blob: f058b53d60b94acbf7648df357acf098ac64a808 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08002 * Copyright (c) 2011-2019 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
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019/**
20 * DOC: wlan_hdd_wext.c
21 *
22 * Linux Wireless Extensions Implementation
23 */
24
25#include <linux/version.h>
26#include <linux/module.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29#include <linux/wireless.h>
30#include <mac_trace.h>
Dustin Brown389e5072018-11-08 17:10:01 +053031#include "osif_sync.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080032#include <wlan_hdd_includes.h>
33#include <cds_api.h>
Rajeev Kumarea95edd2017-01-11 20:49:36 -080034#include "scheduler_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035#include <net/arp.h>
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080036#include <cdp_txrx_cmn.h>
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070037#include <cdp_txrx_stats.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038#include "sir_params.h"
39#include "csr_api.h"
40#include "csr_inside_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080041#include "sme_rrm_internal.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080042#include <ani_global.h>
43#include "dot11f.h"
44#include <wlan_hdd_wowl.h>
45#include <wlan_hdd_cfg.h>
46#include <wlan_hdd_wmm.h>
47#include "utils_api.h"
48#include "wlan_hdd_p2p.h"
49#ifdef FEATURE_WLAN_TDLS
50#include "wlan_hdd_tdls.h"
51#endif
52
53#include "cds_ieee80211_common.h"
54#include "ol_if_athvar.h"
55#include "dbglog_host.h"
56#include "wma.h"
57
58#include "wlan_hdd_power.h"
59#include "qwlan_version.h"
60#include "wlan_hdd_host_offload.h"
61
62#include <linux/wireless.h>
63#include <net/cfg80211.h>
64
65#include "wlan_hdd_misc.h"
66
67#include "qc_sap_ioctl.h"
68#include "sme_api.h"
69#include "wma_types.h"
Dustin Brown05a0658f2019-03-05 11:27:38 -080070#include "qdf_delayed_work_test.h"
Dustin Brown6fb7a752018-11-30 11:33:57 -080071#include "qdf_hashtable_test.h"
Dustin Brown9c49a332019-03-05 11:27:38 -080072#include "qdf_periodic_work_test.h"
Dustin Brown92acafe2019-02-15 17:17:10 -080073#include "qdf_ptr_hash_test.h"
Dustin Brown128e2d02019-02-15 12:59:07 -080074#include "qdf_slist_test.h"
Dustin Brownd315c452018-11-27 11:28:48 -080075#include "qdf_talloc_test.h"
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070076#include "qdf_str.h"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053077#include "qdf_trace.h"
Dustin Brownee733ba2019-03-12 13:31:11 -070078#include "qdf_tracker_test.h"
Dustin Brownebb16d12018-11-29 17:52:07 -080079#include "qdf_types_test.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080080#include "wlan_hdd_assoc.h"
81#include "wlan_hdd_ioctl.h"
82#include "wlan_hdd_scan.h"
83#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080084#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080085#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070086#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070087#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080088#include "wlan_hdd_ocb.h"
89#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080090#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070091#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053092#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070093#ifdef WLAN_SUSPEND_RESUME_TEST
94#include "wlan_hdd_driver_ops.h"
95#include "hif.h"
96#endif
Jeff Johnsonc7fa3542019-04-16 11:35:10 -070097#include "pld_common.h"
Dhanashri Atree7d442a2016-07-14 18:20:29 -070098#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053099#include "cds_utils.h"
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -0700100#include "wlan_osif_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -0800101#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -0800102#include <cdp_txrx_stats.h>
103#include <cds_api.h>
Dustin Brown6099ddc2018-07-06 14:32:53 -0700104#include "wlan_dsc_test.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530105#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -0700106#include "wlan_hdd_regulatory.h"
107#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +0530108#include "wlan_hdd_packet_filter_api.h"
Naveen Rawat3ff5cff2018-01-29 14:31:16 -0800109#include "wlan_cp_stats_mc_ucfg_api.h"
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +0530110#include "wlan_mlme_ucfg_api.h"
Wu Gao93816212018-08-31 16:49:54 +0800111#include "cfg_mlme_sta.h"
Arif Hussain43e09712018-09-18 19:31:57 -0700112#include "wlan_mlme_public_struct.h"
Wu Gao93816212018-08-31 16:49:54 +0800113#include "cfg_ucfg_api.h"
Krunal Sonie71838d2018-09-27 10:45:05 -0700114#include "wlan_policy_mgr_ucfg.h"
Harprit Chhabadabec6de42018-09-10 10:21:15 -0700115#include "wlan_mlme_public_struct.h"
116#include "cfg_ucfg_api.h"
117#include "cfg_mlme_threshold.h"
Wu Gao66454f12018-09-26 19:55:41 +0800118#include "wlan_pmo_cfg.h"
119#include "wlan_pmo_ucfg_api.h"
Mohit Khannac9649652018-11-28 18:10:28 -0800120#include "dp_txrx.h"
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800121#include "wlan_fwol_ucfg_api.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530122
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800123/* Private ioctls and their sub-ioctls */
124#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
125#define WE_SET_11D_STATE 1
126#define WE_WOWL 2
127#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530128/*
129 * <ioctl>
130 * setMaxAssoc - Sets the maximum number of associated stations
131 *
132 * @INPUT: 1 to 32
133 *
134 * @OUTPUT: None
135 *
136 * This IOTCL sets the maximum number of associated stations
137 *
138 * @E.g: iwpriv wlan0 setMaxAssoc <value>
139 *
140 * Supported Feature: STA
141 *
142 * Usage: Internal/External
143 *
144 * </ioctl>
145 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800146#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530147/*
148 * <ioctl>
Jeff Johnsonf2cf6592018-05-06 16:27:44 -0700149 * scan_disable - Disable scan
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530150 *
151 * @INPUT: set_value
152 *
153 * @OUTPUT: None
154 *
155 * This IOCTL is used to set disable scan
156 *
157 * @E.g: iwpriv wlan0 scan_disable 1
158 *
159 * Supported Feature: Scan
160 *
161 * Usage: Internal/External
162 *
163 * </ioctl>
164 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800165#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530166/*
167 * <ioctl>
168 * inactivityTO - sets the timeout value for inactivity data while
169 * in power save mode
170 *
171 * @INPUT: int1…..int255
172 *
173 * @OUTPUT: None
174 *
175 * This IOCTL set the timeout value for inactivity data in power save mode
176 *
177 * @E.g: iwpriv wlan0 inactivityTO 20
178 *
179 * Supported Feature: STA
180 *
181 * Usage: Internal/External
182 *
183 * </ioctl>
184 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530186/*
187 * <ioctl>
188 * setMaxTxPower - Dynamically sets the maximum transmission power
189 *
190 * @INPUT: Transmission power in dBm
191 *
192 * @OUTPUT: None
193 *
194 * This IOCTL dynamically sets the maximum transmission power
195 * This setting does not persist over reboots
196 *
197 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
198 *
199 * Supported Feature: STA
200 *
201 * Usage: Internal/External
202 *
203 * </ioctl>
204 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800205#define WE_SET_MAX_TX_POWER 7
Jeff Johnson0187c622019-01-04 06:39:44 -0800206
207#ifdef HASTINGS_BT_WAR
208/* Temporary WAR for Hastings 1.1 only */
209#define WE_SET_HASTINGS_BT_WAR 8
210#endif
211
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800212#define WE_SET_TM_LEVEL 9
Jeff Johnson0187c622019-01-04 06:39:44 -0800213
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530214/*
215 * <ioctl>
216 * setphymode - Set the phymode dynamically
217 *
218 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
219 *
220 * @OUTPUT: None
221 *
222 * This IOCTL sets the phymode dynamically
223 *
224 * @E.g: iwpriv wlan0 setphymode 10
225 *
226 * Supported Feature: STA
227 *
228 * Usage: Internal/External
229 *
230 * </ioctl>
231 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800232#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530233/*
234 * <ioctl>
235 * nss - Set the number of spatial streams
236 *
237 * @INPUT: int1…..int3
238 *
239 * @OUTPUT: None
240 *
241 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
242 *
243 * @E.g: iwpriv wlan0 nss 2
244 *
245 * Supported Feature: STA
246 *
247 * Usage: Internal/External
248 *
249 * </ioctl>
250 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800251#define WE_SET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530252/*
253 * <ioctl>
254 * ldpc - Enables or disables LDPC
255 *
256 * @INPUT: 0 – Disable, 1 - Enable
257 *
258 * @OUTPUT: None
259 *
260 * This IOCTL enables or disables LDPC
261 *
262 * @E.g: iwpriv wlan0 ldpc 1
263 *
264 * Supported Feature: STA
265 *
266 * Usage: Internal/External
267 *
268 * </ioctl>
269 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800270#define WE_SET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530271/*
272 * <ioctl>
273 * tx_stbc - Enables or disables tx_stbc
274 *
275 * @INPUT: Int 0 – Disable, 1 - Enable
276 *
277 * @OUTPUT: None
278 *
279 * This IOTCL used to enables or disables tx_stbc
280 *
281 * @E.g: iwpriv wlan0 tx_stbc <value>
282 *
283 * Supported Feature: STA
284 *
285 * Usage: Internal/External
286 *
287 * </ioctl>
288 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800289#define WE_SET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530290/*
291 * <ioctl>
292 * rx_stbc - Set the rx_stbc parameter
293 *
294 * @INPUT: Int 0 – Disable, 1 - Enable
295 *
296 * @OUTPUT: None
297 *
298 * This IOTCL used to set rx_stbc parameter
299 *
300 * @E.g: iwpriv wlan0 rx_stbc <value>
301 *
302 * Supported Feature: STA
303 *
304 * Usage: Internal/External
305 *
306 * </ioctl>
307 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800308#define WE_SET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530309/*
310 * <ioctl>
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800311 * shortgi - Sets the short-guard interval
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530312 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800313 * @INPUT: Fixed Rate: 0 - 400ns, 1 - 800ns, 2 - 1600ns, 3 - 3200us
314 * Auto Rate: 8 - 400ns, 9 - 800ns, 10 - 1600ns, 11 - 3200us
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530315 *
316 * @OUTPUT: None
317 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800318 * This IOCTL sets the short-guard interval.
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530319 *
320 * @E.g: iwpriv wlan0 shortgi <value>
321 *
322 * Supported Feature: STA
323 *
324 * Usage: Internal/External
325 *
326 * </ioctl>
327 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800328#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530329/*
330 * <ioctl>
331 * enablertscts - enables or disables rts/cts.
332 *
333 * @INPUT: 1-Enable , 0-Disable
334 *
335 * @OUTPUT: None
336 *
337 * This IOCTL enables or disables rts/cts.
338 *
339 * @E.g: iwpriv wlan0 enablertscts <value>
340 *
341 * Supported Feature: STA
342 *
343 * Usage: Internal/External
344 *
345 * </ioctl>
346 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800347#define WE_SET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530348/*
349 * <ioctl>
350 * chwidth - Set the channel bandwidth
351 *
352 * @INPUT: 0-20mhz to 3-160mhz
353 *
354 * @OUTPUT: None
355 *
356 * This IOTCL used to set the channel bandwidth
357 *
358 * @E.g: iwpriv wlan0 chwidth 1
359 *
360 * Supported Feature: STA
361 *
362 * Usage: Internal/External
363 *
364 * </ioctl>
365 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800366#define WE_SET_CHWIDTH 17
367#define WE_SET_ANI_EN_DIS 18
368#define WE_SET_ANI_POLL_PERIOD 19
369#define WE_SET_ANI_LISTEN_PERIOD 20
370#define WE_SET_ANI_OFDM_LEVEL 21
371#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530372/*
373 * <ioctl>
374 * cwmenable - Enables or disables the dynamic channel bandwidth
375 *
376 * @INPUT: 0-Disable, 1-Enable
377 *
378 * @OUTPUT: None
379 *
380 * This IOTCL used to enables or disables the dynamic channel bandwidth
381 *
382 * @E.g: iwpriv wlan0 cwmenable <value>
383 *
384 * Supported Feature: STA
385 *
386 * Usage: Internal/External
387 *
388 * </ioctl>
389 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800390#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530391/*
392 * <ioctl>
393 * txchainmask - This IOCTL sets the current Tx chain mask
394 *
395 * @INPUT: Mask Value
396 *
397 * @OUTPUT: None
398 *
399 * This IOCTL sets the current Tx chain mask
400 *
401 * @E.g: iwpriv wlan0 txchainmask 1
402 *
403 * Supported Feature: STA
404 *
405 * Usage: Internal/External
406 *
407 * </ioctl>
408 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800409#define WE_SET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530410/*
411 * <ioctl>
412 * rxchainmask - Sets the current Rx chain mask
413 *
414 * @INPUT: Mask Value
415 *
416 * @OUTPUT: None
417 *
418 * This IOCTL sets the current Rx chain mask. This command is the
419 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
420 *
421 * @E.g: iwpriv wlan0 rxchainmask <value>
422 *
423 * Supported Feature: STA
424 *
425 * Usage: Internal/External
426 *
427 * </ioctl>
428 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800429#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530430/*
431 * <ioctl>
432 * set11NRates - Fixes the Tx data rate of the 11N mode.
433 *
434 * @INPUT: 0x1b to 0x8f
435 *
436 * @OUTPUT: None
437 *
438 * This IOCTL fixes the Tx data rate of the 11N mode.
439 *
440 * @E.g: iwpriv wlan0 set11NRates 0x85
441 *
442 * Supported Feature: STA
443 *
444 * Usage: Internal/External
445 *
446 * </ioctl>
447 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800448#define WE_SET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530449/*
450 * <ioctl>
451 * ampdu - Set the the maximum subframe of ampdu
452 *
453 * @INPUT: int 1 to int 63
454 *
455 * @OUTPUT: None
456 *
457 * This IOCTL sets the maximum subframe of ampdu.
458 *
459 * @E.g: iwpriv wlan0 ampdu 9
460 *
461 * Supported Feature: STA
462 *
463 * Usage: Internal/External
464 *
465 * </ioctl>
466 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800467#define WE_SET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530468/*
469 * <ioctl>
470 * amsdu - Sets the maximum subframe of amsdu.
471 *
472 * @INPUT: int 1 to int 31
473 *
474 * @OUTPUT: None
475 *
476 * This IOCTL sets the maximum subframe of amsdu.
477 *
478 * @E.g: iwpriv wlan0 amsdu 9
479 *
480 * Supported Feature: STA
481 *
482 * Usage: Internal/External
483 *
484 * </ioctl>
485 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800486#define WE_SET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530487/*
488 * <ioctl>
489 * txpow2g - current 2 GHz Tx power setting
490 *
491 * @INPUT: Tx power in dBm
492 *
493 * @OUTPUT: None
494 *
495 * This IOTCL used to set 2 ghz tx power
496 *
497 * @E.g: iwpriv wlan0 txpow2g
498 *
499 * Supported Feature: STA
500 *
501 * Usage: Internal/External
502 *
503 * </ioctl>
504 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800505#define WE_SET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530506/*
507 * <ioctl>
508 * txpow5g - Current 5 GHz tx power setting
509 *
510 * @INPUT: Tx power in dBm
511 *
512 * @OUTPUT: None
513 *
514 * This IOTCL used to set the 5 ghz txpower
515 *
516 * @E.g: iwpriv wlan0 txpow5g
517 *
518 * Supported Feature: STA
519 *
520 * Usage: Internal/External
521 *
522 * </ioctl>
523 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800524#define WE_SET_TXPOW_5G 30
525/* Private ioctl for firmware debug log */
526#define WE_DBGLOG_LOG_LEVEL 31
527#define WE_DBGLOG_VAP_ENABLE 32
528#define WE_DBGLOG_VAP_DISABLE 33
529#define WE_DBGLOG_MODULE_ENABLE 34
530#define WE_DBGLOG_MODULE_DISABLE 35
531#define WE_DBGLOG_MOD_LOG_LEVEL 36
532#define WE_DBGLOG_TYPE 37
533#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530534/*
535 * <ioctl>
536 * set11ACRates - Fixes the Tx data rate of 11AC
537 *
538 * @INPUT: 0x1 to 0x9
539 *
540 * @OUTPUT: None
541 *
542 * This IOCTL fixes the Tx data rate of 11AC.
543 *
544 * @E.g: iwpriv wlan0 set11ACRates 0x9
545 *
546 * Supported Feature: STA
547 *
548 * Usage: Internal/External
549 *
550 * </ioctl>
551 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800552#define WE_SET_VHT_RATE 39
553#define WE_DBGLOG_REPORT_ENABLE 40
554#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530555/*
556 * <ioctl>
557 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
558 *
559 * @INPUT: Transmission power in dBm
560 *
561 * @OUTPUT: None
562 *
563 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
564 * This setting does not persist over reboots
565 *
566 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
567 *
568 * Supported Feature: STA
569 *
570 * Usage: Internal/External
571 *
572 * </ioctl>
573 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800574#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530575/*
576 * <ioctl>
577 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
578 *
579 * @INPUT: Transmission power in dBm
580 *
581 * @OUTPUT: None
582 *
583 * This IOCTL sets the maximum transmit power for the 5-GHz band
584 * This setting does not persist over reboots
585 *
586 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
587 *
588 * Supported Feature: STA
589 *
590 * Usage: Internal/External
591 *
592 * </ioctl>
593 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800594#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800595#define WE_SET_PKTLOG 44
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530596/* Private ioctl for packet power save */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800597#define WE_PPS_PAID_MATCH 45
598#define WE_PPS_GID_MATCH 46
599#define WE_PPS_EARLY_TIM_CLEAR 47
600#define WE_PPS_EARLY_DTIM_CLEAR 48
601#define WE_PPS_EOF_PAD_DELIM 49
602#define WE_PPS_MACADDR_MISMATCH 50
603#define WE_PPS_DELIM_CRC_FAIL 51
604#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530605/*
606 * <ioctl>
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530607 * rssi_chk - Check the rssi
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530608 *
609 * @INPUT: One argument as input
610 *
611 * @OUTPUT: rssi
612 * wlan0 rssi_chk:56
613 *
614 * This IOTCL used to chek rssi
615 *
616 * @E.g: iwpriv wlan0 rssi_chk <value>
617 *
618 * Supported Feature: STA
619 *
620 * Usage: Internal/External
621 *
622 * </ioctl>
623 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800624#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530625/*
626 * <ioctl>
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530627 * htsmps - Sets the htsmps
628 *
629 * @INPUT: Atleast one int argument
630 *
631 * @OUTPUT: None
632 *
633 * This IOTCL used to set htsmps
634 *
635 * @E.g: iwpriv wlan0 htsmps <value>
636 *
637 * Supported Feature: STA
638 *
639 * Usage: Internal/External
640 *
641 * </ioctl>
642 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800643#define WE_SET_HTSMPS 55
644/* Private ioctl for QPower */
645#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
646#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
647#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
648#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800649/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530650/*
651 * <ioctl>
652 * gtxHTMcs - Set the tx HTM value
653 *
654 * @INPUT: Atleast one int orgument
655 *
656 * @OUTPUT: None
657 *
658 * This IOTCL sets htm tx value
659 *
660 * @E.g: iwpriv wlan0 gtxHTMcs <value>
661 *
662 * Supported Feature: STA
663 *
664 * Usage: Internal/External
665 *
666 * </ioctl>
667 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800668#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530669/*
670 * <ioctl>
671 * gtxVHTMcs - Set gtxVHTMcs value
672 *
673 * @INPUT: Atleast one int argument
674 *
675 * @OUTPUT: None
676 *
677 * This IOTCL used to set gtxVHTMcs value
678 *
679 * @E.g: iwpriv wlan0 gtxVHTMcs <value>
680 *
681 * Supported Feature: STA
682 *
683 * Usage: Internal/External
684 *
685 * </ioctl>
686 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800687#define WE_SET_GTX_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530688/*
689 * <ioctl>
690 * gtxUsrCfg - Host request for GTX mask
691 *
692 * @INPUT: Atleast one int orgument
693 *
694 * @OUTPUT: None
695 *
696 * This IOTCL used send the host request for GTX mask
697 *
698 * @E.g: iwpriv wlan0 gtxUsrCfg <value>
699 *
700 * Supported Feature: STA
701 *
702 * Usage: Internal/External
703 *
704 * </ioctl>
705 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800706#define WE_SET_GTX_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530707/*
708 * <ioctl>
709 * gtxThre - Set the tx threshold
710 *
711 * @INPUT: Atleast one int argument
712 *
713 * @OUTPUT: None
714 *
715 * This IOTCL used to set tx threshold
716 *
717 * @E.g: iwpriv wlan0 gtxThre <value>
718 *
719 * Supported Feature: STA
720 *
721 * Usage: Internal/External
722 *
723 * </ioctl>
724 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800725#define WE_SET_GTX_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530726/*
727 * <ioctl>
728 * gtxMargin - Set the gtxMargin
729 *
730 * @INPUT: 1 to 32
731 *
732 * @OUTPUT: None
733 *
734 * This IOTCL use dto set gtxMargin
735 *
736 * @E.g: iwpriv wlan0 gtxMargini <value>
737 *
738 * Supported Feature: STA
739 *
740 * Usage: Internal/External
741 *
742 * </ioctl>
743 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800744#define WE_SET_GTX_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530745/*
746 * <ioctl>
747 * gtxStep - Set the gtxStep
748 *
749 * @INPUT: None
750 *
751 * @OUTPUT: None
752 *
753 * This IOTCL used to sets gtxStep
754 *
755 * @E.g: iwpriv wlan0 gtxStep <value>
756 *
757 * Supported Feature: STA
758 *
759 * Usage: Internal/External
760 *
761 * </ioctl>
762 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800763#define WE_SET_GTX_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530764/*
765 * <ioctl>
766 * gtxMinTpc - Sets the gtxMinTpc
767 *
768 * @INPUT: Atleast one int argument
769 *
770 * @OUTPUT: None
771 *
772 * This IOTCL sets the tx MinTpc
773 *
774 * @E.g: iwpriv wlan0 gtxMinTpc <value>
775 *
776 * Supported Feature: STA
777 *
778 * Usage: Internal/External
779 *
780 * </ioctl>
781 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800782#define WE_SET_GTX_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530783/*
784 * <ioctl>
785 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
786 *
787 * @INPUT: Mask value
788 *
789 * @OUTPUT: None
790 *
791 * This IOTCL used to set gtxBWMask
792 *
793 * @E.g: iwpriv wlan0 gtxBWMask <value>
794 *
795 * Supported Feature: STA
796 *
797 * Usage: Internal/External
798 *
799 * </ioctl>
800 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530801
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530802#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530803/*
804 * <ioctl>
805 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
806 *
807 * @INPUT: set_value
808 *
809 * @OUTPUT: None
810 *
811 * This IOCTL is used to set the MCC latency value in milliseconds
812 * during STA-P2P concurrency.
813 *
814 * If 0ms latency is provided, then FW will set to a default.
815 * Otherwise, latency must be at least 30ms.
816 *
817 * @E.g: iwpriv wlan0 setMccLatency 40
818 *
819 *
820 * Supported Feature: Concurrency
821 *
822 * Usage: Internal/External
823 *
824 * </ioctl>
825 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800826#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530827
828/*
829 * <ioctl>
830 * setMccQuota- Set the quota for P2P cases
831 *
832 * @INPUT: set_value [0,100]
833 *
834 * @OUTPUT: None
835 *
836 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
837 *
838 * Currently used to set time quota for 2 MCC vdevs/adapters using
839 * (operating channel, quota) for each mode.
840 * The info is provided run time using iwpriv command:
841 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
842 * Note: the quota provided in command is for the same mode in cmd.
843 * HDD checks if MCC mode is active, gets the second mode and its
844 * operating chan.
845 * Quota for the 2nd role is calculated as 100 - quota of first mode.
846 *
847 * @E.g: iwpriv wlan0 setMccQuota 50
848 * iwpriv p2p0 setMccQuota 50
849 *
850 * Supported Feature: Concurrency
851 *
852 * Usage: Internal/External
853 *
854 * </ioctl>
855 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800856#define WE_MCC_CONFIG_QUOTA 71
857/* Private IOCTL for debug connection issues */
858#define WE_SET_DEBUG_LOG 72
859#ifdef WE_SET_TX_POWER
860#undef WE_SET_TX_POWER
861#endif
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -0800862
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530863/*
864 * <ioctl>
865 * setTxPower - Set the current transmit power
866 *
867 * @INPUT: Transmission power in dBm
868 *
869 * @OUTPUT: None
870 *
871 * This IOCTL sets the current transmit power.
872 * This setting does not persist over reboots.
873 *
874 * @E.g: iwpriv wlan0 setTxPower 10
875 *
876 * Supported Feature: STA
877 *
878 * Usage: Internal/External
879 *
880 * </ioctl>
881 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800882#define WE_SET_TX_POWER 74
883/* Private ioctl for earlyrx power save feature */
884#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
885#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
886#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
887#define WE_SET_EARLY_RX_SLOP_STEP 78
888#define WE_SET_EARLY_RX_INIT_SLOP 79
889#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530890/*
891 * <ioctl>
892 * setMcRate - Set the data rate for multicast data
893 *
894 * @INPUT: 1 to 32
895 *
896 * @OUTPUT: None
897 *
898 * This IOCTL sets the data rate for multicast data. Note that this command
899 * is allowed only in STA, IBSS, or QCMobileAP mode
900 *
901 * @E.g: iwpriv wlan0 setMcRate <value>
902 *
903 * Supported Feature: STA
904 *
905 * Usage: Internal/External
906 *
907 * </ioctl>
908 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800909#define WE_SET_MC_RATE 81
910#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
911/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530912/*
913 * <ioctl>
914 * 5g_ebt - Sets the 5g_ebt
915 *
916 * @INPUT: <value>
917 *
918 * @OUTPUT: None
919 *
920 * This IOTCL used to set 5g_ebt
921 *
922 * @E.g: iwpriv wlan0 5g_ebt <value>
923 *
924 * Supported Feature: STA
925 *
926 * Usage: Internal/External
927 *
928 * </ioctl>
929 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800930#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530931/*
932 * <ioctl>
933 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
934 *
935 * @INPUT: 20 t0 160
936 *
937 * @OUTPUT: None
938 *
939 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
940 *
941 * @E.g: iwpriv wlan0 cts_cbw <value>
942 *
943 * Supported Feature: STA
944 *
945 * Usage: Internal/External
946 *
947 * </ioctl>
948 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800949#define WE_SET_CTS_CBW 84
950#define WE_DUMP_STATS 85
951#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +0530952/* Private sub ioctl for starting/stopping the profiling */
953#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +0530954
Abhishek Singh3c507012016-12-01 11:15:42 +0530955/*
956 * <ioctl>
957 * setChanChange - Initiate channel change
958 *
959 * @INPUT: channel number to switch to.
960 *
961 * @OUTPUT: None
962 *
963 * This IOCTL is used to initiate a channel change.
964 * If called on STA/CLI interface it will send the
965 * ECSA action frame to the connected SAP/GO asking to
966 * initiate the ECSA, if supported.
967 * If called on SAP/GO interface it will initiate
968 * ECSA and ask connected peers to move to new channel.
969 *
970 * @E.g: iwpriv wlan0 setChanChange <channel>
971 * iwpriv wlan0 setChanChange 1
972 *
973 * Supported Feature: ECSA
974 *
975 * Usage: Internal/External
976 *
977 * </ioctl>
978 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +0530979#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +0530980#define WE_SET_CONC_SYSTEM_PREF 89
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800981
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800982/*
983 * <ioctl>
984 * set_11ax_rate - set 11ax rates to FW
985 *
986 * @INPUT: rate code
987 *
988 * @OUTPUT: None
989 *
990 * This IOCTL fixes the Tx data rate of 11AX.
991 *
992 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
993 *
994 * Supported Feature: STA/SAP
995 *
996 * Usage: Internal
997 *
998 * </ioctl>
999 */
1000#define WE_SET_11AX_RATE 91
1001
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001002/*
1003 * <ioctl>
1004 * enable_dcm - enable Dual Carrier Modulation(DCM)
1005 *
1006 * @INPUT: 0/1
1007 *
1008 * @OUTPUT: None
1009 *
1010 * This IOCTL enables/disables DCM.
1011 *
1012 * @E.g: iwpriv wlan0 enable_dcm <0/1>
1013 *
1014 * Supported Feature: STA/SAP
1015 *
1016 * Usage: Internal
1017 *
1018 * </ioctl>
1019 */
1020#define WE_SET_DCM 92
1021
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001022/*
1023 * <ioctl>
Naveen Rawat53448ea2017-11-27 11:43:18 -08001024 * range_ext - enable Range extension
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001025 *
1026 * @INPUT: 0/1
1027 *
1028 * @OUTPUT: None
1029 *
1030 * This IOCTL enables/disables Range extension.
1031 *
Naveen Rawat53448ea2017-11-27 11:43:18 -08001032 * @E.g: iwpriv wlan0 range_ext <1/0>
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001033 *
1034 * Supported Feature: STA/SAP
1035 *
1036 * Usage: Internal
1037 *
1038 * </ioctl>
1039 */
1040#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001041
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301042/*
1043 * <ioctl>
1044 * wow_ito - sets the timeout value for inactivity data while
1045 * in power save mode during wow
1046 *
1047 * @INPUT: int
1048 *
1049 * @OUTPUT: None
1050 *
1051 * This IOCTL set the timeout value for inactivity data in power save mode
1052 *
1053 * @E.g: iwpriv wlan0 wow_ito 20
1054 *
1055 * Supported Feature: STA
1056 *
1057 * Usage: External
1058 *
1059 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001060 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301061#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1062
Jeff Johnson011c4502017-10-05 15:25:56 -07001063/*
1064 * <ioctl>
1065 * pdev_reset - reset the pdev
1066 *
1067 * @INPUT: Reset command to initiate:
1068 * TX_FLUSH = 1
1069 * WARM_RESET = 2
1070 * COLD_RESET = 3
1071 * WARM_RESET_RESTORE_CAL = 4
1072 * COLD_RESET_RESTORE_CAL = 5
1073 *
1074 * @OUTPUT: None
1075 *
1076 * This IOCTL is used to reset the pdev. The primary use is
1077 * for internal testing. It is not expected that this will
1078 * be used on a production device.
1079 *
1080 * @E.g: iwpriv wlan0 pdev_reset <command>
1081 * iwpriv wlan0 pdev_reset 1
1082 *
1083 * Supported Feature: None
1084 *
1085 * Usage: Internal
1086 *
1087 * </ioctl>
1088 */
1089#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301090
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301091/*
1092 * setModDTIM - Change Modulated DTIM
1093 *
1094 * @INPUT: set_value.
1095 *
1096 * @OUTPUT: None
1097 *
1098 * This IOCTL is used to change modulated DTIM
1099 * value without WIFI OFF/ON.
1100 *
1101 * @E.g: iwpriv wlan0 setModDTIM <value>
1102 * iwpriv wlan0 setModDTIM 2
1103 *
1104 * Supported Feature: N/A
1105 *
1106 * Usage: Internal/External
1107 *
1108 * </ioctl>
1109 */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05301110#define WE_SET_MODULATED_DTIM 96
1111
1112#ifdef WLAN_FEATURE_MOTION_DETECTION
1113#define WE_MOTION_DET_START_STOP 97
1114#define WE_MOTION_DET_BASE_LINE_START_STOP 98
1115#endif /* WLAN_FEATURE_MOTION_DETECTION */
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301116
Krishna Reddya50d09f2019-02-04 14:55:06 +05301117/*
Krishna Reddy64c14da2019-02-12 20:23:12 +05301118 * set_btc_mode Set BTCoexMode
Krishna Reddya50d09f2019-02-04 14:55:06 +05301119 *
1120 * @INPUT: set_value.
1121 *
1122 * @OUTPUT: None
1123 *
1124 * This IOCTL is used to set the BT COex operating mode
Krishna Reddy64c14da2019-02-12 20:23:12 +05301125 * Allowed values are 0(TDD), 1(FDD), 2(Hybrid)
Krishna Reddya50d09f2019-02-04 14:55:06 +05301126 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301127 * @E.g: iwpriv wlan0 set_btc_mode <value>
1128 * iwpriv wlan0 set_btc_mode 2
Krishna Reddya50d09f2019-02-04 14:55:06 +05301129 *
1130 * Supported Feature: N/A
1131 *
1132 * Usage: Internal/External
1133 *
1134 * </ioctl>
1135 */
1136#define WE_SET_BTCOEX_MODE 99
1137
1138/*
Krishna Reddy64c14da2019-02-12 20:23:12 +05301139 * set_btc_rssi- Set WLAN low RSSI threshold for BTCOex
Krishna Reddya50d09f2019-02-04 14:55:06 +05301140 *
1141 * @INPUT: set_value.
1142 *
1143 * @OUTPUT: None
1144 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301145 * This IOCTL is used to modify the threshold at which
1146 * the COex mode changes from TDD to Hybrid mode
Krishna Reddya50d09f2019-02-04 14:55:06 +05301147 * Allowed values are from -100 to 0
1148 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301149 * @E.g: iwpriv wlan0 set_btc_rssi <value>
1150 * iwpriv wlan0 set_btc_rssi -70
Krishna Reddya50d09f2019-02-04 14:55:06 +05301151 *
1152 * Supported Feature: N/A
1153 *
1154 * Usage: Internal/External
1155 *
1156 * </ioctl>
1157 */
1158#define WE_SET_BTCOEX_RSSI_THRESHOLD 100
1159
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001160/* Private ioctls and their sub-ioctls */
1161#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1162#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001163#define WE_GET_WLAN_DBG 4
1164#define WE_GET_MAX_ASSOC 6
1165/* 7 is unused */
1166#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301167
1168/*
1169 * <ioctl>
1170 * getconcurrency - Get concurrency mode
1171 *
1172 * @INPUT: None
1173 *
1174 * @OUTPUT: It shows concurrency value
1175 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1176 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1177 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1178 *
1179 * This IOCTL is used to retrieve concurrency mode.
1180 *
1181 * @E.g: iwpriv wlan0 getconcurrency
1182 * wlan0 getconcurrency:5
1183 * Above value shows STA+P2P_Client
1184 *
1185 * Supported Feature: Concurrency
1186 *
1187 * Usage: Internal/External
1188 *
1189 * </ioctl>
1190 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001191#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301192/*
1193 * <ioctl>
1194 * get_nss - Get the number of spatial STBC streams (NSS)
1195 *
1196 * @INPUT: None
1197 *
1198 * @OUTPUT: NSS
1199 * wlan0 get_nss:2
1200 *
1201 * This IOTCL used to get the number of spatial STBC streams
1202 *
1203 * @E.g: iwpriv wlan0 get_nss
1204 *
1205 * Supported Feature: STA
1206 *
1207 * Usage: Internal/External
1208 *
1209 * </ioctl>
1210 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001211#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301212/*
1213 * <ioctl>
1214 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1215 *
1216 * @INPUT: None
1217 *
1218 * @OUTPUT: ldpc
1219 * wlan0 get_ldpc:1
1220 *
1221 * This IOTCL used to gets the low density parity check (LDPC)
1222 *
1223 * @E.g: iwpriv wlan0 get_ldpc
1224 *
1225 * Supported Feature: STA
1226 *
1227 * Usage: Internal/External
1228 *
1229 * </ioctl>
1230 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001231#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301232/*
1233 * <ioctl>
1234 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1235 *
1236 * @INPUT: None
1237 *
1238 * @OUTPUT: TXSTBC
1239 * wlan0 get_tx_stbc:1
1240 *
1241 * This IOTCL get the value of the current Tx space time block code (STBC)
1242 *
1243 * @E.g: iwpriv wlan0 get_tx_stbc
1244 *
1245 * Supported Feature: STA
1246 *
1247 * Usage: Internal/External
1248 *
1249 * </ioctl>
1250 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001251#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301252/*
1253 * <ioctl>
1254 * get_rx_stbc - Gets the value of the current Rx STBC
1255 *
1256 * @INPUT: None
1257 *
1258 * @OUTPUT: Rx STBC
1259 * wlan0 get_rx_stbc:1
1260 *
1261 * This IOTCL used to get the value of the current Rx STBC
1262 *
1263 * @E.g: iwpriv wlan0 get_rx_stbc
1264 *
1265 * Supported Feature: STA
1266 *
1267 * Usage: Internal/External
1268 *
1269 * </ioctl>
1270 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001271#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301272/*
1273 * <ioctl>
1274 * get_shortgi - Get the value of the current short GI setting
1275 *
1276 * @INPUT: None
1277 *
1278 * @OUTPUT: Enable/disable of shortgi
1279 * wlan0 get_shortgi:1
1280 *
1281 * This IOCTL gets the value of the current short GI setting
1282 *
1283 * @E.g: iwpriv wlan0 get_shortgi
1284 *
1285 * Supported Feature: STA
1286 *
1287 * Usage: Internal/External
1288 *
1289 * </ioctl>
1290 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001291#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301292/*
1293 * <ioctl>
1294 * get_rtscts - Get the value of the current RTS/CTS setting.
1295 *
1296 * @INPUT: None
1297 *
1298 * @OUTPUT: Enable/disable of RTS/CTS
1299 * wlan0 get_rtscts:33
1300 *
1301 * This IOTCL get the value of the current RTS/CTS setting.
1302 *
1303 * @E.g: iwpriv wlan0 get_rtscts
1304 *
1305 * Supported Feature: STA
1306 *
1307 * Usage: Internal/External
1308 *
1309 * </ioctl>
1310 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001311#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301312/*
1313 * <ioctl>
1314 * get_chwidth - Get the current channel width setting
1315 *
1316 * @INPUT: None
1317 *
1318 * @OUTPUT: channel width
1319 * wlan0 get_chwidth:0
1320 *
1321 * This IOTCL get the current channel width setting.
1322 *
1323 * @E.g: iwpriv wlan0 get_chwidth
1324 *
1325 * Supported Feature: STA
1326 *
1327 * Usage: Internal/External
1328 *
1329 * </ioctl>
1330 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001331#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301332/*
1333 * <ioctl>
1334 * get_anienable - Get the anienable
1335 *
1336 * @INPUT: None
1337 *
1338 * @OUTPUT:
1339 * wlan0 get_anienable:0
1340 *
1341 * This IOTCL get the anienable
1342 *
1343 * @E.g: iwpriv wlan0 get_anienable
1344 *
1345 * Supported Feature: STA
1346 *
1347 * Usage: Internal/External
1348 *
1349 * </ioctl>
1350 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001351#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301352/*
1353 * <ioctl>
1354 * get_aniplen - Get the aniplen
1355 *
1356 * @INPUT: None
1357 *
1358 * @OUTPUT:
1359 * wlan0 get_aniplen:0
1360 *
1361 * This IOTCL get the aniplen
1362 *
1363 * @E.g: iwpriv wlan0 get_aniplen
1364 *
1365 * Supported Feature: STA
1366 *
1367 * Usage: Internal/External
1368 *
1369 * </ioctl>
1370 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001371#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301372/*
1373 * <ioctl>
1374 * get_anilislen- Get the anilislen
1375 *
1376 * @INPUT: None
1377 *
1378 * @OUTPUT:
1379 * wlan0 get_anilislen:0
1380 *
1381 * This IOTCL used to get anilislen
1382 *
1383 * @E.g: iwpriv wlan0 get_anilislen
1384 *
1385 * Supported Feature: STA
1386 *
1387 * Usage: Internal/External
1388 *
1389 * </ioctl>
1390 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001391#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301392/*
1393 * <ioctl>
1394 * get_aniofdmlvl - Get the OFDM level
1395 *
1396 * @INPUT: None
1397 *
1398 * @OUTPUT: OFDM
1399 * wlan0 get_aniofdmlvl:0
1400 *
1401 * This IOTCL used to get ofdm level
1402 *
1403 * @E.g: iwpriv wlan0 get_aniofdmlvl
1404 *
1405 * Supported Feature: STA
1406 *
1407 * Usage: Internal/External
1408 *
1409 * </ioctl>
1410 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001411#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301412/*
1413 * <ioctl>
1414 * get_aniccklvl - Get the cck level
1415 *
1416 * @INPUT: None
1417 *
1418 * @OUTPUT:
1419 * wlan0 get_aniccklvl:0
1420 *
1421 * This IOTCL used to get cck level
1422 *
1423 * @E.g: iwpriv wlan0 get_aniccklvl
1424 *
1425 * Supported Feature: STA
1426 *
1427 * Usage: Internal/External
1428 *
1429 * </ioctl>
1430 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001431#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301432/*
1433 * <ioctl>
1434 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1435 *
1436 * @INPUT: None
1437 *
1438 * @OUTPUT: Enable/disable dynamic channel bandwidth
1439 * wlan0 get_cwmenable:0
1440 *
1441 * This IOTCL get the value of the dynamic channel bandwidth setting
1442 *
1443 * @E.g: iwpriv wlan0 get_cwmenable
1444 *
1445 * Supported Feature: STA
1446 *
1447 * Usage: Internal/External
1448 *
1449 * </ioctl>
1450 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001451#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301452/*
1453 * <ioctl>
1454 * get_txchainmask - Get the txchainmask that was set
1455 *
1456 * @INPUT: None
1457 *
1458 * @OUTPUT: txchainmask
1459 * wlan0 get_txchainmask:1
1460 *
1461 * This IOCTL gets the txchainmask that was set
1462 * This command is useful if it was previously set
1463 *
1464 * @E.g: iwpriv wlan0 get_txchainmask
1465 *
1466 * Supported Feature: STA
1467 *
1468 * Usage: Internal/External
1469 *
1470 * </ioctl>
1471 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001472#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301473/*
1474 * <ioctl>
1475 * get_rxchainmask - Get the rxchainmask that was set
1476 *
1477 * @INPUT: None
1478 *
1479 * @OUTPUT: rxchainmask
1480 * wlan0 get_rxchainmask:1
1481 *
1482 * This IOCTL gets the rxchainmask that was set
1483 * This command is useful only if it was previously set.
1484 *
1485 * @E.g: iwpriv wlan0 get_rxchainmask
1486 *
1487 * Supported Feature: STA
1488 *
1489 * Usage: Internal/External
1490 *
1491 * </ioctl>
1492 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001493#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301494/*
1495 * <ioctl>
1496 * get_11nrate - Get the fixed Tx data rate
1497 *
1498 * @INPUT: None
1499 *
1500 * @OUTPUT: Using this command does not return the same value as set
1501 * wlan0 get_11nrate:0
1502 *
1503 * This IOCTL gets the fixed Tx data rate
1504 * This command is useful only if setting the fixed Tx rate.
1505 *
1506 * @E.g: iwpriv wlan0 get_11nrate
1507 *
1508 * Supported Feature: STA
1509 *
1510 * Usage: Internal/External
1511 *
1512 * </ioctl>
1513 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001514#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301515/*
1516 * <ioctl>
1517 * get_ampdu - Get the maximum subframe of ampdu
1518 *
1519 * @INPUT: None
1520 *
1521 * @OUTPUT: Maximum subframe of ampdu
1522 * wlan0 get_ampdu:1
1523 *
1524 * This IOCTL gets the maximum subframe of ampdu
1525 * This command is useful only if setting ampdu.
1526 *
1527 * @E.g: iwpriv wlan0 get_ampdu
1528 *
1529 * Supported Feature: STA
1530 *
1531 * Usage: Internal/External
1532 *
1533 * </ioctl>
1534 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001535#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301536/*
1537 * <ioctl>
1538 * get_amsdu - Get the maximum subframe of amsdu
1539 *
1540 * @INPUT: None
1541 *
1542 * @OUTPUT: Maximum subframe of amsdu
1543 * wlan0 get_amsdu:1
1544 *
1545 * This IOCTL gets the maximum subframe of amsdu.
1546 * This command is useful only if setting amsdu
1547 *
1548 * @E.g: iwpriv wlan0 get_amsdu
1549 *
1550 * Supported Feature: STA
1551 *
1552 * Usage: Internal/External
1553 *
1554 * </ioctl>
1555 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001556#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301557/*
1558 * <ioctl>
1559 * get_txpow2g - Get the current 2 GHz Tx power setting
1560 *
1561 * @INPUT: None
1562 *
1563 * @OUTPUT: Tx Power in dbm
1564 * wlan0 get_txpow2g:0
1565 *
1566 * This IOCTL gets the current 2 GHz Tx power setting
1567 * This command is useful if setting Tx power
1568 *
1569 * @E.g: iwpriv wlan0 get_txpow2g
1570 *
1571 * Supported Feature: STA
1572 *
1573 * Usage: Internal/External
1574 *
1575 * </ioctl>
1576 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001577#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301578/*
1579 * <ioctl>
1580 * get_txpow5g - Get the current 5 GHz Tx power setting
1581 *
1582 * @INPUT: None
1583 *
1584 * @OUTPUT: Tx Power in dbm
1585 * wlan0 get_txpow5g:0
1586 *
1587 * This IOCTL gets the current 5 GHz Tx power setting
1588 * This command is useful if setting Tx power
1589 *
1590 * @E.g: iwpriv wlan0 get_txpow5g
1591 *
1592 * Supported Feature: STA
1593 *
1594 * Usage: Internal/External
1595 *
1596 * </ioctl>
1597 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001598#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001599/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001600#define WE_GET_PPS_PAID_MATCH 32
1601#define WE_GET_PPS_GID_MATCH 33
1602#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1603#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1604#define WE_GET_PPS_EOF_PAD_DELIM 36
1605#define WE_GET_PPS_MACADDR_MISMATCH 37
1606#define WE_GET_PPS_DELIM_CRC_FAIL 38
1607#define WE_GET_PPS_GID_NSTS_ZERO 39
1608#define WE_GET_PPS_RSSI_CHECK 40
1609/* Private ioctl for QPower */
1610#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1611#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1612#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1613#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001614/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301615/*
1616 * <ioctl>
1617 * get_gtxHTMcs - Get the tx HTM
1618 *
1619 * @INPUT: None
1620 *
1621 * @OUTPUT: HTM
1622 * wlan0 get_gtxHTMcs:32896
1623 *
1624 * This IOTCL used to get HTM
1625 *
1626 * @E.g: iwpriv wlan0 get_gtxHTMcs
1627 *
1628 * Supported Feature: STA
1629 *
1630 * Usage: Internal/External
1631 *
1632 * </ioctl>
1633 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001634#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301635/*
1636 * <ioctl>
1637 * get_gtxVHTMcs - Get the VHTM
1638 *
1639 * @INPUT: None
1640 *
1641 * @OUTPUT: VHTM
1642 * wlan0 get_gtxVHTMcs:524800
1643 *
1644 * This IOTCL used to get the VHTM
1645 *
1646 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1647 *
1648 * Supported Feature: STA
1649 *
1650 * Usage: Internal/External
1651 *
1652 * </ioctl>
1653 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001654#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301655/*
1656 * <ioctl>
1657 * get_gtxUsrCfg - Get the tx cfg
1658 *
1659 * @INPUT: None
1660 *
1661 * @OUTPUT: TXCFG
1662 * wlan0 get_gtxUsrCfg:32
1663 *
1664 * This IOTCL used to get the tx cfg
1665 *
1666 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1667 *
1668 * Supported Feature: STA
1669 *
1670 * Usage: Internal/External
1671 *
1672 * </ioctl>
1673 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001674#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301675/*
1676 * <ioctl>
1677 * get_gtxThre - Get the tx threshold
1678 *
1679 * @INPUT: None
1680 *
1681 * @OUTPUT: Threshold
1682 * wlan0 get_gtxThre:3
1683 *
1684 * This IOCTL is used to get tx threshold
1685 *
1686 * @E.g: iwpriv wlan0 get_gtxThre
1687 *
1688 * Supported Feature: STA
1689 *
1690 * Usage: Internal/External
1691 *
1692 * </ioctl>
1693 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001694#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301695/*
1696 * <ioctl>
1697 * get_gtxMargin - Get the tx margin
1698 *
1699 * @INPUT: None
1700 *
1701 * @OUTPUT: GTXMARGIN
1702 * wlan0 get_gtxMargin:2
1703 *
1704 * This IOCTL is used to set tx margin
1705 *
1706 * @E.g: iwpriv wlan0 get_gtxMargin
1707 *
1708 * Supported Feature: STA
1709 *
1710 * Usage: Internal/External
1711 *
1712 * </ioctl>
1713 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001714#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301715/*
1716 * <ioctl>
1717 * get_gtxStep - Get the tx step
1718 *
1719 * @INPUT: None
1720 *
1721 * @OUTPUT: GTXSTEP
1722 * wlan0 get_gtxStep:0
1723 *
1724 * This IOCTL is used to get the gtx step
1725 *
1726 * @E.g: iwpriv wlan0 get_gtxStep
1727 *
1728 * Supported Feature: STA
1729 *
1730 * Usage: Internal/External
1731 *
1732 * </ioctl>
1733 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001734#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301735/*
1736 * <ioctl>
1737 * get_gtxMinTpc - Get the tx miminum tpc
1738 *
1739 * @INPUT: None
1740 *
1741 * @OUTPUT: TPC
1742 * wlan0 get_gtxMinTpc:0
1743 *
1744 * This IOCTL is used to get tx miminum tpc
1745 *
1746 * @E.g: iwpriv wlan0 get_gtxMinTpc
1747 *
1748 * Supported Feature: STA
1749 *
1750 * Usage: Internal/External
1751 *
1752 * </ioctl>
1753 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001754#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301755/*
1756 * <ioctl>
1757 * get_gtxBWMask - Get the tx BW MASK
1758 *
1759 * @INPUT: None
1760 *
1761 * @OUTPUT: MASK
1762 * wlan0 get_gtxBWMask:15
1763 *
1764 * This IOCTL is used get gtx bw mask
1765 *
1766 * @E.g: iwpriv wlan0 get_gtxBWMask
1767 *
1768 * Supported Feature: STA
1769 *
1770 * Usage: Internal/External
1771 *
1772 * </ioctl>
1773 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001774#define WE_GET_GTX_BWMASK 54
1775#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001776#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001777#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001778
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001779/*
1780 * <ioctl>
1781 * get_dcm - Get dcm enablement value
1782 *
1783 * @INPUT: None
1784 *
1785 * @OUTPUT: 0/1
1786 * wlan0 get_dcm
1787 *
1788 * This IOCTL is used get dcm value
1789 *
1790 * Supported Feature: STA/SAP
1791 *
1792 * Usage: Internal
1793 *
1794 * </ioctl>
1795 */
1796#define WE_GET_DCM 60
1797
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001798/*
1799 * <ioctl>
1800 * get_dcm - Get range extension enablement value
1801 *
1802 * @INPUT: None
1803 *
1804 * @OUTPUT: 0/1
1805 * wlan0 get_range_ext
1806 *
1807 * This IOCTL is used get range_extension value
1808 *
1809 * Supported Feature: STA/SAP
1810 *
1811 * Usage: Internal
1812 *
1813 * </ioctl>
1814 */
1815#define WE_GET_RANGE_EXT 61
1816
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001817/* Private ioctls and their sub-ioctls */
1818#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1819
1820/* Private ioctls and their sub-ioctls */
1821#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1822#define WE_WOWL_ADD_PTRN 1
1823#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301824/*
1825 * <ioctl>
1826 * neighbor - Send neighbor report request
1827 *
1828 * @INPUT: string
1829 *
1830 * @OUTPUT: None
1831 *
1832 * This IOCTL create a Neighbor report request and send it to peer
1833 *
1834 * @E.g: iwpriv wlan0 neighbor "SSID"
1835 *
1836 * Supported Feature: 11k
1837 *
1838 * Usage: Internal/External
1839 *
1840 * </ioctl>
1841 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001842#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301843/*
1844 * <ioctl>
1845 * set_ap_wps_ie - Set the P2P IE of the probe response
1846 *
1847 * @INPUT: string
1848 *
1849 * @OUTPUT: None
1850 *
1851 * This IOCTL sets the P2P IE of the probe response
1852 *
1853 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1854 *
1855 * Supported Feature: STA
1856 *
1857 * Usage: Internal/External
1858 *
1859 * </ioctl>
1860 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001861#define WE_SET_AP_WPS_IE 4
Jeff Johnson0fcc94e2019-03-06 19:48:17 -08001862
1863/* 5 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001864
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07001865/*
1866 * <ioctl>
1867 * unit_test - execute component-level unit tests
1868 *
1869 * @INPUT: string - the name of the component to test.
1870 * All tests are executed if unspecified
1871 * @OUTPUT: None
1872 *
1873 * Usage: Internal only
1874 * </ioctl>
1875 */
1876#define WE_UNIT_TEST 6
1877
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001878/* Private ioctls and their sub-ioctls */
1879#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1880#define WE_SET_WLAN_DBG 1
1881#define WE_SET_DP_TRACE 2
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301882#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001883
1884/* Private ioctls and their sub-ioctls */
1885#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1886#define WE_WLAN_VERSION 1
1887#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301888/*
1889 * <ioctl>
1890 * getConfig - gets the values of all configurations listed in WCNSS
1891 *
1892 * @INPUT: None
1893 *
1894 * @OUTPUT: Current configuration to the sys log
1895 * wlan0 getConfig: WLAN configuration written to system log
1896 *
1897 * This IOCTL gets the values of all configurations listed in WCNSS
1898 *
1899 * @E.g: iwpriv wlan0 getConfig
1900 *
1901 * Supported Feature: STA
1902 *
1903 * Usage: Internal/External
1904 *
1905 * </ioctl>
1906 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001907#define WE_GET_CFG 3
1908#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301909/*
1910 * <ioctl>
1911 * getChannelList - Get the available channel list while in QCMobileAP
1912 *
1913 * @INPUT: None
1914 *
1915 * @OUTPUT: Channel list
1916 * wlan0 getChannelList:36 US 1..165
1917 *
1918 * This IOCTL gets the available channel list while in QCMobileAP
1919 *
1920 * @E.g: iwpriv wlan0 getChannelList
1921 *
1922 * Supported Feature: STA
1923 *
1924 * Usage: Internal/External
1925 *
1926 * </ioctl>
1927 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001928#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301929/*
1930 * <ioctl>
1931 * getRSSI - Get the Received Signal Strength Indicator
1932 *
1933 * @INPUT: None
1934 *
1935 * @OUTPUT: RSSI
1936 * wlan0 getRSSI:rsssi=-32
1937 *
1938 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1939 *
1940 * @E.g: iwpriv wlan0 getRSSI
1941 *
1942 * Supported Feature: STA
1943 *
1944 * Usage: Internal/External
1945 *
1946 * </ioctl>
1947 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001948#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001949
1950/*
1951 * <ioctl>
1952 * getSuspendStats - Get suspend/resume stats
1953 *
1954 * @INPUT: None
1955 *
1956 * @OUTPUT: character string containing formatted suspend/resume stats
1957 *
1958 * This ioctl is used to get suspend/resume stats formatted for display.
1959 * Currently it includes suspend/resume counts, wow wake up reasons, and
1960 * suspend fail reasons.
1961 *
1962 * @E.g: iwpriv wlan0 getSuspendStats
1963 * iwpriv wlan0 getSuspendStats
1964 *
1965 * Supported Feature: suspend/resume
1966 *
1967 * Usage: Internal
1968 *
1969 * </ioctl>
1970 */
1971#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001972#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05301973/*
1974 * <ioctl>
1975 * getTdlsPeers - Get all TDLS peers.
1976 *
1977 * @INPUT: None
1978 *
1979 * @OUTPUT: Returns the MAC address of all the TDLS peers
1980 * wlan0 getTdlsPeers:
1981 * MAC Id cap up RSSI
1982 * ---------------------------------
1983 * 00:0a:f5:0e:bd:18 2 Y Y -44
1984 * 00:0a:f5:bf:0e:12 0 N N 0
1985 *
1986 * This IOCTL is used to get all TDLS peers.
1987 *
1988 * @E.g: iwpriv wlan0 getTdlsPeers
1989 *
1990 * Supported Feature: TDLS
1991 *
1992 * Usage: Internal/External
1993 *
1994 * </ioctl>
1995 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001996#define WE_GET_TDLS_PEERS 8
1997#endif
1998#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05301999/*
2000 * <ioctl>
2001 * getPMFInfo - get the PMF info of the connected session
2002 *
2003 * @INPUT: None
2004 *
2005 * @OUTPUT:
2006 * wlan0 getPMFInfo:
2007 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
2008 * Number of Unprotected Disassocs 0
2009 * Number of Unprotected Deauths 0
2010 *
2011 * This IOCTL is used to get the PMF stats/status of the current
2012 * connection.
2013 *
2014 * @e.g:iwpriv wlan0 getPMFInfo
2015 *
2016 * Supported Feature: PMF
2017 *
2018 * Usage: Internal/External
2019 *
2020 * </ioctl>
2021 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002022#define WE_GET_11W_INFO 9
2023#endif
2024#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05302025/*
2026 * <ioctl>
2027 * getIbssSTAs - get ibss sta info
2028 *
2029 * @INPUT: None
2030 *
2031 * @OUTPUT: Give the MAC of the IBSS STA
2032 * wlan0 getIbssSTAs:
2033 * 1 .8c:fd:f0:01:9c:bf
2034 *
2035 * This IOCTL is used to get ibss sta info
2036 *
2037 * @E.g: iwpriv wlan0 getIbssSTAs
2038 *
2039 * Supported Feature: IBSS
2040 *
2041 * Usage: Internal/External
2042 *
2043 * </ioctl>
2044 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002045#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302046/*
2047 * <ioctl>
2048 * getphymode - Get the current phymode.
2049 *
2050 * @INPUT: None
2051 *
2052 * @OUTPUT: In phymode
2053 * wlan0 getphymode:AUTO MODE
2054 *
2055 * This IOCTL used to gets the current phymode.
2056 *
2057 * @E.g: iwpriv wlan0 getphymode
2058 *
2059 * Supported Feature: STA
2060 *
2061 * Usage: Internal/External
2062 *
2063 * </ioctl>
2064 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002065#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002066
2067/*
2068 * <ioctl>
2069 * getOemDataCap - Get the oem data caps.
2070 *
2071 * @INPUT: None
2072 *
2073 * @OUTPUT: oem data capability
2074 *
2075 * This IOCTL used to gets the current oem data cap.
2076 *
2077 * @E.g: iwpriv wlan0 getOemDataCap
2078 *
2079 * Usage: Internal/External
2080 *
2081 * </ioctl>
2082 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002083#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002084
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302085/*
2086 * <ioctl>
2087 * getSNR - Enable SNR Monitoring
2088 *
2089 * @INPUT: None
2090 *
2091 * @OUTPUT: Signal strength/ratio
2092 * wlan0 getSNR:1
2093 *
2094 * This IOCTL is used to get ibss sta info
2095 *
2096 * @E.g: iwpriv wlan0 getSNR
2097 *
2098 * Supported Feature: STA
2099 *
2100 * Usage: Internal/External
2101 *
2102 * </ioctl>
2103 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002104
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002105#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302106#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002107
Krunal Soni6c3859f2018-06-01 19:57:40 -07002108/*
2109 * <ioctl>
2110 *
2111 * get_ba_timeout - to get timeout for each AC
2112 *
2113 * @INPUT: None
2114 *
2115 * @OUTPUT: displays timeout value for each access class
2116 *
2117 * @E.g.: iwpriv wlan0 get_ba_timeout
2118 *
2119 * Usage: Internal
2120 *
2121 * </ioctl>
2122 */
2123#define WE_GET_BA_AGEING_TIMEOUT 16
2124
Krunal Soni5e483782018-10-25 15:42:44 -07002125/*
2126 * <ioctl>
2127 *
2128 * sta_cxn_info - STA connection information
2129 *
2130 * @INPUT: none
2131 *
2132 * @OUTPUT: STA's connection information
2133 *
2134 * This IOCTL is used to get connection's information.
2135 *
2136 * @E.g: iwpriv wlan0 get_cxn_info
2137 *
2138 * Usage: Internal
2139 *
2140 * </ioctl>
2141 */
2142#define WE_GET_STA_CXN_INFO 17
2143
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002144/* Private ioctls and their sub-ioctls */
2145#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302146
2147/*
2148 * <ioctl>
2149 * reassoc - Trigger STA re-association to the connected AP
2150 *
2151 * @INPUT: None
2152 *
2153 * @OUTPUT: None
2154 *
2155 * This IOCTL is used to trigger STA reassociation to the connected AP.
2156 *
2157 * @E.g: iwpriv wlan0 reassoc
2158 *
2159 * Supported Feature: Roaming
2160 *
2161 * Usage: Internal
2162 *
2163 * </ioctl>
2164 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002165#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302166/*
2167 * <ioctl>
2168 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2169 *
2170 * @INPUT: None
2171 *
2172 * @OUTPUT: print ibss peer in info logs
Jeff Johnson52f19d52019-02-26 08:35:38 -08002173 * peer_info->numIBSSPeers = 1
Abhishek Singh49b654e2016-12-01 16:11:17 +05302174 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2175 *
2176 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2177 * in info logs
2178 *
2179 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2180 *
2181 * Supported Feature: IBSS
2182 *
2183 * Usage: Internal/External
2184 *
2185 * </ioctl>
2186 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002187#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002188/* Sub ioctls 11 to 16 are not used */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002189#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302190/*
2191 * <ioctl>
2192 * stop_obss_scan - Stop obss scan
2193 *
2194 * @INPUT: None
2195 *
2196 * @OUTPUT: None
2197 *
2198 * This IOCTL is used to stop obss scan
2199 *
2200 * @E.g: iwpriv wlan0 stop_obss_scan
2201 *
2202 * Supported Feature: Scan
2203 *
2204 * Usage: Internal/External
2205 *
2206 * </ioctl>
2207 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002208#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002209
2210/* Private ioctls and their sub-ioctls */
2211#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2212
2213#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302214/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002215
Manjeet Singhf82ed072016-07-08 11:40:00 +05302216#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002217
Kabilan Kannan6894e6a2017-11-09 14:37:55 -08002218/* subcommand 5 is unused */
Sourav Mohapatra3e1694a2019-09-21 17:48:47 +05302219/* subcommand 6 is unused */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302220
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002221#define WE_UNIT_TEST_CMD 7
2222
2223#define WE_MTRACE_DUMP_CMD 8
2224#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2225
2226
2227#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2228#define WE_LED_FLASHING_PARAM 10
2229#endif
2230
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302231/*
2232 * <ioctl>
2233 * pm_clist - Increments the index value of the concurrent connection list
2234 * and update with the input parameters provided.
2235 *
2236 * @INPUT: Following 8 arguments:
2237 * @vdev_id: vdev id
2238 * @tx_streams: TX streams
2239 * @rx_streams: RX streams
2240 * @chain_mask: Chain mask
2241 * @type: vdev_type
2242 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2243 * @sub_type: vdev_subtype
2244 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2245 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2246 * @channel: Channel
2247 * @mac: Mac id
2248 *
2249 * @OUTPUT: None
2250 *
2251 * This IOCTL is used to increments the index value of the concurrent connection
2252 * list and update with the input parameters provided.
2253 *
2254 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2255 * sub_type channel mac
2256 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2257 *
2258 * Supported Feature: DBS
2259 *
2260 * Usage: Internal/External
2261 *
2262 * </ioctl>
2263 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002264#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302265
2266/*
2267 * <ioctl>
2268 * pm_dlist - Delete the index from the concurrent connection list that is
2269 * present in the given vdev_id.
2270 *
2271 * @INPUT: delete_all, vdev_id
2272 * @delete_all: delete all indices
2273 * @vdev_id: vdev id
2274 *
2275 * @OUTPUT: None
2276 *
2277 * This IOCTL is used to delete the index from the concurrent connection list
2278 * that is present in the given vdev_id.
2279 *
2280 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2281 * iwpriv wlan0 pm_dlist 0 1
2282 *
2283 * Supported Feature: DBS
2284 *
2285 * Usage: Internal/External
2286 *
2287 * </ioctl>
2288 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002289#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302290
2291/*
2292 * <ioctl>
2293 * pm_dbs - Set dbs capability and system preference
2294 *
2295 * @INPUT: dbs, system_pref
2296 * @dbs: Value of DBS capability to be set
2297 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002298 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302299 *
2300 * @OUTPUT: None
2301 *
2302 * This IOCTL is used to set dbs capability and system preference.
2303 *
2304 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2305 * iwpriv wlan0 pm_dbs 1 0
2306 *
2307 * Supported Feature: DBS
2308 *
2309 * Usage: Internal/External
2310 *
2311 * </ioctl>
2312 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002313#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302314
2315/*
2316 * <ioctl>
2317 * pm_pcl - Set pcl for concurrency mode.
2318 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002319 * @INPUT: policy_mgr_con_mode
2320 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302321 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2322 *
2323 * @OUTPUT: None
2324 *
2325 * This IOCTL is used to set pcl for concurrency mode.
2326 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002327 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302328 * iwpriv wlan0 pm_pcl 0
2329 *
2330 * Supported Feature: DBS
2331 *
2332 * Usage: Internal/External
2333 *
2334 * </ioctl>
2335 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002336#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302337
2338/*
2339 * <ioctl>
2340 * pm_cinfo - Shows the concurrent connection list.
2341 *
2342 * @INPUT: None
2343 *
2344 * @OUTPUT: None
2345 *
2346 * This IOCTL is used to show the concurrent connection list.
2347 *
2348 * @E.g: iwpriv wlan0 pm_cinfo
2349 *
2350 * Supported Feature: DBS
2351 *
2352 * Usage: Internal/External
2353 *
2354 * </ioctl>
2355 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002356#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302357
2358/*
2359 * <ioctl>
2360 * pm_ulist - Updates the index value of the concurrent connection list
2361 * with the input parameters provided.
2362 *
2363 * @INPUT: Following 8 arguments:
2364 * @vdev_id: vdev id
2365 * @tx_streams: TX streams
2366 * @rx_streams: RX streams
2367 * @chain_mask: Chain mask
2368 * @type: vdev_type
2369 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2370 * @sub_type: vdev_subtype
2371 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2372 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2373 * @channel: Channel
2374 * @mac: Mac id
2375 *
2376 * @OUTPUT: None
2377 *
2378 * This IOCTL is used to updates the index value of the concurrent
2379 * connection list with the input parameters provided.
2380 *
2381 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2382 * sub_type channel mac
2383 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2384 *
2385 * Supported Feature: DBS
2386 *
2387 * Usage: Internal/External
2388 *
2389 * </ioctl>
2390 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002391#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302392
2393/*
2394 * <ioctl>
2395 * pm_query_action - Initiate actions needed on current connections as
2396 * per the channel provided.
2397 *
2398 * @INPUT: channel
2399 * @channel: Channel on which new connection will be.
2400 *
2401 * @OUTPUT: None
2402 *
2403 * This IOCTL is used to initiate actions needed on current connections
2404 * as per the channel provided.
2405 *
2406 * @E.g: iwpriv wlan0 pm_query_action channel
2407 * iwpriv wlan0 pm_query_action 6
2408 *
2409 * Supported Feature: DBS
2410 *
2411 * Usage: Internal/External
2412 *
2413 * </ioctl>
2414 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002415#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302416
2417/*
2418 * <ioctl>
2419 * pm_query_allow - Checks for allowed concurrency combination
2420 *
2421 * @INPUT: mode, channel, bandwidth
2422 * @mode: new connection mode
2423 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2424 * @channel: channel on which new connection is coming up
2425 * @bandwidth: Bandwidth requested by the connection
2426 * 0:None 1:5MHz 2:10MHz 3:20MHz
2427 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2428 *
2429 * @OUTPUT: None
2430 *
2431 * This IOCTL is used to checks for allowed concurrency combination.
2432 *
2433 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2434 * iwpriv wlan0 pm_query_allow 0 6 4
2435 *
2436 * Supported Feature: DBS
2437 *
2438 * Usage: Internal/External
2439 *
2440 * </ioctl>
2441 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002442#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302443
2444/*
2445 * <ioctl>
2446 * pm_run_scenario - Create scenario with number of connections provided.
2447 *
2448 * @INPUT: num_of_conn
2449 * @num_of_conn: the number of connections (values: 1~3)
2450 *
2451 * @OUTPUT: None
2452 *
2453 * This IOCTL is used to create scenario with the number of connections
2454 * provided.
2455 *
2456 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2457 * iwpriv wlan0 pm_run_scenario 1
2458 *
2459 * Supported Feature: DBS
2460 *
2461 * Usage: Internal/External
2462 *
2463 * </ioctl>
2464 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002465#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302466
2467/*
2468 * <ioctl>
2469 * pm_set_hw_mode - Set hardware for single/dual mac.
2470 *
2471 * @INPUT: hw_mode
2472 * 0:single mac 1:dual mac
Liangwei Dong509c3472018-05-30 07:05:59 -04002473 * 2: 2x2 5g + 1x1 2g dbs mode
2474 * 3: 2x2 2g + 1x1 5g dbs mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302475 *
2476 * @OUTPUT: None
2477 *
2478 * This IOCTL is used to set hardware for single/dual mac.
2479 *
2480 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2481 * iwpriv wlan0 pm_set_hw_mode 1
2482 *
2483 * Supported Feature: DBS
2484 *
2485 * Usage: Internal/External
2486 *
2487 * </ioctl>
2488 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002489#define WE_POLICY_SET_HW_MODE_CMD 20
2490
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302491/*
2492 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002493 * ch_avoid - unit test SAP channel avoidance
2494 *
2495 * @INPUT: chan avoid ranges
2496 *
2497 * @OUTPUT: none
2498 *
2499 * This IOCTL is used to fake a channel avoidance event.
2500 * To test SAP/GO chan switch during chan avoid event process.
2501 *
2502 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2503 *
2504 * Supported Feature: SAP chan avoidance.
2505 *
2506 * Usage: Internal
2507 *
2508 * </ioctl>
2509 */
2510#define WE_SET_CHAN_AVOID 21
2511
2512/*
2513 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302514 * set_scan_cfg - Set dual MAC scan config parameters.
2515 *
2516 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2517 * @dbs: Value of DBS bit
2518 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2519 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2520 *
2521 * @OUTPUT: None
2522 *
2523 * This IOCTL is used to set the dual MAC scan config.
2524 *
2525 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2526 * single_mac_scan_with_dbs
2527 * iwpriv wlan0 set_scan_cfg 1 0 1
2528 *
2529 * Supported Feature: DBS
2530 *
2531 * Usage: Internal/External
2532 *
2533 * </ioctl>
2534 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002535#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302536
2537/*
2538 * <ioctl>
2539 * set_fw_mode_cfg - Sets the dual mac FW mode config
2540 *
2541 * @INPUT: dbs, dfs
2542 * @dbs: DBS bit
2543 * @dfs: Agile DFS bit
2544 *
2545 * @OUTPUT: None
2546 *
2547 * This IOCTL is used to set the dual mac FW mode config.
2548 *
2549 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2550 * iwpriv wlan0 set_fw_mode_cfg 1 1
2551 *
2552 * Supported Feature: DBS
2553 *
2554 * Usage: Internal/External
2555 *
2556 * </ioctl>
2557 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002558#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002559#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002560/*
2561 * <ioctl>
2562 * txrx_stats - TXRX statistics query
2563 *
2564 * @INPUT: query category, mac id (default mac id is 0)
2565 *
2566 * @OUTPUT: TXRX statistics result
2567 *
2568 * This IOCTL is used to get TXRX statistics counters.
2569 *
2570 * @E.g: iwpriv wlan0 txrx_stats 21 0
2571 * iwpriv wlan0 txrx_stats 21 1
2572 *
2573 * Usage: Internal
2574 *
2575 * </ioctl>
2576 */
2577#define WE_SET_TXRX_STATS 24
2578
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002579
2580#ifdef FEATURE_WLAN_TDLS
2581#undef MAX_VAR_ARGS
2582#define MAX_VAR_ARGS 11
2583#else
2584#undef MAX_VAR_ARGS
2585#define MAX_VAR_ARGS 9
2586#endif
2587
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302588#ifdef WLAN_FEATURE_MOTION_DETECTION
2589#undef MAX_VAR_ARGS
2590#define MAX_VAR_ARGS 15
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302591#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302592#define WE_MOTION_DET_CONFIG_PARAM 25
2593#define WE_MOTION_DET_BASE_LINE_CONFIG_PARAM 26
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302594
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302595#define WE_SET_THERMAL_THROTTLE_CFG 27
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002596/*
2597 * <ioctl>
2598 * fips_test - Perform a FIPS test
2599 *
2600 * @INPUT: Binary representation of the following packed structure
2601 *
2602 * @OUTPUT: Binary representation of the following packed structure
2603 *
2604 * This IOCTL is used to perform FIPS certification testing
2605 *
2606 * @E.g: iwpriv wlan0 fips_test <test vector>
2607 *
2608 * iwpriv wlan0 fips_test <tbd>
2609 *
2610 * Supported Feature: FIPS
2611 *
2612 * Usage: Internal
2613 *
2614 * </ioctl>
2615 */
2616#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2617
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002618/* Private ioctls (with no sub-ioctls) */
2619/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302620/*
2621 * <ioctl>
2622 * addTspec - Add TSPEC for each AC
2623 *
2624 * @INPUT: 19 TSPEC params
2625 * @[arg0]: handle
2626 * @[arg1]: tid
2627 * @[arg2]: dir
2628 * @[arg3]: psb
2629 * @[arg4]: up
2630 * @[arg5]: nomMsduSize
2631 * @[arg6]: maxMsduSize
2632 * @[arg7]: minDataRate
2633 * @[arg8]: meanDataRate
2634 * @[arg9]: peakDataRate
2635 * @[arg10]: maxBurstSize
2636 * @[arg11]: minPhyRate
2637 * @[arg12]: sba
2638 * @[arg13]: minServiceIntv
2639 * @[arg14]: suspendIntv
2640 * @[arg15]: burstSizeDefn
2641 * @[arg16]: ackPolicy
2642 * @[arg17]: inactivityPeriod
2643 * @[arg18]: maxServiceIntv
2644 *
2645 * @OUTPUT: Success/Failure
2646 *
2647 * This IOCTL is used to add TSPEC for each AC.
2648 *
2649 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2650 * <maxMsduSize> <minDataRate> <meanDataRate>
2651 * <peakDataRate> <maxBurstSize> <minPhyRate>
2652 * <sba> <minServiceIntv> <suspendIntv>
2653 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2654 * <maxServiceIntv>
2655 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2656 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2657 * wlan0 addTspec:3
2658 *
2659 * Supported Feature: WMM
2660 *
2661 * Usage: Internal/External
2662 *
2663 * </ioctl>
2664 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002665#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302666/*
2667 * <ioctl>
2668 * delTspec - Delete TSPEC entry for each AC
2669 *
2670 * @INPUT: 1 TSPEC param
2671 * @[arg0]: handle
2672 *
2673 * @OUTPUT: Success/Failure
2674 *
2675 * This IOCTL is used to delete TSPEC entry for each AC.
2676 *
2677 * @E.g: iwpriv wlan0 delTspec <handle>
2678 * iwpriv wlan0 delTspec 7001
2679 * wlan0 delTspec:16
2680 *
2681 * Supported Feature: WMM
2682 *
2683 * Usage: Internal/External
2684 *
2685 * </ioctl>
2686 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002687#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302688/*
2689 * <ioctl>
2690 * getTspec - Get TSPEC entry for each AC
2691 *
2692 * @INPUT: 1 TSPEC param
2693 * @[arg0]: handle
2694 *
2695 * @OUTPUT: Success/Failure
2696 *
2697 * This IOCTL is used to get TSPEC entry for each AC.
2698 *
2699 * @E.g: iwpriv wlan0 getTspec <handle>
2700 * iwpriv wlan0 getTspec 7001
2701 * wlan0 delTspec:18
2702 *
2703 * Supported Feature: WMM
2704 *
2705 * Usage: Internal/External
2706 *
2707 * </ioctl>
2708 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002709#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2710
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002711/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2712/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2713/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002714#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2715#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002716/* (SIOCIWFIRSTPRIV + 16) is currently unused */
Krunal Sonif9ba53d2019-01-03 21:44:41 -08002717
2718#ifdef FEATURE_WLM_STATS
2719/*
2720 * <ioctl>
2721 *
2722 * get_wlm_stats - Get stats from FW for game latency
2723 *
2724 * @INPUT: BITMASK inform of decimal number
2725 *
2726 * @OUTPUT: HEX string given by FW
2727 *
2728 * This IOCTL is used to get game latency related STATS from FW
2729 *
2730 * @E.g.: iwpriv wlan0 get_wlm_stats 1
2731 *
2732 * Usage: internal
2733 *
2734 * </ioctl>
2735 */
2736#define WLAN_GET_WLM_STATS (SIOCIWFIRSTPRIV + 17)
2737#endif
2738
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002739/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2740
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002741#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002742
2743/* Private ioctl for setting the host offload feature */
2744#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2745
2746/* Private ioctl to get the statistics */
2747#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2748
2749/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302750/*
2751 * <ioctl>
2752 * setKeepAlive - Set the keep alive feature
2753 *
2754 * @INPUT: 28 bytes of information in the order of packet type, time period
2755 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2756 *
2757 * @OUTPUT: None
2758 *
2759 * This IOCTL sets the keep alive feature to send either NULL
2760 * or unsolicited ARP response packets
2761 *
2762 * @E.g: iwpriv wlan0 setKeepAlive
2763 *
2764 * Supported Feature: STA
2765 *
2766 * Usage: Internal/External
2767 *
2768 * </ioctl>
2769 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002770#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2771
2772#ifdef WLAN_FEATURE_PACKET_FILTERING
2773/* Private ioctl to set the packet filtering params */
2774#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2775#endif
2776
2777
2778#ifdef FEATURE_WLAN_SCAN_PNO
2779/* Private ioctl to get the statistics */
2780#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2781#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302782/*
2783 * <ioctl>
2784 * SETBAND - Set the operational band
2785 *
2786 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2787 *
2788 * @OUTPUT: None
2789 *
2790 * This IOCTL Set the operational band If the new band is different from the
2791 * current operational band, it aborts the pending scan requests, flushes
2792 * the existing scan results, and then change * the band capability
2793 *
2794 * @E.g: iwpriv wlan0 SETBAND <value>
2795 *
2796 * Supported Feature: STA
2797 *
2798 * Usage: Internal/External
2799 *
2800 * </ioctl>
2801 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002802#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2803
Dustin Brown0cbc7572016-12-16 13:54:40 -08002804#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002805/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002806
2807/* Private ioctls and their sub-ioctls */
2808#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2809#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002810#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002811#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302812/* Private sub ioctl for enabling and setting histogram interval of profiling */
2813#define WE_ENABLE_FW_PROFILE 4
2814#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002815
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002816/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002817#define WE_SET_WLAN_SUSPEND 6
2818#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002819
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002820/*
2821 * <ioctl>
2822 * log_buffer - prints host/target related communication logs via dmesg
2823 *
2824 * @INPUT: Log Id, Count
2825 *
2826 * Log Id:
2827 * 0) HTC_CREDIT_HISTORY_LOG
2828 * 1) COMMAND_LOG,
2829 * 2) COMMAND_TX_CMP_LOG,
2830 * 3) MGMT_COMMAND_LOG,
2831 * 4) MGMT_COMMAND_TX_CMP_LOG,
2832 * 5) EVENT_LOG,
2833 * 6) RX_EVENT_LOG,
2834 * 7) MGMT_EVENT_LOG
2835 *
2836 * @OUTPUT: None
2837 *
2838 * @E.g:
2839 * # print up to 10 of the most recent records from HTC Credit History
2840 * iwpriv wlan0 log_buffer 0 10
2841 * # print up to 3 of the most recent records from Event Log
2842 * iwpriv wlan0 log_buffer 5 3
2843 *
2844 * Supported Feature: WLAN Trace
2845 *
2846 * Usage: Internal/External
2847 *
2848 * </ioctl>
2849 */
2850#define WE_LOG_BUFFER 8
2851
Krunal Soni6c3859f2018-06-01 19:57:40 -07002852/*
2853 * <ioctl>
2854 * set_ba_timeout - sets Block ACK aging timeout value for each Access class
2855 *
2856 * @INPUT: Access Class [0:BK, 1:BE, 2:VI, 3:VO], Timeout value
2857 *
2858 * @OUTPUT: None
2859 *
2860 * @E.g.:
2861 * # to set duration of 2 seconds for BE
2862 * iwpriv wlan0 set_ba_timeout 1 2
2863 * # to set duration of 3 seconds for VO
2864 * iwpriv wlan0 set_ba_timeout 3 3
2865 *
2866 * Usage: Internal
2867 *
2868 * </ioctl>
2869 */
2870#define WE_SET_BA_AGEING_TIMEOUT 9
2871
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002872enum host_target_comm_log {
2873 HTC_CREDIT_HISTORY_LOG = 0,
2874 COMMAND_LOG,
2875 COMMAND_TX_CMP_LOG,
2876 MGMT_COMMAND_LOG,
2877 MGMT_COMMAND_TX_CMP_LOG,
2878 EVENT_LOG,
2879 RX_EVENT_LOG,
2880 MGMT_EVENT_LOG
2881};
2882
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002883/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2884
2885/* 802.11p IOCTL */
2886#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2887
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302888/*
2889 * <ioctl>
2890 * getLinkSpeed - Gets the current link speed in Mbps
2891 *
2892 * @INPUT: None
2893 *
2894 * @OUTPUT: linkspeed in mbps
2895 * wlan0 getLinkSpeed:7
2896 *
2897 * This IOCTL is used get the current link speed in Mbps
2898 *
2899 * @E.g: iwpriv wlan0 getLinkSpeed
2900 *
2901 * Supported Feature: STA
2902 *
2903 * Usage: Internal/External
2904 *
2905 * </ioctl>
2906 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002907#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2908
2909#define WLAN_STATS_INVALID 0
2910#define WLAN_STATS_RETRY_CNT 1
2911#define WLAN_STATS_MUL_RETRY_CNT 2
2912#define WLAN_STATS_TX_FRM_CNT 3
2913#define WLAN_STATS_RX_FRM_CNT 4
2914#define WLAN_STATS_FRM_DUP_CNT 5
2915#define WLAN_STATS_FAIL_CNT 6
2916#define WLAN_STATS_RTS_FAIL_CNT 7
2917#define WLAN_STATS_ACK_FAIL_CNT 8
2918#define WLAN_STATS_RTS_SUC_CNT 9
2919#define WLAN_STATS_RX_DISCARD_CNT 10
2920#define WLAN_STATS_RX_ERROR_CNT 11
2921#define WLAN_STATS_TX_BYTE_CNT 12
2922
2923#define WLAN_STATS_RX_BYTE_CNT 13
2924#define WLAN_STATS_RX_RATE 14
2925#define WLAN_STATS_TX_RATE 15
2926
2927#define WLAN_STATS_RX_UC_BYTE_CNT 16
2928#define WLAN_STATS_RX_MC_BYTE_CNT 17
2929#define WLAN_STATS_RX_BC_BYTE_CNT 18
2930#define WLAN_STATS_TX_UC_BYTE_CNT 19
2931#define WLAN_STATS_TX_MC_BYTE_CNT 20
2932#define WLAN_STATS_TX_BC_BYTE_CNT 21
2933
2934#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2935 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2936 *__p++ = __type; \
2937 *__p++ = __size; \
2938 memcpy(__p, __val, __size); \
2939 __p += __size; \
2940 __tlen += __size + 2; \
2941 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002942 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002943 } \
2944 } while (0)
2945
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002946#define TX_PER_TRACKING_DEFAULT_RATIO 5
2947#define TX_PER_TRACKING_MAX_RATIO 10
2948#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2949
2950#define WLAN_ADAPTER 0
2951#define P2P_ADAPTER 1
2952
2953/**
2954 * mem_alloc_copy_from_user_helper - copy from user helper
2955 * @wrqu_data: wireless extensions request data
2956 * @len: length of @wrqu_data
2957 *
2958 * Helper function to allocate buffer and copy user data.
2959 *
2960 * Return: On success return a pointer to a kernel buffer containing a
2961 * copy of the userspace data (with an additional NUL character
2962 * appended for safety). On failure return %NULL.
2963 */
2964void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2965{
2966 u8 *ptr = NULL;
2967
2968 /* in order to protect the code, an extra byte is post
2969 * appended to the buffer and the null termination is added.
2970 * However, when allocating (len+1) byte of memory, we need to
2971 * make sure that there is no uint overflow when doing
2972 * addition. In theory check len < UINT_MAX protects the uint
2973 * overflow. For wlan private ioctl, the buffer size is much
2974 * less than UINT_MAX, as a good guess, now, it is assumed
2975 * that the private command buffer size is no greater than 4K
2976 * (4096 bytes). So we use 4096 as the upper boundary for now.
2977 */
2978 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002979 hdd_err("Invalid length: %zu max: %u",
2980 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002981 return NULL;
2982 }
2983
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002984 ptr = qdf_mem_malloc(len + 1);
Jeff Johnsond36fa332019-03-18 13:42:25 -07002985 if (!ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002986 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002987 return NULL;
2988 }
2989
2990 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002991 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002992 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002993 return NULL;
2994 }
2995 ptr[len] = '\0';
2996 return ptr;
2997}
2998
2999/**
3000 * hdd_priv_get_data() - Get pointer to ioctl private data
3001 * @p_priv_data: pointer to iw_point struct to be filled
3002 * @wrqu: Pointer to IOCTL Data received from userspace
3003 *
3004 * Helper function to get compatible struct iw_point passed to ioctl
3005 *
3006 * Return - 0 if p_priv_data successfully filled, error otherwise
3007 */
3008int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
3009{
Jeff Johnsond36fa332019-03-18 13:42:25 -07003010 if ((!p_priv_data) || (!wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003011 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003012
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003013#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07003014 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003015 struct compat_iw_point *p_compat_priv_data;
3016
3017 /* Compat task:
3018 * typecast to compat structure and copy the members.
3019 */
3020 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
3021
3022 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
3023 p_priv_data->length = p_compat_priv_data->length;
3024 p_priv_data->flags = p_compat_priv_data->flags;
3025 } else {
3026#endif /* #ifdef CONFIG_COMPAT */
3027
3028 /* Non compat task: directly copy the structure. */
3029 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
3030
3031#ifdef CONFIG_COMPAT
3032 }
3033#endif /* #ifdef CONFIG_COMPAT */
3034
3035 return 0;
3036}
3037
Jeff Johnson441e1f72017-02-07 08:50:49 -08003038static int hdd_check_wext_control(enum hdd_wext_control wext_control,
3039 struct iw_request_info *info)
3040{
3041 switch (wext_control) {
3042 default:
3043 case hdd_wext_disabled:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003044 hdd_err_rl("Rejecting disabled ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003045 return -ENOTSUPP;
3046 case hdd_wext_deprecated:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003047 hdd_warn_rl("Using deprecated ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003048 return 0;
3049 case hdd_wext_enabled:
3050 return 0;
3051 }
3052}
3053
Jeff Johnson82797b62017-08-11 15:31:27 -07003054int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08003055 struct iw_request_info *info)
3056{
3057 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
3058 info);
3059}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003060
3061/**
3062 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003063 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003064 * @length: Size of the data copied
3065 * @buffer: Pointer to char buffer.
3066 * @buf_len: Length of the char buffer.
3067 *
3068 * This function called when the "iwpriv wlan0 get_stats" command is given.
3069 * It used to collect the txrx stats when the device is configured in SAP mode.
3070 *
3071 * Return - none
3072 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003073void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003074 char *buffer, uint16_t buf_len)
3075{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003076 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003077 uint32_t len = 0;
3078 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
3079 uint32_t total_rx_delv = 0, total_rx_refused = 0;
3080 int i = 0;
Mohit Khanna81418772018-10-30 14:14:46 -07003081 struct hdd_context *hdd_ctx = adapter->hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003082
3083 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003084 total_rx_pkt += stats->rx_packets[i];
3085 total_rx_dropped += stats->rx_dropped[i];
3086 total_rx_delv += stats->rx_delivered[i];
3087 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003088 }
3089
3090 len = scnprintf(buffer, buf_len,
Mohit Khanna81418772018-10-30 14:14:46 -07003091 "\nTransmit[%lu] - "
3092 "called %u, dropped %u orphan %u,"
3093 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
3094 "\n[classified] BK %u, BE %u, VI %u, VO %u"
3095 "\n\nReceive[%lu] - "
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003096 "packets %u, dropped %u, unsolict_arp_n_mcast_drp %u, delivered %u, refused %u\n"
Jinwei Chen0dc383e2019-08-23 00:43:04 +08003097 "GRO - agg %u non-agg %u flush_skip %u low_tput_flush %u disabled(conc %u low-tput %u)\n",
Mohit Khanna81418772018-10-30 14:14:46 -07003098 qdf_system_ticks(),
3099 stats->tx_called,
3100 stats->tx_dropped,
3101 stats->tx_orphaned,
3102 stats->tx_dropped_ac[SME_AC_BK],
3103 stats->tx_dropped_ac[SME_AC_BE],
3104 stats->tx_dropped_ac[SME_AC_VI],
3105 stats->tx_dropped_ac[SME_AC_VO],
3106 stats->tx_classified_ac[SME_AC_BK],
3107 stats->tx_classified_ac[SME_AC_BE],
3108 stats->tx_classified_ac[SME_AC_VI],
3109 stats->tx_classified_ac[SME_AC_VO],
3110 qdf_system_ticks(),
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003111 total_rx_pkt, total_rx_dropped,
3112 qdf_atomic_read(&stats->rx_usolict_arp_n_mcast_drp),
3113 total_rx_delv,
Mohit Khanna81418772018-10-30 14:14:46 -07003114 total_rx_refused,
3115 stats->rx_aggregated, stats->rx_non_aggregated,
Jinwei Chenb681a482019-08-14 15:24:06 +08003116 stats->rx_gro_flush_skip,
Jinwei Chen0dc383e2019-08-23 00:43:04 +08003117 stats->rx_gro_low_tput_flush,
Mohit Khanna81418772018-10-30 14:14:46 -07003118 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_concurrency),
3119 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_low_tput));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003120
3121 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003122 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003123 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003124 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna81418772018-10-30 14:14:46 -07003125 "Rx CPU[%d]:"
3126 "packets %u, dropped %u, delivered %u, refused %u\n",
3127 i, stats->rx_packets[i], stats->rx_dropped[i],
3128 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003129 }
3130
3131 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003132 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003133 "\nCurrent status: %s"
3134 "\ntx-flow timer start count %u"
3135 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003136 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3137 stats->txflow_timer_cnt,
3138 stats->txflow_pause_cnt,
3139 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003140
Leo Changfdb45c32016-10-28 11:09:23 -07003141 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003142 adapter->vdev_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003143 *length = len + 1;
3144}
3145
3146/**
Dustin Brownd9322482017-01-09 12:46:03 -08003147 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3148 * @hdd_ctx: The Hdd context owning the stats to be written
3149 * @buffer: The char buffer to write to
3150 * @max_len: The maximum number of chars to write
3151 *
3152 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3153 *
3154 * Return - length of written content, negative number on error
3155 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003156static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
3157 char *buffer, uint16_t max_len)
3158{
3159 int ret;
3160 QDF_STATUS status;
3161 struct suspend_resume_stats *sr_stats;
3162
3163 sr_stats = &hdd_ctx->suspend_resume_stats;
3164 ret = scnprintf(buffer, max_len,
3165 "\n"
3166 "Suspends: %u\n"
3167 "Resumes: %u\n"
3168 "\n"
3169 "Suspend Fail Reasons\n"
3170 "\tIPA: %u\n"
3171 "\tRadar: %u\n"
3172 "\tRoam: %u\n"
3173 "\tScan: %u\n"
3174 "\tInitial Wakeup: %u\n"
3175 "\n",
3176 sr_stats->suspends, sr_stats->resumes,
3177 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3178 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3179 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3180 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3181 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]);
3182
Dustin Brown05d81302018-09-11 16:49:22 -07003183 status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->psoc,
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003184 &buffer[ret], max_len - ret,
3185 &ret);
3186 if (QDF_IS_STATUS_ERROR(status)) {
3187 hdd_err("Failed to get WoW stats");
3188 return qdf_status_to_os_return(status);
3189 }
3190
3191 return ret;
3192}
Dustin Brownd9322482017-01-09 12:46:03 -08003193
Dustin Brownd9322482017-01-09 12:46:03 -08003194/**
Govind Singha471e5e2015-10-12 17:11:14 +05303195 * hdd_wlan_list_fw_profile() - Get fw profiling points
3196 * @length: Size of the data copied
3197 * @buffer: Pointer to char buffer.
3198 * @buf_len: Length of the char buffer.
3199 *
3200 * This function called when the "iwpriv wlan0 listProfile" command is given.
3201 * It is used to get the supported profiling points in FW.
3202 *
3203 * Return - none
3204 */
3205void hdd_wlan_list_fw_profile(uint16_t *length,
3206 char *buffer, uint16_t buf_len)
3207{
3208 uint32_t len = 0;
3209
3210 len = scnprintf(buffer, buf_len,
3211 "PROF_CPU_IDLE: %u\n"
3212 "PROF_PPDU_PROC: %u\n"
3213 "PROF_PPDU_POST: %u\n"
3214 "PROF_HTT_TX_INPUT: %u\n"
3215 "PROF_MSDU_ENQ: %u\n"
3216 "PROF_PPDU_POST_HAL: %u\n"
3217 "PROF_COMPUTE_TX_TIME: %u\n",
3218 PROF_CPU_IDLE,
3219 PROF_PPDU_PROC,
3220 PROF_PPDU_POST,
3221 PROF_HTT_TX_INPUT,
3222 PROF_MSDU_ENQ,
3223 PROF_PPDU_POST_HAL,
3224 PROF_COMPUTE_TX_TIME);
3225
3226 *length = len + 1;
3227}
Mohit Khannac9649652018-11-28 18:10:28 -08003228
3229#define HDD_DUMP_STAT_HELP(STAT_ID) \
3230 hdd_nofl_info("%u -- %s", STAT_ID, (# STAT_ID))
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003231/**
3232 * hdd_display_stats_help() - print statistics help
3233 *
3234 * Return: none
3235 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003236static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003237{
Nirav Shahe6194ac2018-07-13 11:04:41 +05303238 hdd_nofl_info("iwpriv wlan0 dumpStats [option] - dump statistics");
3239 hdd_nofl_info("iwpriv wlan0 clearStats [option] - clear statistics");
3240 hdd_nofl_info("options:");
Mohit Khannac9649652018-11-28 18:10:28 -08003241 HDD_DUMP_STAT_HELP(CDP_TXRX_PATH_STATS);
3242 HDD_DUMP_STAT_HELP(CDP_TXRX_HIST_STATS);
3243 HDD_DUMP_STAT_HELP(CDP_TXRX_TSO_STATS);
3244 HDD_DUMP_STAT_HELP(CDP_HDD_NETIF_OPER_HISTORY);
3245 HDD_DUMP_STAT_HELP(CDP_DUMP_TX_FLOW_POOL_INFO);
3246 HDD_DUMP_STAT_HELP(CDP_TXRX_DESC_STATS);
3247 HDD_DUMP_STAT_HELP(CDP_HIF_STATS);
3248 HDD_DUMP_STAT_HELP(CDP_NAPI_STATS);
3249 HDD_DUMP_STAT_HELP(CDP_DP_NAPI_STATS);
3250 HDD_DUMP_STAT_HELP(CDP_DP_RX_THREAD_STATS);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003251}
Govind Singha471e5e2015-10-12 17:11:14 +05303252
3253/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003254 * hdd_wlan_dump_stats() - display dump Stats
3255 * @adapter: adapter handle
3256 * @value: value from user
3257 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003258 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003259 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003260int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003261{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003262 int ret = 0;
3263 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003264 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003265
Jeff Johnson0e07ca12018-11-12 21:04:45 -08003266 hdd_debug("%d", value);
3267
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003268 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003269 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003270 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3271 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003272 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003273 wlan_hdd_display_netif_queue_history
3274 (hdd_ctx,
3275 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003276 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003277 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303278 hdd_display_hif_stats();
3279 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003280 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003281 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303282 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003283 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003284 if (hdd_display_napi_stats()) {
3285 hdd_err("error displaying napi stats");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303286 ret = -EFAULT;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003287 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003288 break;
Mohit Khannac9649652018-11-28 18:10:28 -08003289 case CDP_DP_RX_THREAD_STATS:
3290 dp_txrx_ext_dump_stats(cds_get_context(QDF_MODULE_ID_SOC),
3291 CDP_DP_RX_THREAD_STATS);
3292 break;
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303293 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003294 sme_display_disconnect_stats(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003295 adapter->vdev_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303296 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003297 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003298 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003299 value,
3300 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003301 if (status == QDF_STATUS_E_INVAL) {
3302 hdd_display_stats_help();
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303303 ret = -EINVAL;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003304 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003305 break;
3306 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003307 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003308}
3309
Abhishek Ambure68677462019-09-13 12:44:26 +05303310#ifdef QCA_IBSS_SUPPORT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003311/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003312 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003313 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003314 *
3315 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3316 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3317 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003318static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003319{
3320 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003321 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnson93107ad2019-02-26 08:14:46 -08003322 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson52f19d52019-02-26 08:35:38 -08003323 tSirPeerInfoRspParams *peer_info = &sta_ctx->ibss_peer_info;
Yeshwanth Sriram Guntuka3f262102019-07-16 15:41:08 +05303324 struct qdf_mac_addr bcast = QDF_MAC_ADDR_BCAST_INIT;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003325 int i;
3326
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003327 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003328 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003329 hdd_get_ibss_peer_info_cb,
Yeshwanth Sriram Guntuka3f262102019-07-16 15:41:08 +05303330 true, bcast.bytes);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003331
3332 if (QDF_STATUS_SUCCESS == status) {
3333 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003334
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003335 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003336 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003337 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3338 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003339 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003340 return QDF_STATUS_E_FAILURE;
3341 }
3342
3343 /** Print the peer info */
Jeff Johnson52f19d52019-02-26 08:35:38 -08003344 hdd_debug("peer_info->numIBSSPeers = %d ",
3345 (int)peer_info->numPeers);
3346 for (i = 0; i < peer_info->numPeers; i++) {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003347 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3348 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003349
Jeff Johnson52f19d52019-02-26 08:35:38 -08003350 tx_rate = peer_info->peerInfoParams[i].txRate;
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003351 qdf_mem_copy(mac_addr,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003352 peer_info->peerInfoParams[i].mac_addr,
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003353 sizeof(mac_addr));
3354
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003355 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003356 mac_addr, (int)tx_rate,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003357 (int)peer_info->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003358 }
3359 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003360 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003361 }
3362
3363 return status;
3364}
Abhishek Ambure68677462019-09-13 12:44:26 +05303365#else
3366/**
3367 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
3368 * @adapter: Adapter upon which the IBSS client is active
3369 * @sta_id: Station index of the IBSS peer
3370 *
3371 * This function is dummy
3372 *
3373 * Return: QDF_STATUS_STATUS
3374 */
3375static inline QDF_STATUS
3376hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
3377 uint8_t sta_id)
3378{
3379 return QDF_STATUS_SUCCESS;
3380}
3381
3382/**
3383 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
3384 * @adapter: Adapter upon which the IBSS clients are active
3385 *
3386 * This function is dummy
3387 *
3388 * Return: QDF_STATUS_STATUS
3389 */
3390static inline QDF_STATUS
3391hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
3392{
3393 return QDF_STATUS_SUCCESS;
3394}
3395#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003396
3397/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303398 * hdd_get_ldpc() - Get adapter LDPC
3399 * @adapter: adapter being queried
3400 * @value: where to store the value
3401 *
3402 * Return: 0 on success, negative errno on failure
3403 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003404int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303405{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003406 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303407 int ret;
3408
Dustin Brown491d54b2018-03-14 12:39:11 -07003409 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003410 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303411 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3412 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003413 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303414 } else {
3415 *value = ret;
3416 ret = 0;
3417 }
3418 return ret;
3419}
3420
Jeff Johnson3d278b02017-08-29 14:17:47 -07003421int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303422{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003423 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303424 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003425 QDF_STATUS status;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003426 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303427 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303428
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003429 hdd_debug("%d", value);
Jeff Johnson1ca04762018-10-25 10:24:39 -07003430
3431 if (!mac_handle) {
3432 hdd_err("NULL Mac handle");
3433 return -EINVAL;
3434 }
3435
Dustin Brown05d81302018-09-11 16:49:22 -07003436 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003437 if (QDF_STATUS_SUCCESS != status) {
3438 hdd_err("Failed to get HT capability info");
3439 return -EIO;
3440 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003441
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303442 ht_cap_info.adv_coding_cap = value;
Dustin Brown05d81302018-09-11 16:49:22 -07003443 status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003444 if (QDF_STATUS_SUCCESS != status) {
3445 hdd_err("Failed to set HT capability info");
3446 return -EIO;
3447 }
Vignesh Viswanathanecd4de72018-11-22 13:02:20 +05303448 status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303449 if (QDF_IS_STATUS_ERROR(status)) {
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003450 hdd_err("Failed to set VHT LDPC capability info");
3451 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303452 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003453 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303454 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
3455 value);
3456 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003457 hdd_err("Failed to set LDPC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003458 ret = sme_update_he_ldpc_supp(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003459 if (ret)
3460 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303461
3462 return ret;
3463}
3464
3465/**
3466 * hdd_get_tx_stbc() - Get adapter TX STBC
3467 * @adapter: adapter being queried
3468 * @value: where to store the value
3469 *
3470 * Return: 0 on success, negative errno on failure
3471 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003472int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303473{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003474 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303475 int ret;
3476
Dustin Brown491d54b2018-03-14 12:39:11 -07003477 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003478 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303479 WNI_CFG_HT_CAP_INFO_TX_STBC);
3480 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003481 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303482 } else {
3483 *value = ret;
3484 ret = 0;
3485 }
3486
3487 return ret;
3488}
3489
Jeff Johnson3d278b02017-08-29 14:17:47 -07003490int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303491{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003492 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303493 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303494 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303495 QDF_STATUS status;
3496 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303497
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003498 hdd_debug("%d", value);
Jeff Johnson57ff4fa2018-10-25 10:29:47 -07003499
3500 if (!mac_handle) {
3501 hdd_err("NULL Mac handle");
3502 return -EINVAL;
3503 }
3504
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303505 if (value) {
3506 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003507 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303508 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303509 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003510 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303511 return -EIO;
3512 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303513 if (!ht_cap_info.tx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003514 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303515 return -EINVAL;
3516 }
3517 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003518 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303519 WNI_CFG_HT_CAP_INFO_TX_STBC,
3520 value);
3521 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003522 hdd_err("Failed to set TX STBC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003523 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003524 if (ret)
3525 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303526
3527 return ret;
3528}
3529
3530/**
3531 * hdd_get_rx_stbc() - Get adapter RX STBC
3532 * @adapter: adapter being queried
3533 * @value: where to store the value
3534 *
3535 * Return: 0 on success, negative errno on failure
3536 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003537int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303538{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003539 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303540 int ret;
3541
Dustin Brown491d54b2018-03-14 12:39:11 -07003542 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003543 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303544 WNI_CFG_HT_CAP_INFO_RX_STBC);
3545 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003546 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303547 } else {
3548 *value = ret;
3549 ret = 0;
3550 }
3551
3552 return ret;
3553}
3554
Jeff Johnson3d278b02017-08-29 14:17:47 -07003555int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303556{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003557 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303558 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303559 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303560 QDF_STATUS status;
3561 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303562
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003563 hdd_debug("%d", value);
Jeff Johnsonb6645852018-10-25 10:35:41 -07003564
3565 if (!mac_handle) {
3566 hdd_err("NULL Mac handle");
3567 return -EINVAL;
3568 }
3569
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303570 if (value) {
3571 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003572 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303573 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303574 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003575 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303576 return -EIO;
3577 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303578 if (!ht_cap_info.rx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003579 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303580 return -EINVAL;
3581 }
3582 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003583 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303584 WNI_CFG_HT_CAP_INFO_RX_STBC,
3585 value);
3586 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003587 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303588
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003589 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003590 if (ret)
3591 hdd_err("Failed to set HE RX STBC value");
3592
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303593 return ret;
3594}
3595
3596/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003597 * iw_get_linkspeed() - Get current link speed ioctl
3598 * @dev: device upon which the ioctl was received
3599 * @info: ioctl request information
3600 * @wrqu: ioctl request data
3601 * @extra: extra ioctl buffer
3602 *
3603 * Return: 0 on success, non-zero on error
3604 */
3605static int __iw_get_linkspeed(struct net_device *dev,
3606 struct iw_request_info *info,
3607 union iwreq_data *wrqu, char *extra)
3608{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003609 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson21451ae2019-03-10 21:54:04 -07003610 char *out_link_speed = (char *)extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003611 int len = sizeof(uint32_t) + 1;
3612 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003613 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003614 int ret;
3615 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003616
Dustin Brownfdf17c12018-03-14 12:55:34 -07003617 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303618
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003619 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003620 ret = wlan_hdd_validate_context(hdd_ctx);
3621 if (0 != ret)
3622 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003623
Jeff Johnson441e1f72017-02-07 08:50:49 -08003624 ret = hdd_check_private_wext_control(hdd_ctx, info);
3625 if (0 != ret)
3626 return ret;
3627
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003628 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003629 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003630 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003631
3632 wrqu->data.length = len;
3633 /* return the linkspeed as a string */
Jeff Johnson21451ae2019-03-10 21:54:04 -07003634 rc = snprintf(out_link_speed, len, "%u", link_speed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003635 if ((rc < 0) || (rc >= len)) {
3636 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003637 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003638 return -EIO;
3639 }
3640
Dustin Browne74003f2018-03-14 12:51:58 -07003641 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003642 /* a value is being successfully returned */
3643 return 0;
3644}
3645
3646static int iw_get_linkspeed(struct net_device *dev,
3647 struct iw_request_info *info,
3648 union iwreq_data *wrqu, char *extra)
3649{
Dustin Brown389e5072018-11-08 17:10:01 +05303650 int errno;
3651 struct osif_vdev_sync *vdev_sync;
3652
3653 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
3654 if (errno)
3655 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003656
Dustin Brown389e5072018-11-08 17:10:01 +05303657 errno = __iw_get_linkspeed(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003658
Dustin Brown389e5072018-11-08 17:10:01 +05303659 osif_vdev_sync_op_stop(vdev_sync);
3660
3661 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003662}
3663
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003664#ifdef FEATURE_WLM_STATS
3665static void wlan_get_wlm_stats_cb(void *cookie, const char *data)
3666{
3667 struct osif_request *request;
3668 char *priv;
3669
3670 request = osif_request_get(cookie);
3671 if (!request) {
3672 hdd_err("Obsolete request");
3673 return;
3674 }
3675 priv = osif_request_priv(request);
3676 strlcpy(priv, data, WE_MAX_STR_LEN);
3677 osif_request_complete(request);
3678 osif_request_put(request);
3679}
3680
3681static int wlan_get_wlm_stats(struct hdd_adapter *adapter, uint32_t bitmask,
3682 char *response)
3683{
3684 struct osif_request *request;
3685 void *cookie;
3686 int errno;
3687 char *priv;
3688 static const struct osif_request_params params = {
3689 .priv_size = WE_MAX_STR_LEN,
3690 .timeout_ms = 2000,
3691 };
3692
3693 if (!adapter) {
3694 hdd_err("NULL argument");
3695 return -EINVAL;
3696 }
3697 request = osif_request_alloc(&params);
3698 if (!request) {
3699 hdd_err("Request allocation failure");
3700 return -ENOMEM;
3701 }
3702 cookie = osif_request_cookie(request);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003703 errno = wma_wlm_stats_req(adapter->vdev_id, bitmask,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003704 params.priv_size,
3705 wlan_get_wlm_stats_cb, cookie);
3706 if (errno) {
3707 hdd_err("Request failed be sent, %d", errno);
3708 goto cleanup;
3709 }
3710 errno = osif_request_wait_for_response(request);
3711 if (errno) {
3712 hdd_err("Timeout happened, can't complete the req");
3713 goto cleanup;
3714 }
3715 priv = osif_request_priv(request);
3716 strlcpy(response, priv, params.priv_size);
3717
3718cleanup:
3719 osif_request_put(request);
3720
3721 return errno;
3722}
3723
3724/*
3725 * Due to a limitation in iwpriv the "get_wlm_stats" ioctl is defined
3726 * to take as input a variable-length string as opposed to taking a
3727 * single integer "bitmask" value. Hence we must have a buffer large
3728 * enough to hold a string representing the largest possible
3729 * value. MAX_INT = 2,147,483,647 which can be fit in 10 chars.
3730 * Round up to 12 to hold the trailing NUL and be a multiple of 4.
3731 */
3732#define WLM_USER_DATA_SIZE 12
3733
3734static int __iw_get_wlm_stats(struct net_device *dev,
3735 struct iw_request_info *info,
3736 union iwreq_data *wrqu, char *extra)
3737{
3738 struct iw_point priv_data;
3739 char user_data[WLM_USER_DATA_SIZE] = {0};
3740 uint32_t bitmask = 0;
3741 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
3742 struct hdd_context *hdd_ctx;
3743 int errno;
3744
3745 hdd_enter_dev(dev);
3746
3747 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3748 errno = wlan_hdd_validate_context(hdd_ctx);
3749 if (errno)
3750 return errno;
3751
3752 if (!capable(CAP_NET_ADMIN)) {
3753 hdd_err("permission check failed");
3754 return -EPERM;
3755 }
3756
3757 /*
3758 * Since this is GETTER iwpriv ioctl, driver needs to
3759 * copy SET data from user space to kernel space.
3760 * Helper function to get iwreq_data with compat handling.
3761 */
3762 if (hdd_priv_get_data(&priv_data, wrqu))
3763 return -EINVAL;
3764
3765 /*
3766 * priv_data.pointer should be pointing to data given
3767 * to iwpriv command.
3768 *
3769 * For example "iwpriv wlan0 get_wlm_stats 1234"
3770 *
3771 * priv_data.pointer should be pointing to "1234"
3772 * priv_data.length should be zero as this GETTER iwpriv ioctl
3773 */
3774 if (!priv_data.pointer) {
3775 hdd_err("NULL data pointer");
3776 return -EINVAL;
3777 }
3778
3779 /*
3780 * ideally driver should have used priv_data.length to copy
3781 * data from priv_data.pointer but this iwpriv IOCTL has been
3782 * declared as GETTER in nature which makes length field zero
3783 * for input arguments but priv_data.pointer still points to
3784 * user's input argument (just doesn't pass the length of the
3785 * argument)
3786 */
3787 if (copy_from_user(user_data, priv_data.pointer,
3788 sizeof(user_data) - 1)) {
3789 hdd_err("failed to copy data from user buffer");
3790 return -EFAULT;
3791 }
3792
3793 /*
3794 * user data is given in ascii, convert ascii to integer
3795 */
3796 if (kstrtou32(user_data, 0, &bitmask)) {
3797 hdd_err("failed to parse input %s", user_data);
3798 return -EFAULT;
3799 }
3800
3801 if (wlan_get_wlm_stats(adapter, bitmask, extra)) {
3802 hdd_err("returning failure");
3803 return -EFAULT;
3804 }
3805 wrqu->data.length = strlen(extra) + 1;
3806
3807 return 0;
3808}
3809
Dustin Brown96b98dd2019-03-06 12:39:37 -08003810static int iw_get_wlm_stats(struct net_device *net_dev,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003811 struct iw_request_info *info,
3812 union iwreq_data *wrqu, char *extra)
3813{
Dustin Brown96b98dd2019-03-06 12:39:37 -08003814 struct osif_vdev_sync *vdev_sync;
3815 int errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003816
Dustin Brown96b98dd2019-03-06 12:39:37 -08003817 errno = osif_vdev_sync_op_start(net_dev, &vdev_sync);
3818 if (errno)
3819 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003820
Dustin Brown96b98dd2019-03-06 12:39:37 -08003821 errno = __iw_get_wlm_stats(net_dev, info, wrqu, extra);
3822
3823 osif_vdev_sync_op_stop(vdev_sync);
3824
3825 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003826}
3827#endif /* FEATURE_WLM_STATS */
3828
Jeff Johnsonc1713242018-10-23 13:45:42 -07003829int wlan_hdd_update_phymode(struct hdd_adapter *adapter, int new_phymode)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003830{
Jeff Johnsonc1713242018-10-23 13:45:42 -07003831 struct net_device *net = adapter->dev;
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003832 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3833 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003834 bool band_24 = false, band_5g = false;
3835 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08003836 struct sme_config_params *sme_config;
Jeff Johnsone94ccd02019-04-02 15:02:56 -07003837 struct csr_config_params *csr_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003838 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303839 uint8_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003840 eCsrPhyMode phymode = -EIO, old_phymode;
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003841 enum hdd_dot11_mode hdd_dot11mode = hdd_ctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003842 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303843 int retval = 0;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303844 uint8_t band_capability;
3845 QDF_STATUS status;
Wu Gaoed616a12019-01-16 15:19:21 +08003846 uint32_t channel_bonding_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003847
Jeff Johnsonc1713242018-10-23 13:45:42 -07003848 if (!mac_handle)
3849 return -EINVAL;
3850
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003851 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003852
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003853 ucfg_mlme_get_channel_bonding_24ghz(hdd_ctx->psoc,
Wu Gaoed616a12019-01-16 15:19:21 +08003854 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003855 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003856 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003857 ch_bond24 = true;
3858
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003859 ucfg_mlme_get_channel_bonding_5ghz(hdd_ctx->psoc,
Wu Gaoed616a12019-01-16 15:19:21 +08003860 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003861 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003862 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003863 ch_bond5g = true;
3864
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003865 status = wlan_mlme_get_band_capability(hdd_ctx->psoc, &band_capability);
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303866 if (QDF_IS_STATUS_ERROR(status)) {
3867 hdd_err("Failed to get MLME Band capability");
3868 return -EIO;
3869 }
3870
3871 if (band_capability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003872 band_24 = band_5g = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303873 else if (band_capability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003874 band_24 = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303875 else if (band_capability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003876 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003877
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003878 status = ucfg_mlme_get_vht_channel_width(hdd_ctx->psoc, &vhtchanwidth);
Jeff Johnsonc1713242018-10-23 13:45:42 -07003879 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003880 hdd_err("Failed to get channel_width");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303881
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003882 hdd_debug("ch_bond24=%d ch_bond5g=%d band_24=%d band_5g=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003883 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3884
3885 switch (new_phymode) {
3886 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003887 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003888 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003889 phymode = eCSR_DOT11_MODE_AUTO;
3890 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3891 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003892 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003893 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3894 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003895 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003896 return -EIO;
3897 }
3898 break;
3899 case IEEE80211_MODE_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003900 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003901 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003902 phymode = eCSR_DOT11_MODE_11a;
3903 hdd_dot11mode = eHDD_DOT11_MODE_11a;
3904 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003905 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003906 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003907 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003908 return -EIO;
3909 }
3910 break;
3911 case IEEE80211_MODE_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003912 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003913 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003914 phymode = eCSR_DOT11_MODE_11b;
3915 hdd_dot11mode = eHDD_DOT11_MODE_11b;
3916 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003917 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003918 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003919 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003920 return -EIO;
3921 }
3922 break;
3923 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003924 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003925 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003926 phymode = eCSR_DOT11_MODE_11g;
3927 hdd_dot11mode = eHDD_DOT11_MODE_11g;
3928 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003929 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003930 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003931 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003932 return -EIO;
3933 }
3934 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07003935 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003936 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
3937 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
3938 */
3939 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003940 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003941 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003942 phymode = eCSR_DOT11_MODE_11n;
3943 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3944 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003945 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003946 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003947 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003948 return -EIO;
3949 }
3950 break;
3951 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003952 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003953 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003954 phymode = eCSR_DOT11_MODE_11n;
3955 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3956 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003957 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003958 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003959 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003960 return -EIO;
3961 }
3962 break;
3963 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003964 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003965 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003966 phymode = eCSR_DOT11_MODE_11n;
3967 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3968 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003969 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003970 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003971 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003972 return -EIO;
3973 }
3974 break;
3975 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003976 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003977 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003978 phymode = eCSR_DOT11_MODE_11n;
3979 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3980 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003981 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003982 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003983 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003984 return -EIO;
3985 }
3986 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003987 case IEEE80211_MODE_11AC_VHT20:
3988 case IEEE80211_MODE_11AC_VHT40:
3989 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003990 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003991 phymode = eCSR_DOT11_MODE_11ac;
3992 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
3993 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3994 if (band_5g && band_24) {
3995 curr_band = BAND_ALL;
3996 break;
3997 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003998 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003999 break;
4000 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
4001 curr_band = BAND_2G;
4002 break;
4003 }
4004 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
4005 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004006 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004007 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004008 return -EIO;
4009 }
4010 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004011 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004012 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004013 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004014 phymode = eCSR_DOT11_MODE_AUTO;
4015 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4016 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004017 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004018 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004019 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004020 return -EIO;
4021 }
4022 break;
4023 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004024 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004025 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004026 phymode = eCSR_DOT11_MODE_AUTO;
4027 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4028 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
4029 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004030 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004031 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004032 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004033 return -EIO;
4034 }
4035 break;
4036 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004037 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004038 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004039 phymode = eCSR_DOT11_MODE_11n;
4040 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4041 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004042 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004043 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004044 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004045 return -EIO;
4046 }
4047 break;
4048 default:
4049 return -EIO;
4050 }
4051
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004052 switch (new_phymode) {
4053 case IEEE80211_MODE_11AC_VHT20:
4054 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4055 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
4056 break;
4057 case IEEE80211_MODE_11AC_VHT40:
4058 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
4059 break;
4060 case IEEE80211_MODE_11AC_VHT80:
4061 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
4062 break;
4063 default:
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004064 status = ucfg_mlme_get_vht_channel_width(hdd_ctx->psoc,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004065 &vhtchanwidth);
4066 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07004067 hdd_err("Failed to get channel_width");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004068 break;
4069 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004070
4071 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304072 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4073 if (!sme_config) {
4074 hdd_err("Failed to allocate memory for sme_config");
4075 return -ENOMEM;
4076 }
4077 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004078 sme_get_config_param(mac_handle, sme_config);
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004079 csr_config = &sme_config->csr_config;
4080 csr_config->phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004081#ifdef QCA_HT_2040_COEX
4082 if (phymode == eCSR_DOT11_MODE_11n &&
4083 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004084 csr_config->obssEnabled = false;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004085 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004086 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004087 eHT_CHAN_HT20, false);
4088 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004089 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304090 retval = -EIO;
4091 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004092 }
4093 } else if (phymode == eCSR_DOT11_MODE_11n &&
4094 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004095 csr_config->obssEnabled = true;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004096 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004097 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004098 eHT_CHAN_HT20, true);
4099 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004100 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304101 retval = -EIO;
4102 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004103 }
4104 }
4105#endif
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004106 status = ucfg_mlme_set_band_capability(hdd_ctx->psoc,
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05304107 curr_band);
4108 if (QDF_IS_STATUS_ERROR(status)) {
4109 hdd_err("failed to set MLME band capability");
4110 goto free;
4111 }
4112
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304113 if (curr_band == BAND_2G) {
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004114 status = ucfg_mlme_set_11h_enabled(hdd_ctx->psoc, 0);
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304115 if (!QDF_IS_STATUS_SUCCESS(status)) {
4116 hdd_err("Failed to set 11h_enable flag");
4117 goto free;
4118 }
4119 }
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004120 if (curr_band == BAND_2G)
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004121 csr_config->channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07004122 else if (curr_band == BAND_5G)
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004123 csr_config->channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004124 else {
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004125 csr_config->channelBondingMode24GHz = chwidth;
4126 csr_config->channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004127 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004128 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004129
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004130 hdd_ctx->config->dot11Mode = hdd_dot11mode;
Wu Gaoed616a12019-01-16 15:19:21 +08004131 ucfg_mlme_set_channel_bonding_24ghz(
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004132 hdd_ctx->psoc,
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004133 csr_config->channelBondingMode24GHz);
Wu Gaoed616a12019-01-16 15:19:21 +08004134 ucfg_mlme_set_channel_bonding_5ghz(
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004135 hdd_ctx->psoc,
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004136 csr_config->channelBondingMode5GHz);
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004137 if (hdd_update_config_cfg(hdd_ctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004138 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304139 retval = -EIO;
4140 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004141 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304142
4143 if (band_5g) {
4144 struct ieee80211_supported_band *band;
4145
Wu Gaoed616a12019-01-16 15:19:21 +08004146 ucfg_mlme_get_channel_bonding_5ghz(
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004147 hdd_ctx->psoc, &channel_bonding_mode);
4148 band = hdd_ctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
Wu Gaoed616a12019-01-16 15:19:21 +08004149 if (channel_bonding_mode)
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304150 band->ht_cap.cap |=
4151 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4152 else
4153 band->ht_cap.cap &=
4154 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4155 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004156
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004157 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004158 phymode, chwidth, curr_band, vhtchanwidth);
4159 }
4160
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304161free:
4162 if (sme_config)
4163 qdf_mem_free(sme_config);
4164 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004165}
4166
Jeff Johnson011c4502017-10-05 15:25:56 -07004167static int hdd_validate_pdev_reset(int value)
4168{
4169 if ((value < 1) || (value > 5)) {
4170 hdd_warn(" Invalid value %d: Use any one of the below values\n"
4171 " TX_FLUSH = 1\n"
4172 " WARM_RESET = 2\n"
4173 " COLD_RESET = 3\n"
4174 " WARM_RESET_RESTORE_CAL = 4\n"
4175 " COLD_RESET_RESTORE_CAL = 5", value);
4176
4177 return -EINVAL;
4178 }
4179
4180 return 0;
4181}
4182
4183static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
4184{
4185 int ret;
4186
4187 hdd_debug("%d", value);
4188
4189 ret = hdd_validate_pdev_reset(value);
4190 if (ret)
4191 return ret;
4192
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004193 ret = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07004194 WMI_PDEV_PARAM_PDEV_RESET,
4195 value, PDEV_CMD);
4196
4197 return ret;
4198}
4199
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004200static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
4201{
4202 int errno;
4203 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004204 uint32_t bonding_mode;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08004205 struct sme_config_params *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004206 mac_handle_t mac_handle;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004207
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004208 mac_handle = hdd_ctx->mac_handle;
4209 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004210 return -EINVAL;
4211
4212 /* updating channel bonding only on 5Ghz */
4213 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4214
4215 switch (ch_width) {
4216 case eHT_CHANNEL_WIDTH_20MHZ:
4217 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4218 break;
4219
4220 case eHT_CHANNEL_WIDTH_40MHZ:
4221 case eHT_CHANNEL_WIDTH_80MHZ:
Kiran Kumar Lokere9df090b2019-02-07 18:48:22 -08004222 bonding_mode = 1;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004223 break;
4224
4225 default:
4226 hdd_err("Invalid channel width 0->20 1->40 2->80");
4227 return -EINVAL;
4228 }
4229
4230 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4231 if (!sme_config) {
4232 hdd_err("failed to allocate memory for sme_config");
4233 return -ENOMEM;
4234 }
4235
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004236 errno = wma_cli_set_command(adapter->vdev_id, WMI_VDEV_PARAM_CHWIDTH,
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004237 ch_width, VDEV_CMD);
4238 if (errno)
4239 goto free_config;
4240
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004241 sme_get_config_param(mac_handle, sme_config);
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004242 sme_config->csr_config.channelBondingMode5GHz = bonding_mode;
4243 sme_config->csr_config.channelBondingMode24GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004244 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004245
4246free_config:
4247 qdf_mem_free(sme_config);
4248
4249 return errno;
4250}
4251
Jeff Johnsondeab8572018-11-13 15:29:53 -08004252static int hdd_we_set_11d_state(struct hdd_adapter *adapter, int state_11d)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004253{
Jeff Johnsondeab8572018-11-13 15:29:53 -08004254 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004255 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004256 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304257 QDF_STATUS status;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004258
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004259 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004260 return -EINVAL;
4261
4262 switch (state_11d) {
4263 case ENABLE_11D:
4264 enable_11d = true;
4265 break;
4266 case DISABLE_11D:
4267 enable_11d = false;
4268 break;
4269 default:
4270 return -EINVAL;
4271 }
4272
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304273 status = ucfg_mlme_set_11d_enabled(hdd_ctx->psoc, enable_11d);
4274 if (!QDF_IS_STATUS_SUCCESS(status))
4275 hdd_err("Invalid 11d_enable flag");
Dustin Brownd90f61a2018-04-26 12:25:58 -07004276
Dustin Brownea82d562018-05-23 12:07:16 -07004277 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004278
4279 return 0;
4280}
4281
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004282static int hdd_we_set_power(struct hdd_adapter *adapter, int value)
4283{
4284 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4285 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4286
4287 if (!mac_handle)
4288 return -EINVAL;
4289
4290 switch (value) {
4291 case 1:
4292 /* Enable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004293 sme_save_usr_ps_cfg(mac_handle, true);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004294 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004295 SME_PS_ENABLE);
4296 return 0;
4297 case 2:
4298 /* Disable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004299 sme_save_usr_ps_cfg(mac_handle, false);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004300 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004301 SME_PS_DISABLE);
4302 return 0;
4303 case 3:
4304 /* Enable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004305 sme_ps_uapsd_enable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004306 return 0;
4307 case 4:
4308 /* Disable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004309 sme_ps_uapsd_disable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004310 return 0;
4311 default:
4312 hdd_err("Invalid value %d", value);
4313 return -EINVAL;
4314 }
4315}
4316
Jeff Johnsoneb4368a2018-10-19 13:02:52 -07004317static int hdd_we_set_max_assoc(struct hdd_adapter *adapter, int value)
4318{
4319 struct hdd_context *hdd_ctx;
4320 QDF_STATUS status;
4321
4322 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4323 status = ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, value);
4324 if (QDF_IS_STATUS_ERROR(status))
4325 hdd_err("cfg set failed, value %d status %d", value, status);
4326
4327 return qdf_status_to_os_return(status);
4328}
4329
Jeff Johnson693722c2018-10-19 13:11:16 -07004330static int hdd_we_set_data_inactivity_timeout(struct hdd_adapter *adapter,
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004331 int inactivity_timeout)
Jeff Johnson693722c2018-10-19 13:11:16 -07004332{
4333 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004334 QDF_STATUS status;
Jeff Johnson693722c2018-10-19 13:11:16 -07004335
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004336 status = ucfg_mlme_set_ps_data_inactivity_timeout(hdd_ctx->psoc,
4337 inactivity_timeout);
Jeff Johnson693722c2018-10-19 13:11:16 -07004338
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004339 return qdf_status_to_os_return(status);
Jeff Johnson693722c2018-10-19 13:11:16 -07004340}
4341
Jeff Johnson94511942018-10-19 13:15:22 -07004342static int hdd_we_set_wow_data_inactivity_timeout(struct hdd_adapter *adapter,
4343 int value)
4344{
4345 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4346 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Jeff Johnson94511942018-10-19 13:15:22 -07004347
4348 if (!mac_handle)
4349 return -EINVAL;
4350
Wu Gaoa796d712019-01-07 14:15:32 +08004351 if (!cfg_in_range(CFG_PMO_WOW_DATA_INACTIVITY_TIMEOUT, value)) {
Jeff Johnson94511942018-10-19 13:15:22 -07004352 hdd_err_rl("Invalid value %d", value);
4353 return -EINVAL;
4354 }
4355
Wu Gaoa796d712019-01-07 14:15:32 +08004356 ucfg_pmo_set_wow_data_inactivity_timeout(hdd_ctx->psoc, (uint8_t)value);
Jeff Johnson94511942018-10-19 13:15:22 -07004357
Wu Gaoa796d712019-01-07 14:15:32 +08004358 return 0;
Jeff Johnson94511942018-10-19 13:15:22 -07004359}
4360
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004361static int hdd_we_set_tx_power(struct hdd_adapter *adapter, int value)
4362{
4363 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4364 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4365 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4366 QDF_STATUS status;
4367
4368 if (!mac_handle)
4369 return -EINVAL;
4370
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004371 status = sme_set_tx_power(mac_handle, adapter->vdev_id,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004372 sta_ctx->conn_info.bssid,
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004373 adapter->device_mode, value);
4374
4375 if (QDF_IS_STATUS_ERROR(status))
4376 hdd_err("cfg set failed, value %d status %d", value, status);
4377
4378 return qdf_status_to_os_return(status);
4379}
4380
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004381static int hdd_we_set_max_tx_power(struct hdd_adapter *adapter, int value)
4382{
4383 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4384 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4385 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4386 QDF_STATUS status;
4387
4388 if (!mac_handle)
4389 return -EINVAL;
4390
4391 status = sme_set_max_tx_power(mac_handle,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004392 sta_ctx->conn_info.bssid,
4393 sta_ctx->conn_info.bssid,
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004394 value);
4395
4396 if (QDF_IS_STATUS_ERROR(status))
4397 hdd_err("cfg set failed, value %d status %d", value, status);
4398
4399 return qdf_status_to_os_return(status);
4400}
4401
Jeff Johnsonf3892b52018-10-23 11:32:04 -07004402static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power)
4403{
4404 QDF_STATUS status;
4405
4406 hdd_debug("power %d dBm", power);
4407 status = sme_set_max_tx_power_per_band(BAND_2G, power);
4408 if (QDF_IS_STATUS_ERROR(status))
4409 hdd_err("cfg set failed, value %d status %d", power, status);
4410
4411 return qdf_status_to_os_return(status);
4412}
4413
Jeff Johnson175004c2018-10-23 12:03:16 -07004414static int hdd_we_set_max_tx_power_5_0(struct hdd_adapter *adapter, int power)
4415{
4416 QDF_STATUS status;
4417
4418 hdd_debug("power %d dBm", power);
4419 status = sme_set_max_tx_power_per_band(BAND_5G, power);
4420 if (QDF_IS_STATUS_ERROR(status))
4421 hdd_err("cfg set failed, value %d status %d", power, status);
4422
4423 return qdf_status_to_os_return(status);
4424}
4425
Jeff Johnson0187c622019-01-04 06:39:44 -08004426#ifdef HASTINGS_BT_WAR
4427
Jeff Johnsonc7fa3542019-04-16 11:35:10 -07004428static bool hdd_hastings_bt_war_applicable(struct hdd_context *hdd_ctx)
4429{
4430 struct pld_soc_info info;
4431 int errno;
4432
4433 errno = pld_get_soc_info(hdd_ctx->parent_dev, &info);
4434 if (errno)
4435 return false;
4436
4437 /* check for HST 1.1 values */
4438
4439 if (info.device_version.family_number != 0x04)
4440 return false;
4441
4442 if (info.device_version.device_number != 0x0A)
4443 return false;
4444
4445 if (info.device_version.major_version != 0x01)
4446 return false;
4447
4448 return true;
4449}
4450
Jeff Johnson0187c622019-01-04 06:39:44 -08004451/*
4452 * replicate logic:
4453 * iwpriv wlan0 setUnitTestCmd 19 2 23 1 => enable WAR
4454 * iwpriv wlan0 setUnitTestCmd 19 2 23 0 => disable WAR
4455 */
4456
4457#define HASTINGS_WAR_FW_PARAM_ID 23
4458
4459static int hdd_hastings_bt_war_set_fw(struct hdd_context *hdd_ctx,
4460 uint32_t value)
4461{
4462 uint32_t vdev_id = 0; /* not used */
4463 uint32_t module_id = WLAN_MODULE_WAL;
4464 uint32_t arg_count = 2;
4465 uint32_t arg[2] = {HASTINGS_WAR_FW_PARAM_ID, value};
4466 QDF_STATUS status;
4467
Jeff Johnsonc7fa3542019-04-16 11:35:10 -07004468 if (!hdd_hastings_bt_war_applicable(hdd_ctx))
4469 return 0;
4470
Jeff Johnson0187c622019-01-04 06:39:44 -08004471 status = wma_form_unit_test_cmd_and_send(vdev_id, module_id,
4472 arg_count, arg);
4473
4474 return qdf_status_to_os_return(status);
4475}
4476
4477int hdd_hastings_bt_war_enable_fw(struct hdd_context *hdd_ctx)
4478{
4479 return hdd_hastings_bt_war_set_fw(hdd_ctx, 1);
4480}
4481
4482int hdd_hastings_bt_war_disable_fw(struct hdd_context *hdd_ctx)
4483{
4484 return hdd_hastings_bt_war_set_fw(hdd_ctx, 0);
4485}
4486
4487/* value to restore the config when the WAR is disabled */
4488static uint32_t iface_change_wait_time_checkpoint;
4489static void checkpoint_iface_change_wait_time(struct hdd_context *hdd_ctx)
4490{
4491 struct hdd_config *config = hdd_ctx->config;
4492
4493 /* did we already checkpoint a value ? */
4494 if (iface_change_wait_time_checkpoint)
4495 return;
4496
4497 /* checkpoint current value */
4498 iface_change_wait_time_checkpoint = config->iface_change_wait_time;
4499
4500 /* was the timer enabled when we checkpointed? */
4501 if (iface_change_wait_time_checkpoint)
4502 return;
4503
4504 /* WAR was enabled at boot, use default when disable */
4505 iface_change_wait_time_checkpoint =
4506 cfg_default(CFG_INTERFACE_CHANGE_WAIT);
4507}
4508
4509static int hdd_hastings_war_enable(struct hdd_context *hdd_ctx)
4510{
4511 struct hdd_config *config = hdd_ctx->config;
4512
4513 config->iface_change_wait_time = 0;
4514
4515 return hdd_hastings_bt_war_enable_fw(hdd_ctx);
4516}
4517
4518static int hdd_hastings_war_disable(struct hdd_context *hdd_ctx)
4519{
4520 struct hdd_config *config = hdd_ctx->config;
4521
4522 config->iface_change_wait_time = iface_change_wait_time_checkpoint;
4523
4524 return hdd_hastings_bt_war_disable_fw(hdd_ctx);
4525}
4526
4527static int hdd_we_set_hastings_bt_war(struct hdd_adapter *adapter, int enable)
4528{
4529 int errno;
4530 struct hdd_context *hdd_ctx;
4531
4532 errno = hdd_validate_adapter(adapter);
4533 if (errno)
4534 return errno;
4535
4536 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonc7fa3542019-04-16 11:35:10 -07004537 if (!hdd_hastings_bt_war_applicable(hdd_ctx))
4538 return 0;
4539
Jeff Johnson0187c622019-01-04 06:39:44 -08004540 checkpoint_iface_change_wait_time(hdd_ctx);
4541
4542 return enable ?
4543 hdd_hastings_war_enable(hdd_ctx) :
4544 hdd_hastings_war_disable(hdd_ctx);
4545}
4546#endif
4547
Jeff Johnson5bee39b2018-10-23 12:34:38 -07004548static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level)
4549{
4550 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4551 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4552 QDF_STATUS status;
4553
4554 if (!mac_handle)
4555 return -EINVAL;
4556
4557 hdd_debug("Thermal Mitigation Level %d", level);
4558 status = sme_set_thermal_level(mac_handle, level);
4559 if (QDF_IS_STATUS_ERROR(status))
4560 hdd_err("cfg set failed, value %d status %d", level, status);
4561
4562 return qdf_status_to_os_return(status);
4563}
4564
Jeff Johnson38912642018-10-24 15:01:40 -07004565static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss)
4566{
4567 QDF_STATUS status;
4568
4569 hdd_debug("NSS %d", nss);
4570
4571 if ((nss > 2) || (nss <= 0)) {
4572 hdd_err("Invalid NSS: %d", nss);
4573 return -EINVAL;
4574 }
4575
4576 status = hdd_update_nss(adapter, nss);
4577 if (QDF_IS_STATUS_ERROR(status))
4578 hdd_err("cfg set failed, value %d status %d", nss, status);
4579
4580 return qdf_status_to_os_return(status);
4581}
4582
bings14c3f062019-09-17 05:11:03 +08004583int hdd_we_set_short_gi(struct hdd_adapter *adapter, int sgi)
Jeff Johnsonce996b32018-10-25 10:52:40 -07004584{
4585 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
4586 int errno;
4587
4588 hdd_debug("Short GI %d", sgi);
4589
4590 if (!mac_handle) {
4591 hdd_err("NULL Mac handle");
4592 return -EINVAL;
4593 }
4594
4595 if (sgi & HDD_AUTO_RATE_SGI)
4596 errno = sme_set_auto_rate_he_sgi(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004597 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004598 sgi);
4599 else
4600 errno = sme_update_ht_config(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004601 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004602 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4603 sgi);
4604 if (errno)
4605 hdd_err("cfg set failed, value %d status %d", sgi, errno);
4606
4607 return errno;
4608}
4609
Jeff Johnson71d80382018-10-25 15:45:01 -07004610static int hdd_we_set_rtscts(struct hdd_adapter *adapter, int rtscts)
4611{
4612 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4613 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4614 uint32_t value;
4615 uint32_t rts_threshold_val;
4616 QDF_STATUS status;
4617 int errno;
4618
4619 hdd_debug("RTSCTS %d", rtscts);
4620
4621 if (!mac_handle) {
4622 hdd_err("NULL Mac handle");
4623 return -EINVAL;
4624 }
4625
4626 status = ucfg_mlme_get_rts_threshold(hdd_ctx->psoc,
4627 &rts_threshold_val);
4628 if (QDF_IS_STATUS_ERROR(status)) {
4629 hdd_err("Get rts threshold failed, status %d", status);
4630 return -EINVAL;
4631 }
4632
4633 if ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_RTSCTS_ENABLE) {
4634 value = rts_threshold_val;
4635 } else if (((rtscts & HDD_RTSCTS_EN_MASK) == 0) ||
4636 ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_CTS_ENABLE)) {
4637 value = cfg_max(CFG_RTS_THRESHOLD);
4638 } else {
4639 hdd_err_rl("Invalid value %d", rtscts);
4640 return -EINVAL;
4641 }
4642
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004643 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson71d80382018-10-25 15:45:01 -07004644 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4645 rtscts, VDEV_CMD);
4646 if (errno) {
4647 hdd_err("Failed to set firmware, errno %d", errno);
4648 return errno;
4649 }
4650
4651 status = ucfg_mlme_set_rts_threshold(hdd_ctx->psoc, value);
4652 if (QDF_IS_STATUS_ERROR(status)) {
4653 hdd_err("Set rts threshold failed, status %d", status);
4654 return -EINVAL;
4655 }
4656
4657 return 0;
4658}
4659
Jeff Johnson50b15882018-10-26 10:27:37 -07004660static int hdd_we_set_11n_rate(struct hdd_adapter *adapter, int rate_code)
4661{
4662 uint8_t preamble = 0, nss = 0, rix = 0;
4663 int errno;
bings672207d2019-06-20 17:39:39 +08004664 QDF_STATUS status;
4665 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4666 enum wlan_phymode peer_phymode;
4667 uint8_t *peer_mac = adapter->session.station.conn_info.bssid.bytes;
Jeff Johnson50b15882018-10-26 10:27:37 -07004668
4669 hdd_debug("Rate code %d", rate_code);
4670
4671 if (rate_code != 0xff) {
4672 rix = RC_2_RATE_IDX(rate_code);
4673 if (rate_code & 0x80) {
4674 preamble = WMI_RATE_PREAMBLE_HT;
4675 nss = HT_RC_2_STREAMS(rate_code) - 1;
4676 } else {
bings672207d2019-06-20 17:39:39 +08004677 status = ucfg_mlme_get_peer_phymode(hdd_ctx->psoc,
4678 peer_mac,
4679 &peer_phymode);
4680 if (QDF_IS_STATUS_ERROR(status)) {
4681 hdd_err("Failed to set rate");
4682 return 0;
4683 }
4684 if (IS_WLAN_PHYMODE_HE(peer_phymode)) {
4685 hdd_err("Do not set legacy rate %d in HE mode",
4686 rate_code);
4687 return 0;
4688 }
Jeff Johnson50b15882018-10-26 10:27:37 -07004689 nss = 0;
4690 rix = RC_2_RATE_IDX(rate_code);
4691 if (rate_code & 0x10) {
4692 preamble = WMI_RATE_PREAMBLE_CCK;
4693 if (rix != 0x3)
4694 /* Enable Short preamble
4695 * always for CCK except 1mbps
4696 */
4697 rix |= 0x4;
4698 } else {
4699 preamble = WMI_RATE_PREAMBLE_OFDM;
4700 }
4701 }
4702 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4703 }
4704
4705 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4706 rate_code, rix, preamble, nss);
4707
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004708 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson50b15882018-10-26 10:27:37 -07004709 WMI_VDEV_PARAM_FIXED_RATE,
4710 rate_code, VDEV_CMD);
4711 if (errno)
4712 hdd_err("Failed to set firmware, errno %d", errno);
4713
4714 return errno;
4715}
4716
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004717static int hdd_we_set_vht_rate(struct hdd_adapter *adapter, int rate_code)
4718{
4719 uint8_t preamble = 0, nss = 0, rix = 0;
4720 int errno;
4721
4722 hdd_debug("Rate code %d", rate_code);
4723
4724 if (rate_code != 0xff) {
4725 rix = RC_2_RATE_IDX_11AC(rate_code);
4726 preamble = WMI_RATE_PREAMBLE_VHT;
4727 nss = HT_RC_2_STREAMS_11AC(rate_code) - 1;
4728 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4729 }
4730
4731 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4732 rate_code, rix, preamble, nss);
4733
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004734 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004735 WMI_VDEV_PARAM_FIXED_RATE,
4736 rate_code, VDEV_CMD);
4737 if (errno)
4738 hdd_err("Failed to set firmware, errno %d", errno);
4739
4740 return errno;
4741}
4742
Jeff Johnson7c433502018-11-12 15:00:52 -08004743static int hdd_we_set_ampdu(struct hdd_adapter *adapter, int ampdu)
4744{
4745 hdd_debug("AMPDU %d", ampdu);
4746
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004747 return wma_cli_set_command(adapter->vdev_id,
Jeff Johnson7c433502018-11-12 15:00:52 -08004748 GEN_VDEV_PARAM_AMPDU,
4749 ampdu, GEN_CMD);
4750}
4751
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004752static int hdd_we_set_amsdu(struct hdd_adapter *adapter, int amsdu)
4753{
4754 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4755 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4756 int errno;
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304757 QDF_STATUS status;
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004758
4759 hdd_debug("AMSDU %d", amsdu);
4760
4761 if (!mac_handle) {
4762 hdd_err("NULL Mac handle");
4763 return -EINVAL;
4764 }
4765
Kiran Kumar Lokere4bb5c6e2019-08-02 18:47:01 -07004766 status = ucfg_mlme_set_max_amsdu_num(hdd_ctx->psoc,
4767 amsdu);
4768 if (QDF_IS_STATUS_ERROR(status)) {
4769 hdd_err("Failed to set Max AMSDU Num to cfg");
4770 return -EINVAL;
4771 }
4772
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004773 if (amsdu > 1)
4774 sme_set_amsdu(mac_handle, true);
4775 else
4776 sme_set_amsdu(mac_handle, false);
4777
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004778 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004779 GEN_VDEV_PARAM_AMSDU,
4780 amsdu, GEN_CMD);
4781 if (errno) {
4782 hdd_err("Failed to set firmware, errno %d", errno);
4783 return errno;
4784 }
4785
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004786 return 0;
4787}
4788
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004789static int hdd_we_clear_stats(struct hdd_adapter *adapter, int option)
4790{
Venkata Sharath Chandra Manchalacf572622019-07-29 11:50:57 -07004791 QDF_STATUS status;
4792
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004793 hdd_debug("option %d", option);
4794
4795 switch (option) {
4796 case CDP_HDD_STATS:
4797 memset(&adapter->stats, 0, sizeof(adapter->stats));
4798 memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
4799 break;
4800 case CDP_TXRX_HIST_STATS:
4801 wlan_hdd_clear_tx_rx_histogram(adapter->hdd_ctx);
4802 break;
4803 case CDP_HDD_NETIF_OPER_HISTORY:
4804 wlan_hdd_clear_netif_queue_history(adapter->hdd_ctx);
4805 break;
4806 case CDP_HIF_STATS:
4807 hdd_clear_hif_stats();
4808 break;
4809 case CDP_NAPI_STATS:
4810 hdd_clear_napi_stats();
4811 break;
4812 default:
Venkata Sharath Chandra Manchalacf572622019-07-29 11:50:57 -07004813 status = cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4814 option);
4815 if (status != QDF_STATUS_SUCCESS)
4816 hdd_debug("Failed to dump stats for option: %d",
4817 option);
4818 break;
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004819 }
4820
4821 return 0;
4822}
4823
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004824static int hdd_we_set_green_tx_param(struct hdd_adapter *adapter,
4825 green_tx_param id,
4826 const char *id_string,
4827 int value)
4828{
4829 int errno;
4830
4831 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004832 errno = wma_cli_set_command(adapter->vdev_id, id, value, GTX_CMD);
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004833 if (errno)
4834 hdd_err("Failed to set firmware, errno %d", errno);
4835
4836 return errno;
4837}
4838
4839#define hdd_we_set_green_tx_param(adapter, id, value) \
4840 hdd_we_set_green_tx_param(adapter, id, #id, value)
4841
4842static int hdd_we_set_gtx_ht_mcs(struct hdd_adapter *adapter, int value)
4843{
4844 return hdd_we_set_green_tx_param(adapter,
4845 WMI_VDEV_PARAM_GTX_HT_MCS,
4846 value);
4847}
4848
4849static int hdd_we_set_gtx_vht_mcs(struct hdd_adapter *adapter, int value)
4850{
4851 return hdd_we_set_green_tx_param(adapter,
4852 WMI_VDEV_PARAM_GTX_VHT_MCS,
4853 value);
4854}
4855
4856static int hdd_we_set_gtx_usrcfg(struct hdd_adapter *adapter, int value)
4857{
4858 return hdd_we_set_green_tx_param(adapter,
4859 WMI_VDEV_PARAM_GTX_USR_CFG,
4860 value);
4861}
4862
4863static int hdd_we_set_gtx_thre(struct hdd_adapter *adapter, int value)
4864{
4865 return hdd_we_set_green_tx_param(adapter,
4866 WMI_VDEV_PARAM_GTX_THRE,
4867 value);
4868}
4869
4870static int hdd_we_set_gtx_margin(struct hdd_adapter *adapter, int value)
4871{
4872 return hdd_we_set_green_tx_param(adapter,
4873 WMI_VDEV_PARAM_GTX_MARGIN,
4874 value);
4875}
4876
4877static int hdd_we_set_gtx_step(struct hdd_adapter *adapter, int value)
4878{
4879 return hdd_we_set_green_tx_param(adapter,
4880 WMI_VDEV_PARAM_GTX_STEP,
4881 value);
4882}
4883
4884static int hdd_we_set_gtx_mintpc(struct hdd_adapter *adapter, int value)
4885{
4886 return hdd_we_set_green_tx_param(adapter,
4887 WMI_VDEV_PARAM_GTX_MINTPC,
4888 value);
4889}
4890
4891static int hdd_we_set_gtx_bwmask(struct hdd_adapter *adapter, int value)
4892{
4893 return hdd_we_set_green_tx_param(adapter,
4894 WMI_VDEV_PARAM_GTX_BW_MASK,
4895 value);
4896}
4897
Jeff Johnsond0477f22018-10-29 12:26:25 -07004898static int hdd_we_packet_power_save(struct hdd_adapter *adapter,
4899 packet_power_save id,
4900 const char *id_string,
4901 int value)
4902{
4903 int errno;
4904
4905 if (adapter->device_mode != QDF_STA_MODE) {
4906 hdd_err_rl("Not supported in mode %d", adapter->device_mode);
4907 return -EINVAL;
4908 }
4909
4910 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004911 errno = wma_cli_set_command(adapter->vdev_id, id, value, PPS_CMD);
Jeff Johnsond0477f22018-10-29 12:26:25 -07004912 if (errno)
4913 hdd_err("Failed to set firmware, errno %d", errno);
4914
4915 return errno;
4916}
4917
4918#define hdd_we_packet_power_save(adapter, id, value) \
4919 hdd_we_packet_power_save(adapter, id, #id, value)
4920
4921static int hdd_we_pps_paid_match(struct hdd_adapter *adapter, int value)
4922{
4923 return hdd_we_packet_power_save(adapter,
4924 WMI_VDEV_PPS_PAID_MATCH,
4925 value);
4926}
4927
4928static int hdd_we_pps_gid_match(struct hdd_adapter *adapter, int value)
4929{
4930 return hdd_we_packet_power_save(adapter,
4931 WMI_VDEV_PPS_GID_MATCH,
4932 value);
4933}
4934
4935static int hdd_we_pps_early_tim_clear(struct hdd_adapter *adapter, int value)
4936{
4937 return hdd_we_packet_power_save(adapter,
4938 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4939 value);
4940}
4941
4942static int hdd_we_pps_early_dtim_clear(struct hdd_adapter *adapter, int value)
4943{
4944 return hdd_we_packet_power_save(adapter,
4945 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4946 value);
4947}
4948
4949static int hdd_we_pps_eof_pad_delim(struct hdd_adapter *adapter, int value)
4950{
4951 return hdd_we_packet_power_save(adapter,
4952 WMI_VDEV_PPS_EOF_PAD_DELIM,
4953 value);
4954}
4955
4956static int hdd_we_pps_macaddr_mismatch(struct hdd_adapter *adapter, int value)
4957{
4958 return hdd_we_packet_power_save(adapter,
4959 WMI_VDEV_PPS_MACADDR_MISMATCH,
4960 value);
4961}
4962
4963static int hdd_we_pps_delim_crc_fail(struct hdd_adapter *adapter, int value)
4964{
4965 return hdd_we_packet_power_save(adapter,
4966 WMI_VDEV_PPS_DELIM_CRC_FAIL,
4967 value);
4968}
4969
4970static int hdd_we_pps_gid_nsts_zero(struct hdd_adapter *adapter, int value)
4971{
4972 return hdd_we_packet_power_save(adapter,
4973 WMI_VDEV_PPS_GID_NSTS_ZERO,
4974 value);
4975}
4976
4977static int hdd_we_pps_rssi_check(struct hdd_adapter *adapter, int value)
4978{
4979 return hdd_we_packet_power_save(adapter,
4980 WMI_VDEV_PPS_RSSI_CHECK,
4981 value);
4982}
4983
4984static int hdd_we_pps_5g_ebt(struct hdd_adapter *adapter, int value)
4985{
4986 return hdd_we_packet_power_save(adapter,
4987 WMI_VDEV_PPS_5G_EBT,
4988 value);
4989}
4990
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07004991static int hdd_we_set_qpower(struct hdd_adapter *adapter,
4992 enum wmi_sta_powersave_param id,
4993 const char *id_string,
4994 int value)
4995{
4996 int errno;
4997
4998 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004999 errno = wma_cli_set_command(adapter->vdev_id, id, value, QPOWER_CMD);
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07005000 if (errno)
5001 hdd_err("Failed to set firmware, errno %d", errno);
5002
5003 return errno;
5004}
5005
5006#define hdd_we_set_qpower(adapter, id, value) \
5007 hdd_we_set_qpower(adapter, id, #id, value)
5008
5009static int
5010hdd_we_set_qpower_max_pspoll_count(struct hdd_adapter *adapter, int value)
5011{
5012 enum wmi_sta_powersave_param id =
5013 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT;
5014
5015 return hdd_we_set_qpower(adapter, id, value);
5016}
5017
5018static int
5019hdd_we_set_qpower_max_tx_before_wake(struct hdd_adapter *adapter, int value)
5020{
5021 enum wmi_sta_powersave_param id =
5022 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE;
5023
5024 return hdd_we_set_qpower(adapter, id, value);
5025}
5026
5027static int
5028hdd_we_set_qpower_spec_pspoll_wake_interval(struct hdd_adapter *adapter,
5029 int value)
5030{
5031 enum wmi_sta_powersave_param id =
5032 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL;
5033
5034 return hdd_we_set_qpower(adapter, id, value);
5035}
5036
5037static int
5038hdd_we_set_qpower_spec_max_spec_nodata_pspoll(struct hdd_adapter *adapter,
5039 int value)
5040{
5041 enum wmi_sta_powersave_param id =
5042 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL;
5043
5044 return hdd_we_set_qpower(adapter, id, value);
5045}
5046
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005047static int hdd_we_set_pdev(struct hdd_adapter *adapter,
5048 WMI_PDEV_PARAM id,
5049 const char *id_string,
5050 int value)
5051{
5052 int errno;
5053
5054 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005055 errno = wma_cli_set_command(adapter->vdev_id, id, value, PDEV_CMD);
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005056 if (errno)
5057 hdd_err("Failed to set firmware, errno %d", errno);
5058
5059 return errno;
5060}
5061
5062#define hdd_we_set_pdev(adapter, id, value) \
5063 hdd_we_set_pdev(adapter, id, #id, value)
5064
5065static int hdd_we_set_ani_en_dis(struct hdd_adapter *adapter, int value)
5066{
5067 return hdd_we_set_pdev(adapter,
5068 WMI_PDEV_PARAM_ANI_ENABLE,
5069 value);
5070}
5071
5072static int hdd_we_set_ani_poll_period(struct hdd_adapter *adapter, int value)
5073{
5074 return hdd_we_set_pdev(adapter,
5075 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
5076 value);
5077}
5078
5079static int hdd_we_set_ani_listen_period(struct hdd_adapter *adapter, int value)
5080{
5081 return hdd_we_set_pdev(adapter,
5082 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
5083 value);
5084}
5085
5086static int hdd_we_set_ani_ofdm_level(struct hdd_adapter *adapter, int value)
5087{
5088 return hdd_we_set_pdev(adapter,
5089 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
5090 value);
5091}
5092
5093static int hdd_we_set_ani_cck_level(struct hdd_adapter *adapter, int value)
5094{
5095 return hdd_we_set_pdev(adapter,
5096 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
5097 value);
5098}
5099
5100static int hdd_we_set_dynamic_bw(struct hdd_adapter *adapter, int value)
5101{
5102 return hdd_we_set_pdev(adapter,
5103 WMI_PDEV_PARAM_DYNAMIC_BW,
5104 value);
5105}
5106
5107static int hdd_we_set_cts_cbw(struct hdd_adapter *adapter, int value)
5108{
5109 return hdd_we_set_pdev(adapter,
5110 WMI_PDEV_PARAM_CTS_CBW,
5111 value);
5112}
5113
5114static int hdd_we_set_tx_chainmask(struct hdd_adapter *adapter, int value)
5115{
5116 int errno;
5117
5118 errno = hdd_we_set_pdev(adapter,
5119 WMI_PDEV_PARAM_TX_CHAIN_MASK,
5120 value);
5121 if (errno)
5122 return errno;
5123
5124 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5125}
5126
5127static int hdd_we_set_rx_chainmask(struct hdd_adapter *adapter, int value)
5128{
5129 int errno;
5130
5131 errno = hdd_we_set_pdev(adapter,
5132 WMI_PDEV_PARAM_RX_CHAIN_MASK,
5133 value);
5134 if (errno)
5135 return errno;
5136
5137 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5138}
5139
5140static int hdd_we_set_txpow_2g(struct hdd_adapter *adapter, int value)
5141{
5142 return hdd_we_set_pdev(adapter,
5143 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
5144 value);
5145}
5146
5147static int hdd_we_set_txpow_5g(struct hdd_adapter *adapter, int value)
5148{
5149 return hdd_we_set_pdev(adapter,
5150 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
5151 value);
5152}
5153
Jeff Johnson2e381272018-11-10 09:33:39 -08005154static int hdd_we_set_vdev(struct hdd_adapter *adapter,
5155 int id,
5156 const char *id_string,
5157 int value)
5158{
5159 int errno;
5160
5161 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005162 errno = wma_cli_set_command(adapter->vdev_id, id, value, VDEV_CMD);
Jeff Johnson2e381272018-11-10 09:33:39 -08005163 if (errno)
5164 hdd_err("Failed to set firmware, errno %d", errno);
5165
5166 return errno;
5167}
5168
5169#define hdd_we_set_vdev(adapter, id, value) \
5170 hdd_we_set_vdev(adapter, id, #id, value)
5171
5172static int hdd_we_set_txrx_fwstats(struct hdd_adapter *adapter, int value)
5173{
5174 return hdd_we_set_vdev(adapter,
5175 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
5176 value);
5177}
5178
5179static int hdd_we_txrx_fwstats_reset(struct hdd_adapter *adapter, int value)
5180{
5181 return hdd_we_set_vdev(adapter,
5182 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
5183 value);
5184}
5185
5186static int hdd_we_set_htsmps(struct hdd_adapter *adapter, int value)
5187{
5188 return hdd_we_set_vdev(adapter,
5189 WMI_STA_SMPS_FORCE_MODE_CMDID,
5190 value);
5191}
5192
5193static int hdd_we_set_early_rx_adjust_enable(struct hdd_adapter *adapter,
5194 int value)
5195{
5196 if ((value != 0) && (value != 1))
5197 return -EINVAL;
5198
5199 return hdd_we_set_vdev(adapter,
5200 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
5201 value);
5202}
5203
5204static int hdd_we_set_early_rx_tgt_bmiss_num(struct hdd_adapter *adapter,
5205 int value)
5206{
5207 return hdd_we_set_vdev(adapter,
5208 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
5209 value);
5210}
5211
5212static int hdd_we_set_early_rx_bmiss_sample_cycle(struct hdd_adapter *adapter,
5213 int value)
5214{
5215 return hdd_we_set_vdev(adapter,
5216 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
5217 value);
5218}
5219
5220static int hdd_we_set_early_rx_slop_step(struct hdd_adapter *adapter, int value)
5221{
5222 return hdd_we_set_vdev(adapter,
5223 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
5224 value);
5225}
5226
5227static int hdd_we_set_early_rx_init_slop(struct hdd_adapter *adapter, int value)
5228{
5229 return hdd_we_set_vdev(adapter,
5230 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
5231 value);
5232}
5233
5234static int hdd_we_set_early_rx_adjust_pause(struct hdd_adapter *adapter,
5235 int value)
5236{
5237 if ((value != 0) && (value != 1))
5238 return -EINVAL;
5239
5240 return hdd_we_set_vdev(adapter,
5241 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
5242 value);
5243}
5244
5245static int hdd_we_set_early_rx_drift_sample(struct hdd_adapter *adapter,
5246 int value)
5247{
5248 return hdd_we_set_vdev(adapter,
5249 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
5250 value);
5251}
5252
5253static int hdd_we_set_dcm(struct hdd_adapter *adapter, int value)
5254{
5255 return hdd_we_set_vdev(adapter,
5256 WMI_VDEV_PARAM_HE_DCM,
5257 value);
5258}
5259
5260static int hdd_we_set_range_ext(struct hdd_adapter *adapter, int value)
5261{
5262 return hdd_we_set_vdev(adapter,
5263 WMI_VDEV_PARAM_HE_RANGE_EXT,
5264 value);
5265}
5266
Jeff Johnson22e57f12018-11-10 16:02:00 -08005267static int hdd_we_set_dbg(struct hdd_adapter *adapter,
5268 int id,
5269 const char *id_string,
5270 int value)
5271{
5272 int errno;
5273
5274 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005275 errno = wma_cli_set_command(adapter->vdev_id, id, value, DBG_CMD);
Jeff Johnson22e57f12018-11-10 16:02:00 -08005276 if (errno)
5277 hdd_err("Failed to set firmware, errno %d", errno);
5278
5279 return errno;
5280}
5281
5282#define hdd_we_set_dbg(adapter, id, value) \
5283 hdd_we_set_dbg(adapter, id, #id, value)
5284
5285static int hdd_we_dbglog_log_level(struct hdd_adapter *adapter, int value)
5286{
5287 return hdd_we_set_dbg(adapter,
5288 WMI_DBGLOG_LOG_LEVEL,
5289 value);
5290}
5291
5292static int hdd_we_dbglog_vap_enable(struct hdd_adapter *adapter, int value)
5293{
5294 return hdd_we_set_dbg(adapter,
5295 WMI_DBGLOG_VAP_ENABLE,
5296 value);
5297}
5298
5299static int hdd_we_dbglog_vap_disable(struct hdd_adapter *adapter, int value)
5300{
5301 return hdd_we_set_dbg(adapter,
5302 WMI_DBGLOG_VAP_DISABLE,
5303 value);
5304}
5305
5306static int hdd_we_dbglog_module_enable(struct hdd_adapter *adapter, int value)
5307{
5308 return hdd_we_set_dbg(adapter,
5309 WMI_DBGLOG_MODULE_ENABLE,
5310 value);
5311}
5312
5313static int hdd_we_dbglog_module_disable(struct hdd_adapter *adapter, int value)
5314{
5315 return hdd_we_set_dbg(adapter,
5316 WMI_DBGLOG_MODULE_DISABLE,
5317 value);
5318}
5319
5320static int hdd_we_dbglog_mod_log_level(struct hdd_adapter *adapter, int value)
5321{
5322 return hdd_we_set_dbg(adapter,
5323 WMI_DBGLOG_MOD_LOG_LEVEL,
5324 value);
5325}
5326
5327static int hdd_we_dbglog_type(struct hdd_adapter *adapter, int value)
5328{
5329 return hdd_we_set_dbg(adapter,
5330 WMI_DBGLOG_TYPE,
5331 value);
5332}
5333
5334static int hdd_we_dbglog_report_enable(struct hdd_adapter *adapter, int value)
5335{
5336 return hdd_we_set_dbg(adapter,
5337 WMI_DBGLOG_REPORT_ENABLE,
5338 value);
5339}
5340
5341static int hdd_we_start_fw_profile(struct hdd_adapter *adapter, int value)
5342{
5343 return hdd_we_set_dbg(adapter,
5344 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5345 value);
5346}
5347
Jeff Johnson274a1d62018-11-12 20:31:51 -08005348static int hdd_we_set_channel(struct hdd_adapter *adapter, int channel)
5349{
5350 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5351 QDF_STATUS status;
5352
5353 hdd_debug("Set Channel %d Session ID %d mode %d", channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005354 adapter->vdev_id, adapter->device_mode);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005355
5356 if (!hdd_ctx->mac_handle)
5357 return -EINVAL;
5358
5359 switch (adapter->device_mode) {
5360 case QDF_STA_MODE:
5361 case QDF_P2P_CLIENT_MODE:
5362 /* supported */
5363 break;
5364 default:
5365 hdd_err("change channel not supported for device mode %d",
5366 adapter->device_mode);
5367 return -EINVAL;
5368 }
5369
5370 status = sme_ext_change_channel(hdd_ctx->mac_handle, channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005371 adapter->vdev_id);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005372 if (status != QDF_STATUS_SUCCESS)
5373 hdd_err("Error in change channel status %d", status);
5374
5375 return qdf_status_to_os_return(status);
5376}
5377
Jeff Johnson0e07ca12018-11-12 21:04:45 -08005378static int hdd_we_mcc_config_latency(struct hdd_adapter *adapter, int latency)
5379{
5380 hdd_debug("MCC latency %d", latency);
5381
5382 wlan_hdd_set_mcc_latency(adapter, latency);
5383
5384 return 0;
5385}
5386
5387static int hdd_we_mcc_config_quota(struct hdd_adapter *adapter, int quota)
5388{
5389 hdd_debug("MCC quota %dms", quota);
5390
5391 return wlan_hdd_set_mcc_p2p_quota(adapter, quota);
5392}
5393
Jeff Johnson33ec1982018-11-12 21:40:33 -08005394static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value)
5395{
5396 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5397
5398 if (!hdd_ctx->mac_handle)
5399 return -EINVAL;
5400
5401 sme_update_connect_debug(hdd_ctx->mac_handle, value);
5402
5403 return 0;
5404}
5405
Jeff Johnsone50951c2018-11-13 12:20:23 -08005406static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value)
5407{
5408 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5409
5410 hdd_debug("%d", value);
5411
Abhishek Singh935e4772018-11-21 14:14:10 +05305412 if (!hdd_ctx->psoc)
Jeff Johnsone50951c2018-11-13 12:20:23 -08005413 return -EINVAL;
5414
Abhishek Singh935e4772018-11-21 14:14:10 +05305415 if (value)
5416 ucfg_scan_psoc_set_disable(hdd_ctx->psoc, REASON_USER_SPACE);
5417 else
5418 ucfg_scan_psoc_set_enable(hdd_ctx->psoc, REASON_USER_SPACE);
Jeff Johnsone50951c2018-11-13 12:20:23 -08005419
5420 return 0;
5421}
5422
Jeff Johnsond3f1efd2018-11-13 13:26:19 -08005423static int hdd_we_set_conc_system_pref(struct hdd_adapter *adapter,
5424 int preference)
5425{
5426 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5427
5428 hdd_debug("%d", preference);
5429
5430 if (!hdd_ctx->psoc)
5431 return -EINVAL;
5432
5433 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, preference);
5434
5435 return 0;
5436}
5437
Jeff Johnson74696bb2018-11-13 13:30:36 -08005438static int hdd_we_set_11ax_rate(struct hdd_adapter *adapter, int rate)
5439{
5440 return hdd_set_11ax_rate(adapter, rate, NULL);
5441}
5442
Jeff Johnsonb43ec122018-11-13 14:17:08 -08005443static int hdd_we_set_modulated_dtim(struct hdd_adapter *adapter, int value)
5444{
5445 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5446
5447 hdd_debug("%d", value);
5448
5449 if (!hdd_ctx->psoc)
5450 return -EINVAL;
5451
5452 if ((value < cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM)) ||
5453 (value > cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM))) {
5454 hdd_err("Invalid value %d", value);
5455 return -EINVAL;
5456 }
5457
5458 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, value);
5459
5460 return 0;
5461}
5462
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305463#ifdef WLAN_FEATURE_MOTION_DETECTION
5464/**
5465 * hdd_we_motion_det_start_stop - start/stop motion detection
5466 * @adapter: hdd adapter
5467 * @value: start/stop value to set
5468 *
5469 * Return: 0 on success, error on failure
5470 */
5471static int hdd_we_motion_det_start_stop(struct hdd_adapter *adapter, int value)
5472{
5473 struct sme_motion_det_en motion_det;
5474 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5475
5476 if (value < 0 || value > 1) {
5477 hdd_err("Invalid value %d in mt_start", value);
5478 return -EINVAL;
5479 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005480 motion_det.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305481 motion_det.enable = value;
5482
5483 if (!value)
5484 adapter->motion_detection_mode = 0;
5485
5486 sme_motion_det_enable(hdd_ctx->mac_handle, &motion_det);
5487
5488 return 0;
5489}
5490
5491/**
5492 * hdd_we_motion_det_base_line_start_stop - start/stop md baselining
5493 * @adapter: hdd adapter
5494 * @value: start/stop value to set
5495 *
5496 * Return: 0 on success, error on failure
5497 */
5498static int hdd_we_motion_det_base_line_start_stop(struct hdd_adapter *adapter,
5499 int value)
5500{
5501 struct sme_motion_det_base_line_en motion_det_base_line;
5502 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5503
5504 if (value < 0 || value > 1) {
5505 hdd_err("Invalid value %d in mt_bl_start", value);
5506 return -EINVAL;
5507 }
5508
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005509 motion_det_base_line.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305510 motion_det_base_line.enable = value;
5511 sme_motion_det_base_line_enable(hdd_ctx->mac_handle,
5512 &motion_det_base_line);
5513
5514 return 0;
5515}
5516#endif /* WLAN_FEATURE_MOTION_DETECTION */
5517
Krishna Reddya50d09f2019-02-04 14:55:06 +05305518int wlan_hdd_set_btcoex_mode(struct hdd_adapter *adapter, int value)
5519{
5520 struct coex_config_params coex_cfg_params = {0};
5521
5522 coex_cfg_params.config_type = WMI_COEX_CONFIG_BTC_MODE;
5523 coex_cfg_params.config_arg1 = value;
5524 coex_cfg_params.vdev_id = adapter->vdev_id;
5525
5526 if (value < cfg_min(CFG_BTC_MODE) || value > cfg_max(CFG_BTC_MODE)) {
5527 hdd_err_rl("Invalid value %d", value);
5528 return -EINVAL;
5529 }
5530
5531 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5532 hdd_err_rl("Failed to send coex BTC mode");
5533 return -EINVAL;
5534 }
5535
5536 return 0;
5537}
5538
5539int wlan_hdd_set_btcoex_rssi_threshold(struct hdd_adapter *adapter, int value)
5540{
5541 struct coex_config_params coex_cfg_params = {0};
5542
5543 coex_cfg_params.config_type = WMI_COEX_CONFIG_BT_LOW_RSSI_THRESHOLD;
5544 coex_cfg_params.config_arg1 = value;
5545 coex_cfg_params.vdev_id = adapter->vdev_id;
5546
5547 if (value < cfg_min(CFG_WLAN_LOW_RSSI_THRESHOLD) ||
5548 value > cfg_max(CFG_WLAN_LOW_RSSI_THRESHOLD)) {
5549 hdd_err_rl("Invalid value %d", value);
5550 return -EINVAL;
5551 }
5552
5553 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5554 hdd_err_rl("Failed to send coex BTC RSSI Threshold");
5555 return -EINVAL;
5556 }
5557 return 0;
5558}
Jeff Johnson3ba27322018-11-13 17:58:28 -08005559typedef int (*setint_getnone_fn)(struct hdd_adapter *adapter, int value);
5560static const setint_getnone_fn setint_getnone_cb[] = {
5561 [WE_SET_11D_STATE] = hdd_we_set_11d_state,
5562 [WE_SET_POWER] = hdd_we_set_power,
5563 [WE_SET_MAX_ASSOC] = hdd_we_set_max_assoc,
5564 [WE_SET_DATA_INACTIVITY_TO] = hdd_we_set_data_inactivity_timeout,
5565 [WE_SET_WOW_DATA_INACTIVITY_TO] =
5566 hdd_we_set_wow_data_inactivity_timeout,
5567 [WE_SET_MC_RATE] = wlan_hdd_set_mc_rate,
5568 [WE_SET_TX_POWER] = hdd_we_set_tx_power,
5569 [WE_SET_MAX_TX_POWER] = hdd_we_set_max_tx_power,
5570 [WE_SET_MAX_TX_POWER_2_4] = hdd_we_set_max_tx_power_2_4,
5571 [WE_SET_MAX_TX_POWER_5_0] = hdd_we_set_max_tx_power_5_0,
Jeff Johnson0187c622019-01-04 06:39:44 -08005572#ifdef HASTINGS_BT_WAR
5573 [WE_SET_HASTINGS_BT_WAR] = hdd_we_set_hastings_bt_war,
5574#endif
Jeff Johnson3ba27322018-11-13 17:58:28 -08005575 [WE_SET_TM_LEVEL] = hdd_we_set_tm_level,
5576 [WE_SET_PHYMODE] = wlan_hdd_update_phymode,
5577 [WE_SET_NSS] = hdd_we_set_nss,
5578 [WE_SET_GTX_HT_MCS] = hdd_we_set_gtx_ht_mcs,
5579 [WE_SET_GTX_VHT_MCS] = hdd_we_set_gtx_vht_mcs,
5580 [WE_SET_GTX_USRCFG] = hdd_we_set_gtx_usrcfg,
5581 [WE_SET_GTX_THRE] = hdd_we_set_gtx_thre,
5582 [WE_SET_GTX_MARGIN] = hdd_we_set_gtx_margin,
5583 [WE_SET_GTX_STEP] = hdd_we_set_gtx_step,
5584 [WE_SET_GTX_MINTPC] = hdd_we_set_gtx_mintpc,
5585 [WE_SET_GTX_BWMASK] = hdd_we_set_gtx_bwmask,
5586 [WE_SET_LDPC] = hdd_set_ldpc,
5587 [WE_SET_TX_STBC] = hdd_set_tx_stbc,
5588 [WE_SET_RX_STBC] = hdd_set_rx_stbc,
5589 [WE_SET_SHORT_GI] = hdd_we_set_short_gi,
5590 [WE_SET_RTSCTS] = hdd_we_set_rtscts,
5591 [WE_SET_CHWIDTH] = hdd_we_set_ch_width,
5592 [WE_SET_ANI_EN_DIS] = hdd_we_set_ani_en_dis,
5593 [WE_SET_ANI_POLL_PERIOD] = hdd_we_set_ani_poll_period,
5594 [WE_SET_ANI_LISTEN_PERIOD] = hdd_we_set_ani_listen_period,
5595 [WE_SET_ANI_OFDM_LEVEL] = hdd_we_set_ani_ofdm_level,
5596 [WE_SET_ANI_CCK_LEVEL] = hdd_we_set_ani_cck_level,
5597 [WE_SET_DYNAMIC_BW] = hdd_we_set_dynamic_bw,
5598 [WE_SET_CTS_CBW] = hdd_we_set_cts_cbw,
5599 [WE_SET_11N_RATE] = hdd_we_set_11n_rate,
5600 [WE_SET_VHT_RATE] = hdd_we_set_vht_rate,
5601 [WE_SET_AMPDU] = hdd_we_set_ampdu,
5602 [WE_SET_AMSDU] = hdd_we_set_amsdu,
5603 [WE_SET_TX_CHAINMASK] = hdd_we_set_tx_chainmask,
5604 [WE_SET_RX_CHAINMASK] = hdd_we_set_rx_chainmask,
5605 [WE_SET_TXPOW_2G] = hdd_we_set_txpow_2g,
5606 [WE_SET_TXPOW_5G] = hdd_we_set_txpow_5g,
5607 [WE_DBGLOG_LOG_LEVEL] = hdd_we_dbglog_log_level,
5608 [WE_DBGLOG_VAP_ENABLE] = hdd_we_dbglog_vap_enable,
5609 [WE_DBGLOG_VAP_DISABLE] = hdd_we_dbglog_vap_disable,
5610 [WE_DBGLOG_MODULE_ENABLE] = hdd_we_dbglog_module_enable,
5611 [WE_DBGLOG_MODULE_DISABLE] = hdd_we_dbglog_module_disable,
5612 [WE_DBGLOG_MOD_LOG_LEVEL] = hdd_we_dbglog_mod_log_level,
5613 [WE_DBGLOG_TYPE] = hdd_we_dbglog_type,
5614 [WE_DBGLOG_REPORT_ENABLE] = hdd_we_dbglog_report_enable,
5615 [WE_SET_TXRX_FWSTATS] = hdd_we_set_txrx_fwstats,
5616 [WE_TXRX_FWSTATS_RESET] = hdd_we_txrx_fwstats_reset,
5617 [WE_DUMP_STATS] = hdd_wlan_dump_stats,
5618 [WE_CLEAR_STATS] = hdd_we_clear_stats,
5619 [WE_PPS_PAID_MATCH] = hdd_we_pps_paid_match,
5620 [WE_PPS_GID_MATCH] = hdd_we_pps_gid_match,
5621 [WE_PPS_EARLY_TIM_CLEAR] = hdd_we_pps_early_tim_clear,
5622 [WE_PPS_EARLY_DTIM_CLEAR] = hdd_we_pps_early_dtim_clear,
5623 [WE_PPS_EOF_PAD_DELIM] = hdd_we_pps_eof_pad_delim,
5624 [WE_PPS_MACADDR_MISMATCH] = hdd_we_pps_macaddr_mismatch,
5625 [WE_PPS_DELIM_CRC_FAIL] = hdd_we_pps_delim_crc_fail,
5626 [WE_PPS_GID_NSTS_ZERO] = hdd_we_pps_gid_nsts_zero,
5627 [WE_PPS_RSSI_CHECK] = hdd_we_pps_rssi_check,
5628 [WE_PPS_5G_EBT] = hdd_we_pps_5g_ebt,
5629 [WE_SET_HTSMPS] = hdd_we_set_htsmps,
5630 [WE_SET_QPOWER_MAX_PSPOLL_COUNT] = hdd_we_set_qpower_max_pspoll_count,
5631 [WE_SET_QPOWER_MAX_TX_BEFORE_WAKE] =
5632 hdd_we_set_qpower_max_tx_before_wake,
5633 [WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL] =
5634 hdd_we_set_qpower_spec_pspoll_wake_interval,
5635 [WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL] =
5636 hdd_we_set_qpower_spec_max_spec_nodata_pspoll,
5637 [WE_MCC_CONFIG_LATENCY] = hdd_we_mcc_config_latency,
5638 [WE_MCC_CONFIG_QUOTA] = hdd_we_mcc_config_quota,
5639 [WE_SET_DEBUG_LOG] = hdd_we_set_debug_log,
5640 [WE_SET_EARLY_RX_ADJUST_ENABLE] = hdd_we_set_early_rx_adjust_enable,
5641 [WE_SET_EARLY_RX_TGT_BMISS_NUM] = hdd_we_set_early_rx_tgt_bmiss_num,
5642 [WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE] =
5643 hdd_we_set_early_rx_bmiss_sample_cycle,
5644 [WE_SET_EARLY_RX_SLOP_STEP] = hdd_we_set_early_rx_slop_step,
5645 [WE_SET_EARLY_RX_INIT_SLOP] = hdd_we_set_early_rx_init_slop,
5646 [WE_SET_EARLY_RX_ADJUST_PAUSE] = hdd_we_set_early_rx_adjust_pause,
5647 [WE_SET_EARLY_RX_DRIFT_SAMPLE] = hdd_we_set_early_rx_drift_sample,
5648 [WE_SET_SCAN_DISABLE] = hdd_we_set_scan_disable,
5649 [WE_START_FW_PROFILE] = hdd_we_start_fw_profile,
5650 [WE_SET_CHANNEL] = hdd_we_set_channel,
5651 [WE_SET_CONC_SYSTEM_PREF] = hdd_we_set_conc_system_pref,
5652 [WE_SET_11AX_RATE] = hdd_we_set_11ax_rate,
5653 [WE_SET_DCM] = hdd_we_set_dcm,
5654 [WE_SET_RANGE_EXT] = hdd_we_set_range_ext,
5655 [WE_SET_PDEV_RESET] = hdd_handle_pdev_reset,
5656 [WE_SET_MODULATED_DTIM] = hdd_we_set_modulated_dtim,
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305657#ifdef WLAN_FEATURE_MOTION_DETECTION
5658 [WE_MOTION_DET_START_STOP] = hdd_we_motion_det_start_stop,
5659 [WE_MOTION_DET_BASE_LINE_START_STOP] =
5660 hdd_we_motion_det_base_line_start_stop,
5661#endif /* WLAN_FEATURE_MOTION_DETECTION */
Krishna Reddya50d09f2019-02-04 14:55:06 +05305662 [WE_SET_BTCOEX_MODE] = wlan_hdd_set_btcoex_mode,
5663 [WE_SET_BTCOEX_RSSI_THRESHOLD] = wlan_hdd_set_btcoex_rssi_threshold,
Jeff Johnson3ba27322018-11-13 17:58:28 -08005664};
5665
5666static setint_getnone_fn hdd_get_setint_getnone_cb(int param)
5667{
5668 if (param < 0)
5669 return NULL;
5670
5671 if (param >= QDF_ARRAY_SIZE(setint_getnone_cb))
5672 return NULL;
5673
5674 return setint_getnone_cb[param];
5675}
5676
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005677/**
5678 * iw_setint_getnone() - Generic "set integer" private ioctl handler
5679 * @dev: device upon which the ioctl was received
5680 * @info: ioctl request information
5681 * @wrqu: ioctl request data
5682 * @extra: ioctl extra data
5683 *
5684 * Return: 0 on success, non-zero on error
5685 */
5686static int __iw_setint_getnone(struct net_device *dev,
5687 struct iw_request_info *info,
5688 union iwreq_data *wrqu, char *extra)
5689{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005690 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005691 struct hdd_context *hdd_ctx;
Jeff Johnson3ba27322018-11-13 17:58:28 -08005692 setint_getnone_fn cb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005693 int *value = (int *)extra;
5694 int sub_cmd = value[0];
5695 int set_value = value[1];
5696 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005697
Dustin Brownfdf17c12018-03-14 12:55:34 -07005698 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305699
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005700 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005701 ret = wlan_hdd_validate_context(hdd_ctx);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005702 if (ret)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005703 return ret;
5704
Jeff Johnson441e1f72017-02-07 08:50:49 -08005705 ret = hdd_check_private_wext_control(hdd_ctx, info);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005706 if (ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08005707 return ret;
5708
Jeff Johnson3ba27322018-11-13 17:58:28 -08005709 cb = hdd_get_setint_getnone_cb(sub_cmd);
5710 if (!cb) {
Rajeev Kumard0565362018-03-01 12:02:01 -08005711 hdd_debug("Invalid sub command %d", sub_cmd);
Jeff Johnson3ba27322018-11-13 17:58:28 -08005712 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005713 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005714
Jeff Johnson3ba27322018-11-13 17:58:28 -08005715 ret = cb(adapter, set_value);
5716
Dustin Browne74003f2018-03-14 12:51:58 -07005717 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005718
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005719 return ret;
5720}
5721
5722static int iw_setint_getnone(struct net_device *dev,
5723 struct iw_request_info *info,
5724 union iwreq_data *wrqu,
5725 char *extra)
5726{
Dustin Brown389e5072018-11-08 17:10:01 +05305727 int errno;
5728 struct osif_vdev_sync *vdev_sync;
5729
5730 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5731 if (errno)
5732 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005733
Dustin Brown389e5072018-11-08 17:10:01 +05305734 errno = __iw_setint_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005735
Dustin Brown389e5072018-11-08 17:10:01 +05305736 osif_vdev_sync_op_stop(vdev_sync);
5737
5738 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005739}
5740
5741/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005742 * __iw_setnone_get_threeint() - return three value to up layer.
5743 *
5744 * @dev: pointer of net_device of this wireless card
5745 * @info: meta data about Request sent
5746 * @wrqu: include request info
5747 * @extra: buf used for in/Output
5748 *
5749 * Return: execute result
5750 */
5751static int __iw_setnone_get_threeint(struct net_device *dev,
5752 struct iw_request_info *info,
5753 union iwreq_data *wrqu, char *extra)
5754{
5755 int ret = 0; /* success */
5756 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005757 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005758 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005759
Dustin Brownfdf17c12018-03-14 12:55:34 -07005760 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005761 ret = wlan_hdd_validate_context(hdd_ctx);
5762 if (0 != ret)
5763 return ret;
5764
Jeff Johnson441e1f72017-02-07 08:50:49 -08005765 ret = hdd_check_private_wext_control(hdd_ctx, info);
5766 if (0 != ret)
5767 return ret;
5768
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005769 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005770 switch (value[0]) {
5771 case WE_GET_TSF:
5772 ret = hdd_indicate_tsf(adapter, value, 3);
5773 break;
5774 default:
5775 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5776 break;
5777 }
5778 return ret;
5779}
5780
5781/**
5782 * iw_setnone_get_threeint() - return three value to up layer.
5783 *
5784 * @dev: pointer of net_device of this wireless card
5785 * @info: meta data about Request sent
5786 * @wrqu: include request info
5787 * @extra: buf used for in/Output
5788 *
5789 * Return: execute result
5790 */
5791static int iw_setnone_get_threeint(struct net_device *dev,
5792 struct iw_request_info *info,
5793 union iwreq_data *wrqu, char *extra)
5794{
Dustin Brown389e5072018-11-08 17:10:01 +05305795 int errno;
5796 struct osif_vdev_sync *vdev_sync;
5797
5798 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5799 if (errno)
5800 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005801
Dustin Brown389e5072018-11-08 17:10:01 +05305802 errno = __iw_setnone_get_threeint(dev, info, wrqu, extra);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005803
Dustin Brown389e5072018-11-08 17:10:01 +05305804 osif_vdev_sync_op_stop(vdev_sync);
5805
5806 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005807}
5808
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005809#ifdef WLAN_UNIT_TEST
Dustin Brown7d038e52018-11-29 14:28:13 -08005810typedef uint32_t (*hdd_ut_callback)(void);
5811
5812struct hdd_ut_entry {
5813 const hdd_ut_callback callback;
5814 const char *name;
5815};
5816
5817struct hdd_ut_entry hdd_ut_entries[] = {
5818 { .name = "dsc", .callback = dsc_unit_test },
Dustin Brown05a0658f2019-03-05 11:27:38 -08005819 { .name = "qdf_delayed_work", .callback = qdf_delayed_work_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005820 { .name = "qdf_ht", .callback = qdf_ht_unit_test },
5821 { .name = "qdf_periodic_work",
5822 .callback = qdf_periodic_work_unit_test },
Dustin Brown92acafe2019-02-15 17:17:10 -08005823 { .name = "qdf_ptr_hash", .callback = qdf_ptr_hash_unit_test },
Dustin Brown128e2d02019-02-15 12:59:07 -08005824 { .name = "qdf_slist", .callback = qdf_slist_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005825 { .name = "qdf_talloc", .callback = qdf_talloc_unit_test },
Dustin Brownee733ba2019-03-12 13:31:11 -07005826 { .name = "qdf_tracker", .callback = qdf_tracker_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005827 { .name = "qdf_types", .callback = qdf_types_unit_test },
Dustin Brown7d038e52018-11-29 14:28:13 -08005828};
5829
5830#define hdd_for_each_ut_entry(cursor) \
5831 for (cursor = hdd_ut_entries; \
5832 cursor < hdd_ut_entries + ARRAY_SIZE(hdd_ut_entries); \
5833 cursor++)
5834
5835static struct hdd_ut_entry *hdd_ut_lookup(const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005836{
Dustin Brown7d038e52018-11-29 14:28:13 -08005837 struct hdd_ut_entry *entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005838
Dustin Brown7d038e52018-11-29 14:28:13 -08005839 hdd_for_each_ut_entry(entry) {
5840 if (qdf_str_eq(entry->name, name))
5841 return entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005842 }
5843
Dustin Brown7d038e52018-11-29 14:28:13 -08005844 return NULL;
5845}
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005846
Dustin Brown7d038e52018-11-29 14:28:13 -08005847static uint32_t hdd_ut_single(const struct hdd_ut_entry *entry)
5848{
5849 uint32_t errors;
5850
5851 hdd_nofl_info("START: '%s'", entry->name);
5852
5853 errors = entry->callback();
5854 if (errors)
5855 hdd_nofl_err("FAIL: '%s' with %u errors", entry->name, errors);
5856 else
5857 hdd_nofl_info("PASS: '%s'", entry->name);
5858
5859 return errors;
5860}
5861
5862static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
5863{
5864 struct hdd_ut_entry *entry;
5865 uint32_t errors = 0;
5866
5867 hdd_nofl_info("Unit tests begin");
5868
5869 if (!name || !name[0] || qdf_str_eq(name, "all")) {
5870 hdd_for_each_ut_entry(entry)
5871 errors += hdd_ut_single(entry);
5872 } else {
5873 entry = hdd_ut_lookup(name);
5874 if (entry)
5875 errors += hdd_ut_single(entry);
5876 else
5877 hdd_nofl_err("Unit test '%s' not found", name);
5878 }
5879
5880 hdd_nofl_info("Unit tests complete");
5881
5882 return errors ? -EPERM : 0;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005883}
5884#else
Dustin Brown7d038e52018-11-29 14:28:13 -08005885static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005886{
5887 return -EOPNOTSUPP;
5888}
5889#endif /* WLAN_UNIT_TEST */
5890
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005891/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005892 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5893 * @dev: device upon which the ioctl was received
5894 * @info: ioctl request information
5895 * @wrqu: ioctl request data
5896 * @extra: ioctl extra data
5897 *
5898 * Return: 0 on success, non-zero on error
5899 */
5900static int __iw_setchar_getnone(struct net_device *dev,
5901 struct iw_request_info *info,
5902 union iwreq_data *wrqu, char *extra)
5903{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005904 int sub_cmd;
5905 int ret;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005906 char *str_arg = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005907 struct hdd_adapter *adapter = (netdev_priv(dev));
5908 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005909 struct iw_point s_priv_data;
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005910 bool neighbor_report_req_support = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005911
Dustin Brownfdf17c12018-03-14 12:55:34 -07005912 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005913
Mukul Sharma34777c62015-11-02 20:22:30 +05305914 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005915 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305916 return -EPERM;
5917 }
5918
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005919 ret = wlan_hdd_validate_context(hdd_ctx);
5920 if (0 != ret)
5921 return ret;
5922
Jeff Johnson441e1f72017-02-07 08:50:49 -08005923 ret = hdd_check_private_wext_control(hdd_ctx, info);
5924 if (0 != ret)
5925 return ret;
5926
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005927 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005928 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005929 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005930
5931 /* make sure all params are correctly passed to function */
Jeff Johnsond36fa332019-03-18 13:42:25 -07005932 if ((!s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005933 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005934
5935 sub_cmd = s_priv_data.flags;
5936
5937 /* ODD number is used for set, copy data using copy_from_user */
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005938 str_arg = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005939 s_priv_data.length);
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005940 if (!str_arg) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005941 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005942 return -ENOMEM;
5943 }
5944
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005945 hdd_debug("Received length: %d data: %s",
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005946 s_priv_data.length, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005947
5948 switch (sub_cmd) {
5949 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005950 hdd_debug("ADD_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305951 if (!hdd_add_wowl_ptrn(adapter, str_arg))
5952 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005953 break;
5954 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005955 hdd_debug("DEL_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305956 if (!hdd_del_wowl_ptrn(adapter, str_arg))
5957 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005958 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005959 case WE_NEIGHBOR_REPORT_REQUEST:
5960 {
Jeff Johnson84b34332019-03-09 18:21:35 -08005961 tRrmNeighborReq request;
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08005962 tRrmNeighborRspCallbackInfo callback;
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305963 bool rrm_enabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005964
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305965 ucfg_wlan_mlme_get_rrm_enabled(hdd_ctx->psoc,
5966 &rrm_enabled);
5967
5968 if (rrm_enabled) {
Jeff Johnson84b34332019-03-09 18:21:35 -08005969 request.neighbor_report_offload = false;
5970 request.no_ssid =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005971 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305972 hdd_debug("Neighbor Request ssid present %d",
Jeff Johnson84b34332019-03-09 18:21:35 -08005973 request.no_ssid);
5974 if (!request.no_ssid) {
5975 request.ssid.length =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005976 (s_priv_data.length - 1) >
5977 32 ? 32 : (s_priv_data.length - 1);
Jeff Johnson84b34332019-03-09 18:21:35 -08005978 qdf_mem_copy(request.ssid.ssId,
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005979 str_arg,
Jeff Johnson84b34332019-03-09 18:21:35 -08005980 request.ssid.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005981 }
5982
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305983 /*
5984 * If 11k offload is supported by FW and enabled
5985 * in the ini, set the offload to true
5986 */
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005987 if (QDF_IS_STATUS_ERROR(
5988 ucfg_fwol_is_neighbor_report_req_supported(
5989 hdd_ctx->psoc, &neighbor_report_req_support)))
5990 hdd_err("Neighbor report req bit get fail");
5991
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305992 if (hdd_ctx->config->is_11k_offload_supported &&
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005993 neighbor_report_req_support) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305994 hdd_debug("Neighbor report offloaded to FW");
Jeff Johnson84b34332019-03-09 18:21:35 -08005995 request.neighbor_report_offload = true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305996 }
5997
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08005998 callback.neighborRspCallback = NULL;
5999 callback.neighborRspCallbackContext = NULL;
6000 callback.timeout = 5000; /* 5 seconds */
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306001 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006002 hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006003 adapter->vdev_id,
Jeff Johnson84b34332019-03-09 18:21:35 -08006004 &request,
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006005 &callback);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006006 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006007 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006008 ret = -EINVAL;
6009 }
6010 }
6011 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006012 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08006013 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006014 break;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006015 case WE_UNIT_TEST:
6016 ret = hdd_we_unit_test(hdd_ctx, str_arg);
6017 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006018 default:
6019 {
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006020 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006021 ret = -EINVAL;
6022 break;
6023 }
6024 }
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006025
6026 qdf_mem_free(str_arg);
Dustin Browne74003f2018-03-14 12:51:58 -07006027 hdd_exit();
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006028
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006029 return ret;
6030}
6031
6032static int iw_setchar_getnone(struct net_device *dev,
6033 struct iw_request_info *info,
6034 union iwreq_data *wrqu, char *extra)
6035{
Dustin Brown389e5072018-11-08 17:10:01 +05306036 int errno;
6037 struct osif_vdev_sync *vdev_sync;
6038
6039 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6040 if (errno)
6041 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006042
Dustin Brown389e5072018-11-08 17:10:01 +05306043 errno = __iw_setchar_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006044
Dustin Brown389e5072018-11-08 17:10:01 +05306045 osif_vdev_sync_op_stop(vdev_sync);
6046
6047 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006048}
6049
6050/**
6051 * iw_setnone_getint() - Generic "get integer" private ioctl handler
6052 * @dev: device upon which the ioctl was received
6053 * @info: ioctl request information
6054 * @wrqu: ioctl request data
6055 * @extra: ioctl extra data
6056 *
6057 * Return: 0 on success, non-zero on error
6058 */
6059static int __iw_setnone_getint(struct net_device *dev,
6060 struct iw_request_info *info,
6061 union iwreq_data *wrqu, char *extra)
6062{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006063 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006064 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006065 int *value = (int *)extra;
6066 int ret;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08006067 struct sme_config_params *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006068 struct hdd_context *hdd_ctx;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306069 QDF_STATUS status;
6070 bool bval = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006071
Dustin Brownfdf17c12018-03-14 12:55:34 -07006072 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306073
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006074 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006075 ret = wlan_hdd_validate_context(hdd_ctx);
6076 if (0 != ret)
6077 return ret;
6078
Jeff Johnson441e1f72017-02-07 08:50:49 -08006079 ret = hdd_check_private_wext_control(hdd_ctx, info);
6080 if (0 != ret)
6081 return ret;
6082
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08006083 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6084 if (!sme_config) {
6085 hdd_err("failed to allocate memory for sme_config");
6086 return -ENOMEM;
6087 }
6088
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006089 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006090 switch (value[0]) {
6091 case WE_GET_11D_STATE:
6092 {
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05306093 status = ucfg_mlme_is_11d_enabled(hdd_ctx->psoc, &bval);
6094 if (!QDF_IS_STATUS_SUCCESS(status))
6095 hdd_err("Invalid 11d_enable flag");
6096 *value = bval;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006097 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006098
6099 break;
6100 }
6101
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006102 case WE_GET_WLAN_DBG:
6103 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306104 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006105 *value = 0;
6106 break;
6107 }
6108 case WE_GET_MAX_ASSOC:
6109 {
Dustin Brown05d81302018-09-11 16:49:22 -07006110 if (ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, *value) !=
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306111 QDF_STATUS_SUCCESS) {
6112 hdd_err("CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006113 ret = -EIO;
6114 }
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306115
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006116 break;
6117 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006118
6119 case WE_GET_CONCURRENCY_MODE:
6120 {
Dustin Brown05d81302018-09-11 16:49:22 -07006121 *value = policy_mgr_get_concurrency_mode(hdd_ctx->psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006122
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006123 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006124 break;
6125 }
6126
6127 case WE_GET_NSS:
6128 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006129 sme_get_config_param(mac_handle, sme_config);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306130 status = ucfg_mlme_get_vht_enable2x2(hdd_ctx->psoc, &bval);
6131 if (!QDF_IS_STATUS_SUCCESS(status))
6132 hdd_err("unable to get vht_enable2x2");
6133 *value = (bval == 0) ? 1 : 2;
Dustin Brown05d81302018-09-11 16:49:22 -07006134 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc))
Srinivas Girigowda576b2352017-08-25 14:44:26 -07006135 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006136 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006137 break;
6138 }
6139
6140 case WE_GET_GTX_HT_MCS:
6141 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006142 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006143 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006144 WMI_VDEV_PARAM_GTX_HT_MCS,
6145 GTX_CMD);
6146 break;
6147 }
6148
6149 case WE_GET_GTX_VHT_MCS:
6150 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006151 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006152 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006153 WMI_VDEV_PARAM_GTX_VHT_MCS,
6154 GTX_CMD);
6155 break;
6156 }
6157
6158 case WE_GET_GTX_USRCFG:
6159 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006160 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006161 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006162 WMI_VDEV_PARAM_GTX_USR_CFG,
6163 GTX_CMD);
6164 break;
6165 }
6166
6167 case WE_GET_GTX_THRE:
6168 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006169 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006170 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006171 WMI_VDEV_PARAM_GTX_THRE,
6172 GTX_CMD);
6173 break;
6174 }
6175
6176 case WE_GET_GTX_MARGIN:
6177 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006178 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006179 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006180 WMI_VDEV_PARAM_GTX_MARGIN,
6181 GTX_CMD);
6182 break;
6183 }
6184
6185 case WE_GET_GTX_STEP:
6186 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006187 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006188 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006189 WMI_VDEV_PARAM_GTX_STEP,
6190 GTX_CMD);
6191 break;
6192 }
6193
6194 case WE_GET_GTX_MINTPC:
6195 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006196 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006197 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006198 WMI_VDEV_PARAM_GTX_MINTPC,
6199 GTX_CMD);
6200 break;
6201 }
6202
6203 case WE_GET_GTX_BWMASK:
6204 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006205 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006206 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006207 WMI_VDEV_PARAM_GTX_BW_MASK,
6208 GTX_CMD);
6209 break;
6210 }
6211
6212 case WE_GET_LDPC:
6213 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006214 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006215 break;
6216 }
6217
6218 case WE_GET_TX_STBC:
6219 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006220 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006221 break;
6222 }
6223
6224 case WE_GET_RX_STBC:
6225 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006226 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006227 break;
6228 }
6229
6230 case WE_GET_SHORT_GI:
6231 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006232 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006233 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08006234 WMI_VDEV_PARAM_SGI,
6235 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006236 break;
6237 }
6238
6239 case WE_GET_RTSCTS:
6240 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006241 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006242 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006243 WMI_VDEV_PARAM_ENABLE_RTSCTS,
6244 VDEV_CMD);
6245 break;
6246 }
6247
6248 case WE_GET_CHWIDTH:
6249 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006250 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006251 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006252 WMI_VDEV_PARAM_CHWIDTH,
6253 VDEV_CMD);
6254 break;
6255 }
6256
6257 case WE_GET_ANI_EN_DIS:
6258 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006259 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006260 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006261 WMI_PDEV_PARAM_ANI_ENABLE,
6262 PDEV_CMD);
6263 break;
6264 }
6265
6266 case WE_GET_ANI_POLL_PERIOD:
6267 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006268 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006269 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006270 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
6271 PDEV_CMD);
6272 break;
6273 }
6274
6275 case WE_GET_ANI_LISTEN_PERIOD:
6276 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006277 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006278 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006279 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
6280 PDEV_CMD);
6281 break;
6282 }
6283
6284 case WE_GET_ANI_OFDM_LEVEL:
6285 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006286 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006287 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006288 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
6289 PDEV_CMD);
6290 break;
6291 }
6292
6293 case WE_GET_ANI_CCK_LEVEL:
6294 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006295 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006296 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006297 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
6298 PDEV_CMD);
6299 break;
6300 }
6301
6302 case WE_GET_DYNAMIC_BW:
6303 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006304 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006305 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006306 WMI_PDEV_PARAM_DYNAMIC_BW,
6307 PDEV_CMD);
6308 break;
6309 }
6310
6311 case WE_GET_11N_RATE:
6312 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006313 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006314 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006315 WMI_VDEV_PARAM_FIXED_RATE,
6316 VDEV_CMD);
6317 break;
6318 }
6319
6320 case WE_GET_AMPDU:
6321 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006322 hdd_debug("GET AMPDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006323 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006324 GEN_VDEV_PARAM_AMPDU,
6325 GEN_CMD);
6326 break;
6327 }
6328
6329 case WE_GET_AMSDU:
6330 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006331 hdd_debug("GET AMSDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006332 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006333 GEN_VDEV_PARAM_AMSDU,
6334 GEN_CMD);
6335 break;
6336 }
6337
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006338 case WE_GET_ROAM_SYNCH_DELAY:
6339 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006340 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006341 *value = wma_cli_get_command(adapter->vdev_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006342 GEN_VDEV_ROAM_SYNCH_DELAY,
6343 GEN_CMD);
6344 break;
6345 }
6346
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006347 case WE_GET_TX_CHAINMASK:
6348 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006349 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006350 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006351 WMI_PDEV_PARAM_TX_CHAIN_MASK,
6352 PDEV_CMD);
6353 break;
6354 }
6355
6356 case WE_GET_RX_CHAINMASK:
6357 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006358 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006359 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006360 WMI_PDEV_PARAM_RX_CHAIN_MASK,
6361 PDEV_CMD);
6362 break;
6363 }
6364
6365 case WE_GET_TXPOW_2G:
6366 {
Wu Gao5f764082019-01-04 15:54:38 +08006367 uint8_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006368
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006369 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006370 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006371 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
6372 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006373 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow2g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006374 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006375 break;
6376 }
6377
6378 case WE_GET_TXPOW_5G:
6379 {
Wu Gao5f764082019-01-04 15:54:38 +08006380 uint8_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006381
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006382 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006383 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006384 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
6385 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006386 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow5g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006387 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006388 break;
6389 }
6390
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006391 case WE_GET_PPS_PAID_MATCH:
6392 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006393 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006394 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006395 WMI_VDEV_PPS_PAID_MATCH,
6396 PPS_CMD);
6397 break;
6398 }
6399
6400 case WE_GET_PPS_GID_MATCH:
6401 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006402 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006403 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006404 WMI_VDEV_PPS_GID_MATCH,
6405 PPS_CMD);
6406 break;
6407 }
6408
6409 case WE_GET_PPS_EARLY_TIM_CLEAR:
6410 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006411 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006412 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006413 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
6414 PPS_CMD);
6415 break;
6416 }
6417
6418 case WE_GET_PPS_EARLY_DTIM_CLEAR:
6419 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006420 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006421 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006422 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
6423 PPS_CMD);
6424 break;
6425 }
6426
6427 case WE_GET_PPS_EOF_PAD_DELIM:
6428 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006429 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006430 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006431 WMI_VDEV_PPS_EOF_PAD_DELIM,
6432 PPS_CMD);
6433 break;
6434 }
6435
6436 case WE_GET_PPS_MACADDR_MISMATCH:
6437 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006438 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006439 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006440 WMI_VDEV_PPS_MACADDR_MISMATCH,
6441 PPS_CMD);
6442 break;
6443 }
6444
6445 case WE_GET_PPS_DELIM_CRC_FAIL:
6446 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006447 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006448 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006449 WMI_VDEV_PPS_DELIM_CRC_FAIL,
6450 PPS_CMD);
6451 break;
6452 }
6453
6454 case WE_GET_PPS_GID_NSTS_ZERO:
6455 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006456 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006457 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006458 WMI_VDEV_PPS_GID_NSTS_ZERO,
6459 PPS_CMD);
6460 break;
6461 }
6462
6463 case WE_GET_PPS_RSSI_CHECK:
6464 {
6465
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006466 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006467 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006468 WMI_VDEV_PPS_RSSI_CHECK,
6469 PPS_CMD);
6470 break;
6471 }
6472
6473 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
6474 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006475 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006476 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006477 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
6478 QPOWER_CMD);
6479 break;
6480 }
6481
6482 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
6483 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006484 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006485 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006486 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
6487 QPOWER_CMD);
6488 break;
6489 }
6490
6491 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
6492 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006493 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006494 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006495 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
6496 QPOWER_CMD);
6497 break;
6498 }
6499
6500 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
6501 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006502 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006503 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006504 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
6505 QPOWER_CMD);
6506 break;
6507 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006508 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006509 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006510 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006511 case WE_GET_TEMPERATURE:
6512 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006513 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006514 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006515 break;
6516 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006517 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006518 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006519 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006520 WMI_VDEV_PARAM_HE_DCM,
6521 VDEV_CMD);
6522 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006523 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006524 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006525 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006526 WMI_VDEV_PARAM_HE_RANGE_EXT,
6527 VDEV_CMD);
6528 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006529 default:
6530 {
Jeff Johnson99bac312016-06-28 10:38:18 -07006531 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006532 value[0]);
6533 break;
6534 }
6535 }
Dustin Browne74003f2018-03-14 12:51:58 -07006536 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306537 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006538 return ret;
6539}
6540
6541static int iw_setnone_getint(struct net_device *dev,
6542 struct iw_request_info *info,
6543 union iwreq_data *wrqu, char *extra)
6544{
Dustin Brown389e5072018-11-08 17:10:01 +05306545 int errno;
6546 struct osif_vdev_sync *vdev_sync;
6547
6548 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6549 if (errno)
6550 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006551
Dustin Brown389e5072018-11-08 17:10:01 +05306552 errno = __iw_setnone_getint(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006553
Dustin Brown389e5072018-11-08 17:10:01 +05306554 osif_vdev_sync_op_stop(vdev_sync);
6555
6556 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006557}
6558
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306559static int hdd_set_fwtest(int argc, int cmd, int value)
6560{
6561 struct set_fwtest_params *fw_test;
6562
6563 /* check for max number of arguments */
6564 if (argc > (WMA_MAX_NUM_ARGS) ||
6565 argc != HDD_FWTEST_PARAMS) {
6566 hdd_err("Too Many args %d", argc);
6567 return -EINVAL;
6568 }
6569 /*
6570 * check if number of arguments are 3 then, check
6571 * then set the default value for sounding interval.
6572 */
6573 if (HDD_FWTEST_PARAMS == argc) {
6574 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
6575 value = HDD_FWTEST_SU_DEFAULT_VALUE;
6576 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6577 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6578 }
6579 /* check sounding interval value should not exceed to max */
6580 if (value > HDD_FWTEST_MAX_VALUE) {
6581 hdd_err("Invalid arguments value should not exceed max: %d",
6582 value);
6583 return -EINVAL;
6584 }
6585 fw_test = qdf_mem_malloc(sizeof(*fw_test));
Jeff Johnsond36fa332019-03-18 13:42:25 -07006586 if (!fw_test) {
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306587 hdd_err("qdf_mem_malloc failed for fw_test");
6588 return -ENOMEM;
6589 }
6590 fw_test->arg = cmd;
6591 fw_test->value = value;
6592 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6593 qdf_mem_free(fw_test);
6594 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6595 return -EINVAL;
6596 }
6597 return 0;
6598}
6599
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006600/**
6601 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6602 * @dev: device upon which the ioctl was received
6603 * @info: ioctl request information
6604 * @wrqu: ioctl request data
6605 * @extra: ioctl extra data
6606 *
6607 * Return: 0 on success, non-zero on error
6608 */
6609static int __iw_set_three_ints_getnone(struct net_device *dev,
6610 struct iw_request_info *info,
6611 union iwreq_data *wrqu, char *extra)
6612{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006613 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006614 int *value = (int *)extra;
6615 int sub_cmd = value[0];
6616 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08006617 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006618 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08006619 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006620
Dustin Brownfdf17c12018-03-14 12:55:34 -07006621 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306622
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006623 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006624 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006625 return -EPERM;
6626 }
6627
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006628 ret = wlan_hdd_validate_context(hdd_ctx);
6629 if (0 != ret)
6630 return ret;
6631
Jeff Johnson441e1f72017-02-07 08:50:49 -08006632 ret = hdd_check_private_wext_control(hdd_ctx, info);
6633 if (0 != ret)
6634 return ret;
6635
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006636 switch (sub_cmd) {
6637
6638 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006639 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6640 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006641 break;
6642 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306643 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006644 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306645
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006646 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6647 hdd_debug("Ioctl to set dual mac scan config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08006648 status =
6649 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
6650 &dual_mac_feature);
6651 if (status != QDF_STATUS_SUCCESS)
6652 hdd_err("can't get dual mac feature val, use def");
6653 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006654 hdd_err("Dual mac feature is disabled from INI");
6655 return -EPERM;
6656 }
6657 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Dustin Brown05d81302018-09-11 16:49:22 -07006658 policy_mgr_set_dual_mac_scan_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006659 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006660 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306661 case WE_SET_FW_TEST:
6662 {
6663 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6664 if (ret) {
6665 hdd_err("Not able to set fwtest %d", ret);
6666 return ret;
6667 }
6668 }
6669 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006670 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006671 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006672 break;
6673
6674 }
Dustin Browne74003f2018-03-14 12:51:58 -07006675 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006676 return ret;
6677}
6678
6679int iw_set_three_ints_getnone(struct net_device *dev,
6680 struct iw_request_info *info,
6681 union iwreq_data *wrqu, char *extra)
6682{
Dustin Brown389e5072018-11-08 17:10:01 +05306683 int errno;
6684 struct osif_vdev_sync *vdev_sync;
6685
6686 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6687 if (errno)
6688 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006689
Dustin Brown389e5072018-11-08 17:10:01 +05306690 errno = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006691
Dustin Brown389e5072018-11-08 17:10:01 +05306692 osif_vdev_sync_op_stop(vdev_sync);
6693
6694 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006695}
6696
6697/**
6698 * hdd_connection_state_string() - Get connection state string
6699 * @connection_state: enum to be converted to a string
6700 *
6701 * Return: the string equivalent of @connection_state
6702 */
6703static const char *
6704hdd_connection_state_string(eConnectionState connection_state)
6705{
6706 switch (connection_state) {
6707 CASE_RETURN_STRING(eConnectionState_NotConnected);
6708 CASE_RETURN_STRING(eConnectionState_Connecting);
6709 CASE_RETURN_STRING(eConnectionState_Associated);
6710 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6711 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6712 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6713 default:
6714 return "UNKNOWN";
6715 }
6716}
6717
Naveen Rawat910726a2017-03-06 11:42:51 -08006718#if defined(FEATURE_OEM_DATA_SUPPORT)
6719/**
6720 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6721 * wifi_pos api to get oem data caps
6722 * @dev: net device upon which the request was received
6723 * @info: ioctl request information
6724 * @wrqu: ioctl request data
6725 * @extra: ioctl data payload
6726 *
6727 * Return: 0 for success, negative errno value on failure
6728 */
6729static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6730 struct iw_request_info *info,
6731 union iwreq_data *wrqu, char *extra)
6732{
6733 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6734}
6735#elif defined(WIFI_POS_CONVERGED)
6736static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6737 struct iw_request_info *info,
6738 union iwreq_data *wrqu, char *extra)
6739{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006740 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006741 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006742
Dustin Brown05d81302018-09-11 16:49:22 -07006743 return os_if_wifi_pos_populate_caps(hdd_ctx->psoc,
Naveen Rawat910726a2017-03-06 11:42:51 -08006744 (struct wifi_pos_driver_caps *)extra);
6745}
6746#else
6747static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6748 struct iw_request_info *info,
6749 union iwreq_data *wrqu, char *extra)
6750{
6751 return -ENOTSUPP;
6752}
6753#endif
6754
Krunal Soni5e483782018-10-25 15:42:44 -07006755#ifdef WLAN_UNIT_TEST
6756static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6757 struct hdd_adapter *adapter,
6758 char *extra)
6759{
6760 QDF_STATUS status;
6761
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006762 status = sme_get_sta_cxn_info(hdd_ctx->mac_handle, adapter->vdev_id,
Krunal Soni5e483782018-10-25 15:42:44 -07006763 extra, WE_MAX_STR_LEN);
6764 if (status != QDF_STATUS_SUCCESS)
6765 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6766 "\nNo active connection");
6767
6768 return 0;
6769}
6770#else
6771static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6772 struct hdd_adapter *adapter,
6773 char *extra)
6774{
6775 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6776 "\nNot supported");
6777 return -ENOTSUPP;
6778}
6779#endif
6780
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006781/**
6782 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6783 * @dev: device upon which the ioctl was received
6784 * @info: ioctl request information
6785 * @wrqu: ioctl request data
6786 * @extra: ioctl extra data
6787 *
6788 * Return: 0 on success, non-zero on error
6789 */
6790static int __iw_get_char_setnone(struct net_device *dev,
6791 struct iw_request_info *info,
6792 union iwreq_data *wrqu, char *extra)
6793{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006794 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006795 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006796 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006797 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006798 int ret;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306799 QDF_STATUS status;
6800 uint8_t value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006801
Dustin Brownfdf17c12018-03-14 12:55:34 -07006802 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306803
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006804 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006805 ret = wlan_hdd_validate_context(hdd_ctx);
6806 if (0 != ret)
6807 return ret;
6808
Jeff Johnson441e1f72017-02-07 08:50:49 -08006809 ret = hdd_check_private_wext_control(hdd_ctx, info);
6810 if (0 != ret)
6811 return ret;
6812
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006813 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006814 switch (sub_cmd) {
6815 case WE_WLAN_VERSION:
6816 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006817 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6818 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006819 break;
6820 }
6821
6822 case WE_GET_STATS:
6823 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006824 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006825 extra, WE_MAX_STR_LEN);
6826 break;
6827 }
6828
Dustin Brownd9322482017-01-09 12:46:03 -08006829 case WE_GET_SUSPEND_RESUME_STATS:
6830 {
6831 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6832 WE_MAX_STR_LEN);
6833 if (ret >= 0) {
6834 wrqu->data.length = ret;
6835 ret = 0;
6836 }
6837
6838 break;
6839 }
6840
Govind Singha471e5e2015-10-12 17:11:14 +05306841 case WE_LIST_FW_PROFILE:
6842 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6843 extra, WE_MAX_STR_LEN);
6844 break;
6845
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006846 /* The case prints the current state of the HDD, SME, CSR, PE,
6847 * TL it can be extended for WDI Global State as well. And
6848 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6849 * and P2P_GO have not been added as of now.
6850 */
6851 case WE_GET_STATES:
6852 {
6853 int buf = 0, len = 0;
6854 int adapter_num = 0;
6855 int count = 0, check = 1;
6856
Jeff Johnsond377dce2017-10-04 10:32:42 -07006857 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006858
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006859 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006860 struct hdd_adapter *stat_adapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006861
6862 /* Print wlan0 or p2p0 states based on the adapter_num
6863 * by using the correct adapter
6864 */
6865 while (adapter_num < 2) {
6866 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006867 stat_adapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006868 buf =
6869 scnprintf(extra + len,
6870 WE_MAX_STR_LEN - len,
6871 "\n\n wlan0 States:-");
6872 len += buf;
6873 } else if (P2P_ADAPTER == adapter_num) {
6874 buf =
6875 scnprintf(extra + len,
6876 WE_MAX_STR_LEN - len,
6877 "\n\n p2p0 States:-");
6878 len += buf;
6879
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006880 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006881 buf =
6882 scnprintf(extra + len,
6883 WE_MAX_STR_LEN -
6884 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006885 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006886 len += buf;
6887 break;
6888 }
6889
6890 /* Printing p2p0 states only in the
6891 * case when the device is configured
6892 * as a p2p_client
6893 */
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006894 stat_adapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006895 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006896 QDF_P2P_CLIENT_MODE);
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006897 if (!stat_adapter) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006898 buf =
6899 scnprintf(extra + len,
6900 WE_MAX_STR_LEN -
6901 len,
6902 "\n Device not configured as P2P_CLIENT.");
6903 len += buf;
6904 break;
6905 }
6906 }
6907
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006908 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006909 buf = scnprintf(extra + len,
6910 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006911 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006912 len += buf;
6913 break;
6914 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006915 sta_ctx =
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006916 WLAN_HDD_GET_STATION_CTX_PTR(stat_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006917
6918
6919 buf =
6920 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6921 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006922 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006923 "\n Neighbour Roam State - %s"
6924 "\n CSR State - %s"
6925 "\n CSR Substate - %s",
6926 hdd_connection_state_string
Jeff Johnsone7951512019-02-27 10:02:51 -08006927 (sta_ctx->conn_info.conn_state),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006928 mac_trace_get_neighbour_roam_state
6929 (sme_get_neighbor_roam_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006930 (mac_handle, stat_adapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006931 mac_trace_getcsr_roam_state
6932 (sme_get_current_roam_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006933 (mac_handle, stat_adapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006934 mac_trace_getcsr_roam_sub_state
6935 (sme_get_current_roam_sub_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006936 (mac_handle, stat_adapter->vdev_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006937 );
6938 len += buf;
6939 adapter_num++;
6940 }
6941
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006942 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006943 /* Printing Lim State starting with global lim states */
6944 buf =
6945 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006946 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006947 "\n Global Sme State - %s "
6948 "\n Global mlm State - %s " "\n",
6949 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006950 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006951 mac_trace_get_lim_mlm_state
Jeff Johnson71d465a2018-12-05 11:13:30 -08006952 (sme_get_lim_mlm_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006953 );
6954 len += buf;
6955
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006956 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006957 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006958 buf =
6959 scnprintf(extra + len,
6960 WE_MAX_STR_LEN -
6961 len,
6962 "\n Lim Valid Session %d:-"
6963 "\n PE Sme State - %s "
6964 "\n PE Mlm State - %s "
6965 "\n", check,
6966 mac_trace_get_lim_sme_state
6967 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006968 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006969 mac_trace_get_lim_mlm_state
6970 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006971 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006972 );
6973
6974 len += buf;
6975 check++;
6976 }
6977 count++;
6978 }
6979 }
6980
6981 wrqu->data.length = strlen(extra) + 1;
6982 break;
6983 }
6984
6985 case WE_GET_CFG:
6986 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006987 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006988 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006989 extra,
6990 QCSAP_IOCTL_MAX_STR_LEN);
6991 wrqu->data.length = strlen(extra) + 1;
6992 break;
6993 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006994 case WE_GET_RSSI:
6995 {
6996 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006997
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006998 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006999 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
7000 wrqu->data.length = strlen(extra) + 1;
7001 break;
7002 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007003
7004 case WE_GET_WMM_STATUS:
7005 {
7006 snprintf(extra, WE_MAX_STR_LEN,
7007 "\nDir: 0=up, 1=down, 3=both\n"
7008 "|------------------------|\n"
7009 "|AC | ACM |Admitted| Dir |\n"
7010 "|------------------------|\n"
7011 "|VO | %d | %3s | %d |\n"
7012 "|VI | %d | %3s | %d |\n"
7013 "|BE | %d | %3s | %d |\n"
7014 "|BK | %d | %3s | %d |\n"
7015 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007016 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007017 ac_status[SME_AC_VO].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007018 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007019 ac_status[SME_AC_VO].
Jeff Johnsona5548972019-03-09 14:22:18 -08007020 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007021 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007022 ac_status[SME_AC_VO].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007023 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007024 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007025 ac_status[SME_AC_VI].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007026 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007027 ac_status[SME_AC_VI].
Jeff Johnsona5548972019-03-09 14:22:18 -08007028 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007029 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007030 ac_status[SME_AC_VI].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007031 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007032 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007033 ac_status[SME_AC_BE].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007034 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007035 ac_status[SME_AC_BE].
Jeff Johnsona5548972019-03-09 14:22:18 -08007036 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007037 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007038 ac_status[SME_AC_BE].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007039 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007040 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007041 ac_status[SME_AC_BK].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007042 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007043 ac_status[SME_AC_BK].
Jeff Johnsona5548972019-03-09 14:22:18 -08007044 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007045 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007046 ac_status[SME_AC_BK].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007047 ts_info.direction);
7048
7049 wrqu->data.length = strlen(extra) + 1;
7050 break;
7051 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07007052
7053 case WE_GET_BA_AGEING_TIMEOUT:
7054 {
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -07007055 uint32_t i;
7056 enum qca_wlan_ac_type duration[QCA_WLAN_AC_ALL];
Krunal Soni6c3859f2018-06-01 19:57:40 -07007057 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
7058
7059 if (!soc) {
7060 hdd_err("Invalid SOC handle");
7061 break;
7062 }
7063
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -07007064 for (i = 0; i < QCA_WLAN_AC_ALL; i++)
Krunal Soni6c3859f2018-06-01 19:57:40 -07007065 cdp_get_ba_timeout(soc, i, &duration[i]);
7066
7067 snprintf(extra, WE_MAX_STR_LEN,
7068 "\n|------------------------------|\n"
7069 "|AC | BA aging timeout duration |\n"
7070 "|--------------------------------|\n"
7071 "|VO | %d |\n"
7072 "|VI | %d |\n"
Krunal Soni6c3859f2018-06-01 19:57:40 -07007073 "|BK | %d |\n"
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -07007074 "|BE | %d |\n"
Krunal Soni6c3859f2018-06-01 19:57:40 -07007075 "|--------------------------------|\n",
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -07007076 duration[QCA_WLAN_AC_VO], duration[QCA_WLAN_AC_VI],
7077 duration[QCA_WLAN_AC_BK], duration[QCA_WLAN_AC_BE]);
Krunal Soni6c3859f2018-06-01 19:57:40 -07007078
7079 wrqu->data.length = strlen(extra) + 1;
7080 break;
7081 }
7082
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007083 case WE_GET_CHANNEL_LIST:
7084 {
Qun Zhanga055e9c2019-06-21 17:13:31 +08007085 if (0 !=
7086 iw_get_channel_list_with_cc(dev, mac_handle,
7087 info, wrqu, extra))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007088 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007089 break;
7090 }
7091#ifdef FEATURE_WLAN_TDLS
7092 case WE_GET_TDLS_PEERS:
7093 {
7094 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007095 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007096 WE_MAX_STR_LEN) + 1;
7097 break;
7098 }
7099#endif
7100#ifdef WLAN_FEATURE_11W
7101 case WE_GET_11W_INFO:
7102 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007103 struct csr_roam_profile *roam_profile =
7104 hdd_roam_profile(adapter);
7105
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007106 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007107 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007108
7109 snprintf(extra, WE_MAX_STR_LEN,
7110 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
7111 "\n Number of Unprotected Disassocs %d"
7112 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007113 roam_profile->BSSIDs.bssid->bytes[0],
7114 roam_profile->BSSIDs.bssid->bytes[1],
7115 roam_profile->BSSIDs.bssid->bytes[2],
7116 roam_profile->BSSIDs.bssid->bytes[3],
7117 roam_profile->BSSIDs.bssid->bytes[4],
7118 roam_profile->BSSIDs.bssid->bytes[5],
7119 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07007120 adapter->hdd_stats.hdd_pmf_stats.
7121 num_unprot_disassoc_rx,
7122 adapter->hdd_stats.hdd_pmf_stats.
7123 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007124
7125 wrqu->data.length = strlen(extra) + 1;
7126 break;
7127 }
7128#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007129 case WE_GET_IBSS_STA_INFO:
7130 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07007131 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007132 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007133 int idx = 0;
7134 int length = 0, buf = 0;
7135
Naveen Rawatc45d1622016-07-05 12:20:09 -07007136 for (idx = 0; idx < MAX_PEERS; idx++) {
Sourav Mohapatraa3cf12a2019-08-19 15:40:49 +05307137 if (!hdd_is_valid_mac_address(
7138 sta_ctx->conn_info.peer_macaddr[idx].bytes))
7139 continue;
7140
7141 buf = snprintf
7142 ((extra + length),
7143 WE_MAX_STR_LEN - length,
7144 "\n" QDF_MAC_ADDR_STR "\n",
7145 sta_ctx->conn_info.
7146 peer_macaddr[idx].bytes[0],
7147 sta_ctx->conn_info.
7148 peer_macaddr[idx].bytes[1],
7149 sta_ctx->conn_info.
7150 peer_macaddr[idx].bytes[2],
7151 sta_ctx->conn_info.
7152 peer_macaddr[idx].bytes[3],
7153 sta_ctx->conn_info.
7154 peer_macaddr[idx].bytes[4],
7155 sta_ctx->conn_info.
7156 peer_macaddr[idx].bytes[5]
7157 );
7158 length += buf;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007159 }
7160 wrqu->data.length = strlen(extra) + 1;
7161 break;
7162 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007163 case WE_GET_PHYMODE:
7164 {
7165 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007166 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007167 eCsrPhyMode phymode;
Jeff Johnsondbae0172019-03-09 17:01:56 -08007168 enum band_info current_band;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08007169 struct sme_config_params *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007170
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007171 sme_config = qdf_mem_malloc(sizeof(*sme_config));
7172 if (!sme_config) {
7173 hdd_err("Out of memory");
7174 ret = -ENOMEM;
7175 break;
7176 }
7177
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007178 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007179 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Jeff Johnsone94ccd02019-04-02 15:02:56 -07007180 sme_config->csr_config.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007181 ch_bond24 = true;
7182
7183 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Jeff Johnsone94ccd02019-04-02 15:02:56 -07007184 sme_config->csr_config.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007185 ch_bond5g = true;
7186
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007187 qdf_mem_free(sme_config);
7188
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007189 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307190 if ((QDF_STATUS_SUCCESS !=
Harprit Chhabada5dff30e2019-03-12 17:56:45 -07007191 ucfg_reg_get_band(hddctx->pdev, &current_band))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007192 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007193 return -EIO;
7194 }
7195
7196 switch (phymode) {
7197 case eCSR_DOT11_MODE_AUTO:
7198 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
7199 break;
7200 case eCSR_DOT11_MODE_11n:
7201 case eCSR_DOT11_MODE_11n_ONLY:
Jeff Johnsondbae0172019-03-09 17:01:56 -08007202 if (current_band == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007203 if (ch_bond24)
7204 snprintf(extra, WE_MAX_STR_LEN,
7205 "11NGHT40");
7206 else
7207 snprintf(extra, WE_MAX_STR_LEN,
7208 "11NGHT20");
Jeff Johnsondbae0172019-03-09 17:01:56 -08007209 } else if (current_band == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007210 if (ch_bond5g)
7211 snprintf(extra, WE_MAX_STR_LEN,
7212 "11NAHT40");
7213 else
7214 snprintf(extra, WE_MAX_STR_LEN,
7215 "11NAHT20");
7216 } else {
7217 snprintf(extra, WE_MAX_STR_LEN, "11N");
7218 }
7219 break;
7220 case eCSR_DOT11_MODE_abg:
7221 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
7222 break;
7223 case eCSR_DOT11_MODE_11a:
7224 snprintf(extra, WE_MAX_STR_LEN, "11A");
7225 break;
7226 case eCSR_DOT11_MODE_11b:
7227 case eCSR_DOT11_MODE_11b_ONLY:
7228 snprintf(extra, WE_MAX_STR_LEN, "11B");
7229 break;
7230 case eCSR_DOT11_MODE_11g:
7231 case eCSR_DOT11_MODE_11g_ONLY:
7232 snprintf(extra, WE_MAX_STR_LEN, "11G");
7233 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007234 case eCSR_DOT11_MODE_11ac:
7235 case eCSR_DOT11_MODE_11ac_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307236 status =
7237 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7238 &value);
7239 if (!QDF_IS_STATUS_SUCCESS(status))
7240 hdd_err("Failed to set channel_width");
7241 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007242 snprintf(extra, WE_MAX_STR_LEN,
7243 "11ACVHT20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307244 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007245 snprintf(extra, WE_MAX_STR_LEN,
7246 "11ACVHT40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307247 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007248 snprintf(extra, WE_MAX_STR_LEN,
7249 "11ACVHT80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307250 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007251 snprintf(extra, WE_MAX_STR_LEN,
7252 "11ACVHT160");
7253 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007254 case eCSR_DOT11_MODE_11ax:
7255 case eCSR_DOT11_MODE_11ax_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307256 status =
7257 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7258 &value);
7259 if (!QDF_IS_STATUS_SUCCESS(status))
7260 hdd_err("Failed to set channel_width");
7261
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007262 /* currently using vhtChannelWidth */
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307263 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007264 snprintf(extra, WE_MAX_STR_LEN,
7265 "11AX_HE_20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307266 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007267 snprintf(extra, WE_MAX_STR_LEN,
7268 "11AX_HE_40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307269 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007270 snprintf(extra, WE_MAX_STR_LEN,
7271 "11AX_HE_80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307272 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007273 snprintf(extra, WE_MAX_STR_LEN,
7274 "11AX_HE_160");
7275 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007276 }
7277
7278 wrqu->data.length = strlen(extra) + 1;
7279 break;
7280 }
7281
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007282 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08007283 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007284 case WE_GET_SNR:
7285 {
7286 int8_t s7snr = 0;
7287 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007288 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07007289 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007290
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007291 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007292 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307293 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007294 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307295
Jeff Johnsond377dce2017-10-04 10:32:42 -07007296 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsona8fef4e2019-03-11 14:38:49 -07007297 if (!hdd_ctx->config->enable_snr_monitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007298 eConnectionState_Associated !=
Jeff Johnsone7951512019-02-27 10:02:51 -08007299 sta_ctx->conn_info.conn_state) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007300 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsona8fef4e2019-03-11 14:38:49 -07007301 hdd_ctx->config->enable_snr_monitoring,
Jeff Johnsone7951512019-02-27 10:02:51 -08007302 sta_ctx->conn_info.conn_state);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007303 return -ENONET;
7304 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007305 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007306 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
7307 wrqu->data.length = strlen(extra) + 1;
7308 break;
7309 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007310
Krunal Soni5e483782018-10-25 15:42:44 -07007311 case WE_GET_STA_CXN_INFO:
7312 ret = hdd_get_sta_cxn_info(hdd_ctx, adapter, extra);
7313 wrqu->data.length = strlen(extra) + 1;
7314 break;
7315
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007316 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007317 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007318 break;
7319 }
Dustin Brownd9322482017-01-09 12:46:03 -08007320
Dustin Browne74003f2018-03-14 12:51:58 -07007321 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08007322 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007323}
7324
7325static int iw_get_char_setnone(struct net_device *dev,
7326 struct iw_request_info *info,
7327 union iwreq_data *wrqu, char *extra)
7328{
Dustin Brown389e5072018-11-08 17:10:01 +05307329 int errno;
7330 struct osif_vdev_sync *vdev_sync;
7331
7332 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7333 if (errno)
7334 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007335
Dustin Brown389e5072018-11-08 17:10:01 +05307336 errno = __iw_get_char_setnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007337
Dustin Brown389e5072018-11-08 17:10:01 +05307338 osif_vdev_sync_op_stop(vdev_sync);
7339
7340 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007341}
7342
7343/**
7344 * iw_setnone_getnone() - Generic "action" private ioctl handler
7345 * @dev: device upon which the ioctl was received
7346 * @info: ioctl request information
7347 * @wrqu: ioctl request data
7348 * @extra: ioctl extra data
7349 *
7350 * Return: 0 on success, non-zero on error
7351 */
7352static int __iw_setnone_getnone(struct net_device *dev,
7353 struct iw_request_info *info,
7354 union iwreq_data *wrqu, char *extra)
7355{
Jeff Johnson3d278b02017-08-29 14:17:47 -07007356 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007357 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007358 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007359 int ret;
7360 int sub_cmd;
7361
Dustin Brownfdf17c12018-03-14 12:55:34 -07007362 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307363
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007364 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007365 ret = wlan_hdd_validate_context(hdd_ctx);
7366 if (0 != ret)
7367 return ret;
7368
Jeff Johnson441e1f72017-02-07 08:50:49 -08007369 ret = hdd_check_private_wext_control(hdd_ctx, info);
7370 if (0 != ret)
7371 return ret;
7372
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007373#ifdef CONFIG_COMPAT
7374 /* this ioctl is a special case where a sub-ioctl is used and both
7375 * the number of get and set args is 0. in this specific case the
7376 * logic in iwpriv places the sub_cmd in the data.flags portion of
7377 * the iwreq. unfortunately the location of this field will be
7378 * different between 32-bit and 64-bit userspace, and the standard
7379 * compat support in the kernel does not handle this case. so we
7380 * need to explicitly handle it here.
7381 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07007382 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007383 struct compat_iw_point *compat_iw_point =
7384 (struct compat_iw_point *)&wrqu->data;
7385 sub_cmd = compat_iw_point->flags;
7386 } else {
7387 sub_cmd = wrqu->data.flags;
7388 }
7389#else
7390 sub_cmd = wrqu->data.flags;
7391#endif
7392
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007393 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007394 switch (sub_cmd) {
Govind Singha471e5e2015-10-12 17:11:14 +05307395 case WE_GET_FW_PROFILE_DATA:
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007396 ret = wma_cli_set_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05307397 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
7398 0, DBG_CMD);
7399 break;
7400
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007401 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007402 hdd_wlan_get_ibss_peer_info_all(adapter);
7403 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007404
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007405 case WE_SET_REASSOC_TRIGGER:
7406 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07007407 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307408 tSirMacAddr bssid;
Jeff Johnson29c78672019-02-26 21:05:53 -08007409 uint32_t roam_id = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307410 uint8_t operating_ch =
Jingxiang Gece7c5472019-07-23 16:19:23 +08007411 wlan_reg_freq_to_chan(
7412 hdd_ctx->pdev,
Jingxiang Geae80dc62019-08-13 17:32:22 +08007413 adapter->session.station.conn_info.chan_freq);
Jeff Johnson9ff16952019-02-26 20:58:44 -08007414 tCsrRoamModifyProfileFields mod_fields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007415
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007416 sme_get_modify_profile_fields(mac_handle, adapter->vdev_id,
Jeff Johnson9ff16952019-02-26 20:58:44 -08007417 &mod_fields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307418 if (roaming_offload_enabled(hdd_ctx)) {
7419 qdf_mem_copy(bssid,
Jeff Johnsone04b6992019-02-27 14:06:55 -08007420 &adapter->session.station.conn_info.bssid,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307421 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08007422 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307423 bssid, operating_ch);
7424 } else {
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007425 sme_roam_reassoc(mac_handle, adapter->vdev_id,
Jeff Johnson29c78672019-02-26 21:05:53 -08007426 NULL, mod_fields, &roam_id, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307427 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007428 return 0;
7429 }
7430
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007431 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007432 /*
7433 * 1.OBSS Scan is mandatory while operating in 2.4GHz
7434 * 2.OBSS scan is stopped by Firmware during the disassociation
7435 * 3.OBSS stop comamnd is added for debugging purpose
7436 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007437 if (!mac_handle) {
7438 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007439 return -EINVAL;
7440 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007441 sme_ht40_stop_obss_scan(mac_handle, adapter->vdev_id);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007442 break;
7443
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007444 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007445 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007446 break;
7447 }
Dustin Browne74003f2018-03-14 12:51:58 -07007448 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007449 return ret;
7450}
7451
7452static int iw_setnone_getnone(struct net_device *dev,
7453 struct iw_request_info *info,
7454 union iwreq_data *wrqu, char *extra)
7455{
Dustin Brown389e5072018-11-08 17:10:01 +05307456 int errno;
7457 struct osif_vdev_sync *vdev_sync;
7458
7459 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7460 if (errno)
7461 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007462
Dustin Brown389e5072018-11-08 17:10:01 +05307463 errno = __iw_setnone_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007464
Dustin Brown389e5072018-11-08 17:10:01 +05307465 osif_vdev_sync_op_stop(vdev_sync);
7466
7467 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007468}
7469
Krunal Sonia6e505b2017-01-12 12:25:18 -08007470#ifdef MPC_UT_FRAMEWORK
Liangwei Dong509c3472018-05-30 07:05:59 -04007471static void
7472hdd_policy_mgr_set_hw_mode_ut(struct hdd_context *hdd_ctx,
7473 struct hdd_adapter *adapter, int cmd)
7474{
7475 enum hw_mode_ss_config mac0_ss;
7476 enum hw_mode_bandwidth mac0_bw;
7477 enum hw_mode_ss_config mac1_ss;
7478 enum hw_mode_bandwidth mac1_bw;
7479 enum hw_mode_mac_band_cap mac0_band_cap;
7480 enum hw_mode_dbs_capab dbs;
7481
7482 switch (cmd) {
7483 case 0:
7484 hdd_debug("set hw mode for single mac");
7485 mac0_ss = HW_MODE_SS_2x2;
7486 mac0_bw = HW_MODE_80_MHZ;
7487 mac1_ss = HW_MODE_SS_0x0;
7488 mac1_bw = HW_MODE_BW_NONE;
7489 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7490 dbs = HW_MODE_DBS_NONE;
7491 break;
7492 case 1:
7493 hdd_debug("set hw mode for dual mac");
7494 mac0_ss = HW_MODE_SS_1x1;
7495 mac0_bw = HW_MODE_80_MHZ;
7496 mac1_ss = HW_MODE_SS_1x1;
7497 mac1_bw = HW_MODE_40_MHZ;
7498 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7499 dbs = HW_MODE_DBS;
7500 break;
7501 case 2:
7502 hdd_debug("set hw mode for 2x2 5g + 1x1 2g");
7503 mac0_ss = HW_MODE_SS_2x2;
7504 mac0_bw = HW_MODE_80_MHZ;
7505 mac1_ss = HW_MODE_SS_1x1;
7506 mac1_bw = HW_MODE_40_MHZ;
7507 mac0_band_cap = HW_MODE_MAC_BAND_5G;
7508 dbs = HW_MODE_DBS;
7509 break;
7510 case 3:
7511 hdd_debug("set hw mode for 2x2 2g + 1x1 5g");
7512 mac0_ss = HW_MODE_SS_2x2;
7513 mac0_bw = HW_MODE_40_MHZ;
7514 mac1_ss = HW_MODE_SS_1x1;
7515 mac1_bw = HW_MODE_40_MHZ;
7516 mac0_band_cap = HW_MODE_MAC_BAND_2G;
7517 dbs = HW_MODE_DBS;
7518 break;
7519 default:
7520 hdd_err("unknown cmd %d", cmd);
7521 return;
7522 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007523 policy_mgr_pdev_set_hw_mode(hdd_ctx->psoc, adapter->vdev_id,
Liangwei Dong509c3472018-05-30 07:05:59 -04007524 mac0_ss, mac0_bw, mac1_ss, mac1_bw,
7525 mac0_band_cap, dbs, HW_MODE_AGILE_DFS_NONE,
7526 HW_MODE_SBS_NONE,
7527 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
7528}
7529
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007530static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007531 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007532{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08007533 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08007534 case WE_POLICY_MANAGER_CLIST_CMD:
7535 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007536 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307537 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307538 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7539 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7540 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7541 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307542 return 0;
7543 }
Dustin Brown05d81302018-09-11 16:49:22 -07007544 policy_mgr_incr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007545 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7546 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007547 }
7548 break;
7549
7550 case WE_POLICY_MANAGER_DLIST_CMD:
7551 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007552 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307553 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307554 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307555 return 0;
7556 }
Dustin Brown05d81302018-09-11 16:49:22 -07007557 policy_mgr_decr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007558 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007559 }
7560 break;
7561
7562 case WE_POLICY_MANAGER_ULIST_CMD:
7563 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007564 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307565 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307566 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7567 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7568 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7569 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307570 return 0;
7571 }
Manikandan Mohan282c4b62019-08-14 17:42:22 -07007572 policy_mgr_update_connection_info_utfw(
7573 hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007574 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
Manikandan Mohan282c4b62019-08-14 17:42:22 -07007575 apps_args[4], apps_args[5],
7576 wlan_chan_to_freq(apps_args[6]), apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007577 }
7578 break;
7579
7580 case WE_POLICY_MANAGER_DBS_CMD:
7581 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007582 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007583 if (apps_args[0] == 0)
7584 wma_set_dbs_capability_ut(0);
7585 else
7586 wma_set_dbs_capability_ut(1);
7587
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007588 if (apps_args[1] >= PM_THROUGHPUT &&
7589 apps_args[1] <= PM_LATENCY) {
Liangwei Dong509c3472018-05-30 07:05:59 -04007590 hdd_debug("setting system pref to [%d]\n",
7591 apps_args[1]);
Krunal Sonie71838d2018-09-27 10:45:05 -07007592 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc,
7593 apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007594 }
7595 }
7596 break;
7597
7598 case WE_POLICY_MANAGER_PCL_CMD:
7599 {
Manikandan Mohan19f36092019-08-15 15:54:02 -07007600 uint32_t pcl[QDF_MAX_NUM_CHAN] = {0};
Krunal Sonia6e505b2017-01-12 12:25:18 -08007601 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
7602 uint32_t pcl_len = 0, i = 0;
7603
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007604 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007605
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307606 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307607 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307608 return 0;
7609 }
Dustin Brown05d81302018-09-11 16:49:22 -07007610 policy_mgr_get_pcl(hdd_ctx->psoc, apps_args[0],
Manikandan Mohan19f36092019-08-15 15:54:02 -07007611 pcl, &pcl_len,
7612 weight_list, QDF_ARRAY_SIZE(weight_list));
7613 hdd_debug("PCL Freq list for role[%d] is {", apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007614 for (i = 0 ; i < pcl_len; i++)
Liangwei Dong509c3472018-05-30 07:05:59 -04007615 hdd_debug(" %d, ", pcl[i]);
7616 hdd_debug("}--------->\n");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007617 }
7618 break;
7619
7620 case WE_POLICY_SET_HW_MODE_CMD:
7621 {
Liangwei Dong509c3472018-05-30 07:05:59 -04007622 hdd_debug("pm_set_hw_mode cmd %d", apps_args[0]);
7623 hdd_policy_mgr_set_hw_mode_ut(hdd_ctx, adapter, apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007624 }
7625 break;
7626
7627 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7628 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007629 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307630 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307631 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307632 return 0;
7633 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07007634 policy_mgr_current_connections_update(
Manikandan Mohan282c4b62019-08-14 17:42:22 -07007635 hdd_ctx->psoc, adapter->vdev_id,
7636 wlan_chan_to_freq(apps_args[0]),
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07007637 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007638 }
7639 break;
7640
7641 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7642 {
7643 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007644
Dustin Brown5e89ef82018-03-14 11:50:23 -07007645 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307646 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307647 (apps_args[2] < 0)) {
7648 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307649 return 0;
7650 }
Manikandan Mohan282c4b62019-08-14 17:42:22 -07007651 allow = policy_mgr_allow_concurrency(
7652 hdd_ctx->psoc, apps_args[0],
7653 wlan_chan_to_freq(apps_args[1]), apps_args[2]);
Liangwei Dong509c3472018-05-30 07:05:59 -04007654 hdd_debug("allow %d {0 = don't allow, 1 = allow}", allow);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007655 }
7656 break;
7657
7658 case WE_POLICY_MANAGER_SCENARIO_CMD:
7659 {
7660 clean_report(hdd_ctx);
7661 if (apps_args[0] == 1) {
7662 wlan_hdd_one_connection_scenario(hdd_ctx);
7663 } else if (apps_args[0] == 2) {
7664 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007665 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007666 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007667 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007668 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007669 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007670 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007671 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007672 } else if (apps_args[0] == 3) {
7673 /* MCC on same band with 2x2 same mac*/
7674 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007675 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007676 /* MCC on diff band with 2x2 same mac*/
7677 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007678 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007679 /* MCC on diff band with 1x1 diff mac */
7680 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007681 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007682 /* MCC on diff band with 1x1 same mac */
7683 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007684 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007685 /* SCC on same band with 2x2 same mac */
7686 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007687 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007688 /* SCC on same band with 1x1 same mac */
7689 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007690 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007691 /* MCC on same band with 2x2 same mac */
7692 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007693 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007694 /* MCC on same band with 1x1 same mac */
7695 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007696 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007697 }
7698 print_report(hdd_ctx);
7699 }
7700 break;
7701 }
7702 return 0;
7703}
7704#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007705static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007706 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007707{
7708 return 0;
7709}
7710#endif
7711
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007712/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007713 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7714 * @hdd_ctx: hdd_context
7715 * @num_args: input args number
7716 * @apps_args: args data ptr
7717 *
7718 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7719 *
7720 * Return: void
7721 */
7722#if WLAN_DEBUG
7723static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7724 int num_args, int *apps_args)
7725{
7726 struct ch_avoid_ind_type ch_avoid;
7727 int cnt = 0, i;
7728
7729 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7730 num_args % 2 != 0)
7731 return;
7732 hdd_info("simulate ch avoid num_args %d", num_args);
7733 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7734 ch_avoid.avoid_freq_range[cnt].start_freq =
7735 apps_args[i];
7736 ch_avoid.avoid_freq_range[cnt].end_freq =
7737 apps_args[++i];
7738
7739 hdd_info("simulate ch avoid [%d %d]",
7740 ch_avoid.avoid_freq_range[cnt].start_freq,
7741 ch_avoid.avoid_freq_range[cnt].end_freq);
7742 cnt++;
7743 }
7744 ch_avoid.ch_avoid_range_cnt = cnt;
Dustin Brown05d81302018-09-11 16:49:22 -07007745 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->psoc, &ch_avoid);
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007746}
7747#else
7748static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7749 int num_args, int *apps_args)
7750{
7751}
7752#endif
7753/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007754 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7755 * @dev: device upon which the ioctl was received
7756 * @info: ioctl request information
7757 * @wrqu: ioctl request data
7758 * @extra: ioctl extra data
7759 *
7760 * This is an SSR-protected generic handler for private ioctls which
7761 * take multiple arguments. Note that this implementation is also
7762 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7763 * interfaces.
7764 *
7765 * Return: 0 on success, non-zero on error
7766 */
7767static int __iw_set_var_ints_getnone(struct net_device *dev,
7768 struct iw_request_info *info,
7769 union iwreq_data *wrqu, char *extra)
7770{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007771 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007772 mac_handle_t mac_handle;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007773 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007774 int sub_cmd;
7775 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007776 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007777 int ret, num_args;
Rakesh Pillai6c5af2f2019-09-25 15:33:07 +05307778 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
chenguoaa7c90c2018-05-24 17:08:47 +08007779 struct cdp_vdev *vdev = NULL;
7780 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007781
Dustin Brownfdf17c12018-03-14 12:55:34 -07007782 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307783
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007784 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007785 ret = wlan_hdd_validate_context(hdd_ctx);
7786 if (0 != ret)
7787 return ret;
7788
Jeff Johnson441e1f72017-02-07 08:50:49 -08007789 ret = hdd_check_private_wext_control(hdd_ctx, info);
7790 if (0 != ret)
7791 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007792
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007793 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007794 sub_cmd = wrqu->data.flags;
7795 num_args = wrqu->data.length;
7796
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007797 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007798
7799 switch (sub_cmd) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007800 case WE_P2P_NOA_CMD:
7801 {
Jeff Johnson156cd082019-03-10 21:49:54 -07007802 struct p2p_app_set_ps p2p_noa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007803
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007804 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007805 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
Dustin Brown458027c2018-10-19 12:26:27 -07007806 qdf_opmode_str(adapter->device_mode),
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007807 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007808 return -EINVAL;
7809 }
7810
Jeff Johnson156cd082019-03-10 21:49:54 -07007811 p2p_noa.opp_ps = apps_args[0];
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007812 p2p_noa.ct_window = apps_args[1];
Jeff Johnson156cd082019-03-10 21:49:54 -07007813 p2p_noa.duration = apps_args[2];
7814 p2p_noa.interval = apps_args[3];
7815 p2p_noa.count = apps_args[4];
7816 p2p_noa.single_noa_duration = apps_args[5];
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007817 p2p_noa.ps_selection = apps_args[6];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007818
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007819 hdd_debug("P2P_NOA_ATTR:opp ps %d ct window %d duration %d interval %d count %d single noa duration %d ps selection %x",
Jeff Johnson99bac312016-06-28 10:38:18 -07007820 apps_args[0], apps_args[1], apps_args[2],
7821 apps_args[3], apps_args[4],
7822 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007823
Jeff Johnson156cd082019-03-10 21:49:54 -07007824 hdd_set_p2p_ps(dev, &p2p_noa);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007825
7826 }
7827 break;
7828
7829 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7830 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007831 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007832 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307833 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007834 }
7835 break;
7836
7837 case WE_MTRACE_DUMP_CMD:
7838 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007839 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007840 apps_args[0], apps_args[1],
7841 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007842 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007843 apps_args[1], apps_args[2],
7844 apps_args[3]);
7845
7846 }
7847 break;
7848
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007849 case WE_POLICY_MANAGER_CINFO_CMD:
7850 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007851 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007852 uint32_t i = 0, len = 0;
7853
Krunal Sonia6e505b2017-01-12 12:25:18 -08007854 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007855 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007856 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007857 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007858 pr_info("|table_index[%d]\t\t\n", i);
7859 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
Manikandan Mohan932c11e2019-08-14 14:09:08 -07007860 pr_info("|\t|chan - %-10d|\n",
7861 wlan_freq_to_chan(conn_info->freq));
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007862 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7863 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7864 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7865 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7866 pr_info("+--------------------------+\n");
7867 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007868 }
7869 }
7870 break;
7871
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007872 case WE_UNIT_TEST_CMD:
7873 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007874 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007875
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007876 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7877 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007878 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007879 return -EINVAL;
7880 }
Sourav Mohapatraea7210b2018-11-16 16:58:52 +05307881 if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307882 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007883 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007884 return -EINVAL;
7885 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007886 status = sme_send_unit_test_cmd(adapter->vdev_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007887 apps_args[0],
7888 apps_args[1],
7889 &apps_args[2]);
7890 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007891 hdd_err("sme_send_unit_test_cmd returned %d", status);
7892 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007893 }
7894 }
7895 break;
7896#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7897 case WE_LED_FLASHING_PARAM:
7898 {
7899 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007900
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007901 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007902 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007903 return -EINVAL;
7904 }
7905 for (i = 0; i < num_args; i++) {
7906 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007907 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007908 return -EINVAL;
7909 }
7910 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007911 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007912 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007913 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007914 1, apps_args[2], apps_args[3]);
7915 }
7916 break;
7917#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05307918 case WE_SET_PKTLOG:
7919 {
7920 int ret;
7921
7922 if (num_args < 1 || num_args > 2) {
7923 hdd_err("pktlog: either 1 or 2 parameters are required");
7924 return -EINVAL;
7925 }
7926
7927 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
7928 apps_args[1]);
7929 if (ret)
7930 return ret;
7931 break;
7932 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05307933 case WE_MAC_PWR_DEBUG_CMD:
7934 {
7935 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05307936 int i, j;
7937
7938 if (num_args < 3) {
7939 hdd_err("number of arguments can't be null %d",
7940 num_args);
7941 return -EINVAL;
7942 }
7943 if (num_args - 3 != apps_args[2]) {
7944 hdd_err("arg list of size %d doesn't match num_args %d",
7945 num_args-3, apps_args[2]);
7946 return -EINVAL;
7947 }
7948 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
7949 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
7950 hdd_err("Invalid MODULE ID %d", apps_args[1]);
7951 return -EINVAL;
7952 }
7953 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
7954 hdd_err("Too Many args %d", apps_args[2]);
7955 return -EINVAL;
7956 }
7957 mac_pwr_dbg_args.pdev_id = apps_args[0];
7958 mac_pwr_dbg_args.module_id = apps_args[1];
7959 mac_pwr_dbg_args.num_args = apps_args[2];
7960
7961 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
7962 mac_pwr_dbg_args.args[i] = apps_args[j];
7963
7964 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007965 sme_process_mac_pwr_dbg_cmd(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007966 adapter->vdev_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05307967 &mac_pwr_dbg_args)) {
7968 return -EINVAL;
7969 }
7970 }
7971 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08007972 case WE_POLICY_MANAGER_CLIST_CMD:
7973 case WE_POLICY_MANAGER_DLIST_CMD:
7974 case WE_POLICY_MANAGER_ULIST_CMD:
7975 case WE_POLICY_MANAGER_DBS_CMD:
7976 case WE_POLICY_MANAGER_PCL_CMD:
7977 case WE_POLICY_SET_HW_MODE_CMD:
7978 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7979 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7980 case WE_POLICY_MANAGER_SCENARIO_CMD:
7981 {
Krunal Soni3de68532018-09-05 12:16:58 -07007982 if (!hdd_ctx->config->is_unit_test_framework_enabled) {
7983 hdd_warn_rl("UT framework is disabled");
7984 return -EINVAL;
7985 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007986 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Soni3de68532018-09-05 12:16:58 -07007987 sub_cmd, apps_args);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007988 }
7989 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007990 case WE_SET_CHAN_AVOID:
7991 {
7992 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
7993 }
7994 break;
chenguoaa7c90c2018-05-24 17:08:47 +08007995 case WE_SET_TXRX_STATS:
7996 {
chenguoaa7c90c2018-05-24 17:08:47 +08007997 req.stats = apps_args[0];
7998 /* default value of secondary parameter is 0(mac_id) */
7999 req.mac_id = apps_args[1];
8000
8001 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
Rakesh Pillai6c5af2f2019-09-25 15:33:07 +05308002 req.stats, req.mac_id);
8003 if (qdf_unlikely(!soc)) {
8004 hdd_err("soc is NULL");
8005 return -EINVAL;
8006 }
8007
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008008 if (apps_args[0] == CDP_TXRX_STATS_28) {
Jeff Johnson457c2422019-02-27 13:56:04 -08008009 if (sta_ctx->conn_info.is_authenticated) {
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008010 hdd_debug("ap mac addr: %pM",
Jeff Johnsone04b6992019-02-27 14:06:55 -08008011 (void *)&sta_ctx->conn_info.bssid);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008012 req.peer_addr =
Jeff Johnsone04b6992019-02-27 14:06:55 -08008013 (char *)&sta_ctx->conn_info.bssid;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008014 }
8015 }
chenguoaa7c90c2018-05-24 17:08:47 +08008016 ret = cdp_txrx_stats_request(soc, vdev, &req);
8017 break;
8018 }
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308019#ifdef WLAN_FEATURE_MOTION_DETECTION
8020 case WE_MOTION_DET_CONFIG_PARAM:
8021 {
8022 struct sme_motion_det_cfg motion_det_cfg;
8023
8024 if (num_args != 15) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308025 hdd_err_rl("mt_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308026 return -EINVAL;
8027 }
8028
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008029 motion_det_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308030 motion_det_cfg.time_t1 = apps_args[0];
8031 motion_det_cfg.time_t2 = apps_args[1];
8032 motion_det_cfg.n1 = apps_args[2];
8033 motion_det_cfg.n2 = apps_args[3];
8034 motion_det_cfg.time_t1_gap = apps_args[4];
8035 motion_det_cfg.time_t2_gap = apps_args[5];
8036 motion_det_cfg.coarse_K = apps_args[6];
8037 motion_det_cfg.fine_K = apps_args[7];
8038 motion_det_cfg.coarse_Q = apps_args[8];
8039 motion_det_cfg.fine_Q = apps_args[9];
8040 motion_det_cfg.md_coarse_thr_high = apps_args[10];
8041 motion_det_cfg.md_fine_thr_high = apps_args[11];
8042 motion_det_cfg.md_coarse_thr_low = apps_args[12];
8043 motion_det_cfg.md_fine_thr_low = apps_args[13];
8044 adapter->motion_detection_mode = apps_args[14];
8045 sme_motion_det_config(hdd_ctx->mac_handle, &motion_det_cfg);
8046 }
8047 break;
8048 case WE_MOTION_DET_BASE_LINE_CONFIG_PARAM:
8049 {
8050 struct sme_motion_det_base_line_cfg motion_det_base_line_cfg;
8051
8052 if (num_args != 4) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308053 hdd_err_rl("mt_bl_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308054 return -EINVAL;
8055 }
8056
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008057 motion_det_base_line_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308058 motion_det_base_line_cfg.bl_time_t = apps_args[0];
8059 motion_det_base_line_cfg.bl_packet_gap = apps_args[1];
8060 motion_det_base_line_cfg.bl_n = apps_args[2];
8061 motion_det_base_line_cfg.bl_num_meas = apps_args[3];
8062 sme_motion_det_base_line_config(hdd_ctx->mac_handle,
8063 &motion_det_base_line_cfg);
8064 }
8065 break;
8066#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308067#ifdef FW_THERMAL_THROTTLE_SUPPORT
8068 case WE_SET_THERMAL_THROTTLE_CFG:
8069 {
8070 QDF_STATUS status;
8071
8072 if (num_args != 7) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308073 hdd_err_rl("set_thermal_cfg: Invalid no of args");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308074 return -EINVAL;
8075 }
8076
8077 /* Check for valid inputs */
8078 if (apps_args[0] < 0 || apps_args[0] > 1 || apps_args[1] < 0 ||
8079 apps_args[2] < 0 || apps_args[2] > 100 ||
8080 apps_args[3] < 0 || apps_args[3] > 3 || apps_args[4] < 0 ||
8081 apps_args[5] < 0 || apps_args[6] < 0 ||
8082 apps_args[5] <= apps_args[4])
8083 return -EINVAL;
8084
8085 status = sme_set_thermal_throttle_cfg(hdd_ctx->mac_handle,
8086 apps_args[0],
8087 apps_args[1],
8088 apps_args[2],
8089 apps_args[3],
8090 apps_args[6]);
8091 if (QDF_IS_STATUS_ERROR(status))
8092 return qdf_status_to_os_return(status);
8093
8094 if (!apps_args[6]) {
8095 status = sme_set_thermal_mgmt(hdd_ctx->mac_handle,
8096 apps_args[4],
8097 apps_args[5]);
8098 if (QDF_IS_STATUS_ERROR(status))
8099 return qdf_status_to_os_return(status);
8100 }
8101 break;
8102 }
8103#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008104 default:
8105 {
Jeff Johnson99bac312016-06-28 10:38:18 -07008106 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008107 }
8108 break;
8109 }
Dustin Browne74003f2018-03-14 12:51:58 -07008110 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008111 return 0;
8112}
8113
8114/**
8115 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
8116 * @dev: pointer to net_device structure
8117 * @info: pointer to iw_request_info structure
8118 * @wrqu: pointer to iwreq_data
8119 * @extra; extra
8120 *
8121 * Return: 0 on success, error number otherwise
8122 *
8123 */
8124static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
8125 struct iw_request_info *info,
8126 union iwreq_data *wrqu, char *extra)
8127{
8128 union iwreq_data u_priv_wrqu;
8129 int apps_args[MAX_VAR_ARGS] = {0};
Dustin Brown389e5072018-11-08 17:10:01 +05308130 int errno, num_args;
8131 struct osif_vdev_sync *vdev_sync;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008132
Mukul Sharma64a70e82015-11-02 20:05:09 +05308133 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008134 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05308135 return -EPERM;
8136 }
8137
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008138 /* Helper function to get iwreq_data with compat handling. */
8139 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
8140 return -EINVAL;
8141
Jeff Johnsond36fa332019-03-18 13:42:25 -07008142 if (!u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008143 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008144 return -EINVAL;
8145 }
8146
8147 num_args = u_priv_wrqu.data.length;
8148 if (num_args > MAX_VAR_ARGS)
8149 num_args = MAX_VAR_ARGS;
8150
8151 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
Dustin Brown389e5072018-11-08 17:10:01 +05308152 sizeof(int) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008153 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008154 return -EFAULT;
8155 }
8156
Dustin Brown389e5072018-11-08 17:10:01 +05308157 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8158 if (errno)
8159 return errno;
8160
Dustin Brown389e5072018-11-08 17:10:01 +05308161 errno = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
8162 (char *)&apps_args);
Dustin Brown389e5072018-11-08 17:10:01 +05308163
8164 osif_vdev_sync_op_stop(vdev_sync);
8165
8166 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008167}
8168
8169/**
8170 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
8171 * @dev: device upon which the ioctl was received
8172 * @info: ioctl request information
8173 * @wrqu: ioctl request data
8174 * @extra: ioctl extra data
8175 *
8176 * This is a generic handler for private ioctls which take multiple
8177 * arguments. Note that this implementation is also somewhat unique
8178 * in that it is shared by both STA-mode and SAP-mode interfaces.
8179 *
8180 * Return: 0 on success, non-zero on error
8181 */
8182int iw_set_var_ints_getnone(struct net_device *dev,
8183 struct iw_request_info *info,
8184 union iwreq_data *wrqu, char *extra)
8185{
Dustin Brown389e5072018-11-08 17:10:01 +05308186 int errno;
8187 struct osif_vdev_sync *vdev_sync;
8188
8189 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8190 if (errno)
8191 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008192
Dustin Brown389e5072018-11-08 17:10:01 +05308193 errno = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
Dustin Brown389e5072018-11-08 17:10:01 +05308194
8195 osif_vdev_sync_op_stop(vdev_sync);
8196
8197 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008198}
8199
8200/**
8201 * iw_add_tspec - Add TSpec private ioctl handler
8202 * @dev: device upon which the ioctl was received
8203 * @info: ioctl request information
8204 * @wrqu: ioctl request data
8205 * @extra: ioctl extra data
8206 *
8207 * Return: 0 on success, non-zero on error
8208 */
8209static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
8210 union iwreq_data *wrqu, char *extra)
8211{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008212 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008213 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008214 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008215 int params[HDD_WLAN_WMM_PARAM_COUNT];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008216 struct sme_qos_wmmtspecinfo tspec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008217 uint32_t handle;
8218 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008219 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008220 int ret;
8221
Dustin Brownfdf17c12018-03-14 12:55:34 -07008222 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308223
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008224 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008225 ret = wlan_hdd_validate_context(hdd_ctx);
8226 if (0 != ret)
8227 return ret;
8228
Jeff Johnson441e1f72017-02-07 08:50:49 -08008229 ret = hdd_check_private_wext_control(hdd_ctx, info);
8230 if (0 != ret)
8231 return ret;
8232
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008233 /* make sure the application is sufficiently priviledged */
8234 /* note that the kernel will do this for "set" ioctls, but since */
8235 /* this ioctl wants to return status to user space it must be */
8236 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008237 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008238 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008239
8240 /* we must be associated in order to add a tspec */
Jeff Johnsone7951512019-02-27 10:02:51 -08008241 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008242 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008243 return 0;
8244 }
8245 /* since we are defined to be a "get" ioctl, and since the number */
8246 /* of params exceeds the number of params that wireless extensions */
8247 /* will pass down in the iwreq_data, we must copy the "set" params. */
8248 /* We must handle the compat for iwreq_data in 32U/64K environment. */
8249
8250 /* helper function to get iwreq_data with compat handling. */
8251 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008252 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008253 return 0;
8254 }
8255 /* make sure all params are correctly passed to function */
Jeff Johnsond36fa332019-03-18 13:42:25 -07008256 if ((!s_priv_data.pointer) ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008257 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008258 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008259 return 0;
8260 }
8261 /* from user space ourselves */
8262 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
8263 /* hmmm, can't get them */
8264 return -EIO;
8265 }
8266 /* clear the tspec */
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008267 memset(&tspec, 0, sizeof(tspec));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008268
8269 /* validate the handle */
8270 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8271 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8272 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008273 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008274 return 0;
8275 }
8276 /* validate the TID */
8277 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
8278 /* out of range */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008279 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008280 return 0;
8281 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008282 tspec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008283
8284 /* validate the direction */
8285 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
8286 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008287 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008288 break;
8289
8290 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008291 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008292 break;
8293
8294 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008295 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008296 break;
8297
8298 default:
8299 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008300 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008301 return 0;
8302 }
8303
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008304 tspec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008305
8306 /* validate the user priority */
8307 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
8308 /* out of range */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008309 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008310 return 0;
8311 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008312 tspec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
8313 if (0 > tspec.ts_info.up || SME_QOS_WMM_UP_MAX < tspec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008314 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008315 return 0;
8316 }
8317
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008318 hdd_debug("TS_INFO PSB %d UP %d !!!",
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008319 tspec.ts_info.psb, tspec.ts_info.up);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008320
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008321 tspec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
8322 tspec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
8323 tspec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
8324 tspec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
8325 tspec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
8326 tspec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
8327 tspec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
8328 tspec.surplus_bw_allowance =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008329 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008330 tspec.min_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008331 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008332 tspec.max_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008333 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008334 tspec.suspension_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008335 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008336 tspec.inactivity_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008337 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
8338
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008339 tspec.ts_info.burst_size_defn =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008340 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
8341
8342 /* validate the ts info ack policy */
8343 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
Abhinav Kumarab576712018-11-05 14:32:49 +05308344 case TS_INFO_ACK_POLICY_NORMAL_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008345 tspec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008346 break;
8347
Abhinav Kumarab576712018-11-05 14:32:49 +05308348 case TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008349 tspec.ts_info.ack_policy =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008350 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
8351 break;
8352
8353 default:
8354 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008355 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008356 return 0;
8357 }
8358
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008359 *wmm_status = hdd_wmm_addts(adapter, handle, &tspec);
Dustin Browne74003f2018-03-14 12:51:58 -07008360 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008361 return 0;
8362}
8363
8364static int iw_add_tspec(struct net_device *dev,
8365 struct iw_request_info *info,
8366 union iwreq_data *wrqu, char *extra)
8367{
Dustin Brown389e5072018-11-08 17:10:01 +05308368 int errno;
8369 struct osif_vdev_sync *vdev_sync;
8370
8371 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8372 if (errno)
8373 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008374
Dustin Brown389e5072018-11-08 17:10:01 +05308375 errno = __iw_add_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008376
Dustin Brown389e5072018-11-08 17:10:01 +05308377 osif_vdev_sync_op_stop(vdev_sync);
8378
8379 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008380}
8381
8382/**
8383 * iw_del_tspec - Delete TSpec private ioctl handler
8384 * @dev: device upon which the ioctl was received
8385 * @info: ioctl request information
8386 * @wrqu: ioctl request data
8387 * @extra: ioctl extra data
8388 *
8389 * Return: 0 on success, non-zero on error
8390 */
8391static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
8392 union iwreq_data *wrqu, char *extra)
8393{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008394 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008395 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008396 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008397 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008398 uint32_t handle;
8399 int ret;
8400
Dustin Brownfdf17c12018-03-14 12:55:34 -07008401 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308402
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008403 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008404 ret = wlan_hdd_validate_context(hdd_ctx);
8405 if (0 != ret)
8406 return ret;
8407
Jeff Johnson441e1f72017-02-07 08:50:49 -08008408 ret = hdd_check_private_wext_control(hdd_ctx, info);
8409 if (0 != ret)
8410 return ret;
8411
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008412 /* make sure the application is sufficiently priviledged */
8413 /* note that the kernel will do this for "set" ioctls, but since */
8414 /* this ioctl wants to return status to user space it must be */
8415 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008416 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008417 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008418
8419 /* although we are defined to be a "get" ioctl, the params we require */
8420 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8421 /* is no need to copy the params from user space */
8422
8423 /* validate the handle */
8424 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8425 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8426 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008427 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008428 return 0;
8429 }
8430
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008431 *wmm_status = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008432 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008433 return 0;
8434}
8435
8436static int iw_del_tspec(struct net_device *dev,
8437 struct iw_request_info *info,
8438 union iwreq_data *wrqu, char *extra)
8439{
Dustin Brown389e5072018-11-08 17:10:01 +05308440 int errno;
8441 struct osif_vdev_sync *vdev_sync;
8442
8443 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8444 if (errno)
8445 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008446
Dustin Brown389e5072018-11-08 17:10:01 +05308447 errno = __iw_del_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008448
Dustin Brown389e5072018-11-08 17:10:01 +05308449 osif_vdev_sync_op_stop(vdev_sync);
8450
8451 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008452}
8453
8454/**
8455 * iw_get_tspec - Get TSpec private ioctl handler
8456 * @dev: device upon which the ioctl was received
8457 * @info: ioctl request information
8458 * @wrqu: ioctl request data
8459 * @extra: ioctl extra data
8460 *
8461 * Return: 0 on success, non-zero on error
8462 */
8463static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
8464 union iwreq_data *wrqu, char *extra)
8465{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008466 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008467 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008468 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008469 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008470 uint32_t handle;
8471 int ret;
8472
Dustin Brownfdf17c12018-03-14 12:55:34 -07008473 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308474
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008475 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008476 ret = wlan_hdd_validate_context(hdd_ctx);
8477 if (0 != ret)
8478 return ret;
8479
Jeff Johnson441e1f72017-02-07 08:50:49 -08008480 ret = hdd_check_private_wext_control(hdd_ctx, info);
8481 if (0 != ret)
8482 return ret;
8483
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008484 /* although we are defined to be a "get" ioctl, the params we require */
8485 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8486 /* is no need to copy the params from user space */
8487
8488 /* validate the handle */
8489 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8490 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8491 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008492 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008493 return 0;
8494 }
8495
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008496 *wmm_status = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008497 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008498 return 0;
8499}
8500
8501static int iw_get_tspec(struct net_device *dev,
8502 struct iw_request_info *info,
8503 union iwreq_data *wrqu, char *extra)
8504{
Dustin Brown389e5072018-11-08 17:10:01 +05308505 int errno;
8506 struct osif_vdev_sync *vdev_sync;
8507
8508 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8509 if (errno)
8510 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008511
Dustin Brown389e5072018-11-08 17:10:01 +05308512 errno = __iw_get_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008513
Dustin Brown389e5072018-11-08 17:10:01 +05308514 osif_vdev_sync_op_stop(vdev_sync);
8515
8516 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008517}
8518
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008519/**
8520 * iw_set_fties - Set FT IEs private ioctl handler
8521 * @dev: device upon which the ioctl was received
8522 * @info: ioctl request information
8523 * @wrqu: ioctl request data
8524 * @extra: ioctl extra data
8525 *
8526 * Each time the supplicant has the auth_request or reassoc request
8527 * IEs ready they are pushed to the driver. The driver will in turn
8528 * use it to send out the auth req and reassoc req for 11r FT Assoc.
8529 *
8530 * Return: 0 on success, non-zero on error
8531 */
8532static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
8533 union iwreq_data *wrqu, char *extra)
8534{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008535 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008536 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008537 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008538 int ret;
8539
Dustin Brownfdf17c12018-03-14 12:55:34 -07008540 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308541
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008542 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008543 ret = wlan_hdd_validate_context(hdd_ctx);
8544 if (0 != ret)
8545 return ret;
8546
Jeff Johnson441e1f72017-02-07 08:50:49 -08008547 ret = hdd_check_private_wext_control(hdd_ctx, info);
8548 if (0 != ret)
8549 return ret;
8550
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008551 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008552 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008553 return -EINVAL;
8554 }
Jeff Johnsond36fa332019-03-18 13:42:25 -07008555 if (!wrqu->data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008556 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008557 return -EINVAL;
8558 }
8559 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsone7951512019-02-27 10:02:51 -08008560 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008561 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008562 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008563 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008564 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008565 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008566
8567 /* Pass the received FT IEs to SME */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008568 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->vdev_id,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008569 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07008570 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008571 return 0;
8572}
8573
8574static int iw_set_fties(struct net_device *dev,
8575 struct iw_request_info *info,
8576 union iwreq_data *wrqu, char *extra)
8577{
Dustin Brown389e5072018-11-08 17:10:01 +05308578 int errno;
8579 struct osif_vdev_sync *vdev_sync;
8580
8581 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8582 if (errno)
8583 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008584
Dustin Brown389e5072018-11-08 17:10:01 +05308585 errno = __iw_set_fties(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008586
Dustin Brown389e5072018-11-08 17:10:01 +05308587 osif_vdev_sync_op_stop(vdev_sync);
8588
8589 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008590}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008591
Dustin Brown0cbc7572016-12-16 13:54:40 -08008592/**
8593 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
8594 * @dev: device upon which the ioctl was received
8595 * @info: ioctl request information
8596 * @wrqu: ioctl request data
8597 * @extra: ioctl extra data
8598 *
Dustin Brown860566f2017-01-31 15:24:43 -08008599 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
8600 * time being to provide guidance in migrating to standard APIs.
8601 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08008602 * Return: 0 on success, non-zero on error
8603 */
8604static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
8605 struct iw_request_info *info,
8606 union iwreq_data *wrqu,
8607 char *extra)
8608{
Dustin Brown860566f2017-01-31 15:24:43 -08008609 hdd_err("\n"
8610 "setMCBCFilter is obsolete. Use the following instead:\n"
8611 "Configure multicast filtering via the ‘ip’ command.\n"
8612 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
8613 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
8614 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
8615 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
8616 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07008617 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08008618}
8619
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008620/**
8621 * iw_set_host_offload - Set host offload ioctl handler
8622 * @dev: device upon which the ioctl was received
8623 * @info: ioctl request information
8624 * @wrqu: ioctl request data
8625 * @extra: ioctl extra data
8626 *
8627 * Return: 0 on success, non-zero on error
8628 */
8629static int __iw_set_host_offload(struct net_device *dev,
8630 struct iw_request_info *info,
8631 union iwreq_data *wrqu, char *extra)
8632{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008633 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008634 struct host_offload_req *user_request =
8635 (struct host_offload_req *) extra;
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008636 struct sir_host_offload_req offload_request;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008637 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008638 int ret;
8639
Dustin Brownfdf17c12018-03-14 12:55:34 -07008640 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308641
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008642 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008643 ret = wlan_hdd_validate_context(hdd_ctx);
8644 if (0 != ret)
8645 return ret;
8646
Jeff Johnson441e1f72017-02-07 08:50:49 -08008647 ret = hdd_check_private_wext_control(hdd_ctx, info);
8648 if (0 != ret)
8649 return ret;
8650
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008651 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008652 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008653 return -EINVAL;
8654 }
8655
8656 /* Debug display of request components. */
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008657 switch (user_request->offloadType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008658 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008659 hdd_debug("Host offload request: ARP reply");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008660 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008661 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008662 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008663 break;
8664 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008665 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07008666 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008667 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008668 hdd_debug(" ARP offload enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008669 hdd_debug(" IP address: %pI4",
8670 user_request->params.hostIpv4Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008671 }
8672 break;
8673
8674 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008675 hdd_debug("Host offload request: neighbor discovery");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008676 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008677 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008678 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008679 break;
8680 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008681 hdd_debug(" enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008682 hdd_debug(" IP address: %pI6c",
8683 user_request->params.hostIpv6Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008684 }
8685 }
8686
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008687 qdf_mem_zero(&offload_request, sizeof(offload_request));
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008688 offload_request.offloadType = user_request->offloadType;
8689 offload_request.enableOrDisable = user_request->enableOrDisable;
8690 qdf_mem_copy(&offload_request.params, &user_request->params,
8691 sizeof(user_request->params));
8692 qdf_mem_copy(&offload_request.bssid, &user_request->bssId.bytes,
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05308693 QDF_MAC_ADDR_SIZE);
8694
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308695 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008696 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008697 adapter->vdev_id, &offload_request)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008698 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008699 return -EINVAL;
8700 }
Dustin Browne74003f2018-03-14 12:51:58 -07008701 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008702 return 0;
8703}
8704
8705static int iw_set_host_offload(struct net_device *dev,
8706 struct iw_request_info *info,
8707 union iwreq_data *wrqu, char *extra)
8708{
Dustin Brown389e5072018-11-08 17:10:01 +05308709 int errno;
8710 struct osif_vdev_sync *vdev_sync;
8711
8712 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8713 if (errno)
8714 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008715
Dustin Brown389e5072018-11-08 17:10:01 +05308716 errno = __iw_set_host_offload(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008717
Dustin Brown389e5072018-11-08 17:10:01 +05308718 osif_vdev_sync_op_stop(vdev_sync);
8719
8720 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008721}
8722
8723/**
8724 * iw_set_keepalive_params - Set keepalive params ioctl handler
8725 * @dev: device upon which the ioctl was received
8726 * @info: ioctl request information
8727 * @wrqu: ioctl request data
8728 * @extra: ioctl extra data
8729 *
8730 * Return: 0 on success, non-zero on error
8731 */
8732static int __iw_set_keepalive_params(struct net_device *dev,
8733 struct iw_request_info *info,
8734 union iwreq_data *wrqu, char *extra)
8735{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008736 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson562ccad2019-02-06 22:10:24 -08008737 struct keep_alive_req *request = (struct keep_alive_req *)extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008738 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008739 int ret;
8740
Dustin Brownfdf17c12018-03-14 12:55:34 -07008741 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308742
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008743 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008744 ret = wlan_hdd_validate_context(hdd_ctx);
8745 if (0 != ret)
8746 return ret;
8747
Jeff Johnson441e1f72017-02-07 08:50:49 -08008748 ret = hdd_check_private_wext_control(hdd_ctx, info);
8749 if (0 != ret)
8750 return ret;
8751
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008752 if (wrqu->data.length != sizeof(*request)) {
8753 hdd_err("Invalid length %d", wrqu->data.length);
8754 return -EINVAL;
8755 }
8756
Wu Gao93816212018-08-31 16:49:54 +08008757 if (request->timePeriod > cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008758 hdd_err("Value of timePeriod %d exceed Max limit %d",
8759 request->timePeriod,
Wu Gao93816212018-08-31 16:49:54 +08008760 cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008761 return -EINVAL;
8762 }
8763
8764 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008765 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Jeff Johnson562ccad2019-02-06 22:10:24 -08008766 request->timePeriod, sizeof(struct keep_alive_req));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008767
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008768 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008769 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008770 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008771 break;
8772
8773 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008774 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008775
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008776 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008777 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8778 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008779
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008780 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008781 request->destIpv4Addr[0], request->destIpv4Addr[1],
8782 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008783
Srinivas Girigowdacb7b8b82019-04-10 14:27:47 -07008784 hdd_debug("Dest MAC address: "QDF_MAC_ADDR_STR,
Srinivas Girigowda34fbba02019-04-08 12:07:44 -07008785 QDF_MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008786 break;
8787 }
8788
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008789 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008790
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308791 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008792 sme_set_keep_alive(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008793 adapter->vdev_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008794 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008795 return -EINVAL;
8796 }
Dustin Browne74003f2018-03-14 12:51:58 -07008797 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008798 return 0;
8799}
8800
8801static int iw_set_keepalive_params(struct net_device *dev,
8802 struct iw_request_info *info,
8803 union iwreq_data *wrqu,
8804 char *extra)
8805{
Dustin Brown389e5072018-11-08 17:10:01 +05308806 int errno;
8807 struct osif_vdev_sync *vdev_sync;
8808
8809 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8810 if (errno)
8811 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008812
Dustin Brown389e5072018-11-08 17:10:01 +05308813 errno = __iw_set_keepalive_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008814
Dustin Brown389e5072018-11-08 17:10:01 +05308815 osif_vdev_sync_op_stop(vdev_sync);
8816
8817 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008818}
8819
8820#ifdef WLAN_FEATURE_PACKET_FILTERING
8821/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308822 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8823 * @priv_data: Pointer to the priv data from user space
8824 * @request: Pointer to the struct containing the copied data from user space
8825 *
8826 * Return: False on invalid length, true otherwise
8827 */
8828static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8829 uint16_t length)
8830{
8831 int max_params_size, rcvd_params_size;
8832
8833 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8834 sizeof(struct pkt_filter_param_cfg);
8835
8836 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8837 hdd_err("Less than minimum number of arguments needed");
8838 return false;
8839 }
8840
8841 rcvd_params_size = request->num_params *
8842 sizeof(struct pkt_filter_param_cfg);
8843
8844 if (length != sizeof(struct pkt_filter_cfg) -
8845 max_params_size + rcvd_params_size) {
8846 hdd_err("Arguments do not match the number of params provided");
8847 return false;
8848 }
8849
8850 return true;
8851}
8852
8853/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008854 * __iw_set_packet_filter_params() - set packet filter parameters in target
8855 * @dev: Pointer to netdev
8856 * @info: Pointer to iw request info
8857 * @wrqu: Pointer to data
8858 * @extra: Pointer to extra data
8859 *
8860 * Return: 0 on success, non-zero on error
8861 */
8862static int __iw_set_packet_filter_params(struct net_device *dev,
8863 struct iw_request_info *info,
8864 union iwreq_data *wrqu, char *extra)
8865{
8866 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008867 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008868 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008869 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008870 struct pkt_filter_cfg *request = NULL;
8871
Mukul Sharma472382f2015-11-02 20:16:31 +05308872 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008873 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308874 return -EPERM;
8875 }
8876
Dustin Brownfdf17c12018-03-14 12:55:34 -07008877 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308878
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008879 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8880 ret = wlan_hdd_validate_context(hdd_ctx);
8881 if (0 != ret)
8882 return ret;
8883
Jeff Johnson441e1f72017-02-07 08:50:49 -08008884 ret = hdd_check_private_wext_control(hdd_ctx, info);
8885 if (0 != ret)
8886 return ret;
8887
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008888 if (hdd_priv_get_data(&priv_data, wrqu)) {
8889 hdd_err("failed to get priv data");
8890 return -EINVAL;
8891 }
8892
Jeff Johnsond36fa332019-03-18 13:42:25 -07008893 if ((!priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008894 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008895 priv_data.pointer, priv_data.length);
8896 return -EINVAL;
8897 }
8898
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308899 if (adapter->device_mode != QDF_STA_MODE) {
8900 hdd_err("Packet filter not supported for this mode :%d",
8901 adapter->device_mode);
8902 return -ENOTSUPP;
8903 }
8904
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308905 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8906 hdd_err("Packet filter not supported in disconnected state");
8907 return -ENOTSUPP;
8908 }
8909
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008910 /* copy data using copy_from_user */
8911 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
8912 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308913
Jeff Johnsond36fa332019-03-18 13:42:25 -07008914 if (!request) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008915 hdd_err("mem_alloc_copy_from_user_helper fail");
8916 return -ENOMEM;
8917 }
8918
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308919 if (!validate_packet_filter_params_size(request, priv_data.length)) {
8920 hdd_err("Invalid priv data length %d", priv_data.length);
8921 qdf_mem_free(request);
8922 return -EINVAL;
8923 }
8924
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05308925 if (request->filter_action == HDD_RCV_FILTER_SET)
8926 hdd_ctx->user_configured_pkt_filter_rules |=
8927 1 << request->filter_id;
8928 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
8929 hdd_ctx->user_configured_pkt_filter_rules &=
8930 ~(1 << request->filter_id);
8931
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008932 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->vdev_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008933
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07008934 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07008935 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008936 return ret;
8937}
8938
8939/**
8940 * iw_set_packet_filter_params() - set packet filter parameters in target
8941 * @dev: Pointer to netdev
8942 * @info: Pointer to iw request info
8943 * @wrqu: Pointer to data
8944 * @extra: Pointer to extra data
8945 *
8946 * Return: 0 on success, non-zero on error
8947 */
8948static int iw_set_packet_filter_params(struct net_device *dev,
8949 struct iw_request_info *info,
8950 union iwreq_data *wrqu, char *extra)
8951{
Dustin Brown389e5072018-11-08 17:10:01 +05308952 int errno;
8953 struct osif_vdev_sync *vdev_sync;
8954
8955 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8956 if (errno)
8957 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008958
Dustin Brown389e5072018-11-08 17:10:01 +05308959 errno = __iw_set_packet_filter_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008960
Dustin Brown389e5072018-11-08 17:10:01 +05308961 osif_vdev_sync_op_stop(vdev_sync);
8962
8963 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008964}
8965#endif
8966
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008967static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
8968{
8969 return wlan_hdd_get_station_stats(adapter);
8970}
Jeff Johnsonced658b2018-03-08 09:54:01 -08008971
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008972static int __iw_get_statistics(struct net_device *dev,
8973 struct iw_request_info *info,
8974 union iwreq_data *wrqu, char *extra)
8975{
8976 int ret;
8977 char *p;
8978 int tlen;
8979 struct hdd_station_ctx *sta_ctx;
8980 tCsrSummaryStatsInfo *summary_stats;
8981 tCsrGlobalClassAStatsInfo *class_a_stats;
8982 tCsrGlobalClassDStatsInfo *class_d_stats;
8983 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
8984 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8985
8986 hdd_enter_dev(dev);
8987
8988 ret = wlan_hdd_validate_context(hdd_ctx);
8989 if (0 != ret)
8990 return ret;
8991
8992 ret = hdd_check_private_wext_control(hdd_ctx, info);
8993 if (0 != ret)
8994 return ret;
8995
8996 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsone7951512019-02-27 10:02:51 -08008997 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008998 wrqu->data.length = 0;
8999 return 0;
9000 }
9001
9002 hdd_get_wlan_stats(adapter);
9003
9004 summary_stats = &(adapter->hdd_stats.summary_stat);
9005 class_a_stats = &(adapter->hdd_stats.class_a_stat);
9006 class_d_stats = &(adapter->hdd_stats.class_d_stat);
9007
Jeff Johnsonced658b2018-03-08 09:54:01 -08009008 p = extra;
9009 tlen = 0;
9010
9011 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
9012 sizeof(summary_stats->retry_cnt),
9013 &(summary_stats->retry_cnt[0]), tlen);
9014
9015 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
9016 sizeof(summary_stats->multiple_retry_cnt),
9017 &(summary_stats->multiple_retry_cnt[0]), tlen);
9018
9019 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
9020 sizeof(summary_stats->tx_frm_cnt),
9021 &(summary_stats->tx_frm_cnt[0]), tlen);
9022
9023 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
9024 sizeof(summary_stats->rx_frm_cnt),
9025 &(summary_stats->rx_frm_cnt), tlen);
9026
9027 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
9028 sizeof(summary_stats->frm_dup_cnt),
9029 &(summary_stats->frm_dup_cnt), tlen);
9030
9031 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
9032 sizeof(summary_stats->fail_cnt),
9033 &(summary_stats->fail_cnt[0]), tlen);
9034
9035 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
9036 sizeof(summary_stats->rts_fail_cnt),
9037 &(summary_stats->rts_fail_cnt), tlen);
9038
9039 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
9040 sizeof(summary_stats->ack_fail_cnt),
9041 &(summary_stats->ack_fail_cnt), tlen);
9042
9043 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
9044 sizeof(summary_stats->rts_succ_cnt),
9045 &(summary_stats->rts_succ_cnt), tlen);
9046
9047 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
9048 sizeof(summary_stats->rx_discard_cnt),
9049 &(summary_stats->rx_discard_cnt), tlen);
9050
9051 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
9052 sizeof(summary_stats->rx_error_cnt),
9053 &(summary_stats->rx_error_cnt), tlen);
9054
9055 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
9056 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9057 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9058
9059 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
9060 sizeof(class_d_stats->rx_byte_cnt),
9061 &(class_d_stats->rx_byte_cnt), tlen);
9062
9063 FILL_TLV(p, WLAN_STATS_RX_RATE,
9064 sizeof(class_d_stats->rx_rate),
9065 &(class_d_stats->rx_rate), tlen);
9066
9067 /* Transmit rate, in units of 500 kbit/sec */
9068 FILL_TLV(p, WLAN_STATS_TX_RATE,
9069 sizeof(class_a_stats->tx_rate),
9070 &(class_a_stats->tx_rate), tlen);
9071
9072 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
9073 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
9074 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
9075 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
9076 sizeof(class_d_stats->rx_mc_byte_cnt),
9077 &(class_d_stats->rx_mc_byte_cnt), tlen);
9078 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
9079 sizeof(class_d_stats->rx_bc_byte_cnt),
9080 &(class_d_stats->rx_bc_byte_cnt), tlen);
9081 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
9082 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9083 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9084 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
9085 sizeof(class_d_stats->tx_mc_byte_cnt),
9086 &(class_d_stats->tx_mc_byte_cnt), tlen);
9087 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
9088 sizeof(class_d_stats->tx_bc_byte_cnt),
9089 &(class_d_stats->tx_bc_byte_cnt), tlen);
9090
9091 wrqu->data.length = tlen;
9092
Dustin Browne74003f2018-03-14 12:51:58 -07009093 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009094
9095 return 0;
9096}
9097
9098static int iw_get_statistics(struct net_device *dev,
9099 struct iw_request_info *info,
9100 union iwreq_data *wrqu, char *extra)
9101{
Dustin Brown389e5072018-11-08 17:10:01 +05309102 int errno;
9103 struct osif_vdev_sync *vdev_sync;
9104
9105 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9106 if (errno)
9107 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009108
Dustin Brown389e5072018-11-08 17:10:01 +05309109 errno = __iw_get_statistics(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009110
Dustin Brown389e5072018-11-08 17:10:01 +05309111 osif_vdev_sync_op_stop(vdev_sync);
9112
9113 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009114}
9115
9116#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009117/*Max Len for PNO notification*/
9118#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05309119static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
9120 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009121{
Abhishek Singh0481d662017-04-11 18:20:11 +05309122 struct vdev_osif_priv *osif_priv;
9123 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009124 union iwreq_data wrqu;
9125 char buf[MAX_PNO_NOTIFY_LEN + 1];
9126
Abhishek Singh0481d662017-04-11 18:20:11 +05309127 wlan_vdev_obj_lock(vdev);
9128 osif_priv = wlan_vdev_get_ospriv(vdev);
9129 wlan_vdev_obj_unlock(vdev);
9130 if (!osif_priv) {
9131 hdd_err("osif_priv is null");
9132 return;
9133 }
9134
9135 wdev = osif_priv->wdev;
9136 if (!wdev) {
9137 hdd_err("wdev is null");
9138 return;
9139 }
9140
9141 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009142
9143 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05309144 qdf_mem_zero(&wrqu, sizeof(wrqu));
9145 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009146
9147 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05309148 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009149
9150 wrqu.data.pointer = buf;
9151 wrqu.data.length = strlen(buf);
9152
9153 /* send the event */
9154
Abhishek Singh0481d662017-04-11 18:20:11 +05309155 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009156}
9157
9158/**
9159 * __iw_set_pno() - Preferred Network Offload ioctl handler
9160 * @dev: device upon which the ioctl was received
9161 * @info: ioctl request information
9162 * @wrqu: ioctl request data
9163 * @extra: ioctl extra data
9164 *
9165 * This function parses a Preferred Network Offload command
9166 * Input is string based and expected to be of the form:
9167 *
9168 * <enable(1) | disable(0)>
9169 * when enabling:
9170 * <number of networks>
9171 * for each network:
9172 * <ssid_len> <ssid> <authentication> <encryption>
9173 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07009174 * <scan_time (seconds)>
9175 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009176 * <suspend mode>
9177 *
9178 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07009179 * 1 2 4 test 0 0 3 1 6 11 2 40 5 test2 4 4 6 1 2 3 4 5 6 1 0 5 2 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009180 *
9181 * this translates into:
9182 * -----------------------------
9183 * enable PNO
9184 * 2 networks
9185 * Network 1:
9186 * test - with authentication type 0 and encryption type 0,
9187 * search on 3 channels: 1 6 and 11,
9188 * SSID bcast type is unknown (directed probe will be sent if
9189 * AP not found) and must meet -40dBm RSSI
9190 * Network 2:
9191 * test2 - with authentication type 4 and encryption type 4,
9192 * search on 6 channels 1, 2, 3, 4, 5 and 6
9193 * bcast type is non-bcast (directed probe will be sent)
9194 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009195 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07009196 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009197 */
9198static int __iw_set_pno(struct net_device *dev,
9199 struct iw_request_info *info,
9200 union iwreq_data *wrqu, char *extra)
9201{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009202 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009203 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05309204 uint8_t value;
9205 struct wlan_objmgr_vdev *vdev;
9206 struct wlan_objmgr_psoc *psoc;
9207 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009208 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309209 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05309210 uint8_t i, j, params;
9211 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309212 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009213
9214 /* request is a large struct, so we make it static to avoid
9215 * stack overflow. This API is only invoked via ioctl, so it
9216 * is serialized by the kernel rtnl_lock and hence does not
9217 * need to be reentrant
9218 */
Abhishek Singh0481d662017-04-11 18:20:11 +05309219 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009220
Dustin Brownfdf17c12018-03-14 12:55:34 -07009221 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009222
9223 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9224 ret = wlan_hdd_validate_context(hdd_ctx);
9225 if (ret)
9226 return ret;
9227
Jeff Johnson441e1f72017-02-07 08:50:49 -08009228 ret = hdd_check_private_wext_control(hdd_ctx, info);
9229 if (0 != ret)
9230 return ret;
9231
Dustin Brown07901ec2018-09-07 11:02:41 -07009232 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->pdev,
9233 dev->dev_addr,
Abhishek Singh3755cdd2019-09-13 10:38:34 +05309234 WLAN_OSIF_ID);
Abhishek Singh0481d662017-04-11 18:20:11 +05309235 if (!vdev) {
9236 hdd_err("vdev object is NULL");
9237 return -EIO;
9238 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009239
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309240 /* making sure argument string ends with '\0' */
9241 len = (wrqu->data.length + 1);
9242 data = qdf_mem_malloc(len);
9243 if (!data) {
9244 hdd_err("fail to allocate memory %zu", len);
Abhishek Singh3755cdd2019-09-13 10:38:34 +05309245 ret = -EINVAL;
9246 goto exit;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309247 }
9248 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309249 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009250
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05309251 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
9252
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309253 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009254 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309255 ret = -EINVAL;
9256 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009257 }
9258
Abhishek Singh0481d662017-04-11 18:20:11 +05309259 if (!value) {
9260 status = ucfg_scan_pno_stop(vdev);
9261 if (QDF_IS_STATUS_ERROR(status)) {
9262 hdd_err("Failed to disabled PNO");
9263 ret = -EINVAL;
9264 } else {
9265 hdd_debug("PNO scan disabled");
9266 }
9267 goto exit;
9268 }
9269
9270 if (ucfg_scan_get_pno_in_progress(vdev)) {
9271 hdd_debug("pno is already in progress");
9272 ret = -EBUSY;
9273 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009274 }
9275
9276 ptr += offset;
9277
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309278 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009279 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309280 ret = -EINVAL;
9281 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009282 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309283 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009284
Abhishek Singh0481d662017-04-11 18:20:11 +05309285 hdd_debug("PNO enable networks count %d offset %d",
9286 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009287
Abhishek Singh0481d662017-04-11 18:20:11 +05309288 if ((0 == req.networks_cnt) ||
9289 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009290 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05309291 req.networks_cnt);
9292 ret = -EINVAL;
9293 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009294 }
9295
9296 ptr += offset;
9297
Abhishek Singh0481d662017-04-11 18:20:11 +05309298 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009299
Abhishek Singh0481d662017-04-11 18:20:11 +05309300 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009301
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309302 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309303 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009304 &offset);
9305
9306 if (1 != params) {
9307 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309308 ret = -EINVAL;
9309 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009310 }
9311
Abhishek Singh0481d662017-04-11 18:20:11 +05309312 if ((0 == req.networks_list[i].ssid.length) ||
9313 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009314 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309315 req.networks_list[i].ssid.length, i);
9316 ret = -EINVAL;
9317 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009318 }
9319
9320 /* Advance to SSID */
9321 ptr += offset;
9322
Abhishek Singh0481d662017-04-11 18:20:11 +05309323 memcpy(req.networks_list[i].ssid.ssid, ptr,
9324 req.networks_list[i].ssid.length);
9325 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009326
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309327 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309328 &(req.networks_list[i].authentication),
9329 &(req.networks_list[i].encryption),
9330 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009331 &offset);
9332
9333 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009334 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309335 ret = -EINVAL;
9336 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009337 }
9338
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009339 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309340 req.networks_list[i].ssid.length,
9341 req.networks_list[i].ssid.length,
9342 req.networks_list[i].ssid.ssid,
9343 req.networks_list[i].authentication,
9344 req.networks_list[i].encryption,
9345 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009346
9347 /* Advance to channel list */
9348 ptr += offset;
9349
Abhishek Singh0481d662017-04-11 18:20:11 +05309350 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
9351 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009352 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05309353 ret = -EINVAL;
9354 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009355 }
9356
Abhishek Singh0481d662017-04-11 18:20:11 +05309357 if (0 != req.networks_list[i].channel_cnt) {
9358 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009359 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309360 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05309361 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009362 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009363 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309364 ret = -EINVAL;
9365 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009366 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309367 if (!IS_CHANNEL_VALID(value)) {
9368 hdd_err("invalid channel: %hhu", value);
9369 ret = -EINVAL;
9370 goto exit;
9371 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309372 req.networks_list[i].channels[j] =
9373 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009374 /* Advance to next channel number */
9375 ptr += offset;
9376 }
9377 }
9378
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309379 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309380 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009381 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009382 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009383 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309384 ret = -EINVAL;
9385 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009386 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309387 if (req.networks_list[i].bc_new_type > 2) {
9388 hdd_err("invalid bcast nw type: %u",
9389 req.networks_list[i].bc_new_type);
9390 ret = -EINVAL;
9391 goto exit;
9392 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009393
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009394 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309395 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009396
9397 /* Advance to rssi Threshold */
9398 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309399 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309400 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009401 &offset)) {
9402 hdd_err("PNO rssi threshold input is not valid %s",
9403 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309404 ret = -EINVAL;
9405 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009406 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009407 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309408 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009409 /* Advance to next network */
9410 ptr += offset;
9411 } /* For ucNetworkCount */
9412
Abhishek Singh0481d662017-04-11 18:20:11 +05309413 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309414 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05309415 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07009416 ptr += offset;
9417 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309418 if (req.fast_scan_period == 0) {
9419 hdd_err("invalid fast scan period %u",
9420 req.fast_scan_period);
9421 ret = -EINVAL;
9422 goto exit;
9423 }
Dustin Brown43e87292016-10-10 10:38:25 -07009424
Abhishek Singh0481d662017-04-11 18:20:11 +05309425 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309426 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07009427 &offset) > 0)
9428 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05309429 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07009430
Dustin Brown07901ec2018-09-07 11:02:41 -07009431 wlan_pdev_obj_lock(hdd_ctx->pdev);
9432 psoc = wlan_pdev_get_psoc(hdd_ctx->pdev);
9433 wlan_pdev_obj_unlock(hdd_ctx->pdev);
Abhishek Singh0481d662017-04-11 18:20:11 +05309434 ucfg_scan_register_pno_cb(psoc,
9435 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009436
Abhishek Singh0481d662017-04-11 18:20:11 +05309437 ucfg_scan_get_pno_def_params(vdev, &req);
9438 status = ucfg_scan_pno_start(vdev, &req);
9439 if (QDF_IS_STATUS_ERROR(status)) {
9440 hdd_err("Failed to enable PNO");
9441 ret = -EINVAL;
9442 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009443
Abhishek Singh0481d662017-04-11 18:20:11 +05309444exit:
Abhishek Singh3755cdd2019-09-13 10:38:34 +05309445 wlan_objmgr_vdev_release_ref(vdev, WLAN_OSIF_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009446
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309447 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05309448 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009449}
9450
9451static int iw_set_pno(struct net_device *dev,
9452 struct iw_request_info *info,
9453 union iwreq_data *wrqu, char *extra)
9454{
Dustin Brown389e5072018-11-08 17:10:01 +05309455 int errno;
9456 struct osif_vdev_sync *vdev_sync;
9457
9458 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9459 if (errno)
9460 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009461
Dustin Brown389e5072018-11-08 17:10:01 +05309462 errno = __iw_set_pno(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009463
Dustin Brown389e5072018-11-08 17:10:01 +05309464 osif_vdev_sync_op_stop(vdev_sync);
9465
9466 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009467}
9468#endif /* FEATURE_WLAN_SCAN_PNO */
9469
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009470static int __iw_set_band_config(struct net_device *dev,
9471 struct iw_request_info *info,
9472 union iwreq_data *wrqu, char *extra)
9473{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009474 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009475 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08009476 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009477 int *value = (int *)extra;
9478
Dustin Brownfdf17c12018-03-14 12:55:34 -07009479 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009480
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309481 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009482 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309483 return -EPERM;
9484 }
9485
Jeff Johnson441e1f72017-02-07 08:50:49 -08009486 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9487 ret = hdd_check_private_wext_control(hdd_ctx, info);
9488 if (0 != ret)
9489 return ret;
9490
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07009491 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009492}
9493
9494static int iw_set_band_config(struct net_device *dev,
9495 struct iw_request_info *info,
9496 union iwreq_data *wrqu, char *extra)
9497{
Dustin Brown389e5072018-11-08 17:10:01 +05309498 int errno;
9499 struct osif_vdev_sync *vdev_sync;
9500
9501 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9502 if (errno)
9503 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009504
Dustin Brown389e5072018-11-08 17:10:01 +05309505 errno = __iw_set_band_config(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009506
Dustin Brown389e5072018-11-08 17:10:01 +05309507 osif_vdev_sync_op_stop(vdev_sync);
9508
9509 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009510}
9511
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009512static int printk_adapter(void *priv, const char *fmt, ...)
9513{
9514 int ret;
9515 va_list args;
9516
9517 va_start(args, fmt);
9518 ret = vprintk(fmt, args);
9519 ret += printk("\n");
9520 va_end(args);
9521
9522 return ret;
9523}
9524
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009525static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
9526{
9527 qdf_abstract_print *print = &printk_adapter;
9528
9529 switch (log_id) {
9530 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009531 cds_print_htc_credit_history(count, print, NULL);
9532 break;
9533 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009534 wma_print_wmi_cmd_log(count, print, NULL);
9535 break;
9536 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009537 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
9538 break;
9539 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009540 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
9541 break;
9542 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009543 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
9544 break;
9545 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009546 wma_print_wmi_event_log(count, print, NULL);
9547 break;
9548 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009549 wma_print_wmi_rx_event_log(count, print, NULL);
9550 break;
9551 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009552 wma_print_wmi_mgmt_event_log(count, print, NULL);
9553 break;
9554 default:
9555 print(NULL, "Invalid Log Id %d", log_id);
9556 break;
9557 }
9558}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009559
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009560#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
9561int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
9562{
9563 struct hdd_context *hdd_ctx;
9564 int ret;
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309565 bool crash_inject;
9566 QDF_STATUS status;
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009567
9568 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
9569 v1, v2);
9570 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
9571 v1, v2);
9572 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309573
Vignesh Viswanathana1f3a1a2018-10-04 13:10:46 +05309574 status = ucfg_mlme_get_crash_inject(hdd_ctx->psoc, &crash_inject);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309575 if (QDF_IS_STATUS_ERROR(status)) {
9576 hdd_err("Failed to get crash inject ini config");
9577 return 0;
9578 }
9579
9580 if (!crash_inject) {
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009581 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
9582 return 0;
9583 }
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309584
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009585 if (v1 == 3) {
9586 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
9587 return 0;
9588 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009589 ret = wma_cli_set2_command(adapter->vdev_id,
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009590 GEN_PARAM_CRASH_INJECT,
9591 v1, v2, GEN_CMD);
9592 return ret;
9593}
9594#endif
9595
Nirav Shahd21a2e32018-04-20 16:34:43 +05309596#ifdef CONFIG_DP_TRACE
9597void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
9598{
9599 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
9600 cmd_type, count);
9601 if (cmd_type == DUMP_DP_TRACE)
9602 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
9603 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
9604 qdf_dp_trace_enable_live_mode();
9605 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
9606 qdf_dp_trace_clear_buffer();
9607 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
9608 qdf_dp_trace_disable_live_mode();
9609}
9610#endif
9611
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009612static int __iw_set_two_ints_getnone(struct net_device *dev,
9613 struct iw_request_info *info,
9614 union iwreq_data *wrqu, char *extra)
9615{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009616 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009617 int *value = (int *)extra;
9618 int sub_cmd = value[0];
9619 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08009620 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009621 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08009622 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009623
Dustin Brownfdf17c12018-03-14 12:55:34 -07009624 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009625
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009626 ret = wlan_hdd_validate_context(hdd_ctx);
9627 if (0 != ret)
9628 return ret;
9629
Jeff Johnson441e1f72017-02-07 08:50:49 -08009630 ret = hdd_check_private_wext_control(hdd_ctx, info);
9631 if (0 != ret)
9632 return ret;
9633
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009634 switch (sub_cmd) {
9635 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009636 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009637 ret = wma_cli_set_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009638 WMI_STA_SMPS_PARAM_CMDID,
9639 value[1] << WMA_SMPS_PARAM_VALUE_S
9640 | value[2],
9641 VDEV_CMD);
9642 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009643 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009644 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009645 break;
Govind Singha471e5e2015-10-12 17:11:14 +05309646 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07009647 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309648 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009649 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309650 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
9651 value[1], value[2], DBG_CMD);
9652 break;
9653 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07009654 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309655 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009656 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309657 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
9658 value[1], value[2], DBG_CMD);
9659 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009660 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
9661 hdd_debug("Ioctl to set dual fw mode config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08009662 status =
9663 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
9664 &dual_mac_feature);
9665 if (status != QDF_STATUS_SUCCESS)
9666 hdd_err("can't get dual mac feature val, use def");
9667 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009668 hdd_err("Dual mac feature is disabled from INI");
9669 return -EPERM;
9670 }
9671 hdd_debug("%d %d", value[1], value[2]);
Dustin Brown05d81302018-09-11 16:49:22 -07009672 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009673 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009674 break;
9675 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05309676 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009677 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009678 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009679 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009680 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07009681 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08009682 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
9683 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009684 break;
9685 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07009686 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009687 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009688 case WE_LOG_BUFFER: {
9689 int log_id = value[1];
9690 uint32_t count = value[2] < 0 ? 0 : value[2];
9691
9692 hdd_ioctl_log_buffer(log_id, count);
9693
9694 break;
9695 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07009696 case WE_SET_BA_AGEING_TIMEOUT:
9697 {
9698 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
9699
9700 if (!soc) {
9701 hdd_err("Invalid handles");
9702 break;
9703 }
9704 cdp_set_ba_timeout(soc, value[1], value[2]);
9705 break;
9706 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009707 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07009708 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009709 break;
9710 }
9711
9712 return ret;
9713}
9714
9715static int iw_set_two_ints_getnone(struct net_device *dev,
9716 struct iw_request_info *info,
9717 union iwreq_data *wrqu, char *extra)
9718{
Dustin Brown389e5072018-11-08 17:10:01 +05309719 int errno;
9720 struct osif_vdev_sync *vdev_sync;
9721
9722 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9723 if (errno)
9724 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009725
Dustin Brown389e5072018-11-08 17:10:01 +05309726 errno = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009727
Dustin Brown389e5072018-11-08 17:10:01 +05309728 osif_vdev_sync_op_stop(vdev_sync);
9729
9730 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009731}
9732
9733/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009734
9735static const iw_handler we_private[] = {
9736
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009737 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9738 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9739 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009740 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9741 iw_set_three_ints_getnone,
9742 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009743 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009744 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9745 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009746 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9747 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309748#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009749 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309750#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009751 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9752 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9753 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009754 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009755 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9756 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9757 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9758 iw_set_keepalive_params,
9759#ifdef WLAN_FEATURE_PACKET_FILTERING
9760 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9761 iw_set_packet_filter_params,
9762#endif
9763#ifdef FEATURE_WLAN_SCAN_PNO
9764 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9765#endif
9766 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009767 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9768 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009769 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08009770#ifdef FEATURE_WLM_STATS
9771 [WLAN_GET_WLM_STATS - SIOCIWFIRSTPRIV] = iw_get_wlm_stats,
9772#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009773 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9774 iw_set_two_ints_getnone,
9775 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9776 iw_set_dot11p_channel_sched,
9777};
9778
9779/*Maximum command length can be only 15 */
9780static const struct iw_priv_args we_private_args[] = {
9781
9782 /* handlers for main ioctl */
9783 {WLAN_PRIV_SET_INT_GET_NONE,
9784 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9785 0,
9786 ""},
9787
9788 /* handlers for sub-ioctl */
9789 {WE_SET_11D_STATE,
9790 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9791 0,
9792 "set11Dstate"},
9793
9794 {WE_WOWL,
9795 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9796 0,
9797 "wowl"},
9798
9799 {WE_SET_POWER,
9800 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9801 0,
9802 "setPower"},
9803
9804 {WE_SET_MAX_ASSOC,
9805 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9806 0,
9807 "setMaxAssoc"},
9808
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009809 {WE_SET_SCAN_DISABLE,
9810 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9811 0,
9812 "scan_disable"},
9813
9814 {WE_SET_DATA_INACTIVITY_TO,
9815 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9816 0,
9817 "inactivityTO"},
9818
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05309819 {WE_SET_WOW_DATA_INACTIVITY_TO,
9820 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9821 0,
9822 "wow_ito"},
9823
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009824 {WE_SET_MAX_TX_POWER,
9825 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9826 0,
9827 "setMaxTxPower"},
9828
9829 {WE_SET_TX_POWER,
9830 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9831 0,
9832 "setTxPower"},
9833
9834 {WE_SET_MC_RATE,
9835 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9836 0,
9837 "setMcRate"},
9838
9839 {WE_SET_MAX_TX_POWER_2_4,
9840 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9841 0,
9842 "setTxMaxPower2G"},
9843
9844 {WE_SET_MAX_TX_POWER_5_0,
9845 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9846 0,
9847 "setTxMaxPower5G"},
9848
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309849#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009850 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05309851 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009852 0,
9853 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309854#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009855
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009856 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
9857 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -08009858 * will support both
9859 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009860 {WE_SET_MAX_TX_POWER,
9861 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9862 0,
9863 "setTxMaxPower"},
9864
Jeff Johnson0187c622019-01-04 06:39:44 -08009865#ifdef HASTINGS_BT_WAR
9866 {WE_SET_HASTINGS_BT_WAR,
9867 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9868 0,
9869 "hastings_bt_war"},
9870#endif
9871
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009872 {WE_SET_TM_LEVEL,
9873 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9874 0,
9875 "setTmLevel"},
9876
9877 {WE_SET_PHYMODE,
9878 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9879 0,
9880 "setphymode"},
9881
9882 {WE_SET_NSS,
9883 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9884 0,
9885 "nss"},
9886
9887 {WE_SET_LDPC,
9888 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9889 0,
9890 "ldpc"},
9891
9892 {WE_SET_TX_STBC,
9893 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9894 0,
9895 "tx_stbc"},
9896
9897 {WE_SET_RX_STBC,
9898 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9899 0,
9900 "rx_stbc"},
9901
9902 {WE_SET_SHORT_GI,
9903 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9904 0,
9905 "shortgi"},
9906
9907 {WE_SET_RTSCTS,
9908 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9909 0,
9910 "enablertscts"},
9911
9912 {WE_SET_CHWIDTH,
9913 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9914 0,
9915 "chwidth"},
9916
9917 {WE_SET_ANI_EN_DIS,
9918 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9919 0,
9920 "anienable"},
9921
9922 {WE_SET_ANI_POLL_PERIOD,
9923 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9924 0,
9925 "aniplen"},
9926
9927 {WE_SET_ANI_LISTEN_PERIOD,
9928 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9929 0,
9930 "anilislen"},
9931
9932 {WE_SET_ANI_OFDM_LEVEL,
9933 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9934 0,
9935 "aniofdmlvl"},
9936
9937 {WE_SET_ANI_CCK_LEVEL,
9938 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9939 0,
9940 "aniccklvl"},
9941
9942 {WE_SET_DYNAMIC_BW,
9943 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9944 0,
9945 "cwmenable"},
9946
9947 {WE_SET_CTS_CBW,
9948 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9949 0,
9950 "cts_cbw" },
9951
9952 {WE_SET_GTX_HT_MCS,
9953 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9954 0,
9955 "gtxHTMcs"},
9956
9957 {WE_SET_GTX_VHT_MCS,
9958 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9959 0,
9960 "gtxVHTMcs"},
9961
9962 {WE_SET_GTX_USRCFG,
9963 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9964 0,
9965 "gtxUsrCfg"},
9966
9967 {WE_SET_GTX_THRE,
9968 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9969 0,
9970 "gtxThre"},
9971
9972 {WE_SET_GTX_MARGIN,
9973 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9974 0,
9975 "gtxMargin"},
9976
9977 {WE_SET_GTX_STEP,
9978 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9979 0,
9980 "gtxStep"},
9981
9982 {WE_SET_GTX_MINTPC,
9983 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9984 0,
9985 "gtxMinTpc"},
9986
9987 {WE_SET_GTX_BWMASK,
9988 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9989 0,
9990 "gtxBWMask"},
9991
9992 {WE_SET_TX_CHAINMASK,
9993 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9994 0,
9995 "txchainmask"},
9996
9997 {WE_SET_RX_CHAINMASK,
9998 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9999 0,
10000 "rxchainmask"},
10001
10002 {WE_SET_11N_RATE,
10003 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10004 0,
10005 "set11NRates"},
10006
10007 {WE_SET_VHT_RATE,
10008 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10009 0,
10010 "set11ACRates"},
10011
10012 {WE_SET_AMPDU,
10013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10014 0,
10015 "ampdu"},
10016
10017 {WE_SET_AMSDU,
10018 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10019 0,
10020 "amsdu"},
10021
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010022 {WE_SET_TXPOW_2G,
10023 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10024 0,
10025 "txpow2g"},
10026
10027 {WE_SET_TXPOW_5G,
10028 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10029 0,
10030 "txpow5g"},
10031
Wen Gong99768902018-04-25 12:07:49 +080010032#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010033 /* Sub-cmds DBGLOG specific commands */
10034 {WE_DBGLOG_LOG_LEVEL,
10035 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10036 0,
10037 "dl_loglevel"},
10038
10039 {WE_DBGLOG_VAP_ENABLE,
10040 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10041 0,
10042 "dl_vapon"},
10043
10044 {WE_DBGLOG_VAP_DISABLE,
10045 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10046 0,
10047 "dl_vapoff"},
10048
10049 {WE_DBGLOG_MODULE_ENABLE,
10050 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10051 0,
10052 "dl_modon"},
10053
10054 {WE_DBGLOG_MODULE_DISABLE,
10055 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10056 0,
10057 "dl_modoff"},
10058
10059 {WE_DBGLOG_MOD_LOG_LEVEL,
10060 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10061 0,
10062 "dl_mod_loglevel"},
10063
10064 {WE_DBGLOG_TYPE,
10065 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10066 0,
10067 "dl_type"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010068
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010069 {WE_DBGLOG_REPORT_ENABLE,
10070 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10071 0,
10072 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +080010073#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010074
10075 {WE_SET_TXRX_FWSTATS,
10076 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10077 0,
10078 "txrx_fw_stats"},
10079
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010080 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +080010081 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010082 0,
10083 "txrx_stats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010084#ifdef FW_THERMAL_THROTTLE_SUPPORT
10085 {WE_SET_THERMAL_THROTTLE_CFG,
10086 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10087 0,
10088 "set_thermal_cfg"},
10089#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Krishna Reddya50d09f2019-02-04 14:55:06 +053010090 {WE_SET_BTCOEX_MODE,
10091 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10092 0, "set_btc_mode" },
10093 {WE_SET_BTCOEX_RSSI_THRESHOLD,
10094 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10095 0, "set_btc_rssi" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010096 {WE_TXRX_FWSTATS_RESET,
10097 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10098 0,
10099 "txrx_fw_st_rst"},
10100
10101 {WE_PPS_PAID_MATCH,
10102 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10103 0, "paid_match"},
10104
10105 {WE_PPS_GID_MATCH,
10106 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10107 0, "gid_match"},
10108
10109 {WE_PPS_EARLY_TIM_CLEAR,
10110 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10111 0, "tim_clear"},
10112
10113 {WE_PPS_EARLY_DTIM_CLEAR,
10114 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10115 0, "dtim_clear"},
10116
10117 {WE_PPS_EOF_PAD_DELIM,
10118 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10119 0, "eof_delim"},
10120
10121 {WE_PPS_MACADDR_MISMATCH,
10122 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10123 0, "mac_match"},
10124
10125 {WE_PPS_DELIM_CRC_FAIL,
10126 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10127 0, "delim_fail"},
10128
10129 {WE_PPS_GID_NSTS_ZERO,
10130 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10131 0, "nsts_zero"},
10132
10133 {WE_PPS_RSSI_CHECK,
10134 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10135 0, "rssi_chk"},
10136
10137 {WE_PPS_5G_EBT,
10138 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10139 0, "5g_ebt"},
10140
10141 {WE_SET_HTSMPS,
10142 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10143 0, "htsmps"},
10144
10145 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
10146 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10147 0, "set_qpspollcnt"},
10148
10149 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
10150 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10151 0, "set_qtxwake"},
10152
10153 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10154 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10155 0, "set_qwakeintv"},
10156
10157 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10158 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10159 0, "set_qnodatapoll"},
10160
10161 /* handlers for MCC time quota and latency sub ioctls */
10162 {WE_MCC_CONFIG_LATENCY,
10163 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10164 0, "setMccLatency"},
10165
10166 {WE_MCC_CONFIG_QUOTA,
10167 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10168 0, "setMccQuota"},
10169
10170 {WE_SET_DEBUG_LOG,
10171 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10172 0, "setDbgLvl"},
10173
10174 /* handlers for early_rx power save */
10175 {WE_SET_EARLY_RX_ADJUST_ENABLE,
10176 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10177 0, "erx_enable"},
10178
10179 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
10180 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10181 0, "erx_bmiss_val"},
10182
10183 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
10184 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10185 0, "erx_bmiss_smpl"},
10186
10187 {WE_SET_EARLY_RX_SLOP_STEP,
10188 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10189 0, "erx_slop_step"},
10190
10191 {WE_SET_EARLY_RX_INIT_SLOP,
10192 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10193 0, "erx_init_slop"},
10194
10195 {WE_SET_EARLY_RX_ADJUST_PAUSE,
10196 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10197 0, "erx_adj_pause"},
10198
10199 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
10200 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10201 0, "erx_dri_sample"},
10202
10203 {WE_DUMP_STATS,
10204 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10205 0, "dumpStats"},
10206
10207 {WE_CLEAR_STATS,
10208 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10209 0, "clearStats"},
10210
Govind Singha471e5e2015-10-12 17:11:14 +053010211 {WE_START_FW_PROFILE,
10212 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10213 0, "startProfile"},
10214
Abhishek Singh1bdb1572015-10-16 16:24:19 +053010215 {WE_SET_CHANNEL,
10216 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10217 0, "setChanChange" },
10218
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +053010219 {WE_SET_CONC_SYSTEM_PREF,
10220 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10221 0, "setConcSysPref" },
10222
Jeff Johnson011c4502017-10-05 15:25:56 -070010223 {WE_SET_PDEV_RESET,
10224 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10225 0, "pdev_reset" },
10226
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010227 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -080010228 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10229 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010230
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010231 {WLAN_PRIV_SET_NONE_GET_INT,
10232 0,
10233 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10234 ""},
10235
10236 /* handlers for sub-ioctl */
10237 {WE_GET_11D_STATE,
10238 0,
10239 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10240 "get11Dstate"},
10241
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010242 {WE_GET_WLAN_DBG,
10243 0,
10244 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10245 "getwlandbg"},
10246
10247 {WE_GET_MAX_ASSOC,
10248 0,
10249 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10250 "getMaxAssoc"},
10251
10252 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010253 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10254 "getAutoChannel"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010255
10256 {WE_GET_CONCURRENCY_MODE,
10257 0,
10258 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10259 "getconcurrency"},
10260
10261 {WE_GET_NSS,
10262 0,
10263 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10264 "get_nss"},
10265
10266 {WE_GET_LDPC,
10267 0,
10268 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10269 "get_ldpc"},
10270
10271 {WE_GET_TX_STBC,
10272 0,
10273 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10274 "get_tx_stbc"},
10275
10276 {WE_GET_RX_STBC,
10277 0,
10278 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10279 "get_rx_stbc"},
10280
10281 {WE_GET_SHORT_GI,
10282 0,
10283 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10284 "get_shortgi"},
10285
10286 {WE_GET_RTSCTS,
10287 0,
10288 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10289 "get_rtscts"},
10290
10291 {WE_GET_CHWIDTH,
10292 0,
10293 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10294 "get_chwidth"},
10295
10296 {WE_GET_ANI_EN_DIS,
10297 0,
10298 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10299 "get_anienable"},
10300
10301 {WE_GET_ANI_POLL_PERIOD,
10302 0,
10303 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10304 "get_aniplen"},
10305
10306 {WE_GET_ANI_LISTEN_PERIOD,
10307 0,
10308 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10309 "get_anilislen"},
10310
10311 {WE_GET_ANI_OFDM_LEVEL,
10312 0,
10313 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10314 "get_aniofdmlvl"},
10315
10316 {WE_GET_ANI_CCK_LEVEL,
10317 0,
10318 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10319 "get_aniccklvl"},
10320
10321 {WE_GET_DYNAMIC_BW,
10322 0,
10323 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10324 "get_cwmenable"},
10325
10326 {WE_GET_GTX_HT_MCS,
10327 0,
10328 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10329 "get_gtxHTMcs"},
10330
10331 {WE_GET_GTX_VHT_MCS,
10332 0,
10333 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10334 "get_gtxVHTMcs"},
10335
10336 {WE_GET_GTX_USRCFG,
10337 0,
10338 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10339 "get_gtxUsrCfg"},
10340
10341 {WE_GET_GTX_THRE,
10342 0,
10343 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10344 "get_gtxThre"},
10345
10346 {WE_GET_GTX_MARGIN,
10347 0,
10348 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10349 "get_gtxMargin"},
10350
10351 {WE_GET_GTX_STEP,
10352 0,
10353 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10354 "get_gtxStep"},
10355
10356 {WE_GET_GTX_MINTPC,
10357 0,
10358 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10359 "get_gtxMinTpc"},
10360
10361 {WE_GET_GTX_BWMASK,
10362 0,
10363 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10364 "get_gtxBWMask"},
10365
10366 {WE_GET_TX_CHAINMASK,
10367 0,
10368 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10369 "get_txchainmask"},
10370
10371 {WE_GET_RX_CHAINMASK,
10372 0,
10373 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10374 "get_rxchainmask"},
10375
10376 {WE_GET_11N_RATE,
10377 0,
10378 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10379 "get_11nrate"},
10380
10381 {WE_GET_AMPDU,
10382 0,
10383 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10384 "get_ampdu"},
10385
10386 {WE_GET_AMSDU,
10387 0,
10388 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10389 "get_amsdu"},
10390
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010391 {WE_GET_TXPOW_2G,
10392 0,
10393 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10394 "get_txpow2g"},
10395
10396 {WE_GET_TXPOW_5G,
10397 0,
10398 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10399 "get_txpow5g"},
10400
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010401 {WE_GET_PPS_PAID_MATCH,
10402 0,
10403 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10404 "get_paid_match"},
10405
10406 {WE_GET_PPS_GID_MATCH,
10407 0,
10408 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10409 "get_gid_match"},
10410
10411 {WE_GET_PPS_EARLY_TIM_CLEAR,
10412 0,
10413 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10414 "get_tim_clear"},
10415
10416 {WE_GET_PPS_EARLY_DTIM_CLEAR,
10417 0,
10418 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10419 "get_dtim_clear"},
10420
10421 {WE_GET_PPS_EOF_PAD_DELIM,
10422 0,
10423 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10424 "get_eof_delim"},
10425
10426 {WE_GET_PPS_MACADDR_MISMATCH,
10427 0,
10428 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10429 "get_mac_match"},
10430
10431 {WE_GET_PPS_DELIM_CRC_FAIL,
10432 0,
10433 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10434 "get_delim_fail"},
10435
10436 {WE_GET_PPS_GID_NSTS_ZERO,
10437 0,
10438 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10439 "get_nsts_zero"},
10440
10441 {WE_GET_PPS_RSSI_CHECK,
10442 0,
10443 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10444 "get_rssi_chk"},
10445
10446 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
10447 0,
10448 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10449 "get_qpspollcnt"},
10450
10451 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
10452 0,
10453 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10454 "get_qtxwake"},
10455
10456 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10457 0,
10458 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10459 "get_qwakeintv"},
10460
10461 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10462 0,
10463 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10464 "get_qnodatapoll"},
10465
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010466 {WE_CAP_TSF,
10467 0,
10468 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10469 "cap_tsf"},
10470
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010471 {WE_GET_TEMPERATURE,
10472 0,
10473 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10474 "get_temp"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010475
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010476 {WE_GET_DCM,
10477 0,
10478 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10479 "get_dcm"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010480
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010481 {WE_GET_RANGE_EXT,
10482 0,
10483 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10484 "get_range_ext"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010485
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010486 /* handlers for main ioctl */
10487 {WLAN_PRIV_SET_CHAR_GET_NONE,
10488 IW_PRIV_TYPE_CHAR | 512,
10489 0,
10490 ""},
10491
10492 /* handlers for sub-ioctl */
10493 {WE_WOWL_ADD_PTRN,
10494 IW_PRIV_TYPE_CHAR | 512,
10495 0,
10496 "wowlAddPtrn"},
10497
10498 {WE_WOWL_DEL_PTRN,
10499 IW_PRIV_TYPE_CHAR | 512,
10500 0,
10501 "wowlDelPtrn"},
10502
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010503 /* handlers for sub-ioctl */
10504 {WE_NEIGHBOR_REPORT_REQUEST,
10505 IW_PRIV_TYPE_CHAR | 512,
10506 0,
10507 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080010508
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010509 {WE_SET_AP_WPS_IE,
10510 IW_PRIV_TYPE_CHAR | 512,
10511 0,
10512 "set_ap_wps_ie"},
10513
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070010514#ifdef WLAN_UNIT_TEST
10515 {WE_UNIT_TEST,
10516 IW_PRIV_TYPE_CHAR | 512,
10517 0,
10518 "unit_test"},
10519#endif
10520
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010521 /* handlers for main ioctl */
10522 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
10523 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10524 0,
10525 ""},
10526
10527 /* handlers for sub-ioctl */
10528 {WE_SET_WLAN_DBG,
10529 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10530 0,
10531 "setwlandbg"},
10532
Nirav Shahd21a2e32018-04-20 16:34:43 +053010533#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010534 /* handlers for sub-ioctl */
10535 {WE_SET_DP_TRACE,
10536 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10537 0,
10538 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010539#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010540
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053010541 {WE_SET_FW_TEST,
10542 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10543 0, "fw_test"},
10544
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010545 /* handlers for main ioctl */
10546 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
10547 0,
10548 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010549 ""},
10550
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010551 {WE_GET_TSF,
10552 0,
10553 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010554 "get_tsf"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010555
10556 {WE_SET_DUAL_MAC_SCAN_CONFIG,
10557 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10558 0,
10559 "set_scan_cfg"},
10560
10561 /* handlers for main ioctl */
10562 {WLAN_PRIV_GET_CHAR_SET_NONE,
10563 0,
10564 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10565 ""},
10566
10567 /* handlers for sub-ioctl */
10568 {WE_WLAN_VERSION,
10569 0,
10570 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10571 "version"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010572
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010573 {WE_GET_STATS,
10574 0,
10575 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10576 "getStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010577
Dustin Brownd9322482017-01-09 12:46:03 -080010578 {WE_GET_SUSPEND_RESUME_STATS,
10579 0,
10580 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10581 "getSuspendStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010582
Govind Singha471e5e2015-10-12 17:11:14 +053010583 {WE_LIST_FW_PROFILE,
10584 0,
10585 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10586 "listProfile"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010587
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010588 {WE_GET_STATES,
10589 0,
10590 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10591 "getHostStates"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010592
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010593 {WE_GET_CFG,
10594 0,
10595 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10596 "getConfig"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010597
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010598 {WE_GET_RSSI,
10599 0,
10600 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10601 "getRSSI"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010602
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010603 {WE_GET_WMM_STATUS,
10604 0,
10605 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10606 "getWmmStatus"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010607
10608 {WE_GET_CHANNEL_LIST,
10609 0,
10610 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10611 "getChannelList"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010612#ifdef FEATURE_WLAN_TDLS
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010613 {WE_GET_TDLS_PEERS,
10614 0,
10615 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10616 "getTdlsPeers"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010617#endif
10618#ifdef WLAN_FEATURE_11W
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010619 {WE_GET_11W_INFO,
10620 0,
10621 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10622 "getPMFInfo"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010623#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010624 {WE_GET_STA_CXN_INFO,
10625 0,
10626 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10627 "get_cxn_info" },
Krunal Soni5e483782018-10-25 15:42:44 -070010628
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010629 {WE_GET_IBSS_STA_INFO,
10630 0,
10631 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10632 "getIbssSTAs"},
10633
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010634 {WE_GET_PHYMODE,
10635 0,
10636 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10637 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010638#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010639 {WE_GET_OEM_DATA_CAP,
10640 0,
10641 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10642 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010643#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010644 {WE_GET_SNR,
10645 0,
10646 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10647 "getSNR"},
10648
Krunal Soni6c3859f2018-06-01 19:57:40 -070010649 {WE_GET_BA_AGEING_TIMEOUT,
10650 0,
10651 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10652 "get_ba_timeout"},
10653
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010654 /* handlers for main ioctl */
10655 {WLAN_PRIV_SET_NONE_GET_NONE,
10656 0,
10657 0,
10658 ""},
10659
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010660 /* handlers for sub-ioctl */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010661 {WE_IBSS_GET_PEER_INFO_ALL,
10662 0,
10663 0,
10664 "ibssPeerInfoAll"},
10665
Govind Singha471e5e2015-10-12 17:11:14 +053010666 {WE_GET_FW_PROFILE_DATA,
10667 0,
10668 0,
10669 "getProfileData"},
10670
10671 {WE_SET_REASSOC_TRIGGER,
10672 0,
10673 0,
10674 "reassoc"},
10675
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010676 {WE_STOP_OBSS_SCAN,
10677 0,
10678 0,
10679 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010680 /* handlers for main ioctl */
10681 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
10682 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10683 0,
10684 ""},
10685
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010686#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010687 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010688 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
10689 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10690 0,
10691 "setdumplog"},
10692
10693 {WE_MTRACE_DUMP_CMD,
10694 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10695 0,
10696 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010697#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -080010698
10699 {WE_POLICY_MANAGER_CINFO_CMD,
10700 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10701 0,
10702 "pm_cinfo"},
10703
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010704#ifdef MPC_UT_FRAMEWORK
10705 {WE_POLICY_MANAGER_CLIST_CMD,
10706 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10707 0,
10708 "pm_clist"},
10709
10710 {WE_POLICY_MANAGER_DLIST_CMD,
10711 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10712 0,
10713 "pm_dlist"},
10714
10715 {WE_POLICY_MANAGER_DBS_CMD,
10716 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10717 0,
10718 "pm_dbs"},
10719
10720 {WE_POLICY_MANAGER_PCL_CMD,
10721 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10722 0,
10723 "pm_pcl"},
10724
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010725 {WE_POLICY_MANAGER_ULIST_CMD,
10726 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10727 0,
10728 "pm_ulist"},
10729
10730 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
10731 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10732 0,
10733 "pm_query_action"},
10734
10735 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
10736 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10737 0,
10738 "pm_query_allow"},
10739
10740 {WE_POLICY_MANAGER_SCENARIO_CMD,
10741 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10742 0,
10743 "pm_run_scenario"},
10744
10745 {WE_POLICY_SET_HW_MODE_CMD,
10746 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10747 0,
10748 "pm_set_hw_mode"},
10749#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010750 {WE_UNIT_TEST_CMD,
10751 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10752 0,
10753 "setUnitTestCmd"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010754
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010755 {WE_MAC_PWR_DEBUG_CMD,
10756 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10757 0,
10758 "halPwrDebug"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010759#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10760 {WE_LED_FLASHING_PARAM,
10761 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10762 0,
10763 "gpio_control"},
10764#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010765#ifdef WLAN_DEBUG
10766 {WE_SET_CHAN_AVOID,
10767 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10768 0,
10769 "ch_avoid"},
10770#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010771 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010772 {WLAN_PRIV_FIPS_TEST,
10773 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10774 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10775 "fips_test"},
10776
10777 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010778 {WLAN_PRIV_ADD_TSPEC,
10779 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10780 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10781 "addTspec"},
10782
10783 /* handlers for main ioctl */
10784 {WLAN_PRIV_DEL_TSPEC,
10785 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10786 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10787 "delTspec"},
10788
10789 /* handlers for main ioctl */
10790 {WLAN_PRIV_GET_TSPEC,
10791 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10792 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10793 "getTspec"},
10794
10795 /* handlers for main ioctl - host offload */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010796 {WLAN_PRIV_SET_HOST_OFFLOAD,
10797 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
10798 0,
10799 "setHostOffload"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010800
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010801 {WLAN_GET_WLAN_STATISTICS,
10802 0,
10803 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10804 "getWlanStats"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010805
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010806 {WLAN_SET_KEEPALIVE_PARAMS,
Jeff Johnson562ccad2019-02-06 22:10:24 -080010807 IW_PRIV_TYPE_BYTE | sizeof(struct keep_alive_req) |
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010808 IW_PRIV_SIZE_FIXED,
10809 0,
10810 "setKeepAlive"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010811#ifdef WLAN_FEATURE_PACKET_FILTERING
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010812 {WLAN_SET_PACKET_FILTER_PARAMS,
10813 IW_PRIV_TYPE_BYTE |
10814 sizeof(struct pkt_filter_cfg),
10815 0,
10816 "setPktFilter"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010817#endif
10818#ifdef FEATURE_WLAN_SCAN_PNO
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010819 {WLAN_SET_PNO,
10820 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10821 0,
10822 "setpno"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010823#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010824 {WLAN_SET_BAND_CONFIG,
10825 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10826 0,
10827 "SETBAND"},
Dustin Brown0cbc7572016-12-16 13:54:40 -080010828
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010829 {WLAN_PRIV_SET_MCBC_FILTER,
10830 0,
10831 0,
10832 "setMCBCFilter"},
10833
10834 {WLAN_GET_LINK_SPEED,
10835 IW_PRIV_TYPE_CHAR | 18,
10836 IW_PRIV_TYPE_CHAR | 5,
10837 "getLinkSpeed"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010838
Krunal Sonif9ba53d2019-01-03 21:44:41 -080010839#ifdef FEATURE_WLM_STATS
10840 {WLAN_GET_WLM_STATS,
10841 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10842 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10843 "get_wlm_stats"},
10844#endif
10845
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010846 /* handlers for main ioctl */
10847 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
10848 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10849 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010850 ""},
10851
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010852 {WE_SET_SMPS_PARAM,
10853 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010854 0, "set_smps_param"},
10855
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010856 {WLAN_SET_DOT11P_CHANNEL_SCHED,
10857 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010858 0, "set_dot11p" },
10859
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010860#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010861 {WE_SET_FW_CRASH_INJECT,
10862 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010863 0, "crash_inject"},
10864
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010865#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053010866#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070010867 {WE_LOG_BUFFER,
10868 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010869 0, "log_buffer"},
10870
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010871#endif
Krunal Soni6c3859f2018-06-01 19:57:40 -070010872 {WE_SET_BA_AGEING_TIMEOUT,
10873 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010874 0, "set_ba_timeout"},
10875
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010876#ifdef WLAN_SUSPEND_RESUME_TEST
10877 {WE_SET_WLAN_SUSPEND,
10878 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010879 0, "wlan_suspend"},
10880
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010881 {WE_SET_WLAN_RESUME,
10882 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010883 0, "wlan_resume"},
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010884#endif
Govind Singha471e5e2015-10-12 17:11:14 +053010885 {WE_ENABLE_FW_PROFILE,
10886 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010887 0, "enableProfile"},
10888
Govind Singha471e5e2015-10-12 17:11:14 +053010889 {WE_SET_FW_PROFILE_HIST_INTVL,
10890 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010891 0, "set_hist_intvl"},
10892
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010893 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
10894 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010895 0, "set_fw_mode_cfg"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010896#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010897 {WE_DUMP_DP_TRACE_LEVEL,
10898 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010899 0, "dump_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010900#endif
Nirav Shah73713f72018-05-17 14:50:41 +053010901#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070010902 {WE_SET_MON_MODE_CHAN,
10903 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010904 0, "setMonChan"},
Nirav Shah73713f72018-05-17 14:50:41 +053010905#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070010906 {WE_GET_ROAM_SYNCH_DELAY,
10907 0,
10908 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010909 "hostroamdelay"},
10910
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080010911 {WE_SET_11AX_RATE,
10912 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10913 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010914 "set_11ax_rate"},
10915
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010916 {WE_SET_DCM,
10917 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10918 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010919 "enable_dcm"},
10920
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010921 {WE_SET_RANGE_EXT,
10922 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10923 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010924 "range_ext"},
10925
Naveen Rawatc921c7b2017-06-13 17:29:51 -070010926 {WLAN_PRIV_SET_FTIES,
10927 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
10928 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010929 "set_ft_ies"},
10930
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010931#ifdef WLAN_FEATURE_MOTION_DETECTION
10932 {WE_MOTION_DET_START_STOP,
10933 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10934 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010935 "mt_start"},
10936
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010937 {WE_MOTION_DET_BASE_LINE_START_STOP,
10938 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10939 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010940 "mt_bl_start"},
10941
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010942 {WE_MOTION_DET_CONFIG_PARAM,
10943 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10944 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010945 "mt_config"},
10946
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010947 {WE_MOTION_DET_BASE_LINE_CONFIG_PARAM,
10948 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10949 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010950 "mt_bl_config"},
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010951#endif /* WLAN_FEATURE_MOTION_DETECTION */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010952};
10953
10954const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010955 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053010956 .num_private = QDF_ARRAY_SIZE(we_private),
10957 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010958
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010959 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010960 .private = (iw_handler *) we_private,
10961 .private_args = we_private_args,
10962 .get_wireless_stats = NULL,
10963};
10964
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010965void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010966{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010967 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010968
Dustin Browne7e71d32018-05-11 16:00:08 -070010969 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010970
Dustin Browne74003f2018-03-14 12:51:58 -070010971 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010972}
10973
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010974void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010975{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010976 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010977
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010978 rtnl_lock();
10979 dev->wireless_handlers = NULL;
10980 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010981
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010982 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010983}