blob: 40993dc1f0e40c72d8821948dcaad3039305b364 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Krishna Kumaar Natarajan4e9cf392015-11-20 13:35:05 -08002 * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
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 lim_send_sme_rspMessages.cc contains the functions
30 * for sending SME response/notification messages to applications
31 * above MAC software.
32 * Author: Chandra Modumudi
33 * Date: 02/13/02
34 * History:-
35 * Date Modified by Modification Information
36 * --------------------------------------------------------------------
37 */
38
Anurag Chouhan6d760662016-02-20 16:05:43 +053039#include "qdf_types.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080040#include "wni_api.h"
41#include "sir_common.h"
42#include "ani_global.h"
43
44#include "wni_cfg.h"
45#include "sys_def.h"
46#include "cfg_api.h"
47
48#include "sch_api.h"
49#include "utils_api.h"
50#include "lim_utils.h"
51#include "lim_security_utils.h"
52#include "lim_ser_des_utils.h"
53#include "lim_send_sme_rsp_messages.h"
54#include "lim_ibss_peer_mgmt.h"
55#include "lim_session_utils.h"
56#include "lim_types.h"
57#include "sir_api.h"
Naveen Rawat3b6068c2016-04-14 19:01:06 -070058#include "cds_regdomain.h"
Gupta, Kapil121bf212015-11-25 19:21:29 +053059#include "lim_send_messages.h"
Deepak Dhamdhere13983f22016-05-31 19:06:09 -070060#include "nan_datapath.h"
Sandeep Puligilla7e3e3c52016-09-02 17:54:21 -070061#include "lim_assoc_utils.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080062
63static void lim_handle_join_rsp_status(tpAniSirGlobal mac_ctx,
64 tpPESession session_entry, tSirResultCodes result_code,
65 tpSirSmeJoinRsp sme_join_rsp);
66
67/**
68 * lim_send_sme_rsp() - Send Response to upper layers
69 * @mac_ctx: Pointer to Global MAC structure
70 * @msg_type: Indicates message type
71 * @result_code: Indicates the result of previously issued
72 * eWNI_SME_msg_type_REQ message
73 *
74 * This function is called by lim_process_sme_req_messages() to send
75 * eWNI_SME_START_RSP, eWNI_SME_STOP_BSS_RSP
76 * or eWNI_SME_SWITCH_CHL_RSP messages to applications above MAC
77 * Software.
78 *
79 * Return: None
80 */
81
82void
83lim_send_sme_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type,
84 tSirResultCodes result_code, uint8_t sme_session_id,
85 uint16_t sme_transaction_id)
86{
87 tSirMsgQ msg;
88 tSirSmeRsp *sme_rsp;
89
90 lim_log(mac_ctx, LOG1, FL("Sending message %s with reasonCode %s"),
91 lim_msg_str(msg_type), lim_result_code_str(result_code));
92
Anurag Chouhan600c3a02016-03-01 10:33:54 +053093 sme_rsp = qdf_mem_malloc(sizeof(tSirSmeRsp));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080094 if (NULL == sme_rsp) {
95 /* Buffer not available. Log error */
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053096 QDF_TRACE(QDF_MODULE_ID_PE, LOGP,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080097 FL("call to AllocateMemory failed for eWNI_SME_*_RSP"));
98 return;
99 }
100
101 sme_rsp->messageType = msg_type;
102 sme_rsp->length = sizeof(tSirSmeRsp);
103 sme_rsp->statusCode = result_code;
104
105 sme_rsp->sessionId = sme_session_id;
106 sme_rsp->transactionId = sme_transaction_id;
107
108 msg.type = msg_type;
109 msg.bodyptr = sme_rsp;
110 msg.bodyval = 0;
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +0530111 MTRACE(mac_trace(mac_ctx, TRACE_CODE_TX_SME_MSG,
112 sme_session_id, msg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800113
114#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
115 switch (msg_type) {
116 case eWNI_SME_STOP_BSS_RSP:
117 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_STOP_BSS_RSP_EVENT,
118 NULL, (uint16_t) result_code, 0);
119 break;
120 }
121#endif /* FEATURE_WLAN_DIAG_SUPPORT */
122 lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT);
123}
124
125
126
127/**
128 * lim_send_sme_roc_rsp() - Send Response to SME
129 * @mac_ctx: Pointer to Global MAC structure
130 * @status: Resume link status
131 * @result_code: Result of the ROC request
132 * @sme_session_id: SME sesson Id
133 * @scan_id: Scan Identifier
134 *
135 * This function is called to send ROC rsp
136 * message to SME.
137 *
138 * Return: None
139 */
140void
141lim_send_sme_roc_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type,
142 tSirResultCodes result_code, uint8_t sme_session_id,
143 uint32_t scan_id)
144{
145 tSirMsgQ msg;
146 struct sir_roc_rsp *sme_rsp;
147
148 lim_log(mac_ctx, LOG1,
149 FL("Sending message %s with reasonCode %s scanId %d"),
150 lim_msg_str(msg_type), lim_result_code_str(result_code),
151 scan_id);
152
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530153 sme_rsp = qdf_mem_malloc(sizeof(struct sir_roc_rsp));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800154 if (NULL == sme_rsp) {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530155 QDF_TRACE(QDF_MODULE_ID_PE, LOGP,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800156 FL("call to AllocateMemory failed for eWNI_SME_*_RSP"));
157 return;
158 }
159
160 sme_rsp->message_type = msg_type;
161 sme_rsp->length = sizeof(struct sir_roc_rsp);
162 sme_rsp->status = result_code;
163
164 sme_rsp->session_id = sme_session_id;
165 sme_rsp->scan_id = scan_id;
166
167 msg.type = msg_type;
168 msg.bodyptr = sme_rsp;
169 msg.bodyval = 0;
170 MTRACE(mac_trace_msg_tx(mac_ctx, sme_session_id, msg.type));
171 lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT);
172}
173
174
175/**
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530176 * lim_get_max_rate_flags() - Get rate flags
177 * @mac_ctx: Pointer to global MAC structure
178 * @sta_ds: Pointer to station ds structure
179 *
180 * This function is called to get the rate flags for a connection
181 * from the station ds structure depending on the ht and the vht
182 * channel width supported.
183 *
184 * Return: Returns the populated rate_flags
185 */
186uint32_t lim_get_max_rate_flags(tpAniSirGlobal mac_ctx, tpDphHashNode sta_ds)
187{
188 uint32_t rate_flags = 0;
189
190 if (sta_ds == NULL) {
191 lim_log(mac_ctx, LOGE, FL("sta_ds is NULL"));
192 return rate_flags;
193 }
194
195 if (!sta_ds->mlmStaContext.htCapability &&
196 !sta_ds->mlmStaContext.vhtCapability) {
197 rate_flags |= eHAL_TX_RATE_LEGACY;
198 } else {
199 if (sta_ds->mlmStaContext.vhtCapability) {
200 if (WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ ==
201 sta_ds->vhtSupportedChannelWidthSet) {
202 rate_flags |= eHAL_TX_RATE_VHT80;
203 } else if (WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ ==
204 sta_ds->vhtSupportedChannelWidthSet) {
205 if (sta_ds->htSupportedChannelWidthSet)
206 rate_flags |= eHAL_TX_RATE_VHT40;
207 else
208 rate_flags |= eHAL_TX_RATE_VHT20;
209 }
210 } else if (sta_ds->mlmStaContext.htCapability) {
211 if (sta_ds->htSupportedChannelWidthSet)
212 rate_flags |= eHAL_TX_RATE_HT40;
213 else
214 rate_flags |= eHAL_TX_RATE_HT20;
215 }
216 }
217
218 if (sta_ds->htShortGI20Mhz || sta_ds->htShortGI40Mhz)
219 rate_flags |= eHAL_TX_RATE_SGI;
220
221 return rate_flags;
222}
223
224/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800225 * lim_send_sme_join_reassoc_rsp_after_resume() - Send Response to SME
226 * @mac_ctx Pointer to Global MAC structure
227 * @status Resume link status
228 * @ctx context passed while calling resmune link.
229 * (join response to be sent)
230 *
231 * This function is called to send Join/Reassoc rsp
232 * message to SME after the resume link.
233 *
234 * Return: None
235 */
236static void lim_send_sme_join_reassoc_rsp_after_resume(tpAniSirGlobal mac_ctx,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530237 QDF_STATUS status, uint32_t *ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800238{
239 tSirMsgQ msg;
240 tpSirSmeJoinRsp sme_join_rsp = (tpSirSmeJoinRsp) ctx;
241
242 msg.type = sme_join_rsp->messageType;
243 msg.bodyptr = sme_join_rsp;
244 msg.bodyval = 0;
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +0530245 MTRACE(mac_trace(mac_ctx, TRACE_CODE_TX_SME_MSG, NO_SESSION, msg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800246 lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT);
247}
248
249/**
250 * lim_handle_join_rsp_status() - Handle the response.
251 * @mac_ctx: Pointer to Global MAC structure
252 * @session_entry: PE Session Info
253 * @result_code: Indicates the result of previously issued
254 * eWNI_SME_msgType_REQ message
255 * @sme_join_rsp The received response.
256 *
257 * This function will handle both the success and failure status
258 * of the received response.
259 *
260 * Return: None
261 */
262static void lim_handle_join_rsp_status(tpAniSirGlobal mac_ctx,
263 tpPESession session_entry, tSirResultCodes result_code,
264 tpSirSmeJoinRsp sme_join_rsp)
265{
266#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
267 tSirSmeHTProfile *ht_profile;
268#endif
269 if (result_code == eSIR_SME_SUCCESS) {
270 if (session_entry->beacon != NULL) {
271 sme_join_rsp->beaconLength = session_entry->bcnLen;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530272 qdf_mem_copy(sme_join_rsp->frames,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800273 session_entry->beacon,
274 sme_join_rsp->beaconLength);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530275 qdf_mem_free(session_entry->beacon);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800276 session_entry->beacon = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530277 session_entry->bcnLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800278 lim_log(mac_ctx, LOG1, FL("Beacon=%d"),
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530279 sme_join_rsp->beaconLength);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800280 }
281 if (session_entry->assocReq != NULL) {
282 sme_join_rsp->assocReqLength =
283 session_entry->assocReqLen;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530284 qdf_mem_copy(sme_join_rsp->frames +
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530285 sme_join_rsp->beaconLength,
286 session_entry->assocReq,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800287 sme_join_rsp->assocReqLength);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530288 qdf_mem_free(session_entry->assocReq);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800289 session_entry->assocReq = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530290 session_entry->assocReqLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800291 lim_log(mac_ctx,
292 LOG1, FL("AssocReq=%d"),
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530293 sme_join_rsp->assocReqLength);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800294 }
295 if (session_entry->assocRsp != NULL) {
296 sme_join_rsp->assocRspLength =
297 session_entry->assocRspLen;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530298 qdf_mem_copy(sme_join_rsp->frames +
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530299 sme_join_rsp->beaconLength +
300 sme_join_rsp->assocReqLength,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800301 session_entry->assocRsp,
302 sme_join_rsp->assocRspLength);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530303 qdf_mem_free(session_entry->assocRsp);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800304 session_entry->assocRsp = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530305 session_entry->assocRspLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800306 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800307 if (session_entry->ricData != NULL) {
308 sme_join_rsp->parsedRicRspLen =
309 session_entry->RICDataLen;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530310 qdf_mem_copy(sme_join_rsp->frames +
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530311 sme_join_rsp->beaconLength +
312 sme_join_rsp->assocReqLength +
313 sme_join_rsp->assocRspLength,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800314 session_entry->ricData,
315 sme_join_rsp->parsedRicRspLen);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530316 qdf_mem_free(session_entry->ricData);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800317 session_entry->ricData = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530318 session_entry->RICDataLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800319 lim_log(mac_ctx, LOG1, FL("RicLength=%d"),
320 sme_join_rsp->parsedRicRspLen);
321 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800322#ifdef FEATURE_WLAN_ESE
323 if (session_entry->tspecIes != NULL) {
324 sme_join_rsp->tspecIeLen =
325 session_entry->tspecLen;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530326 qdf_mem_copy(sme_join_rsp->frames +
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530327 sme_join_rsp->beaconLength +
328 sme_join_rsp->assocReqLength +
329 sme_join_rsp->assocRspLength +
330 sme_join_rsp->parsedRicRspLen,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800331 session_entry->tspecIes,
332 sme_join_rsp->tspecIeLen);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530333 qdf_mem_free(session_entry->tspecIes);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800334 session_entry->tspecIes = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530335 session_entry->tspecLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800336 lim_log(mac_ctx, LOG1, FL("ESE-TspecLen=%d"),
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530337 sme_join_rsp->tspecIeLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800338 }
339#endif
340 sme_join_rsp->aid = session_entry->limAID;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800341 lim_log(mac_ctx, LOG1, FL("AssocRsp=%d"),
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530342 sme_join_rsp->assocRspLength);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800343 sme_join_rsp->vht_channel_width =
344 session_entry->ch_width;
345#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
346 if (session_entry->cc_switch_mode !=
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530347 QDF_MCC_TO_SCC_SWITCH_DISABLE) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800348 ht_profile = &sme_join_rsp->HTProfile;
349 ht_profile->htSupportedChannelWidthSet =
350 session_entry->htSupportedChannelWidthSet;
351 ht_profile->htRecommendedTxWidthSet =
352 session_entry->htRecommendedTxWidthSet;
353 ht_profile->htSecondaryChannelOffset =
354 session_entry->htSecondaryChannelOffset;
355 ht_profile->dot11mode = session_entry->dot11mode;
356 ht_profile->htCapability = session_entry->htCapability;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800357 ht_profile->vhtCapability =
358 session_entry->vhtCapability;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800359 ht_profile->apCenterChan = session_entry->ch_center_freq_seg0;
360 ht_profile->apChanWidth = session_entry->ch_width;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800361 }
362#endif
363 } else {
364 if (session_entry->beacon != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530365 qdf_mem_free(session_entry->beacon);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800366 session_entry->beacon = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530367 session_entry->bcnLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800368 }
369 if (session_entry->assocReq != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530370 qdf_mem_free(session_entry->assocReq);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800371 session_entry->assocReq = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530372 session_entry->assocReqLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800373 }
374 if (session_entry->assocRsp != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530375 qdf_mem_free(session_entry->assocRsp);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800376 session_entry->assocRsp = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530377 session_entry->assocRspLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800378 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800379 if (session_entry->ricData != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530380 qdf_mem_free(session_entry->ricData);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800381 session_entry->ricData = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530382 session_entry->RICDataLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800383 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800384#ifdef FEATURE_WLAN_ESE
385 if (session_entry->tspecIes != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530386 qdf_mem_free(session_entry->tspecIes);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800387 session_entry->tspecIes = NULL;
Sreelakshmi Konamki3b8ba612015-12-02 18:13:22 +0530388 session_entry->tspecLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800389 }
390#endif
391 }
392}
Anurag Chouhan5de8d172016-07-13 14:44:28 +0530393
394/**
395 * lim_add_bss_info() - copy data from session entry to join rsp
Selvaraj, Sridhare01e0732016-09-13 12:45:22 +0530396 * @sta_ds: Station dph entry
Anurag Chouhan5de8d172016-07-13 14:44:28 +0530397 * @sme_join_rsp: Join response buffer to be filled up
398 *
399 * Return: None
400 */
Jeff Johnson6db011e2016-10-07 07:31:39 -0700401static void lim_add_bss_info(tpDphHashNode sta_ds, tpSirSmeJoinRsp sme_join_rsp)
Anurag Chouhan5de8d172016-07-13 14:44:28 +0530402{
Selvaraj, Sridhare01e0732016-09-13 12:45:22 +0530403 struct parsed_ies *parsed_ies = &sta_ds->parsed_ies;
404
405 if (parsed_ies->hs20vendor_ie.present)
406 sme_join_rsp->hs20vendor_ie = parsed_ies->hs20vendor_ie;
407 if (parsed_ies->vht_caps.present)
408 sme_join_rsp->vht_caps = parsed_ies->vht_caps;
409 if (parsed_ies->ht_caps.present)
410 sme_join_rsp->ht_caps = parsed_ies->ht_caps;
411 if (parsed_ies->ht_operation.present)
412 sme_join_rsp->ht_operation = parsed_ies->ht_operation;
413 if (parsed_ies->vht_operation.present)
414 sme_join_rsp->vht_operation = parsed_ies->vht_operation;
Anurag Chouhan5de8d172016-07-13 14:44:28 +0530415}
416
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800417/**
418 * lim_send_sme_join_reassoc_rsp() - Send Response to Upper Layers
419 * @mac_ctx: Pointer to Global MAC structure
420 * @msg_type: Indicates message type
421 * @result_code: Indicates the result of previously issued
422 * eWNI_SME_msgType_REQ message
423 * @prot_status_code: Protocol Status Code
424 * @session_entry: PE Session Info
425 * @sme_session_id: SME Session ID
426 * @sme_transaction_id: SME Transaction ID
427 *
428 * This function is called by lim_process_sme_req_messages() to send
429 * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications
430 * above MAC Software.
431 *
432 * Return: None
433 */
434
435void
436lim_send_sme_join_reassoc_rsp(tpAniSirGlobal mac_ctx, uint16_t msg_type,
437 tSirResultCodes result_code, uint16_t prot_status_code,
438 tpPESession session_entry, uint8_t sme_session_id,
439 uint16_t sme_transaction_id)
440{
441 tpSirSmeJoinRsp sme_join_rsp;
442 uint32_t rsp_len;
443 tpDphHashNode sta_ds = NULL;
444#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
445 if (msg_type == eWNI_SME_REASSOC_RSP)
446 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_REASSOC_RSP_EVENT,
447 session_entry, (uint16_t) result_code, 0);
448 else
449 lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_JOIN_RSP_EVENT,
450 session_entry, (uint16_t) result_code, 0);
451#endif /* FEATURE_WLAN_DIAG_SUPPORT */
452
453 lim_log(mac_ctx, LOG1, FL("Sending message %s with reasonCode %s"),
454 lim_msg_str(msg_type), lim_result_code_str(result_code));
455
456 if (session_entry == NULL) {
457 rsp_len = sizeof(tSirSmeJoinRsp);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530458 sme_join_rsp = qdf_mem_malloc(rsp_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800459 if (NULL == sme_join_rsp) {
460 lim_log(mac_ctx, LOGP,
461 FL("Mem Alloc fail - JOIN/REASSOC_RSP"));
462 return;
463 }
464
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800465 sme_join_rsp->beaconLength = 0;
466 sme_join_rsp->assocReqLength = 0;
467 sme_join_rsp->assocRspLength = 0;
468 } else {
469 rsp_len = session_entry->assocReqLen +
470 session_entry->assocRspLen + session_entry->bcnLen +
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800471 session_entry->RICDataLen +
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800472#ifdef FEATURE_WLAN_ESE
473 session_entry->tspecLen +
474#endif
475 sizeof(tSirSmeJoinRsp) - sizeof(uint8_t);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530476 sme_join_rsp = qdf_mem_malloc(rsp_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800477 if (NULL == sme_join_rsp) {
478 lim_log(mac_ctx, LOGP,
479 FL("MemAlloc fail - JOIN/REASSOC_RSP"));
480 return;
481 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800482 if (result_code == eSIR_SME_SUCCESS) {
483 sta_ds = dph_get_hash_entry(mac_ctx,
484 DPH_STA_HASH_INDEX_PEER,
485 &session_entry->dph.dphHashTable);
486 if (sta_ds == NULL) {
487 lim_log(mac_ctx, LOGE,
488 FL("Get Self Sta Entry fail"));
489 } else {
490 /* Pass the peer's staId */
491 sme_join_rsp->staId = sta_ds->staIndex;
492 sme_join_rsp->ucastSig =
493 sta_ds->ucUcastSig;
494 sme_join_rsp->bcastSig =
495 sta_ds->ucBcastSig;
496 sme_join_rsp->timingMeasCap =
497 sta_ds->timingMeasCap;
498#ifdef FEATURE_WLAN_TDLS
499 sme_join_rsp->tdls_prohibited =
500 session_entry->tdls_prohibited;
501 sme_join_rsp->tdls_chan_swit_prohibited =
502 session_entry->tdls_chan_swit_prohibited;
503#endif
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530504 sme_join_rsp->nss = sta_ds->nss;
505 sme_join_rsp->max_rate_flags =
506 lim_get_max_rate_flags(mac_ctx, sta_ds);
Selvaraj, Sridhare01e0732016-09-13 12:45:22 +0530507 lim_add_bss_info(sta_ds, sme_join_rsp);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800508 }
509 }
510 sme_join_rsp->beaconLength = 0;
511 sme_join_rsp->assocReqLength = 0;
512 sme_join_rsp->assocRspLength = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800513 sme_join_rsp->parsedRicRspLen = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800514#ifdef FEATURE_WLAN_ESE
515 sme_join_rsp->tspecIeLen = 0;
516#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800517 lim_handle_join_rsp_status(mac_ctx, session_entry, result_code,
518 sme_join_rsp);
Archana Ramachandran20d2e232016-02-11 16:58:40 -0800519
520 /* Send supported NSS 1x1 to SME */
521 sme_join_rsp->supported_nss_1x1 =
522 session_entry->supported_nss_1x1;
523 lim_log(mac_ctx, LOG1,
524 FL("SME Join Rsp is supported NSS 1X1: %d"),
525 sme_join_rsp->supported_nss_1x1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800526 }
527
528 sme_join_rsp->messageType = msg_type;
529 sme_join_rsp->length = (uint16_t) rsp_len;
530 sme_join_rsp->statusCode = result_code;
531 sme_join_rsp->protStatusCode = prot_status_code;
532
533 sme_join_rsp->sessionId = sme_session_id;
534 sme_join_rsp->transactionId = sme_transaction_id;
535
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530536 lim_send_sme_join_reassoc_rsp_after_resume(mac_ctx, QDF_STATUS_SUCCESS,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800537 (uint32_t *)sme_join_rsp);
538}
539
540/**
541 * lim_send_sme_start_bss_rsp()
542 *
543 ***FUNCTION:
544 * This function is called to send eWNI_SME_START_BSS_RSP
545 * message to applications above MAC Software.
546 *
547 ***PARAMS:
548 *
549 ***LOGIC:
550 *
551 ***ASSUMPTIONS:
552 * NA
553 *
554 ***NOTE:
555 * NA
556 *
557 * @param pMac Pointer to Global MAC structure
558 * @param msgType Indicates message type
559 * @param resultCode Indicates the result of previously issued
560 * eWNI_SME_msgType_REQ message
561 *
562 * @return None
563 */
564
565void
566lim_send_sme_start_bss_rsp(tpAniSirGlobal pMac,
567 uint16_t msgType, tSirResultCodes resultCode,
568 tpPESession psessionEntry, uint8_t smesessionId,
569 uint16_t smetransactionId)
570{
571
572 uint16_t size = 0;
573 tSirMsgQ mmhMsg;
574 tSirSmeStartBssRsp *pSirSmeRsp;
575 uint16_t ieLen;
576 uint16_t ieOffset, curLen;
577
578 PELOG1(lim_log(pMac, LOG1, FL("Sending message %s with reasonCode %s"),
579 lim_msg_str(msgType), lim_result_code_str(resultCode));
580 )
581
582 size = sizeof(tSirSmeStartBssRsp);
583
584 if (psessionEntry == NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530585 pSirSmeRsp = qdf_mem_malloc(size);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800586 if (NULL == pSirSmeRsp) {
587 /* / Buffer not available. Log error */
588 lim_log(pMac, LOGP,
589 FL
590 ("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
591 return;
592 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800593 } else {
594 /* subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID */
595 ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
596 ieLen = psessionEntry->schBeaconOffsetBegin
597 + psessionEntry->schBeaconOffsetEnd - ieOffset;
598 /* calculate the memory size to allocate */
599 size += ieLen;
600
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530601 pSirSmeRsp = qdf_mem_malloc(size);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800602 if (NULL == pSirSmeRsp) {
603 /* / Buffer not available. Log error */
604 lim_log(pMac, LOGP,
605 FL
606 ("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
607
608 return;
609 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800610 size = sizeof(tSirSmeStartBssRsp);
611 if (resultCode == eSIR_SME_SUCCESS) {
612
613 sir_copy_mac_addr(pSirSmeRsp->bssDescription.bssId,
614 psessionEntry->bssId);
615
616 /* Read beacon interval from session */
617 pSirSmeRsp->bssDescription.beaconInterval =
618 (uint16_t) psessionEntry->beaconParams.
619 beaconInterval;
620 pSirSmeRsp->bssType = psessionEntry->bssType;
621
622 if (cfg_get_capability_info
623 (pMac, &pSirSmeRsp->bssDescription.capabilityInfo,
624 psessionEntry)
625 != eSIR_SUCCESS)
626 lim_log(pMac, LOGP,
627 FL
628 ("could not retrieve Capabilities value"));
629
630 lim_get_phy_mode(pMac,
631 (uint32_t *) &pSirSmeRsp->bssDescription.
632 nwType, psessionEntry);
633
634 pSirSmeRsp->bssDescription.channelId =
635 psessionEntry->currentOperChannel;
636
Deepak Dhamdheree2dd5442016-05-27 15:05:51 -0700637 if (!LIM_IS_NDI_ROLE(psessionEntry)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800638 curLen = psessionEntry->schBeaconOffsetBegin - ieOffset;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530639 qdf_mem_copy((uint8_t *) &pSirSmeRsp->bssDescription.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800640 ieFields,
641 psessionEntry->pSchBeaconFrameBegin +
642 ieOffset, (uint32_t) curLen);
643
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530644 qdf_mem_copy(((uint8_t *) &pSirSmeRsp->bssDescription.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800645 ieFields) + curLen,
646 psessionEntry->pSchBeaconFrameEnd,
647 (uint32_t) psessionEntry->
648 schBeaconOffsetEnd);
649
Abhishek Singh34a4d862016-10-26 16:01:51 +0530650 pSirSmeRsp->bssDescription.length = (uint16_t)
651 (offsetof(tSirBssDescription, ieFields[0])
652 - sizeof(pSirSmeRsp->bssDescription.length)
653 + ieLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800654 /* This is the size of the message, subtracting the size of the pointer to ieFields */
655 size += ieLen - sizeof(uint32_t);
Deepak Dhamdheree2dd5442016-05-27 15:05:51 -0700656 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800657#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
658 if (psessionEntry->cc_switch_mode
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530659 != QDF_MCC_TO_SCC_SWITCH_DISABLE) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800660 pSirSmeRsp->HTProfile.
661 htSupportedChannelWidthSet =
662 psessionEntry->htSupportedChannelWidthSet;
663 pSirSmeRsp->HTProfile.htRecommendedTxWidthSet =
664 psessionEntry->htRecommendedTxWidthSet;
665 pSirSmeRsp->HTProfile.htSecondaryChannelOffset =
666 psessionEntry->htSecondaryChannelOffset;
667 pSirSmeRsp->HTProfile.dot11mode =
668 psessionEntry->dot11mode;
669 pSirSmeRsp->HTProfile.htCapability =
670 psessionEntry->htCapability;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800671 pSirSmeRsp->HTProfile.vhtCapability =
672 psessionEntry->vhtCapability;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800673 pSirSmeRsp->HTProfile.apCenterChan =
674 psessionEntry->ch_center_freq_seg0;
675 pSirSmeRsp->HTProfile.apChanWidth =
676 psessionEntry->ch_width;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800677 }
678#endif
679 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800680 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800681 pSirSmeRsp->messageType = msgType;
682 pSirSmeRsp->length = size;
683
684 /* Update SME session Id and transaction Id */
685 pSirSmeRsp->sessionId = smesessionId;
686 pSirSmeRsp->transactionId = smetransactionId;
687 pSirSmeRsp->statusCode = resultCode;
688 if (psessionEntry != NULL)
689 pSirSmeRsp->staId = psessionEntry->staId; /* else it will be always zero smeRsp StaID = 0 */
690
691 mmhMsg.type = msgType;
692 mmhMsg.bodyptr = pSirSmeRsp;
693 mmhMsg.bodyval = 0;
694 if (psessionEntry == NULL) {
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +0530695 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
696 NO_SESSION, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800697 } else {
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +0530698 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
699 psessionEntry->peSessionId, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800700 }
701#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
702 lim_diag_event_report(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT,
703 psessionEntry, (uint16_t) resultCode, 0);
704#endif /* FEATURE_WLAN_DIAG_SUPPORT */
705
706 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
707} /*** end lim_send_sme_start_bss_rsp() ***/
708
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800709/**
710 * lim_send_sme_scan_rsp() - Send scan response to SME
711 * @pMac: Pointer to Global MAC structure
712 * @length: Indicates length of message
713 * @resultCode: Indicates the result of previously issued
714 * eWNI_SME_SCAN_REQ message
715 * @scan_id: scan identifier
716 *
717 * This function is called by lim_process_sme_req_messages() to send
718 * eWNI_SME_SCAN_RSP message to applications above MAC
719 *
720 * return: None
721 */
722
723void
724lim_send_sme_scan_rsp(tpAniSirGlobal pMac, tSirResultCodes resultCode,
725 uint8_t smesessionId, uint16_t smetranscationId,
726 uint32_t scan_id)
727{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800728 lim_post_sme_scan_rsp_message(pMac, resultCode, smesessionId,
729 smetranscationId, scan_id);
730}
731
732/**
733 * lim_post_sme_scan_rsp_message()
734 *
735 ***FUNCTION:
736 * This function is called by lim_send_sme_scan_rsp() to send
737 * eWNI_SME_SCAN_RSP message with failed result code
738 *
739 ***NOTE:
740 * NA
741 *
742 * @param pMac Pointer to Global MAC structure
743 * @param length Indicates length of message
744 * @param resultCode failed result code
745 *
746 * @return None
747 */
748
749void
750lim_post_sme_scan_rsp_message(tpAniSirGlobal pMac,
751 tSirResultCodes resultCode, uint8_t smesessionId,
752 uint16_t smetransactionId,
753 uint32_t scan_id)
754{
755 tpSirSmeScanRsp pSirSmeScanRsp;
756 tSirMsgQ mmhMsg;
757
758 lim_log(pMac, LOG1, FL("send SME_SCAN_RSP (reasonCode %s)."),
759 lim_result_code_str(resultCode));
760
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530761 pSirSmeScanRsp = qdf_mem_malloc(sizeof(tSirSmeScanRsp));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800762 if (NULL == pSirSmeScanRsp) {
763 lim_log(pMac, LOGP,
764 FL("AllocateMemory failed for eWNI_SME_SCAN_RSP"));
765 return;
766 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800767
768 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
769 pSirSmeScanRsp->statusCode = resultCode;
770
771 /*Update SME session Id and transaction Id */
772 pSirSmeScanRsp->sessionId = smesessionId;
773 pSirSmeScanRsp->transcationId = smetransactionId;
774 pSirSmeScanRsp->scan_id = scan_id;
775
776 mmhMsg.type = eWNI_SME_SCAN_RSP;
777 mmhMsg.bodyptr = pSirSmeScanRsp;
778 mmhMsg.bodyval = 0;
779
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +0530780 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800781#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
782 lim_diag_event_report(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL,
783 (uint16_t) resultCode, 0);
784#endif /* FEATURE_WLAN_DIAG_SUPPORT */
785
786 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
787 return;
788
789} /*** lim_post_sme_scan_rsp_message ***/
790
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800791void lim_send_sme_disassoc_deauth_ntf(tpAniSirGlobal pMac,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530792 QDF_STATUS status, uint32_t *pCtx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800793{
794 tSirMsgQ mmhMsg;
795 tSirMsgQ *pMsg = (tSirMsgQ *) pCtx;
796
797 mmhMsg.type = pMsg->type;
798 mmhMsg.bodyptr = pMsg;
799 mmhMsg.bodyval = 0;
800
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +0530801 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800802
803 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
804}
805
806/**
807 * lim_send_sme_disassoc_ntf()
808 *
809 ***FUNCTION:
810 * This function is called by limProcessSmeMessages() to send
811 * eWNI_SME_DISASSOC_RSP/IND message to host
812 *
813 ***PARAMS:
814 *
815 ***LOGIC:
816 *
817 ***ASSUMPTIONS:
818 * NA
819 *
820 ***NOTE:
821 * This function is used for sending eWNI_SME_DISASSOC_CNF,
822 * or eWNI_SME_DISASSOC_IND to host depending on
823 * disassociation trigger.
824 *
825 * @param peerMacAddr Indicates the peer MAC addr to which
826 * disassociate was initiated
827 * @param reasonCode Indicates the reason for Disassociation
828 * @param disassocTrigger Indicates the trigger for Disassociation
829 * @param aid Indicates the STAID. This parameter is
830 * present only on AP.
831 *
832 * @return None
833 */
834void
835lim_send_sme_disassoc_ntf(tpAniSirGlobal pMac,
836 tSirMacAddr peerMacAddr,
837 tSirResultCodes reasonCode,
838 uint16_t disassocTrigger,
839 uint16_t aid,
840 uint8_t smesessionId,
841 uint16_t smetransactionId, tpPESession psessionEntry)
842{
843
844 uint8_t *pBuf;
845 tSirSmeDisassocRsp *pSirSmeDisassocRsp;
846 tSirSmeDisassocInd *pSirSmeDisassocInd;
Sandeep Puligilla7e3e3c52016-09-02 17:54:21 -0700847 uint32_t *pMsg = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800848 bool failure = false;
Sandeep Puligilla7e3e3c52016-09-02 17:54:21 -0700849 tpPESession session = NULL;
850 uint16_t i, assoc_id;
851 tpDphHashNode sta_ds = NULL;
Hanumantha Reddy Pothula3e5d6aa2016-09-08 15:21:54 +0530852 struct sir_sme_discon_done_ind *sir_sme_dis_ind;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800853
854 lim_log(pMac, LOG1, FL("Disassoc Ntf with trigger : %d reasonCode: %d"),
855 disassocTrigger, reasonCode);
856
857 switch (disassocTrigger) {
Sandeep Puligilla7e3e3c52016-09-02 17:54:21 -0700858 case eLIM_DUPLICATE_ENTRY:
859 /*
860 * Duplicate entry is removed at LIM.
861 * Initiate new entry for other session
862 */
863 lim_log(pMac, LOG1,
864 FL("Rcvd eLIM_DUPLICATE_ENTRY for " MAC_ADDRESS_STR),
865 MAC_ADDR_ARRAY(peerMacAddr));
866
867 for (i = 0; i < pMac->lim.maxBssId; i++) {
868 if ((&pMac->lim.gpSession[i] != NULL) &&
869 (pMac->lim.gpSession[i].valid) &&
870 (pMac->lim.gpSession[i].pePersona ==
871 QDF_SAP_MODE)) {
872 /* Find the sta ds entry in another session */
873 session = &pMac->lim.gpSession[i];
874 sta_ds = dph_lookup_hash_entry(pMac,
875 peerMacAddr, &assoc_id,
876 &session->dph.dphHashTable);
877 }
878 }
879 if (sta_ds
880#ifdef WLAN_FEATURE_11W
881 && (!sta_ds->rmfEnabled)
882#endif
883 ) {
884 if (lim_add_sta(pMac, sta_ds, false, session) !=
885 eSIR_SUCCESS)
886 lim_log(pMac, LOGE,
887 FL("could not Add STA with assocId=%d"),
888 sta_ds->assocId);
889 }
890 failure = true;
891 break;
892
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800893 case eLIM_HOST_DISASSOC:
894 /**
895 * Disassociation response due to
896 * host triggered disassociation
897 */
898
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530899 pSirSmeDisassocRsp = qdf_mem_malloc(sizeof(tSirSmeDisassocRsp));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800900 if (NULL == pSirSmeDisassocRsp) {
901 /* Log error */
902 lim_log(pMac, LOGP, FL("Memory allocation failed"));
903 failure = true;
904 goto error;
905 }
906 lim_log(pMac, LOG1, FL("send eWNI_SME_DISASSOC_RSP with "
907 "retCode: %d for " MAC_ADDRESS_STR),
908 reasonCode, MAC_ADDR_ARRAY(peerMacAddr));
909 pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
910 pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
911 /* sessionId */
912 pBuf = (uint8_t *) &pSirSmeDisassocRsp->sessionId;
913 *pBuf = smesessionId;
914 pBuf++;
915
916 /* transactionId */
917 lim_copy_u16(pBuf, smetransactionId);
918 pBuf += sizeof(uint16_t);
919
920 /* statusCode */
921 lim_copy_u32(pBuf, reasonCode);
922 pBuf += sizeof(tSirResultCodes);
923
924 /* peerMacAddr */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530925 qdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800926 pBuf += sizeof(tSirMacAddr);
927
928 /* Clear Station Stats */
929 /* for sta, it is always 1, IBSS is handled at halInitSta */
930
931#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
932
933 lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
934 psessionEntry, (uint16_t) reasonCode, 0);
935#endif
936 pMsg = (uint32_t *) pSirSmeDisassocRsp;
937 break;
938
Hanumantha Reddy Pothula3e5d6aa2016-09-08 15:21:54 +0530939 case eLIM_PEER_ENTITY_DISASSOC:
940 case eLIM_LINK_MONITORING_DISASSOC:
941 sir_sme_dis_ind =
942 qdf_mem_malloc(sizeof(*sir_sme_dis_ind));
943 if (!sir_sme_dis_ind) {
944 lim_log(pMac, LOGE,
945 FL("call to AllocateMemory failed for disconnect indication"));
946 return;
947 }
948
949 lim_log(pMac, LOG1,
950 FL("send eWNI_SME_DISCONNECT_DONE_IND with retCode: %d"),
951 reasonCode);
952
953 sir_sme_dis_ind->message_type =
954 eWNI_SME_DISCONNECT_DONE_IND;
955 sir_sme_dis_ind->length =
956 sizeof(*sir_sme_dis_ind);
957 qdf_mem_copy(sir_sme_dis_ind->peer_mac, peerMacAddr,
958 sizeof(tSirMacAddr));
959 sir_sme_dis_ind->session_id = smesessionId;
960 sir_sme_dis_ind->reason_code = reasonCode;
961 pMsg = (uint32_t *)sir_sme_dis_ind;
962
963 break;
964
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800965 default:
966 /**
967 * Disassociation indication due to Disassociation
968 * frame reception from peer entity or due to
969 * loss of link with peer entity.
970 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530971 pSirSmeDisassocInd = qdf_mem_malloc(sizeof(tSirSmeDisassocInd));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800972 if (NULL == pSirSmeDisassocInd) {
973 /* Log error */
974 lim_log(pMac, LOGP, FL("Memory allocation failed"));
975 failure = true;
976 goto error;
977 }
978 lim_log(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with "
979 "retCode: %d for " MAC_ADDRESS_STR),
980 reasonCode, MAC_ADDR_ARRAY(peerMacAddr));
981 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
982 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
983
984 /* Update SME session Id and Transaction Id */
985 pSirSmeDisassocInd->sessionId = smesessionId;
986 pSirSmeDisassocInd->transactionId = smetransactionId;
987 pSirSmeDisassocInd->reasonCode = reasonCode;
988 pBuf = (uint8_t *) &pSirSmeDisassocInd->statusCode;
989
990 lim_copy_u32(pBuf, reasonCode);
991 pBuf += sizeof(tSirResultCodes);
992
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530993 qdf_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800994 pBuf += sizeof(tSirMacAddr);
995
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530996 qdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800997
998#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
999 lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1000 psessionEntry, (uint16_t) reasonCode, 0);
1001#endif
1002 pMsg = (uint32_t *) pSirSmeDisassocInd;
1003
1004 break;
1005 }
1006
1007error:
1008 /* Delete the PE session Created */
Rajeev Kumarcf835a02016-04-15 15:01:31 -07001009 if ((psessionEntry != NULL) && LIM_IS_STA_ROLE(psessionEntry))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001010 pe_delete_session(pMac, psessionEntry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001011
1012 if (false == failure)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301013 lim_send_sme_disassoc_deauth_ntf(pMac, QDF_STATUS_SUCCESS,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001014 (uint32_t *) pMsg);
1015} /*** end lim_send_sme_disassoc_ntf() ***/
1016
1017/** -----------------------------------------------------------------
1018 \brief lim_send_sme_disassoc_ind() - sends SME_DISASSOC_IND
1019
1020 After receiving disassociation frame from peer entity, this
1021 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1022 reason code.
1023
1024 \param pMac - global mac structure
1025 \param pStaDs - station dph hash node
1026 \return none
1027 \sa
1028 ----------------------------------------------------------------- */
1029void
1030lim_send_sme_disassoc_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
1031 tpPESession psessionEntry)
1032{
1033 tSirMsgQ mmhMsg;
1034 tSirSmeDisassocInd *pSirSmeDisassocInd;
1035
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301036 pSirSmeDisassocInd = qdf_mem_malloc(sizeof(tSirSmeDisassocInd));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001037 if (NULL == pSirSmeDisassocInd) {
1038 lim_log(pMac, LOGP,
1039 FL("AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
1040 return;
1041 }
1042
1043 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1044 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1045
1046 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1047 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
Padma, Santhosh Kumar02289212016-09-30 13:30:08 +05301048 pSirSmeDisassocInd->statusCode = eSIR_SME_DEAUTH_STATUS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001049 pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
1050
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301051 qdf_mem_copy(pSirSmeDisassocInd->bssid.bytes, psessionEntry->bssId,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301052 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001053
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301054 qdf_mem_copy(pSirSmeDisassocInd->peer_macaddr.bytes, pStaDs->staAddr,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301055 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001056
1057 pSirSmeDisassocInd->staId = pStaDs->staIndex;
1058
1059 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1060 mmhMsg.bodyptr = pSirSmeDisassocInd;
1061 mmhMsg.bodyval = 0;
1062
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301063 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
1064 psessionEntry->peSessionId, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001065#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
1066 lim_diag_event_report(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry,
1067 0, (uint16_t) pStaDs->mlmStaContext.disassocReason);
1068#endif /* FEATURE_WLAN_DIAG_SUPPORT */
1069
1070 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1071
1072} /*** end lim_send_sme_disassoc_ind() ***/
1073
1074/** -----------------------------------------------------------------
1075 \brief lim_send_sme_deauth_ind() - sends SME_DEAUTH_IND
1076
1077 After receiving deauthentication frame from peer entity, this
1078 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1079 reason code.
1080
1081 \param pMac - global mac structure
1082 \param pStaDs - station dph hash node
1083 \return none
1084 \sa
1085 ----------------------------------------------------------------- */
1086void
1087lim_send_sme_deauth_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
1088 tpPESession psessionEntry)
1089{
1090 tSirMsgQ mmhMsg;
1091 tSirSmeDeauthInd *pSirSmeDeauthInd;
1092
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301093 pSirSmeDeauthInd = qdf_mem_malloc(sizeof(tSirSmeDeauthInd));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001094 if (NULL == pSirSmeDeauthInd) {
1095 lim_log(pMac, LOGP,
1096 FL("AllocateMemory failed for eWNI_SME_DEAUTH_IND "));
1097 return;
1098 }
1099
1100 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1101 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
1102
1103 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1104 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
1105 if (eSIR_INFRA_AP_MODE == psessionEntry->bssType) {
1106 pSirSmeDeauthInd->statusCode =
1107 (tSirResultCodes) pStaDs->mlmStaContext.cleanupTrigger;
1108 } else {
1109 /* Need to indicatet he reascon code over the air */
1110 pSirSmeDeauthInd->statusCode =
1111 (tSirResultCodes) pStaDs->mlmStaContext.disassocReason;
1112 }
1113 /* BSSID */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301114 qdf_mem_copy(pSirSmeDeauthInd->bssid.bytes, psessionEntry->bssId,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301115 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001116 /* peerMacAddr */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301117 qdf_mem_copy(pSirSmeDeauthInd->peer_macaddr.bytes, pStaDs->staAddr,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301118 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001119 pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
1120
1121 pSirSmeDeauthInd->staId = pStaDs->staIndex;
Kiran Kumar Lokere37d3aa22015-11-03 14:58:26 -08001122 if (eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON ==
1123 pStaDs->mlmStaContext.disassocReason)
1124 pSirSmeDeauthInd->rssi = pStaDs->del_sta_ctx_rssi;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001125
1126 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1127 mmhMsg.bodyptr = pSirSmeDeauthInd;
1128 mmhMsg.bodyval = 0;
1129
1130 MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type));
1131#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
1132 lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry,
1133 0, pStaDs->mlmStaContext.cleanupTrigger);
1134#endif /* FEATURE_WLAN_DIAG_SUPPORT */
1135
1136 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1137 return;
1138} /*** end lim_send_sme_deauth_ind() ***/
1139
1140#ifdef FEATURE_WLAN_TDLS
1141/**
1142 * lim_send_sme_tdls_del_sta_ind()
1143 *
1144 ***FUNCTION:
1145 * This function is called to send the TDLS STA context deletion to SME.
1146 *
1147 ***LOGIC:
1148 *
1149 ***ASSUMPTIONS:
1150 *
1151 ***NOTE:
1152 * NA
1153 *
1154 * @param pMac - Pointer to global MAC structure
1155 * @param pStaDs - Pointer to internal STA Datastructure
1156 * @param psessionEntry - Pointer to the session entry
1157 * @param reasonCode - Reason for TDLS sta deletion
1158 * @return None
1159 */
1160void
1161lim_send_sme_tdls_del_sta_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
1162 tpPESession psessionEntry, uint16_t reasonCode)
1163{
1164 tSirMsgQ mmhMsg;
1165 tSirTdlsDelStaInd *pSirTdlsDelStaInd;
1166
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301167 pSirTdlsDelStaInd = qdf_mem_malloc(sizeof(tSirTdlsDelStaInd));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001168 if (NULL == pSirTdlsDelStaInd) {
1169 lim_log(pMac, LOGP,
1170 FL
1171 ("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND "));
1172 return;
1173 }
1174 /* messageType */
1175 pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND;
1176 pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd);
1177
1178 /* sessionId */
1179 pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId;
1180
1181 /* peerMacAddr */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301182 qdf_mem_copy(pSirTdlsDelStaInd->peermac.bytes, pStaDs->staAddr,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301183 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001184
1185 /* staId */
1186 lim_copy_u16((uint8_t *) (&pSirTdlsDelStaInd->staId),
1187 (uint16_t) pStaDs->staIndex);
1188
1189 /* reasonCode */
1190 lim_copy_u16((uint8_t *) (&pSirTdlsDelStaInd->reasonCode), reasonCode);
1191
1192 mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND;
1193 mmhMsg.bodyptr = pSirTdlsDelStaInd;
1194 mmhMsg.bodyval = 0;
1195
1196 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1197 return;
1198} /*** end lim_send_sme_tdls_del_sta_ind() ***/
1199
1200/**
1201 * lim_send_sme_tdls_delete_all_peer_ind()
1202 *
1203 ***FUNCTION:
1204 * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND
1205 * message to SME.
1206 *
1207 ***LOGIC:
1208 *
1209 ***ASSUMPTIONS:
1210 *
1211 ***NOTE:
1212 * NA
1213 *
1214 * @param pMac - Pointer to global MAC structure
1215 * @param psessionEntry - Pointer to the session entry
1216 * @return None
1217 */
1218void
1219lim_send_sme_tdls_delete_all_peer_ind(tpAniSirGlobal pMac, tpPESession psessionEntry)
1220{
1221 tSirMsgQ mmhMsg;
1222 tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd;
1223
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301224 pSirTdlsDelAllPeerInd = qdf_mem_malloc(sizeof(tSirTdlsDelAllPeerInd));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001225 if (NULL == pSirTdlsDelAllPeerInd) {
1226 lim_log(pMac, LOGP,
1227 FL
1228 ("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND"));
1229 return;
1230 }
1231 /* messageType */
1232 pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1233 pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd);
1234
1235 /* sessionId */
1236 pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId;
1237
1238 mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1239 mmhMsg.bodyptr = pSirTdlsDelAllPeerInd;
1240 mmhMsg.bodyval = 0;
1241
1242 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1243 return;
1244} /*** end lim_send_sme_tdls_delete_all_peer_ind() ***/
1245
1246/**
1247 * lim_send_sme_mgmt_tx_completion()
1248 *
1249 ***FUNCTION:
1250 * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND
1251 * message to SME.
1252 *
1253 ***LOGIC:
1254 *
1255 ***ASSUMPTIONS:
1256 *
1257 ***NOTE:
1258 * NA
1259 *
1260 * @param pMac - Pointer to global MAC structure
1261 * @param psessionEntry - Pointer to the session entry
1262 * @param txCompleteStatus - TX Complete Status of Mgmt Frames
1263 * @return None
1264 */
1265void
1266lim_send_sme_mgmt_tx_completion(tpAniSirGlobal pMac,
1267 tpPESession psessionEntry, uint32_t txCompleteStatus)
1268{
1269 tSirMsgQ mmhMsg;
1270 tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd;
1271
1272 pSirMgmtTxCompletionInd =
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301273 qdf_mem_malloc(sizeof(tSirMgmtTxCompletionInd));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001274 if (NULL == pSirMgmtTxCompletionInd) {
1275 lim_log(pMac, LOGP,
1276 FL
1277 ("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"));
1278 return;
1279 }
1280 /* messageType */
1281 pSirMgmtTxCompletionInd->messageType =
1282 eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1283 pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
1284
1285 /* sessionId */
1286 pSirMgmtTxCompletionInd->sessionId = psessionEntry->smeSessionId;
1287
1288 pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
1289
1290 mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1291 mmhMsg.bodyptr = pSirMgmtTxCompletionInd;
1292 mmhMsg.bodyval = 0;
1293
1294 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1295 return;
1296} /*** end lim_send_sme_tdls_delete_all_peer_ind() ***/
1297
1298void lim_send_sme_tdls_event_notify(tpAniSirGlobal pMac, uint16_t msgType,
1299 void *events)
1300{
1301 tSirMsgQ mmhMsg;
1302
1303 switch (msgType) {
1304 case SIR_HAL_TDLS_SHOULD_DISCOVER:
1305 mmhMsg.type = eWNI_SME_TDLS_SHOULD_DISCOVER;
1306 break;
1307 case SIR_HAL_TDLS_SHOULD_TEARDOWN:
1308 mmhMsg.type = eWNI_SME_TDLS_SHOULD_TEARDOWN;
1309 break;
1310 case SIR_HAL_TDLS_PEER_DISCONNECTED:
1311 mmhMsg.type = eWNI_SME_TDLS_PEER_DISCONNECTED;
1312 break;
Kabilan Kannan14ec97f2016-05-16 23:48:25 -07001313 case SIR_HAL_TDLS_CONNECTION_TRACKER_NOTIFICATION:
1314 mmhMsg.type = eWNI_SME_TDLS_CONNECTION_TRACKER_NOTIFICATION;
1315 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001316 }
1317
1318 mmhMsg.bodyptr = events;
1319 mmhMsg.bodyval = 0;
1320 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1321 return;
1322}
1323#endif /* FEATURE_WLAN_TDLS */
1324
1325/**
1326 * lim_send_sme_deauth_ntf()
1327 *
1328 ***FUNCTION:
1329 * This function is called by limProcessSmeMessages() to send
1330 * eWNI_SME_DISASSOC_RSP/IND message to host
1331 *
1332 ***PARAMS:
1333 *
1334 ***LOGIC:
1335 *
1336 ***ASSUMPTIONS:
1337 * NA
1338 *
1339 ***NOTE:
1340 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1341 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1342 *
1343 * @param peerMacAddr Indicates the peer MAC addr to which
1344 * deauthentication was initiated
1345 * @param reasonCode Indicates the reason for Deauthetication
1346 * @param deauthTrigger Indicates the trigger for Deauthetication
1347 * @param aid Indicates the STAID. This parameter is present
1348 * only on AP.
1349 *
1350 * @return None
1351 */
1352void
1353lim_send_sme_deauth_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
1354 tSirResultCodes reasonCode, uint16_t deauthTrigger,
1355 uint16_t aid, uint8_t smesessionId,
1356 uint16_t smetransactionId)
1357{
1358 uint8_t *pBuf;
1359 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1360 tSirSmeDeauthInd *pSirSmeDeauthInd;
1361 tpPESession psessionEntry;
1362 uint8_t sessionId;
1363 uint32_t *pMsg;
Hanumantha Reddy Pothula3e5d6aa2016-09-08 15:21:54 +05301364 struct sir_sme_discon_done_ind *sir_sme_dis_ind;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001365
1366 psessionEntry = pe_find_session_by_bssid(pMac, peerMacAddr, &sessionId);
1367 switch (deauthTrigger) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001368 case eLIM_HOST_DEAUTH:
1369 /**
1370 * Deauthentication response to host triggered
1371 * deauthentication.
1372 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301373 pSirSmeDeauthRsp = qdf_mem_malloc(sizeof(tSirSmeDeauthRsp));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001374 if (NULL == pSirSmeDeauthRsp) {
1375 /* Log error */
1376 lim_log(pMac, LOGP,
1377 FL
1378 ("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"));
1379
1380 return;
1381 }
1382 lim_log(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
1383 "retCode: %d for" MAC_ADDRESS_STR),
1384 reasonCode, MAC_ADDR_ARRAY(peerMacAddr));
1385 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1386 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
1387 pSirSmeDeauthRsp->statusCode = reasonCode;
1388 pSirSmeDeauthRsp->sessionId = smesessionId;
1389 pSirSmeDeauthRsp->transactionId = smetransactionId;
1390
Srinivas Girigowda9cf95c52016-01-04 16:17:15 -08001391 pBuf = (uint8_t *) pSirSmeDeauthRsp->peer_macaddr.bytes;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301392 qdf_mem_copy(pBuf, peerMacAddr, sizeof(tSirMacAddr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001393
1394#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
1395 lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1396 psessionEntry, 0, (uint16_t) reasonCode);
1397#endif
1398 pMsg = (uint32_t *) pSirSmeDeauthRsp;
1399
1400 break;
1401
Hanumantha Reddy Pothula3e5d6aa2016-09-08 15:21:54 +05301402 case eLIM_PEER_ENTITY_DEAUTH:
1403 case eLIM_LINK_MONITORING_DEAUTH:
1404 sir_sme_dis_ind =
1405 qdf_mem_malloc(sizeof(*sir_sme_dis_ind));
1406 if (!sir_sme_dis_ind) {
1407 lim_log(pMac, LOGE,
1408 FL("call to AllocateMemory failed for disconnect indication"));
1409 return;
1410 }
1411
1412 lim_log(pMac, LOG1,
1413 FL("send eWNI_SME_DISCONNECT_DONE_IND withretCode: %d"),
1414 reasonCode);
1415
1416 sir_sme_dis_ind->message_type =
1417 eWNI_SME_DISCONNECT_DONE_IND;
1418 sir_sme_dis_ind->length =
1419 sizeof(*sir_sme_dis_ind);
1420 sir_sme_dis_ind->session_id = smesessionId;
1421 sir_sme_dis_ind->reason_code = reasonCode;
1422 qdf_mem_copy(sir_sme_dis_ind->peer_mac, peerMacAddr,
1423 ETH_ALEN);
1424 pMsg = (uint32_t *)sir_sme_dis_ind;
1425
1426 break;
1427
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001428 default:
1429 /**
1430 * Deauthentication indication due to Deauthentication
1431 * frame reception from peer entity or due to
1432 * loss of link with peer entity.
1433 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301434 pSirSmeDeauthInd = qdf_mem_malloc(sizeof(tSirSmeDeauthInd));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001435 if (NULL == pSirSmeDeauthInd) {
1436 /* Log error */
1437 lim_log(pMac, LOGP,
1438 FL
1439 ("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind"));
1440
1441 return;
1442 }
1443 lim_log(pMac, LOG1, FL("send eWNI_SME_DEAUTH_IND with "
1444 "retCode: %d for " MAC_ADDRESS_STR),
1445 reasonCode, MAC_ADDR_ARRAY(peerMacAddr));
1446 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1447 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
1448 pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
1449
1450 /* sessionId */
1451 pBuf = (uint8_t *) &pSirSmeDeauthInd->sessionId;
1452 *pBuf++ = smesessionId;
1453
1454 /* transaction ID */
1455 lim_copy_u16(pBuf, smetransactionId);
1456 pBuf += sizeof(uint16_t);
1457
1458 /* status code */
1459 lim_copy_u32(pBuf, reasonCode);
1460 pBuf += sizeof(tSirResultCodes);
1461
1462 /* bssId */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301463 qdf_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001464 pBuf += sizeof(tSirMacAddr);
1465
1466 /* peerMacAddr */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301467 qdf_mem_copy(pSirSmeDeauthInd->peer_macaddr.bytes, peerMacAddr,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301468 QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001469
1470#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
1471 lim_diag_event_report(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1472 psessionEntry, 0, (uint16_t) reasonCode);
1473#endif /* FEATURE_WLAN_DIAG_SUPPORT */
1474 pMsg = (uint32_t *) pSirSmeDeauthInd;
1475
1476 break;
1477 }
1478
1479 /*Delete the PE session created */
1480 if (psessionEntry != NULL) {
1481 pe_delete_session(pMac, psessionEntry);
1482 }
1483
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301484 lim_send_sme_disassoc_deauth_ntf(pMac, QDF_STATUS_SUCCESS,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001485 (uint32_t *) pMsg);
1486
1487} /*** end lim_send_sme_deauth_ntf() ***/
1488
1489/**
1490 * lim_send_sme_wm_status_change_ntf() - Send Notification
1491 * @mac_ctx: Global MAC Context
1492 * @status_change_code: Indicates the change in the wireless medium.
1493 * @status_change_info: Indicates the information associated with
1494 * change in the wireless medium.
1495 * @info_len: Indicates the length of status change information
1496 * being sent.
1497 * @session_id SessionID
1498 *
1499 * This function is called by limProcessSmeMessages() to send
1500 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1501 *
1502 * Return: None
1503 */
1504void
1505lim_send_sme_wm_status_change_ntf(tpAniSirGlobal mac_ctx,
1506 tSirSmeStatusChangeCode status_change_code,
1507 uint32_t *status_change_info, uint16_t info_len, uint8_t session_id)
1508{
1509 tSirMsgQ msg;
1510 tSirSmeWmStatusChangeNtf *wm_status_change_ntf;
Naveen Rawate01ed172016-11-17 11:34:50 -08001511 uint32_t max_info_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001512
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301513 wm_status_change_ntf = qdf_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001514 if (NULL == wm_status_change_ntf) {
1515 lim_log(mac_ctx, LOGE,
1516 FL("Mem Alloc failed - eWNI_SME_WM_STATUS_CHANGE_NTF"));
1517 return;
1518 }
1519
1520 msg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1521 msg.bodyval = 0;
1522 msg.bodyptr = wm_status_change_ntf;
1523
1524 switch (status_change_code) {
Naveen Rawate01ed172016-11-17 11:34:50 -08001525 case eSIR_SME_AP_CAPS_CHANGED:
1526 max_info_len = sizeof(tSirSmeApNewCaps);
1527 break;
1528 case eSIR_SME_JOINED_NEW_BSS:
1529 max_info_len = sizeof(tSirSmeNewBssInfo);
1530 break;
1531 default:
1532 max_info_len = sizeof(wm_status_change_ntf->statusChangeInfo);
1533 break;
1534 }
1535
1536 switch (status_change_code) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001537 case eSIR_SME_RADAR_DETECTED:
1538 break;
1539 default:
1540 wm_status_change_ntf->messageType =
1541 eWNI_SME_WM_STATUS_CHANGE_NTF;
1542 wm_status_change_ntf->statusChangeCode = status_change_code;
1543 wm_status_change_ntf->length = sizeof(tSirSmeWmStatusChangeNtf);
1544 wm_status_change_ntf->sessionId = session_id;
Naveen Rawate01ed172016-11-17 11:34:50 -08001545 if (info_len <= max_info_len && status_change_info) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301546 qdf_mem_copy(
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001547 (uint8_t *) &wm_status_change_ntf->statusChangeInfo,
1548 (uint8_t *) status_change_info, info_len);
1549 }
1550 lim_log(mac_ctx, LOGE,
1551 FL("**---** StatusChg: code 0x%x, length %d **---**"),
1552 status_change_code, info_len);
1553 break;
1554 }
1555
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301556 MTRACE(mac_trace(mac_ctx, TRACE_CODE_TX_SME_MSG, session_id, msg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001557 if (eSIR_SUCCESS != lim_sys_process_mmh_msg_api(mac_ctx, &msg, ePROT)) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301558 qdf_mem_free(wm_status_change_ntf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001559 lim_log(mac_ctx, LOGP,
1560 FL("lim_sys_process_mmh_msg_api failed"));
1561 }
1562
1563} /*** end lim_send_sme_wm_status_change_ntf() ***/
1564
1565/**
1566 * lim_send_sme_set_context_rsp()
1567 *
1568 ***FUNCTION:
1569 * This function is called by limProcessSmeMessages() to send
1570 * eWNI_SME_SETCONTEXT_RSP message to host
1571 *
1572 ***PARAMS:
1573 *
1574 ***LOGIC:
1575 *
1576 ***ASSUMPTIONS:
1577 * NA
1578 *
1579 ***NOTE:
1580 *
1581 * @param pMac Pointer to Global MAC structure
1582 * @param peerMacAddr Indicates the peer MAC addr to which
1583 * setContext was performed
1584 * @param aid Indicates the aid corresponding to the peer MAC
1585 * address
1586 * @param resultCode Indicates the result of previously issued
1587 * eWNI_SME_SETCONTEXT_RSP message
1588 *
1589 * @return None
1590 */
1591void
1592lim_send_sme_set_context_rsp(tpAniSirGlobal pMac,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301593 struct qdf_mac_addr peer_macaddr, uint16_t aid,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001594 tSirResultCodes resultCode,
1595 tpPESession psessionEntry, uint8_t smesessionId,
1596 uint16_t smetransactionId)
1597{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001598 tSirMsgQ mmhMsg;
1599 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
1600
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301601 pSirSmeSetContextRsp = qdf_mem_malloc(sizeof(tSirSmeSetContextRsp));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001602 if (NULL == pSirSmeSetContextRsp) {
1603 /* Log error */
1604 lim_log(pMac, LOGP,
1605 FL
1606 ("call to AllocateMemory failed for SmeSetContextRsp"));
1607
1608 return;
1609 }
1610
1611 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
1612 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
1613 pSirSmeSetContextRsp->statusCode = resultCode;
1614
Anurag Chouhanc5548422016-02-24 18:33:27 +05301615 qdf_copy_macaddr(&pSirSmeSetContextRsp->peer_macaddr, &peer_macaddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001616
1617 /* Update SME session and transaction Id */
1618 pSirSmeSetContextRsp->sessionId = smesessionId;
1619 pSirSmeSetContextRsp->transactionId = smetransactionId;
1620
1621 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
1622 mmhMsg.bodyptr = pSirSmeSetContextRsp;
1623 mmhMsg.bodyval = 0;
1624 if (NULL == psessionEntry) {
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301625 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
1626 NO_SESSION, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001627 } else {
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301628 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
1629 psessionEntry->peSessionId, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001630 }
1631
1632#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
1633 lim_diag_event_report(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT,
1634 psessionEntry, (uint16_t) resultCode, 0);
1635#endif /* FEATURE_WLAN_DIAG_SUPPORT */
1636
1637 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1638} /*** end lim_send_sme_set_context_rsp() ***/
1639
1640/**
1641 * lim_send_sme_neighbor_bss_ind()
1642 *
1643 ***FUNCTION:
1644 * This function is called by lim_lookup_nadd_hash_entry() to send
1645 * eWNI_SME_NEIGHBOR_BSS_IND message to host
1646 *
1647 ***PARAMS:
1648 *
1649 ***LOGIC:
1650 *
1651 ***ASSUMPTIONS:
1652 * NA
1653 *
1654 ***NOTE:
1655 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
1656 * host upon detecting new BSS during background scanning if CFG
1657 * option is enabled for sending such indication
1658 *
1659 * @param pMac - Pointer to Global MAC structure
1660 * @return None
1661 */
1662
1663void
1664lim_send_sme_neighbor_bss_ind(tpAniSirGlobal pMac, tLimScanResultNode *pBssDescr)
1665{
1666 tSirMsgQ msgQ;
1667 uint32_t val;
1668 tSirSmeNeighborBssInd *pNewBssInd;
1669
1670 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
1671 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
1672 pMac->lim.gLimRspReqd)) {
1673 /* LIM is not in background scan state OR */
1674 /* current scan is initiated by HDD. */
1675 /* No need to send new BSS indication to HDD */
1676 return;
1677 }
1678
1679 if (wlan_cfg_get_int(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) !=
1680 eSIR_SUCCESS) {
1681 lim_log(pMac, LOGP,
1682 FL("could not get NEIGHBOR_BSS_IND from CFG"));
1683
1684 return;
1685 }
1686
1687 if (val == 0)
1688 return;
1689
1690 /**
1691 * Need to indicate new BSSs found during
1692 * background scanning to host.
1693 * Allocate buffer for sending indication.
1694 * Length of buffer is length of BSS description
1695 * and length of header itself
1696 */
1697 val = pBssDescr->bssDescription.length + sizeof(uint16_t) +
1698 sizeof(uint32_t) + sizeof(uint8_t);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301699 pNewBssInd = qdf_mem_malloc(val);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001700 if (NULL == pNewBssInd) {
1701 /* Log error */
1702 lim_log(pMac, LOGP,
1703 FL
1704 ("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND"));
1705
1706 return;
1707 }
1708
1709 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
1710 pNewBssInd->length = (uint16_t) val;
1711 pNewBssInd->sessionId = 0;
1712
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301713 qdf_mem_copy((uint8_t *) pNewBssInd->bssDescription,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001714 (uint8_t *) &pBssDescr->bssDescription,
1715 pBssDescr->bssDescription.length + sizeof(uint16_t));
1716
1717 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
1718 msgQ.bodyptr = pNewBssInd;
1719 msgQ.bodyval = 0;
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301720 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msgQ.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001721 lim_sys_process_mmh_msg_api(pMac, &msgQ, ePROT);
1722} /*** end lim_send_sme_neighbor_bss_ind() ***/
1723
1724/** -----------------------------------------------------------------
1725 \brief lim_send_sme_addts_rsp() - sends SME ADDTS RSP
1726 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
1727 \ SME only looks at rc and tspec field.
1728 \param pMac - global mac structure
1729 \param rspReqd - is SmeAddTsRsp required
1730 \param status - status code of SME_ADD_TS_RSP
1731 \return tspec
1732 \sa
1733 ----------------------------------------------------------------- */
1734void
1735lim_send_sme_addts_rsp(tpAniSirGlobal pMac, uint8_t rspReqd, uint32_t status,
1736 tpPESession psessionEntry, tSirMacTspecIE tspec,
1737 uint8_t smesessionId, uint16_t smetransactionId)
1738{
1739 tpSirAddtsRsp rsp;
1740 tSirMsgQ mmhMsg;
1741
1742 if (!rspReqd)
1743 return;
1744
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301745 rsp = qdf_mem_malloc(sizeof(tSirAddtsRsp));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001746 if (NULL == rsp) {
1747 lim_log(pMac, LOGP, FL("AllocateMemory failed for ADDTS_RSP"));
1748 return;
1749 }
1750
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001751 rsp->messageType = eWNI_SME_ADDTS_RSP;
1752 rsp->rc = status;
1753 rsp->rsp.status = (enum eSirMacStatusCodes)status;
1754 rsp->rsp.tspec = tspec;
1755 /* Update SME session Id and transcation Id */
1756 rsp->sessionId = smesessionId;
1757 rsp->transactionId = smetransactionId;
1758
1759 mmhMsg.type = eWNI_SME_ADDTS_RSP;
1760 mmhMsg.bodyptr = rsp;
1761 mmhMsg.bodyval = 0;
1762 if (NULL == psessionEntry) {
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301763 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
1764 NO_SESSION, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001765 } else {
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301766 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
1767 psessionEntry->peSessionId, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001768 }
1769#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
1770 lim_diag_event_report(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0,
1771 0);
1772#endif /* FEATURE_WLAN_DIAG_SUPPORT */
1773
1774 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1775 return;
1776}
1777
1778void
1779lim_send_sme_delts_rsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, uint32_t status,
1780 tpPESession psessionEntry, uint8_t smesessionId,
1781 uint16_t smetransactionId)
1782{
1783 tpSirDeltsRsp rsp;
1784 tSirMsgQ mmhMsg;
1785
1786 lim_log(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d",
1787 delts->aid,
1788 delts->req.tsinfo.traffic.tsid,
1789 delts->req.tsinfo.traffic.userPrio, status);
1790 if (!delts->rspReqd)
1791 return;
1792
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301793 rsp = qdf_mem_malloc(sizeof(tSirDeltsRsp));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001794 if (NULL == rsp) {
1795 /* Log error */
1796 lim_log(pMac, LOGP, FL("AllocateMemory failed for DELTS_RSP"));
1797 return;
1798 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001799
1800 if (psessionEntry != NULL) {
1801
1802 rsp->aid = delts->aid;
Anurag Chouhanc5548422016-02-24 18:33:27 +05301803 qdf_copy_macaddr(&rsp->macaddr, &delts->macaddr);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301804 qdf_mem_copy((uint8_t *) &rsp->rsp, (uint8_t *) &delts->req,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001805 sizeof(tSirDeltsReqInfo));
1806 }
1807
1808 rsp->messageType = eWNI_SME_DELTS_RSP;
1809 rsp->rc = status;
1810
1811 /* Update SME session Id and transcation Id */
1812 rsp->sessionId = smesessionId;
1813 rsp->transactionId = smetransactionId;
1814
1815 mmhMsg.type = eWNI_SME_DELTS_RSP;
1816 mmhMsg.bodyptr = rsp;
1817 mmhMsg.bodyval = 0;
1818 if (NULL == psessionEntry) {
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301819 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
1820 NO_SESSION, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001821 } else {
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301822 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
1823 psessionEntry->peSessionId, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001824 }
1825#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
1826 lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry,
1827 (uint16_t) status, 0);
1828#endif /* FEATURE_WLAN_DIAG_SUPPORT */
1829
1830 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1831}
1832
1833void
1834lim_send_sme_delts_ind(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, uint16_t aid,
1835 tpPESession psessionEntry)
1836{
1837 tpSirDeltsRsp rsp;
1838 tSirMsgQ mmhMsg;
1839
1840 lim_log(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)",
1841 aid, delts->tsinfo.traffic.tsid, delts->tsinfo.traffic.userPrio);
1842
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301843 rsp = qdf_mem_malloc(sizeof(tSirDeltsRsp));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001844 if (NULL == rsp) {
1845 /* Log error */
1846 lim_log(pMac, LOGP, FL("AllocateMemory failed for DELTS_IND"));
1847 return;
1848 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001849
1850 rsp->messageType = eWNI_SME_DELTS_IND;
1851 rsp->rc = eSIR_SUCCESS;
1852 rsp->aid = aid;
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301853 qdf_mem_copy((uint8_t *) &rsp->rsp, (uint8_t *) delts, sizeof(*delts));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001854
1855 /* Update SME session Id and SME transaction Id */
1856
1857 rsp->sessionId = psessionEntry->smeSessionId;
1858 rsp->transactionId = psessionEntry->transactionId;
1859
1860 mmhMsg.type = eWNI_SME_DELTS_IND;
1861 mmhMsg.bodyptr = rsp;
1862 mmhMsg.bodyval = 0;
1863 MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, mmhMsg.type));
1864#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */
1865 lim_diag_event_report(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0,
1866 0);
1867#endif /* FEATURE_WLAN_DIAG_SUPPORT */
1868
1869 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1870}
1871
1872/**
1873 * lim_send_sme_pe_statistics_rsp()
1874 *
1875 ***FUNCTION:
1876 * This function is called to send 802.11 statistics response to HDD.
1877 * This function posts the result back to HDD. This is a response to
1878 * HDD's request for statistics.
1879 *
1880 ***PARAMS:
1881 *
1882 ***LOGIC:
1883 *
1884 ***ASSUMPTIONS:
1885 * NA
1886 *
1887 ***NOTE:
1888 * NA
1889 *
1890 * @param pMac Pointer to Global MAC structure
1891 * @param p80211Stats Statistics sent in response
1892 * @param resultCode TODO:
1893 *
1894 *
1895 * @return none
1896 */
1897
1898void
1899lim_send_sme_pe_statistics_rsp(tpAniSirGlobal pMac, uint16_t msgType, void *stats)
1900{
1901 tSirMsgQ mmhMsg;
1902 uint8_t sessionId;
1903 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
1904 tpPESession pPeSessionEntry;
1905
1906 /* Get the Session Id based on Sta Id */
1907 pPeSessionEntry =
1908 pe_find_session_by_sta_id(pMac, pPeStats->staId, &sessionId);
1909
1910 /* Fill the Session Id */
1911 if (NULL != pPeSessionEntry) {
1912 /* Fill the Session Id */
1913 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
1914 }
1915
1916 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
1917
1918 /* msgType should be WMA_GET_STATISTICS_RSP */
1919 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
1920
1921 mmhMsg.bodyptr = stats;
1922 mmhMsg.bodyval = 0;
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301923 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001924 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1925
1926 return;
1927
1928} /*** end lim_send_sme_pe_statistics_rsp() ***/
1929
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001930#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001931/**
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001932 * lim_send_sme_pe_ese_tsm_rsp() - send tsm response
1933 * @pMac: Pointer to global pMac structure
1934 * @pStats: Pointer to TSM Stats
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001935 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001936 * This function is called to send tsm stats response to HDD.
1937 * This function posts the result back to HDD. This is a response to
1938 * HDD's request to get tsm stats.
1939 *
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001940 * Return: None
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001941 */
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001942void lim_send_sme_pe_ese_tsm_rsp(tpAniSirGlobal pMac,
1943 tAniGetTsmStatsRsp *pStats)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001944{
1945 tSirMsgQ mmhMsg;
1946 uint8_t sessionId;
1947 tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats;
1948 tpPESession pPeSessionEntry = NULL;
1949
1950 /* Get the Session Id based on Sta Id */
1951 pPeSessionEntry =
1952 pe_find_session_by_sta_id(pMac, pPeStats->staId, &sessionId);
1953
1954 /* Fill the Session Id */
1955 if (NULL != pPeSessionEntry) {
1956 /* Fill the Session Id */
1957 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
1958 } else {
1959 PELOGE(lim_log
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001960 (pMac, LOGE, FL("Session not found for the Sta id(%d)"),
1961 pPeStats->staId);)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001962 return;
1963 }
1964
1965 pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP;
1966 pPeStats->tsmMetrics.RoamingCount
1967 = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount;
1968 pPeStats->tsmMetrics.RoamingDly
1969 = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly;
1970
1971 mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP;
1972 mmhMsg.bodyptr = pStats;
1973 mmhMsg.bodyval = 0;
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05301974 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001975 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
1976
1977 return;
1978} /*** end lim_send_sme_pe_ese_tsm_rsp() ***/
1979
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001980#endif /* FEATURE_WLAN_ESE */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001981
1982void
1983lim_send_sme_ibss_peer_ind(tpAniSirGlobal pMac,
1984 tSirMacAddr peerMacAddr,
1985 uint16_t staIndex,
1986 uint8_t ucastIdx,
1987 uint8_t bcastIdx,
1988 uint8_t *beacon,
1989 uint16_t beaconLen, uint16_t msgType, uint8_t sessionId)
1990{
1991 tSirMsgQ mmhMsg;
1992 tSmeIbssPeerInd *pNewPeerInd;
1993
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301994 pNewPeerInd = qdf_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001995 if (NULL == pNewPeerInd) {
1996 PELOGE(lim_log(pMac, LOGE, FL("Failed to allocate memory"));)
1997 return;
1998 }
1999
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302000 qdf_mem_copy((uint8_t *) pNewPeerInd->peer_addr.bytes,
Anurag Chouhan6d760662016-02-20 16:05:43 +05302001 peerMacAddr, QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002002 pNewPeerInd->staId = staIndex;
2003 pNewPeerInd->ucastSig = ucastIdx;
2004 pNewPeerInd->bcastSig = bcastIdx;
2005 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2006 pNewPeerInd->mesgType = msgType;
2007 pNewPeerInd->sessionId = sessionId;
2008
2009 if (beacon != NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302010 qdf_mem_copy((void *)((uint8_t *) pNewPeerInd +
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002011 sizeof(tSmeIbssPeerInd)), (void *)beacon,
2012 beaconLen);
2013 }
2014
2015 mmhMsg.type = msgType;
2016 mmhMsg.bodyptr = pNewPeerInd;
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05302017 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002018 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
2019
2020}
2021
Kiran Kumar Lokerefc8feea2016-10-27 17:07:00 -07002022/**
2023 * lim_process_csa_wbw_ie() - Process CSA Wide BW IE
2024 * @mac_ctx: pointer to global adapter context
2025 * @csa_params: pointer to CSA parameters
2026 * @chnl_switch_info:pointer to channel switch parameters
2027 * @session_entry: session pointer
2028 *
2029 * Return: None
2030 */
2031static void lim_process_csa_wbw_ie(tpAniSirGlobal mac_ctx,
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002032 struct csa_offload_params *csa_params,
2033 tLimWiderBWChannelSwitchInfo *chnl_switch_info,
2034 tpPESession session_entry)
2035{
2036 struct ch_params_s ch_params = {0};
2037 uint8_t ap_new_ch_width;
2038 bool new_ch_width_dfn = false;
2039 uint8_t center_freq_diff;
2040
2041 ap_new_ch_width = csa_params->new_ch_width + 1;
2042 if ((ap_new_ch_width == CH_WIDTH_80MHZ) &&
2043 csa_params->new_ch_freq_seg2) {
2044 new_ch_width_dfn = true;
2045 if (csa_params->new_ch_freq_seg2 >
2046 csa_params->new_ch_freq_seg1)
2047 center_freq_diff = csa_params->new_ch_freq_seg2 -
2048 csa_params->new_ch_freq_seg1;
2049 else
2050 center_freq_diff = csa_params->new_ch_freq_seg1 -
2051 csa_params->new_ch_freq_seg2;
2052 if (center_freq_diff == CENTER_FREQ_DIFF_160MHz)
2053 ap_new_ch_width = CH_WIDTH_160MHZ;
2054 else if (center_freq_diff > CENTER_FREQ_DIFF_80P80MHz)
2055 ap_new_ch_width = CH_WIDTH_80P80MHZ;
2056 else
2057 ap_new_ch_width = CH_WIDTH_80MHZ;
2058 }
2059 session_entry->gLimChannelSwitch.state =
2060 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2061 if ((ap_new_ch_width == CH_WIDTH_160MHZ) &&
2062 !new_ch_width_dfn) {
2063 ch_params.ch_width = CH_WIDTH_160MHZ;
2064 cds_set_channel_params(csa_params->channel, 0,
2065 &ch_params);
2066 ap_new_ch_width = ch_params.ch_width;
2067 csa_params->new_ch_freq_seg1 = ch_params.center_freq_seg0;
2068 csa_params->new_ch_freq_seg2 = ch_params.center_freq_seg1;
2069 }
2070 chnl_switch_info->newChanWidth = ap_new_ch_width;
2071 chnl_switch_info->newCenterChanFreq0 = csa_params->new_ch_freq_seg1;
2072 chnl_switch_info->newCenterChanFreq1 = csa_params->new_ch_freq_seg2;
2073
2074 if (session_entry->ch_width == ap_new_ch_width)
2075 goto prnt_log;
2076
2077 if (session_entry->ch_width == CH_WIDTH_80MHZ) {
2078 chnl_switch_info->newChanWidth = CH_WIDTH_80MHZ;
2079 chnl_switch_info->newCenterChanFreq1 = 0;
2080 } else {
2081 session_entry->ch_width = ap_new_ch_width;
2082 chnl_switch_info->newChanWidth = ap_new_ch_width;
2083 }
2084prnt_log:
2085 lim_log(mac_ctx, LOG1,
2086 FL("new channel: %d new_ch_width:%d seg0:%d seg1:%d"),
2087 csa_params->channel,
2088 chnl_switch_info->newChanWidth,
2089 chnl_switch_info->newCenterChanFreq0,
2090 chnl_switch_info->newCenterChanFreq1);
2091}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002092/**
2093 * lim_handle_csa_offload_msg() - Handle CSA offload message
2094 * @mac_ctx: pointer to global adapter context
2095 * @msg: Message pointer.
2096 *
2097 * Return: None
2098 */
2099void lim_handle_csa_offload_msg(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
2100{
2101 tpPESession session_entry;
2102 tSirMsgQ mmh_msg;
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05302103 struct csa_offload_params *csa_params =
2104 (struct csa_offload_params *) (msg->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002105 tpSmeCsaOffloadInd csa_offload_ind;
2106 tpDphHashNode sta_ds = NULL;
2107 uint8_t session_id;
2108 uint16_t aid = 0;
Gupta, Kapil121bf212015-11-25 19:21:29 +05302109 uint16_t chan_space = 0;
Amar Singhale4f28ee2015-10-21 14:36:56 -07002110 struct ch_params_s ch_params;
Gupta, Kapil121bf212015-11-25 19:21:29 +05302111
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002112 tLimWiderBWChannelSwitchInfo *chnl_switch_info = NULL;
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08002113 tLimChannelSwitchInfo *lim_ch_switch = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002114
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05302115 lim_log(mac_ctx, LOG1, FL("handle csa offload msg"));
2116
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002117 if (!csa_params) {
2118 lim_log(mac_ctx, LOGE, FL("limMsgQ body ptr is NULL"));
2119 return;
2120 }
2121
2122 session_entry =
2123 pe_find_session_by_bssid(mac_ctx,
2124 csa_params->bssId, &session_id);
2125 if (!session_entry) {
2126 lim_log(mac_ctx, LOGE,
Chandrasekaran, Manishekar5c19dc52016-02-04 14:58:26 +05302127 FL("Session does not exists for %pM"),
2128 csa_params->bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002129 goto err;
2130 }
2131
2132 sta_ds = dph_lookup_hash_entry(mac_ctx, session_entry->bssId, &aid,
2133 &session_entry->dph.dphHashTable);
2134
2135 if (!sta_ds) {
2136 lim_log(mac_ctx, LOGE,
2137 FL("sta_ds does not exist"));
2138 goto err;
2139 }
2140
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002141 if (!LIM_IS_STA_ROLE(session_entry)) {
2142 lim_log(mac_ctx, LOG1, FL("Invalid role to handle CSA"));
2143 goto err;
2144 }
Masti, Narayanraddi1c630442015-11-02 12:03:50 +05302145
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002146 /*
2147 * on receiving channel switch announcement from AP, delete all
2148 * TDLS peers before leaving BSS and proceed for channel switch
2149 */
2150 lim_delete_tdls_peers(mac_ctx, session_entry);
Gupta, Kapil121bf212015-11-25 19:21:29 +05302151
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002152 lim_ch_switch = &session_entry->gLimChannelSwitch;
2153 session_entry->gLimChannelSwitch.switchMode =
2154 csa_params->switch_mode;
2155 /* timer already started by firmware, switch immediately */
2156 session_entry->gLimChannelSwitch.switchCount = 0;
2157 session_entry->gLimChannelSwitch.primaryChannel =
2158 csa_params->channel;
2159 session_entry->gLimChannelSwitch.state =
2160 eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2161 session_entry->gLimChannelSwitch.ch_width = CH_WIDTH_20MHZ;
2162 lim_ch_switch->sec_ch_offset =
2163 session_entry->htSecondaryChannelOffset;
2164 session_entry->gLimChannelSwitch.ch_center_freq_seg0 = 0;
2165 session_entry->gLimChannelSwitch.ch_center_freq_seg1 = 0;
2166 chnl_switch_info =
2167 &session_entry->gLimWiderBWChannelSwitch;
2168
2169 lim_log(mac_ctx, LOG1,
2170 FL("vht:%d ht:%d flag:%x chan:%d"),
Chandrasekaran, Manishekarce2172e2016-02-18 16:12:43 +05302171 session_entry->vhtCapability,
2172 session_entry->htSupportedChannelWidthSet,
2173 csa_params->ies_present_flag,
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002174 csa_params->channel);
2175 lim_log(mac_ctx, LOG1,
2176 FL("seg1:%d seg2:%d width:%d country:%s class:%d"),
2177 csa_params->new_ch_freq_seg1,
Chandrasekaran, Manishekarce2172e2016-02-18 16:12:43 +05302178 csa_params->new_ch_freq_seg2,
2179 csa_params->new_ch_width,
2180 mac_ctx->scan.countryCodeCurrent,
2181 csa_params->new_op_class);
2182
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002183 if (session_entry->vhtCapability &&
2184 session_entry->htSupportedChannelWidthSet) {
2185 if (csa_params->ies_present_flag & lim_wbw_ie_present) {
Kiran Kumar Lokerefc8feea2016-10-27 17:07:00 -07002186 lim_process_csa_wbw_ie(mac_ctx, csa_params,
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002187 chnl_switch_info, session_entry);
2188 lim_ch_switch->sec_ch_offset =
2189 csa_params->sec_chan_offset;
2190 } else if (csa_params->ies_present_flag
2191 & lim_xcsa_ie_present) {
2192 chan_space =
2193 cds_reg_dmn_get_chanwidth_from_opclass(
2194 mac_ctx->scan.countryCodeCurrent,
2195 csa_params->channel,
2196 csa_params->new_op_class);
2197 session_entry->gLimChannelSwitch.state =
2198 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2199
2200 if (chan_space == 80) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002201 chnl_switch_info->newChanWidth =
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002202 CH_WIDTH_80MHZ;
2203 } else if (chan_space == 40) {
2204 chnl_switch_info->newChanWidth =
2205 CH_WIDTH_40MHZ;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002206 } else {
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002207 chnl_switch_info->newChanWidth =
2208 CH_WIDTH_20MHZ;
2209 lim_ch_switch->state =
2210 eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2211 }
2212
2213 ch_params.ch_width =
2214 chnl_switch_info->newChanWidth;
2215 cds_set_channel_params(csa_params->channel,
2216 0, &ch_params);
2217 chnl_switch_info->newCenterChanFreq0 =
2218 ch_params.center_freq_seg0;
2219 /*
2220 * This is not applicable for 20/40/80 MHz.
2221 * Only used when we support 80+80 MHz operation.
2222 * In case of 80+80 MHz, this parameter indicates
2223 * center channel frequency index of 80 MHz
2224 * channel offrequency segment 1.
2225 */
2226 chnl_switch_info->newCenterChanFreq1 =
2227 ch_params.center_freq_seg1;
2228 lim_ch_switch->sec_ch_offset =
2229 ch_params.sec_ch_offset;
2230
2231 }
2232 session_entry->gLimChannelSwitch.ch_center_freq_seg0 =
2233 chnl_switch_info->newCenterChanFreq0;
2234 session_entry->gLimChannelSwitch.ch_center_freq_seg1 =
2235 chnl_switch_info->newCenterChanFreq1;
2236 session_entry->gLimChannelSwitch.ch_width =
2237 chnl_switch_info->newChanWidth;
2238
2239 } else if (session_entry->htSupportedChannelWidthSet) {
2240 if (csa_params->ies_present_flag
2241 & lim_xcsa_ie_present) {
2242 chan_space =
2243 cds_reg_dmn_get_chanwidth_from_opclass(
2244 mac_ctx->scan.countryCodeCurrent,
2245 csa_params->channel,
2246 csa_params->new_op_class);
2247 lim_ch_switch->state =
2248 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2249 if (chan_space == 40) {
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08002250 lim_ch_switch->ch_width =
2251 CH_WIDTH_40MHZ;
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002252 chnl_switch_info->newChanWidth =
2253 CH_WIDTH_40MHZ;
2254 ch_params.ch_width =
2255 chnl_switch_info->newChanWidth;
2256 cds_set_channel_params(
2257 csa_params->channel,
Sandeep Puligilla1cc23f62016-04-27 16:52:49 -07002258 0, &ch_params);
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -08002259 lim_ch_switch->ch_center_freq_seg0 =
2260 ch_params.center_freq_seg0;
2261 lim_ch_switch->sec_ch_offset =
2262 ch_params.sec_ch_offset;
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002263 } else {
2264 lim_ch_switch->ch_width =
2265 CH_WIDTH_20MHZ;
2266 chnl_switch_info->newChanWidth =
2267 CH_WIDTH_40MHZ;
2268 lim_ch_switch->state =
2269 eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2270 lim_ch_switch->sec_ch_offset =
2271 PHY_SINGLE_CHANNEL_CENTERED;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002272 }
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002273 } else {
2274 lim_ch_switch->ch_width =
2275 CH_WIDTH_40MHZ;
2276 lim_ch_switch->state =
2277 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2278 ch_params.ch_width = CH_WIDTH_40MHZ;
2279 cds_set_channel_params(csa_params->channel,
2280 0, &ch_params);
2281 lim_ch_switch->ch_center_freq_seg0 =
2282 ch_params.center_freq_seg0;
2283 lim_ch_switch->sec_ch_offset =
2284 ch_params.sec_ch_offset;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002285 }
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002286
2287 }
2288 lim_log(mac_ctx, LOG1, FL("new ch width = %d space:%d"),
Chandrasekaran, Manishekarce2172e2016-02-18 16:12:43 +05302289 session_entry->gLimChannelSwitch.ch_width, chan_space);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002290
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002291 lim_prepare_for11h_channel_switch(mac_ctx, session_entry);
2292 csa_offload_ind = qdf_mem_malloc(sizeof(tSmeCsaOffloadInd));
2293 if (NULL == csa_offload_ind) {
2294 lim_log(mac_ctx, LOGE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002295 FL("memalloc fail eWNI_SME_CSA_OFFLOAD_EVENT"));
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002296 goto err;
2297 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002298
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002299 csa_offload_ind->mesgType = eWNI_SME_CSA_OFFLOAD_EVENT;
2300 csa_offload_ind->mesgLen = sizeof(tSmeCsaOffloadInd);
2301 qdf_mem_copy(csa_offload_ind->bssid.bytes, session_entry->bssId,
2302 QDF_MAC_ADDR_SIZE);
2303 mmh_msg.type = eWNI_SME_CSA_OFFLOAD_EVENT;
2304 mmh_msg.bodyptr = csa_offload_ind;
2305 mmh_msg.bodyval = 0;
2306 lim_log(mac_ctx, LOG1,
Srinivas Girigowdac9148f72015-11-25 12:42:32 -08002307 FL("Sending eWNI_SME_CSA_OFFLOAD_EVENT to SME."));
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002308 MTRACE(mac_trace_msg_tx
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002309 (mac_ctx, session_entry->peSessionId, mmh_msg.type));
2310#ifdef FEATURE_WLAN_DIAG_SUPPORT
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002311 lim_diag_event_report(mac_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002312 WLAN_PE_DIAG_SWITCH_CHL_IND_EVENT, session_entry,
2313 eSIR_SUCCESS, eSIR_SUCCESS);
2314#endif
Kiran Kumar Lokeree38f4d22016-10-20 17:30:59 -07002315 lim_sys_process_mmh_msg_api(mac_ctx, &mmh_msg, ePROT);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002316
2317err:
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302318 qdf_mem_free(csa_params);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002319}
2320
2321/*--------------------------------------------------------------------------
2322 \brief pe_delete_session() - Handle the Delete BSS Response from HAL.
2323
2324 \param pMac - pointer to global adapter context
2325 \param sessionId - Message pointer.
2326
2327 \sa
2328 --------------------------------------------------------------------------*/
2329
2330void lim_handle_delete_bss_rsp(tpAniSirGlobal pMac, tpSirMsgQ MsgQ)
2331{
2332 tpPESession psessionEntry;
2333 tpDeleteBssParams pDelBss = (tpDeleteBssParams) (MsgQ->bodyptr);
2334
2335 psessionEntry =
2336 pe_find_session_by_session_id(pMac, pDelBss->sessionId);
2337 if (psessionEntry == NULL) {
2338 lim_log(pMac, LOGE,
2339 FL("Session Does not exist for given sessionID %d"),
2340 pDelBss->sessionId);
Naveen Rawat0c81edc2016-06-08 10:08:30 -07002341 qdf_mem_free(MsgQ->bodyptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002342 return;
2343 }
Deepak Dhamdhere2dae1bd2016-10-27 10:58:29 -07002344 /*
2345 * During DEL BSS handling, the PE Session will be deleted, but it is
2346 * better to clear this flag if the session is hanging around due
2347 * to some error conditions so that the next DEL_BSS request does
2348 * not take the HO_FAIL path
2349 */
2350 psessionEntry->process_ho_fail = false;
Deepak Dhamdhere13983f22016-05-31 19:06:09 -07002351 if (LIM_IS_IBSS_ROLE(psessionEntry))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002352 lim_ibss_del_bss_rsp(pMac, MsgQ->bodyptr, psessionEntry);
Deepak Dhamdhere13983f22016-05-31 19:06:09 -07002353 else if (LIM_IS_UNKNOWN_ROLE(psessionEntry))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002354 lim_process_sme_del_bss_rsp(pMac, MsgQ->bodyval, psessionEntry);
Deepak Dhamdhere13983f22016-05-31 19:06:09 -07002355 else if (LIM_IS_NDI_ROLE(psessionEntry))
2356 lim_ndi_del_bss_rsp(pMac, MsgQ->bodyptr, psessionEntry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002357 else
2358 lim_process_mlm_del_bss_rsp(pMac, MsgQ, psessionEntry);
2359
2360}
2361
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002362/** -----------------------------------------------------------------
2363 \brief lim_send_sme_aggr_qos_rsp() - sends SME FT AGGR QOS RSP
2364 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2365 \ SME only looks at rc and tspec field.
2366 \param pMac - global mac structure
2367 \param rspReqd - is SmeAddTsRsp required
2368 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2369 \return tspec
2370 \sa
2371 ----------------------------------------------------------------- */
2372void
2373lim_send_sme_aggr_qos_rsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2374 uint8_t smesessionId)
2375{
2376 tSirMsgQ mmhMsg;
2377
2378 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2379 mmhMsg.bodyptr = aggrQosRsp;
2380 mmhMsg.bodyval = 0;
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05302381 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
2382 smesessionId, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002383 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
2384
2385 return;
2386}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002387
2388void lim_send_sme_max_assoc_exceeded_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2389 uint8_t smesessionId)
2390{
2391 tSirMsgQ mmhMsg;
2392 tSmeMaxAssocInd *pSmeMaxAssocInd;
2393
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302394 pSmeMaxAssocInd = qdf_mem_malloc(sizeof(tSmeMaxAssocInd));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002395 if (NULL == pSmeMaxAssocInd) {
2396 PELOGE(lim_log(pMac, LOGE, FL("Failed to allocate memory"));)
2397 return;
2398 }
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302399 qdf_mem_copy((uint8_t *) pSmeMaxAssocInd->peer_mac.bytes,
Anurag Chouhan6d760662016-02-20 16:05:43 +05302400 (uint8_t *) peerMacAddr, QDF_MAC_ADDR_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002401 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2402 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2403 pSmeMaxAssocInd->sessionId = smesessionId;
2404 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2405 mmhMsg.bodyptr = pSmeMaxAssocInd;
2406 PELOG1(lim_log(pMac, LOG1, FL("msgType %s peerMacAddr " MAC_ADDRESS_STR
2407 " sme session id %d"),
2408 "eWNI_SME_MAX_ASSOC_EXCEEDED",
2409 MAC_ADDR_ARRAY(peerMacAddr));
2410 )
Sreelakshmi Konamkibeacc2e2016-09-01 16:14:56 +05302411 MTRACE(mac_trace(pMac, TRACE_CODE_TX_SME_MSG,
2412 smesessionId, mmhMsg.type));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002413 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
2414
2415 return;
2416}
2417
2418/** -----------------------------------------------------------------
2419 \brief lim_send_sme_dfs_event_notify() - sends
2420 eWNI_SME_DFS_RADAR_FOUND
2421 After receiving WMI_PHYERR_EVENTID indication frame from FW, this
2422 function sends a eWNI_SME_DFS_RADAR_FOUND to SME to notify
2423 that a RADAR is found on current operating channel and SAP-
2424 has to move to a new channel.
2425 \param pMac - global mac structure
2426 \param msgType - message type received from lower layer
2427 \param event - event data received from lower layer
2428 \return none
2429 \sa
2430 ----------------------------------------------------------------- */
2431void
2432lim_send_sme_dfs_event_notify(tpAniSirGlobal pMac, uint16_t msgType, void *event)
2433{
2434 tSirMsgQ mmhMsg;
2435 mmhMsg.type = eWNI_SME_DFS_RADAR_FOUND;
2436 mmhMsg.bodyptr = event;
2437 mmhMsg.bodyval = 0;
2438 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
2439 return;
2440}
2441
2442/*--------------------------------------------------------------------------
2443 \brief lim_send_dfs_chan_sw_ie_update()
2444 This timer handler updates the channel switch IE in beacon template
2445
2446 \param pMac - pointer to global adapter context
2447 \return - channel to scan from valid session else zero.
2448 \sa
2449 --------------------------------------------------------------------------*/
2450static void
2451lim_send_dfs_chan_sw_ie_update(tpAniSirGlobal pMac, tpPESession psessionEntry)
2452{
2453
2454 /* Update the beacon template and send to FW */
2455 if (sch_set_fixed_beacon_fields(pMac, psessionEntry) != eSIR_SUCCESS) {
2456 PELOGE(lim_log(pMac, LOGE, FL("Unable to set CSA IE in beacon"));)
2457 return;
2458 }
2459
2460 /* Send update beacon template message */
2461 lim_send_beacon_ind(pMac, psessionEntry);
2462 PELOG1(lim_log(pMac, LOG1,
2463 FL(" Updated CSA IE, IE COUNT = %d"),
2464 psessionEntry->gLimChannelSwitch.switchCount);
2465 )
2466
2467 return;
2468}
2469
2470/** -----------------------------------------------------------------
2471 \brief lim_send_sme_ap_channel_switch_resp() - sends
2472 eWNI_SME_CHANNEL_CHANGE_RSP
2473 After receiving WMA_SWITCH_CHANNEL_RSP indication this
2474 function sends a eWNI_SME_CHANNEL_CHANGE_RSP to SME to notify
2475 that the Channel change has been done to the specified target
2476 channel in the Channel change request
2477 \param pMac - global mac structure
2478 \param psessionEntry - session info
2479 \param pChnlParams - Channel switch params
2480 --------------------------------------------------------------------*/
2481void
2482lim_send_sme_ap_channel_switch_resp(tpAniSirGlobal pMac,
2483 tpPESession psessionEntry,
2484 tpSwitchChannelParams pChnlParams)
2485{
2486 tSirMsgQ mmhMsg;
2487 tpSwitchChannelParams pSmeSwithChnlParams;
2488 uint8_t channelId;
Sandeep Puligilla2111d3c2016-02-03 01:46:15 -08002489 bool is_ch_dfs = false;
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002490 enum phy_ch_width ch_width;
Sandeep Puligilla2111d3c2016-02-03 01:46:15 -08002491 uint8_t ch_center_freq_seg1;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002492
2493 pSmeSwithChnlParams = (tSwitchChannelParams *)
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302494 qdf_mem_malloc(sizeof(tSwitchChannelParams));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002495 if (NULL == pSmeSwithChnlParams) {
2496 lim_log(pMac, LOGP,
2497 FL("AllocateMemory failed for pSmeSwithChnlParams\n"));
2498 return;
2499 }
2500
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302501 qdf_mem_copy(pSmeSwithChnlParams, pChnlParams,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002502 sizeof(tSwitchChannelParams));
2503
2504 channelId = pSmeSwithChnlParams->channelNumber;
Sandeep Puligilla2111d3c2016-02-03 01:46:15 -08002505 ch_width = pSmeSwithChnlParams->ch_width;
2506 ch_center_freq_seg1 = pSmeSwithChnlParams->ch_center_freq_seg1;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002507
2508 /*
2509 * Pass the sme sessionID to SME instead
2510 * PE session ID.
2511 */
2512 pSmeSwithChnlParams->peSessionId = psessionEntry->smeSessionId;
2513
2514 mmhMsg.type = eWNI_SME_CHANNEL_CHANGE_RSP;
2515 mmhMsg.bodyptr = (void *)pSmeSwithChnlParams;
2516 mmhMsg.bodyval = 0;
2517 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
2518
2519 /*
2520 * We should start beacon transmission only if the new
2521 * channel after channel change is Non-DFS. For a DFS
2522 * channel, PE will receive an explicit request from
2523 * upper layers to start the beacon transmission .
2524 */
2525
Sandeep Puligilla2111d3c2016-02-03 01:46:15 -08002526 if (ch_width == CH_WIDTH_160MHZ) {
2527 is_ch_dfs = true;
2528 } else if (ch_width == CH_WIDTH_80P80MHZ) {
2529 if (cds_get_channel_state(channelId) == CHANNEL_STATE_DFS ||
2530 cds_get_channel_state(ch_center_freq_seg1 -
2531 SIR_80MHZ_START_CENTER_CH_DIFF) ==
2532 CHANNEL_STATE_DFS)
2533 is_ch_dfs = true;
2534 } else {
2535 if (cds_get_channel_state(channelId) == CHANNEL_STATE_DFS)
2536 is_ch_dfs = true;
2537 }
2538
2539 if (!is_ch_dfs) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002540 if (channelId == psessionEntry->currentOperChannel) {
2541 lim_apply_configuration(pMac, psessionEntry);
2542 lim_send_beacon_ind(pMac, psessionEntry);
2543 } else {
2544 PELOG1(lim_log(pMac, LOG1,
2545 FL
2546 ("Failed to Transmit Beacons on channel = %d"
2547 "after AP channel change response"),
2548 psessionEntry->bcnLen);
2549 )
2550 }
2551 }
2552 return;
2553}
2554
2555/** -----------------------------------------------------------------
2556 \brief lim_process_beacon_tx_success_ind() - This function is used
2557 explicitely to handle successful beacon transmission indication
2558 from the FW. This is a generic event generated by the FW afer the
2559 first beacon is sent out after the beacon template update by the
2560 host
2561 \param pMac - global mac structure
2562 \param psessionEntry - session info
2563 \return none
2564 \sa
2565 ----------------------------------------------------------------- */
2566void
2567lim_process_beacon_tx_success_ind(tpAniSirGlobal pMac, uint16_t msgType, void *event)
2568{
2569 /* Currently, this event is used only for DFS channel switch announcement
2570 * IE update in the template. If required to be used for other IE updates
2571 * add appropriate code by introducing a state variable
2572 */
2573 tpPESession psessionEntry;
2574 tSirMsgQ mmhMsg;
2575 tSirSmeCSAIeTxCompleteRsp *pChanSwTxResponse;
2576 struct sir_beacon_tx_complete_rsp *beacon_tx_comp_rsp_ptr;
2577 uint8_t length = sizeof(tSirSmeCSAIeTxCompleteRsp);
2578 tpSirFirstBeaconTxCompleteInd pBcnTxInd =
2579 (tSirFirstBeaconTxCompleteInd *) event;
2580
2581 psessionEntry = pe_find_session_by_bss_idx(pMac, pBcnTxInd->bssIdx);
2582 if (psessionEntry == NULL) {
2583 lim_log(pMac, LOGE,
2584 FL("Session Does not exist for given sessionID"));
2585 return;
2586 }
2587
Chandrasekaran, Manishekarce2172e2016-02-18 16:12:43 +05302588 lim_log(pMac, LOG1, FL("role:%d swIe:%d opIe:%d"),
2589 GET_LIM_SYSTEM_ROLE(psessionEntry),
2590 psessionEntry->dfsIncludeChanSwIe,
2591 psessionEntry->gLimOperatingMode.present);
2592
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002593 if (LIM_IS_AP_ROLE(psessionEntry) &&
2594 true == psessionEntry->dfsIncludeChanSwIe) {
2595 /* Send only 5 beacons with CSA IE Set in when a radar is detected */
2596 if (psessionEntry->gLimChannelSwitch.switchCount > 0) {
2597 /*
2598 * Send the next beacon with updated CSA IE count
2599 */
2600 lim_send_dfs_chan_sw_ie_update(pMac, psessionEntry);
2601 /* Decrement the IE count */
2602 psessionEntry->gLimChannelSwitch.switchCount--;
2603 } else {
2604 /* Done with CSA IE update, send response back to SME */
2605 psessionEntry->gLimChannelSwitch.switchCount = 0;
2606 if (pMac->sap.SapDfsInfo.disable_dfs_ch_switch == false)
2607 psessionEntry->gLimChannelSwitch.switchMode = 0;
2608 psessionEntry->dfsIncludeChanSwIe = false;
2609 psessionEntry->dfsIncludeChanWrapperIe = false;
2610
2611 pChanSwTxResponse = (tSirSmeCSAIeTxCompleteRsp *)
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302612 qdf_mem_malloc(length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002613
2614 if (NULL == pChanSwTxResponse) {
2615 lim_log(pMac, LOGP,
2616 FL
2617 ("AllocateMemory failed for tSirSmeCSAIeTxCompleteRsp"));
2618 return;
2619 }
2620
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002621 pChanSwTxResponse->sessionId =
2622 psessionEntry->smeSessionId;
2623 pChanSwTxResponse->chanSwIeTxStatus =
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05302624 QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002625
2626 mmhMsg.type = eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND;
2627 mmhMsg.bodyptr = pChanSwTxResponse;
2628 mmhMsg.bodyval = 0;
2629 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
2630 }
2631 }
2632
2633 if (LIM_IS_AP_ROLE(psessionEntry) &&
2634 psessionEntry->gLimOperatingMode.present) {
2635 /* Done with nss update, send response back to SME */
2636 psessionEntry->gLimOperatingMode.present = 0;
2637 beacon_tx_comp_rsp_ptr = (struct sir_beacon_tx_complete_rsp *)
Anurag Chouhan600c3a02016-03-01 10:33:54 +05302638 qdf_mem_malloc(sizeof(*beacon_tx_comp_rsp_ptr));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002639 if (NULL == beacon_tx_comp_rsp_ptr) {
2640 lim_log(pMac, LOGP,
2641 FL
2642 ("AllocateMemory failed for beacon_tx_comp_rsp_ptr"));
2643 return;
2644 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002645 beacon_tx_comp_rsp_ptr->session_id =
2646 psessionEntry->smeSessionId;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05302647 beacon_tx_comp_rsp_ptr->tx_status = QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002648 mmhMsg.type = eWNI_SME_NSS_UPDATE_RSP;
2649 mmhMsg.bodyptr = beacon_tx_comp_rsp_ptr;
2650 mmhMsg.bodyval = 0;
2651 lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT);
2652 }
2653 return;
2654}