blob: 772c25b74bc9dbc40024d06a73488711b9c346c4 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Kiran Kumar Lokere40875852018-01-15 12:36:19 -08002 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/*
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080020 * This file lim_process_action_frame.cc contains the code
21 * for processing Action Frame.
22 * Author: Michael Lui
23 * Date: 05/23/03
24 * History:-
25 * Date Modified by Modification Information
26 * --------------------------------------------------------------------
27 *
28 */
29#include "cds_api.h"
30#include "wni_api.h"
31#include "sir_api.h"
32#include "ani_global.h"
33#include "wni_cfg.h"
34#include "sch_api.h"
35#include "utils_api.h"
36#include "lim_types.h"
37#include "lim_utils.h"
38#include "lim_assoc_utils.h"
39#include "lim_security_utils.h"
40#include "lim_ser_des_utils.h"
41#include "lim_send_sme_rsp_messages.h"
42#include "parser_api.h"
43#include "lim_admit_control.h"
44#include "wmm_apsd.h"
45#include "lim_send_messages.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080046#include "rrm_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080047#include "lim_session_utils.h"
Tushnim Bhattacharyya66348bd2017-03-09 15:02:10 -080048#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080049#include "wma_types.h"
Naveen Rawatc0c91cd2015-11-05 14:27:37 -080050#include "wma.h"
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -080051#include <cdp_txrx_cmn.h>
Tushnim Bhattacharyya45ed04f2017-03-15 10:15:05 -070052#include <cdp_txrx_peer_ops.h>
Jianmin Zhu2f708f22018-07-23 22:07:05 +080053#include "dot11f.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054
55#define BA_DEFAULT_TX_BUFFER_SIZE 64
56
Arif Hussain776ee7a2016-11-10 20:28:50 -080057static last_processed_msg rrm_link_action_frm;
58
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080059/* Note: The test passes if the STAUT stops sending any frames, and no further
60 frames are transmitted on this channel by the station when the AP has sent
61 the last 6 beacons, with the channel switch information elements as seen
62 with the sniffer.*/
63#define SIR_CHANSW_TX_STOP_MAX_COUNT 6
64/**-----------------------------------------------------------------
65 \fn lim_stop_tx_and_switch_channel
66 \brief Stops the transmission if channel switch mode is silent and
Anurag Chouhan6d760662016-02-20 16:05:43 +053067 starts the channel switch timer.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080068
Jeff Johnson982fe962018-11-28 17:07:01 -080069 \param mac
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080070 \return NONE
71 -----------------------------------------------------------------*/
Jeff Johnson9320c1e2018-12-02 13:09:20 -080072void lim_stop_tx_and_switch_channel(struct mac_context *mac, uint8_t sessionId)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080073{
Jeff Johnsonb5c13332018-12-03 09:54:51 -080074 struct pe_session *pe_session;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080075
Jeff Johnsonb5c13332018-12-03 09:54:51 -080076 pe_session = pe_find_session_by_session_id(mac, sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080077
Jeff Johnsonb5c13332018-12-03 09:54:51 -080078 if (NULL == pe_session) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +053079 pe_err("Session: %d not active", sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080080 return;
81 }
82
Jeff Johnsonb5c13332018-12-03 09:54:51 -080083 if (pe_session->ftPEContext.pFTPreAuthReq) {
Padma, Santhosh Kumar9397bc12017-04-17 15:19:30 +053084 pe_debug("Avoid Switch Channel req during pre auth");
85 return;
86 }
87
Nishank Aggarwald3d70462017-03-23 12:57:40 +053088 pe_debug("Channel switch Mode: %d",
Jeff Johnsonb5c13332018-12-03 09:54:51 -080089 pe_session->gLimChannelSwitch.switchMode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080090
Jeff Johnson348973e2018-11-22 16:51:12 -080091 mac->lim.limTimers.gLimChannelSwitchTimer.sessionId = sessionId;
Jeff Johnson47d75242018-05-12 15:58:53 -070092 /* change the channel immediately only if
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080093 * the channel switch count is 0
94 */
Jeff Johnsonb5c13332018-12-03 09:54:51 -080095 if (pe_session->gLimChannelSwitch.switchCount == 0) {
Jeff Johnson348973e2018-11-22 16:51:12 -080096 lim_process_channel_switch_timeout(mac);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080097 return;
98 }
99 MTRACE(mac_trace
Jeff Johnson348973e2018-11-22 16:51:12 -0800100 (mac, TRACE_CODE_TIMER_ACTIVATE, sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800101 eLIM_CHANNEL_SWITCH_TIMER));
102
Jeff Johnson348973e2018-11-22 16:51:12 -0800103 if (tx_timer_activate(&mac->lim.limTimers.gLimChannelSwitchTimer) !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800104 TX_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530105 pe_err("tx_timer_activate failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800106 }
107 return;
108}
109
110/**------------------------------------------------------------
111 \fn lim_start_channel_switch
112 \brief Switches the channel if switch count == 0, otherwise
Anurag Chouhan6d760662016-02-20 16:05:43 +0530113 starts the timer for channel switch and stops BG scan
114 and heartbeat timer tempororily.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800115
Jeff Johnson982fe962018-11-28 17:07:01 -0800116 \param mac
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800117 \param pe_session
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800118 \return NONE
119 ------------------------------------------------------------*/
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800120QDF_STATUS lim_start_channel_switch(struct mac_context *mac,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800121 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122{
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530123 pe_debug("Starting the channel switch");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800124
125 /*If channel switch is already running and it is on a different session, just return */
126 /*This need to be removed for MCC */
Jeff Johnson348973e2018-11-22 16:51:12 -0800127 if ((lim_is_chan_switch_running(mac) &&
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800128 pe_session->gLimSpecMgmt.dot11hChanSwState !=
129 eLIM_11H_CHANSW_RUNNING) || pe_session->csaOffloadEnable) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530130 pe_warn("Ignoring channel switch on session: %d",
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800131 pe_session->peSessionId);
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700132 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800133 }
134
135 /* Deactivate and change reconfigure the timeout value */
Jeff Johnson348973e2018-11-22 16:51:12 -0800136 /* lim_deactivate_and_change_timer(mac, eLIM_CHANNEL_SWITCH_TIMER); */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800137 MTRACE(mac_trace
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800138 (mac, TRACE_CODE_TIMER_DEACTIVATE, pe_session->peSessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800139 eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson348973e2018-11-22 16:51:12 -0800140 if (tx_timer_deactivate(&mac->lim.limTimers.gLimChannelSwitchTimer) !=
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700141 QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530142 pe_err("tx_timer_deactivate failed!");
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700143 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800144 }
145
Jeff Johnson348973e2018-11-22 16:51:12 -0800146 if (tx_timer_change(&mac->lim.limTimers.gLimChannelSwitchTimer,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800147 pe_session->gLimChannelSwitch.switchTimeoutValue,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800148 0) != TX_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530149 pe_err("tx_timer_change failed");
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700150 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800151 }
152
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800153 /* Prepare for 11h channel switch */
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800154 lim_prepare_for11h_channel_switch(mac, pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800155
156 /** Dont add any more statements here as we posted finish scan request
157 * to HAL, wait till we get the response
158 */
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700159 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800160}
161
162/**
163 * __lim_process_channel_switch_action_frame() - to process channel switch
164 * @mac_ctx: Pointer to Global MAC structure
165 * @rx_pkt_info: A pointer to packet info structure
166 *
167 * This routine will be called to process channel switch action frame
168 *
169 * Return: None
170 */
171
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800172static void __lim_process_channel_switch_action_frame(struct mac_context *mac_ctx,
Jeff Johnson41ce2852018-11-19 06:51:22 -0800173 uint8_t *rx_pkt_info, struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800174{
175 tpSirMacMgmtHdr mac_hdr;
176 uint8_t *body_ptr;
177 tDot11fChannelSwitch *chnl_switch_frame;
178 uint16_t bcn_period;
179 uint32_t val, frame_len, status;
180 tLimChannelSwitchInfo *ch_switch_params;
181 struct sDot11fIEWiderBWChanSwitchAnn *wbw_chnlswitch_ie = NULL;
182 struct sLimWiderBWChannelSwitch *lim_wbw_chnlswitch_info = NULL;
183 struct sDot11fIEsec_chan_offset_ele *sec_chnl_offset = NULL;
184
185 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
186 body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
187 frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
188
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530189 pe_debug("Received Channel switch action frame");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800190 if (!session->lim11hEnable)
191 return;
192
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530193 chnl_switch_frame = qdf_mem_malloc(sizeof(*chnl_switch_frame));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700194 if (!chnl_switch_frame)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800195 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800196
197 /* Unpack channel switch frame */
198 status = dot11f_unpack_channel_switch(mac_ctx, body_ptr, frame_len,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +0530199 chnl_switch_frame, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800200
201 if (DOT11F_FAILED(status)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530202 pe_err("Failed to unpack and parse (0x%08x, %d bytes)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800203 status, frame_len);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530204 qdf_mem_free(chnl_switch_frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800205 return;
206 } else if (DOT11F_WARNED(status)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530207 pe_warn("warning: unpack 11h-CHANSW Req(0x%08x, %d bytes)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800208 status, frame_len);
209 }
210
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530211 if (qdf_mem_cmp((uint8_t *) &session->bssId,
212 (uint8_t *) &mac_hdr->sa, sizeof(tSirMacAddr))) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530213 pe_warn("Rcvd action frame not from our BSS, dropping");
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530214 qdf_mem_free(chnl_switch_frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800215 return;
216 }
217 /* copy the beacon interval from session */
218 val = session->beaconParams.beaconInterval;
219 ch_switch_params = &session->gLimChannelSwitch;
220 bcn_period = (uint16_t)val;
221 ch_switch_params->primaryChannel =
222 chnl_switch_frame->ChanSwitchAnn.newChannel;
223 ch_switch_params->switchCount =
224 chnl_switch_frame->ChanSwitchAnn.switchCount;
225 ch_switch_params->switchTimeoutValue =
226 SYS_MS_TO_TICKS(bcn_period) *
227 session->gLimChannelSwitch.switchCount;
228 ch_switch_params->switchMode =
229 chnl_switch_frame->ChanSwitchAnn.switchMode;
230
231 /* Only primary channel switch element is present */
232 ch_switch_params->state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
233 ch_switch_params->ch_width = CH_WIDTH_20MHZ;
234
235 if (chnl_switch_frame->WiderBWChanSwitchAnn.present
236 && session->vhtCapability) {
237 wbw_chnlswitch_ie = &chnl_switch_frame->WiderBWChanSwitchAnn;
238 session->gLimWiderBWChannelSwitch.newChanWidth =
239 wbw_chnlswitch_ie->newChanWidth;
240 session->gLimWiderBWChannelSwitch.newCenterChanFreq0 =
241 wbw_chnlswitch_ie->newCenterChanFreq0;
242 session->gLimWiderBWChannelSwitch.newCenterChanFreq1 =
243 wbw_chnlswitch_ie->newCenterChanFreq1;
244 }
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530245 pe_debug("Rcv Chnl Swtch Frame: Timeout in %d ticks",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800246 session->gLimChannelSwitch.switchTimeoutValue);
247 if (session->htSupportedChannelWidthSet) {
248 sec_chnl_offset = &chnl_switch_frame->sec_chan_offset_ele;
249 if (sec_chnl_offset->secondaryChannelOffset ==
250 PHY_DOUBLE_CHANNEL_LOW_PRIMARY) {
251 ch_switch_params->state =
252 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
253 ch_switch_params->ch_width = CH_WIDTH_40MHZ;
254 ch_switch_params->ch_center_freq_seg0 =
255 ch_switch_params->primaryChannel + 2;
256 } else if (sec_chnl_offset->secondaryChannelOffset ==
257 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) {
258 ch_switch_params->state =
259 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
260 ch_switch_params->ch_width = CH_WIDTH_40MHZ;
261 ch_switch_params->ch_center_freq_seg0 =
262 ch_switch_params->primaryChannel - 2;
263
264 }
265 if (session->vhtCapability &&
266 chnl_switch_frame->WiderBWChanSwitchAnn.present) {
267 wbw_chnlswitch_ie =
268 &chnl_switch_frame->WiderBWChanSwitchAnn;
269 ch_switch_params->ch_width =
270 wbw_chnlswitch_ie->newChanWidth + 1;
271 lim_wbw_chnlswitch_info =
272 &session->gLimWiderBWChannelSwitch;
273 ch_switch_params->ch_center_freq_seg0 =
274 lim_wbw_chnlswitch_info->newCenterChanFreq0;
275 ch_switch_params->ch_center_freq_seg1 =
276 lim_wbw_chnlswitch_info->newCenterChanFreq1;
277
278 }
279 }
280
281 if (CH_WIDTH_20MHZ == ch_switch_params->ch_width) {
282 session->htSupportedChannelWidthSet =
283 WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
284 session->htRecommendedTxWidthSet =
285 session->htSupportedChannelWidthSet;
286 }
287
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700288 if (QDF_STATUS_SUCCESS != lim_start_channel_switch(mac_ctx, session))
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530289 pe_err("Could not start channel switch");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800290
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530291 qdf_mem_free(chnl_switch_frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800292 return;
293}
294
Abhishek Singh518323d2015-10-19 17:42:01 +0530295/**
296 * lim_process_ext_channel_switch_action_frame()- Process ECSA Action
297 * Frames.
298 * @mac_ctx: pointer to global mac structure
299 * @rx_packet_info: rx packet meta information
300 * @session_entry: Session entry.
301 *
302 * This function is called when ECSA action frame is received.
303 *
304 * Return: void
305 */
306static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800307lim_process_ext_channel_switch_action_frame(struct mac_context *mac_ctx,
Jeff Johnson41ce2852018-11-19 06:51:22 -0800308 uint8_t *rx_packet_info, struct pe_session *session_entry)
Abhishek Singh518323d2015-10-19 17:42:01 +0530309{
310
311 tpSirMacMgmtHdr hdr;
312 uint8_t *body;
313 tDot11fext_channel_switch_action_frame *ext_channel_switch_frame;
314 uint32_t frame_len;
315 uint32_t status;
316 uint8_t target_channel;
317
318 hdr = WMA_GET_RX_MAC_HEADER(rx_packet_info);
319 body = WMA_GET_RX_MPDU_DATA(rx_packet_info);
320 frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_packet_info);
321
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530322 pe_debug("Received EXT Channel switch action frame");
Abhishek Singh518323d2015-10-19 17:42:01 +0530323
324 ext_channel_switch_frame =
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530325 qdf_mem_malloc(sizeof(*ext_channel_switch_frame));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700326 if (!ext_channel_switch_frame)
Abhishek Singh518323d2015-10-19 17:42:01 +0530327 return;
Abhishek Singh518323d2015-10-19 17:42:01 +0530328
329 /* Unpack channel switch frame */
330 status = dot11f_unpack_ext_channel_switch_action_frame(mac_ctx,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +0530331 body, frame_len, ext_channel_switch_frame, false);
Abhishek Singh518323d2015-10-19 17:42:01 +0530332
333 if (DOT11F_FAILED(status)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530334 pe_err("Failed to parse CHANSW action frame (0x%08x, len %d):",
Abhishek Singh518323d2015-10-19 17:42:01 +0530335 status, frame_len);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530336 qdf_mem_free(ext_channel_switch_frame);
Abhishek Singh518323d2015-10-19 17:42:01 +0530337 return;
338 } else if (DOT11F_WARNED(status)) {
Rajeev Kumarb5813802017-06-29 17:34:57 -0700339 pe_debug("There were warnings while unpacking CHANSW Request (0x%08x, %d bytes):",
Abhishek Singh518323d2015-10-19 17:42:01 +0530340 status, frame_len);
341 }
342
343 target_channel =
344 ext_channel_switch_frame->ext_chan_switch_ann_action.new_channel;
345
346 /* Free ext_channel_switch_frame here as its no longer needed */
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530347 qdf_mem_free(ext_channel_switch_frame);
Abhishek Singh518323d2015-10-19 17:42:01 +0530348 /*
349 * Now, validate if channel change is required for the passed
350 * channel and if is valid in the current regulatory domain,
351 * and no concurrent session is running.
352 */
353 if (!((session_entry->currentOperChannel != target_channel) &&
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -0700354 ((wlan_reg_get_channel_state(mac_ctx->pdev, target_channel) ==
355 CHANNEL_STATE_ENABLE) ||
356 (wlan_reg_get_channel_state(mac_ctx->pdev, target_channel) ==
357 CHANNEL_STATE_DFS &&
358 !policy_mgr_concurrent_open_sessions_running(
359 mac_ctx->psoc))))) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530360 pe_err("Channel: %d is not valid", target_channel);
Abhishek Singh518323d2015-10-19 17:42:01 +0530361 return;
362 }
363
Visweswara Tanukud0c726b2018-04-09 18:14:08 +0530364 if ((eLIM_STA_ROLE == session_entry->limSystemRole) ||
365 (eLIM_P2P_DEVICE_CLIENT == session_entry->limSystemRole)) {
Abhishek Singh518323d2015-10-19 17:42:01 +0530366
367 struct sir_sme_ext_cng_chan_ind *ext_cng_chan_ind;
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700368 struct scheduler_msg mmh_msg = {0};
Abhishek Singh518323d2015-10-19 17:42:01 +0530369
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530370 ext_cng_chan_ind = qdf_mem_malloc(sizeof(*ext_cng_chan_ind));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700371 if (!ext_cng_chan_ind)
Abhishek Singh518323d2015-10-19 17:42:01 +0530372 return;
Abhishek Singh518323d2015-10-19 17:42:01 +0530373
Abhishek Singh518323d2015-10-19 17:42:01 +0530374 ext_cng_chan_ind->session_id =
375 session_entry->smeSessionId;
376
377 /* No need to extract op mode as BW will be decided in
378 * in SAP FSM depending on previous BW.
379 */
380 ext_cng_chan_ind->new_channel = target_channel;
381
382 mmh_msg.type = eWNI_SME_EXT_CHANGE_CHANNEL_IND;
383 mmh_msg.bodyptr = ext_cng_chan_ind;
384 mmh_msg.bodyval = 0;
385 lim_sys_process_mmh_msg_api(mac_ctx, &mmh_msg, ePROT);
386 }
387 return;
388} /*** end lim_process_ext_channel_switch_action_frame() ***/
389
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800390/**
391 * __lim_process_operating_mode_action_frame() - To process op mode frames
392 * @mac_ctx: pointer to mac context
393 * @rx_pkt_info: pointer to received packet info
394 * @session: pointer to session
395 *
396 * This routine is called to process operating mode action frames
397 *
398 * Return: None
399 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800400static void __lim_process_operating_mode_action_frame(struct mac_context *mac_ctx,
Jeff Johnson41ce2852018-11-19 06:51:22 -0800401 uint8_t *rx_pkt_info, struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800402{
403
404 tpSirMacMgmtHdr mac_hdr;
405 uint8_t *body_ptr;
406 tDot11fOperatingMode *operating_mode_frm;
407 uint32_t frame_len;
408 uint32_t status;
409 tpDphHashNode sta_ptr;
410 uint16_t aid;
411 uint8_t oper_mode;
412 uint8_t cb_mode;
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800413 uint8_t ch_bw = 0;
414 uint8_t skip_opmode_update = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800415
416 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
417 body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
418 frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
419
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530420 pe_debug("Received Operating Mode action frame");
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530421 operating_mode_frm = qdf_mem_malloc(sizeof(*operating_mode_frm));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700422 if (!operating_mode_frm)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800423 return;
Arif Hussainf5b6c412018-10-10 19:41:09 -0700424
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800425 /* Unpack channel switch frame */
426 status = dot11f_unpack_operating_mode(mac_ctx, body_ptr, frame_len,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +0530427 operating_mode_frm, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800428 if (DOT11F_FAILED(status)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530429 pe_err("Failed to unpack and parse (0x%08x, %d bytes)",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800430 status, frame_len);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530431 qdf_mem_free(operating_mode_frm);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800432 return;
433 } else if (DOT11F_WARNED(status)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530434 pe_warn("warnings while unpacking (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800435 status, frame_len);
436 }
437 sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid,
438 &session->dph.dphHashTable);
Padma, Santhosh Kumar79412ed2016-08-09 16:21:11 +0530439
440 if (sta_ptr == NULL) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530441 pe_err("Station context not found");
Padma, Santhosh Kumar79412ed2016-08-09 16:21:11 +0530442 goto end;
443 }
444
Naveen Rawat2f131932017-12-19 16:23:00 -0800445 if (CHAN_ENUM_14 >= session->currentOperChannel)
446 cb_mode = mac_ctx->roam.configParam.channelBondingMode24GHz;
447 else
448 cb_mode = mac_ctx->roam.configParam.channelBondingMode5GHz;
449 /*
450 * Do not update the channel bonding mode if channel bonding
451 * mode is disabled in INI.
452 */
453 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE == cb_mode) {
Naveen Rawat170420a2017-12-21 14:33:55 -0800454 pe_debug("channel bonding disabled");
Naveen Rawat2f131932017-12-19 16:23:00 -0800455 goto update_nss;
456 }
457
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800458 if (sta_ptr->htSupportedChannelWidthSet) {
459 if (WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ <
460 sta_ptr->vhtSupportedChannelWidthSet)
461 oper_mode = eHT_CHANNEL_WIDTH_160MHZ;
462 else
463 oper_mode = sta_ptr->vhtSupportedChannelWidthSet + 1;
464 } else {
465 oper_mode = eHT_CHANNEL_WIDTH_20MHZ;
466 }
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800467
468 if ((oper_mode == eHT_CHANNEL_WIDTH_80MHZ) &&
469 (operating_mode_frm->OperatingMode.chanWidth >
470 eHT_CHANNEL_WIDTH_80MHZ))
471 skip_opmode_update = true;
472
473 if (!skip_opmode_update && (oper_mode !=
474 operating_mode_frm->OperatingMode.chanWidth)) {
475 uint32_t fw_vht_ch_wd = wma_get_vht_ch_width();
476
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530477 pe_debug("received Chanwidth: %d staIdx: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800478 (operating_mode_frm->OperatingMode.chanWidth),
479 sta_ptr->staIndex);
480
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530481 pe_debug(" MAC: %0x:%0x:%0x:%0x:%0x:%0x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800482 mac_hdr->sa[0], mac_hdr->sa[1], mac_hdr->sa[2],
483 mac_hdr->sa[3], mac_hdr->sa[4], mac_hdr->sa[5]);
484
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800485 if (operating_mode_frm->OperatingMode.chanWidth >=
486 eHT_CHANNEL_WIDTH_160MHZ
487 && (fw_vht_ch_wd >= eHT_CHANNEL_WIDTH_160MHZ)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800488 sta_ptr->vhtSupportedChannelWidthSet =
489 WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ;
490 sta_ptr->htSupportedChannelWidthSet =
491 eHT_CHANNEL_WIDTH_40MHZ;
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800492 ch_bw = eHT_CHANNEL_WIDTH_160MHZ;
493 } else if (operating_mode_frm->OperatingMode.chanWidth >=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800494 eHT_CHANNEL_WIDTH_80MHZ) {
495 sta_ptr->vhtSupportedChannelWidthSet =
496 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
497 sta_ptr->htSupportedChannelWidthSet =
498 eHT_CHANNEL_WIDTH_40MHZ;
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800499 ch_bw = eHT_CHANNEL_WIDTH_80MHZ;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800500 } else if (operating_mode_frm->OperatingMode.chanWidth ==
501 eHT_CHANNEL_WIDTH_40MHZ) {
502 sta_ptr->vhtSupportedChannelWidthSet =
503 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
504 sta_ptr->htSupportedChannelWidthSet =
505 eHT_CHANNEL_WIDTH_40MHZ;
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800506 ch_bw = eHT_CHANNEL_WIDTH_40MHZ;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800507 } else if (operating_mode_frm->OperatingMode.chanWidth ==
508 eHT_CHANNEL_WIDTH_20MHZ) {
509 sta_ptr->vhtSupportedChannelWidthSet =
510 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
511 sta_ptr->htSupportedChannelWidthSet =
512 eHT_CHANNEL_WIDTH_20MHZ;
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800513 ch_bw = eHT_CHANNEL_WIDTH_20MHZ;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800514 }
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800515 lim_check_vht_op_mode_change(mac_ctx, session, ch_bw,
516 sta_ptr->staIndex, mac_hdr->sa);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800517 }
518
Naveen Rawat2f131932017-12-19 16:23:00 -0800519update_nss:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800520 if (sta_ptr->vhtSupportedRxNss !=
521 (operating_mode_frm->OperatingMode.rxNSS + 1)) {
522 sta_ptr->vhtSupportedRxNss =
523 operating_mode_frm->OperatingMode.rxNSS + 1;
Naveen Rawat5b933dc2016-10-31 09:39:43 -0700524 lim_set_nss_change(mac_ctx, session, sta_ptr->vhtSupportedRxNss,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800525 sta_ptr->staIndex, mac_hdr->sa);
526 }
Padma, Santhosh Kumar79412ed2016-08-09 16:21:11 +0530527
528end:
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530529 qdf_mem_free(operating_mode_frm);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800530 return;
531}
532
533/**
534 * __lim_process_gid_management_action_frame() - To process group-id mgmt frames
535 * @mac_ctx: Pointer to mac context
536 * @rx_pkt_info: Rx packet info
537 * @session: pointer to session
538 *
539 * This routine will be called to process group id management frames
540 *
541 * Return: none
542 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800543static void __lim_process_gid_management_action_frame(struct mac_context *mac_ctx,
Jeff Johnson41ce2852018-11-19 06:51:22 -0800544 uint8_t *rx_pkt_info, struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800545{
546
547 uint8_t *body_ptr;
548 uint16_t aid;
549 uint32_t frame_len, status, membership = 0, usr_position = 0;
550 uint32_t *mem_lower, *mem_upper, *mem_cur;
551 tpSirMacMgmtHdr mac_hdr;
552 tDot11fVHTGidManagementActionFrame *gid_mgmt_frame;
553 tpDphHashNode sta_ptr;
554 struct sDot11fFfVhtMembershipStatusArray *vht_member_status = NULL;
555 struct sDot11fFfVhtUserPositionArray *vht_user_position = NULL;
556
557 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
558 body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
559 frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
560
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530561 pe_debug("Received GID Management action frame");
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530562 gid_mgmt_frame = qdf_mem_malloc(sizeof(*gid_mgmt_frame));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700563 if (!gid_mgmt_frame)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800564 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800565
Jeff Johnson9020f0c2018-05-06 08:08:25 -0700566 /* Unpack Gid Management Action frame */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800567 status = dot11f_unpack_vht_gid_management_action_frame(mac_ctx,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +0530568 body_ptr, frame_len, gid_mgmt_frame, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800569 if (DOT11F_FAILED(status)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530570 pe_err("Fail to parse an Grp id frame (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800571 status, frame_len);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530572 qdf_mem_free(gid_mgmt_frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800573 return;
574 } else if (DOT11F_WARNED(status)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530575 pe_warn("warnings while unpacking Grp id frm (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800576 status, frame_len);
577 }
578 sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid,
579 &session->dph.dphHashTable);
Arif Hussain4a682392016-10-25 13:59:03 -0700580 if (!sta_ptr) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530581 pe_err("Failed to get STA entry from hash table");
Arif Hussain4a682392016-10-25 13:59:03 -0700582 goto out;
583 }
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530584 pe_debug("received Gid Management Action Frame staIdx: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800585 sta_ptr->staIndex);
586
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530587 pe_debug(" MAC: %0x:%0x:%0x:%0x:%0x:%0x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800588 mac_hdr->sa[0], mac_hdr->sa[1], mac_hdr->sa[2],
589 mac_hdr->sa[3], mac_hdr->sa[4], mac_hdr->sa[5]);
590 vht_member_status = &gid_mgmt_frame->VhtMembershipStatusArray;
591 mem_lower = (uint32_t *) vht_member_status->membershipStatusArray;
592 mem_upper = (uint32_t *) &vht_member_status->membershipStatusArray[4];
593
594 if (*mem_lower && *mem_upper) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530595 pe_err("rcved frame with mult group ID set, staIdx = %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800596 sta_ptr->staIndex);
597 goto out;
598 }
599 if (*mem_lower) {
600 mem_cur = mem_lower;
601 } else if (*mem_upper) {
602 mem_cur = mem_upper;
603 membership += sizeof(uint32_t);
604 } else {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530605 pe_err("rcved Gid frame with no group ID set, staIdx: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800606 sta_ptr->staIndex);
607 goto out;
608 }
609 while (!(*mem_cur & 1)) {
610 *mem_cur >>= 1;
611 ++membership;
612 }
613 if (*mem_cur) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530614 pe_err("rcved frame with mult group ID set, staIdx: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800615 sta_ptr->staIndex);
616 goto out;
617 }
618
619 /*Just read the last two bits */
620 vht_user_position = &gid_mgmt_frame->VhtUserPositionArray;
621 usr_position = vht_user_position->userPositionArray[membership] & 0x3;
622 lim_check_membership_user_position(mac_ctx, session, membership,
623 usr_position, sta_ptr->staIndex);
624out:
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530625 qdf_mem_free(gid_mgmt_frame);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800626 return;
627}
628
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800629static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800630__lim_process_add_ts_req(struct mac_context *mac, uint8_t *pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800631 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800632{
633}
634
635/**
636 * __lim_process_add_ts_rsp() - To process add ts response frame
637 * @mac_ctx: pointer to mac context
638 * @rx_pkt_info: Received packet info
639 * @session: pointer to session
640 *
641 * This routine is to handle add ts response frame
642 *
643 * Return: none
644 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800645static void __lim_process_add_ts_rsp(struct mac_context *mac_ctx,
Jeff Johnson41ce2852018-11-19 06:51:22 -0800646 uint8_t *rx_pkt_info, struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800647{
648 tSirAddtsRspInfo addts;
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700649 QDF_STATUS retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800650 tpSirMacMgmtHdr mac_hdr;
651 tpDphHashNode sta_ptr;
652 uint16_t aid;
653 uint32_t frameLen;
654 uint8_t *body_ptr;
655 tpLimTspecInfo tspec_info;
656 uint8_t ac;
657 tpDphHashNode sta_ds_ptr = NULL;
658 uint8_t rsp_reqd = 1;
659 uint32_t cfg_len;
660 tSirMacAddr peer_macaddr;
661
662 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
663 body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
664 frameLen = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
665
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530666 pe_warn("Recv AddTs Response");
Rajeev Kumarbe5d7fd2016-04-15 14:35:12 -0700667 if (LIM_IS_AP_ROLE(session)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530668 pe_warn("AddTsRsp recvd at AP: ignoring");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800669 return;
670 }
671
672 sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid,
673 &session->dph.dphHashTable);
674 if (sta_ptr == NULL) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530675 pe_err("Station context not found - ignoring AddTsRsp");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800676 return;
677 }
678
679 retval = sir_convert_addts_rsp2_struct(mac_ctx, body_ptr,
680 frameLen, &addts);
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700681 if (retval != QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530682 pe_err("AddTsRsp parsing failed %d", retval);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800683 return;
684 }
685 /*
686 * don't have to check for qos/wme capabilities since we wouldn't have
687 * this flag set otherwise
688 */
689 if (!mac_ctx->lim.gLimAddtsSent) {
690 /* we never sent an addts request! */
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530691 pe_warn("rx AddTsRsp but no req was ever sent-ignoring");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800692 return;
693 }
694
695 if (mac_ctx->lim.gLimAddtsReq.req.dialogToken != addts.dialogToken) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530696 pe_warn("token mismatch got: %d exp: %d - ignoring",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800697 addts.dialogToken,
698 mac_ctx->lim.gLimAddtsReq.req.dialogToken);
699 return;
700 }
701
702 /*
Jeff Johnson47d75242018-05-12 15:58:53 -0700703 * for successful addts response, try to add the classifier.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800704 * if this fails for any reason, we should send a delts request to the
705 * ap for now, its ok not to send a delts since we are going to add
706 * support for multiple tclas soon and until then we won't send any
707 * addts requests with multiple tclas elements anyway.
708 * In case of addClassifier failure, we just let the addts timer run out
709 */
710 if (((addts.tspec.tsinfo.traffic.accessPolicy ==
711 SIR_MAC_ACCESSPOLICY_HCCA) ||
712 (addts.tspec.tsinfo.traffic.accessPolicy ==
713 SIR_MAC_ACCESSPOLICY_BOTH)) &&
714 (addts.status == eSIR_MAC_SUCCESS_STATUS)) {
715 /* add the classifier - this should always succeed */
716 if (addts.numTclas > 1) {
717 /* currently no support for multiple tclas elements */
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530718 pe_err("Sta: %d Too many Tclas: %d 1 supported",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800719 aid, addts.numTclas);
720 return;
721 } else if (addts.numTclas == 1) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530722 pe_debug("Response from STA: %d tsid: %d UP: %d OK!",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800723 aid, addts.tspec.tsinfo.traffic.tsid,
724 addts.tspec.tsinfo.traffic.userPrio);
725 }
726 }
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530727 pe_debug("Recv AddTsRsp: tsid: %d UP: %d status: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800728 addts.tspec.tsinfo.traffic.tsid,
729 addts.tspec.tsinfo.traffic.userPrio, addts.status);
730
731 /* deactivate the response timer */
732 lim_deactivate_and_change_timer(mac_ctx, eLIM_ADDTS_RSP_TIMER);
733
734 if (addts.status != eSIR_MAC_SUCCESS_STATUS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530735 pe_debug("Recv AddTsRsp: tsid: %d UP: %d status: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800736 addts.tspec.tsinfo.traffic.tsid,
737 addts.tspec.tsinfo.traffic.userPrio, addts.status);
738 lim_send_sme_addts_rsp(mac_ctx, true, addts.status, session,
739 addts.tspec, session->smeSessionId,
740 session->transactionId);
741
742 /* clear the addts flag */
743 mac_ctx->lim.gLimAddtsSent = false;
744
745 return;
746 }
747#ifdef FEATURE_WLAN_ESE
748 if (addts.tsmPresent) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530749 pe_debug("TSM IE Present");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800750 session->eseContext.tsm.tid =
751 addts.tspec.tsinfo.traffic.userPrio;
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530752 qdf_mem_copy(&session->eseContext.tsm.tsmInfo,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800753 &addts.tsmIE, sizeof(tSirMacESETSMIE));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800754 lim_send_sme_tsm_ie_ind(mac_ctx, session, addts.tsmIE.tsid,
755 addts.tsmIE.state,
756 addts.tsmIE.msmt_interval);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800757 }
758#endif
759 /*
760 * Since AddTS response was successful, check for the PSB flag
761 * and directional flag inside the TS Info field.
762 * An AC is trigger enabled AC if the PSB subfield is set to 1
763 * in the uplink direction.
764 * An AC is delivery enabled AC if the PSB subfield is set to 1
765 * in the downlink direction.
766 * An AC is trigger and delivery enabled AC if the PSB subfield
767 * is set to 1 in the bi-direction field.
768 */
769 if (addts.tspec.tsinfo.traffic.psb == 1)
770 lim_set_tspec_uapsd_mask_per_session(mac_ctx, session,
771 &addts.tspec.tsinfo,
772 SET_UAPSD_MASK);
773 else
774 lim_set_tspec_uapsd_mask_per_session(mac_ctx, session,
775 &addts.tspec.tsinfo,
776 CLEAR_UAPSD_MASK);
777
778 /*
779 * ADDTS success, so AC is now admitted. We shall now use the default
780 * EDCA parameters as advertised by AP and send the updated EDCA params
781 * to HAL.
782 */
783 ac = upToAc(addts.tspec.tsinfo.traffic.userPrio);
784 if (addts.tspec.tsinfo.traffic.direction ==
785 SIR_MAC_DIRECTION_UPLINK) {
786 session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |=
787 (1 << ac);
788 } else if (addts.tspec.tsinfo.traffic.direction ==
789 SIR_MAC_DIRECTION_DNLINK) {
790 session->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |=
791 (1 << ac);
792 } else if (addts.tspec.tsinfo.traffic.direction ==
793 SIR_MAC_DIRECTION_BIDIR) {
794 session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |=
795 (1 << ac);
796 session->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |=
797 (1 << ac);
798 }
799 lim_set_active_edca_params(mac_ctx, session->gLimEdcaParams,
800 session);
801 sta_ds_ptr = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER,
802 &session->dph.dphHashTable);
803 if (sta_ds_ptr != NULL)
804 lim_send_edca_params(mac_ctx, session->gLimEdcaParamsActive,
Kiran Kumar Lokere27026ae2018-03-09 11:38:19 -0800805 sta_ds_ptr->bssId, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800806 else
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530807 pe_err("Self entry missing in Hash Table");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800808 sir_copy_mac_addr(peer_macaddr, session->bssId);
809 /* if schedule is not present then add TSPEC with svcInterval as 0. */
810 if (!addts.schedulePresent)
811 addts.schedule.svcInterval = 0;
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700812 if (QDF_STATUS_SUCCESS !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800813 lim_tspec_add(mac_ctx, sta_ptr->staAddr, sta_ptr->assocId,
814 &addts.tspec, addts.schedule.svcInterval, &tspec_info)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530815 pe_err("Adding entry in lim Tspec Table failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800816 lim_send_delts_req_action_frame(mac_ctx, peer_macaddr, rsp_reqd,
817 &addts.tspec.tsinfo,
818 &addts.tspec, session);
819 mac_ctx->lim.gLimAddtsSent = false;
820 return;
821 /*
822 * Error handling. send the response with error status.
823 * need to send DelTS to tear down the TSPEC status.
824 */
825 }
826 if ((addts.tspec.tsinfo.traffic.accessPolicy !=
827 SIR_MAC_ACCESSPOLICY_EDCA) ||
828 ((upToAc(addts.tspec.tsinfo.traffic.userPrio) < MAX_NUM_AC))) {
829#ifdef FEATURE_WLAN_ESE
830 retval = lim_send_hal_msg_add_ts(mac_ctx,
831 sta_ptr->staIndex, tspec_info->idx,
832 addts.tspec, session->peSessionId,
833 addts.tsmIE.msmt_interval);
834#else
835 retval = lim_send_hal_msg_add_ts(mac_ctx,
836 sta_ptr->staIndex, tspec_info->idx,
837 addts.tspec, session->peSessionId);
838#endif
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700839 if (QDF_STATUS_SUCCESS != retval) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800840 lim_admit_control_delete_ts(mac_ctx, sta_ptr->assocId,
841 &addts.tspec.tsinfo, NULL, &tspec_info->idx);
842
843 /* Send DELTS action frame to AP */
844 cfg_len = sizeof(tSirMacAddr);
845 lim_send_delts_req_action_frame(mac_ctx, peer_macaddr,
846 rsp_reqd, &addts.tspec.tsinfo,
847 &addts.tspec, session);
848 lim_send_sme_addts_rsp(mac_ctx, true, retval,
849 session, addts.tspec,
850 session->smeSessionId,
851 session->transactionId);
852 mac_ctx->lim.gLimAddtsSent = false;
853 return;
854 }
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530855 pe_debug("AddTsRsp received successfully UP: %d TSID: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800856 addts.tspec.tsinfo.traffic.userPrio,
857 addts.tspec.tsinfo.traffic.tsid);
858 } else {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530859 pe_debug("AddTsRsp received successfully UP: %d TSID: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800860 addts.tspec.tsinfo.traffic.userPrio,
861 addts.tspec.tsinfo.traffic.tsid);
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530862 pe_debug("no ACM: Bypass sending WMA_ADD_TS_REQ to HAL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800863 /*
864 * Use the smesessionId and smetransactionId from the PE
865 * session context
866 */
867 lim_send_sme_addts_rsp(mac_ctx, true, eSIR_SME_SUCCESS,
868 session, addts.tspec, session->smeSessionId,
869 session->transactionId);
870 }
871 /* clear the addts flag */
872 mac_ctx->lim.gLimAddtsSent = false;
873 return;
874}
875
876/**
877 * __lim_process_del_ts_req() - To process del ts response frame
878 * @mac_ctx: pointer to mac context
879 * @rx_pkt_info: Received packet info
880 * @session: pointer to session
881 *
882 * This routine is to handle del ts request frame
883 *
884 * Return: none
885 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800886static void __lim_process_del_ts_req(struct mac_context *mac_ctx,
Jeff Johnson41ce2852018-11-19 06:51:22 -0800887 uint8_t *rx_pkt_info, struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800888{
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700889 QDF_STATUS retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800890 tSirDeltsReqInfo delts;
891 tpSirMacMgmtHdr mac_hdr;
892 tpDphHashNode sta_ptr;
893 uint32_t frame_len;
894 uint16_t aid;
895 uint8_t *body_ptr;
896 uint8_t ts_status;
897 tSirMacTSInfo *tsinfo;
898 uint8_t tspec_idx;
899 uint8_t ac;
900 tpDphHashNode sta_ds_ptr = NULL;
901
902 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
903 body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
904 frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
905
906 sta_ptr = dph_lookup_hash_entry(mac_ctx, mac_hdr->sa, &aid,
907 &session->dph.dphHashTable);
908 if (sta_ptr == NULL) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530909 pe_err("Station context not found - ignoring DelTs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800910 return;
911 }
912 /* parse the delts request */
913 retval = sir_convert_delts_req2_struct(mac_ctx, body_ptr,
914 frame_len, &delts);
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700915 if (retval != QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530916 pe_err("DelTs parsing failed %d", retval);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800917 return;
918 }
919
920 if (delts.wmeTspecPresent) {
921 if ((!session->limWmeEnabled) || (!sta_ptr->wmeEnabled)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530922 pe_warn("Ignore delts req: wme not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800923 return;
924 }
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530925 pe_debug("WME Delts received");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800926 } else if ((session->limQosEnabled) && sta_ptr->lleEnabled) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530927 pe_debug("11e QoS Delts received");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800928 } else if ((session->limWsmEnabled) && sta_ptr->wsmEnabled) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530929 pe_debug("WSM Delts received");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800930 } else {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530931 pe_warn("Ignoring delts request: qos not enabled/capable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800932 return;
933 }
934
935 tsinfo = delts.wmeTspecPresent ? &delts.tspec.tsinfo : &delts.tsinfo;
936
937 /* if no Admit Control, ignore the request */
Srinivas Girigowdaf326dfe2017-08-03 11:28:32 -0700938 if (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800939 if (upToAc(tsinfo->traffic.userPrio) >= MAX_NUM_AC) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530940 pe_warn("DelTs with UP: %d has no AC - ignoring req",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800941 tsinfo->traffic.userPrio);
942 return;
943 }
944 }
945
Rajeev Kumarbe5d7fd2016-04-15 14:35:12 -0700946 if (!LIM_IS_AP_ROLE(session))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800947 lim_send_sme_delts_ind(mac_ctx, &delts, aid, session);
948
949 /* try to delete the TS */
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700950 if (QDF_STATUS_SUCCESS !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800951 lim_admit_control_delete_ts(mac_ctx, sta_ptr->assocId, tsinfo,
952 &ts_status, &tspec_idx)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530953 pe_warn("Unable to Delete TS");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800954 return;
955 } else if (!((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA)
956 || (tsinfo->traffic.accessPolicy ==
957 SIR_MAC_ACCESSPOLICY_BOTH))){
958 /* send message to HAL to delete TS */
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700959 if (QDF_STATUS_SUCCESS != lim_send_hal_msg_del_ts(mac_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800960 sta_ptr->staIndex, tspec_idx,
961 delts, session->peSessionId,
962 session->bssId)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +0530963 pe_warn("DelTs with UP: %d failed ignoring request",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800964 tsinfo->traffic.userPrio);
965 return;
966 }
967 }
968 /*
969 * We successfully deleted the TSPEC. Update the dynamic UAPSD Mask.
970 * The AC for this TSPEC is no longer trigger enabled if this Tspec
971 * was set-up in uplink direction only.
972 * The AC for this TSPEC is no longer delivery enabled if this Tspec
973 * was set-up in downlink direction only.
974 * The AC for this TSPEC is no longer triiger enabled and delivery
975 * enabled if this Tspec was a bidirectional TSPEC.
976 */
977 lim_set_tspec_uapsd_mask_per_session(mac_ctx, session,
978 tsinfo, CLEAR_UAPSD_MASK);
979 /*
980 * We're deleting the TSPEC.
981 * The AC for this TSPEC is no longer admitted in uplink/downlink
982 * direction if this TSPEC was set-up in uplink/downlink direction only.
983 * The AC for this TSPEC is no longer admitted in both uplink and
984 * downlink directions if this TSPEC was a bi-directional TSPEC.
985 * If ACM is set for this AC and this AC is admitted only in downlink
986 * direction, PE needs to downgrade the EDCA parameter
987 * (for the AC for which TS is being deleted) to the
988 * next best AC for which ACM is not enabled, and send the
989 * updated values to HAL.
990 */
991 ac = upToAc(tsinfo->traffic.userPrio);
992 if (tsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK) {
993 session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &=
994 ~(1 << ac);
995 } else if (tsinfo->traffic.direction ==
996 SIR_MAC_DIRECTION_DNLINK) {
997 session->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &=
998 ~(1 << ac);
999 } else if (tsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR) {
1000 session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &=
1001 ~(1 << ac);
1002 session->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &=
1003 ~(1 << ac);
1004 }
1005 lim_set_active_edca_params(mac_ctx, session->gLimEdcaParams,
1006 session);
1007 sta_ds_ptr = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER,
1008 &session->dph.dphHashTable);
1009 if (sta_ds_ptr != NULL)
1010 lim_send_edca_params(mac_ctx, session->gLimEdcaParamsActive,
Kiran Kumar Lokere27026ae2018-03-09 11:38:19 -08001011 sta_ds_ptr->bssId, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001012 else
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301013 pe_err("Self entry missing in Hash Table");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001014
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301015 pe_debug("DeleteTS succeeded");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001016#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001017 lim_send_sme_tsm_ie_ind(mac_ctx, session, 0, 0, 0);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001018#endif
1019}
1020
1021/**
1022 * __lim_process_qos_map_configure_frame() - to process QoS map configure frame
1023 * @mac_ctx: pointer to mac context
1024 * @rx_pkt_info: pointer to received packet info
1025 * @session: pointer to session
1026 *
1027 * This routine will called to process qos map configure frame
1028 *
1029 * Return: none
1030 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001031static void __lim_process_qos_map_configure_frame(struct mac_context *mac_ctx,
Jeff Johnson41ce2852018-11-19 06:51:22 -08001032 uint8_t *rx_pkt_info, struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001033{
1034 tpSirMacMgmtHdr mac_hdr;
1035 uint32_t frame_len;
1036 uint8_t *body_ptr;
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001037 QDF_STATUS retval;
Srinivas Girigowda4d65ebe2017-10-13 21:41:42 -07001038
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001039 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
1040 body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
1041 frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
1042 retval = sir_convert_qos_map_configure_frame2_struct(mac_ctx,
1043 body_ptr, frame_len, &session->QosMapSet);
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001044 if (retval != QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301045 pe_err("QosMapConfigure frame parsing fail %d", retval);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001046 return;
1047 }
1048 lim_send_sme_mgmt_frame_ind(mac_ctx, mac_hdr->fc.subType,
1049 (uint8_t *) mac_hdr,
1050 frame_len + sizeof(tSirMacMgmtHdr), 0,
yeshwanth sriram guntuka2bc14352017-04-26 13:07:32 +05301051 WMA_GET_RX_CH(rx_pkt_info), session,
1052 WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001053}
1054
1055#ifdef ANI_SUPPORT_11H
1056static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001057__lim_process_basic_meas_req(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001058 tpSirMacMeasReqActionFrame pMeasReqFrame,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001059 tSirMacAddr peerMacAddr, struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001060{
Jeff Johnson348973e2018-11-22 16:51:12 -08001061 if (lim_send_meas_report_frame(mac, pMeasReqFrame,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001062 peerMacAddr, pe_session) !=
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001063 QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301064 pe_err("fail to send Basic Meas report");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001065 return;
1066 }
1067}
1068static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001069__lim_process_cca_meas_req(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001070 tpSirMacMeasReqActionFrame pMeasReqFrame,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001071 tSirMacAddr peerMacAddr, struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001072{
Jeff Johnson348973e2018-11-22 16:51:12 -08001073 if (lim_send_meas_report_frame(mac, pMeasReqFrame,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001074 peerMacAddr, pe_session) !=
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001075 QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301076 pe_err("fail to send CCA Meas report");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001077 return;
1078 }
1079}
1080static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001081__lim_process_rpi_meas_req(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001082 tpSirMacMeasReqActionFrame pMeasReqFrame,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001083 tSirMacAddr peerMacAddr, struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001084{
Jeff Johnson348973e2018-11-22 16:51:12 -08001085 if (lim_send_meas_report_frame(mac, pMeasReqFrame,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001086 peerMacAddr, pe_session) !=
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001087 QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301088 pe_err("fail to send RPI Meas report");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001089 return;
1090 }
1091}
1092static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001093__lim_process_measurement_request_frame(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001094 uint8_t *pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001095 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001096{
1097 tpSirMacMgmtHdr pHdr;
1098 uint8_t *pBody;
1099 tpSirMacMeasReqActionFrame pMeasReqFrame;
1100 uint32_t frameLen;
1101
1102 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
1103 pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo);
1104 frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1105
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301106 pMeasReqFrame = qdf_mem_malloc(sizeof(tSirMacMeasReqActionFrame));
Arif Hussainf5b6c412018-10-10 19:41:09 -07001107 if (!pMeasReqFrame)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001108 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001109
Jeff Johnson348973e2018-11-22 16:51:12 -08001110 if (sir_convert_meas_req_frame2_struct(mac, pBody, pMeasReqFrame, frameLen)
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001111 != QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301112 pe_warn("Rcv invalid Measurement Request Action Frame");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001113 return;
1114 }
1115 switch (pMeasReqFrame->measReqIE.measType) {
1116 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
Jeff Johnson348973e2018-11-22 16:51:12 -08001117 __lim_process_basic_meas_req(mac, pMeasReqFrame, pHdr->sa,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001118 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001119 break;
1120 case SIR_MAC_CCA_MEASUREMENT_TYPE:
Jeff Johnson348973e2018-11-22 16:51:12 -08001121 __lim_process_cca_meas_req(mac, pMeasReqFrame, pHdr->sa,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001122 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001123 break;
1124 case SIR_MAC_RPI_MEASUREMENT_TYPE:
Jeff Johnson348973e2018-11-22 16:51:12 -08001125 __lim_process_rpi_meas_req(mac, pMeasReqFrame, pHdr->sa,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001126 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001127 break;
1128 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301129 pe_warn("Unknown Measurement Type: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001130 pMeasReqFrame->measReqIE.measType);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001131 break;
1132 }
1133} /*** end limProcessMeasurementRequestFrame ***/
1134static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001135__lim_process_tpc_request_frame(struct mac_context *mac, uint8_t *pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001136 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001137{
1138 tpSirMacMgmtHdr pHdr;
1139 uint8_t *pBody;
1140 tpSirMacTpcReqActionFrame pTpcReqFrame;
1141 uint32_t frameLen;
Srinivas Girigowda4d65ebe2017-10-13 21:41:42 -07001142
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001143 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
1144 pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo);
1145 frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301146 pe_debug("****LIM: Processing TPC Request from peer ****");
Nishank Aggarwal7f494192017-03-11 13:46:18 +05301147
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301148 pTpcReqFrame = qdf_mem_malloc(sizeof(tSirMacTpcReqActionFrame));
Arif Hussainf5b6c412018-10-10 19:41:09 -07001149 if (!pTpcReqFrame)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001150 return;
Arif Hussainf5b6c412018-10-10 19:41:09 -07001151
Jeff Johnson348973e2018-11-22 16:51:12 -08001152 if (sir_convert_tpc_req_frame2_struct(mac, pBody, pTpcReqFrame, frameLen) !=
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001153 QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301154 pe_warn("Rcv invalid TPC Req Action Frame");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001155 return;
1156 }
Jeff Johnson348973e2018-11-22 16:51:12 -08001157 if (lim_send_tpc_report_frame(mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001158 pTpcReqFrame,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001159 pHdr->sa, pe_session) != QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301160 pe_err("fail to send TPC Report Frame");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001161 return;
1162 }
1163}
1164#endif
1165
1166static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001167__lim_process_sm_power_save_update(struct mac_context *mac, uint8_t *pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001168 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001169{
1170
1171 tpSirMacMgmtHdr pHdr;
1172 tDot11fSMPowerSave frmSMPower;
1173 tSirMacHTMIMOPowerSaveState state;
1174 tpDphHashNode pSta;
1175 uint16_t aid;
1176 uint32_t frameLen, nStatus;
1177 uint8_t *pBody;
1178
1179 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
1180 pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo);
1181 frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1182
1183 pSta =
Jeff Johnson348973e2018-11-22 16:51:12 -08001184 dph_lookup_hash_entry(mac, pHdr->sa, &aid,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001185 &pe_session->dph.dphHashTable);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001186 if (pSta == NULL) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301187 pe_err("STA context not found - ignoring UpdateSM PSave Mode from");
Jeff Johnson348973e2018-11-22 16:51:12 -08001188 lim_print_mac_addr(mac, pHdr->sa, LOGE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001189 return;
1190 }
1191
1192 /**Unpack the received frame */
Jeff Johnson348973e2018-11-22 16:51:12 -08001193 nStatus = dot11f_unpack_sm_power_save(mac, pBody, frameLen,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +05301194 &frmSMPower, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001195
1196 if (DOT11F_FAILED(nStatus)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301197 pe_err("Failed to unpack and parse a Update SM Power (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001198 nStatus, frameLen);
Srinivas Girigowdab896a562017-03-16 17:41:26 -07001199 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
1200 pBody, frameLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001201 return;
1202 } else if (DOT11F_WARNED(nStatus)) {
Rajeev Kumarb5813802017-06-29 17:34:57 -07001203 pe_debug("There were warnings while unpacking a SMPower Save update (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001204 nStatus, frameLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001205 }
1206
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301207 pe_debug("Received SM Power save Mode update Frame with PS_Enable: %d"
1208 "PS Mode: %d", frmSMPower.SMPowerModeSet.PowerSave_En,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001209 frmSMPower.SMPowerModeSet.Mode);
1210
1211 /** Update in the DPH Table about the Update in the SM Power Save mode*/
1212 if (frmSMPower.SMPowerModeSet.PowerSave_En
1213 && frmSMPower.SMPowerModeSet.Mode)
1214 state = eSIR_HT_MIMO_PS_DYNAMIC;
1215 else if ((frmSMPower.SMPowerModeSet.PowerSave_En)
1216 && (frmSMPower.SMPowerModeSet.Mode == 0))
1217 state = eSIR_HT_MIMO_PS_STATIC;
1218 else if ((frmSMPower.SMPowerModeSet.PowerSave_En == 0)
1219 && (frmSMPower.SMPowerModeSet.Mode == 0))
1220 state = eSIR_HT_MIMO_PS_NO_LIMIT;
1221 else {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301222 pe_warn("Received SM Power save Mode update Frame with invalid mode");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001223 return;
1224 }
1225
1226 if (state == pSta->htMIMOPSState) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301227 pe_err("The PEER is already set in the same mode");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001228 return;
1229 }
1230
1231 /** Update in the HAL Station Table for the Update of the Protection Mode */
1232 pSta->htMIMOPSState = state;
Jeff Johnson348973e2018-11-22 16:51:12 -08001233 lim_post_sm_state_update(mac, pSta->staIndex, pSta->htMIMOPSState,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001234 pSta->staAddr, pe_session->smeSessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001235}
1236
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001237
1238static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001239__lim_process_radio_measure_request(struct mac_context *mac, uint8_t *pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001240 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001241{
1242 tpSirMacMgmtHdr pHdr;
Mohit Khanna841044f2016-03-25 16:16:24 -07001243 tDot11fRadioMeasurementRequest *frm;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001244 uint32_t frameLen, nStatus;
1245 uint8_t *pBody;
Abhinav Kumarfcc22e02018-03-23 16:46:06 +05301246 uint16_t curr_seq_num;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001247
1248 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
1249 pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo);
1250 frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1251
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001252 if (pe_session == NULL) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001253 return;
1254 }
1255
Abhinav Kumarfcc22e02018-03-23 16:46:06 +05301256 curr_seq_num = ((pHdr->seqControl.seqNumHi <<
1257 HIGH_SEQ_NUM_OFFSET) |
1258 pHdr->seqControl.seqNumLo);
Jeff Johnson348973e2018-11-22 16:51:12 -08001259 if (curr_seq_num == mac->rrm.rrmPEContext.prev_rrm_report_seq_num &&
1260 mac->rrm.rrmPEContext.pCurrentReq) {
Abhinav Kumarfcc22e02018-03-23 16:46:06 +05301261 pe_err("rrm report req frame, seq num: %d is already in progress, drop it",
1262 curr_seq_num);
1263 return;
1264 }
1265 /* Save seq no of currently processing rrm report req frame */
Jeff Johnson348973e2018-11-22 16:51:12 -08001266 mac->rrm.rrmPEContext.prev_rrm_report_seq_num = curr_seq_num;
1267 lim_send_sme_mgmt_frame_ind(mac, pHdr->fc.subType, (uint8_t *)pHdr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001268 frameLen + sizeof(tSirMacMgmtHdr), 0,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001269 WMA_GET_RX_CH(pRxPacketInfo), pe_session,
yeshwanth sriram guntuka2bc14352017-04-26 13:07:32 +05301270 WMA_GET_RX_RSSI_NORMALIZED(pRxPacketInfo));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001271
Mohit Khanna841044f2016-03-25 16:16:24 -07001272 frm = qdf_mem_malloc(sizeof(*frm));
Arif Hussainf5b6c412018-10-10 19:41:09 -07001273 if (!frm)
Mohit Khanna841044f2016-03-25 16:16:24 -07001274 return;
Mohit Khanna841044f2016-03-25 16:16:24 -07001275
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001276 /**Unpack the received frame */
Jeff Johnson348973e2018-11-22 16:51:12 -08001277 nStatus = dot11f_unpack_radio_measurement_request(mac, pBody,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +05301278 frameLen, frm, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001279
1280 if (DOT11F_FAILED(nStatus)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301281 pe_err("Failed to unpack and parse a Radio Measure request (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001282 nStatus, frameLen);
Srinivas Girigowdab896a562017-03-16 17:41:26 -07001283 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
1284 pBody, frameLen);
Srinivas Girigowdaeff16d92018-09-12 14:56:29 -07001285 goto err;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001286 } else if (DOT11F_WARNED(nStatus)) {
Rajeev Kumarb5813802017-06-29 17:34:57 -07001287 pe_debug("There were warnings while unpacking a Radio Measure request (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001288 nStatus, frameLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001289 }
1290 /* Call rrm function to handle the request. */
1291
Jeff Johnson348973e2018-11-22 16:51:12 -08001292 rrm_process_radio_measurement_request(mac, pHdr->sa, frm,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001293 pe_session);
Mohit Khanna841044f2016-03-25 16:16:24 -07001294err:
1295 qdf_mem_free(frm);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001296}
1297
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001298static QDF_STATUS
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001299__lim_process_link_measurement_req(struct mac_context *mac, uint8_t *pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001300 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001301{
1302 tpSirMacMgmtHdr pHdr;
1303 tDot11fLinkMeasurementRequest frm;
1304 uint32_t frameLen, nStatus;
1305 uint8_t *pBody;
1306
1307 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
1308 pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo);
1309 frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1310
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001311 if (pe_session == NULL) {
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001312 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001313 }
1314
1315 /**Unpack the received frame */
1316 nStatus =
Jeff Johnson348973e2018-11-22 16:51:12 -08001317 dot11f_unpack_link_measurement_request(mac, pBody, frameLen,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +05301318 &frm, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001319
1320 if (DOT11F_FAILED(nStatus)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301321 pe_err("Failed to unpack and parse a Link Measure request (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001322 nStatus, frameLen);
Srinivas Girigowdab896a562017-03-16 17:41:26 -07001323 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
1324 pBody, frameLen);
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001325 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001326 } else if (DOT11F_WARNED(nStatus)) {
Rajeev Kumarb5813802017-06-29 17:34:57 -07001327 pe_debug("There were warnings while unpacking a Link Measure request (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001328 nStatus, frameLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001329 }
1330 /* Call rrm function to handle the request. */
1331
Jeff Johnson348973e2018-11-22 16:51:12 -08001332 return rrm_process_link_measurement_request(mac, pRxPacketInfo, &frm,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001333 pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001334
1335}
1336
1337static void
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001338__lim_process_neighbor_report(struct mac_context *mac, uint8_t *pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001339 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001340{
1341 tpSirMacMgmtHdr pHdr;
1342 tDot11fNeighborReportResponse *pFrm;
1343 uint32_t frameLen, nStatus;
1344 uint8_t *pBody;
1345
1346 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
1347 pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo);
1348 frameLen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1349
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301350 pFrm = qdf_mem_malloc(sizeof(tDot11fNeighborReportResponse));
Arif Hussainf5b6c412018-10-10 19:41:09 -07001351 if (!pFrm)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001352 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001353
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001354 if (pe_session == NULL) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301355 qdf_mem_free(pFrm);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001356 return;
1357 }
1358
1359 /**Unpack the received frame */
1360 nStatus =
Jeff Johnson348973e2018-11-22 16:51:12 -08001361 dot11f_unpack_neighbor_report_response(mac, pBody,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +05301362 frameLen, pFrm, false);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001363
1364 if (DOT11F_FAILED(nStatus)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301365 pe_err("Failed to unpack and parse a Neighbor report response (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001366 nStatus, frameLen);
Srinivas Girigowdab896a562017-03-16 17:41:26 -07001367 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR,
1368 pBody, frameLen);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301369 qdf_mem_free(pFrm);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001370 return;
1371 } else if (DOT11F_WARNED(nStatus)) {
Rajeev Kumarb5813802017-06-29 17:34:57 -07001372 pe_debug("There were warnings while unpacking a Neighbor report response (0x%08x, %d bytes):",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001373 nStatus, frameLen);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001374 }
1375 /* Call rrm function to handle the request. */
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001376 rrm_process_neighbor_report_response(mac, pFrm, pe_session);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001377
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301378 qdf_mem_free(pFrm);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001379}
1380
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001381
1382#ifdef WLAN_FEATURE_11W
1383/**
1384 * limProcessSAQueryRequestActionFrame
1385 *
1386 ***FUNCTION:
1387 * This function is called by lim_process_action_frame() upon
1388 * SA query request Action frame reception.
1389 *
1390 ***LOGIC:
1391 *
1392 ***ASSUMPTIONS:
1393 *
1394 ***NOTE:
1395 *
Jeff Johnson348973e2018-11-22 16:51:12 -08001396 * @param mac - Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001397 * @param *pRxPacketInfo - Handle to the Rx packet info
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001398 * @param pe_session - PE session entry
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001399 *
1400 * @return None
1401 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001402static void __lim_process_sa_query_request_action_frame(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001403 uint8_t *pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001404 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001405{
1406 tpSirMacMgmtHdr pHdr;
1407 uint8_t *pBody;
Jianmin Zhu2f708f22018-07-23 22:07:05 +08001408 uint32_t frame_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001409 uint8_t transId[2];
1410
1411 /* Prima --- Below Macro not available in prima
1412 pHdr = SIR_MAC_BD_TO_MPDUHEADER(pBd);
1413 pBody = SIR_MAC_BD_TO_MPDUDATA(pBd); */
1414
1415 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
1416 pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo);
Jianmin Zhu2f708f22018-07-23 22:07:05 +08001417 frame_len = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001418
Jianmin Zhu2f708f22018-07-23 22:07:05 +08001419 if (frame_len < sizeof(struct sDot11fSaQueryReq)) {
1420 pe_err("Invalid frame length");
1421 return;
1422 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001423 /* If this is an unprotected SA Query Request, then ignore it. */
1424 if (pHdr->fc.wep == 0)
1425 return;
1426
mukul sharma72c8b222015-09-04 17:02:01 +05301427 /* 11w offload is enabled then firmware should not fwd this frame */
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001428 if (LIM_IS_STA_ROLE(pe_session) && mac->pmf_offload) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301429 pe_err("11w offload enabled, SA Query req isn't expected");
mukul sharma72c8b222015-09-04 17:02:01 +05301430 return;
1431 }
1432
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001433 /*Extract 11w trsansId from SA query request action frame
1434 In SA query response action frame we will send same transId
1435 In SA query request action frame:
1436 Category : 1 byte
1437 Action : 1 byte
1438 Transaction ID : 2 bytes */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301439 qdf_mem_copy(&transId[0], &pBody[2], 2);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001440
1441 /* Send 11w SA query response action frame */
Jeff Johnson348973e2018-11-22 16:51:12 -08001442 if (lim_send_sa_query_response_frame(mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001443 transId,
1444 pHdr->sa,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001445 pe_session) != QDF_STATUS_SUCCESS) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301446 pe_err("fail to send SA query response action frame");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001447 return;
1448 }
1449}
1450
1451/**
1452 * __lim_process_sa_query_response_action_frame
1453 *
1454 ***FUNCTION:
1455 * This function is called by lim_process_action_frame() upon
1456 * SA query response Action frame reception.
1457 *
1458 ***LOGIC:
1459 *
1460 ***ASSUMPTIONS:
1461 *
1462 ***NOTE:
1463 *
Jeff Johnson348973e2018-11-22 16:51:12 -08001464 * @param mac - Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001465 * @param *pRxPacketInfo - Handle to the Rx packet info
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001466 * @param pe_session - PE session entry
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001467 * @return None
1468 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001469static void __lim_process_sa_query_response_action_frame(struct mac_context *mac,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001470 uint8_t *pRxPacketInfo,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001471 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001472{
1473 tpSirMacMgmtHdr pHdr;
Jianmin Zhu2f708f22018-07-23 22:07:05 +08001474 uint32_t frame_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001475 uint8_t *pBody;
1476 tpDphHashNode pSta;
1477 uint16_t aid;
1478 uint16_t transId;
1479 uint8_t retryNum;
1480
1481 pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo);
Jianmin Zhu2f708f22018-07-23 22:07:05 +08001482 frame_len = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001483 pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo);
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301484 pe_debug("SA Query Response received");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001485
Jianmin Zhu2f708f22018-07-23 22:07:05 +08001486 if (frame_len < sizeof(struct sDot11fSaQueryRsp)) {
1487 pe_err("Invalid frame length");
1488 return;
1489 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001490 /* When a station, supplicant handles SA Query Response.
1491 * Forward to SME to HDD to wpa_supplicant.
1492 */
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001493 if (LIM_IS_STA_ROLE(pe_session)) {
Jeff Johnson348973e2018-11-22 16:51:12 -08001494 lim_send_sme_mgmt_frame_ind(mac, pHdr->fc.subType,
Jianmin Zhu2f708f22018-07-23 22:07:05 +08001495 (uint8_t *)pHdr,
1496 frame_len + sizeof(tSirMacMgmtHdr),
1497 0,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001498 WMA_GET_RX_CH(pRxPacketInfo),
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001499 pe_session,
yeshwanth sriram guntuka2bc14352017-04-26 13:07:32 +05301500 WMA_GET_RX_RSSI_NORMALIZED(
1501 pRxPacketInfo));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001502 return;
1503 }
1504
1505 /* If this is an unprotected SA Query Response, then ignore it. */
1506 if (pHdr->fc.wep == 0)
1507 return;
1508
1509 pSta =
Jeff Johnson348973e2018-11-22 16:51:12 -08001510 dph_lookup_hash_entry(mac, pHdr->sa, &aid,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001511 &pe_session->dph.dphHashTable);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001512 if (NULL == pSta)
1513 return;
1514
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301515 pe_debug("SA Query Response source addr: %0x:%0x:%0x:%0x:%0x:%0x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001516 pHdr->sa[0], pHdr->sa[1], pHdr->sa[2], pHdr->sa[3],
1517 pHdr->sa[4], pHdr->sa[5]);
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301518 pe_debug("SA Query state for station: %d", pSta->pmfSaQueryState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001519
1520 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
1521 return;
1522
Jeff Johnson47d75242018-05-12 15:58:53 -07001523 /* Extract 11w trsansId from SA query response action frame
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001524 In SA query response action frame:
1525 Category : 1 byte
1526 Action : 1 byte
1527 Transaction ID : 2 bytes */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301528 qdf_mem_copy(&transId, &pBody[2], 2);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001529
1530 /* If SA Query is in progress with the station and the station
1531 responds then the association request that triggered the SA
1532 query is from a rogue station, just go back to initial state. */
1533 for (retryNum = 0; retryNum <= pSta->pmfSaQueryRetryCount; retryNum++)
1534 if (transId == pSta->pmfSaQueryStartTransId + retryNum) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301535 pe_debug("Found matching SA Query Request - transaction ID: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001536 transId);
1537 tx_timer_deactivate(&pSta->pmfSaQueryTimer);
1538 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
1539 break;
1540 }
1541}
1542#endif
1543
1544#ifdef WLAN_FEATURE_11W
1545/**
1546 * lim_drop_unprotected_action_frame
1547 *
1548 ***FUNCTION:
1549 * This function checks if an Action frame should be dropped since it is
Jeff Johnson47d75242018-05-12 15:58:53 -07001550 * a Robust Management Frame, it is unprotected, and it is received on a
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001551 * connection where PMF is enabled.
1552 *
1553 ***LOGIC:
1554 *
1555 ***ASSUMPTIONS:
1556 *
1557 ***NOTE:
1558 *
Jeff Johnson348973e2018-11-22 16:51:12 -08001559 * @param mac - Global MAC structure
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001560 * @param pe_session - PE session entry
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001561 * @param pHdr - Frame header
1562 * @param category - Action frame category
1563 * @return true if frame should be dropped
1564 */
1565
1566static bool
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001567lim_drop_unprotected_action_frame(struct mac_context *mac, struct pe_session *pe_session,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001568 tpSirMacMgmtHdr pHdr, uint8_t category)
1569{
1570 uint16_t aid;
1571 tpDphHashNode pStaDs;
1572 bool rmfConnection = false;
1573
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001574 if (LIM_IS_AP_ROLE(pe_session)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001575 pStaDs =
Jeff Johnson348973e2018-11-22 16:51:12 -08001576 dph_lookup_hash_entry(mac, pHdr->sa, &aid,
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001577 &pe_session->dph.dphHashTable);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001578 if (pStaDs != NULL)
1579 if (pStaDs->rmfEnabled)
1580 rmfConnection = true;
Jeff Johnsonb5c13332018-12-03 09:54:51 -08001581 } else if (pe_session->limRmfEnabled)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001582 rmfConnection = true;
1583
1584 if (rmfConnection && (pHdr->fc.wep == 0)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301585 pe_err("Dropping unprotected Action category: %d frame since RMF is enabled",
1586 category);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001587 return true;
1588 } else
1589 return false;
1590}
1591#endif
1592
1593/**
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001594 * lim_process_addba_req() - process ADDBA Request
1595 * @mac_ctx: Pointer to Global MAC structure
1596 * @rx_pkt_info: A pointer to packet info structure
1597 * @session: PE session pointer
1598 *
1599 * This routine will be called to process ADDBA request action frame
1600 *
1601 * Return: None
1602 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001603static void lim_process_addba_req(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
Jeff Johnson41ce2852018-11-19 06:51:22 -08001604 struct pe_session *session)
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001605{
1606 tpSirMacMgmtHdr mac_hdr;
1607 uint8_t *body_ptr;
1608 tDot11faddba_req *addba_req;
1609 uint32_t frame_len, status;
1610 QDF_STATUS qdf_status;
1611 uint8_t peer_id;
1612 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
1613 void *peer, *pdev;
1614
1615 pdev = cds_get_context(QDF_MODULE_ID_TXRX);
1616 if (!pdev) {
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001617 pe_err("pdev is NULL");
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001618 return;
1619 }
1620
1621 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
1622 body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
1623 frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
1624
1625 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1626 body_ptr, frame_len);
1627
1628 addba_req = qdf_mem_malloc(sizeof(*addba_req));
Arif Hussainf5b6c412018-10-10 19:41:09 -07001629 if (!addba_req)
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001630 return;
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001631
1632 /* Unpack ADDBA request frame */
1633 status = dot11f_unpack_addba_req(mac_ctx, body_ptr, frame_len,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +05301634 addba_req, false);
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001635
1636 if (DOT11F_FAILED(status)) {
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001637 pe_err("Failed to unpack and parse (0x%08x, %d bytes)",
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001638 status, frame_len);
1639 goto error;
1640 } else if (DOT11F_WARNED(status)) {
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001641 pe_warn("warning: unpack addba Req(0x%08x, %d bytes)",
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001642 status, frame_len);
1643 }
1644
Mohit Khannac4c22252017-11-20 11:06:33 -08001645 peer = cdp_peer_get_ref_by_addr(soc, pdev, mac_hdr->sa, &peer_id,
1646 PEER_DEBUG_ID_WMA_ADDBA_REQ);
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001647 if (!peer) {
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001648 pe_err("PEER [%pM] not found", mac_hdr->sa);
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001649 goto error;
1650 }
1651
1652 qdf_status = cdp_addba_requestprocess(soc, peer,
1653 addba_req->DialogToken.token,
1654 addba_req->addba_param_set.tid,
1655 addba_req->ba_timeout.timeout,
1656 addba_req->addba_param_set.buff_size,
1657 addba_req->ba_start_seq_ctrl.ssn);
1658
Mohit Khannac4c22252017-11-20 11:06:33 -08001659 cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_WMA_ADDBA_REQ);
1660
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001661 if (QDF_STATUS_SUCCESS == qdf_status) {
1662 lim_send_addba_response_frame(mac_ctx, mac_hdr->sa,
Kiran Kumar Lokere40875852018-01-15 12:36:19 -08001663 addba_req->addba_param_set.tid, session,
Kiran Kumar Lokereaee823a2018-03-22 15:27:05 -07001664 addba_req->addba_extn_element.present,
1665 addba_req->addba_param_set.amsdu_supp);
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001666 } else {
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001667 pe_err("Failed to process addba request");
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001668 }
1669
1670error:
1671 qdf_mem_free(addba_req);
1672 return;
1673}
1674
1675/**
1676 * lim_process_delba_req() - process DELBA Request
1677 * @mac_ctx: Pointer to Global MAC structure
1678 * @rx_pkt_info: A pointer to packet info structure
1679 * @session: PE session pointer
1680 *
1681 * This routine will be called to process ADDBA request action frame
1682 *
1683 * Return: None
1684 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001685static void lim_process_delba_req(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
Jeff Johnson41ce2852018-11-19 06:51:22 -08001686 struct pe_session *session)
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001687{
1688 tpSirMacMgmtHdr mac_hdr;
1689 uint8_t *body_ptr;
1690 tDot11fdelba_req *delba_req;
1691 uint32_t frame_len, status;
1692 QDF_STATUS qdf_status;
1693 uint8_t peer_id;
1694 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
1695 void *peer, *pdev;
1696
1697 pdev = cds_get_context(QDF_MODULE_ID_TXRX);
1698 if (!pdev) {
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001699 pe_err("pdev is NULL");
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001700 return;
1701 }
1702
1703 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
1704 body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
1705 frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
1706
1707 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO,
1708 body_ptr, frame_len);
1709
1710 delba_req = qdf_mem_malloc(sizeof(*delba_req));
Arif Hussainf5b6c412018-10-10 19:41:09 -07001711 if (!delba_req)
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001712 return;
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001713
1714 /* Unpack DELBA request frame */
1715 status = dot11f_unpack_delba_req(mac_ctx, body_ptr, frame_len,
Selvaraj, Sridhar75afbeb2017-04-03 17:08:59 +05301716 delba_req, false);
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001717
1718 if (DOT11F_FAILED(status)) {
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001719 pe_err("Failed to unpack and parse (0x%08x, %d bytes)",
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001720 status, frame_len);
1721 goto error;
1722 } else if (DOT11F_WARNED(status)) {
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001723 pe_warn("warning: unpack addba Req(0x%08x, %d bytes)",
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001724 status, frame_len);
1725 }
1726
Mohit Khannac4c22252017-11-20 11:06:33 -08001727 peer = cdp_peer_get_ref_by_addr(soc, pdev, mac_hdr->sa, &peer_id,
1728 PEER_DEBUG_ID_WMA_DELBA_REQ);
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001729 if (!peer) {
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001730 pe_err("PEER [%pM] not found", mac_hdr->sa);
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001731 goto error;
1732 }
1733
1734 qdf_status = cdp_delba_process(soc, peer,
1735 delba_req->delba_param_set.tid, delba_req->Reason.code);
1736
Mohit Khannac4c22252017-11-20 11:06:33 -08001737 cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_WMA_DELBA_REQ);
1738
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001739 if (QDF_STATUS_SUCCESS != qdf_status)
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07001740 pe_err("Failed to process delba request");
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08001741
1742error:
1743 qdf_mem_free(delba_req);
1744 return;
1745}
1746
1747/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001748 * lim_process_action_frame() - to process action frames
1749 * @mac_ctx: Pointer to Global MAC structure
1750 * @rx_pkt_info: A pointer to packet info structure
1751 *
1752 * This function is called by limProcessMessageQueue() upon
1753 * Action frame reception.
1754 *
1755 * Return: none
1756 */
1757
Jeff Johnson9320c1e2018-12-02 13:09:20 -08001758void lim_process_action_frame(struct mac_context *mac_ctx,
Jeff Johnson41ce2852018-11-19 06:51:22 -08001759 uint8_t *rx_pkt_info, struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001760{
1761 uint8_t *body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
1762 tpSirMacActionFrameHdr action_hdr = (tpSirMacActionFrameHdr) body_ptr;
1763#ifdef WLAN_FEATURE_11W
1764 tpSirMacMgmtHdr mac_hdr_11w = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
1765#endif
1766 tpSirMacMgmtHdr mac_hdr = NULL;
1767 int8_t rssi;
Vignesh Viswanathan5f37b212018-06-07 16:15:56 +05301768 uint32_t frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001769 tpSirMacVendorSpecificFrameHdr vendor_specific;
1770 uint8_t oui[] = { 0x00, 0x00, 0xf0 };
Vignesh Viswanathaneaa68892017-09-27 12:16:34 +05301771 uint8_t dpp_oui[] = { 0x50, 0x6F, 0x9A, 0x1A };
Vignesh Viswanathan5f37b212018-06-07 16:15:56 +05301772 tpSirMacVendorSpecificPublicActionFrameHdr pub_action;
1773
1774 if (frame_len < sizeof(*action_hdr)) {
1775 pe_debug("frame_len %d less than Action Frame Hdr size",
1776 frame_len);
1777 return;
1778 }
1779
Rajeev Kumar03200802016-04-15 13:59:36 -07001780#ifdef WLAN_FEATURE_11W
1781 if (lim_is_robust_mgmt_action_frame(action_hdr->category) &&
1782 lim_drop_unprotected_action_frame(mac_ctx, session,
1783 mac_hdr_11w, action_hdr->category))
1784 return;
1785#endif
1786
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001787 switch (action_hdr->category) {
1788 case SIR_MAC_ACTION_QOS_MGMT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001789 if ((session->limQosEnabled) ||
1790 (action_hdr->actionID == SIR_MAC_QOS_MAP_CONFIGURE)) {
1791 switch (action_hdr->actionID) {
1792 case SIR_MAC_QOS_ADD_TS_REQ:
1793 __lim_process_add_ts_req(mac_ctx,
1794 (uint8_t *) rx_pkt_info,
1795 session);
1796 break;
1797
1798 case SIR_MAC_QOS_ADD_TS_RSP:
1799 __lim_process_add_ts_rsp(mac_ctx,
1800 (uint8_t *) rx_pkt_info,
1801 session);
1802 break;
1803
1804 case SIR_MAC_QOS_DEL_TS_REQ:
1805 __lim_process_del_ts_req(mac_ctx,
1806 (uint8_t *) rx_pkt_info,
1807 session);
1808 break;
1809
1810 case SIR_MAC_QOS_MAP_CONFIGURE:
1811 __lim_process_qos_map_configure_frame(mac_ctx,
1812 (uint8_t *)rx_pkt_info,
1813 session);
1814 break;
1815 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301816 pe_warn("Qos action: %d not handled",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001817 action_hdr->actionID);
1818 break;
1819 }
1820 break;
1821 }
1822 break;
1823
1824 case SIR_MAC_ACTION_SPECTRUM_MGMT:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001825 switch (action_hdr->actionID) {
1826#ifdef ANI_SUPPORT_11H
1827 case SIR_MAC_ACTION_MEASURE_REQUEST_ID:
1828 if (session->lim11hEnable)
1829 __lim_process_measurement_request_frame(mac_ctx,
1830 rx_pkt_info,
1831 session);
1832 break;
1833 case SIR_MAC_ACTION_TPC_REQUEST_ID:
1834 if ((LIM_IS_STA_ROLE(session) ||
1835 LIM_IS_AP_ROLE(session)) &&
1836 session->lim11hEnable)
1837 __lim_process_tpc_request_frame(mac_ctx,
1838 rx_pkt_info, session);
1839 break;
1840#endif
1841 case SIR_MAC_ACTION_CHANNEL_SWITCH_ID:
1842 if (LIM_IS_STA_ROLE(session))
1843 __lim_process_channel_switch_action_frame(
1844 mac_ctx, rx_pkt_info, session);
1845 break;
1846 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301847 pe_warn("Spectrum mgmt action id: %d not handled",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001848 action_hdr->actionID);
1849 break;
1850 }
1851 break;
1852
1853 case SIR_MAC_ACTION_WME:
1854 if (!session->limWmeEnabled) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301855 pe_warn("WME mode disabled - dropping frame: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001856 action_hdr->actionID);
1857 break;
1858 }
1859 switch (action_hdr->actionID) {
1860 case SIR_MAC_QOS_ADD_TS_REQ:
1861 __lim_process_add_ts_req(mac_ctx,
1862 (uint8_t *) rx_pkt_info, session);
1863 break;
1864
1865 case SIR_MAC_QOS_ADD_TS_RSP:
1866 __lim_process_add_ts_rsp(mac_ctx,
1867 (uint8_t *) rx_pkt_info, session);
1868 break;
1869
1870 case SIR_MAC_QOS_DEL_TS_REQ:
1871 __lim_process_del_ts_req(mac_ctx,
1872 (uint8_t *) rx_pkt_info, session);
1873 break;
1874
1875 case SIR_MAC_QOS_MAP_CONFIGURE:
1876 __lim_process_qos_map_configure_frame(mac_ctx,
1877 (uint8_t *)rx_pkt_info, session);
1878 break;
1879
1880 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301881 pe_warn("WME action: %d not handled",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001882 action_hdr->actionID);
1883 break;
1884 }
1885 break;
1886
1887 case SIR_MAC_ACTION_HT:
1888 /** Type of HT Action to be performed*/
1889 switch (action_hdr->actionID) {
1890 case SIR_MAC_SM_POWER_SAVE:
1891 if (LIM_IS_AP_ROLE(session))
1892 __lim_process_sm_power_save_update(mac_ctx,
1893 (uint8_t *)rx_pkt_info,
1894 session);
1895 break;
1896 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301897 pe_warn("Action ID: %d not handled in HT category",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001898 action_hdr->actionID);
1899 break;
1900 }
1901 break;
1902
1903 case SIR_MAC_ACTION_WNM:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301904 pe_debug("WNM Action category: %d action: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001905 action_hdr->category, action_hdr->actionID);
1906 switch (action_hdr->actionID) {
1907 case SIR_MAC_WNM_BSS_TM_QUERY:
1908 case SIR_MAC_WNM_BSS_TM_REQUEST:
1909 case SIR_MAC_WNM_BSS_TM_RESPONSE:
1910 case SIR_MAC_WNM_NOTIF_REQUEST:
1911 case SIR_MAC_WNM_NOTIF_RESPONSE:
Deepak Dhamdhere68929ec2015-08-05 15:16:35 -07001912 rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001913 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
1914 /* Forward to the SME to HDD to wpa_supplicant */
1915 lim_send_sme_mgmt_frame_ind(mac_ctx,
1916 mac_hdr->fc.subType,
1917 (uint8_t *) mac_hdr,
1918 frame_len + sizeof(tSirMacMgmtHdr),
1919 session->smeSessionId,
1920 WMA_GET_RX_CH(rx_pkt_info),
1921 session, rssi);
1922 break;
1923 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301924 pe_debug("Action ID: %d not handled in WNM category",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001925 action_hdr->actionID);
1926 break;
1927 }
1928 break;
1929
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001930 case SIR_MAC_ACTION_RRM:
Abhishek Singhca408032016-09-13 15:26:12 +05301931 /* Ignore RRM measurement request until DHCP is set */
1932 if (mac_ctx->rrm.rrmPEContext.rrmEnable &&
1933 mac_ctx->roam.roamSession
1934 [session->smeSessionId].dhcp_done) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001935 switch (action_hdr->actionID) {
1936 case SIR_MAC_RRM_RADIO_MEASURE_REQ:
1937 __lim_process_radio_measure_request(mac_ctx,
1938 (uint8_t *)rx_pkt_info,
1939 session);
1940 break;
1941 case SIR_MAC_RRM_LINK_MEASUREMENT_REQ:
Arif Hussain776ee7a2016-11-10 20:28:50 -08001942 if (!lim_is_valid_frame(
1943 &rrm_link_action_frm,
1944 rx_pkt_info))
1945 break;
1946
1947 if (__lim_process_link_measurement_req(
1948 mac_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001949 (uint8_t *)rx_pkt_info,
Jeff Johnson0301ecb2018-06-29 09:36:23 -07001950 session) == QDF_STATUS_SUCCESS)
Arif Hussain776ee7a2016-11-10 20:28:50 -08001951 lim_update_last_processed_frame(
1952 &rrm_link_action_frm,
1953 rx_pkt_info);
1954
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001955 break;
1956 case SIR_MAC_RRM_NEIGHBOR_RPT:
1957 __lim_process_neighbor_report(mac_ctx,
1958 (uint8_t *)rx_pkt_info,
1959 session);
1960 break;
1961 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301962 pe_warn("Action ID: %d not handled in RRM",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001963 action_hdr->actionID);
1964 break;
1965
1966 }
1967 } else {
1968 /* Else we will just ignore the RRM messages. */
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301969 pe_debug("RRM frm ignored, it is disabled in cfg: %d or DHCP not completed: %d",
Abhishek Singhca408032016-09-13 15:26:12 +05301970 mac_ctx->rrm.rrmPEContext.rrmEnable,
1971 mac_ctx->roam.roamSession
1972 [session->smeSessionId].dhcp_done);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001973 }
1974 break;
Deepak Dhamdhere641bf322016-01-06 15:19:03 -08001975
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001976 case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
1977 vendor_specific = (tpSirMacVendorSpecificFrameHdr) action_hdr;
1978 mac_hdr = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001979
1980 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
Vignesh Viswanathan5f37b212018-06-07 16:15:56 +05301981
1982 if (frame_len < sizeof(*vendor_specific)) {
1983 pe_debug("frame len %d less than Vendor Specific Hdr len",
1984 frame_len);
1985 return;
1986 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001987
1988 /* Check if it is a vendor specific action frame. */
1989 if (LIM_IS_STA_ROLE(session) &&
Ankit Guptaa5076012016-09-14 11:32:19 -07001990 (!qdf_mem_cmp(session->selfMacAddr,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001991 &mac_hdr->da[0], sizeof(tSirMacAddr)))
1992 && IS_WES_MODE_ENABLED(mac_ctx)
Anurag Chouhan600c3a02016-03-01 10:33:54 +05301993 && !qdf_mem_cmp(vendor_specific->Oui, oui, 3)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05301994 pe_debug("Rcvd Vendor specific frame OUI: %x %x %x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001995 vendor_specific->Oui[0],
1996 vendor_specific->Oui[1],
1997 vendor_specific->Oui[2]);
1998 /*
1999 * Forward to the SME to HDD to wpa_supplicant
2000 * type is ACTION
2001 */
2002 lim_send_sme_mgmt_frame_ind(mac_ctx,
2003 mac_hdr->fc.subType,
2004 (uint8_t *) mac_hdr,
2005 frame_len +
2006 sizeof(tSirMacMgmtHdr),
2007 session->smeSessionId,
2008 WMA_GET_RX_CH(rx_pkt_info),
yeshwanth sriram guntuka2bc14352017-04-26 13:07:32 +05302009 session,
2010 WMA_GET_RX_RSSI_NORMALIZED(
2011 rx_pkt_info));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002012 } else {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302013 pe_debug("Dropping the vendor specific action frame"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002014 "beacause of (WES Mode not enabled "
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302015 "(WESMODE: %d) or OUI mismatch "
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002016 "(%02x %02x %02x) or not received with"
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302017 "SelfSta address) system role: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002018 IS_WES_MODE_ENABLED(mac_ctx),
2019 vendor_specific->Oui[0],
2020 vendor_specific->Oui[1],
2021 vendor_specific->Oui[2],
2022 GET_LIM_SYSTEM_ROLE(session));
2023 }
2024 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002025 case SIR_MAC_ACTION_PUBLIC_USAGE:
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302026 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302027
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002028 switch (action_hdr->actionID) {
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302029 case SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID:
2030 lim_process_ext_channel_switch_action_frame(mac_ctx,
2031 rx_pkt_info, session);
2032 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002033 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
2034 pub_action =
2035 (tpSirMacVendorSpecificPublicActionFrameHdr)
2036 action_hdr;
Vignesh Viswanathan5f37b212018-06-07 16:15:56 +05302037 if (frame_len < sizeof(*pub_action)) {
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302038 pe_debug("Received vendor specific public action frame of invalid len %d",
2039 frame_len);
2040 return;
2041 }
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302042 /*
2043 * Check if it is a DPP public action frame and fall
2044 * thru, else drop the frame.
2045 */
2046 if (qdf_mem_cmp(pub_action->Oui, dpp_oui, 4)) {
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302047 pe_debug("Unhandled public action frame (Vendor specific) OUI: %x %x %x %x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002048 pub_action->Oui[0], pub_action->Oui[1],
2049 pub_action->Oui[2], pub_action->Oui[3]);
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302050 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002051 }
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302052 /* Fall through to send the frame to supplicant */
Samuel Ahn065e6492016-09-30 22:48:09 +05302053 case SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002054 case SIR_MAC_ACTION_2040_BSS_COEXISTENCE:
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302055 case SIR_MAC_ACTION_GAS_INITIAL_REQUEST:
2056 case SIR_MAC_ACTION_GAS_INITIAL_RESPONSE:
2057 case SIR_MAC_ACTION_GAS_COMEBACK_REQUEST:
2058 case SIR_MAC_ACTION_GAS_COMEBACK_RESPONSE:
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302059 /*
2060 * Forward to the SME to HDD to wpa_supplicant
2061 * type is ACTION
2062 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002063 lim_send_sme_mgmt_frame_ind(mac_ctx,
2064 mac_hdr->fc.subType,
2065 (uint8_t *) mac_hdr,
2066 frame_len + sizeof(tSirMacMgmtHdr),
2067 session->smeSessionId,
yeshwanth sriram guntuka2bc14352017-04-26 13:07:32 +05302068 WMA_GET_RX_CH(rx_pkt_info), session,
2069 WMA_GET_RX_RSSI_NORMALIZED(
2070 rx_pkt_info));
Abhishek Singh518323d2015-10-19 17:42:01 +05302071 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002072 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302073 pe_warn("Unhandled public action frame: %x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002074 action_hdr->actionID);
2075 break;
2076 }
2077 break;
2078
2079#ifdef WLAN_FEATURE_11W
2080 case SIR_MAC_ACTION_SA_QUERY:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302081 pe_debug("SA Query Action category: %d action: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002082 action_hdr->category, action_hdr->actionID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002083 switch (action_hdr->actionID) {
2084 case SIR_MAC_SA_QUERY_REQ:
2085 /**11w SA query request action frame received**/
2086 /* Respond directly to the incoming request in LIM */
2087 __lim_process_sa_query_request_action_frame(mac_ctx,
2088 (uint8_t *)rx_pkt_info,
2089 session);
2090 break;
2091 case SIR_MAC_SA_QUERY_RSP:
2092 /**11w SA query response action frame received**/
2093 /* Handle based on the current SA Query state */
2094 __lim_process_sa_query_response_action_frame(mac_ctx,
2095 (uint8_t *)rx_pkt_info,
2096 session);
2097 break;
2098 default:
2099 break;
2100 }
2101 break;
2102#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002103 case SIR_MAC_ACTION_VHT:
2104 if (!session->vhtCapability)
2105 break;
2106 switch (action_hdr->actionID) {
2107 case SIR_MAC_VHT_OPMODE_NOTIFICATION:
2108 __lim_process_operating_mode_action_frame(mac_ctx,
2109 rx_pkt_info, session);
2110 break;
2111 case SIR_MAC_VHT_GID_NOTIFICATION:
2112 /* Only if ini supports it */
2113 if (session->enableVhtGid)
2114 __lim_process_gid_management_action_frame(
2115 mac_ctx, rx_pkt_info, session);
2116 break;
2117 default:
2118 break;
2119 }
2120 break;
Naveen Rawatb4938442015-11-13 09:58:27 -08002121 case SIR_MAC_ACTION_FST: {
2122 tpSirMacMgmtHdr hdr;
Naveen Rawatb4938442015-11-13 09:58:27 -08002123
2124 hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
Naveen Rawatb4938442015-11-13 09:58:27 -08002125
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302126 pe_debug("Received FST MGMT action frame");
Naveen Rawatb4938442015-11-13 09:58:27 -08002127 /* Forward to the SME to HDD */
2128 lim_send_sme_mgmt_frame_ind(mac_ctx, hdr->fc.subType,
2129 (uint8_t *)hdr,
2130 frame_len + sizeof(tSirMacMgmtHdr),
2131 session->smeSessionId,
2132 WMA_GET_RX_CH(rx_pkt_info),
yeshwanth sriram guntuka2bc14352017-04-26 13:07:32 +05302133 session,
2134 WMA_GET_RX_RSSI_NORMALIZED(
2135 rx_pkt_info));
Naveen Rawatb4938442015-11-13 09:58:27 -08002136 break;
2137 }
Krishna Kumaar Natarajan6553ea12016-09-02 12:28:07 -07002138 case SIR_MAC_ACTION_PROT_DUAL_PUB:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302139 pe_debug("Rcvd Protected Dual of Public Action: %d",
Krishna Kumaar Natarajan6553ea12016-09-02 12:28:07 -07002140 action_hdr->actionID);
2141 switch (action_hdr->actionID) {
2142 case SIR_MAC_PDPA_GAS_INIT_REQ:
2143 case SIR_MAC_PDPA_GAS_INIT_RSP:
2144 case SIR_MAC_PDPA_GAS_COMEBACK_REQ:
2145 case SIR_MAC_PDPA_GAS_COMEBACK_RSP:
2146 mac_hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
Krishna Kumaar Natarajan6553ea12016-09-02 12:28:07 -07002147 rssi = WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info);
2148 lim_send_sme_mgmt_frame_ind(mac_ctx,
2149 mac_hdr->fc.subType, (uint8_t *) mac_hdr,
2150 frame_len + sizeof(tSirMacMgmtHdr),
2151 session->smeSessionId,
2152 WMA_GET_RX_CH(rx_pkt_info), session, rssi);
2153 break;
2154 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302155 pe_warn("Unhandled - Protected Dual Public Action");
Krishna Kumaar Natarajan6553ea12016-09-02 12:28:07 -07002156 break;
2157 }
2158 break;
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08002159 case SIR_MAC_ACTION_BLKACK:
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07002160 pe_debug("Rcvd Block Ack for %pM; action: %d",
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08002161 session->selfMacAddr, action_hdr->actionID);
2162 switch (action_hdr->actionID) {
2163 case SIR_MAC_ADDBA_REQ:
2164 lim_process_addba_req(mac_ctx, rx_pkt_info, session);
2165 break;
2166 case SIR_MAC_DELBA_REQ:
2167 lim_process_delba_req(mac_ctx, rx_pkt_info, session);
2168 break;
2169 default:
Srinivas Girigowda28fb0122017-03-26 22:21:20 -07002170 pe_err("Unhandle BA action frame");
Krishna Kumaar Natarajan48a6b4c2017-01-06 16:30:55 -08002171 break;
2172 }
2173 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002174 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302175 pe_warn("Action category: %d not handled",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002176 action_hdr->category);
2177 break;
2178 }
2179}
2180
2181/**
2182 * lim_process_action_frame_no_session
2183 *
2184 ***FUNCTION:
2185 * This function is called by limProcessMessageQueue() upon
2186 * Action frame reception and no session.
2187 * Currently only public action frames can be received from
2188 * a non-associated station.
2189 *
2190 ***LOGIC:
2191 *
2192 ***ASSUMPTIONS:
2193 *
2194 ***NOTE:
2195 *
Jeff Johnson348973e2018-11-22 16:51:12 -08002196 * @param mac - Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002197 * @param *pBd - A pointer to Buffer descriptor + associated PDUs
2198 * @return None
2199 */
Jeff Johnson9320c1e2018-12-02 13:09:20 -08002200void lim_process_action_frame_no_session(struct mac_context *mac, uint8_t *pBd)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002201{
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302202 tpSirMacMgmtHdr mac_hdr = WMA_GET_RX_MAC_HEADER(pBd);
2203 uint32_t frame_len = WMA_GET_RX_PAYLOAD_LEN(pBd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002204 uint8_t *pBody = WMA_GET_RX_MPDU_DATA(pBd);
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302205 uint8_t dpp_oui[] = { 0x50, 0x6F, 0x9A, 0x1A };
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302206 tpSirMacActionFrameHdr action_hdr = (tpSirMacActionFrameHdr) pBody;
2207 tpSirMacVendorSpecificPublicActionFrameHdr vendor_specific;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002208
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302209 pe_debug("Received an Action frame -- no session");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002210
Vignesh Viswanathan5f37b212018-06-07 16:15:56 +05302211 if (frame_len < sizeof(*action_hdr)) {
2212 pe_debug("frame_len %d less than action frame header len",
2213 frame_len);
2214 return;
2215 }
2216
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302217 switch (action_hdr->category) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002218 case SIR_MAC_ACTION_PUBLIC_USAGE:
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302219 switch (action_hdr->actionID) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002220 case SIR_MAC_ACTION_VENDOR_SPECIFIC:
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302221 vendor_specific =
2222 (tpSirMacVendorSpecificPublicActionFrameHdr)
2223 action_hdr;
2224
Vignesh Viswanathan5f37b212018-06-07 16:15:56 +05302225 if (frame_len < sizeof(*vendor_specific)) {
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302226 pe_debug("Received vendor specific public action frame of invalid len %d",
2227 frame_len);
2228 return;
2229 }
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302230 /*
2231 * Check if it is a DPP public action frame and fall
2232 * thru, else drop the frame.
2233 */
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302234 if (qdf_mem_cmp(vendor_specific->Oui, dpp_oui, 4)) {
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302235 pe_debug("Unhandled public action frame (Vendor specific) OUI: %x %x %x %x",
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302236 vendor_specific->Oui[0],
2237 vendor_specific->Oui[1],
2238 vendor_specific->Oui[2],
2239 vendor_specific->Oui[3]);
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302240 break;
2241 }
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302242 /* Fall through to send the frame to supplicant */
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302243 case SIR_MAC_ACTION_GAS_INITIAL_REQUEST:
2244 case SIR_MAC_ACTION_GAS_INITIAL_RESPONSE:
2245 case SIR_MAC_ACTION_GAS_COMEBACK_REQUEST:
2246 case SIR_MAC_ACTION_GAS_COMEBACK_RESPONSE:
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302247 /*
2248 * Forward the GAS frames to wpa_supplicant
2249 * type is ACTION
2250 */
Jeff Johnson348973e2018-11-22 16:51:12 -08002251 lim_send_sme_mgmt_frame_ind(mac,
Vignesh Viswanathan117c2032017-12-20 12:31:11 +05302252 mac_hdr->fc.subType,
2253 (uint8_t *) mac_hdr,
2254 frame_len + sizeof(tSirMacMgmtHdr), 0,
2255 WMA_GET_RX_CH(pBd), NULL,
2256 WMA_GET_RX_RSSI_NORMALIZED(pBd));
2257 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002258 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302259 pe_warn("Unhandled public action frame: %x",
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302260 action_hdr->actionID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002261 break;
2262 }
2263 break;
2264 default:
Nishank Aggarwald3d70462017-03-23 12:57:40 +05302265 pe_warn("Unhandled action frame without session: %x",
Vignesh Viswanathan167f8ac2018-02-09 23:29:11 +05302266 action_hdr->category);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002267 break;
2268
2269 }
2270}