blob: 5eaf0c6eee929ef715d5d537387b8b909ee1ab07 [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 */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302219
Abhishek Singh49b654e2016-12-01 16:11:17 +05302220/*
2221 * <ioctl>
2222 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2223 *
Jeff Johnson0a082d92019-03-04 12:25:49 -08002224 * @INPUT: sta_id
Abhishek Singh49b654e2016-12-01 16:11:17 +05302225 *
Jeff Johnson0a082d92019-03-04 12:25:49 -08002226 * @OUTPUT: print ibss peer corresponding to sta_id in info logs
Abhishek Singh49b654e2016-12-01 16:11:17 +05302227 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2228 *
2229 * This IOCTL is used to print the specific ibss peers's MAC,
2230 * rate and RSSI in info logs
2231 *
2232 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2233 * iwpriv wlan0 ibssPeerInfo 0
2234 *
2235 * Supported Feature: IBSS
2236 *
2237 * Usage: Internal/External
2238 *
2239 * </ioctl>
2240 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002241#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002242#define WE_UNIT_TEST_CMD 7
2243
2244#define WE_MTRACE_DUMP_CMD 8
2245#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2246
2247
2248#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2249#define WE_LED_FLASHING_PARAM 10
2250#endif
2251
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302252/*
2253 * <ioctl>
2254 * pm_clist - Increments the index value of the concurrent connection list
2255 * and update with the input parameters provided.
2256 *
2257 * @INPUT: Following 8 arguments:
2258 * @vdev_id: vdev id
2259 * @tx_streams: TX streams
2260 * @rx_streams: RX streams
2261 * @chain_mask: Chain mask
2262 * @type: vdev_type
2263 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2264 * @sub_type: vdev_subtype
2265 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2266 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2267 * @channel: Channel
2268 * @mac: Mac id
2269 *
2270 * @OUTPUT: None
2271 *
2272 * This IOCTL is used to increments the index value of the concurrent connection
2273 * list and update with the input parameters provided.
2274 *
2275 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2276 * sub_type channel mac
2277 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2278 *
2279 * Supported Feature: DBS
2280 *
2281 * Usage: Internal/External
2282 *
2283 * </ioctl>
2284 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002285#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302286
2287/*
2288 * <ioctl>
2289 * pm_dlist - Delete the index from the concurrent connection list that is
2290 * present in the given vdev_id.
2291 *
2292 * @INPUT: delete_all, vdev_id
2293 * @delete_all: delete all indices
2294 * @vdev_id: vdev id
2295 *
2296 * @OUTPUT: None
2297 *
2298 * This IOCTL is used to delete the index from the concurrent connection list
2299 * that is present in the given vdev_id.
2300 *
2301 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2302 * iwpriv wlan0 pm_dlist 0 1
2303 *
2304 * Supported Feature: DBS
2305 *
2306 * Usage: Internal/External
2307 *
2308 * </ioctl>
2309 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002310#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302311
2312/*
2313 * <ioctl>
2314 * pm_dbs - Set dbs capability and system preference
2315 *
2316 * @INPUT: dbs, system_pref
2317 * @dbs: Value of DBS capability to be set
2318 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002319 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302320 *
2321 * @OUTPUT: None
2322 *
2323 * This IOCTL is used to set dbs capability and system preference.
2324 *
2325 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2326 * iwpriv wlan0 pm_dbs 1 0
2327 *
2328 * Supported Feature: DBS
2329 *
2330 * Usage: Internal/External
2331 *
2332 * </ioctl>
2333 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002334#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302335
2336/*
2337 * <ioctl>
2338 * pm_pcl - Set pcl for concurrency mode.
2339 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002340 * @INPUT: policy_mgr_con_mode
2341 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302342 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2343 *
2344 * @OUTPUT: None
2345 *
2346 * This IOCTL is used to set pcl for concurrency mode.
2347 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002348 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302349 * iwpriv wlan0 pm_pcl 0
2350 *
2351 * Supported Feature: DBS
2352 *
2353 * Usage: Internal/External
2354 *
2355 * </ioctl>
2356 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002357#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302358
2359/*
2360 * <ioctl>
2361 * pm_cinfo - Shows the concurrent connection list.
2362 *
2363 * @INPUT: None
2364 *
2365 * @OUTPUT: None
2366 *
2367 * This IOCTL is used to show the concurrent connection list.
2368 *
2369 * @E.g: iwpriv wlan0 pm_cinfo
2370 *
2371 * Supported Feature: DBS
2372 *
2373 * Usage: Internal/External
2374 *
2375 * </ioctl>
2376 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002377#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302378
2379/*
2380 * <ioctl>
2381 * pm_ulist - Updates the index value of the concurrent connection list
2382 * with the input parameters provided.
2383 *
2384 * @INPUT: Following 8 arguments:
2385 * @vdev_id: vdev id
2386 * @tx_streams: TX streams
2387 * @rx_streams: RX streams
2388 * @chain_mask: Chain mask
2389 * @type: vdev_type
2390 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2391 * @sub_type: vdev_subtype
2392 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2393 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2394 * @channel: Channel
2395 * @mac: Mac id
2396 *
2397 * @OUTPUT: None
2398 *
2399 * This IOCTL is used to updates the index value of the concurrent
2400 * connection list with the input parameters provided.
2401 *
2402 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2403 * sub_type channel mac
2404 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2405 *
2406 * Supported Feature: DBS
2407 *
2408 * Usage: Internal/External
2409 *
2410 * </ioctl>
2411 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002412#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302413
2414/*
2415 * <ioctl>
2416 * pm_query_action - Initiate actions needed on current connections as
2417 * per the channel provided.
2418 *
2419 * @INPUT: channel
2420 * @channel: Channel on which new connection will be.
2421 *
2422 * @OUTPUT: None
2423 *
2424 * This IOCTL is used to initiate actions needed on current connections
2425 * as per the channel provided.
2426 *
2427 * @E.g: iwpriv wlan0 pm_query_action channel
2428 * iwpriv wlan0 pm_query_action 6
2429 *
2430 * Supported Feature: DBS
2431 *
2432 * Usage: Internal/External
2433 *
2434 * </ioctl>
2435 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002436#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302437
2438/*
2439 * <ioctl>
2440 * pm_query_allow - Checks for allowed concurrency combination
2441 *
2442 * @INPUT: mode, channel, bandwidth
2443 * @mode: new connection mode
2444 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2445 * @channel: channel on which new connection is coming up
2446 * @bandwidth: Bandwidth requested by the connection
2447 * 0:None 1:5MHz 2:10MHz 3:20MHz
2448 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2449 *
2450 * @OUTPUT: None
2451 *
2452 * This IOCTL is used to checks for allowed concurrency combination.
2453 *
2454 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2455 * iwpriv wlan0 pm_query_allow 0 6 4
2456 *
2457 * Supported Feature: DBS
2458 *
2459 * Usage: Internal/External
2460 *
2461 * </ioctl>
2462 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002463#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302464
2465/*
2466 * <ioctl>
2467 * pm_run_scenario - Create scenario with number of connections provided.
2468 *
2469 * @INPUT: num_of_conn
2470 * @num_of_conn: the number of connections (values: 1~3)
2471 *
2472 * @OUTPUT: None
2473 *
2474 * This IOCTL is used to create scenario with the number of connections
2475 * provided.
2476 *
2477 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2478 * iwpriv wlan0 pm_run_scenario 1
2479 *
2480 * Supported Feature: DBS
2481 *
2482 * Usage: Internal/External
2483 *
2484 * </ioctl>
2485 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002486#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302487
2488/*
2489 * <ioctl>
2490 * pm_set_hw_mode - Set hardware for single/dual mac.
2491 *
2492 * @INPUT: hw_mode
2493 * 0:single mac 1:dual mac
Liangwei Dong509c3472018-05-30 07:05:59 -04002494 * 2: 2x2 5g + 1x1 2g dbs mode
2495 * 3: 2x2 2g + 1x1 5g dbs mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302496 *
2497 * @OUTPUT: None
2498 *
2499 * This IOCTL is used to set hardware for single/dual mac.
2500 *
2501 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2502 * iwpriv wlan0 pm_set_hw_mode 1
2503 *
2504 * Supported Feature: DBS
2505 *
2506 * Usage: Internal/External
2507 *
2508 * </ioctl>
2509 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002510#define WE_POLICY_SET_HW_MODE_CMD 20
2511
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302512/*
2513 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002514 * ch_avoid - unit test SAP channel avoidance
2515 *
2516 * @INPUT: chan avoid ranges
2517 *
2518 * @OUTPUT: none
2519 *
2520 * This IOCTL is used to fake a channel avoidance event.
2521 * To test SAP/GO chan switch during chan avoid event process.
2522 *
2523 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2524 *
2525 * Supported Feature: SAP chan avoidance.
2526 *
2527 * Usage: Internal
2528 *
2529 * </ioctl>
2530 */
2531#define WE_SET_CHAN_AVOID 21
2532
2533/*
2534 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302535 * set_scan_cfg - Set dual MAC scan config parameters.
2536 *
2537 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2538 * @dbs: Value of DBS bit
2539 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2540 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2541 *
2542 * @OUTPUT: None
2543 *
2544 * This IOCTL is used to set the dual MAC scan config.
2545 *
2546 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2547 * single_mac_scan_with_dbs
2548 * iwpriv wlan0 set_scan_cfg 1 0 1
2549 *
2550 * Supported Feature: DBS
2551 *
2552 * Usage: Internal/External
2553 *
2554 * </ioctl>
2555 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002556#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302557
2558/*
2559 * <ioctl>
2560 * set_fw_mode_cfg - Sets the dual mac FW mode config
2561 *
2562 * @INPUT: dbs, dfs
2563 * @dbs: DBS bit
2564 * @dfs: Agile DFS bit
2565 *
2566 * @OUTPUT: None
2567 *
2568 * This IOCTL is used to set the dual mac FW mode config.
2569 *
2570 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2571 * iwpriv wlan0 set_fw_mode_cfg 1 1
2572 *
2573 * Supported Feature: DBS
2574 *
2575 * Usage: Internal/External
2576 *
2577 * </ioctl>
2578 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002579#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002580#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002581/*
2582 * <ioctl>
2583 * txrx_stats - TXRX statistics query
2584 *
2585 * @INPUT: query category, mac id (default mac id is 0)
2586 *
2587 * @OUTPUT: TXRX statistics result
2588 *
2589 * This IOCTL is used to get TXRX statistics counters.
2590 *
2591 * @E.g: iwpriv wlan0 txrx_stats 21 0
2592 * iwpriv wlan0 txrx_stats 21 1
2593 *
2594 * Usage: Internal
2595 *
2596 * </ioctl>
2597 */
2598#define WE_SET_TXRX_STATS 24
2599
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002600
2601#ifdef FEATURE_WLAN_TDLS
2602#undef MAX_VAR_ARGS
2603#define MAX_VAR_ARGS 11
2604#else
2605#undef MAX_VAR_ARGS
2606#define MAX_VAR_ARGS 9
2607#endif
2608
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302609#ifdef WLAN_FEATURE_MOTION_DETECTION
2610#undef MAX_VAR_ARGS
2611#define MAX_VAR_ARGS 15
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302612#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302613#define WE_MOTION_DET_CONFIG_PARAM 25
2614#define WE_MOTION_DET_BASE_LINE_CONFIG_PARAM 26
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302615
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302616#define WE_SET_THERMAL_THROTTLE_CFG 27
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002617/*
2618 * <ioctl>
2619 * fips_test - Perform a FIPS test
2620 *
2621 * @INPUT: Binary representation of the following packed structure
2622 *
2623 * @OUTPUT: Binary representation of the following packed structure
2624 *
2625 * This IOCTL is used to perform FIPS certification testing
2626 *
2627 * @E.g: iwpriv wlan0 fips_test <test vector>
2628 *
2629 * iwpriv wlan0 fips_test <tbd>
2630 *
2631 * Supported Feature: FIPS
2632 *
2633 * Usage: Internal
2634 *
2635 * </ioctl>
2636 */
2637#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2638
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002639/* Private ioctls (with no sub-ioctls) */
2640/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302641/*
2642 * <ioctl>
2643 * addTspec - Add TSPEC for each AC
2644 *
2645 * @INPUT: 19 TSPEC params
2646 * @[arg0]: handle
2647 * @[arg1]: tid
2648 * @[arg2]: dir
2649 * @[arg3]: psb
2650 * @[arg4]: up
2651 * @[arg5]: nomMsduSize
2652 * @[arg6]: maxMsduSize
2653 * @[arg7]: minDataRate
2654 * @[arg8]: meanDataRate
2655 * @[arg9]: peakDataRate
2656 * @[arg10]: maxBurstSize
2657 * @[arg11]: minPhyRate
2658 * @[arg12]: sba
2659 * @[arg13]: minServiceIntv
2660 * @[arg14]: suspendIntv
2661 * @[arg15]: burstSizeDefn
2662 * @[arg16]: ackPolicy
2663 * @[arg17]: inactivityPeriod
2664 * @[arg18]: maxServiceIntv
2665 *
2666 * @OUTPUT: Success/Failure
2667 *
2668 * This IOCTL is used to add TSPEC for each AC.
2669 *
2670 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2671 * <maxMsduSize> <minDataRate> <meanDataRate>
2672 * <peakDataRate> <maxBurstSize> <minPhyRate>
2673 * <sba> <minServiceIntv> <suspendIntv>
2674 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2675 * <maxServiceIntv>
2676 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2677 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2678 * wlan0 addTspec:3
2679 *
2680 * Supported Feature: WMM
2681 *
2682 * Usage: Internal/External
2683 *
2684 * </ioctl>
2685 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002686#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302687/*
2688 * <ioctl>
2689 * delTspec - Delete TSPEC entry for each AC
2690 *
2691 * @INPUT: 1 TSPEC param
2692 * @[arg0]: handle
2693 *
2694 * @OUTPUT: Success/Failure
2695 *
2696 * This IOCTL is used to delete TSPEC entry for each AC.
2697 *
2698 * @E.g: iwpriv wlan0 delTspec <handle>
2699 * iwpriv wlan0 delTspec 7001
2700 * wlan0 delTspec:16
2701 *
2702 * Supported Feature: WMM
2703 *
2704 * Usage: Internal/External
2705 *
2706 * </ioctl>
2707 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002708#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302709/*
2710 * <ioctl>
2711 * getTspec - Get TSPEC entry for each AC
2712 *
2713 * @INPUT: 1 TSPEC param
2714 * @[arg0]: handle
2715 *
2716 * @OUTPUT: Success/Failure
2717 *
2718 * This IOCTL is used to get TSPEC entry for each AC.
2719 *
2720 * @E.g: iwpriv wlan0 getTspec <handle>
2721 * iwpriv wlan0 getTspec 7001
2722 * wlan0 delTspec:18
2723 *
2724 * Supported Feature: WMM
2725 *
2726 * Usage: Internal/External
2727 *
2728 * </ioctl>
2729 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002730#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2731
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002732/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2733/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2734/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002735#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2736#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002737/* (SIOCIWFIRSTPRIV + 16) is currently unused */
Krunal Sonif9ba53d2019-01-03 21:44:41 -08002738
2739#ifdef FEATURE_WLM_STATS
2740/*
2741 * <ioctl>
2742 *
2743 * get_wlm_stats - Get stats from FW for game latency
2744 *
2745 * @INPUT: BITMASK inform of decimal number
2746 *
2747 * @OUTPUT: HEX string given by FW
2748 *
2749 * This IOCTL is used to get game latency related STATS from FW
2750 *
2751 * @E.g.: iwpriv wlan0 get_wlm_stats 1
2752 *
2753 * Usage: internal
2754 *
2755 * </ioctl>
2756 */
2757#define WLAN_GET_WLM_STATS (SIOCIWFIRSTPRIV + 17)
2758#endif
2759
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002760/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2761
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002762#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002763
2764/* Private ioctl for setting the host offload feature */
2765#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2766
2767/* Private ioctl to get the statistics */
2768#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2769
2770/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302771/*
2772 * <ioctl>
2773 * setKeepAlive - Set the keep alive feature
2774 *
2775 * @INPUT: 28 bytes of information in the order of packet type, time period
2776 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2777 *
2778 * @OUTPUT: None
2779 *
2780 * This IOCTL sets the keep alive feature to send either NULL
2781 * or unsolicited ARP response packets
2782 *
2783 * @E.g: iwpriv wlan0 setKeepAlive
2784 *
2785 * Supported Feature: STA
2786 *
2787 * Usage: Internal/External
2788 *
2789 * </ioctl>
2790 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002791#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2792
2793#ifdef WLAN_FEATURE_PACKET_FILTERING
2794/* Private ioctl to set the packet filtering params */
2795#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2796#endif
2797
2798
2799#ifdef FEATURE_WLAN_SCAN_PNO
2800/* Private ioctl to get the statistics */
2801#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2802#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302803/*
2804 * <ioctl>
2805 * SETBAND - Set the operational band
2806 *
2807 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2808 *
2809 * @OUTPUT: None
2810 *
2811 * This IOCTL Set the operational band If the new band is different from the
2812 * current operational band, it aborts the pending scan requests, flushes
2813 * the existing scan results, and then change * the band capability
2814 *
2815 * @E.g: iwpriv wlan0 SETBAND <value>
2816 *
2817 * Supported Feature: STA
2818 *
2819 * Usage: Internal/External
2820 *
2821 * </ioctl>
2822 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002823#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2824
Dustin Brown0cbc7572016-12-16 13:54:40 -08002825#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002826/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002827
2828/* Private ioctls and their sub-ioctls */
2829#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2830#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002831#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002832#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302833/* Private sub ioctl for enabling and setting histogram interval of profiling */
2834#define WE_ENABLE_FW_PROFILE 4
2835#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002836
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002837/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002838#define WE_SET_WLAN_SUSPEND 6
2839#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002840
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002841/*
2842 * <ioctl>
2843 * log_buffer - prints host/target related communication logs via dmesg
2844 *
2845 * @INPUT: Log Id, Count
2846 *
2847 * Log Id:
2848 * 0) HTC_CREDIT_HISTORY_LOG
2849 * 1) COMMAND_LOG,
2850 * 2) COMMAND_TX_CMP_LOG,
2851 * 3) MGMT_COMMAND_LOG,
2852 * 4) MGMT_COMMAND_TX_CMP_LOG,
2853 * 5) EVENT_LOG,
2854 * 6) RX_EVENT_LOG,
2855 * 7) MGMT_EVENT_LOG
2856 *
2857 * @OUTPUT: None
2858 *
2859 * @E.g:
2860 * # print up to 10 of the most recent records from HTC Credit History
2861 * iwpriv wlan0 log_buffer 0 10
2862 * # print up to 3 of the most recent records from Event Log
2863 * iwpriv wlan0 log_buffer 5 3
2864 *
2865 * Supported Feature: WLAN Trace
2866 *
2867 * Usage: Internal/External
2868 *
2869 * </ioctl>
2870 */
2871#define WE_LOG_BUFFER 8
2872
Krunal Soni6c3859f2018-06-01 19:57:40 -07002873/*
2874 * <ioctl>
2875 * set_ba_timeout - sets Block ACK aging timeout value for each Access class
2876 *
2877 * @INPUT: Access Class [0:BK, 1:BE, 2:VI, 3:VO], Timeout value
2878 *
2879 * @OUTPUT: None
2880 *
2881 * @E.g.:
2882 * # to set duration of 2 seconds for BE
2883 * iwpriv wlan0 set_ba_timeout 1 2
2884 * # to set duration of 3 seconds for VO
2885 * iwpriv wlan0 set_ba_timeout 3 3
2886 *
2887 * Usage: Internal
2888 *
2889 * </ioctl>
2890 */
2891#define WE_SET_BA_AGEING_TIMEOUT 9
2892
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002893enum host_target_comm_log {
2894 HTC_CREDIT_HISTORY_LOG = 0,
2895 COMMAND_LOG,
2896 COMMAND_TX_CMP_LOG,
2897 MGMT_COMMAND_LOG,
2898 MGMT_COMMAND_TX_CMP_LOG,
2899 EVENT_LOG,
2900 RX_EVENT_LOG,
2901 MGMT_EVENT_LOG
2902};
2903
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002904/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2905
2906/* 802.11p IOCTL */
2907#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2908
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302909/*
2910 * <ioctl>
2911 * getLinkSpeed - Gets the current link speed in Mbps
2912 *
2913 * @INPUT: None
2914 *
2915 * @OUTPUT: linkspeed in mbps
2916 * wlan0 getLinkSpeed:7
2917 *
2918 * This IOCTL is used get the current link speed in Mbps
2919 *
2920 * @E.g: iwpriv wlan0 getLinkSpeed
2921 *
2922 * Supported Feature: STA
2923 *
2924 * Usage: Internal/External
2925 *
2926 * </ioctl>
2927 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002928#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2929
2930#define WLAN_STATS_INVALID 0
2931#define WLAN_STATS_RETRY_CNT 1
2932#define WLAN_STATS_MUL_RETRY_CNT 2
2933#define WLAN_STATS_TX_FRM_CNT 3
2934#define WLAN_STATS_RX_FRM_CNT 4
2935#define WLAN_STATS_FRM_DUP_CNT 5
2936#define WLAN_STATS_FAIL_CNT 6
2937#define WLAN_STATS_RTS_FAIL_CNT 7
2938#define WLAN_STATS_ACK_FAIL_CNT 8
2939#define WLAN_STATS_RTS_SUC_CNT 9
2940#define WLAN_STATS_RX_DISCARD_CNT 10
2941#define WLAN_STATS_RX_ERROR_CNT 11
2942#define WLAN_STATS_TX_BYTE_CNT 12
2943
2944#define WLAN_STATS_RX_BYTE_CNT 13
2945#define WLAN_STATS_RX_RATE 14
2946#define WLAN_STATS_TX_RATE 15
2947
2948#define WLAN_STATS_RX_UC_BYTE_CNT 16
2949#define WLAN_STATS_RX_MC_BYTE_CNT 17
2950#define WLAN_STATS_RX_BC_BYTE_CNT 18
2951#define WLAN_STATS_TX_UC_BYTE_CNT 19
2952#define WLAN_STATS_TX_MC_BYTE_CNT 20
2953#define WLAN_STATS_TX_BC_BYTE_CNT 21
2954
2955#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2956 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2957 *__p++ = __type; \
2958 *__p++ = __size; \
2959 memcpy(__p, __val, __size); \
2960 __p += __size; \
2961 __tlen += __size + 2; \
2962 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002963 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002964 } \
2965 } while (0)
2966
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002967#define TX_PER_TRACKING_DEFAULT_RATIO 5
2968#define TX_PER_TRACKING_MAX_RATIO 10
2969#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2970
2971#define WLAN_ADAPTER 0
2972#define P2P_ADAPTER 1
2973
2974/**
2975 * mem_alloc_copy_from_user_helper - copy from user helper
2976 * @wrqu_data: wireless extensions request data
2977 * @len: length of @wrqu_data
2978 *
2979 * Helper function to allocate buffer and copy user data.
2980 *
2981 * Return: On success return a pointer to a kernel buffer containing a
2982 * copy of the userspace data (with an additional NUL character
2983 * appended for safety). On failure return %NULL.
2984 */
2985void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2986{
2987 u8 *ptr = NULL;
2988
2989 /* in order to protect the code, an extra byte is post
2990 * appended to the buffer and the null termination is added.
2991 * However, when allocating (len+1) byte of memory, we need to
2992 * make sure that there is no uint overflow when doing
2993 * addition. In theory check len < UINT_MAX protects the uint
2994 * overflow. For wlan private ioctl, the buffer size is much
2995 * less than UINT_MAX, as a good guess, now, it is assumed
2996 * that the private command buffer size is no greater than 4K
2997 * (4096 bytes). So we use 4096 as the upper boundary for now.
2998 */
2999 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003000 hdd_err("Invalid length: %zu max: %u",
3001 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003002 return NULL;
3003 }
3004
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07003005 ptr = qdf_mem_malloc(len + 1);
Jeff Johnsond36fa332019-03-18 13:42:25 -07003006 if (!ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003007 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003008 return NULL;
3009 }
3010
3011 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003012 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07003013 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003014 return NULL;
3015 }
3016 ptr[len] = '\0';
3017 return ptr;
3018}
3019
3020/**
3021 * hdd_priv_get_data() - Get pointer to ioctl private data
3022 * @p_priv_data: pointer to iw_point struct to be filled
3023 * @wrqu: Pointer to IOCTL Data received from userspace
3024 *
3025 * Helper function to get compatible struct iw_point passed to ioctl
3026 *
3027 * Return - 0 if p_priv_data successfully filled, error otherwise
3028 */
3029int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
3030{
Jeff Johnsond36fa332019-03-18 13:42:25 -07003031 if ((!p_priv_data) || (!wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003032 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003033
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003034#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07003035 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003036 struct compat_iw_point *p_compat_priv_data;
3037
3038 /* Compat task:
3039 * typecast to compat structure and copy the members.
3040 */
3041 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
3042
3043 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
3044 p_priv_data->length = p_compat_priv_data->length;
3045 p_priv_data->flags = p_compat_priv_data->flags;
3046 } else {
3047#endif /* #ifdef CONFIG_COMPAT */
3048
3049 /* Non compat task: directly copy the structure. */
3050 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
3051
3052#ifdef CONFIG_COMPAT
3053 }
3054#endif /* #ifdef CONFIG_COMPAT */
3055
3056 return 0;
3057}
3058
Jeff Johnson441e1f72017-02-07 08:50:49 -08003059static int hdd_check_wext_control(enum hdd_wext_control wext_control,
3060 struct iw_request_info *info)
3061{
3062 switch (wext_control) {
3063 default:
3064 case hdd_wext_disabled:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003065 hdd_err_rl("Rejecting disabled ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003066 return -ENOTSUPP;
3067 case hdd_wext_deprecated:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003068 hdd_warn_rl("Using deprecated ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003069 return 0;
3070 case hdd_wext_enabled:
3071 return 0;
3072 }
3073}
3074
Jeff Johnson82797b62017-08-11 15:31:27 -07003075int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08003076 struct iw_request_info *info)
3077{
3078 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
3079 info);
3080}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003081
3082/**
3083 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003084 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003085 * @length: Size of the data copied
3086 * @buffer: Pointer to char buffer.
3087 * @buf_len: Length of the char buffer.
3088 *
3089 * This function called when the "iwpriv wlan0 get_stats" command is given.
3090 * It used to collect the txrx stats when the device is configured in SAP mode.
3091 *
3092 * Return - none
3093 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003094void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003095 char *buffer, uint16_t buf_len)
3096{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003097 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003098 uint32_t len = 0;
3099 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
3100 uint32_t total_rx_delv = 0, total_rx_refused = 0;
3101 int i = 0;
Mohit Khanna81418772018-10-30 14:14:46 -07003102 struct hdd_context *hdd_ctx = adapter->hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003103
3104 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003105 total_rx_pkt += stats->rx_packets[i];
3106 total_rx_dropped += stats->rx_dropped[i];
3107 total_rx_delv += stats->rx_delivered[i];
3108 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003109 }
3110
3111 len = scnprintf(buffer, buf_len,
Mohit Khanna81418772018-10-30 14:14:46 -07003112 "\nTransmit[%lu] - "
3113 "called %u, dropped %u orphan %u,"
3114 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
3115 "\n[classified] BK %u, BE %u, VI %u, VO %u"
3116 "\n\nReceive[%lu] - "
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003117 "packets %u, dropped %u, unsolict_arp_n_mcast_drp %u, delivered %u, refused %u\n"
Jinwei Chenb681a482019-08-14 15:24:06 +08003118 "GRO - agg %u non-agg %u flush-skip %u disabled(conc %u low-tput %u)\n",
Mohit Khanna81418772018-10-30 14:14:46 -07003119 qdf_system_ticks(),
3120 stats->tx_called,
3121 stats->tx_dropped,
3122 stats->tx_orphaned,
3123 stats->tx_dropped_ac[SME_AC_BK],
3124 stats->tx_dropped_ac[SME_AC_BE],
3125 stats->tx_dropped_ac[SME_AC_VI],
3126 stats->tx_dropped_ac[SME_AC_VO],
3127 stats->tx_classified_ac[SME_AC_BK],
3128 stats->tx_classified_ac[SME_AC_BE],
3129 stats->tx_classified_ac[SME_AC_VI],
3130 stats->tx_classified_ac[SME_AC_VO],
3131 qdf_system_ticks(),
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003132 total_rx_pkt, total_rx_dropped,
3133 qdf_atomic_read(&stats->rx_usolict_arp_n_mcast_drp),
3134 total_rx_delv,
Mohit Khanna81418772018-10-30 14:14:46 -07003135 total_rx_refused,
3136 stats->rx_aggregated, stats->rx_non_aggregated,
Jinwei Chenb681a482019-08-14 15:24:06 +08003137 stats->rx_gro_flush_skip,
Mohit Khanna81418772018-10-30 14:14:46 -07003138 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_concurrency),
3139 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_low_tput));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003140
3141 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003142 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003143 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003144 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna81418772018-10-30 14:14:46 -07003145 "Rx CPU[%d]:"
3146 "packets %u, dropped %u, delivered %u, refused %u\n",
3147 i, stats->rx_packets[i], stats->rx_dropped[i],
3148 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003149 }
3150
3151 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003152 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003153 "\nCurrent status: %s"
3154 "\ntx-flow timer start count %u"
3155 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003156 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3157 stats->txflow_timer_cnt,
3158 stats->txflow_pause_cnt,
3159 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003160
Leo Changfdb45c32016-10-28 11:09:23 -07003161 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003162 adapter->vdev_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003163 *length = len + 1;
3164}
3165
3166/**
Dustin Brownd9322482017-01-09 12:46:03 -08003167 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3168 * @hdd_ctx: The Hdd context owning the stats to be written
3169 * @buffer: The char buffer to write to
3170 * @max_len: The maximum number of chars to write
3171 *
3172 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3173 *
3174 * Return - length of written content, negative number on error
3175 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003176static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
3177 char *buffer, uint16_t max_len)
3178{
3179 int ret;
3180 QDF_STATUS status;
3181 struct suspend_resume_stats *sr_stats;
3182
3183 sr_stats = &hdd_ctx->suspend_resume_stats;
3184 ret = scnprintf(buffer, max_len,
3185 "\n"
3186 "Suspends: %u\n"
3187 "Resumes: %u\n"
3188 "\n"
3189 "Suspend Fail Reasons\n"
3190 "\tIPA: %u\n"
3191 "\tRadar: %u\n"
3192 "\tRoam: %u\n"
3193 "\tScan: %u\n"
3194 "\tInitial Wakeup: %u\n"
3195 "\n",
3196 sr_stats->suspends, sr_stats->resumes,
3197 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3198 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3199 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3200 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3201 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]);
3202
Dustin Brown05d81302018-09-11 16:49:22 -07003203 status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->psoc,
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003204 &buffer[ret], max_len - ret,
3205 &ret);
3206 if (QDF_IS_STATUS_ERROR(status)) {
3207 hdd_err("Failed to get WoW stats");
3208 return qdf_status_to_os_return(status);
3209 }
3210
3211 return ret;
3212}
Dustin Brownd9322482017-01-09 12:46:03 -08003213
Dustin Brownd9322482017-01-09 12:46:03 -08003214/**
Govind Singha471e5e2015-10-12 17:11:14 +05303215 * hdd_wlan_list_fw_profile() - Get fw profiling points
3216 * @length: Size of the data copied
3217 * @buffer: Pointer to char buffer.
3218 * @buf_len: Length of the char buffer.
3219 *
3220 * This function called when the "iwpriv wlan0 listProfile" command is given.
3221 * It is used to get the supported profiling points in FW.
3222 *
3223 * Return - none
3224 */
3225void hdd_wlan_list_fw_profile(uint16_t *length,
3226 char *buffer, uint16_t buf_len)
3227{
3228 uint32_t len = 0;
3229
3230 len = scnprintf(buffer, buf_len,
3231 "PROF_CPU_IDLE: %u\n"
3232 "PROF_PPDU_PROC: %u\n"
3233 "PROF_PPDU_POST: %u\n"
3234 "PROF_HTT_TX_INPUT: %u\n"
3235 "PROF_MSDU_ENQ: %u\n"
3236 "PROF_PPDU_POST_HAL: %u\n"
3237 "PROF_COMPUTE_TX_TIME: %u\n",
3238 PROF_CPU_IDLE,
3239 PROF_PPDU_PROC,
3240 PROF_PPDU_POST,
3241 PROF_HTT_TX_INPUT,
3242 PROF_MSDU_ENQ,
3243 PROF_PPDU_POST_HAL,
3244 PROF_COMPUTE_TX_TIME);
3245
3246 *length = len + 1;
3247}
Mohit Khannac9649652018-11-28 18:10:28 -08003248
3249#define HDD_DUMP_STAT_HELP(STAT_ID) \
3250 hdd_nofl_info("%u -- %s", STAT_ID, (# STAT_ID))
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003251/**
3252 * hdd_display_stats_help() - print statistics help
3253 *
3254 * Return: none
3255 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003256static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003257{
Nirav Shahe6194ac2018-07-13 11:04:41 +05303258 hdd_nofl_info("iwpriv wlan0 dumpStats [option] - dump statistics");
3259 hdd_nofl_info("iwpriv wlan0 clearStats [option] - clear statistics");
3260 hdd_nofl_info("options:");
Mohit Khannac9649652018-11-28 18:10:28 -08003261 HDD_DUMP_STAT_HELP(CDP_TXRX_PATH_STATS);
3262 HDD_DUMP_STAT_HELP(CDP_TXRX_HIST_STATS);
3263 HDD_DUMP_STAT_HELP(CDP_TXRX_TSO_STATS);
3264 HDD_DUMP_STAT_HELP(CDP_HDD_NETIF_OPER_HISTORY);
3265 HDD_DUMP_STAT_HELP(CDP_DUMP_TX_FLOW_POOL_INFO);
3266 HDD_DUMP_STAT_HELP(CDP_TXRX_DESC_STATS);
3267 HDD_DUMP_STAT_HELP(CDP_HIF_STATS);
3268 HDD_DUMP_STAT_HELP(CDP_NAPI_STATS);
3269 HDD_DUMP_STAT_HELP(CDP_DP_NAPI_STATS);
3270 HDD_DUMP_STAT_HELP(CDP_DP_RX_THREAD_STATS);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003271}
Govind Singha471e5e2015-10-12 17:11:14 +05303272
3273/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003274 * hdd_wlan_dump_stats() - display dump Stats
3275 * @adapter: adapter handle
3276 * @value: value from user
3277 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003278 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003279 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003280int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003281{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003282 int ret = 0;
3283 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003284 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003285
Jeff Johnson0e07ca12018-11-12 21:04:45 -08003286 hdd_debug("%d", value);
3287
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003288 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003289 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003290 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3291 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003292 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003293 wlan_hdd_display_netif_queue_history
3294 (hdd_ctx,
3295 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003296 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003297 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303298 hdd_display_hif_stats();
3299 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003300 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003301 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303302 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003303 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003304 if (hdd_display_napi_stats()) {
3305 hdd_err("error displaying napi stats");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303306 ret = -EFAULT;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003307 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003308 break;
Mohit Khannac9649652018-11-28 18:10:28 -08003309 case CDP_DP_RX_THREAD_STATS:
3310 dp_txrx_ext_dump_stats(cds_get_context(QDF_MODULE_ID_SOC),
3311 CDP_DP_RX_THREAD_STATS);
3312 break;
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303313 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003314 sme_display_disconnect_stats(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003315 adapter->vdev_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303316 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003317 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003318 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003319 value,
3320 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003321 if (status == QDF_STATUS_E_INVAL) {
3322 hdd_display_stats_help();
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303323 ret = -EINVAL;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003324 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003325 break;
3326 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003327 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003328}
3329
3330/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003331 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003332 * @adapter: Adapter upon which the IBSS client is active
Jeff Johnson0a082d92019-03-04 12:25:49 -08003333 * @sta_id: Station index of the IBSS peer
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003334 *
3335 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3336 * otherwise an appropriate QDF_STATUS_E_* failure code.
3337 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003338static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnson0a082d92019-03-04 12:25:49 -08003339 uint8_t sta_id)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003340{
3341 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003342 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnson93107ad2019-02-26 08:14:46 -08003343 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson52f19d52019-02-26 08:35:38 -08003344 tSirPeerInfoRspParams *peer_info = &sta_ctx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003345
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003346 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003347 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003348 hdd_get_ibss_peer_info_cb,
Jeff Johnson0a082d92019-03-04 12:25:49 -08003349 false, sta_id);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003350
3351 if (QDF_STATUS_SUCCESS == status) {
3352 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003353
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003354 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003355 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003356 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3357 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003358 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003359 return QDF_STATUS_E_FAILURE;
3360 }
3361
3362 /** Print the peer info */
Jeff Johnson52f19d52019-02-26 08:35:38 -08003363 hdd_debug("peer_info->numIBSSPeers = %d ", peer_info->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003364 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003365 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
Jeff Johnson52f19d52019-02-26 08:35:38 -08003366 uint32_t tx_rate = peer_info->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003367
Jeff Johnson52f19d52019-02-26 08:35:38 -08003368 qdf_mem_copy(mac_addr, peer_info->peerInfoParams[0].
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003369 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003370 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003371 mac_addr, (int)tx_rate,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003372 (int)peer_info->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003373 }
3374 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003375 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003376 }
3377
3378 return status;
3379}
3380
3381/**
3382 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003383 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003384 *
3385 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3386 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3387 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003388static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003389{
3390 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003391 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnson93107ad2019-02-26 08:14:46 -08003392 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson52f19d52019-02-26 08:35:38 -08003393 tSirPeerInfoRspParams *peer_info = &sta_ctx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003394 int i;
3395
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003396 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003397 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003398 hdd_get_ibss_peer_info_cb,
3399 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003400
3401 if (QDF_STATUS_SUCCESS == status) {
3402 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003403
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003404 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003405 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003406 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3407 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003408 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003409 return QDF_STATUS_E_FAILURE;
3410 }
3411
3412 /** Print the peer info */
Jeff Johnson52f19d52019-02-26 08:35:38 -08003413 hdd_debug("peer_info->numIBSSPeers = %d ",
3414 (int)peer_info->numPeers);
3415 for (i = 0; i < peer_info->numPeers; i++) {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003416 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3417 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003418
Jeff Johnson52f19d52019-02-26 08:35:38 -08003419 tx_rate = peer_info->peerInfoParams[i].txRate;
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003420 qdf_mem_copy(mac_addr,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003421 peer_info->peerInfoParams[i].mac_addr,
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003422 sizeof(mac_addr));
3423
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003424 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003425 mac_addr, (int)tx_rate,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003426 (int)peer_info->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003427 }
3428 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003429 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003430 }
3431
3432 return status;
3433}
3434
3435/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303436 * hdd_get_ldpc() - Get adapter LDPC
3437 * @adapter: adapter being queried
3438 * @value: where to store the value
3439 *
3440 * Return: 0 on success, negative errno on failure
3441 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003442int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303443{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003444 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303445 int ret;
3446
Dustin Brown491d54b2018-03-14 12:39:11 -07003447 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003448 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303449 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3450 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003451 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303452 } else {
3453 *value = ret;
3454 ret = 0;
3455 }
3456 return ret;
3457}
3458
Jeff Johnson3d278b02017-08-29 14:17:47 -07003459int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303460{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003461 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303462 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003463 QDF_STATUS status;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003464 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303465 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303466
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003467 hdd_debug("%d", value);
Jeff Johnson1ca04762018-10-25 10:24:39 -07003468
3469 if (!mac_handle) {
3470 hdd_err("NULL Mac handle");
3471 return -EINVAL;
3472 }
3473
Dustin Brown05d81302018-09-11 16:49:22 -07003474 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003475 if (QDF_STATUS_SUCCESS != status) {
3476 hdd_err("Failed to get HT capability info");
3477 return -EIO;
3478 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003479
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303480 ht_cap_info.adv_coding_cap = value;
Dustin Brown05d81302018-09-11 16:49:22 -07003481 status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003482 if (QDF_STATUS_SUCCESS != status) {
3483 hdd_err("Failed to set HT capability info");
3484 return -EIO;
3485 }
Vignesh Viswanathanecd4de72018-11-22 13:02:20 +05303486 status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303487 if (QDF_IS_STATUS_ERROR(status)) {
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003488 hdd_err("Failed to set VHT LDPC capability info");
3489 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303490 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003491 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303492 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
3493 value);
3494 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003495 hdd_err("Failed to set LDPC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003496 ret = sme_update_he_ldpc_supp(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003497 if (ret)
3498 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303499
3500 return ret;
3501}
3502
3503/**
3504 * hdd_get_tx_stbc() - Get adapter TX STBC
3505 * @adapter: adapter being queried
3506 * @value: where to store the value
3507 *
3508 * Return: 0 on success, negative errno on failure
3509 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003510int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303511{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003512 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303513 int ret;
3514
Dustin Brown491d54b2018-03-14 12:39:11 -07003515 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003516 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303517 WNI_CFG_HT_CAP_INFO_TX_STBC);
3518 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003519 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303520 } else {
3521 *value = ret;
3522 ret = 0;
3523 }
3524
3525 return ret;
3526}
3527
Jeff Johnson3d278b02017-08-29 14:17:47 -07003528int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303529{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003530 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303531 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303532 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303533 QDF_STATUS status;
3534 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303535
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003536 hdd_debug("%d", value);
Jeff Johnson57ff4fa2018-10-25 10:29:47 -07003537
3538 if (!mac_handle) {
3539 hdd_err("NULL Mac handle");
3540 return -EINVAL;
3541 }
3542
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303543 if (value) {
3544 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003545 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303546 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303547 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003548 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303549 return -EIO;
3550 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303551 if (!ht_cap_info.tx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003552 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303553 return -EINVAL;
3554 }
3555 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003556 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303557 WNI_CFG_HT_CAP_INFO_TX_STBC,
3558 value);
3559 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003560 hdd_err("Failed to set TX STBC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003561 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003562 if (ret)
3563 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303564
3565 return ret;
3566}
3567
3568/**
3569 * hdd_get_rx_stbc() - Get adapter RX STBC
3570 * @adapter: adapter being queried
3571 * @value: where to store the value
3572 *
3573 * Return: 0 on success, negative errno on failure
3574 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003575int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303576{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003577 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303578 int ret;
3579
Dustin Brown491d54b2018-03-14 12:39:11 -07003580 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003581 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303582 WNI_CFG_HT_CAP_INFO_RX_STBC);
3583 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003584 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303585 } else {
3586 *value = ret;
3587 ret = 0;
3588 }
3589
3590 return ret;
3591}
3592
Jeff Johnson3d278b02017-08-29 14:17:47 -07003593int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303594{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003595 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303596 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303597 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303598 QDF_STATUS status;
3599 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303600
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003601 hdd_debug("%d", value);
Jeff Johnsonb6645852018-10-25 10:35:41 -07003602
3603 if (!mac_handle) {
3604 hdd_err("NULL Mac handle");
3605 return -EINVAL;
3606 }
3607
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303608 if (value) {
3609 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003610 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303611 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303612 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003613 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303614 return -EIO;
3615 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303616 if (!ht_cap_info.rx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003617 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303618 return -EINVAL;
3619 }
3620 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003621 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303622 WNI_CFG_HT_CAP_INFO_RX_STBC,
3623 value);
3624 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003625 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303626
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003627 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003628 if (ret)
3629 hdd_err("Failed to set HE RX STBC value");
3630
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303631 return ret;
3632}
3633
3634/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003635 * iw_get_linkspeed() - Get current link speed ioctl
3636 * @dev: device upon which the ioctl was received
3637 * @info: ioctl request information
3638 * @wrqu: ioctl request data
3639 * @extra: extra ioctl buffer
3640 *
3641 * Return: 0 on success, non-zero on error
3642 */
3643static int __iw_get_linkspeed(struct net_device *dev,
3644 struct iw_request_info *info,
3645 union iwreq_data *wrqu, char *extra)
3646{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003647 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson21451ae2019-03-10 21:54:04 -07003648 char *out_link_speed = (char *)extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003649 int len = sizeof(uint32_t) + 1;
3650 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003651 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003652 int ret;
3653 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003654
Dustin Brownfdf17c12018-03-14 12:55:34 -07003655 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303656
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003657 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003658 ret = wlan_hdd_validate_context(hdd_ctx);
3659 if (0 != ret)
3660 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003661
Jeff Johnson441e1f72017-02-07 08:50:49 -08003662 ret = hdd_check_private_wext_control(hdd_ctx, info);
3663 if (0 != ret)
3664 return ret;
3665
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003666 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003667 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003668 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003669
3670 wrqu->data.length = len;
3671 /* return the linkspeed as a string */
Jeff Johnson21451ae2019-03-10 21:54:04 -07003672 rc = snprintf(out_link_speed, len, "%u", link_speed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003673 if ((rc < 0) || (rc >= len)) {
3674 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003675 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003676 return -EIO;
3677 }
3678
Dustin Browne74003f2018-03-14 12:51:58 -07003679 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003680 /* a value is being successfully returned */
3681 return 0;
3682}
3683
3684static int iw_get_linkspeed(struct net_device *dev,
3685 struct iw_request_info *info,
3686 union iwreq_data *wrqu, char *extra)
3687{
Dustin Brown389e5072018-11-08 17:10:01 +05303688 int errno;
3689 struct osif_vdev_sync *vdev_sync;
3690
3691 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
3692 if (errno)
3693 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003694
Dustin Brown389e5072018-11-08 17:10:01 +05303695 errno = __iw_get_linkspeed(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003696
Dustin Brown389e5072018-11-08 17:10:01 +05303697 osif_vdev_sync_op_stop(vdev_sync);
3698
3699 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003700}
3701
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003702#ifdef FEATURE_WLM_STATS
3703static void wlan_get_wlm_stats_cb(void *cookie, const char *data)
3704{
3705 struct osif_request *request;
3706 char *priv;
3707
3708 request = osif_request_get(cookie);
3709 if (!request) {
3710 hdd_err("Obsolete request");
3711 return;
3712 }
3713 priv = osif_request_priv(request);
3714 strlcpy(priv, data, WE_MAX_STR_LEN);
3715 osif_request_complete(request);
3716 osif_request_put(request);
3717}
3718
3719static int wlan_get_wlm_stats(struct hdd_adapter *adapter, uint32_t bitmask,
3720 char *response)
3721{
3722 struct osif_request *request;
3723 void *cookie;
3724 int errno;
3725 char *priv;
3726 static const struct osif_request_params params = {
3727 .priv_size = WE_MAX_STR_LEN,
3728 .timeout_ms = 2000,
3729 };
3730
3731 if (!adapter) {
3732 hdd_err("NULL argument");
3733 return -EINVAL;
3734 }
3735 request = osif_request_alloc(&params);
3736 if (!request) {
3737 hdd_err("Request allocation failure");
3738 return -ENOMEM;
3739 }
3740 cookie = osif_request_cookie(request);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003741 errno = wma_wlm_stats_req(adapter->vdev_id, bitmask,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003742 params.priv_size,
3743 wlan_get_wlm_stats_cb, cookie);
3744 if (errno) {
3745 hdd_err("Request failed be sent, %d", errno);
3746 goto cleanup;
3747 }
3748 errno = osif_request_wait_for_response(request);
3749 if (errno) {
3750 hdd_err("Timeout happened, can't complete the req");
3751 goto cleanup;
3752 }
3753 priv = osif_request_priv(request);
3754 strlcpy(response, priv, params.priv_size);
3755
3756cleanup:
3757 osif_request_put(request);
3758
3759 return errno;
3760}
3761
3762/*
3763 * Due to a limitation in iwpriv the "get_wlm_stats" ioctl is defined
3764 * to take as input a variable-length string as opposed to taking a
3765 * single integer "bitmask" value. Hence we must have a buffer large
3766 * enough to hold a string representing the largest possible
3767 * value. MAX_INT = 2,147,483,647 which can be fit in 10 chars.
3768 * Round up to 12 to hold the trailing NUL and be a multiple of 4.
3769 */
3770#define WLM_USER_DATA_SIZE 12
3771
3772static int __iw_get_wlm_stats(struct net_device *dev,
3773 struct iw_request_info *info,
3774 union iwreq_data *wrqu, char *extra)
3775{
3776 struct iw_point priv_data;
3777 char user_data[WLM_USER_DATA_SIZE] = {0};
3778 uint32_t bitmask = 0;
3779 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
3780 struct hdd_context *hdd_ctx;
3781 int errno;
3782
3783 hdd_enter_dev(dev);
3784
3785 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3786 errno = wlan_hdd_validate_context(hdd_ctx);
3787 if (errno)
3788 return errno;
3789
3790 if (!capable(CAP_NET_ADMIN)) {
3791 hdd_err("permission check failed");
3792 return -EPERM;
3793 }
3794
3795 /*
3796 * Since this is GETTER iwpriv ioctl, driver needs to
3797 * copy SET data from user space to kernel space.
3798 * Helper function to get iwreq_data with compat handling.
3799 */
3800 if (hdd_priv_get_data(&priv_data, wrqu))
3801 return -EINVAL;
3802
3803 /*
3804 * priv_data.pointer should be pointing to data given
3805 * to iwpriv command.
3806 *
3807 * For example "iwpriv wlan0 get_wlm_stats 1234"
3808 *
3809 * priv_data.pointer should be pointing to "1234"
3810 * priv_data.length should be zero as this GETTER iwpriv ioctl
3811 */
3812 if (!priv_data.pointer) {
3813 hdd_err("NULL data pointer");
3814 return -EINVAL;
3815 }
3816
3817 /*
3818 * ideally driver should have used priv_data.length to copy
3819 * data from priv_data.pointer but this iwpriv IOCTL has been
3820 * declared as GETTER in nature which makes length field zero
3821 * for input arguments but priv_data.pointer still points to
3822 * user's input argument (just doesn't pass the length of the
3823 * argument)
3824 */
3825 if (copy_from_user(user_data, priv_data.pointer,
3826 sizeof(user_data) - 1)) {
3827 hdd_err("failed to copy data from user buffer");
3828 return -EFAULT;
3829 }
3830
3831 /*
3832 * user data is given in ascii, convert ascii to integer
3833 */
3834 if (kstrtou32(user_data, 0, &bitmask)) {
3835 hdd_err("failed to parse input %s", user_data);
3836 return -EFAULT;
3837 }
3838
3839 if (wlan_get_wlm_stats(adapter, bitmask, extra)) {
3840 hdd_err("returning failure");
3841 return -EFAULT;
3842 }
3843 wrqu->data.length = strlen(extra) + 1;
3844
3845 return 0;
3846}
3847
Dustin Brown96b98dd2019-03-06 12:39:37 -08003848static int iw_get_wlm_stats(struct net_device *net_dev,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003849 struct iw_request_info *info,
3850 union iwreq_data *wrqu, char *extra)
3851{
Dustin Brown96b98dd2019-03-06 12:39:37 -08003852 struct osif_vdev_sync *vdev_sync;
3853 int errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003854
Dustin Brown96b98dd2019-03-06 12:39:37 -08003855 errno = osif_vdev_sync_op_start(net_dev, &vdev_sync);
3856 if (errno)
3857 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003858
Dustin Brown96b98dd2019-03-06 12:39:37 -08003859 errno = __iw_get_wlm_stats(net_dev, info, wrqu, extra);
3860
3861 osif_vdev_sync_op_stop(vdev_sync);
3862
3863 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003864}
3865#endif /* FEATURE_WLM_STATS */
3866
Jeff Johnsonc1713242018-10-23 13:45:42 -07003867int wlan_hdd_update_phymode(struct hdd_adapter *adapter, int new_phymode)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003868{
Jeff Johnsonc1713242018-10-23 13:45:42 -07003869 struct net_device *net = adapter->dev;
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003870 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3871 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003872 bool band_24 = false, band_5g = false;
3873 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08003874 struct sme_config_params *sme_config;
Jeff Johnsone94ccd02019-04-02 15:02:56 -07003875 struct csr_config_params *csr_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003876 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303877 uint8_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003878 eCsrPhyMode phymode = -EIO, old_phymode;
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003879 enum hdd_dot11_mode hdd_dot11mode = hdd_ctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003880 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303881 int retval = 0;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303882 uint8_t band_capability;
3883 QDF_STATUS status;
Wu Gaoed616a12019-01-16 15:19:21 +08003884 uint32_t channel_bonding_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003885
Jeff Johnsonc1713242018-10-23 13:45:42 -07003886 if (!mac_handle)
3887 return -EINVAL;
3888
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003889 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003890
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003891 ucfg_mlme_get_channel_bonding_24ghz(hdd_ctx->psoc,
Wu Gaoed616a12019-01-16 15:19:21 +08003892 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003893 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003894 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003895 ch_bond24 = true;
3896
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003897 ucfg_mlme_get_channel_bonding_5ghz(hdd_ctx->psoc,
Wu Gaoed616a12019-01-16 15:19:21 +08003898 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003899 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003900 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003901 ch_bond5g = true;
3902
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003903 status = wlan_mlme_get_band_capability(hdd_ctx->psoc, &band_capability);
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303904 if (QDF_IS_STATUS_ERROR(status)) {
3905 hdd_err("Failed to get MLME Band capability");
3906 return -EIO;
3907 }
3908
3909 if (band_capability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003910 band_24 = band_5g = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303911 else if (band_capability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003912 band_24 = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303913 else if (band_capability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003914 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003915
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07003916 status = ucfg_mlme_get_vht_channel_width(hdd_ctx->psoc, &vhtchanwidth);
Jeff Johnsonc1713242018-10-23 13:45:42 -07003917 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003918 hdd_err("Failed to get channel_width");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303919
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003920 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 -08003921 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3922
3923 switch (new_phymode) {
3924 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003925 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003926 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003927 phymode = eCSR_DOT11_MODE_AUTO;
3928 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3929 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003930 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003931 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3932 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003933 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003934 return -EIO;
3935 }
3936 break;
3937 case IEEE80211_MODE_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003938 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003939 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003940 phymode = eCSR_DOT11_MODE_11a;
3941 hdd_dot11mode = eHDD_DOT11_MODE_11a;
3942 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003943 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003944 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003945 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003946 return -EIO;
3947 }
3948 break;
3949 case IEEE80211_MODE_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003950 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003951 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003952 phymode = eCSR_DOT11_MODE_11b;
3953 hdd_dot11mode = eHDD_DOT11_MODE_11b;
3954 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003955 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003956 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003957 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003958 return -EIO;
3959 }
3960 break;
3961 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003962 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003963 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003964 phymode = eCSR_DOT11_MODE_11g;
3965 hdd_dot11mode = eHDD_DOT11_MODE_11g;
3966 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003967 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003968 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003969 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003970 return -EIO;
3971 }
3972 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07003973 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003974 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
3975 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
3976 */
3977 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003978 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003979 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003980 phymode = eCSR_DOT11_MODE_11n;
3981 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3982 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003983 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003984 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003985 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003986 return -EIO;
3987 }
3988 break;
3989 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003990 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003991 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003992 phymode = eCSR_DOT11_MODE_11n;
3993 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3994 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003995 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003996 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003997 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003998 return -EIO;
3999 }
4000 break;
4001 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004002 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004003 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004004 phymode = eCSR_DOT11_MODE_11n;
4005 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4006 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004007 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004008 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004009 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004010 return -EIO;
4011 }
4012 break;
4013 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004014 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004015 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004016 phymode = eCSR_DOT11_MODE_11n;
4017 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4018 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004019 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004020 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004021 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004022 return -EIO;
4023 }
4024 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004025 case IEEE80211_MODE_11AC_VHT20:
4026 case IEEE80211_MODE_11AC_VHT40:
4027 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004028 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07004029 phymode = eCSR_DOT11_MODE_11ac;
4030 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
4031 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
4032 if (band_5g && band_24) {
4033 curr_band = BAND_ALL;
4034 break;
4035 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004036 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07004037 break;
4038 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
4039 curr_band = BAND_2G;
4040 break;
4041 }
4042 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
4043 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004044 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004045 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004046 return -EIO;
4047 }
4048 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004049 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004050 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004051 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004052 phymode = eCSR_DOT11_MODE_AUTO;
4053 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4054 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004055 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004056 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004057 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004058 return -EIO;
4059 }
4060 break;
4061 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004062 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004063 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004064 phymode = eCSR_DOT11_MODE_AUTO;
4065 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4066 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
4067 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004068 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004069 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004070 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004071 return -EIO;
4072 }
4073 break;
4074 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004075 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004076 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004077 phymode = eCSR_DOT11_MODE_11n;
4078 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4079 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004080 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004081 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004082 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004083 return -EIO;
4084 }
4085 break;
4086 default:
4087 return -EIO;
4088 }
4089
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004090 switch (new_phymode) {
4091 case IEEE80211_MODE_11AC_VHT20:
4092 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4093 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
4094 break;
4095 case IEEE80211_MODE_11AC_VHT40:
4096 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
4097 break;
4098 case IEEE80211_MODE_11AC_VHT80:
4099 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
4100 break;
4101 default:
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004102 status = ucfg_mlme_get_vht_channel_width(hdd_ctx->psoc,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004103 &vhtchanwidth);
4104 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07004105 hdd_err("Failed to get channel_width");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004106 break;
4107 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004108
4109 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304110 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4111 if (!sme_config) {
4112 hdd_err("Failed to allocate memory for sme_config");
4113 return -ENOMEM;
4114 }
4115 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004116 sme_get_config_param(mac_handle, sme_config);
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004117 csr_config = &sme_config->csr_config;
4118 csr_config->phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004119#ifdef QCA_HT_2040_COEX
4120 if (phymode == eCSR_DOT11_MODE_11n &&
4121 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004122 csr_config->obssEnabled = false;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004123 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004124 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004125 eHT_CHAN_HT20, false);
4126 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004127 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304128 retval = -EIO;
4129 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004130 }
4131 } else if (phymode == eCSR_DOT11_MODE_11n &&
4132 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004133 csr_config->obssEnabled = true;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004134 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004135 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004136 eHT_CHAN_HT20, true);
4137 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004138 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304139 retval = -EIO;
4140 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004141 }
4142 }
4143#endif
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004144 status = ucfg_mlme_set_band_capability(hdd_ctx->psoc,
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05304145 curr_band);
4146 if (QDF_IS_STATUS_ERROR(status)) {
4147 hdd_err("failed to set MLME band capability");
4148 goto free;
4149 }
4150
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304151 if (curr_band == BAND_2G) {
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004152 status = ucfg_mlme_set_11h_enabled(hdd_ctx->psoc, 0);
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304153 if (!QDF_IS_STATUS_SUCCESS(status)) {
4154 hdd_err("Failed to set 11h_enable flag");
4155 goto free;
4156 }
4157 }
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004158 if (curr_band == BAND_2G)
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004159 csr_config->channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07004160 else if (curr_band == BAND_5G)
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004161 csr_config->channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004162 else {
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004163 csr_config->channelBondingMode24GHz = chwidth;
4164 csr_config->channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004165 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004166 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004167
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004168 hdd_ctx->config->dot11Mode = hdd_dot11mode;
Wu Gaoed616a12019-01-16 15:19:21 +08004169 ucfg_mlme_set_channel_bonding_24ghz(
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004170 hdd_ctx->psoc,
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004171 csr_config->channelBondingMode24GHz);
Wu Gaoed616a12019-01-16 15:19:21 +08004172 ucfg_mlme_set_channel_bonding_5ghz(
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004173 hdd_ctx->psoc,
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004174 csr_config->channelBondingMode5GHz);
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004175 if (hdd_update_config_cfg(hdd_ctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004176 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304177 retval = -EIO;
4178 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004179 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304180
4181 if (band_5g) {
4182 struct ieee80211_supported_band *band;
4183
Wu Gaoed616a12019-01-16 15:19:21 +08004184 ucfg_mlme_get_channel_bonding_5ghz(
Jeff Johnsonfd7d1ef2019-03-31 10:41:37 -07004185 hdd_ctx->psoc, &channel_bonding_mode);
4186 band = hdd_ctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
Wu Gaoed616a12019-01-16 15:19:21 +08004187 if (channel_bonding_mode)
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304188 band->ht_cap.cap |=
4189 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4190 else
4191 band->ht_cap.cap &=
4192 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4193 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004194
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004195 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004196 phymode, chwidth, curr_band, vhtchanwidth);
4197 }
4198
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304199free:
4200 if (sme_config)
4201 qdf_mem_free(sme_config);
4202 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004203}
4204
Jeff Johnson011c4502017-10-05 15:25:56 -07004205static int hdd_validate_pdev_reset(int value)
4206{
4207 if ((value < 1) || (value > 5)) {
4208 hdd_warn(" Invalid value %d: Use any one of the below values\n"
4209 " TX_FLUSH = 1\n"
4210 " WARM_RESET = 2\n"
4211 " COLD_RESET = 3\n"
4212 " WARM_RESET_RESTORE_CAL = 4\n"
4213 " COLD_RESET_RESTORE_CAL = 5", value);
4214
4215 return -EINVAL;
4216 }
4217
4218 return 0;
4219}
4220
4221static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
4222{
4223 int ret;
4224
4225 hdd_debug("%d", value);
4226
4227 ret = hdd_validate_pdev_reset(value);
4228 if (ret)
4229 return ret;
4230
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004231 ret = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07004232 WMI_PDEV_PARAM_PDEV_RESET,
4233 value, PDEV_CMD);
4234
4235 return ret;
4236}
4237
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004238static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
4239{
4240 int errno;
4241 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004242 uint32_t bonding_mode;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08004243 struct sme_config_params *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004244 mac_handle_t mac_handle;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004245
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004246 mac_handle = hdd_ctx->mac_handle;
4247 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004248 return -EINVAL;
4249
4250 /* updating channel bonding only on 5Ghz */
4251 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4252
4253 switch (ch_width) {
4254 case eHT_CHANNEL_WIDTH_20MHZ:
4255 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4256 break;
4257
4258 case eHT_CHANNEL_WIDTH_40MHZ:
4259 case eHT_CHANNEL_WIDTH_80MHZ:
Kiran Kumar Lokere9df090b2019-02-07 18:48:22 -08004260 bonding_mode = 1;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004261 break;
4262
4263 default:
4264 hdd_err("Invalid channel width 0->20 1->40 2->80");
4265 return -EINVAL;
4266 }
4267
4268 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4269 if (!sme_config) {
4270 hdd_err("failed to allocate memory for sme_config");
4271 return -ENOMEM;
4272 }
4273
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004274 errno = wma_cli_set_command(adapter->vdev_id, WMI_VDEV_PARAM_CHWIDTH,
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004275 ch_width, VDEV_CMD);
4276 if (errno)
4277 goto free_config;
4278
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004279 sme_get_config_param(mac_handle, sme_config);
Jeff Johnsone94ccd02019-04-02 15:02:56 -07004280 sme_config->csr_config.channelBondingMode5GHz = bonding_mode;
4281 sme_config->csr_config.channelBondingMode24GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004282 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004283
4284free_config:
4285 qdf_mem_free(sme_config);
4286
4287 return errno;
4288}
4289
Jeff Johnsondeab8572018-11-13 15:29:53 -08004290static int hdd_we_set_11d_state(struct hdd_adapter *adapter, int state_11d)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004291{
Jeff Johnsondeab8572018-11-13 15:29:53 -08004292 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004293 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004294 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304295 QDF_STATUS status;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004296
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004297 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004298 return -EINVAL;
4299
4300 switch (state_11d) {
4301 case ENABLE_11D:
4302 enable_11d = true;
4303 break;
4304 case DISABLE_11D:
4305 enable_11d = false;
4306 break;
4307 default:
4308 return -EINVAL;
4309 }
4310
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304311 status = ucfg_mlme_set_11d_enabled(hdd_ctx->psoc, enable_11d);
4312 if (!QDF_IS_STATUS_SUCCESS(status))
4313 hdd_err("Invalid 11d_enable flag");
Dustin Brownd90f61a2018-04-26 12:25:58 -07004314
Dustin Brownea82d562018-05-23 12:07:16 -07004315 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004316
4317 return 0;
4318}
4319
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004320static int hdd_we_set_power(struct hdd_adapter *adapter, int value)
4321{
4322 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4323 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4324
4325 if (!mac_handle)
4326 return -EINVAL;
4327
4328 switch (value) {
4329 case 1:
4330 /* Enable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004331 sme_save_usr_ps_cfg(mac_handle, true);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004332 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004333 SME_PS_ENABLE);
4334 return 0;
4335 case 2:
4336 /* Disable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004337 sme_save_usr_ps_cfg(mac_handle, false);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004338 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004339 SME_PS_DISABLE);
4340 return 0;
4341 case 3:
4342 /* Enable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004343 sme_ps_uapsd_enable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004344 return 0;
4345 case 4:
4346 /* Disable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004347 sme_ps_uapsd_disable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004348 return 0;
4349 default:
4350 hdd_err("Invalid value %d", value);
4351 return -EINVAL;
4352 }
4353}
4354
Jeff Johnsoneb4368a2018-10-19 13:02:52 -07004355static int hdd_we_set_max_assoc(struct hdd_adapter *adapter, int value)
4356{
4357 struct hdd_context *hdd_ctx;
4358 QDF_STATUS status;
4359
4360 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4361 status = ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, value);
4362 if (QDF_IS_STATUS_ERROR(status))
4363 hdd_err("cfg set failed, value %d status %d", value, status);
4364
4365 return qdf_status_to_os_return(status);
4366}
4367
Jeff Johnson693722c2018-10-19 13:11:16 -07004368static int hdd_we_set_data_inactivity_timeout(struct hdd_adapter *adapter,
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004369 int inactivity_timeout)
Jeff Johnson693722c2018-10-19 13:11:16 -07004370{
4371 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004372 QDF_STATUS status;
Jeff Johnson693722c2018-10-19 13:11:16 -07004373
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004374 status = ucfg_mlme_set_ps_data_inactivity_timeout(hdd_ctx->psoc,
4375 inactivity_timeout);
Jeff Johnson693722c2018-10-19 13:11:16 -07004376
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004377 return qdf_status_to_os_return(status);
Jeff Johnson693722c2018-10-19 13:11:16 -07004378}
4379
Jeff Johnson94511942018-10-19 13:15:22 -07004380static int hdd_we_set_wow_data_inactivity_timeout(struct hdd_adapter *adapter,
4381 int value)
4382{
4383 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4384 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Jeff Johnson94511942018-10-19 13:15:22 -07004385
4386 if (!mac_handle)
4387 return -EINVAL;
4388
Wu Gaoa796d712019-01-07 14:15:32 +08004389 if (!cfg_in_range(CFG_PMO_WOW_DATA_INACTIVITY_TIMEOUT, value)) {
Jeff Johnson94511942018-10-19 13:15:22 -07004390 hdd_err_rl("Invalid value %d", value);
4391 return -EINVAL;
4392 }
4393
Wu Gaoa796d712019-01-07 14:15:32 +08004394 ucfg_pmo_set_wow_data_inactivity_timeout(hdd_ctx->psoc, (uint8_t)value);
Jeff Johnson94511942018-10-19 13:15:22 -07004395
Wu Gaoa796d712019-01-07 14:15:32 +08004396 return 0;
Jeff Johnson94511942018-10-19 13:15:22 -07004397}
4398
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004399static int hdd_we_set_tx_power(struct hdd_adapter *adapter, int value)
4400{
4401 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4402 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4403 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4404 QDF_STATUS status;
4405
4406 if (!mac_handle)
4407 return -EINVAL;
4408
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004409 status = sme_set_tx_power(mac_handle, adapter->vdev_id,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004410 sta_ctx->conn_info.bssid,
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004411 adapter->device_mode, value);
4412
4413 if (QDF_IS_STATUS_ERROR(status))
4414 hdd_err("cfg set failed, value %d status %d", value, status);
4415
4416 return qdf_status_to_os_return(status);
4417}
4418
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004419static int hdd_we_set_max_tx_power(struct hdd_adapter *adapter, int value)
4420{
4421 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4422 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4423 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4424 QDF_STATUS status;
4425
4426 if (!mac_handle)
4427 return -EINVAL;
4428
4429 status = sme_set_max_tx_power(mac_handle,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004430 sta_ctx->conn_info.bssid,
4431 sta_ctx->conn_info.bssid,
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004432 value);
4433
4434 if (QDF_IS_STATUS_ERROR(status))
4435 hdd_err("cfg set failed, value %d status %d", value, status);
4436
4437 return qdf_status_to_os_return(status);
4438}
4439
Jeff Johnsonf3892b52018-10-23 11:32:04 -07004440static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power)
4441{
4442 QDF_STATUS status;
4443
4444 hdd_debug("power %d dBm", power);
4445 status = sme_set_max_tx_power_per_band(BAND_2G, power);
4446 if (QDF_IS_STATUS_ERROR(status))
4447 hdd_err("cfg set failed, value %d status %d", power, status);
4448
4449 return qdf_status_to_os_return(status);
4450}
4451
Jeff Johnson175004c2018-10-23 12:03:16 -07004452static int hdd_we_set_max_tx_power_5_0(struct hdd_adapter *adapter, int power)
4453{
4454 QDF_STATUS status;
4455
4456 hdd_debug("power %d dBm", power);
4457 status = sme_set_max_tx_power_per_band(BAND_5G, power);
4458 if (QDF_IS_STATUS_ERROR(status))
4459 hdd_err("cfg set failed, value %d status %d", power, status);
4460
4461 return qdf_status_to_os_return(status);
4462}
4463
Jeff Johnson0187c622019-01-04 06:39:44 -08004464#ifdef HASTINGS_BT_WAR
4465
Jeff Johnsonc7fa3542019-04-16 11:35:10 -07004466static bool hdd_hastings_bt_war_applicable(struct hdd_context *hdd_ctx)
4467{
4468 struct pld_soc_info info;
4469 int errno;
4470
4471 errno = pld_get_soc_info(hdd_ctx->parent_dev, &info);
4472 if (errno)
4473 return false;
4474
4475 /* check for HST 1.1 values */
4476
4477 if (info.device_version.family_number != 0x04)
4478 return false;
4479
4480 if (info.device_version.device_number != 0x0A)
4481 return false;
4482
4483 if (info.device_version.major_version != 0x01)
4484 return false;
4485
4486 return true;
4487}
4488
Jeff Johnson0187c622019-01-04 06:39:44 -08004489/*
4490 * replicate logic:
4491 * iwpriv wlan0 setUnitTestCmd 19 2 23 1 => enable WAR
4492 * iwpriv wlan0 setUnitTestCmd 19 2 23 0 => disable WAR
4493 */
4494
4495#define HASTINGS_WAR_FW_PARAM_ID 23
4496
4497static int hdd_hastings_bt_war_set_fw(struct hdd_context *hdd_ctx,
4498 uint32_t value)
4499{
4500 uint32_t vdev_id = 0; /* not used */
4501 uint32_t module_id = WLAN_MODULE_WAL;
4502 uint32_t arg_count = 2;
4503 uint32_t arg[2] = {HASTINGS_WAR_FW_PARAM_ID, value};
4504 QDF_STATUS status;
4505
Jeff Johnsonc7fa3542019-04-16 11:35:10 -07004506 if (!hdd_hastings_bt_war_applicable(hdd_ctx))
4507 return 0;
4508
Jeff Johnson0187c622019-01-04 06:39:44 -08004509 status = wma_form_unit_test_cmd_and_send(vdev_id, module_id,
4510 arg_count, arg);
4511
4512 return qdf_status_to_os_return(status);
4513}
4514
4515int hdd_hastings_bt_war_enable_fw(struct hdd_context *hdd_ctx)
4516{
4517 return hdd_hastings_bt_war_set_fw(hdd_ctx, 1);
4518}
4519
4520int hdd_hastings_bt_war_disable_fw(struct hdd_context *hdd_ctx)
4521{
4522 return hdd_hastings_bt_war_set_fw(hdd_ctx, 0);
4523}
4524
4525/* value to restore the config when the WAR is disabled */
4526static uint32_t iface_change_wait_time_checkpoint;
4527static void checkpoint_iface_change_wait_time(struct hdd_context *hdd_ctx)
4528{
4529 struct hdd_config *config = hdd_ctx->config;
4530
4531 /* did we already checkpoint a value ? */
4532 if (iface_change_wait_time_checkpoint)
4533 return;
4534
4535 /* checkpoint current value */
4536 iface_change_wait_time_checkpoint = config->iface_change_wait_time;
4537
4538 /* was the timer enabled when we checkpointed? */
4539 if (iface_change_wait_time_checkpoint)
4540 return;
4541
4542 /* WAR was enabled at boot, use default when disable */
4543 iface_change_wait_time_checkpoint =
4544 cfg_default(CFG_INTERFACE_CHANGE_WAIT);
4545}
4546
4547static int hdd_hastings_war_enable(struct hdd_context *hdd_ctx)
4548{
4549 struct hdd_config *config = hdd_ctx->config;
4550
4551 config->iface_change_wait_time = 0;
4552
4553 return hdd_hastings_bt_war_enable_fw(hdd_ctx);
4554}
4555
4556static int hdd_hastings_war_disable(struct hdd_context *hdd_ctx)
4557{
4558 struct hdd_config *config = hdd_ctx->config;
4559
4560 config->iface_change_wait_time = iface_change_wait_time_checkpoint;
4561
4562 return hdd_hastings_bt_war_disable_fw(hdd_ctx);
4563}
4564
4565static int hdd_we_set_hastings_bt_war(struct hdd_adapter *adapter, int enable)
4566{
4567 int errno;
4568 struct hdd_context *hdd_ctx;
4569
4570 errno = hdd_validate_adapter(adapter);
4571 if (errno)
4572 return errno;
4573
4574 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonc7fa3542019-04-16 11:35:10 -07004575 if (!hdd_hastings_bt_war_applicable(hdd_ctx))
4576 return 0;
4577
Jeff Johnson0187c622019-01-04 06:39:44 -08004578 checkpoint_iface_change_wait_time(hdd_ctx);
4579
4580 return enable ?
4581 hdd_hastings_war_enable(hdd_ctx) :
4582 hdd_hastings_war_disable(hdd_ctx);
4583}
4584#endif
4585
Jeff Johnson5bee39b2018-10-23 12:34:38 -07004586static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level)
4587{
4588 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4589 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4590 QDF_STATUS status;
4591
4592 if (!mac_handle)
4593 return -EINVAL;
4594
4595 hdd_debug("Thermal Mitigation Level %d", level);
4596 status = sme_set_thermal_level(mac_handle, level);
4597 if (QDF_IS_STATUS_ERROR(status))
4598 hdd_err("cfg set failed, value %d status %d", level, status);
4599
4600 return qdf_status_to_os_return(status);
4601}
4602
Jeff Johnson38912642018-10-24 15:01:40 -07004603static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss)
4604{
4605 QDF_STATUS status;
4606
4607 hdd_debug("NSS %d", nss);
4608
4609 if ((nss > 2) || (nss <= 0)) {
4610 hdd_err("Invalid NSS: %d", nss);
4611 return -EINVAL;
4612 }
4613
4614 status = hdd_update_nss(adapter, nss);
4615 if (QDF_IS_STATUS_ERROR(status))
4616 hdd_err("cfg set failed, value %d status %d", nss, status);
4617
4618 return qdf_status_to_os_return(status);
4619}
4620
Jeff Johnsonce996b32018-10-25 10:52:40 -07004621static int hdd_we_set_short_gi(struct hdd_adapter *adapter, int sgi)
4622{
4623 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
4624 int errno;
4625
4626 hdd_debug("Short GI %d", sgi);
4627
4628 if (!mac_handle) {
4629 hdd_err("NULL Mac handle");
4630 return -EINVAL;
4631 }
4632
4633 if (sgi & HDD_AUTO_RATE_SGI)
4634 errno = sme_set_auto_rate_he_sgi(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004635 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004636 sgi);
4637 else
4638 errno = sme_update_ht_config(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004639 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004640 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4641 sgi);
4642 if (errno)
4643 hdd_err("cfg set failed, value %d status %d", sgi, errno);
4644
4645 return errno;
4646}
4647
Jeff Johnson71d80382018-10-25 15:45:01 -07004648static int hdd_we_set_rtscts(struct hdd_adapter *adapter, int rtscts)
4649{
4650 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4651 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4652 uint32_t value;
4653 uint32_t rts_threshold_val;
4654 QDF_STATUS status;
4655 int errno;
4656
4657 hdd_debug("RTSCTS %d", rtscts);
4658
4659 if (!mac_handle) {
4660 hdd_err("NULL Mac handle");
4661 return -EINVAL;
4662 }
4663
4664 status = ucfg_mlme_get_rts_threshold(hdd_ctx->psoc,
4665 &rts_threshold_val);
4666 if (QDF_IS_STATUS_ERROR(status)) {
4667 hdd_err("Get rts threshold failed, status %d", status);
4668 return -EINVAL;
4669 }
4670
4671 if ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_RTSCTS_ENABLE) {
4672 value = rts_threshold_val;
4673 } else if (((rtscts & HDD_RTSCTS_EN_MASK) == 0) ||
4674 ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_CTS_ENABLE)) {
4675 value = cfg_max(CFG_RTS_THRESHOLD);
4676 } else {
4677 hdd_err_rl("Invalid value %d", rtscts);
4678 return -EINVAL;
4679 }
4680
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004681 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson71d80382018-10-25 15:45:01 -07004682 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4683 rtscts, VDEV_CMD);
4684 if (errno) {
4685 hdd_err("Failed to set firmware, errno %d", errno);
4686 return errno;
4687 }
4688
4689 status = ucfg_mlme_set_rts_threshold(hdd_ctx->psoc, value);
4690 if (QDF_IS_STATUS_ERROR(status)) {
4691 hdd_err("Set rts threshold failed, status %d", status);
4692 return -EINVAL;
4693 }
4694
4695 return 0;
4696}
4697
Jeff Johnson50b15882018-10-26 10:27:37 -07004698static int hdd_we_set_11n_rate(struct hdd_adapter *adapter, int rate_code)
4699{
4700 uint8_t preamble = 0, nss = 0, rix = 0;
4701 int errno;
bings672207d2019-06-20 17:39:39 +08004702 QDF_STATUS status;
4703 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4704 enum wlan_phymode peer_phymode;
4705 uint8_t *peer_mac = adapter->session.station.conn_info.bssid.bytes;
Jeff Johnson50b15882018-10-26 10:27:37 -07004706
4707 hdd_debug("Rate code %d", rate_code);
4708
4709 if (rate_code != 0xff) {
4710 rix = RC_2_RATE_IDX(rate_code);
4711 if (rate_code & 0x80) {
4712 preamble = WMI_RATE_PREAMBLE_HT;
4713 nss = HT_RC_2_STREAMS(rate_code) - 1;
4714 } else {
bings672207d2019-06-20 17:39:39 +08004715 status = ucfg_mlme_get_peer_phymode(hdd_ctx->psoc,
4716 peer_mac,
4717 &peer_phymode);
4718 if (QDF_IS_STATUS_ERROR(status)) {
4719 hdd_err("Failed to set rate");
4720 return 0;
4721 }
4722 if (IS_WLAN_PHYMODE_HE(peer_phymode)) {
4723 hdd_err("Do not set legacy rate %d in HE mode",
4724 rate_code);
4725 return 0;
4726 }
Jeff Johnson50b15882018-10-26 10:27:37 -07004727 nss = 0;
4728 rix = RC_2_RATE_IDX(rate_code);
4729 if (rate_code & 0x10) {
4730 preamble = WMI_RATE_PREAMBLE_CCK;
4731 if (rix != 0x3)
4732 /* Enable Short preamble
4733 * always for CCK except 1mbps
4734 */
4735 rix |= 0x4;
4736 } else {
4737 preamble = WMI_RATE_PREAMBLE_OFDM;
4738 }
4739 }
4740 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4741 }
4742
4743 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4744 rate_code, rix, preamble, nss);
4745
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004746 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson50b15882018-10-26 10:27:37 -07004747 WMI_VDEV_PARAM_FIXED_RATE,
4748 rate_code, VDEV_CMD);
4749 if (errno)
4750 hdd_err("Failed to set firmware, errno %d", errno);
4751
4752 return errno;
4753}
4754
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004755static int hdd_we_set_vht_rate(struct hdd_adapter *adapter, int rate_code)
4756{
4757 uint8_t preamble = 0, nss = 0, rix = 0;
4758 int errno;
4759
4760 hdd_debug("Rate code %d", rate_code);
4761
4762 if (rate_code != 0xff) {
4763 rix = RC_2_RATE_IDX_11AC(rate_code);
4764 preamble = WMI_RATE_PREAMBLE_VHT;
4765 nss = HT_RC_2_STREAMS_11AC(rate_code) - 1;
4766 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4767 }
4768
4769 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4770 rate_code, rix, preamble, nss);
4771
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004772 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004773 WMI_VDEV_PARAM_FIXED_RATE,
4774 rate_code, VDEV_CMD);
4775 if (errno)
4776 hdd_err("Failed to set firmware, errno %d", errno);
4777
4778 return errno;
4779}
4780
Jeff Johnson7c433502018-11-12 15:00:52 -08004781static int hdd_we_set_ampdu(struct hdd_adapter *adapter, int ampdu)
4782{
4783 hdd_debug("AMPDU %d", ampdu);
4784
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004785 return wma_cli_set_command(adapter->vdev_id,
Jeff Johnson7c433502018-11-12 15:00:52 -08004786 GEN_VDEV_PARAM_AMPDU,
4787 ampdu, GEN_CMD);
4788}
4789
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004790static int hdd_we_set_amsdu(struct hdd_adapter *adapter, int amsdu)
4791{
4792 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4793 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4794 int errno;
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304795 QDF_STATUS status;
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004796
4797 hdd_debug("AMSDU %d", amsdu);
4798
4799 if (!mac_handle) {
4800 hdd_err("NULL Mac handle");
4801 return -EINVAL;
4802 }
4803
Kiran Kumar Lokere4bb5c6e2019-08-02 18:47:01 -07004804 status = ucfg_mlme_set_max_amsdu_num(hdd_ctx->psoc,
4805 amsdu);
4806 if (QDF_IS_STATUS_ERROR(status)) {
4807 hdd_err("Failed to set Max AMSDU Num to cfg");
4808 return -EINVAL;
4809 }
4810
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004811 if (amsdu > 1)
4812 sme_set_amsdu(mac_handle, true);
4813 else
4814 sme_set_amsdu(mac_handle, false);
4815
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004816 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004817 GEN_VDEV_PARAM_AMSDU,
4818 amsdu, GEN_CMD);
4819 if (errno) {
4820 hdd_err("Failed to set firmware, errno %d", errno);
4821 return errno;
4822 }
4823
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004824 return 0;
4825}
4826
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004827static int hdd_we_clear_stats(struct hdd_adapter *adapter, int option)
4828{
4829 hdd_debug("option %d", option);
4830
4831 switch (option) {
4832 case CDP_HDD_STATS:
4833 memset(&adapter->stats, 0, sizeof(adapter->stats));
4834 memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
4835 break;
4836 case CDP_TXRX_HIST_STATS:
4837 wlan_hdd_clear_tx_rx_histogram(adapter->hdd_ctx);
4838 break;
4839 case CDP_HDD_NETIF_OPER_HISTORY:
4840 wlan_hdd_clear_netif_queue_history(adapter->hdd_ctx);
4841 break;
4842 case CDP_HIF_STATS:
4843 hdd_clear_hif_stats();
4844 break;
4845 case CDP_NAPI_STATS:
4846 hdd_clear_napi_stats();
4847 break;
4848 default:
4849 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4850 option);
4851 }
4852
4853 return 0;
4854}
4855
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004856static int hdd_we_set_green_tx_param(struct hdd_adapter *adapter,
4857 green_tx_param id,
4858 const char *id_string,
4859 int value)
4860{
4861 int errno;
4862
4863 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004864 errno = wma_cli_set_command(adapter->vdev_id, id, value, GTX_CMD);
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004865 if (errno)
4866 hdd_err("Failed to set firmware, errno %d", errno);
4867
4868 return errno;
4869}
4870
4871#define hdd_we_set_green_tx_param(adapter, id, value) \
4872 hdd_we_set_green_tx_param(adapter, id, #id, value)
4873
4874static int hdd_we_set_gtx_ht_mcs(struct hdd_adapter *adapter, int value)
4875{
4876 return hdd_we_set_green_tx_param(adapter,
4877 WMI_VDEV_PARAM_GTX_HT_MCS,
4878 value);
4879}
4880
4881static int hdd_we_set_gtx_vht_mcs(struct hdd_adapter *adapter, int value)
4882{
4883 return hdd_we_set_green_tx_param(adapter,
4884 WMI_VDEV_PARAM_GTX_VHT_MCS,
4885 value);
4886}
4887
4888static int hdd_we_set_gtx_usrcfg(struct hdd_adapter *adapter, int value)
4889{
4890 return hdd_we_set_green_tx_param(adapter,
4891 WMI_VDEV_PARAM_GTX_USR_CFG,
4892 value);
4893}
4894
4895static int hdd_we_set_gtx_thre(struct hdd_adapter *adapter, int value)
4896{
4897 return hdd_we_set_green_tx_param(adapter,
4898 WMI_VDEV_PARAM_GTX_THRE,
4899 value);
4900}
4901
4902static int hdd_we_set_gtx_margin(struct hdd_adapter *adapter, int value)
4903{
4904 return hdd_we_set_green_tx_param(adapter,
4905 WMI_VDEV_PARAM_GTX_MARGIN,
4906 value);
4907}
4908
4909static int hdd_we_set_gtx_step(struct hdd_adapter *adapter, int value)
4910{
4911 return hdd_we_set_green_tx_param(adapter,
4912 WMI_VDEV_PARAM_GTX_STEP,
4913 value);
4914}
4915
4916static int hdd_we_set_gtx_mintpc(struct hdd_adapter *adapter, int value)
4917{
4918 return hdd_we_set_green_tx_param(adapter,
4919 WMI_VDEV_PARAM_GTX_MINTPC,
4920 value);
4921}
4922
4923static int hdd_we_set_gtx_bwmask(struct hdd_adapter *adapter, int value)
4924{
4925 return hdd_we_set_green_tx_param(adapter,
4926 WMI_VDEV_PARAM_GTX_BW_MASK,
4927 value);
4928}
4929
Jeff Johnsond0477f22018-10-29 12:26:25 -07004930static int hdd_we_packet_power_save(struct hdd_adapter *adapter,
4931 packet_power_save id,
4932 const char *id_string,
4933 int value)
4934{
4935 int errno;
4936
4937 if (adapter->device_mode != QDF_STA_MODE) {
4938 hdd_err_rl("Not supported in mode %d", adapter->device_mode);
4939 return -EINVAL;
4940 }
4941
4942 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004943 errno = wma_cli_set_command(adapter->vdev_id, id, value, PPS_CMD);
Jeff Johnsond0477f22018-10-29 12:26:25 -07004944 if (errno)
4945 hdd_err("Failed to set firmware, errno %d", errno);
4946
4947 return errno;
4948}
4949
4950#define hdd_we_packet_power_save(adapter, id, value) \
4951 hdd_we_packet_power_save(adapter, id, #id, value)
4952
4953static int hdd_we_pps_paid_match(struct hdd_adapter *adapter, int value)
4954{
4955 return hdd_we_packet_power_save(adapter,
4956 WMI_VDEV_PPS_PAID_MATCH,
4957 value);
4958}
4959
4960static int hdd_we_pps_gid_match(struct hdd_adapter *adapter, int value)
4961{
4962 return hdd_we_packet_power_save(adapter,
4963 WMI_VDEV_PPS_GID_MATCH,
4964 value);
4965}
4966
4967static int hdd_we_pps_early_tim_clear(struct hdd_adapter *adapter, int value)
4968{
4969 return hdd_we_packet_power_save(adapter,
4970 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4971 value);
4972}
4973
4974static int hdd_we_pps_early_dtim_clear(struct hdd_adapter *adapter, int value)
4975{
4976 return hdd_we_packet_power_save(adapter,
4977 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4978 value);
4979}
4980
4981static int hdd_we_pps_eof_pad_delim(struct hdd_adapter *adapter, int value)
4982{
4983 return hdd_we_packet_power_save(adapter,
4984 WMI_VDEV_PPS_EOF_PAD_DELIM,
4985 value);
4986}
4987
4988static int hdd_we_pps_macaddr_mismatch(struct hdd_adapter *adapter, int value)
4989{
4990 return hdd_we_packet_power_save(adapter,
4991 WMI_VDEV_PPS_MACADDR_MISMATCH,
4992 value);
4993}
4994
4995static int hdd_we_pps_delim_crc_fail(struct hdd_adapter *adapter, int value)
4996{
4997 return hdd_we_packet_power_save(adapter,
4998 WMI_VDEV_PPS_DELIM_CRC_FAIL,
4999 value);
5000}
5001
5002static int hdd_we_pps_gid_nsts_zero(struct hdd_adapter *adapter, int value)
5003{
5004 return hdd_we_packet_power_save(adapter,
5005 WMI_VDEV_PPS_GID_NSTS_ZERO,
5006 value);
5007}
5008
5009static int hdd_we_pps_rssi_check(struct hdd_adapter *adapter, int value)
5010{
5011 return hdd_we_packet_power_save(adapter,
5012 WMI_VDEV_PPS_RSSI_CHECK,
5013 value);
5014}
5015
5016static int hdd_we_pps_5g_ebt(struct hdd_adapter *adapter, int value)
5017{
5018 return hdd_we_packet_power_save(adapter,
5019 WMI_VDEV_PPS_5G_EBT,
5020 value);
5021}
5022
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07005023static int hdd_we_set_qpower(struct hdd_adapter *adapter,
5024 enum wmi_sta_powersave_param id,
5025 const char *id_string,
5026 int value)
5027{
5028 int errno;
5029
5030 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005031 errno = wma_cli_set_command(adapter->vdev_id, id, value, QPOWER_CMD);
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07005032 if (errno)
5033 hdd_err("Failed to set firmware, errno %d", errno);
5034
5035 return errno;
5036}
5037
5038#define hdd_we_set_qpower(adapter, id, value) \
5039 hdd_we_set_qpower(adapter, id, #id, value)
5040
5041static int
5042hdd_we_set_qpower_max_pspoll_count(struct hdd_adapter *adapter, int value)
5043{
5044 enum wmi_sta_powersave_param id =
5045 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT;
5046
5047 return hdd_we_set_qpower(adapter, id, value);
5048}
5049
5050static int
5051hdd_we_set_qpower_max_tx_before_wake(struct hdd_adapter *adapter, int value)
5052{
5053 enum wmi_sta_powersave_param id =
5054 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE;
5055
5056 return hdd_we_set_qpower(adapter, id, value);
5057}
5058
5059static int
5060hdd_we_set_qpower_spec_pspoll_wake_interval(struct hdd_adapter *adapter,
5061 int value)
5062{
5063 enum wmi_sta_powersave_param id =
5064 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL;
5065
5066 return hdd_we_set_qpower(adapter, id, value);
5067}
5068
5069static int
5070hdd_we_set_qpower_spec_max_spec_nodata_pspoll(struct hdd_adapter *adapter,
5071 int value)
5072{
5073 enum wmi_sta_powersave_param id =
5074 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL;
5075
5076 return hdd_we_set_qpower(adapter, id, value);
5077}
5078
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005079static int hdd_we_set_pdev(struct hdd_adapter *adapter,
5080 WMI_PDEV_PARAM id,
5081 const char *id_string,
5082 int value)
5083{
5084 int errno;
5085
5086 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005087 errno = wma_cli_set_command(adapter->vdev_id, id, value, PDEV_CMD);
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005088 if (errno)
5089 hdd_err("Failed to set firmware, errno %d", errno);
5090
5091 return errno;
5092}
5093
5094#define hdd_we_set_pdev(adapter, id, value) \
5095 hdd_we_set_pdev(adapter, id, #id, value)
5096
5097static int hdd_we_set_ani_en_dis(struct hdd_adapter *adapter, int value)
5098{
5099 return hdd_we_set_pdev(adapter,
5100 WMI_PDEV_PARAM_ANI_ENABLE,
5101 value);
5102}
5103
5104static int hdd_we_set_ani_poll_period(struct hdd_adapter *adapter, int value)
5105{
5106 return hdd_we_set_pdev(adapter,
5107 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
5108 value);
5109}
5110
5111static int hdd_we_set_ani_listen_period(struct hdd_adapter *adapter, int value)
5112{
5113 return hdd_we_set_pdev(adapter,
5114 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
5115 value);
5116}
5117
5118static int hdd_we_set_ani_ofdm_level(struct hdd_adapter *adapter, int value)
5119{
5120 return hdd_we_set_pdev(adapter,
5121 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
5122 value);
5123}
5124
5125static int hdd_we_set_ani_cck_level(struct hdd_adapter *adapter, int value)
5126{
5127 return hdd_we_set_pdev(adapter,
5128 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
5129 value);
5130}
5131
5132static int hdd_we_set_dynamic_bw(struct hdd_adapter *adapter, int value)
5133{
5134 return hdd_we_set_pdev(adapter,
5135 WMI_PDEV_PARAM_DYNAMIC_BW,
5136 value);
5137}
5138
5139static int hdd_we_set_cts_cbw(struct hdd_adapter *adapter, int value)
5140{
5141 return hdd_we_set_pdev(adapter,
5142 WMI_PDEV_PARAM_CTS_CBW,
5143 value);
5144}
5145
5146static int hdd_we_set_tx_chainmask(struct hdd_adapter *adapter, int value)
5147{
5148 int errno;
5149
5150 errno = hdd_we_set_pdev(adapter,
5151 WMI_PDEV_PARAM_TX_CHAIN_MASK,
5152 value);
5153 if (errno)
5154 return errno;
5155
5156 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5157}
5158
5159static int hdd_we_set_rx_chainmask(struct hdd_adapter *adapter, int value)
5160{
5161 int errno;
5162
5163 errno = hdd_we_set_pdev(adapter,
5164 WMI_PDEV_PARAM_RX_CHAIN_MASK,
5165 value);
5166 if (errno)
5167 return errno;
5168
5169 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5170}
5171
5172static int hdd_we_set_txpow_2g(struct hdd_adapter *adapter, int value)
5173{
5174 return hdd_we_set_pdev(adapter,
5175 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
5176 value);
5177}
5178
5179static int hdd_we_set_txpow_5g(struct hdd_adapter *adapter, int value)
5180{
5181 return hdd_we_set_pdev(adapter,
5182 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
5183 value);
5184}
5185
Jeff Johnson2e381272018-11-10 09:33:39 -08005186static int hdd_we_set_vdev(struct hdd_adapter *adapter,
5187 int id,
5188 const char *id_string,
5189 int value)
5190{
5191 int errno;
5192
5193 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005194 errno = wma_cli_set_command(adapter->vdev_id, id, value, VDEV_CMD);
Jeff Johnson2e381272018-11-10 09:33:39 -08005195 if (errno)
5196 hdd_err("Failed to set firmware, errno %d", errno);
5197
5198 return errno;
5199}
5200
5201#define hdd_we_set_vdev(adapter, id, value) \
5202 hdd_we_set_vdev(adapter, id, #id, value)
5203
5204static int hdd_we_set_txrx_fwstats(struct hdd_adapter *adapter, int value)
5205{
5206 return hdd_we_set_vdev(adapter,
5207 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
5208 value);
5209}
5210
5211static int hdd_we_txrx_fwstats_reset(struct hdd_adapter *adapter, int value)
5212{
5213 return hdd_we_set_vdev(adapter,
5214 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
5215 value);
5216}
5217
5218static int hdd_we_set_htsmps(struct hdd_adapter *adapter, int value)
5219{
5220 return hdd_we_set_vdev(adapter,
5221 WMI_STA_SMPS_FORCE_MODE_CMDID,
5222 value);
5223}
5224
5225static int hdd_we_set_early_rx_adjust_enable(struct hdd_adapter *adapter,
5226 int value)
5227{
5228 if ((value != 0) && (value != 1))
5229 return -EINVAL;
5230
5231 return hdd_we_set_vdev(adapter,
5232 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
5233 value);
5234}
5235
5236static int hdd_we_set_early_rx_tgt_bmiss_num(struct hdd_adapter *adapter,
5237 int value)
5238{
5239 return hdd_we_set_vdev(adapter,
5240 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
5241 value);
5242}
5243
5244static int hdd_we_set_early_rx_bmiss_sample_cycle(struct hdd_adapter *adapter,
5245 int value)
5246{
5247 return hdd_we_set_vdev(adapter,
5248 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
5249 value);
5250}
5251
5252static int hdd_we_set_early_rx_slop_step(struct hdd_adapter *adapter, int value)
5253{
5254 return hdd_we_set_vdev(adapter,
5255 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
5256 value);
5257}
5258
5259static int hdd_we_set_early_rx_init_slop(struct hdd_adapter *adapter, int value)
5260{
5261 return hdd_we_set_vdev(adapter,
5262 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
5263 value);
5264}
5265
5266static int hdd_we_set_early_rx_adjust_pause(struct hdd_adapter *adapter,
5267 int value)
5268{
5269 if ((value != 0) && (value != 1))
5270 return -EINVAL;
5271
5272 return hdd_we_set_vdev(adapter,
5273 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
5274 value);
5275}
5276
5277static int hdd_we_set_early_rx_drift_sample(struct hdd_adapter *adapter,
5278 int value)
5279{
5280 return hdd_we_set_vdev(adapter,
5281 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
5282 value);
5283}
5284
5285static int hdd_we_set_dcm(struct hdd_adapter *adapter, int value)
5286{
5287 return hdd_we_set_vdev(adapter,
5288 WMI_VDEV_PARAM_HE_DCM,
5289 value);
5290}
5291
5292static int hdd_we_set_range_ext(struct hdd_adapter *adapter, int value)
5293{
5294 return hdd_we_set_vdev(adapter,
5295 WMI_VDEV_PARAM_HE_RANGE_EXT,
5296 value);
5297}
5298
Jeff Johnson22e57f12018-11-10 16:02:00 -08005299static int hdd_we_set_dbg(struct hdd_adapter *adapter,
5300 int id,
5301 const char *id_string,
5302 int value)
5303{
5304 int errno;
5305
5306 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005307 errno = wma_cli_set_command(adapter->vdev_id, id, value, DBG_CMD);
Jeff Johnson22e57f12018-11-10 16:02:00 -08005308 if (errno)
5309 hdd_err("Failed to set firmware, errno %d", errno);
5310
5311 return errno;
5312}
5313
5314#define hdd_we_set_dbg(adapter, id, value) \
5315 hdd_we_set_dbg(adapter, id, #id, value)
5316
5317static int hdd_we_dbglog_log_level(struct hdd_adapter *adapter, int value)
5318{
5319 return hdd_we_set_dbg(adapter,
5320 WMI_DBGLOG_LOG_LEVEL,
5321 value);
5322}
5323
5324static int hdd_we_dbglog_vap_enable(struct hdd_adapter *adapter, int value)
5325{
5326 return hdd_we_set_dbg(adapter,
5327 WMI_DBGLOG_VAP_ENABLE,
5328 value);
5329}
5330
5331static int hdd_we_dbglog_vap_disable(struct hdd_adapter *adapter, int value)
5332{
5333 return hdd_we_set_dbg(adapter,
5334 WMI_DBGLOG_VAP_DISABLE,
5335 value);
5336}
5337
5338static int hdd_we_dbglog_module_enable(struct hdd_adapter *adapter, int value)
5339{
5340 return hdd_we_set_dbg(adapter,
5341 WMI_DBGLOG_MODULE_ENABLE,
5342 value);
5343}
5344
5345static int hdd_we_dbglog_module_disable(struct hdd_adapter *adapter, int value)
5346{
5347 return hdd_we_set_dbg(adapter,
5348 WMI_DBGLOG_MODULE_DISABLE,
5349 value);
5350}
5351
5352static int hdd_we_dbglog_mod_log_level(struct hdd_adapter *adapter, int value)
5353{
5354 return hdd_we_set_dbg(adapter,
5355 WMI_DBGLOG_MOD_LOG_LEVEL,
5356 value);
5357}
5358
5359static int hdd_we_dbglog_type(struct hdd_adapter *adapter, int value)
5360{
5361 return hdd_we_set_dbg(adapter,
5362 WMI_DBGLOG_TYPE,
5363 value);
5364}
5365
5366static int hdd_we_dbglog_report_enable(struct hdd_adapter *adapter, int value)
5367{
5368 return hdd_we_set_dbg(adapter,
5369 WMI_DBGLOG_REPORT_ENABLE,
5370 value);
5371}
5372
5373static int hdd_we_start_fw_profile(struct hdd_adapter *adapter, int value)
5374{
5375 return hdd_we_set_dbg(adapter,
5376 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5377 value);
5378}
5379
Jeff Johnson274a1d62018-11-12 20:31:51 -08005380static int hdd_we_set_channel(struct hdd_adapter *adapter, int channel)
5381{
5382 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5383 QDF_STATUS status;
5384
5385 hdd_debug("Set Channel %d Session ID %d mode %d", channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005386 adapter->vdev_id, adapter->device_mode);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005387
5388 if (!hdd_ctx->mac_handle)
5389 return -EINVAL;
5390
5391 switch (adapter->device_mode) {
5392 case QDF_STA_MODE:
5393 case QDF_P2P_CLIENT_MODE:
5394 /* supported */
5395 break;
5396 default:
5397 hdd_err("change channel not supported for device mode %d",
5398 adapter->device_mode);
5399 return -EINVAL;
5400 }
5401
5402 status = sme_ext_change_channel(hdd_ctx->mac_handle, channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005403 adapter->vdev_id);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005404 if (status != QDF_STATUS_SUCCESS)
5405 hdd_err("Error in change channel status %d", status);
5406
5407 return qdf_status_to_os_return(status);
5408}
5409
Jeff Johnson0e07ca12018-11-12 21:04:45 -08005410static int hdd_we_mcc_config_latency(struct hdd_adapter *adapter, int latency)
5411{
5412 hdd_debug("MCC latency %d", latency);
5413
5414 wlan_hdd_set_mcc_latency(adapter, latency);
5415
5416 return 0;
5417}
5418
5419static int hdd_we_mcc_config_quota(struct hdd_adapter *adapter, int quota)
5420{
5421 hdd_debug("MCC quota %dms", quota);
5422
5423 return wlan_hdd_set_mcc_p2p_quota(adapter, quota);
5424}
5425
Jeff Johnson33ec1982018-11-12 21:40:33 -08005426static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value)
5427{
5428 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5429
5430 if (!hdd_ctx->mac_handle)
5431 return -EINVAL;
5432
5433 sme_update_connect_debug(hdd_ctx->mac_handle, value);
5434
5435 return 0;
5436}
5437
Jeff Johnsone50951c2018-11-13 12:20:23 -08005438static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value)
5439{
5440 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5441
5442 hdd_debug("%d", value);
5443
Abhishek Singh935e4772018-11-21 14:14:10 +05305444 if (!hdd_ctx->psoc)
Jeff Johnsone50951c2018-11-13 12:20:23 -08005445 return -EINVAL;
5446
Abhishek Singh935e4772018-11-21 14:14:10 +05305447 if (value)
5448 ucfg_scan_psoc_set_disable(hdd_ctx->psoc, REASON_USER_SPACE);
5449 else
5450 ucfg_scan_psoc_set_enable(hdd_ctx->psoc, REASON_USER_SPACE);
Jeff Johnsone50951c2018-11-13 12:20:23 -08005451
5452 return 0;
5453}
5454
Jeff Johnsond3f1efd2018-11-13 13:26:19 -08005455static int hdd_we_set_conc_system_pref(struct hdd_adapter *adapter,
5456 int preference)
5457{
5458 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5459
5460 hdd_debug("%d", preference);
5461
5462 if (!hdd_ctx->psoc)
5463 return -EINVAL;
5464
5465 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, preference);
5466
5467 return 0;
5468}
5469
Jeff Johnson74696bb2018-11-13 13:30:36 -08005470static int hdd_we_set_11ax_rate(struct hdd_adapter *adapter, int rate)
5471{
5472 return hdd_set_11ax_rate(adapter, rate, NULL);
5473}
5474
Jeff Johnsonb43ec122018-11-13 14:17:08 -08005475static int hdd_we_set_modulated_dtim(struct hdd_adapter *adapter, int value)
5476{
5477 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5478
5479 hdd_debug("%d", value);
5480
5481 if (!hdd_ctx->psoc)
5482 return -EINVAL;
5483
5484 if ((value < cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM)) ||
5485 (value > cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM))) {
5486 hdd_err("Invalid value %d", value);
5487 return -EINVAL;
5488 }
5489
5490 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, value);
5491
5492 return 0;
5493}
5494
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305495#ifdef WLAN_FEATURE_MOTION_DETECTION
5496/**
5497 * hdd_we_motion_det_start_stop - start/stop motion detection
5498 * @adapter: hdd adapter
5499 * @value: start/stop value to set
5500 *
5501 * Return: 0 on success, error on failure
5502 */
5503static int hdd_we_motion_det_start_stop(struct hdd_adapter *adapter, int value)
5504{
5505 struct sme_motion_det_en motion_det;
5506 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5507
5508 if (value < 0 || value > 1) {
5509 hdd_err("Invalid value %d in mt_start", value);
5510 return -EINVAL;
5511 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005512 motion_det.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305513 motion_det.enable = value;
5514
5515 if (!value)
5516 adapter->motion_detection_mode = 0;
5517
5518 sme_motion_det_enable(hdd_ctx->mac_handle, &motion_det);
5519
5520 return 0;
5521}
5522
5523/**
5524 * hdd_we_motion_det_base_line_start_stop - start/stop md baselining
5525 * @adapter: hdd adapter
5526 * @value: start/stop value to set
5527 *
5528 * Return: 0 on success, error on failure
5529 */
5530static int hdd_we_motion_det_base_line_start_stop(struct hdd_adapter *adapter,
5531 int value)
5532{
5533 struct sme_motion_det_base_line_en motion_det_base_line;
5534 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5535
5536 if (value < 0 || value > 1) {
5537 hdd_err("Invalid value %d in mt_bl_start", value);
5538 return -EINVAL;
5539 }
5540
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005541 motion_det_base_line.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305542 motion_det_base_line.enable = value;
5543 sme_motion_det_base_line_enable(hdd_ctx->mac_handle,
5544 &motion_det_base_line);
5545
5546 return 0;
5547}
5548#endif /* WLAN_FEATURE_MOTION_DETECTION */
5549
Krishna Reddya50d09f2019-02-04 14:55:06 +05305550int wlan_hdd_set_btcoex_mode(struct hdd_adapter *adapter, int value)
5551{
5552 struct coex_config_params coex_cfg_params = {0};
5553
5554 coex_cfg_params.config_type = WMI_COEX_CONFIG_BTC_MODE;
5555 coex_cfg_params.config_arg1 = value;
5556 coex_cfg_params.vdev_id = adapter->vdev_id;
5557
5558 if (value < cfg_min(CFG_BTC_MODE) || value > cfg_max(CFG_BTC_MODE)) {
5559 hdd_err_rl("Invalid value %d", value);
5560 return -EINVAL;
5561 }
5562
5563 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5564 hdd_err_rl("Failed to send coex BTC mode");
5565 return -EINVAL;
5566 }
5567
5568 return 0;
5569}
5570
5571int wlan_hdd_set_btcoex_rssi_threshold(struct hdd_adapter *adapter, int value)
5572{
5573 struct coex_config_params coex_cfg_params = {0};
5574
5575 coex_cfg_params.config_type = WMI_COEX_CONFIG_BT_LOW_RSSI_THRESHOLD;
5576 coex_cfg_params.config_arg1 = value;
5577 coex_cfg_params.vdev_id = adapter->vdev_id;
5578
5579 if (value < cfg_min(CFG_WLAN_LOW_RSSI_THRESHOLD) ||
5580 value > cfg_max(CFG_WLAN_LOW_RSSI_THRESHOLD)) {
5581 hdd_err_rl("Invalid value %d", value);
5582 return -EINVAL;
5583 }
5584
5585 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5586 hdd_err_rl("Failed to send coex BTC RSSI Threshold");
5587 return -EINVAL;
5588 }
5589 return 0;
5590}
Jeff Johnson3ba27322018-11-13 17:58:28 -08005591typedef int (*setint_getnone_fn)(struct hdd_adapter *adapter, int value);
5592static const setint_getnone_fn setint_getnone_cb[] = {
5593 [WE_SET_11D_STATE] = hdd_we_set_11d_state,
5594 [WE_SET_POWER] = hdd_we_set_power,
5595 [WE_SET_MAX_ASSOC] = hdd_we_set_max_assoc,
5596 [WE_SET_DATA_INACTIVITY_TO] = hdd_we_set_data_inactivity_timeout,
5597 [WE_SET_WOW_DATA_INACTIVITY_TO] =
5598 hdd_we_set_wow_data_inactivity_timeout,
5599 [WE_SET_MC_RATE] = wlan_hdd_set_mc_rate,
5600 [WE_SET_TX_POWER] = hdd_we_set_tx_power,
5601 [WE_SET_MAX_TX_POWER] = hdd_we_set_max_tx_power,
5602 [WE_SET_MAX_TX_POWER_2_4] = hdd_we_set_max_tx_power_2_4,
5603 [WE_SET_MAX_TX_POWER_5_0] = hdd_we_set_max_tx_power_5_0,
Jeff Johnson0187c622019-01-04 06:39:44 -08005604#ifdef HASTINGS_BT_WAR
5605 [WE_SET_HASTINGS_BT_WAR] = hdd_we_set_hastings_bt_war,
5606#endif
Jeff Johnson3ba27322018-11-13 17:58:28 -08005607 [WE_SET_TM_LEVEL] = hdd_we_set_tm_level,
5608 [WE_SET_PHYMODE] = wlan_hdd_update_phymode,
5609 [WE_SET_NSS] = hdd_we_set_nss,
5610 [WE_SET_GTX_HT_MCS] = hdd_we_set_gtx_ht_mcs,
5611 [WE_SET_GTX_VHT_MCS] = hdd_we_set_gtx_vht_mcs,
5612 [WE_SET_GTX_USRCFG] = hdd_we_set_gtx_usrcfg,
5613 [WE_SET_GTX_THRE] = hdd_we_set_gtx_thre,
5614 [WE_SET_GTX_MARGIN] = hdd_we_set_gtx_margin,
5615 [WE_SET_GTX_STEP] = hdd_we_set_gtx_step,
5616 [WE_SET_GTX_MINTPC] = hdd_we_set_gtx_mintpc,
5617 [WE_SET_GTX_BWMASK] = hdd_we_set_gtx_bwmask,
5618 [WE_SET_LDPC] = hdd_set_ldpc,
5619 [WE_SET_TX_STBC] = hdd_set_tx_stbc,
5620 [WE_SET_RX_STBC] = hdd_set_rx_stbc,
5621 [WE_SET_SHORT_GI] = hdd_we_set_short_gi,
5622 [WE_SET_RTSCTS] = hdd_we_set_rtscts,
5623 [WE_SET_CHWIDTH] = hdd_we_set_ch_width,
5624 [WE_SET_ANI_EN_DIS] = hdd_we_set_ani_en_dis,
5625 [WE_SET_ANI_POLL_PERIOD] = hdd_we_set_ani_poll_period,
5626 [WE_SET_ANI_LISTEN_PERIOD] = hdd_we_set_ani_listen_period,
5627 [WE_SET_ANI_OFDM_LEVEL] = hdd_we_set_ani_ofdm_level,
5628 [WE_SET_ANI_CCK_LEVEL] = hdd_we_set_ani_cck_level,
5629 [WE_SET_DYNAMIC_BW] = hdd_we_set_dynamic_bw,
5630 [WE_SET_CTS_CBW] = hdd_we_set_cts_cbw,
5631 [WE_SET_11N_RATE] = hdd_we_set_11n_rate,
5632 [WE_SET_VHT_RATE] = hdd_we_set_vht_rate,
5633 [WE_SET_AMPDU] = hdd_we_set_ampdu,
5634 [WE_SET_AMSDU] = hdd_we_set_amsdu,
5635 [WE_SET_TX_CHAINMASK] = hdd_we_set_tx_chainmask,
5636 [WE_SET_RX_CHAINMASK] = hdd_we_set_rx_chainmask,
5637 [WE_SET_TXPOW_2G] = hdd_we_set_txpow_2g,
5638 [WE_SET_TXPOW_5G] = hdd_we_set_txpow_5g,
5639 [WE_DBGLOG_LOG_LEVEL] = hdd_we_dbglog_log_level,
5640 [WE_DBGLOG_VAP_ENABLE] = hdd_we_dbglog_vap_enable,
5641 [WE_DBGLOG_VAP_DISABLE] = hdd_we_dbglog_vap_disable,
5642 [WE_DBGLOG_MODULE_ENABLE] = hdd_we_dbglog_module_enable,
5643 [WE_DBGLOG_MODULE_DISABLE] = hdd_we_dbglog_module_disable,
5644 [WE_DBGLOG_MOD_LOG_LEVEL] = hdd_we_dbglog_mod_log_level,
5645 [WE_DBGLOG_TYPE] = hdd_we_dbglog_type,
5646 [WE_DBGLOG_REPORT_ENABLE] = hdd_we_dbglog_report_enable,
5647 [WE_SET_TXRX_FWSTATS] = hdd_we_set_txrx_fwstats,
5648 [WE_TXRX_FWSTATS_RESET] = hdd_we_txrx_fwstats_reset,
5649 [WE_DUMP_STATS] = hdd_wlan_dump_stats,
5650 [WE_CLEAR_STATS] = hdd_we_clear_stats,
5651 [WE_PPS_PAID_MATCH] = hdd_we_pps_paid_match,
5652 [WE_PPS_GID_MATCH] = hdd_we_pps_gid_match,
5653 [WE_PPS_EARLY_TIM_CLEAR] = hdd_we_pps_early_tim_clear,
5654 [WE_PPS_EARLY_DTIM_CLEAR] = hdd_we_pps_early_dtim_clear,
5655 [WE_PPS_EOF_PAD_DELIM] = hdd_we_pps_eof_pad_delim,
5656 [WE_PPS_MACADDR_MISMATCH] = hdd_we_pps_macaddr_mismatch,
5657 [WE_PPS_DELIM_CRC_FAIL] = hdd_we_pps_delim_crc_fail,
5658 [WE_PPS_GID_NSTS_ZERO] = hdd_we_pps_gid_nsts_zero,
5659 [WE_PPS_RSSI_CHECK] = hdd_we_pps_rssi_check,
5660 [WE_PPS_5G_EBT] = hdd_we_pps_5g_ebt,
5661 [WE_SET_HTSMPS] = hdd_we_set_htsmps,
5662 [WE_SET_QPOWER_MAX_PSPOLL_COUNT] = hdd_we_set_qpower_max_pspoll_count,
5663 [WE_SET_QPOWER_MAX_TX_BEFORE_WAKE] =
5664 hdd_we_set_qpower_max_tx_before_wake,
5665 [WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL] =
5666 hdd_we_set_qpower_spec_pspoll_wake_interval,
5667 [WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL] =
5668 hdd_we_set_qpower_spec_max_spec_nodata_pspoll,
5669 [WE_MCC_CONFIG_LATENCY] = hdd_we_mcc_config_latency,
5670 [WE_MCC_CONFIG_QUOTA] = hdd_we_mcc_config_quota,
5671 [WE_SET_DEBUG_LOG] = hdd_we_set_debug_log,
5672 [WE_SET_EARLY_RX_ADJUST_ENABLE] = hdd_we_set_early_rx_adjust_enable,
5673 [WE_SET_EARLY_RX_TGT_BMISS_NUM] = hdd_we_set_early_rx_tgt_bmiss_num,
5674 [WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE] =
5675 hdd_we_set_early_rx_bmiss_sample_cycle,
5676 [WE_SET_EARLY_RX_SLOP_STEP] = hdd_we_set_early_rx_slop_step,
5677 [WE_SET_EARLY_RX_INIT_SLOP] = hdd_we_set_early_rx_init_slop,
5678 [WE_SET_EARLY_RX_ADJUST_PAUSE] = hdd_we_set_early_rx_adjust_pause,
5679 [WE_SET_EARLY_RX_DRIFT_SAMPLE] = hdd_we_set_early_rx_drift_sample,
5680 [WE_SET_SCAN_DISABLE] = hdd_we_set_scan_disable,
5681 [WE_START_FW_PROFILE] = hdd_we_start_fw_profile,
5682 [WE_SET_CHANNEL] = hdd_we_set_channel,
5683 [WE_SET_CONC_SYSTEM_PREF] = hdd_we_set_conc_system_pref,
5684 [WE_SET_11AX_RATE] = hdd_we_set_11ax_rate,
5685 [WE_SET_DCM] = hdd_we_set_dcm,
5686 [WE_SET_RANGE_EXT] = hdd_we_set_range_ext,
5687 [WE_SET_PDEV_RESET] = hdd_handle_pdev_reset,
5688 [WE_SET_MODULATED_DTIM] = hdd_we_set_modulated_dtim,
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305689#ifdef WLAN_FEATURE_MOTION_DETECTION
5690 [WE_MOTION_DET_START_STOP] = hdd_we_motion_det_start_stop,
5691 [WE_MOTION_DET_BASE_LINE_START_STOP] =
5692 hdd_we_motion_det_base_line_start_stop,
5693#endif /* WLAN_FEATURE_MOTION_DETECTION */
Krishna Reddya50d09f2019-02-04 14:55:06 +05305694 [WE_SET_BTCOEX_MODE] = wlan_hdd_set_btcoex_mode,
5695 [WE_SET_BTCOEX_RSSI_THRESHOLD] = wlan_hdd_set_btcoex_rssi_threshold,
Jeff Johnson3ba27322018-11-13 17:58:28 -08005696};
5697
5698static setint_getnone_fn hdd_get_setint_getnone_cb(int param)
5699{
5700 if (param < 0)
5701 return NULL;
5702
5703 if (param >= QDF_ARRAY_SIZE(setint_getnone_cb))
5704 return NULL;
5705
5706 return setint_getnone_cb[param];
5707}
5708
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005709/**
5710 * iw_setint_getnone() - Generic "set integer" private ioctl handler
5711 * @dev: device upon which the ioctl was received
5712 * @info: ioctl request information
5713 * @wrqu: ioctl request data
5714 * @extra: ioctl extra data
5715 *
5716 * Return: 0 on success, non-zero on error
5717 */
5718static int __iw_setint_getnone(struct net_device *dev,
5719 struct iw_request_info *info,
5720 union iwreq_data *wrqu, char *extra)
5721{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005722 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005723 struct hdd_context *hdd_ctx;
Jeff Johnson3ba27322018-11-13 17:58:28 -08005724 setint_getnone_fn cb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005725 int *value = (int *)extra;
5726 int sub_cmd = value[0];
5727 int set_value = value[1];
5728 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005729
Dustin Brownfdf17c12018-03-14 12:55:34 -07005730 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305731
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005732 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005733 ret = wlan_hdd_validate_context(hdd_ctx);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005734 if (ret)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005735 return ret;
5736
Jeff Johnson441e1f72017-02-07 08:50:49 -08005737 ret = hdd_check_private_wext_control(hdd_ctx, info);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005738 if (ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08005739 return ret;
5740
Jeff Johnson3ba27322018-11-13 17:58:28 -08005741 cb = hdd_get_setint_getnone_cb(sub_cmd);
5742 if (!cb) {
Rajeev Kumard0565362018-03-01 12:02:01 -08005743 hdd_debug("Invalid sub command %d", sub_cmd);
Jeff Johnson3ba27322018-11-13 17:58:28 -08005744 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005745 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005746
Jeff Johnson3ba27322018-11-13 17:58:28 -08005747 ret = cb(adapter, set_value);
5748
Dustin Browne74003f2018-03-14 12:51:58 -07005749 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005750
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005751 return ret;
5752}
5753
5754static int iw_setint_getnone(struct net_device *dev,
5755 struct iw_request_info *info,
5756 union iwreq_data *wrqu,
5757 char *extra)
5758{
Dustin Brown389e5072018-11-08 17:10:01 +05305759 int errno;
5760 struct osif_vdev_sync *vdev_sync;
5761
5762 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5763 if (errno)
5764 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005765
Dustin Brown389e5072018-11-08 17:10:01 +05305766 errno = __iw_setint_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005767
Dustin Brown389e5072018-11-08 17:10:01 +05305768 osif_vdev_sync_op_stop(vdev_sync);
5769
5770 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005771}
5772
5773/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005774 * __iw_setnone_get_threeint() - return three value to up layer.
5775 *
5776 * @dev: pointer of net_device of this wireless card
5777 * @info: meta data about Request sent
5778 * @wrqu: include request info
5779 * @extra: buf used for in/Output
5780 *
5781 * Return: execute result
5782 */
5783static int __iw_setnone_get_threeint(struct net_device *dev,
5784 struct iw_request_info *info,
5785 union iwreq_data *wrqu, char *extra)
5786{
5787 int ret = 0; /* success */
5788 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005789 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005790 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005791
Dustin Brownfdf17c12018-03-14 12:55:34 -07005792 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005793 ret = wlan_hdd_validate_context(hdd_ctx);
5794 if (0 != ret)
5795 return ret;
5796
Jeff Johnson441e1f72017-02-07 08:50:49 -08005797 ret = hdd_check_private_wext_control(hdd_ctx, info);
5798 if (0 != ret)
5799 return ret;
5800
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005801 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005802 switch (value[0]) {
5803 case WE_GET_TSF:
5804 ret = hdd_indicate_tsf(adapter, value, 3);
5805 break;
5806 default:
5807 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5808 break;
5809 }
5810 return ret;
5811}
5812
5813/**
5814 * iw_setnone_get_threeint() - return three value to up layer.
5815 *
5816 * @dev: pointer of net_device of this wireless card
5817 * @info: meta data about Request sent
5818 * @wrqu: include request info
5819 * @extra: buf used for in/Output
5820 *
5821 * Return: execute result
5822 */
5823static int iw_setnone_get_threeint(struct net_device *dev,
5824 struct iw_request_info *info,
5825 union iwreq_data *wrqu, char *extra)
5826{
Dustin Brown389e5072018-11-08 17:10:01 +05305827 int errno;
5828 struct osif_vdev_sync *vdev_sync;
5829
5830 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5831 if (errno)
5832 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005833
Dustin Brown389e5072018-11-08 17:10:01 +05305834 errno = __iw_setnone_get_threeint(dev, info, wrqu, extra);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005835
Dustin Brown389e5072018-11-08 17:10:01 +05305836 osif_vdev_sync_op_stop(vdev_sync);
5837
5838 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005839}
5840
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005841#ifdef WLAN_UNIT_TEST
Dustin Brown7d038e52018-11-29 14:28:13 -08005842typedef uint32_t (*hdd_ut_callback)(void);
5843
5844struct hdd_ut_entry {
5845 const hdd_ut_callback callback;
5846 const char *name;
5847};
5848
5849struct hdd_ut_entry hdd_ut_entries[] = {
5850 { .name = "dsc", .callback = dsc_unit_test },
Dustin Brown05a0658f2019-03-05 11:27:38 -08005851 { .name = "qdf_delayed_work", .callback = qdf_delayed_work_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005852 { .name = "qdf_ht", .callback = qdf_ht_unit_test },
5853 { .name = "qdf_periodic_work",
5854 .callback = qdf_periodic_work_unit_test },
Dustin Brown92acafe2019-02-15 17:17:10 -08005855 { .name = "qdf_ptr_hash", .callback = qdf_ptr_hash_unit_test },
Dustin Brown128e2d02019-02-15 12:59:07 -08005856 { .name = "qdf_slist", .callback = qdf_slist_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005857 { .name = "qdf_talloc", .callback = qdf_talloc_unit_test },
Dustin Brownee733ba2019-03-12 13:31:11 -07005858 { .name = "qdf_tracker", .callback = qdf_tracker_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005859 { .name = "qdf_types", .callback = qdf_types_unit_test },
Dustin Brown7d038e52018-11-29 14:28:13 -08005860};
5861
5862#define hdd_for_each_ut_entry(cursor) \
5863 for (cursor = hdd_ut_entries; \
5864 cursor < hdd_ut_entries + ARRAY_SIZE(hdd_ut_entries); \
5865 cursor++)
5866
5867static struct hdd_ut_entry *hdd_ut_lookup(const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005868{
Dustin Brown7d038e52018-11-29 14:28:13 -08005869 struct hdd_ut_entry *entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005870
Dustin Brown7d038e52018-11-29 14:28:13 -08005871 hdd_for_each_ut_entry(entry) {
5872 if (qdf_str_eq(entry->name, name))
5873 return entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005874 }
5875
Dustin Brown7d038e52018-11-29 14:28:13 -08005876 return NULL;
5877}
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005878
Dustin Brown7d038e52018-11-29 14:28:13 -08005879static uint32_t hdd_ut_single(const struct hdd_ut_entry *entry)
5880{
5881 uint32_t errors;
5882
5883 hdd_nofl_info("START: '%s'", entry->name);
5884
5885 errors = entry->callback();
5886 if (errors)
5887 hdd_nofl_err("FAIL: '%s' with %u errors", entry->name, errors);
5888 else
5889 hdd_nofl_info("PASS: '%s'", entry->name);
5890
5891 return errors;
5892}
5893
5894static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
5895{
5896 struct hdd_ut_entry *entry;
5897 uint32_t errors = 0;
5898
5899 hdd_nofl_info("Unit tests begin");
5900
5901 if (!name || !name[0] || qdf_str_eq(name, "all")) {
5902 hdd_for_each_ut_entry(entry)
5903 errors += hdd_ut_single(entry);
5904 } else {
5905 entry = hdd_ut_lookup(name);
5906 if (entry)
5907 errors += hdd_ut_single(entry);
5908 else
5909 hdd_nofl_err("Unit test '%s' not found", name);
5910 }
5911
5912 hdd_nofl_info("Unit tests complete");
5913
5914 return errors ? -EPERM : 0;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005915}
5916#else
Dustin Brown7d038e52018-11-29 14:28:13 -08005917static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005918{
5919 return -EOPNOTSUPP;
5920}
5921#endif /* WLAN_UNIT_TEST */
5922
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005923/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005924 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5925 * @dev: device upon which the ioctl was received
5926 * @info: ioctl request information
5927 * @wrqu: ioctl request data
5928 * @extra: ioctl extra data
5929 *
5930 * Return: 0 on success, non-zero on error
5931 */
5932static int __iw_setchar_getnone(struct net_device *dev,
5933 struct iw_request_info *info,
5934 union iwreq_data *wrqu, char *extra)
5935{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005936 int sub_cmd;
5937 int ret;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005938 char *str_arg = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005939 struct hdd_adapter *adapter = (netdev_priv(dev));
5940 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005941 struct iw_point s_priv_data;
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005942 bool neighbor_report_req_support = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005943
Dustin Brownfdf17c12018-03-14 12:55:34 -07005944 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005945
Mukul Sharma34777c62015-11-02 20:22:30 +05305946 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005947 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305948 return -EPERM;
5949 }
5950
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005951 ret = wlan_hdd_validate_context(hdd_ctx);
5952 if (0 != ret)
5953 return ret;
5954
Jeff Johnson441e1f72017-02-07 08:50:49 -08005955 ret = hdd_check_private_wext_control(hdd_ctx, info);
5956 if (0 != ret)
5957 return ret;
5958
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005959 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005960 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005961 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005962
5963 /* make sure all params are correctly passed to function */
Jeff Johnsond36fa332019-03-18 13:42:25 -07005964 if ((!s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005965 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005966
5967 sub_cmd = s_priv_data.flags;
5968
5969 /* ODD number is used for set, copy data using copy_from_user */
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005970 str_arg = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005971 s_priv_data.length);
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005972 if (!str_arg) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005973 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005974 return -ENOMEM;
5975 }
5976
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005977 hdd_debug("Received length: %d data: %s",
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005978 s_priv_data.length, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005979
5980 switch (sub_cmd) {
5981 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005982 hdd_debug("ADD_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305983 if (!hdd_add_wowl_ptrn(adapter, str_arg))
5984 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005985 break;
5986 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005987 hdd_debug("DEL_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305988 if (!hdd_del_wowl_ptrn(adapter, str_arg))
5989 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005990 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005991 case WE_NEIGHBOR_REPORT_REQUEST:
5992 {
Jeff Johnson84b34332019-03-09 18:21:35 -08005993 tRrmNeighborReq request;
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08005994 tRrmNeighborRspCallbackInfo callback;
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305995 bool rrm_enabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005996
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305997 ucfg_wlan_mlme_get_rrm_enabled(hdd_ctx->psoc,
5998 &rrm_enabled);
5999
6000 if (rrm_enabled) {
Jeff Johnson84b34332019-03-09 18:21:35 -08006001 request.neighbor_report_offload = false;
6002 request.no_ssid =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006003 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306004 hdd_debug("Neighbor Request ssid present %d",
Jeff Johnson84b34332019-03-09 18:21:35 -08006005 request.no_ssid);
6006 if (!request.no_ssid) {
6007 request.ssid.length =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006008 (s_priv_data.length - 1) >
6009 32 ? 32 : (s_priv_data.length - 1);
Jeff Johnson84b34332019-03-09 18:21:35 -08006010 qdf_mem_copy(request.ssid.ssId,
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006011 str_arg,
Jeff Johnson84b34332019-03-09 18:21:35 -08006012 request.ssid.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006013 }
6014
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306015 /*
6016 * If 11k offload is supported by FW and enabled
6017 * in the ini, set the offload to true
6018 */
Manikandan Mohan06d38d82018-11-26 18:36:58 -08006019 if (QDF_IS_STATUS_ERROR(
6020 ucfg_fwol_is_neighbor_report_req_supported(
6021 hdd_ctx->psoc, &neighbor_report_req_support)))
6022 hdd_err("Neighbor report req bit get fail");
6023
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306024 if (hdd_ctx->config->is_11k_offload_supported &&
Manikandan Mohan06d38d82018-11-26 18:36:58 -08006025 neighbor_report_req_support) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306026 hdd_debug("Neighbor report offloaded to FW");
Jeff Johnson84b34332019-03-09 18:21:35 -08006027 request.neighbor_report_offload = true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306028 }
6029
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006030 callback.neighborRspCallback = NULL;
6031 callback.neighborRspCallbackContext = NULL;
6032 callback.timeout = 5000; /* 5 seconds */
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306033 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006034 hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006035 adapter->vdev_id,
Jeff Johnson84b34332019-03-09 18:21:35 -08006036 &request,
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006037 &callback);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006038 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006039 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006040 ret = -EINVAL;
6041 }
6042 }
6043 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006044 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08006045 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006046 break;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006047 case WE_UNIT_TEST:
6048 ret = hdd_we_unit_test(hdd_ctx, str_arg);
6049 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006050 default:
6051 {
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006052 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006053 ret = -EINVAL;
6054 break;
6055 }
6056 }
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006057
6058 qdf_mem_free(str_arg);
Dustin Browne74003f2018-03-14 12:51:58 -07006059 hdd_exit();
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006060
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006061 return ret;
6062}
6063
6064static int iw_setchar_getnone(struct net_device *dev,
6065 struct iw_request_info *info,
6066 union iwreq_data *wrqu, char *extra)
6067{
Dustin Brown389e5072018-11-08 17:10:01 +05306068 int errno;
6069 struct osif_vdev_sync *vdev_sync;
6070
6071 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6072 if (errno)
6073 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006074
Dustin Brown389e5072018-11-08 17:10:01 +05306075 errno = __iw_setchar_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006076
Dustin Brown389e5072018-11-08 17:10:01 +05306077 osif_vdev_sync_op_stop(vdev_sync);
6078
6079 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006080}
6081
6082/**
6083 * iw_setnone_getint() - Generic "get integer" private ioctl handler
6084 * @dev: device upon which the ioctl was received
6085 * @info: ioctl request information
6086 * @wrqu: ioctl request data
6087 * @extra: ioctl extra data
6088 *
6089 * Return: 0 on success, non-zero on error
6090 */
6091static int __iw_setnone_getint(struct net_device *dev,
6092 struct iw_request_info *info,
6093 union iwreq_data *wrqu, char *extra)
6094{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006095 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006096 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006097 int *value = (int *)extra;
6098 int ret;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08006099 struct sme_config_params *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006100 struct hdd_context *hdd_ctx;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306101 QDF_STATUS status;
6102 bool bval = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006103
Dustin Brownfdf17c12018-03-14 12:55:34 -07006104 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306105
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006106 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006107 ret = wlan_hdd_validate_context(hdd_ctx);
6108 if (0 != ret)
6109 return ret;
6110
Jeff Johnson441e1f72017-02-07 08:50:49 -08006111 ret = hdd_check_private_wext_control(hdd_ctx, info);
6112 if (0 != ret)
6113 return ret;
6114
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08006115 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6116 if (!sme_config) {
6117 hdd_err("failed to allocate memory for sme_config");
6118 return -ENOMEM;
6119 }
6120
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006121 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006122 switch (value[0]) {
6123 case WE_GET_11D_STATE:
6124 {
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05306125 status = ucfg_mlme_is_11d_enabled(hdd_ctx->psoc, &bval);
6126 if (!QDF_IS_STATUS_SUCCESS(status))
6127 hdd_err("Invalid 11d_enable flag");
6128 *value = bval;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006129 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006130
6131 break;
6132 }
6133
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006134 case WE_GET_WLAN_DBG:
6135 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306136 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006137 *value = 0;
6138 break;
6139 }
6140 case WE_GET_MAX_ASSOC:
6141 {
Dustin Brown05d81302018-09-11 16:49:22 -07006142 if (ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, *value) !=
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306143 QDF_STATUS_SUCCESS) {
6144 hdd_err("CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006145 ret = -EIO;
6146 }
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306147
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006148 break;
6149 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006150
6151 case WE_GET_CONCURRENCY_MODE:
6152 {
Dustin Brown05d81302018-09-11 16:49:22 -07006153 *value = policy_mgr_get_concurrency_mode(hdd_ctx->psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006154
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006155 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006156 break;
6157 }
6158
6159 case WE_GET_NSS:
6160 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006161 sme_get_config_param(mac_handle, sme_config);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306162 status = ucfg_mlme_get_vht_enable2x2(hdd_ctx->psoc, &bval);
6163 if (!QDF_IS_STATUS_SUCCESS(status))
6164 hdd_err("unable to get vht_enable2x2");
6165 *value = (bval == 0) ? 1 : 2;
Dustin Brown05d81302018-09-11 16:49:22 -07006166 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc))
Srinivas Girigowda576b2352017-08-25 14:44:26 -07006167 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006168 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006169 break;
6170 }
6171
6172 case WE_GET_GTX_HT_MCS:
6173 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006174 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006175 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006176 WMI_VDEV_PARAM_GTX_HT_MCS,
6177 GTX_CMD);
6178 break;
6179 }
6180
6181 case WE_GET_GTX_VHT_MCS:
6182 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006183 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006184 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006185 WMI_VDEV_PARAM_GTX_VHT_MCS,
6186 GTX_CMD);
6187 break;
6188 }
6189
6190 case WE_GET_GTX_USRCFG:
6191 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006192 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006193 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006194 WMI_VDEV_PARAM_GTX_USR_CFG,
6195 GTX_CMD);
6196 break;
6197 }
6198
6199 case WE_GET_GTX_THRE:
6200 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006201 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006202 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006203 WMI_VDEV_PARAM_GTX_THRE,
6204 GTX_CMD);
6205 break;
6206 }
6207
6208 case WE_GET_GTX_MARGIN:
6209 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006210 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006211 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006212 WMI_VDEV_PARAM_GTX_MARGIN,
6213 GTX_CMD);
6214 break;
6215 }
6216
6217 case WE_GET_GTX_STEP:
6218 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006219 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006220 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006221 WMI_VDEV_PARAM_GTX_STEP,
6222 GTX_CMD);
6223 break;
6224 }
6225
6226 case WE_GET_GTX_MINTPC:
6227 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006228 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006229 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006230 WMI_VDEV_PARAM_GTX_MINTPC,
6231 GTX_CMD);
6232 break;
6233 }
6234
6235 case WE_GET_GTX_BWMASK:
6236 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006237 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006238 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006239 WMI_VDEV_PARAM_GTX_BW_MASK,
6240 GTX_CMD);
6241 break;
6242 }
6243
6244 case WE_GET_LDPC:
6245 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006246 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006247 break;
6248 }
6249
6250 case WE_GET_TX_STBC:
6251 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006252 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006253 break;
6254 }
6255
6256 case WE_GET_RX_STBC:
6257 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006258 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006259 break;
6260 }
6261
6262 case WE_GET_SHORT_GI:
6263 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006264 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006265 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08006266 WMI_VDEV_PARAM_SGI,
6267 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006268 break;
6269 }
6270
6271 case WE_GET_RTSCTS:
6272 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006273 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006274 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006275 WMI_VDEV_PARAM_ENABLE_RTSCTS,
6276 VDEV_CMD);
6277 break;
6278 }
6279
6280 case WE_GET_CHWIDTH:
6281 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006282 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006283 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006284 WMI_VDEV_PARAM_CHWIDTH,
6285 VDEV_CMD);
6286 break;
6287 }
6288
6289 case WE_GET_ANI_EN_DIS:
6290 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006291 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006292 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006293 WMI_PDEV_PARAM_ANI_ENABLE,
6294 PDEV_CMD);
6295 break;
6296 }
6297
6298 case WE_GET_ANI_POLL_PERIOD:
6299 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006300 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006301 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006302 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
6303 PDEV_CMD);
6304 break;
6305 }
6306
6307 case WE_GET_ANI_LISTEN_PERIOD:
6308 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006309 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006310 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006311 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
6312 PDEV_CMD);
6313 break;
6314 }
6315
6316 case WE_GET_ANI_OFDM_LEVEL:
6317 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006318 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006319 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006320 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
6321 PDEV_CMD);
6322 break;
6323 }
6324
6325 case WE_GET_ANI_CCK_LEVEL:
6326 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006327 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006328 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006329 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
6330 PDEV_CMD);
6331 break;
6332 }
6333
6334 case WE_GET_DYNAMIC_BW:
6335 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006336 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006337 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006338 WMI_PDEV_PARAM_DYNAMIC_BW,
6339 PDEV_CMD);
6340 break;
6341 }
6342
6343 case WE_GET_11N_RATE:
6344 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006345 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006346 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006347 WMI_VDEV_PARAM_FIXED_RATE,
6348 VDEV_CMD);
6349 break;
6350 }
6351
6352 case WE_GET_AMPDU:
6353 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006354 hdd_debug("GET AMPDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006355 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006356 GEN_VDEV_PARAM_AMPDU,
6357 GEN_CMD);
6358 break;
6359 }
6360
6361 case WE_GET_AMSDU:
6362 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006363 hdd_debug("GET AMSDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006364 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006365 GEN_VDEV_PARAM_AMSDU,
6366 GEN_CMD);
6367 break;
6368 }
6369
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006370 case WE_GET_ROAM_SYNCH_DELAY:
6371 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006372 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006373 *value = wma_cli_get_command(adapter->vdev_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006374 GEN_VDEV_ROAM_SYNCH_DELAY,
6375 GEN_CMD);
6376 break;
6377 }
6378
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006379 case WE_GET_TX_CHAINMASK:
6380 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006381 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006382 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006383 WMI_PDEV_PARAM_TX_CHAIN_MASK,
6384 PDEV_CMD);
6385 break;
6386 }
6387
6388 case WE_GET_RX_CHAINMASK:
6389 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006390 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006391 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006392 WMI_PDEV_PARAM_RX_CHAIN_MASK,
6393 PDEV_CMD);
6394 break;
6395 }
6396
6397 case WE_GET_TXPOW_2G:
6398 {
Wu Gao5f764082019-01-04 15:54:38 +08006399 uint8_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006400
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006401 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006402 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006403 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
6404 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006405 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow2g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006406 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006407 break;
6408 }
6409
6410 case WE_GET_TXPOW_5G:
6411 {
Wu Gao5f764082019-01-04 15:54:38 +08006412 uint8_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006413
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006414 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006415 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006416 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
6417 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006418 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow5g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006419 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006420 break;
6421 }
6422
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006423 case WE_GET_PPS_PAID_MATCH:
6424 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006425 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006426 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006427 WMI_VDEV_PPS_PAID_MATCH,
6428 PPS_CMD);
6429 break;
6430 }
6431
6432 case WE_GET_PPS_GID_MATCH:
6433 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006434 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006435 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006436 WMI_VDEV_PPS_GID_MATCH,
6437 PPS_CMD);
6438 break;
6439 }
6440
6441 case WE_GET_PPS_EARLY_TIM_CLEAR:
6442 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006443 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006444 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006445 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
6446 PPS_CMD);
6447 break;
6448 }
6449
6450 case WE_GET_PPS_EARLY_DTIM_CLEAR:
6451 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006452 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006453 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006454 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
6455 PPS_CMD);
6456 break;
6457 }
6458
6459 case WE_GET_PPS_EOF_PAD_DELIM:
6460 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006461 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006462 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006463 WMI_VDEV_PPS_EOF_PAD_DELIM,
6464 PPS_CMD);
6465 break;
6466 }
6467
6468 case WE_GET_PPS_MACADDR_MISMATCH:
6469 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006470 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006471 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006472 WMI_VDEV_PPS_MACADDR_MISMATCH,
6473 PPS_CMD);
6474 break;
6475 }
6476
6477 case WE_GET_PPS_DELIM_CRC_FAIL:
6478 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006479 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006480 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006481 WMI_VDEV_PPS_DELIM_CRC_FAIL,
6482 PPS_CMD);
6483 break;
6484 }
6485
6486 case WE_GET_PPS_GID_NSTS_ZERO:
6487 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006488 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006489 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006490 WMI_VDEV_PPS_GID_NSTS_ZERO,
6491 PPS_CMD);
6492 break;
6493 }
6494
6495 case WE_GET_PPS_RSSI_CHECK:
6496 {
6497
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006498 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006499 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006500 WMI_VDEV_PPS_RSSI_CHECK,
6501 PPS_CMD);
6502 break;
6503 }
6504
6505 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
6506 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006507 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006508 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006509 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
6510 QPOWER_CMD);
6511 break;
6512 }
6513
6514 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
6515 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006516 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006517 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006518 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
6519 QPOWER_CMD);
6520 break;
6521 }
6522
6523 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
6524 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006525 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006526 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006527 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
6528 QPOWER_CMD);
6529 break;
6530 }
6531
6532 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
6533 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006534 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006535 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006536 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
6537 QPOWER_CMD);
6538 break;
6539 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006540 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006541 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006542 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006543 case WE_GET_TEMPERATURE:
6544 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006545 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006546 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006547 break;
6548 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006549 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006550 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006551 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006552 WMI_VDEV_PARAM_HE_DCM,
6553 VDEV_CMD);
6554 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006555 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006556 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006557 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006558 WMI_VDEV_PARAM_HE_RANGE_EXT,
6559 VDEV_CMD);
6560 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006561 default:
6562 {
Jeff Johnson99bac312016-06-28 10:38:18 -07006563 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006564 value[0]);
6565 break;
6566 }
6567 }
Dustin Browne74003f2018-03-14 12:51:58 -07006568 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306569 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006570 return ret;
6571}
6572
6573static int iw_setnone_getint(struct net_device *dev,
6574 struct iw_request_info *info,
6575 union iwreq_data *wrqu, char *extra)
6576{
Dustin Brown389e5072018-11-08 17:10:01 +05306577 int errno;
6578 struct osif_vdev_sync *vdev_sync;
6579
6580 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6581 if (errno)
6582 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006583
Dustin Brown389e5072018-11-08 17:10:01 +05306584 errno = __iw_setnone_getint(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006585
Dustin Brown389e5072018-11-08 17:10:01 +05306586 osif_vdev_sync_op_stop(vdev_sync);
6587
6588 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006589}
6590
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306591static int hdd_set_fwtest(int argc, int cmd, int value)
6592{
6593 struct set_fwtest_params *fw_test;
6594
6595 /* check for max number of arguments */
6596 if (argc > (WMA_MAX_NUM_ARGS) ||
6597 argc != HDD_FWTEST_PARAMS) {
6598 hdd_err("Too Many args %d", argc);
6599 return -EINVAL;
6600 }
6601 /*
6602 * check if number of arguments are 3 then, check
6603 * then set the default value for sounding interval.
6604 */
6605 if (HDD_FWTEST_PARAMS == argc) {
6606 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
6607 value = HDD_FWTEST_SU_DEFAULT_VALUE;
6608 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6609 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6610 }
6611 /* check sounding interval value should not exceed to max */
6612 if (value > HDD_FWTEST_MAX_VALUE) {
6613 hdd_err("Invalid arguments value should not exceed max: %d",
6614 value);
6615 return -EINVAL;
6616 }
6617 fw_test = qdf_mem_malloc(sizeof(*fw_test));
Jeff Johnsond36fa332019-03-18 13:42:25 -07006618 if (!fw_test) {
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306619 hdd_err("qdf_mem_malloc failed for fw_test");
6620 return -ENOMEM;
6621 }
6622 fw_test->arg = cmd;
6623 fw_test->value = value;
6624 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6625 qdf_mem_free(fw_test);
6626 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6627 return -EINVAL;
6628 }
6629 return 0;
6630}
6631
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006632/**
6633 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6634 * @dev: device upon which the ioctl was received
6635 * @info: ioctl request information
6636 * @wrqu: ioctl request data
6637 * @extra: ioctl extra data
6638 *
6639 * Return: 0 on success, non-zero on error
6640 */
6641static int __iw_set_three_ints_getnone(struct net_device *dev,
6642 struct iw_request_info *info,
6643 union iwreq_data *wrqu, char *extra)
6644{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006645 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006646 int *value = (int *)extra;
6647 int sub_cmd = value[0];
6648 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08006649 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006650 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08006651 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006652
Dustin Brownfdf17c12018-03-14 12:55:34 -07006653 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306654
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006655 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006656 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006657 return -EPERM;
6658 }
6659
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006660 ret = wlan_hdd_validate_context(hdd_ctx);
6661 if (0 != ret)
6662 return ret;
6663
Jeff Johnson441e1f72017-02-07 08:50:49 -08006664 ret = hdd_check_private_wext_control(hdd_ctx, info);
6665 if (0 != ret)
6666 return ret;
6667
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006668 switch (sub_cmd) {
6669
6670 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006671 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6672 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006673 break;
6674 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306675 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006676 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306677
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006678 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6679 hdd_debug("Ioctl to set dual mac scan config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08006680 status =
6681 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
6682 &dual_mac_feature);
6683 if (status != QDF_STATUS_SUCCESS)
6684 hdd_err("can't get dual mac feature val, use def");
6685 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006686 hdd_err("Dual mac feature is disabled from INI");
6687 return -EPERM;
6688 }
6689 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Dustin Brown05d81302018-09-11 16:49:22 -07006690 policy_mgr_set_dual_mac_scan_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006691 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006692 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306693 case WE_SET_FW_TEST:
6694 {
6695 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6696 if (ret) {
6697 hdd_err("Not able to set fwtest %d", ret);
6698 return ret;
6699 }
6700 }
6701 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006702 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006703 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006704 break;
6705
6706 }
Dustin Browne74003f2018-03-14 12:51:58 -07006707 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006708 return ret;
6709}
6710
6711int iw_set_three_ints_getnone(struct net_device *dev,
6712 struct iw_request_info *info,
6713 union iwreq_data *wrqu, char *extra)
6714{
Dustin Brown389e5072018-11-08 17:10:01 +05306715 int errno;
6716 struct osif_vdev_sync *vdev_sync;
6717
6718 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6719 if (errno)
6720 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006721
Dustin Brown389e5072018-11-08 17:10:01 +05306722 errno = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006723
Dustin Brown389e5072018-11-08 17:10:01 +05306724 osif_vdev_sync_op_stop(vdev_sync);
6725
6726 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006727}
6728
6729/**
6730 * hdd_connection_state_string() - Get connection state string
6731 * @connection_state: enum to be converted to a string
6732 *
6733 * Return: the string equivalent of @connection_state
6734 */
6735static const char *
6736hdd_connection_state_string(eConnectionState connection_state)
6737{
6738 switch (connection_state) {
6739 CASE_RETURN_STRING(eConnectionState_NotConnected);
6740 CASE_RETURN_STRING(eConnectionState_Connecting);
6741 CASE_RETURN_STRING(eConnectionState_Associated);
6742 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6743 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6744 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6745 default:
6746 return "UNKNOWN";
6747 }
6748}
6749
Naveen Rawat910726a2017-03-06 11:42:51 -08006750#if defined(FEATURE_OEM_DATA_SUPPORT)
6751/**
6752 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6753 * wifi_pos api to get oem data caps
6754 * @dev: net device upon which the request was received
6755 * @info: ioctl request information
6756 * @wrqu: ioctl request data
6757 * @extra: ioctl data payload
6758 *
6759 * Return: 0 for success, negative errno value on failure
6760 */
6761static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6762 struct iw_request_info *info,
6763 union iwreq_data *wrqu, char *extra)
6764{
6765 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6766}
6767#elif defined(WIFI_POS_CONVERGED)
6768static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6769 struct iw_request_info *info,
6770 union iwreq_data *wrqu, char *extra)
6771{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006772 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006773 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006774
Dustin Brown05d81302018-09-11 16:49:22 -07006775 return os_if_wifi_pos_populate_caps(hdd_ctx->psoc,
Naveen Rawat910726a2017-03-06 11:42:51 -08006776 (struct wifi_pos_driver_caps *)extra);
6777}
6778#else
6779static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6780 struct iw_request_info *info,
6781 union iwreq_data *wrqu, char *extra)
6782{
6783 return -ENOTSUPP;
6784}
6785#endif
6786
Krunal Soni5e483782018-10-25 15:42:44 -07006787#ifdef WLAN_UNIT_TEST
6788static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6789 struct hdd_adapter *adapter,
6790 char *extra)
6791{
6792 QDF_STATUS status;
6793
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006794 status = sme_get_sta_cxn_info(hdd_ctx->mac_handle, adapter->vdev_id,
Krunal Soni5e483782018-10-25 15:42:44 -07006795 extra, WE_MAX_STR_LEN);
6796 if (status != QDF_STATUS_SUCCESS)
6797 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6798 "\nNo active connection");
6799
6800 return 0;
6801}
6802#else
6803static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6804 struct hdd_adapter *adapter,
6805 char *extra)
6806{
6807 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6808 "\nNot supported");
6809 return -ENOTSUPP;
6810}
6811#endif
6812
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006813/**
6814 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6815 * @dev: device upon which the ioctl was received
6816 * @info: ioctl request information
6817 * @wrqu: ioctl request data
6818 * @extra: ioctl extra data
6819 *
6820 * Return: 0 on success, non-zero on error
6821 */
6822static int __iw_get_char_setnone(struct net_device *dev,
6823 struct iw_request_info *info,
6824 union iwreq_data *wrqu, char *extra)
6825{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006826 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006827 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006828 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006829 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006830 int ret;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306831 QDF_STATUS status;
6832 uint8_t value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006833
Dustin Brownfdf17c12018-03-14 12:55:34 -07006834 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306835
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006836 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006837 ret = wlan_hdd_validate_context(hdd_ctx);
6838 if (0 != ret)
6839 return ret;
6840
Jeff Johnson441e1f72017-02-07 08:50:49 -08006841 ret = hdd_check_private_wext_control(hdd_ctx, info);
6842 if (0 != ret)
6843 return ret;
6844
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006845 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006846 switch (sub_cmd) {
6847 case WE_WLAN_VERSION:
6848 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006849 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6850 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006851 break;
6852 }
6853
6854 case WE_GET_STATS:
6855 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006856 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006857 extra, WE_MAX_STR_LEN);
6858 break;
6859 }
6860
Dustin Brownd9322482017-01-09 12:46:03 -08006861 case WE_GET_SUSPEND_RESUME_STATS:
6862 {
6863 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6864 WE_MAX_STR_LEN);
6865 if (ret >= 0) {
6866 wrqu->data.length = ret;
6867 ret = 0;
6868 }
6869
6870 break;
6871 }
6872
Govind Singha471e5e2015-10-12 17:11:14 +05306873 case WE_LIST_FW_PROFILE:
6874 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6875 extra, WE_MAX_STR_LEN);
6876 break;
6877
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006878 /* The case prints the current state of the HDD, SME, CSR, PE,
6879 * TL it can be extended for WDI Global State as well. And
6880 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6881 * and P2P_GO have not been added as of now.
6882 */
6883 case WE_GET_STATES:
6884 {
6885 int buf = 0, len = 0;
6886 int adapter_num = 0;
6887 int count = 0, check = 1;
6888
Jeff Johnsond377dce2017-10-04 10:32:42 -07006889 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006890
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006891 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006892 struct hdd_adapter *stat_adapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006893
6894 /* Print wlan0 or p2p0 states based on the adapter_num
6895 * by using the correct adapter
6896 */
6897 while (adapter_num < 2) {
6898 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006899 stat_adapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006900 buf =
6901 scnprintf(extra + len,
6902 WE_MAX_STR_LEN - len,
6903 "\n\n wlan0 States:-");
6904 len += buf;
6905 } else if (P2P_ADAPTER == adapter_num) {
6906 buf =
6907 scnprintf(extra + len,
6908 WE_MAX_STR_LEN - len,
6909 "\n\n p2p0 States:-");
6910 len += buf;
6911
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006912 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006913 buf =
6914 scnprintf(extra + len,
6915 WE_MAX_STR_LEN -
6916 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006917 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006918 len += buf;
6919 break;
6920 }
6921
6922 /* Printing p2p0 states only in the
6923 * case when the device is configured
6924 * as a p2p_client
6925 */
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006926 stat_adapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006927 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006928 QDF_P2P_CLIENT_MODE);
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006929 if (!stat_adapter) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006930 buf =
6931 scnprintf(extra + len,
6932 WE_MAX_STR_LEN -
6933 len,
6934 "\n Device not configured as P2P_CLIENT.");
6935 len += buf;
6936 break;
6937 }
6938 }
6939
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006940 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006941 buf = scnprintf(extra + len,
6942 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006943 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006944 len += buf;
6945 break;
6946 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006947 sta_ctx =
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006948 WLAN_HDD_GET_STATION_CTX_PTR(stat_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006949
6950
6951 buf =
6952 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6953 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006954 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006955 "\n Neighbour Roam State - %s"
6956 "\n CSR State - %s"
6957 "\n CSR Substate - %s",
6958 hdd_connection_state_string
Jeff Johnsone7951512019-02-27 10:02:51 -08006959 (sta_ctx->conn_info.conn_state),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006960 mac_trace_get_neighbour_roam_state
6961 (sme_get_neighbor_roam_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006962 (mac_handle, stat_adapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006963 mac_trace_getcsr_roam_state
6964 (sme_get_current_roam_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006965 (mac_handle, stat_adapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006966 mac_trace_getcsr_roam_sub_state
6967 (sme_get_current_roam_sub_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006968 (mac_handle, stat_adapter->vdev_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006969 );
6970 len += buf;
6971 adapter_num++;
6972 }
6973
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006974 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006975 /* Printing Lim State starting with global lim states */
6976 buf =
6977 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006978 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006979 "\n Global Sme State - %s "
6980 "\n Global mlm State - %s " "\n",
6981 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006982 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006983 mac_trace_get_lim_mlm_state
Jeff Johnson71d465a2018-12-05 11:13:30 -08006984 (sme_get_lim_mlm_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006985 );
6986 len += buf;
6987
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006988 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006989 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006990 buf =
6991 scnprintf(extra + len,
6992 WE_MAX_STR_LEN -
6993 len,
6994 "\n Lim Valid Session %d:-"
6995 "\n PE Sme State - %s "
6996 "\n PE Mlm State - %s "
6997 "\n", check,
6998 mac_trace_get_lim_sme_state
6999 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007000 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007001 mac_trace_get_lim_mlm_state
7002 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007003 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007004 );
7005
7006 len += buf;
7007 check++;
7008 }
7009 count++;
7010 }
7011 }
7012
7013 wrqu->data.length = strlen(extra) + 1;
7014 break;
7015 }
7016
7017 case WE_GET_CFG:
7018 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007019 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007020 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007021 extra,
7022 QCSAP_IOCTL_MAX_STR_LEN);
7023 wrqu->data.length = strlen(extra) + 1;
7024 break;
7025 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007026 case WE_GET_RSSI:
7027 {
7028 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007029
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007030 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007031 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
7032 wrqu->data.length = strlen(extra) + 1;
7033 break;
7034 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007035
7036 case WE_GET_WMM_STATUS:
7037 {
7038 snprintf(extra, WE_MAX_STR_LEN,
7039 "\nDir: 0=up, 1=down, 3=both\n"
7040 "|------------------------|\n"
7041 "|AC | ACM |Admitted| Dir |\n"
7042 "|------------------------|\n"
7043 "|VO | %d | %3s | %d |\n"
7044 "|VI | %d | %3s | %d |\n"
7045 "|BE | %d | %3s | %d |\n"
7046 "|BK | %d | %3s | %d |\n"
7047 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007048 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007049 ac_status[SME_AC_VO].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007050 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007051 ac_status[SME_AC_VO].
Jeff Johnsona5548972019-03-09 14:22:18 -08007052 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007053 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007054 ac_status[SME_AC_VO].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007055 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007056 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007057 ac_status[SME_AC_VI].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007058 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007059 ac_status[SME_AC_VI].
Jeff Johnsona5548972019-03-09 14:22:18 -08007060 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007061 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007062 ac_status[SME_AC_VI].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007063 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007064 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007065 ac_status[SME_AC_BE].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007066 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007067 ac_status[SME_AC_BE].
Jeff Johnsona5548972019-03-09 14:22:18 -08007068 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007069 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007070 ac_status[SME_AC_BE].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007071 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007072 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007073 ac_status[SME_AC_BK].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007074 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007075 ac_status[SME_AC_BK].
Jeff Johnsona5548972019-03-09 14:22:18 -08007076 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007077 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007078 ac_status[SME_AC_BK].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007079 ts_info.direction);
7080
7081 wrqu->data.length = strlen(extra) + 1;
7082 break;
7083 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07007084
7085 case WE_GET_BA_AGEING_TIMEOUT:
7086 {
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -07007087 uint32_t i;
7088 enum qca_wlan_ac_type duration[QCA_WLAN_AC_ALL];
Krunal Soni6c3859f2018-06-01 19:57:40 -07007089 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
7090
7091 if (!soc) {
7092 hdd_err("Invalid SOC handle");
7093 break;
7094 }
7095
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -07007096 for (i = 0; i < QCA_WLAN_AC_ALL; i++)
Krunal Soni6c3859f2018-06-01 19:57:40 -07007097 cdp_get_ba_timeout(soc, i, &duration[i]);
7098
7099 snprintf(extra, WE_MAX_STR_LEN,
7100 "\n|------------------------------|\n"
7101 "|AC | BA aging timeout duration |\n"
7102 "|--------------------------------|\n"
7103 "|VO | %d |\n"
7104 "|VI | %d |\n"
Krunal Soni6c3859f2018-06-01 19:57:40 -07007105 "|BK | %d |\n"
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -07007106 "|BE | %d |\n"
Krunal Soni6c3859f2018-06-01 19:57:40 -07007107 "|--------------------------------|\n",
Srinivas Girigowdad462f3b2019-03-25 14:05:33 -07007108 duration[QCA_WLAN_AC_VO], duration[QCA_WLAN_AC_VI],
7109 duration[QCA_WLAN_AC_BK], duration[QCA_WLAN_AC_BE]);
Krunal Soni6c3859f2018-06-01 19:57:40 -07007110
7111 wrqu->data.length = strlen(extra) + 1;
7112 break;
7113 }
7114
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007115 case WE_GET_CHANNEL_LIST:
7116 {
Qun Zhanga055e9c2019-06-21 17:13:31 +08007117 if (0 !=
7118 iw_get_channel_list_with_cc(dev, mac_handle,
7119 info, wrqu, extra))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007120 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007121 break;
7122 }
7123#ifdef FEATURE_WLAN_TDLS
7124 case WE_GET_TDLS_PEERS:
7125 {
7126 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007127 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007128 WE_MAX_STR_LEN) + 1;
7129 break;
7130 }
7131#endif
7132#ifdef WLAN_FEATURE_11W
7133 case WE_GET_11W_INFO:
7134 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007135 struct csr_roam_profile *roam_profile =
7136 hdd_roam_profile(adapter);
7137
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007138 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007139 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007140
7141 snprintf(extra, WE_MAX_STR_LEN,
7142 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
7143 "\n Number of Unprotected Disassocs %d"
7144 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007145 roam_profile->BSSIDs.bssid->bytes[0],
7146 roam_profile->BSSIDs.bssid->bytes[1],
7147 roam_profile->BSSIDs.bssid->bytes[2],
7148 roam_profile->BSSIDs.bssid->bytes[3],
7149 roam_profile->BSSIDs.bssid->bytes[4],
7150 roam_profile->BSSIDs.bssid->bytes[5],
7151 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07007152 adapter->hdd_stats.hdd_pmf_stats.
7153 num_unprot_disassoc_rx,
7154 adapter->hdd_stats.hdd_pmf_stats.
7155 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007156
7157 wrqu->data.length = strlen(extra) + 1;
7158 break;
7159 }
7160#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007161 case WE_GET_IBSS_STA_INFO:
7162 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07007163 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007164 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007165 int idx = 0;
7166 int length = 0, buf = 0;
7167
Naveen Rawatc45d1622016-07-05 12:20:09 -07007168 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07007169 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnson0a082d92019-03-04 12:25:49 -08007170 sta_ctx->conn_info.sta_id[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007171 buf = snprintf
7172 ((extra + length),
7173 WE_MAX_STR_LEN - length,
Srinivas Girigowdacb7b8b82019-04-10 14:27:47 -07007174 "\n%d ."QDF_MAC_ADDR_STR"\n",
Jeff Johnson0a082d92019-03-04 12:25:49 -08007175 sta_ctx->conn_info.sta_id[idx],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007176 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007177 peer_macaddr[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007178 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007179 peer_macaddr[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007180 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007181 peer_macaddr[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007182 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007183 peer_macaddr[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007184 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007185 peer_macaddr[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007186 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007187 peer_macaddr[idx].bytes[5]
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007188 );
7189 length += buf;
7190 }
7191 }
7192 wrqu->data.length = strlen(extra) + 1;
7193 break;
7194 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007195 case WE_GET_PHYMODE:
7196 {
7197 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007198 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007199 eCsrPhyMode phymode;
Jeff Johnsondbae0172019-03-09 17:01:56 -08007200 enum band_info current_band;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08007201 struct sme_config_params *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007202
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007203 sme_config = qdf_mem_malloc(sizeof(*sme_config));
7204 if (!sme_config) {
7205 hdd_err("Out of memory");
7206 ret = -ENOMEM;
7207 break;
7208 }
7209
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007210 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007211 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Jeff Johnsone94ccd02019-04-02 15:02:56 -07007212 sme_config->csr_config.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007213 ch_bond24 = true;
7214
7215 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Jeff Johnsone94ccd02019-04-02 15:02:56 -07007216 sme_config->csr_config.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007217 ch_bond5g = true;
7218
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007219 qdf_mem_free(sme_config);
7220
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007221 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307222 if ((QDF_STATUS_SUCCESS !=
Harprit Chhabada5dff30e2019-03-12 17:56:45 -07007223 ucfg_reg_get_band(hddctx->pdev, &current_band))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007224 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007225 return -EIO;
7226 }
7227
7228 switch (phymode) {
7229 case eCSR_DOT11_MODE_AUTO:
7230 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
7231 break;
7232 case eCSR_DOT11_MODE_11n:
7233 case eCSR_DOT11_MODE_11n_ONLY:
Jeff Johnsondbae0172019-03-09 17:01:56 -08007234 if (current_band == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007235 if (ch_bond24)
7236 snprintf(extra, WE_MAX_STR_LEN,
7237 "11NGHT40");
7238 else
7239 snprintf(extra, WE_MAX_STR_LEN,
7240 "11NGHT20");
Jeff Johnsondbae0172019-03-09 17:01:56 -08007241 } else if (current_band == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007242 if (ch_bond5g)
7243 snprintf(extra, WE_MAX_STR_LEN,
7244 "11NAHT40");
7245 else
7246 snprintf(extra, WE_MAX_STR_LEN,
7247 "11NAHT20");
7248 } else {
7249 snprintf(extra, WE_MAX_STR_LEN, "11N");
7250 }
7251 break;
7252 case eCSR_DOT11_MODE_abg:
7253 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
7254 break;
7255 case eCSR_DOT11_MODE_11a:
7256 snprintf(extra, WE_MAX_STR_LEN, "11A");
7257 break;
7258 case eCSR_DOT11_MODE_11b:
7259 case eCSR_DOT11_MODE_11b_ONLY:
7260 snprintf(extra, WE_MAX_STR_LEN, "11B");
7261 break;
7262 case eCSR_DOT11_MODE_11g:
7263 case eCSR_DOT11_MODE_11g_ONLY:
7264 snprintf(extra, WE_MAX_STR_LEN, "11G");
7265 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007266 case eCSR_DOT11_MODE_11ac:
7267 case eCSR_DOT11_MODE_11ac_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307268 status =
7269 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7270 &value);
7271 if (!QDF_IS_STATUS_SUCCESS(status))
7272 hdd_err("Failed to set channel_width");
7273 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007274 snprintf(extra, WE_MAX_STR_LEN,
7275 "11ACVHT20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307276 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007277 snprintf(extra, WE_MAX_STR_LEN,
7278 "11ACVHT40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307279 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007280 snprintf(extra, WE_MAX_STR_LEN,
7281 "11ACVHT80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307282 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007283 snprintf(extra, WE_MAX_STR_LEN,
7284 "11ACVHT160");
7285 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007286 case eCSR_DOT11_MODE_11ax:
7287 case eCSR_DOT11_MODE_11ax_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307288 status =
7289 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7290 &value);
7291 if (!QDF_IS_STATUS_SUCCESS(status))
7292 hdd_err("Failed to set channel_width");
7293
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007294 /* currently using vhtChannelWidth */
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307295 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007296 snprintf(extra, WE_MAX_STR_LEN,
7297 "11AX_HE_20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307298 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007299 snprintf(extra, WE_MAX_STR_LEN,
7300 "11AX_HE_40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307301 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007302 snprintf(extra, WE_MAX_STR_LEN,
7303 "11AX_HE_80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307304 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007305 snprintf(extra, WE_MAX_STR_LEN,
7306 "11AX_HE_160");
7307 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007308 }
7309
7310 wrqu->data.length = strlen(extra) + 1;
7311 break;
7312 }
7313
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007314 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08007315 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007316 case WE_GET_SNR:
7317 {
7318 int8_t s7snr = 0;
7319 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007320 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07007321 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007322
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007323 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007324 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307325 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007326 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307327
Jeff Johnsond377dce2017-10-04 10:32:42 -07007328 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsona8fef4e2019-03-11 14:38:49 -07007329 if (!hdd_ctx->config->enable_snr_monitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007330 eConnectionState_Associated !=
Jeff Johnsone7951512019-02-27 10:02:51 -08007331 sta_ctx->conn_info.conn_state) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007332 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsona8fef4e2019-03-11 14:38:49 -07007333 hdd_ctx->config->enable_snr_monitoring,
Jeff Johnsone7951512019-02-27 10:02:51 -08007334 sta_ctx->conn_info.conn_state);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007335 return -ENONET;
7336 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007337 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007338 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
7339 wrqu->data.length = strlen(extra) + 1;
7340 break;
7341 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007342
Krunal Soni5e483782018-10-25 15:42:44 -07007343 case WE_GET_STA_CXN_INFO:
7344 ret = hdd_get_sta_cxn_info(hdd_ctx, adapter, extra);
7345 wrqu->data.length = strlen(extra) + 1;
7346 break;
7347
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007348 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007349 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007350 break;
7351 }
Dustin Brownd9322482017-01-09 12:46:03 -08007352
Dustin Browne74003f2018-03-14 12:51:58 -07007353 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08007354 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007355}
7356
7357static int iw_get_char_setnone(struct net_device *dev,
7358 struct iw_request_info *info,
7359 union iwreq_data *wrqu, char *extra)
7360{
Dustin Brown389e5072018-11-08 17:10:01 +05307361 int errno;
7362 struct osif_vdev_sync *vdev_sync;
7363
7364 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7365 if (errno)
7366 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007367
Dustin Brown389e5072018-11-08 17:10:01 +05307368 errno = __iw_get_char_setnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007369
Dustin Brown389e5072018-11-08 17:10:01 +05307370 osif_vdev_sync_op_stop(vdev_sync);
7371
7372 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007373}
7374
7375/**
7376 * iw_setnone_getnone() - Generic "action" private ioctl handler
7377 * @dev: device upon which the ioctl was received
7378 * @info: ioctl request information
7379 * @wrqu: ioctl request data
7380 * @extra: ioctl extra data
7381 *
7382 * Return: 0 on success, non-zero on error
7383 */
7384static int __iw_setnone_getnone(struct net_device *dev,
7385 struct iw_request_info *info,
7386 union iwreq_data *wrqu, char *extra)
7387{
Jeff Johnson3d278b02017-08-29 14:17:47 -07007388 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007389 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007390 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007391 int ret;
7392 int sub_cmd;
7393
Dustin Brownfdf17c12018-03-14 12:55:34 -07007394 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307395
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007396 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007397 ret = wlan_hdd_validate_context(hdd_ctx);
7398 if (0 != ret)
7399 return ret;
7400
Jeff Johnson441e1f72017-02-07 08:50:49 -08007401 ret = hdd_check_private_wext_control(hdd_ctx, info);
7402 if (0 != ret)
7403 return ret;
7404
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007405#ifdef CONFIG_COMPAT
7406 /* this ioctl is a special case where a sub-ioctl is used and both
7407 * the number of get and set args is 0. in this specific case the
7408 * logic in iwpriv places the sub_cmd in the data.flags portion of
7409 * the iwreq. unfortunately the location of this field will be
7410 * different between 32-bit and 64-bit userspace, and the standard
7411 * compat support in the kernel does not handle this case. so we
7412 * need to explicitly handle it here.
7413 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07007414 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007415 struct compat_iw_point *compat_iw_point =
7416 (struct compat_iw_point *)&wrqu->data;
7417 sub_cmd = compat_iw_point->flags;
7418 } else {
7419 sub_cmd = wrqu->data.flags;
7420 }
7421#else
7422 sub_cmd = wrqu->data.flags;
7423#endif
7424
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007425 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007426 switch (sub_cmd) {
Govind Singha471e5e2015-10-12 17:11:14 +05307427 case WE_GET_FW_PROFILE_DATA:
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007428 ret = wma_cli_set_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05307429 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
7430 0, DBG_CMD);
7431 break;
7432
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007433 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007434 hdd_wlan_get_ibss_peer_info_all(adapter);
7435 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007436
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007437 case WE_SET_REASSOC_TRIGGER:
7438 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07007439 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307440 tSirMacAddr bssid;
Jeff Johnson29c78672019-02-26 21:05:53 -08007441 uint32_t roam_id = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307442 uint8_t operating_ch =
Jingxiang Gece7c5472019-07-23 16:19:23 +08007443 wlan_reg_freq_to_chan(
7444 hdd_ctx->pdev,
7445 adapter->session.station.conn_info.freq);
Jeff Johnson9ff16952019-02-26 20:58:44 -08007446 tCsrRoamModifyProfileFields mod_fields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007447
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007448 sme_get_modify_profile_fields(mac_handle, adapter->vdev_id,
Jeff Johnson9ff16952019-02-26 20:58:44 -08007449 &mod_fields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307450 if (roaming_offload_enabled(hdd_ctx)) {
7451 qdf_mem_copy(bssid,
Jeff Johnsone04b6992019-02-27 14:06:55 -08007452 &adapter->session.station.conn_info.bssid,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307453 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08007454 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307455 bssid, operating_ch);
7456 } else {
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007457 sme_roam_reassoc(mac_handle, adapter->vdev_id,
Jeff Johnson29c78672019-02-26 21:05:53 -08007458 NULL, mod_fields, &roam_id, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307459 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007460 return 0;
7461 }
7462
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007463 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007464 /*
7465 * 1.OBSS Scan is mandatory while operating in 2.4GHz
7466 * 2.OBSS scan is stopped by Firmware during the disassociation
7467 * 3.OBSS stop comamnd is added for debugging purpose
7468 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007469 if (!mac_handle) {
7470 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007471 return -EINVAL;
7472 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007473 sme_ht40_stop_obss_scan(mac_handle, adapter->vdev_id);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007474 break;
7475
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007476 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007477 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007478 break;
7479 }
Dustin Browne74003f2018-03-14 12:51:58 -07007480 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007481 return ret;
7482}
7483
7484static int iw_setnone_getnone(struct net_device *dev,
7485 struct iw_request_info *info,
7486 union iwreq_data *wrqu, char *extra)
7487{
Dustin Brown389e5072018-11-08 17:10:01 +05307488 int errno;
7489 struct osif_vdev_sync *vdev_sync;
7490
7491 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7492 if (errno)
7493 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007494
Dustin Brown389e5072018-11-08 17:10:01 +05307495 errno = __iw_setnone_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007496
Dustin Brown389e5072018-11-08 17:10:01 +05307497 osif_vdev_sync_op_stop(vdev_sync);
7498
7499 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007500}
7501
Krunal Sonia6e505b2017-01-12 12:25:18 -08007502#ifdef MPC_UT_FRAMEWORK
Liangwei Dong509c3472018-05-30 07:05:59 -04007503static void
7504hdd_policy_mgr_set_hw_mode_ut(struct hdd_context *hdd_ctx,
7505 struct hdd_adapter *adapter, int cmd)
7506{
7507 enum hw_mode_ss_config mac0_ss;
7508 enum hw_mode_bandwidth mac0_bw;
7509 enum hw_mode_ss_config mac1_ss;
7510 enum hw_mode_bandwidth mac1_bw;
7511 enum hw_mode_mac_band_cap mac0_band_cap;
7512 enum hw_mode_dbs_capab dbs;
7513
7514 switch (cmd) {
7515 case 0:
7516 hdd_debug("set hw mode for single mac");
7517 mac0_ss = HW_MODE_SS_2x2;
7518 mac0_bw = HW_MODE_80_MHZ;
7519 mac1_ss = HW_MODE_SS_0x0;
7520 mac1_bw = HW_MODE_BW_NONE;
7521 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7522 dbs = HW_MODE_DBS_NONE;
7523 break;
7524 case 1:
7525 hdd_debug("set hw mode for dual mac");
7526 mac0_ss = HW_MODE_SS_1x1;
7527 mac0_bw = HW_MODE_80_MHZ;
7528 mac1_ss = HW_MODE_SS_1x1;
7529 mac1_bw = HW_MODE_40_MHZ;
7530 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7531 dbs = HW_MODE_DBS;
7532 break;
7533 case 2:
7534 hdd_debug("set hw mode for 2x2 5g + 1x1 2g");
7535 mac0_ss = HW_MODE_SS_2x2;
7536 mac0_bw = HW_MODE_80_MHZ;
7537 mac1_ss = HW_MODE_SS_1x1;
7538 mac1_bw = HW_MODE_40_MHZ;
7539 mac0_band_cap = HW_MODE_MAC_BAND_5G;
7540 dbs = HW_MODE_DBS;
7541 break;
7542 case 3:
7543 hdd_debug("set hw mode for 2x2 2g + 1x1 5g");
7544 mac0_ss = HW_MODE_SS_2x2;
7545 mac0_bw = HW_MODE_40_MHZ;
7546 mac1_ss = HW_MODE_SS_1x1;
7547 mac1_bw = HW_MODE_40_MHZ;
7548 mac0_band_cap = HW_MODE_MAC_BAND_2G;
7549 dbs = HW_MODE_DBS;
7550 break;
7551 default:
7552 hdd_err("unknown cmd %d", cmd);
7553 return;
7554 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007555 policy_mgr_pdev_set_hw_mode(hdd_ctx->psoc, adapter->vdev_id,
Liangwei Dong509c3472018-05-30 07:05:59 -04007556 mac0_ss, mac0_bw, mac1_ss, mac1_bw,
7557 mac0_band_cap, dbs, HW_MODE_AGILE_DFS_NONE,
7558 HW_MODE_SBS_NONE,
7559 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
7560}
7561
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007562static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007563 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007564{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08007565 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08007566 case WE_POLICY_MANAGER_CLIST_CMD:
7567 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007568 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307569 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307570 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7571 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7572 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7573 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307574 return 0;
7575 }
Dustin Brown05d81302018-09-11 16:49:22 -07007576 policy_mgr_incr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007577 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7578 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007579 }
7580 break;
7581
7582 case WE_POLICY_MANAGER_DLIST_CMD:
7583 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007584 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307585 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307586 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307587 return 0;
7588 }
Dustin Brown05d81302018-09-11 16:49:22 -07007589 policy_mgr_decr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007590 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007591 }
7592 break;
7593
7594 case WE_POLICY_MANAGER_ULIST_CMD:
7595 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007596 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307597 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307598 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7599 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7600 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7601 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307602 return 0;
7603 }
Dustin Brown05d81302018-09-11 16:49:22 -07007604 policy_mgr_update_connection_info_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007605 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7606 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007607 }
7608 break;
7609
7610 case WE_POLICY_MANAGER_DBS_CMD:
7611 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007612 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007613 if (apps_args[0] == 0)
7614 wma_set_dbs_capability_ut(0);
7615 else
7616 wma_set_dbs_capability_ut(1);
7617
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007618 if (apps_args[1] >= PM_THROUGHPUT &&
7619 apps_args[1] <= PM_LATENCY) {
Liangwei Dong509c3472018-05-30 07:05:59 -04007620 hdd_debug("setting system pref to [%d]\n",
7621 apps_args[1]);
Krunal Sonie71838d2018-09-27 10:45:05 -07007622 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc,
7623 apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007624 }
7625 }
7626 break;
7627
7628 case WE_POLICY_MANAGER_PCL_CMD:
7629 {
7630 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
7631 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
7632 uint32_t pcl_len = 0, i = 0;
7633
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007634 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007635
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307636 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307637 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307638 return 0;
7639 }
Dustin Brown05d81302018-09-11 16:49:22 -07007640 policy_mgr_get_pcl(hdd_ctx->psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08007641 pcl, &pcl_len,
7642 weight_list, QDF_ARRAY_SIZE(weight_list));
Liangwei Dong509c3472018-05-30 07:05:59 -04007643 hdd_debug("PCL list for role[%d] is {", apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007644 for (i = 0 ; i < pcl_len; i++)
Liangwei Dong509c3472018-05-30 07:05:59 -04007645 hdd_debug(" %d, ", pcl[i]);
7646 hdd_debug("}--------->\n");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007647 }
7648 break;
7649
7650 case WE_POLICY_SET_HW_MODE_CMD:
7651 {
Liangwei Dong509c3472018-05-30 07:05:59 -04007652 hdd_debug("pm_set_hw_mode cmd %d", apps_args[0]);
7653 hdd_policy_mgr_set_hw_mode_ut(hdd_ctx, adapter, apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007654 }
7655 break;
7656
7657 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7658 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007659 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307660 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307661 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307662 return 0;
7663 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07007664 policy_mgr_current_connections_update(
Dustin Brown05d81302018-09-11 16:49:22 -07007665 hdd_ctx->psoc,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007666 adapter->vdev_id, apps_args[0],
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07007667 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007668 }
7669 break;
7670
7671 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7672 {
7673 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007674
Dustin Brown5e89ef82018-03-14 11:50:23 -07007675 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307676 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307677 (apps_args[2] < 0)) {
7678 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307679 return 0;
7680 }
Dustin Brown05d81302018-09-11 16:49:22 -07007681 allow = policy_mgr_allow_concurrency(hdd_ctx->psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08007682 apps_args[0], apps_args[1], apps_args[2]);
Liangwei Dong509c3472018-05-30 07:05:59 -04007683 hdd_debug("allow %d {0 = don't allow, 1 = allow}", allow);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007684 }
7685 break;
7686
7687 case WE_POLICY_MANAGER_SCENARIO_CMD:
7688 {
7689 clean_report(hdd_ctx);
7690 if (apps_args[0] == 1) {
7691 wlan_hdd_one_connection_scenario(hdd_ctx);
7692 } else if (apps_args[0] == 2) {
7693 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007694 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007695 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007696 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007697 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007698 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007699 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007700 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007701 } else if (apps_args[0] == 3) {
7702 /* MCC on same band with 2x2 same mac*/
7703 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007704 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007705 /* MCC on diff band with 2x2 same mac*/
7706 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007707 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007708 /* MCC on diff band with 1x1 diff mac */
7709 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007710 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007711 /* MCC on diff band with 1x1 same mac */
7712 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007713 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007714 /* SCC on same band with 2x2 same mac */
7715 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007716 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007717 /* SCC on same band with 1x1 same mac */
7718 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007719 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007720 /* MCC on same band with 2x2 same mac */
7721 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007722 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007723 /* MCC on same band with 1x1 same mac */
7724 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007725 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007726 }
7727 print_report(hdd_ctx);
7728 }
7729 break;
7730 }
7731 return 0;
7732}
7733#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007734static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007735 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007736{
7737 return 0;
7738}
7739#endif
7740
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007741/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007742 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7743 * @hdd_ctx: hdd_context
7744 * @num_args: input args number
7745 * @apps_args: args data ptr
7746 *
7747 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7748 *
7749 * Return: void
7750 */
7751#if WLAN_DEBUG
7752static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7753 int num_args, int *apps_args)
7754{
7755 struct ch_avoid_ind_type ch_avoid;
7756 int cnt = 0, i;
7757
7758 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7759 num_args % 2 != 0)
7760 return;
7761 hdd_info("simulate ch avoid num_args %d", num_args);
7762 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7763 ch_avoid.avoid_freq_range[cnt].start_freq =
7764 apps_args[i];
7765 ch_avoid.avoid_freq_range[cnt].end_freq =
7766 apps_args[++i];
7767
7768 hdd_info("simulate ch avoid [%d %d]",
7769 ch_avoid.avoid_freq_range[cnt].start_freq,
7770 ch_avoid.avoid_freq_range[cnt].end_freq);
7771 cnt++;
7772 }
7773 ch_avoid.ch_avoid_range_cnt = cnt;
Dustin Brown05d81302018-09-11 16:49:22 -07007774 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->psoc, &ch_avoid);
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007775}
7776#else
7777static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7778 int num_args, int *apps_args)
7779{
7780}
7781#endif
7782/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007783 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7784 * @dev: device upon which the ioctl was received
7785 * @info: ioctl request information
7786 * @wrqu: ioctl request data
7787 * @extra: ioctl extra data
7788 *
7789 * This is an SSR-protected generic handler for private ioctls which
7790 * take multiple arguments. Note that this implementation is also
7791 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7792 * interfaces.
7793 *
7794 * Return: 0 on success, non-zero on error
7795 */
7796static int __iw_set_var_ints_getnone(struct net_device *dev,
7797 struct iw_request_info *info,
7798 union iwreq_data *wrqu, char *extra)
7799{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007800 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007801 mac_handle_t mac_handle;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007802 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007803 int sub_cmd;
7804 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007805 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007806 int ret, num_args;
chenguoaa7c90c2018-05-24 17:08:47 +08007807 void *soc = NULL;
7808 struct cdp_pdev *pdev = NULL;
7809 struct cdp_vdev *vdev = NULL;
7810 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007811
Dustin Brownfdf17c12018-03-14 12:55:34 -07007812 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307813
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007814 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007815 ret = wlan_hdd_validate_context(hdd_ctx);
7816 if (0 != ret)
7817 return ret;
7818
Jeff Johnson441e1f72017-02-07 08:50:49 -08007819 ret = hdd_check_private_wext_control(hdd_ctx, info);
7820 if (0 != ret)
7821 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007822
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007823 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007824 sub_cmd = wrqu->data.flags;
7825 num_args = wrqu->data.length;
7826
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007827 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007828
7829 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007830 case WE_IBSS_GET_PEER_INFO:
7831 {
7832 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007833 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007834 }
7835 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007836
7837 case WE_P2P_NOA_CMD:
7838 {
Jeff Johnson156cd082019-03-10 21:49:54 -07007839 struct p2p_app_set_ps p2p_noa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007840
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007841 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007842 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
Dustin Brown458027c2018-10-19 12:26:27 -07007843 qdf_opmode_str(adapter->device_mode),
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007844 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007845 return -EINVAL;
7846 }
7847
Jeff Johnson156cd082019-03-10 21:49:54 -07007848 p2p_noa.opp_ps = apps_args[0];
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007849 p2p_noa.ct_window = apps_args[1];
Jeff Johnson156cd082019-03-10 21:49:54 -07007850 p2p_noa.duration = apps_args[2];
7851 p2p_noa.interval = apps_args[3];
7852 p2p_noa.count = apps_args[4];
7853 p2p_noa.single_noa_duration = apps_args[5];
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007854 p2p_noa.ps_selection = apps_args[6];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007855
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007856 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 -07007857 apps_args[0], apps_args[1], apps_args[2],
7858 apps_args[3], apps_args[4],
7859 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007860
Jeff Johnson156cd082019-03-10 21:49:54 -07007861 hdd_set_p2p_ps(dev, &p2p_noa);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007862
7863 }
7864 break;
7865
7866 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7867 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007868 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007869 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307870 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007871 }
7872 break;
7873
7874 case WE_MTRACE_DUMP_CMD:
7875 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007876 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007877 apps_args[0], apps_args[1],
7878 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007879 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007880 apps_args[1], apps_args[2],
7881 apps_args[3]);
7882
7883 }
7884 break;
7885
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007886 case WE_POLICY_MANAGER_CINFO_CMD:
7887 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007888 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007889 uint32_t i = 0, len = 0;
7890
Krunal Sonia6e505b2017-01-12 12:25:18 -08007891 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007892 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007893 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007894 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007895 pr_info("|table_index[%d]\t\t\n", i);
7896 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
7897 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
7898 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7899 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7900 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7901 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7902 pr_info("+--------------------------+\n");
7903 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007904 }
7905 }
7906 break;
7907
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007908 case WE_UNIT_TEST_CMD:
7909 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007910 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007911
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007912 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7913 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007914 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007915 return -EINVAL;
7916 }
Sourav Mohapatraea7210b2018-11-16 16:58:52 +05307917 if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307918 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007919 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007920 return -EINVAL;
7921 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007922 status = sme_send_unit_test_cmd(adapter->vdev_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007923 apps_args[0],
7924 apps_args[1],
7925 &apps_args[2]);
7926 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007927 hdd_err("sme_send_unit_test_cmd returned %d", status);
7928 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007929 }
7930 }
7931 break;
7932#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7933 case WE_LED_FLASHING_PARAM:
7934 {
7935 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007936
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007937 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007938 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007939 return -EINVAL;
7940 }
7941 for (i = 0; i < num_args; i++) {
7942 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007943 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007944 return -EINVAL;
7945 }
7946 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007947 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007948 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007949 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007950 1, apps_args[2], apps_args[3]);
7951 }
7952 break;
7953#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05307954 case WE_SET_PKTLOG:
7955 {
7956 int ret;
7957
7958 if (num_args < 1 || num_args > 2) {
7959 hdd_err("pktlog: either 1 or 2 parameters are required");
7960 return -EINVAL;
7961 }
7962
7963 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
7964 apps_args[1]);
7965 if (ret)
7966 return ret;
7967 break;
7968 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05307969 case WE_MAC_PWR_DEBUG_CMD:
7970 {
7971 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05307972 int i, j;
7973
7974 if (num_args < 3) {
7975 hdd_err("number of arguments can't be null %d",
7976 num_args);
7977 return -EINVAL;
7978 }
7979 if (num_args - 3 != apps_args[2]) {
7980 hdd_err("arg list of size %d doesn't match num_args %d",
7981 num_args-3, apps_args[2]);
7982 return -EINVAL;
7983 }
7984 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
7985 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
7986 hdd_err("Invalid MODULE ID %d", apps_args[1]);
7987 return -EINVAL;
7988 }
7989 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
7990 hdd_err("Too Many args %d", apps_args[2]);
7991 return -EINVAL;
7992 }
7993 mac_pwr_dbg_args.pdev_id = apps_args[0];
7994 mac_pwr_dbg_args.module_id = apps_args[1];
7995 mac_pwr_dbg_args.num_args = apps_args[2];
7996
7997 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
7998 mac_pwr_dbg_args.args[i] = apps_args[j];
7999
8000 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008001 sme_process_mac_pwr_dbg_cmd(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008002 adapter->vdev_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05308003 &mac_pwr_dbg_args)) {
8004 return -EINVAL;
8005 }
8006 }
8007 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08008008 case WE_POLICY_MANAGER_CLIST_CMD:
8009 case WE_POLICY_MANAGER_DLIST_CMD:
8010 case WE_POLICY_MANAGER_ULIST_CMD:
8011 case WE_POLICY_MANAGER_DBS_CMD:
8012 case WE_POLICY_MANAGER_PCL_CMD:
8013 case WE_POLICY_SET_HW_MODE_CMD:
8014 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
8015 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
8016 case WE_POLICY_MANAGER_SCENARIO_CMD:
8017 {
Krunal Soni3de68532018-09-05 12:16:58 -07008018 if (!hdd_ctx->config->is_unit_test_framework_enabled) {
8019 hdd_warn_rl("UT framework is disabled");
8020 return -EINVAL;
8021 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008022 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Soni3de68532018-09-05 12:16:58 -07008023 sub_cmd, apps_args);
Krunal Sonia6e505b2017-01-12 12:25:18 -08008024 }
8025 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08008026 case WE_SET_CHAN_AVOID:
8027 {
8028 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
8029 }
8030 break;
chenguoaa7c90c2018-05-24 17:08:47 +08008031 case WE_SET_TXRX_STATS:
8032 {
8033 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008034 adapter->vdev_id);
chenguoaa7c90c2018-05-24 17:08:47 +08008035
8036 if (ret != 0) {
8037 hdd_err("Invalid handles");
8038 break;
8039 }
8040
8041 req.stats = apps_args[0];
8042 /* default value of secondary parameter is 0(mac_id) */
8043 req.mac_id = apps_args[1];
8044
8045 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
8046 req.stats, req.mac_id);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008047 if (apps_args[0] == CDP_TXRX_STATS_28) {
Jeff Johnson457c2422019-02-27 13:56:04 -08008048 if (sta_ctx->conn_info.is_authenticated) {
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008049 hdd_debug("ap mac addr: %pM",
Jeff Johnsone04b6992019-02-27 14:06:55 -08008050 (void *)&sta_ctx->conn_info.bssid);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008051 req.peer_addr =
Jeff Johnsone04b6992019-02-27 14:06:55 -08008052 (char *)&sta_ctx->conn_info.bssid;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008053 }
8054 }
chenguoaa7c90c2018-05-24 17:08:47 +08008055 ret = cdp_txrx_stats_request(soc, vdev, &req);
8056 break;
8057 }
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308058#ifdef WLAN_FEATURE_MOTION_DETECTION
8059 case WE_MOTION_DET_CONFIG_PARAM:
8060 {
8061 struct sme_motion_det_cfg motion_det_cfg;
8062
8063 if (num_args != 15) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308064 hdd_err_rl("mt_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308065 return -EINVAL;
8066 }
8067
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008068 motion_det_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308069 motion_det_cfg.time_t1 = apps_args[0];
8070 motion_det_cfg.time_t2 = apps_args[1];
8071 motion_det_cfg.n1 = apps_args[2];
8072 motion_det_cfg.n2 = apps_args[3];
8073 motion_det_cfg.time_t1_gap = apps_args[4];
8074 motion_det_cfg.time_t2_gap = apps_args[5];
8075 motion_det_cfg.coarse_K = apps_args[6];
8076 motion_det_cfg.fine_K = apps_args[7];
8077 motion_det_cfg.coarse_Q = apps_args[8];
8078 motion_det_cfg.fine_Q = apps_args[9];
8079 motion_det_cfg.md_coarse_thr_high = apps_args[10];
8080 motion_det_cfg.md_fine_thr_high = apps_args[11];
8081 motion_det_cfg.md_coarse_thr_low = apps_args[12];
8082 motion_det_cfg.md_fine_thr_low = apps_args[13];
8083 adapter->motion_detection_mode = apps_args[14];
8084 sme_motion_det_config(hdd_ctx->mac_handle, &motion_det_cfg);
8085 }
8086 break;
8087 case WE_MOTION_DET_BASE_LINE_CONFIG_PARAM:
8088 {
8089 struct sme_motion_det_base_line_cfg motion_det_base_line_cfg;
8090
8091 if (num_args != 4) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308092 hdd_err_rl("mt_bl_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308093 return -EINVAL;
8094 }
8095
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008096 motion_det_base_line_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308097 motion_det_base_line_cfg.bl_time_t = apps_args[0];
8098 motion_det_base_line_cfg.bl_packet_gap = apps_args[1];
8099 motion_det_base_line_cfg.bl_n = apps_args[2];
8100 motion_det_base_line_cfg.bl_num_meas = apps_args[3];
8101 sme_motion_det_base_line_config(hdd_ctx->mac_handle,
8102 &motion_det_base_line_cfg);
8103 }
8104 break;
8105#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308106#ifdef FW_THERMAL_THROTTLE_SUPPORT
8107 case WE_SET_THERMAL_THROTTLE_CFG:
8108 {
8109 QDF_STATUS status;
8110
8111 if (num_args != 7) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308112 hdd_err_rl("set_thermal_cfg: Invalid no of args");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308113 return -EINVAL;
8114 }
8115
8116 /* Check for valid inputs */
8117 if (apps_args[0] < 0 || apps_args[0] > 1 || apps_args[1] < 0 ||
8118 apps_args[2] < 0 || apps_args[2] > 100 ||
8119 apps_args[3] < 0 || apps_args[3] > 3 || apps_args[4] < 0 ||
8120 apps_args[5] < 0 || apps_args[6] < 0 ||
8121 apps_args[5] <= apps_args[4])
8122 return -EINVAL;
8123
8124 status = sme_set_thermal_throttle_cfg(hdd_ctx->mac_handle,
8125 apps_args[0],
8126 apps_args[1],
8127 apps_args[2],
8128 apps_args[3],
8129 apps_args[6]);
8130 if (QDF_IS_STATUS_ERROR(status))
8131 return qdf_status_to_os_return(status);
8132
8133 if (!apps_args[6]) {
8134 status = sme_set_thermal_mgmt(hdd_ctx->mac_handle,
8135 apps_args[4],
8136 apps_args[5]);
8137 if (QDF_IS_STATUS_ERROR(status))
8138 return qdf_status_to_os_return(status);
8139 }
8140 break;
8141 }
8142#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008143 default:
8144 {
Jeff Johnson99bac312016-06-28 10:38:18 -07008145 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008146 }
8147 break;
8148 }
Dustin Browne74003f2018-03-14 12:51:58 -07008149 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008150 return 0;
8151}
8152
8153/**
8154 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
8155 * @dev: pointer to net_device structure
8156 * @info: pointer to iw_request_info structure
8157 * @wrqu: pointer to iwreq_data
8158 * @extra; extra
8159 *
8160 * Return: 0 on success, error number otherwise
8161 *
8162 */
8163static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
8164 struct iw_request_info *info,
8165 union iwreq_data *wrqu, char *extra)
8166{
8167 union iwreq_data u_priv_wrqu;
8168 int apps_args[MAX_VAR_ARGS] = {0};
Dustin Brown389e5072018-11-08 17:10:01 +05308169 int errno, num_args;
8170 struct osif_vdev_sync *vdev_sync;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008171
Mukul Sharma64a70e82015-11-02 20:05:09 +05308172 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008173 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05308174 return -EPERM;
8175 }
8176
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008177 /* Helper function to get iwreq_data with compat handling. */
8178 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
8179 return -EINVAL;
8180
Jeff Johnsond36fa332019-03-18 13:42:25 -07008181 if (!u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008182 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008183 return -EINVAL;
8184 }
8185
8186 num_args = u_priv_wrqu.data.length;
8187 if (num_args > MAX_VAR_ARGS)
8188 num_args = MAX_VAR_ARGS;
8189
8190 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
Dustin Brown389e5072018-11-08 17:10:01 +05308191 sizeof(int) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008192 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008193 return -EFAULT;
8194 }
8195
Dustin Brown389e5072018-11-08 17:10:01 +05308196 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8197 if (errno)
8198 return errno;
8199
Dustin Brown389e5072018-11-08 17:10:01 +05308200 errno = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
8201 (char *)&apps_args);
Dustin Brown389e5072018-11-08 17:10:01 +05308202
8203 osif_vdev_sync_op_stop(vdev_sync);
8204
8205 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008206}
8207
8208/**
8209 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
8210 * @dev: device upon which the ioctl was received
8211 * @info: ioctl request information
8212 * @wrqu: ioctl request data
8213 * @extra: ioctl extra data
8214 *
8215 * This is a generic handler for private ioctls which take multiple
8216 * arguments. Note that this implementation is also somewhat unique
8217 * in that it is shared by both STA-mode and SAP-mode interfaces.
8218 *
8219 * Return: 0 on success, non-zero on error
8220 */
8221int iw_set_var_ints_getnone(struct net_device *dev,
8222 struct iw_request_info *info,
8223 union iwreq_data *wrqu, char *extra)
8224{
Dustin Brown389e5072018-11-08 17:10:01 +05308225 int errno;
8226 struct osif_vdev_sync *vdev_sync;
8227
8228 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8229 if (errno)
8230 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008231
Dustin Brown389e5072018-11-08 17:10:01 +05308232 errno = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
Dustin Brown389e5072018-11-08 17:10:01 +05308233
8234 osif_vdev_sync_op_stop(vdev_sync);
8235
8236 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008237}
8238
8239/**
8240 * iw_add_tspec - Add TSpec private ioctl handler
8241 * @dev: device upon which the ioctl was received
8242 * @info: ioctl request information
8243 * @wrqu: ioctl request data
8244 * @extra: ioctl extra data
8245 *
8246 * Return: 0 on success, non-zero on error
8247 */
8248static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
8249 union iwreq_data *wrqu, char *extra)
8250{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008251 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008252 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008253 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008254 int params[HDD_WLAN_WMM_PARAM_COUNT];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008255 struct sme_qos_wmmtspecinfo tspec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008256 uint32_t handle;
8257 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008258 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008259 int ret;
8260
Dustin Brownfdf17c12018-03-14 12:55:34 -07008261 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308262
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008263 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008264 ret = wlan_hdd_validate_context(hdd_ctx);
8265 if (0 != ret)
8266 return ret;
8267
Jeff Johnson441e1f72017-02-07 08:50:49 -08008268 ret = hdd_check_private_wext_control(hdd_ctx, info);
8269 if (0 != ret)
8270 return ret;
8271
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008272 /* make sure the application is sufficiently priviledged */
8273 /* note that the kernel will do this for "set" ioctls, but since */
8274 /* this ioctl wants to return status to user space it must be */
8275 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008276 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008277 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008278
8279 /* we must be associated in order to add a tspec */
Jeff Johnsone7951512019-02-27 10:02:51 -08008280 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008281 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008282 return 0;
8283 }
8284 /* since we are defined to be a "get" ioctl, and since the number */
8285 /* of params exceeds the number of params that wireless extensions */
8286 /* will pass down in the iwreq_data, we must copy the "set" params. */
8287 /* We must handle the compat for iwreq_data in 32U/64K environment. */
8288
8289 /* helper function to get iwreq_data with compat handling. */
8290 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008291 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008292 return 0;
8293 }
8294 /* make sure all params are correctly passed to function */
Jeff Johnsond36fa332019-03-18 13:42:25 -07008295 if ((!s_priv_data.pointer) ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008296 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008297 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008298 return 0;
8299 }
8300 /* from user space ourselves */
8301 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
8302 /* hmmm, can't get them */
8303 return -EIO;
8304 }
8305 /* clear the tspec */
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008306 memset(&tspec, 0, sizeof(tspec));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008307
8308 /* validate the handle */
8309 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8310 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8311 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008312 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008313 return 0;
8314 }
8315 /* validate the TID */
8316 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
8317 /* out of range */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008318 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008319 return 0;
8320 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008321 tspec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008322
8323 /* validate the direction */
8324 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
8325 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008326 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008327 break;
8328
8329 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008330 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008331 break;
8332
8333 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008334 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008335 break;
8336
8337 default:
8338 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008339 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008340 return 0;
8341 }
8342
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008343 tspec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008344
8345 /* validate the user priority */
8346 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
8347 /* out of range */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008348 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008349 return 0;
8350 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008351 tspec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
8352 if (0 > tspec.ts_info.up || SME_QOS_WMM_UP_MAX < tspec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008353 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008354 return 0;
8355 }
8356
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008357 hdd_debug("TS_INFO PSB %d UP %d !!!",
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008358 tspec.ts_info.psb, tspec.ts_info.up);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008359
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008360 tspec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
8361 tspec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
8362 tspec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
8363 tspec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
8364 tspec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
8365 tspec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
8366 tspec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
8367 tspec.surplus_bw_allowance =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008368 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008369 tspec.min_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008370 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008371 tspec.max_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008372 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008373 tspec.suspension_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008374 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008375 tspec.inactivity_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008376 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
8377
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008378 tspec.ts_info.burst_size_defn =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008379 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
8380
8381 /* validate the ts info ack policy */
8382 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
Abhinav Kumarab576712018-11-05 14:32:49 +05308383 case TS_INFO_ACK_POLICY_NORMAL_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008384 tspec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008385 break;
8386
Abhinav Kumarab576712018-11-05 14:32:49 +05308387 case TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008388 tspec.ts_info.ack_policy =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008389 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
8390 break;
8391
8392 default:
8393 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008394 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008395 return 0;
8396 }
8397
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008398 *wmm_status = hdd_wmm_addts(adapter, handle, &tspec);
Dustin Browne74003f2018-03-14 12:51:58 -07008399 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008400 return 0;
8401}
8402
8403static int iw_add_tspec(struct net_device *dev,
8404 struct iw_request_info *info,
8405 union iwreq_data *wrqu, char *extra)
8406{
Dustin Brown389e5072018-11-08 17:10:01 +05308407 int errno;
8408 struct osif_vdev_sync *vdev_sync;
8409
8410 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8411 if (errno)
8412 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008413
Dustin Brown389e5072018-11-08 17:10:01 +05308414 errno = __iw_add_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008415
Dustin Brown389e5072018-11-08 17:10:01 +05308416 osif_vdev_sync_op_stop(vdev_sync);
8417
8418 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008419}
8420
8421/**
8422 * iw_del_tspec - Delete TSpec private ioctl handler
8423 * @dev: device upon which the ioctl was received
8424 * @info: ioctl request information
8425 * @wrqu: ioctl request data
8426 * @extra: ioctl extra data
8427 *
8428 * Return: 0 on success, non-zero on error
8429 */
8430static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
8431 union iwreq_data *wrqu, char *extra)
8432{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008433 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008434 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008435 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008436 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008437 uint32_t handle;
8438 int ret;
8439
Dustin Brownfdf17c12018-03-14 12:55:34 -07008440 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308441
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008442 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008443 ret = wlan_hdd_validate_context(hdd_ctx);
8444 if (0 != ret)
8445 return ret;
8446
Jeff Johnson441e1f72017-02-07 08:50:49 -08008447 ret = hdd_check_private_wext_control(hdd_ctx, info);
8448 if (0 != ret)
8449 return ret;
8450
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008451 /* make sure the application is sufficiently priviledged */
8452 /* note that the kernel will do this for "set" ioctls, but since */
8453 /* this ioctl wants to return status to user space it must be */
8454 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008455 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008456 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008457
8458 /* although we are defined to be a "get" ioctl, the params we require */
8459 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8460 /* is no need to copy the params from user space */
8461
8462 /* validate the handle */
8463 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8464 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8465 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008466 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008467 return 0;
8468 }
8469
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008470 *wmm_status = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008471 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008472 return 0;
8473}
8474
8475static int iw_del_tspec(struct net_device *dev,
8476 struct iw_request_info *info,
8477 union iwreq_data *wrqu, char *extra)
8478{
Dustin Brown389e5072018-11-08 17:10:01 +05308479 int errno;
8480 struct osif_vdev_sync *vdev_sync;
8481
8482 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8483 if (errno)
8484 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008485
Dustin Brown389e5072018-11-08 17:10:01 +05308486 errno = __iw_del_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008487
Dustin Brown389e5072018-11-08 17:10:01 +05308488 osif_vdev_sync_op_stop(vdev_sync);
8489
8490 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008491}
8492
8493/**
8494 * iw_get_tspec - Get TSpec private ioctl handler
8495 * @dev: device upon which the ioctl was received
8496 * @info: ioctl request information
8497 * @wrqu: ioctl request data
8498 * @extra: ioctl extra data
8499 *
8500 * Return: 0 on success, non-zero on error
8501 */
8502static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
8503 union iwreq_data *wrqu, char *extra)
8504{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008505 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008506 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008507 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008508 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008509 uint32_t handle;
8510 int ret;
8511
Dustin Brownfdf17c12018-03-14 12:55:34 -07008512 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308513
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008514 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008515 ret = wlan_hdd_validate_context(hdd_ctx);
8516 if (0 != ret)
8517 return ret;
8518
Jeff Johnson441e1f72017-02-07 08:50:49 -08008519 ret = hdd_check_private_wext_control(hdd_ctx, info);
8520 if (0 != ret)
8521 return ret;
8522
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008523 /* although we are defined to be a "get" ioctl, the params we require */
8524 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8525 /* is no need to copy the params from user space */
8526
8527 /* validate the handle */
8528 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8529 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8530 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008531 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008532 return 0;
8533 }
8534
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008535 *wmm_status = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008536 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008537 return 0;
8538}
8539
8540static int iw_get_tspec(struct net_device *dev,
8541 struct iw_request_info *info,
8542 union iwreq_data *wrqu, char *extra)
8543{
Dustin Brown389e5072018-11-08 17:10:01 +05308544 int errno;
8545 struct osif_vdev_sync *vdev_sync;
8546
8547 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8548 if (errno)
8549 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008550
Dustin Brown389e5072018-11-08 17:10:01 +05308551 errno = __iw_get_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008552
Dustin Brown389e5072018-11-08 17:10:01 +05308553 osif_vdev_sync_op_stop(vdev_sync);
8554
8555 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008556}
8557
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008558/**
8559 * iw_set_fties - Set FT IEs private ioctl handler
8560 * @dev: device upon which the ioctl was received
8561 * @info: ioctl request information
8562 * @wrqu: ioctl request data
8563 * @extra: ioctl extra data
8564 *
8565 * Each time the supplicant has the auth_request or reassoc request
8566 * IEs ready they are pushed to the driver. The driver will in turn
8567 * use it to send out the auth req and reassoc req for 11r FT Assoc.
8568 *
8569 * Return: 0 on success, non-zero on error
8570 */
8571static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
8572 union iwreq_data *wrqu, char *extra)
8573{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008574 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008575 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008576 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008577 int ret;
8578
Dustin Brownfdf17c12018-03-14 12:55:34 -07008579 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308580
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008581 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008582 ret = wlan_hdd_validate_context(hdd_ctx);
8583 if (0 != ret)
8584 return ret;
8585
Jeff Johnson441e1f72017-02-07 08:50:49 -08008586 ret = hdd_check_private_wext_control(hdd_ctx, info);
8587 if (0 != ret)
8588 return ret;
8589
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008590 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008591 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008592 return -EINVAL;
8593 }
Jeff Johnsond36fa332019-03-18 13:42:25 -07008594 if (!wrqu->data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008595 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008596 return -EINVAL;
8597 }
8598 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsone7951512019-02-27 10:02:51 -08008599 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008600 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008601 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008602 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008603 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008604 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008605
8606 /* Pass the received FT IEs to SME */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008607 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->vdev_id,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008608 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07008609 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008610 return 0;
8611}
8612
8613static int iw_set_fties(struct net_device *dev,
8614 struct iw_request_info *info,
8615 union iwreq_data *wrqu, char *extra)
8616{
Dustin Brown389e5072018-11-08 17:10:01 +05308617 int errno;
8618 struct osif_vdev_sync *vdev_sync;
8619
8620 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8621 if (errno)
8622 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008623
Dustin Brown389e5072018-11-08 17:10:01 +05308624 errno = __iw_set_fties(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008625
Dustin Brown389e5072018-11-08 17:10:01 +05308626 osif_vdev_sync_op_stop(vdev_sync);
8627
8628 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008629}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008630
Dustin Brown0cbc7572016-12-16 13:54:40 -08008631/**
8632 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
8633 * @dev: device upon which the ioctl was received
8634 * @info: ioctl request information
8635 * @wrqu: ioctl request data
8636 * @extra: ioctl extra data
8637 *
Dustin Brown860566f2017-01-31 15:24:43 -08008638 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
8639 * time being to provide guidance in migrating to standard APIs.
8640 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08008641 * Return: 0 on success, non-zero on error
8642 */
8643static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
8644 struct iw_request_info *info,
8645 union iwreq_data *wrqu,
8646 char *extra)
8647{
Dustin Brown860566f2017-01-31 15:24:43 -08008648 hdd_err("\n"
8649 "setMCBCFilter is obsolete. Use the following instead:\n"
8650 "Configure multicast filtering via the ‘ip’ command.\n"
8651 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
8652 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
8653 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
8654 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
8655 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07008656 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08008657}
8658
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008659/**
8660 * iw_set_host_offload - Set host offload ioctl handler
8661 * @dev: device upon which the ioctl was received
8662 * @info: ioctl request information
8663 * @wrqu: ioctl request data
8664 * @extra: ioctl extra data
8665 *
8666 * Return: 0 on success, non-zero on error
8667 */
8668static int __iw_set_host_offload(struct net_device *dev,
8669 struct iw_request_info *info,
8670 union iwreq_data *wrqu, char *extra)
8671{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008672 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008673 struct host_offload_req *user_request =
8674 (struct host_offload_req *) extra;
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008675 struct sir_host_offload_req offload_request;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008676 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008677 int ret;
8678
Dustin Brownfdf17c12018-03-14 12:55:34 -07008679 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308680
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008681 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008682 ret = wlan_hdd_validate_context(hdd_ctx);
8683 if (0 != ret)
8684 return ret;
8685
Jeff Johnson441e1f72017-02-07 08:50:49 -08008686 ret = hdd_check_private_wext_control(hdd_ctx, info);
8687 if (0 != ret)
8688 return ret;
8689
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008690 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008691 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008692 return -EINVAL;
8693 }
8694
8695 /* Debug display of request components. */
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008696 switch (user_request->offloadType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008697 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008698 hdd_debug("Host offload request: ARP reply");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008699 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008700 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008701 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008702 break;
8703 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008704 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07008705 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008706 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008707 hdd_debug(" ARP offload enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008708 hdd_debug(" IP address: %pI4",
8709 user_request->params.hostIpv4Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008710 }
8711 break;
8712
8713 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008714 hdd_debug("Host offload request: neighbor discovery");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008715 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008716 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008717 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008718 break;
8719 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008720 hdd_debug(" enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008721 hdd_debug(" IP address: %pI6c",
8722 user_request->params.hostIpv6Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008723 }
8724 }
8725
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008726 qdf_mem_zero(&offload_request, sizeof(offload_request));
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008727 offload_request.offloadType = user_request->offloadType;
8728 offload_request.enableOrDisable = user_request->enableOrDisable;
8729 qdf_mem_copy(&offload_request.params, &user_request->params,
8730 sizeof(user_request->params));
8731 qdf_mem_copy(&offload_request.bssid, &user_request->bssId.bytes,
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05308732 QDF_MAC_ADDR_SIZE);
8733
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308734 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008735 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008736 adapter->vdev_id, &offload_request)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008737 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008738 return -EINVAL;
8739 }
Dustin Browne74003f2018-03-14 12:51:58 -07008740 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008741 return 0;
8742}
8743
8744static int iw_set_host_offload(struct net_device *dev,
8745 struct iw_request_info *info,
8746 union iwreq_data *wrqu, char *extra)
8747{
Dustin Brown389e5072018-11-08 17:10:01 +05308748 int errno;
8749 struct osif_vdev_sync *vdev_sync;
8750
8751 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8752 if (errno)
8753 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008754
Dustin Brown389e5072018-11-08 17:10:01 +05308755 errno = __iw_set_host_offload(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008756
Dustin Brown389e5072018-11-08 17:10:01 +05308757 osif_vdev_sync_op_stop(vdev_sync);
8758
8759 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008760}
8761
8762/**
8763 * iw_set_keepalive_params - Set keepalive params ioctl handler
8764 * @dev: device upon which the ioctl was received
8765 * @info: ioctl request information
8766 * @wrqu: ioctl request data
8767 * @extra: ioctl extra data
8768 *
8769 * Return: 0 on success, non-zero on error
8770 */
8771static int __iw_set_keepalive_params(struct net_device *dev,
8772 struct iw_request_info *info,
8773 union iwreq_data *wrqu, char *extra)
8774{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008775 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson562ccad2019-02-06 22:10:24 -08008776 struct keep_alive_req *request = (struct keep_alive_req *)extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008777 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008778 int ret;
8779
Dustin Brownfdf17c12018-03-14 12:55:34 -07008780 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308781
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008782 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008783 ret = wlan_hdd_validate_context(hdd_ctx);
8784 if (0 != ret)
8785 return ret;
8786
Jeff Johnson441e1f72017-02-07 08:50:49 -08008787 ret = hdd_check_private_wext_control(hdd_ctx, info);
8788 if (0 != ret)
8789 return ret;
8790
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008791 if (wrqu->data.length != sizeof(*request)) {
8792 hdd_err("Invalid length %d", wrqu->data.length);
8793 return -EINVAL;
8794 }
8795
Wu Gao93816212018-08-31 16:49:54 +08008796 if (request->timePeriod > cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008797 hdd_err("Value of timePeriod %d exceed Max limit %d",
8798 request->timePeriod,
Wu Gao93816212018-08-31 16:49:54 +08008799 cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008800 return -EINVAL;
8801 }
8802
8803 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008804 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Jeff Johnson562ccad2019-02-06 22:10:24 -08008805 request->timePeriod, sizeof(struct keep_alive_req));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008806
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008807 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008808 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008809 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008810 break;
8811
8812 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008813 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008814
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008815 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008816 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8817 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008818
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008819 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008820 request->destIpv4Addr[0], request->destIpv4Addr[1],
8821 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008822
Srinivas Girigowdacb7b8b82019-04-10 14:27:47 -07008823 hdd_debug("Dest MAC address: "QDF_MAC_ADDR_STR,
Srinivas Girigowda34fbba02019-04-08 12:07:44 -07008824 QDF_MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008825 break;
8826 }
8827
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008828 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008829
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308830 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008831 sme_set_keep_alive(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008832 adapter->vdev_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008833 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008834 return -EINVAL;
8835 }
Dustin Browne74003f2018-03-14 12:51:58 -07008836 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008837 return 0;
8838}
8839
8840static int iw_set_keepalive_params(struct net_device *dev,
8841 struct iw_request_info *info,
8842 union iwreq_data *wrqu,
8843 char *extra)
8844{
Dustin Brown389e5072018-11-08 17:10:01 +05308845 int errno;
8846 struct osif_vdev_sync *vdev_sync;
8847
8848 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8849 if (errno)
8850 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008851
Dustin Brown389e5072018-11-08 17:10:01 +05308852 errno = __iw_set_keepalive_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008853
Dustin Brown389e5072018-11-08 17:10:01 +05308854 osif_vdev_sync_op_stop(vdev_sync);
8855
8856 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008857}
8858
8859#ifdef WLAN_FEATURE_PACKET_FILTERING
8860/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308861 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8862 * @priv_data: Pointer to the priv data from user space
8863 * @request: Pointer to the struct containing the copied data from user space
8864 *
8865 * Return: False on invalid length, true otherwise
8866 */
8867static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8868 uint16_t length)
8869{
8870 int max_params_size, rcvd_params_size;
8871
8872 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8873 sizeof(struct pkt_filter_param_cfg);
8874
8875 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8876 hdd_err("Less than minimum number of arguments needed");
8877 return false;
8878 }
8879
8880 rcvd_params_size = request->num_params *
8881 sizeof(struct pkt_filter_param_cfg);
8882
8883 if (length != sizeof(struct pkt_filter_cfg) -
8884 max_params_size + rcvd_params_size) {
8885 hdd_err("Arguments do not match the number of params provided");
8886 return false;
8887 }
8888
8889 return true;
8890}
8891
8892/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008893 * __iw_set_packet_filter_params() - set packet filter parameters in target
8894 * @dev: Pointer to netdev
8895 * @info: Pointer to iw request info
8896 * @wrqu: Pointer to data
8897 * @extra: Pointer to extra data
8898 *
8899 * Return: 0 on success, non-zero on error
8900 */
8901static int __iw_set_packet_filter_params(struct net_device *dev,
8902 struct iw_request_info *info,
8903 union iwreq_data *wrqu, char *extra)
8904{
8905 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008906 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008907 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008908 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008909 struct pkt_filter_cfg *request = NULL;
8910
Mukul Sharma472382f2015-11-02 20:16:31 +05308911 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008912 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308913 return -EPERM;
8914 }
8915
Dustin Brownfdf17c12018-03-14 12:55:34 -07008916 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308917
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008918 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8919 ret = wlan_hdd_validate_context(hdd_ctx);
8920 if (0 != ret)
8921 return ret;
8922
Jeff Johnson441e1f72017-02-07 08:50:49 -08008923 ret = hdd_check_private_wext_control(hdd_ctx, info);
8924 if (0 != ret)
8925 return ret;
8926
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008927 if (hdd_priv_get_data(&priv_data, wrqu)) {
8928 hdd_err("failed to get priv data");
8929 return -EINVAL;
8930 }
8931
Jeff Johnsond36fa332019-03-18 13:42:25 -07008932 if ((!priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008933 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008934 priv_data.pointer, priv_data.length);
8935 return -EINVAL;
8936 }
8937
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308938 if (adapter->device_mode != QDF_STA_MODE) {
8939 hdd_err("Packet filter not supported for this mode :%d",
8940 adapter->device_mode);
8941 return -ENOTSUPP;
8942 }
8943
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308944 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8945 hdd_err("Packet filter not supported in disconnected state");
8946 return -ENOTSUPP;
8947 }
8948
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008949 /* copy data using copy_from_user */
8950 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
8951 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308952
Jeff Johnsond36fa332019-03-18 13:42:25 -07008953 if (!request) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008954 hdd_err("mem_alloc_copy_from_user_helper fail");
8955 return -ENOMEM;
8956 }
8957
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308958 if (!validate_packet_filter_params_size(request, priv_data.length)) {
8959 hdd_err("Invalid priv data length %d", priv_data.length);
8960 qdf_mem_free(request);
8961 return -EINVAL;
8962 }
8963
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05308964 if (request->filter_action == HDD_RCV_FILTER_SET)
8965 hdd_ctx->user_configured_pkt_filter_rules |=
8966 1 << request->filter_id;
8967 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
8968 hdd_ctx->user_configured_pkt_filter_rules &=
8969 ~(1 << request->filter_id);
8970
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008971 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->vdev_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008972
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07008973 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07008974 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008975 return ret;
8976}
8977
8978/**
8979 * iw_set_packet_filter_params() - set packet filter parameters in target
8980 * @dev: Pointer to netdev
8981 * @info: Pointer to iw request info
8982 * @wrqu: Pointer to data
8983 * @extra: Pointer to extra data
8984 *
8985 * Return: 0 on success, non-zero on error
8986 */
8987static int iw_set_packet_filter_params(struct net_device *dev,
8988 struct iw_request_info *info,
8989 union iwreq_data *wrqu, char *extra)
8990{
Dustin Brown389e5072018-11-08 17:10:01 +05308991 int errno;
8992 struct osif_vdev_sync *vdev_sync;
8993
8994 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8995 if (errno)
8996 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008997
Dustin Brown389e5072018-11-08 17:10:01 +05308998 errno = __iw_set_packet_filter_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008999
Dustin Brown389e5072018-11-08 17:10:01 +05309000 osif_vdev_sync_op_stop(vdev_sync);
9001
9002 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009003}
9004#endif
9005
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009006static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
9007{
9008 return wlan_hdd_get_station_stats(adapter);
9009}
Jeff Johnsonced658b2018-03-08 09:54:01 -08009010
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009011static int __iw_get_statistics(struct net_device *dev,
9012 struct iw_request_info *info,
9013 union iwreq_data *wrqu, char *extra)
9014{
9015 int ret;
9016 char *p;
9017 int tlen;
9018 struct hdd_station_ctx *sta_ctx;
9019 tCsrSummaryStatsInfo *summary_stats;
9020 tCsrGlobalClassAStatsInfo *class_a_stats;
9021 tCsrGlobalClassDStatsInfo *class_d_stats;
9022 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
9023 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9024
9025 hdd_enter_dev(dev);
9026
9027 ret = wlan_hdd_validate_context(hdd_ctx);
9028 if (0 != ret)
9029 return ret;
9030
9031 ret = hdd_check_private_wext_control(hdd_ctx, info);
9032 if (0 != ret)
9033 return ret;
9034
9035 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsone7951512019-02-27 10:02:51 -08009036 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009037 wrqu->data.length = 0;
9038 return 0;
9039 }
9040
9041 hdd_get_wlan_stats(adapter);
9042
9043 summary_stats = &(adapter->hdd_stats.summary_stat);
9044 class_a_stats = &(adapter->hdd_stats.class_a_stat);
9045 class_d_stats = &(adapter->hdd_stats.class_d_stat);
9046
Jeff Johnsonced658b2018-03-08 09:54:01 -08009047 p = extra;
9048 tlen = 0;
9049
9050 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
9051 sizeof(summary_stats->retry_cnt),
9052 &(summary_stats->retry_cnt[0]), tlen);
9053
9054 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
9055 sizeof(summary_stats->multiple_retry_cnt),
9056 &(summary_stats->multiple_retry_cnt[0]), tlen);
9057
9058 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
9059 sizeof(summary_stats->tx_frm_cnt),
9060 &(summary_stats->tx_frm_cnt[0]), tlen);
9061
9062 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
9063 sizeof(summary_stats->rx_frm_cnt),
9064 &(summary_stats->rx_frm_cnt), tlen);
9065
9066 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
9067 sizeof(summary_stats->frm_dup_cnt),
9068 &(summary_stats->frm_dup_cnt), tlen);
9069
9070 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
9071 sizeof(summary_stats->fail_cnt),
9072 &(summary_stats->fail_cnt[0]), tlen);
9073
9074 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
9075 sizeof(summary_stats->rts_fail_cnt),
9076 &(summary_stats->rts_fail_cnt), tlen);
9077
9078 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
9079 sizeof(summary_stats->ack_fail_cnt),
9080 &(summary_stats->ack_fail_cnt), tlen);
9081
9082 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
9083 sizeof(summary_stats->rts_succ_cnt),
9084 &(summary_stats->rts_succ_cnt), tlen);
9085
9086 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
9087 sizeof(summary_stats->rx_discard_cnt),
9088 &(summary_stats->rx_discard_cnt), tlen);
9089
9090 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
9091 sizeof(summary_stats->rx_error_cnt),
9092 &(summary_stats->rx_error_cnt), tlen);
9093
9094 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
9095 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9096 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9097
9098 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
9099 sizeof(class_d_stats->rx_byte_cnt),
9100 &(class_d_stats->rx_byte_cnt), tlen);
9101
9102 FILL_TLV(p, WLAN_STATS_RX_RATE,
9103 sizeof(class_d_stats->rx_rate),
9104 &(class_d_stats->rx_rate), tlen);
9105
9106 /* Transmit rate, in units of 500 kbit/sec */
9107 FILL_TLV(p, WLAN_STATS_TX_RATE,
9108 sizeof(class_a_stats->tx_rate),
9109 &(class_a_stats->tx_rate), tlen);
9110
9111 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
9112 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
9113 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
9114 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
9115 sizeof(class_d_stats->rx_mc_byte_cnt),
9116 &(class_d_stats->rx_mc_byte_cnt), tlen);
9117 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
9118 sizeof(class_d_stats->rx_bc_byte_cnt),
9119 &(class_d_stats->rx_bc_byte_cnt), tlen);
9120 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
9121 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9122 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9123 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
9124 sizeof(class_d_stats->tx_mc_byte_cnt),
9125 &(class_d_stats->tx_mc_byte_cnt), tlen);
9126 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
9127 sizeof(class_d_stats->tx_bc_byte_cnt),
9128 &(class_d_stats->tx_bc_byte_cnt), tlen);
9129
9130 wrqu->data.length = tlen;
9131
Dustin Browne74003f2018-03-14 12:51:58 -07009132 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009133
9134 return 0;
9135}
9136
9137static int iw_get_statistics(struct net_device *dev,
9138 struct iw_request_info *info,
9139 union iwreq_data *wrqu, char *extra)
9140{
Dustin Brown389e5072018-11-08 17:10:01 +05309141 int errno;
9142 struct osif_vdev_sync *vdev_sync;
9143
9144 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9145 if (errno)
9146 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009147
Dustin Brown389e5072018-11-08 17:10:01 +05309148 errno = __iw_get_statistics(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009149
Dustin Brown389e5072018-11-08 17:10:01 +05309150 osif_vdev_sync_op_stop(vdev_sync);
9151
9152 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009153}
9154
9155#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009156/*Max Len for PNO notification*/
9157#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05309158static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
9159 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009160{
Abhishek Singh0481d662017-04-11 18:20:11 +05309161 struct vdev_osif_priv *osif_priv;
9162 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009163 union iwreq_data wrqu;
9164 char buf[MAX_PNO_NOTIFY_LEN + 1];
9165
Abhishek Singh0481d662017-04-11 18:20:11 +05309166 wlan_vdev_obj_lock(vdev);
9167 osif_priv = wlan_vdev_get_ospriv(vdev);
9168 wlan_vdev_obj_unlock(vdev);
9169 if (!osif_priv) {
9170 hdd_err("osif_priv is null");
9171 return;
9172 }
9173
9174 wdev = osif_priv->wdev;
9175 if (!wdev) {
9176 hdd_err("wdev is null");
9177 return;
9178 }
9179
9180 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009181
9182 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05309183 qdf_mem_zero(&wrqu, sizeof(wrqu));
9184 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009185
9186 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05309187 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009188
9189 wrqu.data.pointer = buf;
9190 wrqu.data.length = strlen(buf);
9191
9192 /* send the event */
9193
Abhishek Singh0481d662017-04-11 18:20:11 +05309194 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009195}
9196
9197/**
9198 * __iw_set_pno() - Preferred Network Offload ioctl handler
9199 * @dev: device upon which the ioctl was received
9200 * @info: ioctl request information
9201 * @wrqu: ioctl request data
9202 * @extra: ioctl extra data
9203 *
9204 * This function parses a Preferred Network Offload command
9205 * Input is string based and expected to be of the form:
9206 *
9207 * <enable(1) | disable(0)>
9208 * when enabling:
9209 * <number of networks>
9210 * for each network:
9211 * <ssid_len> <ssid> <authentication> <encryption>
9212 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07009213 * <scan_time (seconds)>
9214 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009215 * <suspend mode>
9216 *
9217 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07009218 * 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 -08009219 *
9220 * this translates into:
9221 * -----------------------------
9222 * enable PNO
9223 * 2 networks
9224 * Network 1:
9225 * test - with authentication type 0 and encryption type 0,
9226 * search on 3 channels: 1 6 and 11,
9227 * SSID bcast type is unknown (directed probe will be sent if
9228 * AP not found) and must meet -40dBm RSSI
9229 * Network 2:
9230 * test2 - with authentication type 4 and encryption type 4,
9231 * search on 6 channels 1, 2, 3, 4, 5 and 6
9232 * bcast type is non-bcast (directed probe will be sent)
9233 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009234 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07009235 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009236 */
9237static int __iw_set_pno(struct net_device *dev,
9238 struct iw_request_info *info,
9239 union iwreq_data *wrqu, char *extra)
9240{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009241 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009242 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05309243 uint8_t value;
9244 struct wlan_objmgr_vdev *vdev;
9245 struct wlan_objmgr_psoc *psoc;
9246 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009247 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309248 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05309249 uint8_t i, j, params;
9250 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309251 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009252
9253 /* request is a large struct, so we make it static to avoid
9254 * stack overflow. This API is only invoked via ioctl, so it
9255 * is serialized by the kernel rtnl_lock and hence does not
9256 * need to be reentrant
9257 */
Abhishek Singh0481d662017-04-11 18:20:11 +05309258 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009259
Dustin Brownfdf17c12018-03-14 12:55:34 -07009260 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009261
9262 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9263 ret = wlan_hdd_validate_context(hdd_ctx);
9264 if (ret)
9265 return ret;
9266
Jeff Johnson441e1f72017-02-07 08:50:49 -08009267 ret = hdd_check_private_wext_control(hdd_ctx, info);
9268 if (0 != ret)
9269 return ret;
9270
Dustin Brown07901ec2018-09-07 11:02:41 -07009271 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->pdev,
9272 dev->dev_addr,
9273 WLAN_LEGACY_MAC_ID);
Abhishek Singh0481d662017-04-11 18:20:11 +05309274 if (!vdev) {
9275 hdd_err("vdev object is NULL");
9276 return -EIO;
9277 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009278
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309279 /* making sure argument string ends with '\0' */
9280 len = (wrqu->data.length + 1);
9281 data = qdf_mem_malloc(len);
9282 if (!data) {
9283 hdd_err("fail to allocate memory %zu", len);
9284 return -EINVAL;
9285 }
9286 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309287 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009288
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05309289 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
9290
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309291 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009292 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309293 ret = -EINVAL;
9294 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009295 }
9296
Abhishek Singh0481d662017-04-11 18:20:11 +05309297 if (!value) {
9298 status = ucfg_scan_pno_stop(vdev);
9299 if (QDF_IS_STATUS_ERROR(status)) {
9300 hdd_err("Failed to disabled PNO");
9301 ret = -EINVAL;
9302 } else {
9303 hdd_debug("PNO scan disabled");
9304 }
9305 goto exit;
9306 }
9307
9308 if (ucfg_scan_get_pno_in_progress(vdev)) {
9309 hdd_debug("pno is already in progress");
9310 ret = -EBUSY;
9311 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009312 }
9313
9314 ptr += offset;
9315
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309316 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009317 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309318 ret = -EINVAL;
9319 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009320 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309321 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009322
Abhishek Singh0481d662017-04-11 18:20:11 +05309323 hdd_debug("PNO enable networks count %d offset %d",
9324 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009325
Abhishek Singh0481d662017-04-11 18:20:11 +05309326 if ((0 == req.networks_cnt) ||
9327 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009328 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05309329 req.networks_cnt);
9330 ret = -EINVAL;
9331 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009332 }
9333
9334 ptr += offset;
9335
Abhishek Singh0481d662017-04-11 18:20:11 +05309336 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009337
Abhishek Singh0481d662017-04-11 18:20:11 +05309338 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009339
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309340 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309341 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009342 &offset);
9343
9344 if (1 != params) {
9345 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309346 ret = -EINVAL;
9347 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009348 }
9349
Abhishek Singh0481d662017-04-11 18:20:11 +05309350 if ((0 == req.networks_list[i].ssid.length) ||
9351 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009352 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309353 req.networks_list[i].ssid.length, i);
9354 ret = -EINVAL;
9355 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009356 }
9357
9358 /* Advance to SSID */
9359 ptr += offset;
9360
Abhishek Singh0481d662017-04-11 18:20:11 +05309361 memcpy(req.networks_list[i].ssid.ssid, ptr,
9362 req.networks_list[i].ssid.length);
9363 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009364
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309365 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309366 &(req.networks_list[i].authentication),
9367 &(req.networks_list[i].encryption),
9368 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009369 &offset);
9370
9371 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009372 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309373 ret = -EINVAL;
9374 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009375 }
9376
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009377 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309378 req.networks_list[i].ssid.length,
9379 req.networks_list[i].ssid.length,
9380 req.networks_list[i].ssid.ssid,
9381 req.networks_list[i].authentication,
9382 req.networks_list[i].encryption,
9383 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009384
9385 /* Advance to channel list */
9386 ptr += offset;
9387
Abhishek Singh0481d662017-04-11 18:20:11 +05309388 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
9389 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009390 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05309391 ret = -EINVAL;
9392 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009393 }
9394
Abhishek Singh0481d662017-04-11 18:20:11 +05309395 if (0 != req.networks_list[i].channel_cnt) {
9396 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009397 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309398 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05309399 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009400 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009401 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309402 ret = -EINVAL;
9403 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009404 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309405 if (!IS_CHANNEL_VALID(value)) {
9406 hdd_err("invalid channel: %hhu", value);
9407 ret = -EINVAL;
9408 goto exit;
9409 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309410 req.networks_list[i].channels[j] =
9411 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009412 /* Advance to next channel number */
9413 ptr += offset;
9414 }
9415 }
9416
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309417 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309418 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009419 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009420 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009421 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309422 ret = -EINVAL;
9423 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009424 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309425 if (req.networks_list[i].bc_new_type > 2) {
9426 hdd_err("invalid bcast nw type: %u",
9427 req.networks_list[i].bc_new_type);
9428 ret = -EINVAL;
9429 goto exit;
9430 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009431
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009432 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309433 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009434
9435 /* Advance to rssi Threshold */
9436 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309437 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309438 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009439 &offset)) {
9440 hdd_err("PNO rssi threshold input is not valid %s",
9441 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309442 ret = -EINVAL;
9443 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009444 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009445 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309446 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009447 /* Advance to next network */
9448 ptr += offset;
9449 } /* For ucNetworkCount */
9450
Abhishek Singh0481d662017-04-11 18:20:11 +05309451 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309452 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05309453 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07009454 ptr += offset;
9455 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309456 if (req.fast_scan_period == 0) {
9457 hdd_err("invalid fast scan period %u",
9458 req.fast_scan_period);
9459 ret = -EINVAL;
9460 goto exit;
9461 }
Dustin Brown43e87292016-10-10 10:38:25 -07009462
Abhishek Singh0481d662017-04-11 18:20:11 +05309463 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309464 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07009465 &offset) > 0)
9466 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05309467 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07009468
Dustin Brown07901ec2018-09-07 11:02:41 -07009469 wlan_pdev_obj_lock(hdd_ctx->pdev);
9470 psoc = wlan_pdev_get_psoc(hdd_ctx->pdev);
9471 wlan_pdev_obj_unlock(hdd_ctx->pdev);
Abhishek Singh0481d662017-04-11 18:20:11 +05309472 ucfg_scan_register_pno_cb(psoc,
9473 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009474
Abhishek Singh0481d662017-04-11 18:20:11 +05309475 ucfg_scan_get_pno_def_params(vdev, &req);
9476 status = ucfg_scan_pno_start(vdev, &req);
9477 if (QDF_IS_STATUS_ERROR(status)) {
9478 hdd_err("Failed to enable PNO");
9479 ret = -EINVAL;
9480 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009481
Abhishek Singh0481d662017-04-11 18:20:11 +05309482exit:
9483 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009484
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309485 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05309486 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009487}
9488
9489static int iw_set_pno(struct net_device *dev,
9490 struct iw_request_info *info,
9491 union iwreq_data *wrqu, char *extra)
9492{
Dustin Brown389e5072018-11-08 17:10:01 +05309493 int errno;
9494 struct osif_vdev_sync *vdev_sync;
9495
9496 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9497 if (errno)
9498 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009499
Dustin Brown389e5072018-11-08 17:10:01 +05309500 errno = __iw_set_pno(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009501
Dustin Brown389e5072018-11-08 17:10:01 +05309502 osif_vdev_sync_op_stop(vdev_sync);
9503
9504 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009505}
9506#endif /* FEATURE_WLAN_SCAN_PNO */
9507
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009508static int __iw_set_band_config(struct net_device *dev,
9509 struct iw_request_info *info,
9510 union iwreq_data *wrqu, char *extra)
9511{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009512 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009513 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08009514 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009515 int *value = (int *)extra;
9516
Dustin Brownfdf17c12018-03-14 12:55:34 -07009517 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009518
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309519 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009520 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309521 return -EPERM;
9522 }
9523
Jeff Johnson441e1f72017-02-07 08:50:49 -08009524 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9525 ret = hdd_check_private_wext_control(hdd_ctx, info);
9526 if (0 != ret)
9527 return ret;
9528
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07009529 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009530}
9531
9532static int iw_set_band_config(struct net_device *dev,
9533 struct iw_request_info *info,
9534 union iwreq_data *wrqu, char *extra)
9535{
Dustin Brown389e5072018-11-08 17:10:01 +05309536 int errno;
9537 struct osif_vdev_sync *vdev_sync;
9538
9539 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9540 if (errno)
9541 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009542
Dustin Brown389e5072018-11-08 17:10:01 +05309543 errno = __iw_set_band_config(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009544
Dustin Brown389e5072018-11-08 17:10:01 +05309545 osif_vdev_sync_op_stop(vdev_sync);
9546
9547 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009548}
9549
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009550static int printk_adapter(void *priv, const char *fmt, ...)
9551{
9552 int ret;
9553 va_list args;
9554
9555 va_start(args, fmt);
9556 ret = vprintk(fmt, args);
9557 ret += printk("\n");
9558 va_end(args);
9559
9560 return ret;
9561}
9562
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009563static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
9564{
9565 qdf_abstract_print *print = &printk_adapter;
9566
9567 switch (log_id) {
9568 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009569 cds_print_htc_credit_history(count, print, NULL);
9570 break;
9571 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009572 wma_print_wmi_cmd_log(count, print, NULL);
9573 break;
9574 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009575 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
9576 break;
9577 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009578 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
9579 break;
9580 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009581 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
9582 break;
9583 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009584 wma_print_wmi_event_log(count, print, NULL);
9585 break;
9586 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009587 wma_print_wmi_rx_event_log(count, print, NULL);
9588 break;
9589 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009590 wma_print_wmi_mgmt_event_log(count, print, NULL);
9591 break;
9592 default:
9593 print(NULL, "Invalid Log Id %d", log_id);
9594 break;
9595 }
9596}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009597
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009598#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
9599int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
9600{
9601 struct hdd_context *hdd_ctx;
9602 int ret;
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309603 bool crash_inject;
9604 QDF_STATUS status;
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009605
9606 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
9607 v1, v2);
9608 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
9609 v1, v2);
9610 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309611
Vignesh Viswanathana1f3a1a2018-10-04 13:10:46 +05309612 status = ucfg_mlme_get_crash_inject(hdd_ctx->psoc, &crash_inject);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309613 if (QDF_IS_STATUS_ERROR(status)) {
9614 hdd_err("Failed to get crash inject ini config");
9615 return 0;
9616 }
9617
9618 if (!crash_inject) {
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009619 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
9620 return 0;
9621 }
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309622
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009623 if (v1 == 3) {
9624 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
9625 return 0;
9626 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009627 ret = wma_cli_set2_command(adapter->vdev_id,
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009628 GEN_PARAM_CRASH_INJECT,
9629 v1, v2, GEN_CMD);
9630 return ret;
9631}
9632#endif
9633
Nirav Shahd21a2e32018-04-20 16:34:43 +05309634#ifdef CONFIG_DP_TRACE
9635void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
9636{
9637 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
9638 cmd_type, count);
9639 if (cmd_type == DUMP_DP_TRACE)
9640 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
9641 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
9642 qdf_dp_trace_enable_live_mode();
9643 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
9644 qdf_dp_trace_clear_buffer();
9645 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
9646 qdf_dp_trace_disable_live_mode();
9647}
9648#endif
9649
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009650static int __iw_set_two_ints_getnone(struct net_device *dev,
9651 struct iw_request_info *info,
9652 union iwreq_data *wrqu, char *extra)
9653{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009654 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009655 int *value = (int *)extra;
9656 int sub_cmd = value[0];
9657 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08009658 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009659 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08009660 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009661
Dustin Brownfdf17c12018-03-14 12:55:34 -07009662 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009663
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009664 ret = wlan_hdd_validate_context(hdd_ctx);
9665 if (0 != ret)
9666 return ret;
9667
Jeff Johnson441e1f72017-02-07 08:50:49 -08009668 ret = hdd_check_private_wext_control(hdd_ctx, info);
9669 if (0 != ret)
9670 return ret;
9671
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009672 switch (sub_cmd) {
9673 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009674 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009675 ret = wma_cli_set_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009676 WMI_STA_SMPS_PARAM_CMDID,
9677 value[1] << WMA_SMPS_PARAM_VALUE_S
9678 | value[2],
9679 VDEV_CMD);
9680 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009681 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009682 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009683 break;
Govind Singha471e5e2015-10-12 17:11:14 +05309684 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07009685 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309686 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009687 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309688 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
9689 value[1], value[2], DBG_CMD);
9690 break;
9691 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07009692 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309693 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009694 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309695 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
9696 value[1], value[2], DBG_CMD);
9697 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009698 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
9699 hdd_debug("Ioctl to set dual fw mode config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08009700 status =
9701 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
9702 &dual_mac_feature);
9703 if (status != QDF_STATUS_SUCCESS)
9704 hdd_err("can't get dual mac feature val, use def");
9705 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009706 hdd_err("Dual mac feature is disabled from INI");
9707 return -EPERM;
9708 }
9709 hdd_debug("%d %d", value[1], value[2]);
Dustin Brown05d81302018-09-11 16:49:22 -07009710 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009711 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009712 break;
9713 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05309714 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009715 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009716 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009717 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009718 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07009719 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08009720 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
9721 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009722 break;
9723 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07009724 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009725 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009726 case WE_LOG_BUFFER: {
9727 int log_id = value[1];
9728 uint32_t count = value[2] < 0 ? 0 : value[2];
9729
9730 hdd_ioctl_log_buffer(log_id, count);
9731
9732 break;
9733 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07009734 case WE_SET_BA_AGEING_TIMEOUT:
9735 {
9736 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
9737
9738 if (!soc) {
9739 hdd_err("Invalid handles");
9740 break;
9741 }
9742 cdp_set_ba_timeout(soc, value[1], value[2]);
9743 break;
9744 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009745 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07009746 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009747 break;
9748 }
9749
9750 return ret;
9751}
9752
9753static int iw_set_two_ints_getnone(struct net_device *dev,
9754 struct iw_request_info *info,
9755 union iwreq_data *wrqu, char *extra)
9756{
Dustin Brown389e5072018-11-08 17:10:01 +05309757 int errno;
9758 struct osif_vdev_sync *vdev_sync;
9759
9760 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9761 if (errno)
9762 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009763
Dustin Brown389e5072018-11-08 17:10:01 +05309764 errno = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009765
Dustin Brown389e5072018-11-08 17:10:01 +05309766 osif_vdev_sync_op_stop(vdev_sync);
9767
9768 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009769}
9770
9771/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009772
9773static const iw_handler we_private[] = {
9774
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009775 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9776 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9777 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009778 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9779 iw_set_three_ints_getnone,
9780 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009781 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009782 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9783 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009784 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9785 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309786#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009787 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309788#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009789 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9790 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9791 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009792 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009793 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9794 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9795 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9796 iw_set_keepalive_params,
9797#ifdef WLAN_FEATURE_PACKET_FILTERING
9798 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9799 iw_set_packet_filter_params,
9800#endif
9801#ifdef FEATURE_WLAN_SCAN_PNO
9802 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9803#endif
9804 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009805 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9806 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009807 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08009808#ifdef FEATURE_WLM_STATS
9809 [WLAN_GET_WLM_STATS - SIOCIWFIRSTPRIV] = iw_get_wlm_stats,
9810#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009811 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9812 iw_set_two_ints_getnone,
9813 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9814 iw_set_dot11p_channel_sched,
9815};
9816
9817/*Maximum command length can be only 15 */
9818static const struct iw_priv_args we_private_args[] = {
9819
9820 /* handlers for main ioctl */
9821 {WLAN_PRIV_SET_INT_GET_NONE,
9822 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9823 0,
9824 ""},
9825
9826 /* handlers for sub-ioctl */
9827 {WE_SET_11D_STATE,
9828 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9829 0,
9830 "set11Dstate"},
9831
9832 {WE_WOWL,
9833 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9834 0,
9835 "wowl"},
9836
9837 {WE_SET_POWER,
9838 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9839 0,
9840 "setPower"},
9841
9842 {WE_SET_MAX_ASSOC,
9843 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9844 0,
9845 "setMaxAssoc"},
9846
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009847 {WE_SET_SCAN_DISABLE,
9848 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9849 0,
9850 "scan_disable"},
9851
9852 {WE_SET_DATA_INACTIVITY_TO,
9853 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9854 0,
9855 "inactivityTO"},
9856
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05309857 {WE_SET_WOW_DATA_INACTIVITY_TO,
9858 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9859 0,
9860 "wow_ito"},
9861
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009862 {WE_SET_MAX_TX_POWER,
9863 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9864 0,
9865 "setMaxTxPower"},
9866
9867 {WE_SET_TX_POWER,
9868 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9869 0,
9870 "setTxPower"},
9871
9872 {WE_SET_MC_RATE,
9873 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9874 0,
9875 "setMcRate"},
9876
9877 {WE_SET_MAX_TX_POWER_2_4,
9878 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9879 0,
9880 "setTxMaxPower2G"},
9881
9882 {WE_SET_MAX_TX_POWER_5_0,
9883 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9884 0,
9885 "setTxMaxPower5G"},
9886
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309887#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009888 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05309889 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009890 0,
9891 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309892#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009893
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009894 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
9895 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -08009896 * will support both
9897 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009898 {WE_SET_MAX_TX_POWER,
9899 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9900 0,
9901 "setTxMaxPower"},
9902
Jeff Johnson0187c622019-01-04 06:39:44 -08009903#ifdef HASTINGS_BT_WAR
9904 {WE_SET_HASTINGS_BT_WAR,
9905 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9906 0,
9907 "hastings_bt_war"},
9908#endif
9909
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009910 {WE_SET_TM_LEVEL,
9911 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9912 0,
9913 "setTmLevel"},
9914
9915 {WE_SET_PHYMODE,
9916 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9917 0,
9918 "setphymode"},
9919
9920 {WE_SET_NSS,
9921 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9922 0,
9923 "nss"},
9924
9925 {WE_SET_LDPC,
9926 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9927 0,
9928 "ldpc"},
9929
9930 {WE_SET_TX_STBC,
9931 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9932 0,
9933 "tx_stbc"},
9934
9935 {WE_SET_RX_STBC,
9936 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9937 0,
9938 "rx_stbc"},
9939
9940 {WE_SET_SHORT_GI,
9941 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9942 0,
9943 "shortgi"},
9944
9945 {WE_SET_RTSCTS,
9946 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9947 0,
9948 "enablertscts"},
9949
9950 {WE_SET_CHWIDTH,
9951 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9952 0,
9953 "chwidth"},
9954
9955 {WE_SET_ANI_EN_DIS,
9956 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9957 0,
9958 "anienable"},
9959
9960 {WE_SET_ANI_POLL_PERIOD,
9961 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9962 0,
9963 "aniplen"},
9964
9965 {WE_SET_ANI_LISTEN_PERIOD,
9966 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9967 0,
9968 "anilislen"},
9969
9970 {WE_SET_ANI_OFDM_LEVEL,
9971 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9972 0,
9973 "aniofdmlvl"},
9974
9975 {WE_SET_ANI_CCK_LEVEL,
9976 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9977 0,
9978 "aniccklvl"},
9979
9980 {WE_SET_DYNAMIC_BW,
9981 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9982 0,
9983 "cwmenable"},
9984
9985 {WE_SET_CTS_CBW,
9986 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9987 0,
9988 "cts_cbw" },
9989
9990 {WE_SET_GTX_HT_MCS,
9991 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9992 0,
9993 "gtxHTMcs"},
9994
9995 {WE_SET_GTX_VHT_MCS,
9996 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9997 0,
9998 "gtxVHTMcs"},
9999
10000 {WE_SET_GTX_USRCFG,
10001 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10002 0,
10003 "gtxUsrCfg"},
10004
10005 {WE_SET_GTX_THRE,
10006 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10007 0,
10008 "gtxThre"},
10009
10010 {WE_SET_GTX_MARGIN,
10011 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10012 0,
10013 "gtxMargin"},
10014
10015 {WE_SET_GTX_STEP,
10016 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10017 0,
10018 "gtxStep"},
10019
10020 {WE_SET_GTX_MINTPC,
10021 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10022 0,
10023 "gtxMinTpc"},
10024
10025 {WE_SET_GTX_BWMASK,
10026 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10027 0,
10028 "gtxBWMask"},
10029
10030 {WE_SET_TX_CHAINMASK,
10031 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10032 0,
10033 "txchainmask"},
10034
10035 {WE_SET_RX_CHAINMASK,
10036 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10037 0,
10038 "rxchainmask"},
10039
10040 {WE_SET_11N_RATE,
10041 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10042 0,
10043 "set11NRates"},
10044
10045 {WE_SET_VHT_RATE,
10046 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10047 0,
10048 "set11ACRates"},
10049
10050 {WE_SET_AMPDU,
10051 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10052 0,
10053 "ampdu"},
10054
10055 {WE_SET_AMSDU,
10056 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10057 0,
10058 "amsdu"},
10059
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010060 {WE_SET_TXPOW_2G,
10061 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10062 0,
10063 "txpow2g"},
10064
10065 {WE_SET_TXPOW_5G,
10066 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10067 0,
10068 "txpow5g"},
10069
Wen Gong99768902018-04-25 12:07:49 +080010070#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010071 /* Sub-cmds DBGLOG specific commands */
10072 {WE_DBGLOG_LOG_LEVEL,
10073 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10074 0,
10075 "dl_loglevel"},
10076
10077 {WE_DBGLOG_VAP_ENABLE,
10078 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10079 0,
10080 "dl_vapon"},
10081
10082 {WE_DBGLOG_VAP_DISABLE,
10083 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10084 0,
10085 "dl_vapoff"},
10086
10087 {WE_DBGLOG_MODULE_ENABLE,
10088 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10089 0,
10090 "dl_modon"},
10091
10092 {WE_DBGLOG_MODULE_DISABLE,
10093 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10094 0,
10095 "dl_modoff"},
10096
10097 {WE_DBGLOG_MOD_LOG_LEVEL,
10098 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10099 0,
10100 "dl_mod_loglevel"},
10101
10102 {WE_DBGLOG_TYPE,
10103 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10104 0,
10105 "dl_type"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010106
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010107 {WE_DBGLOG_REPORT_ENABLE,
10108 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10109 0,
10110 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +080010111#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010112
10113 {WE_SET_TXRX_FWSTATS,
10114 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10115 0,
10116 "txrx_fw_stats"},
10117
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010118 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +080010119 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010120 0,
10121 "txrx_stats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010122#ifdef FW_THERMAL_THROTTLE_SUPPORT
10123 {WE_SET_THERMAL_THROTTLE_CFG,
10124 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10125 0,
10126 "set_thermal_cfg"},
10127#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Krishna Reddya50d09f2019-02-04 14:55:06 +053010128 {WE_SET_BTCOEX_MODE,
10129 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10130 0, "set_btc_mode" },
10131 {WE_SET_BTCOEX_RSSI_THRESHOLD,
10132 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10133 0, "set_btc_rssi" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010134 {WE_TXRX_FWSTATS_RESET,
10135 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10136 0,
10137 "txrx_fw_st_rst"},
10138
10139 {WE_PPS_PAID_MATCH,
10140 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10141 0, "paid_match"},
10142
10143 {WE_PPS_GID_MATCH,
10144 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10145 0, "gid_match"},
10146
10147 {WE_PPS_EARLY_TIM_CLEAR,
10148 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10149 0, "tim_clear"},
10150
10151 {WE_PPS_EARLY_DTIM_CLEAR,
10152 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10153 0, "dtim_clear"},
10154
10155 {WE_PPS_EOF_PAD_DELIM,
10156 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10157 0, "eof_delim"},
10158
10159 {WE_PPS_MACADDR_MISMATCH,
10160 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10161 0, "mac_match"},
10162
10163 {WE_PPS_DELIM_CRC_FAIL,
10164 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10165 0, "delim_fail"},
10166
10167 {WE_PPS_GID_NSTS_ZERO,
10168 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10169 0, "nsts_zero"},
10170
10171 {WE_PPS_RSSI_CHECK,
10172 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10173 0, "rssi_chk"},
10174
10175 {WE_PPS_5G_EBT,
10176 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10177 0, "5g_ebt"},
10178
10179 {WE_SET_HTSMPS,
10180 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10181 0, "htsmps"},
10182
10183 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
10184 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10185 0, "set_qpspollcnt"},
10186
10187 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
10188 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10189 0, "set_qtxwake"},
10190
10191 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10192 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10193 0, "set_qwakeintv"},
10194
10195 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10196 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10197 0, "set_qnodatapoll"},
10198
10199 /* handlers for MCC time quota and latency sub ioctls */
10200 {WE_MCC_CONFIG_LATENCY,
10201 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10202 0, "setMccLatency"},
10203
10204 {WE_MCC_CONFIG_QUOTA,
10205 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10206 0, "setMccQuota"},
10207
10208 {WE_SET_DEBUG_LOG,
10209 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10210 0, "setDbgLvl"},
10211
10212 /* handlers for early_rx power save */
10213 {WE_SET_EARLY_RX_ADJUST_ENABLE,
10214 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10215 0, "erx_enable"},
10216
10217 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
10218 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10219 0, "erx_bmiss_val"},
10220
10221 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
10222 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10223 0, "erx_bmiss_smpl"},
10224
10225 {WE_SET_EARLY_RX_SLOP_STEP,
10226 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10227 0, "erx_slop_step"},
10228
10229 {WE_SET_EARLY_RX_INIT_SLOP,
10230 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10231 0, "erx_init_slop"},
10232
10233 {WE_SET_EARLY_RX_ADJUST_PAUSE,
10234 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10235 0, "erx_adj_pause"},
10236
10237 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
10238 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10239 0, "erx_dri_sample"},
10240
10241 {WE_DUMP_STATS,
10242 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10243 0, "dumpStats"},
10244
10245 {WE_CLEAR_STATS,
10246 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10247 0, "clearStats"},
10248
Govind Singha471e5e2015-10-12 17:11:14 +053010249 {WE_START_FW_PROFILE,
10250 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10251 0, "startProfile"},
10252
Abhishek Singh1bdb1572015-10-16 16:24:19 +053010253 {WE_SET_CHANNEL,
10254 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10255 0, "setChanChange" },
10256
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +053010257 {WE_SET_CONC_SYSTEM_PREF,
10258 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10259 0, "setConcSysPref" },
10260
Jeff Johnson011c4502017-10-05 15:25:56 -070010261 {WE_SET_PDEV_RESET,
10262 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10263 0, "pdev_reset" },
10264
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010265 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -080010266 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10267 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010268
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010269 {WLAN_PRIV_SET_NONE_GET_INT,
10270 0,
10271 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10272 ""},
10273
10274 /* handlers for sub-ioctl */
10275 {WE_GET_11D_STATE,
10276 0,
10277 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10278 "get11Dstate"},
10279
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010280 {WE_GET_WLAN_DBG,
10281 0,
10282 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10283 "getwlandbg"},
10284
10285 {WE_GET_MAX_ASSOC,
10286 0,
10287 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10288 "getMaxAssoc"},
10289
10290 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010291 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10292 "getAutoChannel"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010293
10294 {WE_GET_CONCURRENCY_MODE,
10295 0,
10296 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10297 "getconcurrency"},
10298
10299 {WE_GET_NSS,
10300 0,
10301 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10302 "get_nss"},
10303
10304 {WE_GET_LDPC,
10305 0,
10306 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10307 "get_ldpc"},
10308
10309 {WE_GET_TX_STBC,
10310 0,
10311 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10312 "get_tx_stbc"},
10313
10314 {WE_GET_RX_STBC,
10315 0,
10316 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10317 "get_rx_stbc"},
10318
10319 {WE_GET_SHORT_GI,
10320 0,
10321 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10322 "get_shortgi"},
10323
10324 {WE_GET_RTSCTS,
10325 0,
10326 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10327 "get_rtscts"},
10328
10329 {WE_GET_CHWIDTH,
10330 0,
10331 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10332 "get_chwidth"},
10333
10334 {WE_GET_ANI_EN_DIS,
10335 0,
10336 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10337 "get_anienable"},
10338
10339 {WE_GET_ANI_POLL_PERIOD,
10340 0,
10341 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10342 "get_aniplen"},
10343
10344 {WE_GET_ANI_LISTEN_PERIOD,
10345 0,
10346 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10347 "get_anilislen"},
10348
10349 {WE_GET_ANI_OFDM_LEVEL,
10350 0,
10351 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10352 "get_aniofdmlvl"},
10353
10354 {WE_GET_ANI_CCK_LEVEL,
10355 0,
10356 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10357 "get_aniccklvl"},
10358
10359 {WE_GET_DYNAMIC_BW,
10360 0,
10361 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10362 "get_cwmenable"},
10363
10364 {WE_GET_GTX_HT_MCS,
10365 0,
10366 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10367 "get_gtxHTMcs"},
10368
10369 {WE_GET_GTX_VHT_MCS,
10370 0,
10371 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10372 "get_gtxVHTMcs"},
10373
10374 {WE_GET_GTX_USRCFG,
10375 0,
10376 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10377 "get_gtxUsrCfg"},
10378
10379 {WE_GET_GTX_THRE,
10380 0,
10381 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10382 "get_gtxThre"},
10383
10384 {WE_GET_GTX_MARGIN,
10385 0,
10386 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10387 "get_gtxMargin"},
10388
10389 {WE_GET_GTX_STEP,
10390 0,
10391 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10392 "get_gtxStep"},
10393
10394 {WE_GET_GTX_MINTPC,
10395 0,
10396 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10397 "get_gtxMinTpc"},
10398
10399 {WE_GET_GTX_BWMASK,
10400 0,
10401 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10402 "get_gtxBWMask"},
10403
10404 {WE_GET_TX_CHAINMASK,
10405 0,
10406 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10407 "get_txchainmask"},
10408
10409 {WE_GET_RX_CHAINMASK,
10410 0,
10411 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10412 "get_rxchainmask"},
10413
10414 {WE_GET_11N_RATE,
10415 0,
10416 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10417 "get_11nrate"},
10418
10419 {WE_GET_AMPDU,
10420 0,
10421 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10422 "get_ampdu"},
10423
10424 {WE_GET_AMSDU,
10425 0,
10426 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10427 "get_amsdu"},
10428
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010429 {WE_GET_TXPOW_2G,
10430 0,
10431 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10432 "get_txpow2g"},
10433
10434 {WE_GET_TXPOW_5G,
10435 0,
10436 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10437 "get_txpow5g"},
10438
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010439 {WE_GET_PPS_PAID_MATCH,
10440 0,
10441 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10442 "get_paid_match"},
10443
10444 {WE_GET_PPS_GID_MATCH,
10445 0,
10446 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10447 "get_gid_match"},
10448
10449 {WE_GET_PPS_EARLY_TIM_CLEAR,
10450 0,
10451 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10452 "get_tim_clear"},
10453
10454 {WE_GET_PPS_EARLY_DTIM_CLEAR,
10455 0,
10456 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10457 "get_dtim_clear"},
10458
10459 {WE_GET_PPS_EOF_PAD_DELIM,
10460 0,
10461 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10462 "get_eof_delim"},
10463
10464 {WE_GET_PPS_MACADDR_MISMATCH,
10465 0,
10466 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10467 "get_mac_match"},
10468
10469 {WE_GET_PPS_DELIM_CRC_FAIL,
10470 0,
10471 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10472 "get_delim_fail"},
10473
10474 {WE_GET_PPS_GID_NSTS_ZERO,
10475 0,
10476 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10477 "get_nsts_zero"},
10478
10479 {WE_GET_PPS_RSSI_CHECK,
10480 0,
10481 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10482 "get_rssi_chk"},
10483
10484 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
10485 0,
10486 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10487 "get_qpspollcnt"},
10488
10489 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
10490 0,
10491 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10492 "get_qtxwake"},
10493
10494 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10495 0,
10496 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10497 "get_qwakeintv"},
10498
10499 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10500 0,
10501 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10502 "get_qnodatapoll"},
10503
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010504 {WE_CAP_TSF,
10505 0,
10506 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10507 "cap_tsf"},
10508
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010509 {WE_GET_TEMPERATURE,
10510 0,
10511 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10512 "get_temp"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010513
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010514 {WE_GET_DCM,
10515 0,
10516 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10517 "get_dcm"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010518
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010519 {WE_GET_RANGE_EXT,
10520 0,
10521 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10522 "get_range_ext"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010523
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010524 /* handlers for main ioctl */
10525 {WLAN_PRIV_SET_CHAR_GET_NONE,
10526 IW_PRIV_TYPE_CHAR | 512,
10527 0,
10528 ""},
10529
10530 /* handlers for sub-ioctl */
10531 {WE_WOWL_ADD_PTRN,
10532 IW_PRIV_TYPE_CHAR | 512,
10533 0,
10534 "wowlAddPtrn"},
10535
10536 {WE_WOWL_DEL_PTRN,
10537 IW_PRIV_TYPE_CHAR | 512,
10538 0,
10539 "wowlDelPtrn"},
10540
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010541 /* handlers for sub-ioctl */
10542 {WE_NEIGHBOR_REPORT_REQUEST,
10543 IW_PRIV_TYPE_CHAR | 512,
10544 0,
10545 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080010546
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010547 {WE_SET_AP_WPS_IE,
10548 IW_PRIV_TYPE_CHAR | 512,
10549 0,
10550 "set_ap_wps_ie"},
10551
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070010552#ifdef WLAN_UNIT_TEST
10553 {WE_UNIT_TEST,
10554 IW_PRIV_TYPE_CHAR | 512,
10555 0,
10556 "unit_test"},
10557#endif
10558
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010559 /* handlers for main ioctl */
10560 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
10561 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10562 0,
10563 ""},
10564
10565 /* handlers for sub-ioctl */
10566 {WE_SET_WLAN_DBG,
10567 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10568 0,
10569 "setwlandbg"},
10570
Nirav Shahd21a2e32018-04-20 16:34:43 +053010571#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010572 /* handlers for sub-ioctl */
10573 {WE_SET_DP_TRACE,
10574 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10575 0,
10576 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010577#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010578
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053010579 {WE_SET_FW_TEST,
10580 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10581 0, "fw_test"},
10582
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010583 /* handlers for main ioctl */
10584 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
10585 0,
10586 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010587 ""},
10588
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010589 {WE_GET_TSF,
10590 0,
10591 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010592 "get_tsf"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010593
10594 {WE_SET_DUAL_MAC_SCAN_CONFIG,
10595 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10596 0,
10597 "set_scan_cfg"},
10598
10599 /* handlers for main ioctl */
10600 {WLAN_PRIV_GET_CHAR_SET_NONE,
10601 0,
10602 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10603 ""},
10604
10605 /* handlers for sub-ioctl */
10606 {WE_WLAN_VERSION,
10607 0,
10608 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10609 "version"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010610
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010611 {WE_GET_STATS,
10612 0,
10613 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10614 "getStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010615
Dustin Brownd9322482017-01-09 12:46:03 -080010616 {WE_GET_SUSPEND_RESUME_STATS,
10617 0,
10618 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10619 "getSuspendStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010620
Govind Singha471e5e2015-10-12 17:11:14 +053010621 {WE_LIST_FW_PROFILE,
10622 0,
10623 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10624 "listProfile"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010625
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010626 {WE_GET_STATES,
10627 0,
10628 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10629 "getHostStates"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010630
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010631 {WE_GET_CFG,
10632 0,
10633 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10634 "getConfig"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010635
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010636 {WE_GET_RSSI,
10637 0,
10638 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10639 "getRSSI"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010640
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010641 {WE_GET_WMM_STATUS,
10642 0,
10643 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10644 "getWmmStatus"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010645
10646 {WE_GET_CHANNEL_LIST,
10647 0,
10648 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10649 "getChannelList"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010650#ifdef FEATURE_WLAN_TDLS
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010651 {WE_GET_TDLS_PEERS,
10652 0,
10653 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10654 "getTdlsPeers"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010655#endif
10656#ifdef WLAN_FEATURE_11W
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010657 {WE_GET_11W_INFO,
10658 0,
10659 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10660 "getPMFInfo"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010661#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010662 {WE_GET_STA_CXN_INFO,
10663 0,
10664 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10665 "get_cxn_info" },
Krunal Soni5e483782018-10-25 15:42:44 -070010666
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010667 {WE_GET_IBSS_STA_INFO,
10668 0,
10669 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10670 "getIbssSTAs"},
10671
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010672 {WE_GET_PHYMODE,
10673 0,
10674 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10675 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010676#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010677 {WE_GET_OEM_DATA_CAP,
10678 0,
10679 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10680 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010681#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010682 {WE_GET_SNR,
10683 0,
10684 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10685 "getSNR"},
10686
Krunal Soni6c3859f2018-06-01 19:57:40 -070010687 {WE_GET_BA_AGEING_TIMEOUT,
10688 0,
10689 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10690 "get_ba_timeout"},
10691
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010692 /* handlers for main ioctl */
10693 {WLAN_PRIV_SET_NONE_GET_NONE,
10694 0,
10695 0,
10696 ""},
10697
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010698 /* handlers for sub-ioctl */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010699 {WE_IBSS_GET_PEER_INFO_ALL,
10700 0,
10701 0,
10702 "ibssPeerInfoAll"},
10703
Govind Singha471e5e2015-10-12 17:11:14 +053010704 {WE_GET_FW_PROFILE_DATA,
10705 0,
10706 0,
10707 "getProfileData"},
10708
10709 {WE_SET_REASSOC_TRIGGER,
10710 0,
10711 0,
10712 "reassoc"},
10713
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010714 {WE_STOP_OBSS_SCAN,
10715 0,
10716 0,
10717 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010718 /* handlers for main ioctl */
10719 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
10720 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10721 0,
10722 ""},
10723
10724 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010725 {WE_IBSS_GET_PEER_INFO,
10726 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10727 0,
10728 "ibssPeerInfo"},
10729
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010730#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010731 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010732 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
10733 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10734 0,
10735 "setdumplog"},
10736
10737 {WE_MTRACE_DUMP_CMD,
10738 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10739 0,
10740 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010741#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -080010742
10743 {WE_POLICY_MANAGER_CINFO_CMD,
10744 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10745 0,
10746 "pm_cinfo"},
10747
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010748#ifdef MPC_UT_FRAMEWORK
10749 {WE_POLICY_MANAGER_CLIST_CMD,
10750 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10751 0,
10752 "pm_clist"},
10753
10754 {WE_POLICY_MANAGER_DLIST_CMD,
10755 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10756 0,
10757 "pm_dlist"},
10758
10759 {WE_POLICY_MANAGER_DBS_CMD,
10760 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10761 0,
10762 "pm_dbs"},
10763
10764 {WE_POLICY_MANAGER_PCL_CMD,
10765 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10766 0,
10767 "pm_pcl"},
10768
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010769 {WE_POLICY_MANAGER_ULIST_CMD,
10770 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10771 0,
10772 "pm_ulist"},
10773
10774 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
10775 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10776 0,
10777 "pm_query_action"},
10778
10779 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
10780 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10781 0,
10782 "pm_query_allow"},
10783
10784 {WE_POLICY_MANAGER_SCENARIO_CMD,
10785 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10786 0,
10787 "pm_run_scenario"},
10788
10789 {WE_POLICY_SET_HW_MODE_CMD,
10790 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10791 0,
10792 "pm_set_hw_mode"},
10793#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010794 {WE_UNIT_TEST_CMD,
10795 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10796 0,
10797 "setUnitTestCmd"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010798
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010799 {WE_MAC_PWR_DEBUG_CMD,
10800 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10801 0,
10802 "halPwrDebug"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010803#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10804 {WE_LED_FLASHING_PARAM,
10805 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10806 0,
10807 "gpio_control"},
10808#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010809#ifdef WLAN_DEBUG
10810 {WE_SET_CHAN_AVOID,
10811 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10812 0,
10813 "ch_avoid"},
10814#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010815 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010816 {WLAN_PRIV_FIPS_TEST,
10817 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10818 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10819 "fips_test"},
10820
10821 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010822 {WLAN_PRIV_ADD_TSPEC,
10823 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10824 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10825 "addTspec"},
10826
10827 /* handlers for main ioctl */
10828 {WLAN_PRIV_DEL_TSPEC,
10829 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10830 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10831 "delTspec"},
10832
10833 /* handlers for main ioctl */
10834 {WLAN_PRIV_GET_TSPEC,
10835 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10836 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10837 "getTspec"},
10838
10839 /* handlers for main ioctl - host offload */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010840 {WLAN_PRIV_SET_HOST_OFFLOAD,
10841 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
10842 0,
10843 "setHostOffload"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010844
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010845 {WLAN_GET_WLAN_STATISTICS,
10846 0,
10847 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10848 "getWlanStats"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010849
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010850 {WLAN_SET_KEEPALIVE_PARAMS,
Jeff Johnson562ccad2019-02-06 22:10:24 -080010851 IW_PRIV_TYPE_BYTE | sizeof(struct keep_alive_req) |
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010852 IW_PRIV_SIZE_FIXED,
10853 0,
10854 "setKeepAlive"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010855#ifdef WLAN_FEATURE_PACKET_FILTERING
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010856 {WLAN_SET_PACKET_FILTER_PARAMS,
10857 IW_PRIV_TYPE_BYTE |
10858 sizeof(struct pkt_filter_cfg),
10859 0,
10860 "setPktFilter"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010861#endif
10862#ifdef FEATURE_WLAN_SCAN_PNO
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010863 {WLAN_SET_PNO,
10864 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10865 0,
10866 "setpno"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010867#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010868 {WLAN_SET_BAND_CONFIG,
10869 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10870 0,
10871 "SETBAND"},
Dustin Brown0cbc7572016-12-16 13:54:40 -080010872
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010873 {WLAN_PRIV_SET_MCBC_FILTER,
10874 0,
10875 0,
10876 "setMCBCFilter"},
10877
10878 {WLAN_GET_LINK_SPEED,
10879 IW_PRIV_TYPE_CHAR | 18,
10880 IW_PRIV_TYPE_CHAR | 5,
10881 "getLinkSpeed"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010882
Krunal Sonif9ba53d2019-01-03 21:44:41 -080010883#ifdef FEATURE_WLM_STATS
10884 {WLAN_GET_WLM_STATS,
10885 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10886 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10887 "get_wlm_stats"},
10888#endif
10889
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010890 /* handlers for main ioctl */
10891 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
10892 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10893 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010894 ""},
10895
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010896 {WE_SET_SMPS_PARAM,
10897 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010898 0, "set_smps_param"},
10899
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010900 {WLAN_SET_DOT11P_CHANNEL_SCHED,
10901 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010902 0, "set_dot11p" },
10903
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010904#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010905 {WE_SET_FW_CRASH_INJECT,
10906 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010907 0, "crash_inject"},
10908
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010909#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053010910#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070010911 {WE_LOG_BUFFER,
10912 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010913 0, "log_buffer"},
10914
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010915#endif
Krunal Soni6c3859f2018-06-01 19:57:40 -070010916 {WE_SET_BA_AGEING_TIMEOUT,
10917 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010918 0, "set_ba_timeout"},
10919
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010920#ifdef WLAN_SUSPEND_RESUME_TEST
10921 {WE_SET_WLAN_SUSPEND,
10922 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010923 0, "wlan_suspend"},
10924
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010925 {WE_SET_WLAN_RESUME,
10926 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010927 0, "wlan_resume"},
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010928#endif
Govind Singha471e5e2015-10-12 17:11:14 +053010929 {WE_ENABLE_FW_PROFILE,
10930 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010931 0, "enableProfile"},
10932
Govind Singha471e5e2015-10-12 17:11:14 +053010933 {WE_SET_FW_PROFILE_HIST_INTVL,
10934 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010935 0, "set_hist_intvl"},
10936
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010937 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
10938 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010939 0, "set_fw_mode_cfg"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010940#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010941 {WE_DUMP_DP_TRACE_LEVEL,
10942 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010943 0, "dump_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010944#endif
Nirav Shah73713f72018-05-17 14:50:41 +053010945#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070010946 {WE_SET_MON_MODE_CHAN,
10947 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010948 0, "setMonChan"},
Nirav Shah73713f72018-05-17 14:50:41 +053010949#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070010950 {WE_GET_ROAM_SYNCH_DELAY,
10951 0,
10952 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010953 "hostroamdelay"},
10954
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080010955 {WE_SET_11AX_RATE,
10956 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10957 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010958 "set_11ax_rate"},
10959
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010960 {WE_SET_DCM,
10961 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10962 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010963 "enable_dcm"},
10964
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010965 {WE_SET_RANGE_EXT,
10966 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10967 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010968 "range_ext"},
10969
Naveen Rawatc921c7b2017-06-13 17:29:51 -070010970 {WLAN_PRIV_SET_FTIES,
10971 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
10972 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010973 "set_ft_ies"},
10974
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010975#ifdef WLAN_FEATURE_MOTION_DETECTION
10976 {WE_MOTION_DET_START_STOP,
10977 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10978 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010979 "mt_start"},
10980
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010981 {WE_MOTION_DET_BASE_LINE_START_STOP,
10982 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10983 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010984 "mt_bl_start"},
10985
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010986 {WE_MOTION_DET_CONFIG_PARAM,
10987 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10988 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010989 "mt_config"},
10990
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010991 {WE_MOTION_DET_BASE_LINE_CONFIG_PARAM,
10992 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10993 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010994 "mt_bl_config"},
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010995#endif /* WLAN_FEATURE_MOTION_DETECTION */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010996};
10997
10998const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010999 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053011000 .num_private = QDF_ARRAY_SIZE(we_private),
11001 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011002
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070011003 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011004 .private = (iw_handler *) we_private,
11005 .private_args = we_private_args,
11006 .get_wireless_stats = NULL,
11007};
11008
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011009void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011010{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011011 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011012
Dustin Browne7e71d32018-05-11 16:00:08 -070011013 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011014
Dustin Browne74003f2018-03-14 12:51:58 -070011015 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011016}
11017
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011018void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011019{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011020 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011021
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011022 rtnl_lock();
11023 dev->wireless_handlers = NULL;
11024 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011025
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011026 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011027}