blob: 6f50d2b1263ea6b790d39ae40b34925ed4083ddd [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 Brown128e2d02019-02-15 12:59:07 -080073#include "qdf_slist_test.h"
Dustin Brownd315c452018-11-27 11:28:48 -080074#include "qdf_talloc_test.h"
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070075#include "qdf_str.h"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053076#include "qdf_trace.h"
Dustin Brownebb16d12018-11-29 17:52:07 -080077#include "qdf_types_test.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080078#include "wlan_hdd_assoc.h"
79#include "wlan_hdd_ioctl.h"
80#include "wlan_hdd_scan.h"
81#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080082#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080083#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070084#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070085#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080086#include "wlan_hdd_ocb.h"
87#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080088#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070089#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053090#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070091#ifdef WLAN_SUSPEND_RESUME_TEST
92#include "wlan_hdd_driver_ops.h"
93#include "hif.h"
Rajeev Kumar9bb2e852016-09-24 12:29:25 -070094#include "pld_common.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070095#endif
Dhanashri Atree7d442a2016-07-14 18:20:29 -070096#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053097#include "cds_utils.h"
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -070098#include "wlan_osif_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080099#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -0800100#include <cdp_txrx_stats.h>
101#include <cds_api.h>
Dustin Brown6099ddc2018-07-06 14:32:53 -0700102#include "wlan_dsc_test.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530103#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -0700104#include "wlan_hdd_regulatory.h"
105#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +0530106#include "wlan_hdd_packet_filter_api.h"
Naveen Rawat3ff5cff2018-01-29 14:31:16 -0800107#include "wlan_cp_stats_mc_ucfg_api.h"
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +0530108#include "wlan_mlme_ucfg_api.h"
Wu Gao93816212018-08-31 16:49:54 +0800109#include "cfg_mlme_sta.h"
Arif Hussain43e09712018-09-18 19:31:57 -0700110#include "wlan_mlme_public_struct.h"
Wu Gao93816212018-08-31 16:49:54 +0800111#include "cfg_ucfg_api.h"
Krunal Sonie71838d2018-09-27 10:45:05 -0700112#include "wlan_policy_mgr_ucfg.h"
Harprit Chhabadabec6de42018-09-10 10:21:15 -0700113#include "wlan_mlme_public_struct.h"
114#include "cfg_ucfg_api.h"
115#include "cfg_mlme_threshold.h"
Wu Gao66454f12018-09-26 19:55:41 +0800116#include "wlan_pmo_cfg.h"
117#include "wlan_pmo_ucfg_api.h"
Mohit Khannac9649652018-11-28 18:10:28 -0800118#include "dp_txrx.h"
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800119#include "wlan_fwol_ucfg_api.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530120
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800121/* Private ioctls and their sub-ioctls */
122#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
123#define WE_SET_11D_STATE 1
124#define WE_WOWL 2
125#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530126/*
127 * <ioctl>
128 * setMaxAssoc - Sets the maximum number of associated stations
129 *
130 * @INPUT: 1 to 32
131 *
132 * @OUTPUT: None
133 *
134 * This IOTCL sets the maximum number of associated stations
135 *
136 * @E.g: iwpriv wlan0 setMaxAssoc <value>
137 *
138 * Supported Feature: STA
139 *
140 * Usage: Internal/External
141 *
142 * </ioctl>
143 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800144#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530145/*
146 * <ioctl>
Jeff Johnsonf2cf6592018-05-06 16:27:44 -0700147 * scan_disable - Disable scan
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530148 *
149 * @INPUT: set_value
150 *
151 * @OUTPUT: None
152 *
153 * This IOCTL is used to set disable scan
154 *
155 * @E.g: iwpriv wlan0 scan_disable 1
156 *
157 * Supported Feature: Scan
158 *
159 * Usage: Internal/External
160 *
161 * </ioctl>
162 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800163#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530164/*
165 * <ioctl>
166 * inactivityTO - sets the timeout value for inactivity data while
167 * in power save mode
168 *
169 * @INPUT: int1…..int255
170 *
171 * @OUTPUT: None
172 *
173 * This IOCTL set the timeout value for inactivity data in power save mode
174 *
175 * @E.g: iwpriv wlan0 inactivityTO 20
176 *
177 * Supported Feature: STA
178 *
179 * Usage: Internal/External
180 *
181 * </ioctl>
182 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800183#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530184/*
185 * <ioctl>
186 * setMaxTxPower - Dynamically sets the maximum transmission power
187 *
188 * @INPUT: Transmission power in dBm
189 *
190 * @OUTPUT: None
191 *
192 * This IOCTL dynamically sets the maximum transmission power
193 * This setting does not persist over reboots
194 *
195 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
196 *
197 * Supported Feature: STA
198 *
199 * Usage: Internal/External
200 *
201 * </ioctl>
202 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800203#define WE_SET_MAX_TX_POWER 7
Jeff Johnson0187c622019-01-04 06:39:44 -0800204
205#ifdef HASTINGS_BT_WAR
206/* Temporary WAR for Hastings 1.1 only */
207#define WE_SET_HASTINGS_BT_WAR 8
208#endif
209
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800210#define WE_SET_TM_LEVEL 9
Jeff Johnson0187c622019-01-04 06:39:44 -0800211
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530212/*
213 * <ioctl>
214 * setphymode - Set the phymode dynamically
215 *
216 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
217 *
218 * @OUTPUT: None
219 *
220 * This IOCTL sets the phymode dynamically
221 *
222 * @E.g: iwpriv wlan0 setphymode 10
223 *
224 * Supported Feature: STA
225 *
226 * Usage: Internal/External
227 *
228 * </ioctl>
229 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800230#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530231/*
232 * <ioctl>
233 * nss - Set the number of spatial streams
234 *
235 * @INPUT: int1…..int3
236 *
237 * @OUTPUT: None
238 *
239 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
240 *
241 * @E.g: iwpriv wlan0 nss 2
242 *
243 * Supported Feature: STA
244 *
245 * Usage: Internal/External
246 *
247 * </ioctl>
248 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800249#define WE_SET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530250/*
251 * <ioctl>
252 * ldpc - Enables or disables LDPC
253 *
254 * @INPUT: 0 – Disable, 1 - Enable
255 *
256 * @OUTPUT: None
257 *
258 * This IOCTL enables or disables LDPC
259 *
260 * @E.g: iwpriv wlan0 ldpc 1
261 *
262 * Supported Feature: STA
263 *
264 * Usage: Internal/External
265 *
266 * </ioctl>
267 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800268#define WE_SET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530269/*
270 * <ioctl>
271 * tx_stbc - Enables or disables tx_stbc
272 *
273 * @INPUT: Int 0 – Disable, 1 - Enable
274 *
275 * @OUTPUT: None
276 *
277 * This IOTCL used to enables or disables tx_stbc
278 *
279 * @E.g: iwpriv wlan0 tx_stbc <value>
280 *
281 * Supported Feature: STA
282 *
283 * Usage: Internal/External
284 *
285 * </ioctl>
286 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800287#define WE_SET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530288/*
289 * <ioctl>
290 * rx_stbc - Set the rx_stbc parameter
291 *
292 * @INPUT: Int 0 – Disable, 1 - Enable
293 *
294 * @OUTPUT: None
295 *
296 * This IOTCL used to set rx_stbc parameter
297 *
298 * @E.g: iwpriv wlan0 rx_stbc <value>
299 *
300 * Supported Feature: STA
301 *
302 * Usage: Internal/External
303 *
304 * </ioctl>
305 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800306#define WE_SET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530307/*
308 * <ioctl>
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800309 * shortgi - Sets the short-guard interval
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530310 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800311 * @INPUT: Fixed Rate: 0 - 400ns, 1 - 800ns, 2 - 1600ns, 3 - 3200us
312 * Auto Rate: 8 - 400ns, 9 - 800ns, 10 - 1600ns, 11 - 3200us
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530313 *
314 * @OUTPUT: None
315 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800316 * This IOCTL sets the short-guard interval.
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530317 *
318 * @E.g: iwpriv wlan0 shortgi <value>
319 *
320 * Supported Feature: STA
321 *
322 * Usage: Internal/External
323 *
324 * </ioctl>
325 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800326#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530327/*
328 * <ioctl>
329 * enablertscts - enables or disables rts/cts.
330 *
331 * @INPUT: 1-Enable , 0-Disable
332 *
333 * @OUTPUT: None
334 *
335 * This IOCTL enables or disables rts/cts.
336 *
337 * @E.g: iwpriv wlan0 enablertscts <value>
338 *
339 * Supported Feature: STA
340 *
341 * Usage: Internal/External
342 *
343 * </ioctl>
344 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800345#define WE_SET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530346/*
347 * <ioctl>
348 * chwidth - Set the channel bandwidth
349 *
350 * @INPUT: 0-20mhz to 3-160mhz
351 *
352 * @OUTPUT: None
353 *
354 * This IOTCL used to set the channel bandwidth
355 *
356 * @E.g: iwpriv wlan0 chwidth 1
357 *
358 * Supported Feature: STA
359 *
360 * Usage: Internal/External
361 *
362 * </ioctl>
363 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800364#define WE_SET_CHWIDTH 17
365#define WE_SET_ANI_EN_DIS 18
366#define WE_SET_ANI_POLL_PERIOD 19
367#define WE_SET_ANI_LISTEN_PERIOD 20
368#define WE_SET_ANI_OFDM_LEVEL 21
369#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530370/*
371 * <ioctl>
372 * cwmenable - Enables or disables the dynamic channel bandwidth
373 *
374 * @INPUT: 0-Disable, 1-Enable
375 *
376 * @OUTPUT: None
377 *
378 * This IOTCL used to enables or disables the dynamic channel bandwidth
379 *
380 * @E.g: iwpriv wlan0 cwmenable <value>
381 *
382 * Supported Feature: STA
383 *
384 * Usage: Internal/External
385 *
386 * </ioctl>
387 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800388#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530389/*
390 * <ioctl>
391 * txchainmask - This IOCTL sets the current Tx chain mask
392 *
393 * @INPUT: Mask Value
394 *
395 * @OUTPUT: None
396 *
397 * This IOCTL sets the current Tx chain mask
398 *
399 * @E.g: iwpriv wlan0 txchainmask 1
400 *
401 * Supported Feature: STA
402 *
403 * Usage: Internal/External
404 *
405 * </ioctl>
406 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800407#define WE_SET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530408/*
409 * <ioctl>
410 * rxchainmask - Sets the current Rx chain mask
411 *
412 * @INPUT: Mask Value
413 *
414 * @OUTPUT: None
415 *
416 * This IOCTL sets the current Rx chain mask. This command is the
417 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
418 *
419 * @E.g: iwpriv wlan0 rxchainmask <value>
420 *
421 * Supported Feature: STA
422 *
423 * Usage: Internal/External
424 *
425 * </ioctl>
426 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800427#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530428/*
429 * <ioctl>
430 * set11NRates - Fixes the Tx data rate of the 11N mode.
431 *
432 * @INPUT: 0x1b to 0x8f
433 *
434 * @OUTPUT: None
435 *
436 * This IOCTL fixes the Tx data rate of the 11N mode.
437 *
438 * @E.g: iwpriv wlan0 set11NRates 0x85
439 *
440 * Supported Feature: STA
441 *
442 * Usage: Internal/External
443 *
444 * </ioctl>
445 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800446#define WE_SET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530447/*
448 * <ioctl>
449 * ampdu - Set the the maximum subframe of ampdu
450 *
451 * @INPUT: int 1 to int 63
452 *
453 * @OUTPUT: None
454 *
455 * This IOCTL sets the maximum subframe of ampdu.
456 *
457 * @E.g: iwpriv wlan0 ampdu 9
458 *
459 * Supported Feature: STA
460 *
461 * Usage: Internal/External
462 *
463 * </ioctl>
464 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800465#define WE_SET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530466/*
467 * <ioctl>
468 * amsdu - Sets the maximum subframe of amsdu.
469 *
470 * @INPUT: int 1 to int 31
471 *
472 * @OUTPUT: None
473 *
474 * This IOCTL sets the maximum subframe of amsdu.
475 *
476 * @E.g: iwpriv wlan0 amsdu 9
477 *
478 * Supported Feature: STA
479 *
480 * Usage: Internal/External
481 *
482 * </ioctl>
483 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800484#define WE_SET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530485/*
486 * <ioctl>
487 * txpow2g - current 2 GHz Tx power setting
488 *
489 * @INPUT: Tx power in dBm
490 *
491 * @OUTPUT: None
492 *
493 * This IOTCL used to set 2 ghz tx power
494 *
495 * @E.g: iwpriv wlan0 txpow2g
496 *
497 * Supported Feature: STA
498 *
499 * Usage: Internal/External
500 *
501 * </ioctl>
502 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800503#define WE_SET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530504/*
505 * <ioctl>
506 * txpow5g - Current 5 GHz tx power setting
507 *
508 * @INPUT: Tx power in dBm
509 *
510 * @OUTPUT: None
511 *
512 * This IOTCL used to set the 5 ghz txpower
513 *
514 * @E.g: iwpriv wlan0 txpow5g
515 *
516 * Supported Feature: STA
517 *
518 * Usage: Internal/External
519 *
520 * </ioctl>
521 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800522#define WE_SET_TXPOW_5G 30
523/* Private ioctl for firmware debug log */
524#define WE_DBGLOG_LOG_LEVEL 31
525#define WE_DBGLOG_VAP_ENABLE 32
526#define WE_DBGLOG_VAP_DISABLE 33
527#define WE_DBGLOG_MODULE_ENABLE 34
528#define WE_DBGLOG_MODULE_DISABLE 35
529#define WE_DBGLOG_MOD_LOG_LEVEL 36
530#define WE_DBGLOG_TYPE 37
531#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530532/*
533 * <ioctl>
534 * set11ACRates - Fixes the Tx data rate of 11AC
535 *
536 * @INPUT: 0x1 to 0x9
537 *
538 * @OUTPUT: None
539 *
540 * This IOCTL fixes the Tx data rate of 11AC.
541 *
542 * @E.g: iwpriv wlan0 set11ACRates 0x9
543 *
544 * Supported Feature: STA
545 *
546 * Usage: Internal/External
547 *
548 * </ioctl>
549 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800550#define WE_SET_VHT_RATE 39
551#define WE_DBGLOG_REPORT_ENABLE 40
552#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530553/*
554 * <ioctl>
555 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
556 *
557 * @INPUT: Transmission power in dBm
558 *
559 * @OUTPUT: None
560 *
561 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
562 * This setting does not persist over reboots
563 *
564 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
565 *
566 * Supported Feature: STA
567 *
568 * Usage: Internal/External
569 *
570 * </ioctl>
571 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800572#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530573/*
574 * <ioctl>
575 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
576 *
577 * @INPUT: Transmission power in dBm
578 *
579 * @OUTPUT: None
580 *
581 * This IOCTL sets the maximum transmit power for the 5-GHz band
582 * This setting does not persist over reboots
583 *
584 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
585 *
586 * Supported Feature: STA
587 *
588 * Usage: Internal/External
589 *
590 * </ioctl>
591 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800592#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800593#define WE_SET_PKTLOG 44
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530594/* Private ioctl for packet power save */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800595#define WE_PPS_PAID_MATCH 45
596#define WE_PPS_GID_MATCH 46
597#define WE_PPS_EARLY_TIM_CLEAR 47
598#define WE_PPS_EARLY_DTIM_CLEAR 48
599#define WE_PPS_EOF_PAD_DELIM 49
600#define WE_PPS_MACADDR_MISMATCH 50
601#define WE_PPS_DELIM_CRC_FAIL 51
602#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530603/*
604 * <ioctl>
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530605 * rssi_chk - Check the rssi
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530606 *
607 * @INPUT: One argument as input
608 *
609 * @OUTPUT: rssi
610 * wlan0 rssi_chk:56
611 *
612 * This IOTCL used to chek rssi
613 *
614 * @E.g: iwpriv wlan0 rssi_chk <value>
615 *
616 * Supported Feature: STA
617 *
618 * Usage: Internal/External
619 *
620 * </ioctl>
621 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800622#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530623/*
624 * <ioctl>
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530625 * htsmps - Sets the htsmps
626 *
627 * @INPUT: Atleast one int argument
628 *
629 * @OUTPUT: None
630 *
631 * This IOTCL used to set htsmps
632 *
633 * @E.g: iwpriv wlan0 htsmps <value>
634 *
635 * Supported Feature: STA
636 *
637 * Usage: Internal/External
638 *
639 * </ioctl>
640 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800641#define WE_SET_HTSMPS 55
642/* Private ioctl for QPower */
643#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
644#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
645#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
646#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800647/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530648/*
649 * <ioctl>
650 * gtxHTMcs - Set the tx HTM value
651 *
652 * @INPUT: Atleast one int orgument
653 *
654 * @OUTPUT: None
655 *
656 * This IOTCL sets htm tx value
657 *
658 * @E.g: iwpriv wlan0 gtxHTMcs <value>
659 *
660 * Supported Feature: STA
661 *
662 * Usage: Internal/External
663 *
664 * </ioctl>
665 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800666#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530667/*
668 * <ioctl>
669 * gtxVHTMcs - Set gtxVHTMcs value
670 *
671 * @INPUT: Atleast one int argument
672 *
673 * @OUTPUT: None
674 *
675 * This IOTCL used to set gtxVHTMcs value
676 *
677 * @E.g: iwpriv wlan0 gtxVHTMcs <value>
678 *
679 * Supported Feature: STA
680 *
681 * Usage: Internal/External
682 *
683 * </ioctl>
684 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800685#define WE_SET_GTX_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530686/*
687 * <ioctl>
688 * gtxUsrCfg - Host request for GTX mask
689 *
690 * @INPUT: Atleast one int orgument
691 *
692 * @OUTPUT: None
693 *
694 * This IOTCL used send the host request for GTX mask
695 *
696 * @E.g: iwpriv wlan0 gtxUsrCfg <value>
697 *
698 * Supported Feature: STA
699 *
700 * Usage: Internal/External
701 *
702 * </ioctl>
703 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800704#define WE_SET_GTX_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530705/*
706 * <ioctl>
707 * gtxThre - Set the tx threshold
708 *
709 * @INPUT: Atleast one int argument
710 *
711 * @OUTPUT: None
712 *
713 * This IOTCL used to set tx threshold
714 *
715 * @E.g: iwpriv wlan0 gtxThre <value>
716 *
717 * Supported Feature: STA
718 *
719 * Usage: Internal/External
720 *
721 * </ioctl>
722 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800723#define WE_SET_GTX_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530724/*
725 * <ioctl>
726 * gtxMargin - Set the gtxMargin
727 *
728 * @INPUT: 1 to 32
729 *
730 * @OUTPUT: None
731 *
732 * This IOTCL use dto set gtxMargin
733 *
734 * @E.g: iwpriv wlan0 gtxMargini <value>
735 *
736 * Supported Feature: STA
737 *
738 * Usage: Internal/External
739 *
740 * </ioctl>
741 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800742#define WE_SET_GTX_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530743/*
744 * <ioctl>
745 * gtxStep - Set the gtxStep
746 *
747 * @INPUT: None
748 *
749 * @OUTPUT: None
750 *
751 * This IOTCL used to sets gtxStep
752 *
753 * @E.g: iwpriv wlan0 gtxStep <value>
754 *
755 * Supported Feature: STA
756 *
757 * Usage: Internal/External
758 *
759 * </ioctl>
760 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800761#define WE_SET_GTX_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530762/*
763 * <ioctl>
764 * gtxMinTpc - Sets the gtxMinTpc
765 *
766 * @INPUT: Atleast one int argument
767 *
768 * @OUTPUT: None
769 *
770 * This IOTCL sets the tx MinTpc
771 *
772 * @E.g: iwpriv wlan0 gtxMinTpc <value>
773 *
774 * Supported Feature: STA
775 *
776 * Usage: Internal/External
777 *
778 * </ioctl>
779 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800780#define WE_SET_GTX_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530781/*
782 * <ioctl>
783 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
784 *
785 * @INPUT: Mask value
786 *
787 * @OUTPUT: None
788 *
789 * This IOTCL used to set gtxBWMask
790 *
791 * @E.g: iwpriv wlan0 gtxBWMask <value>
792 *
793 * Supported Feature: STA
794 *
795 * Usage: Internal/External
796 *
797 * </ioctl>
798 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530799
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530800#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530801/*
802 * <ioctl>
803 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
804 *
805 * @INPUT: set_value
806 *
807 * @OUTPUT: None
808 *
809 * This IOCTL is used to set the MCC latency value in milliseconds
810 * during STA-P2P concurrency.
811 *
812 * If 0ms latency is provided, then FW will set to a default.
813 * Otherwise, latency must be at least 30ms.
814 *
815 * @E.g: iwpriv wlan0 setMccLatency 40
816 *
817 *
818 * Supported Feature: Concurrency
819 *
820 * Usage: Internal/External
821 *
822 * </ioctl>
823 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800824#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530825
826/*
827 * <ioctl>
828 * setMccQuota- Set the quota for P2P cases
829 *
830 * @INPUT: set_value [0,100]
831 *
832 * @OUTPUT: None
833 *
834 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
835 *
836 * Currently used to set time quota for 2 MCC vdevs/adapters using
837 * (operating channel, quota) for each mode.
838 * The info is provided run time using iwpriv command:
839 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
840 * Note: the quota provided in command is for the same mode in cmd.
841 * HDD checks if MCC mode is active, gets the second mode and its
842 * operating chan.
843 * Quota for the 2nd role is calculated as 100 - quota of first mode.
844 *
845 * @E.g: iwpriv wlan0 setMccQuota 50
846 * iwpriv p2p0 setMccQuota 50
847 *
848 * Supported Feature: Concurrency
849 *
850 * Usage: Internal/External
851 *
852 * </ioctl>
853 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800854#define WE_MCC_CONFIG_QUOTA 71
855/* Private IOCTL for debug connection issues */
856#define WE_SET_DEBUG_LOG 72
857#ifdef WE_SET_TX_POWER
858#undef WE_SET_TX_POWER
859#endif
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -0800860
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530861/*
862 * <ioctl>
863 * setTxPower - Set the current transmit power
864 *
865 * @INPUT: Transmission power in dBm
866 *
867 * @OUTPUT: None
868 *
869 * This IOCTL sets the current transmit power.
870 * This setting does not persist over reboots.
871 *
872 * @E.g: iwpriv wlan0 setTxPower 10
873 *
874 * Supported Feature: STA
875 *
876 * Usage: Internal/External
877 *
878 * </ioctl>
879 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800880#define WE_SET_TX_POWER 74
881/* Private ioctl for earlyrx power save feature */
882#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
883#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
884#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
885#define WE_SET_EARLY_RX_SLOP_STEP 78
886#define WE_SET_EARLY_RX_INIT_SLOP 79
887#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530888/*
889 * <ioctl>
890 * setMcRate - Set the data rate for multicast data
891 *
892 * @INPUT: 1 to 32
893 *
894 * @OUTPUT: None
895 *
896 * This IOCTL sets the data rate for multicast data. Note that this command
897 * is allowed only in STA, IBSS, or QCMobileAP mode
898 *
899 * @E.g: iwpriv wlan0 setMcRate <value>
900 *
901 * Supported Feature: STA
902 *
903 * Usage: Internal/External
904 *
905 * </ioctl>
906 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800907#define WE_SET_MC_RATE 81
908#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
909/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530910/*
911 * <ioctl>
912 * 5g_ebt - Sets the 5g_ebt
913 *
914 * @INPUT: <value>
915 *
916 * @OUTPUT: None
917 *
918 * This IOTCL used to set 5g_ebt
919 *
920 * @E.g: iwpriv wlan0 5g_ebt <value>
921 *
922 * Supported Feature: STA
923 *
924 * Usage: Internal/External
925 *
926 * </ioctl>
927 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800928#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530929/*
930 * <ioctl>
931 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
932 *
933 * @INPUT: 20 t0 160
934 *
935 * @OUTPUT: None
936 *
937 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
938 *
939 * @E.g: iwpriv wlan0 cts_cbw <value>
940 *
941 * Supported Feature: STA
942 *
943 * Usage: Internal/External
944 *
945 * </ioctl>
946 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800947#define WE_SET_CTS_CBW 84
948#define WE_DUMP_STATS 85
949#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +0530950/* Private sub ioctl for starting/stopping the profiling */
951#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +0530952
Abhishek Singh3c507012016-12-01 11:15:42 +0530953/*
954 * <ioctl>
955 * setChanChange - Initiate channel change
956 *
957 * @INPUT: channel number to switch to.
958 *
959 * @OUTPUT: None
960 *
961 * This IOCTL is used to initiate a channel change.
962 * If called on STA/CLI interface it will send the
963 * ECSA action frame to the connected SAP/GO asking to
964 * initiate the ECSA, if supported.
965 * If called on SAP/GO interface it will initiate
966 * ECSA and ask connected peers to move to new channel.
967 *
968 * @E.g: iwpriv wlan0 setChanChange <channel>
969 * iwpriv wlan0 setChanChange 1
970 *
971 * Supported Feature: ECSA
972 *
973 * Usage: Internal/External
974 *
975 * </ioctl>
976 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +0530977#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +0530978#define WE_SET_CONC_SYSTEM_PREF 89
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800979
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800980/*
981 * <ioctl>
982 * set_11ax_rate - set 11ax rates to FW
983 *
984 * @INPUT: rate code
985 *
986 * @OUTPUT: None
987 *
988 * This IOCTL fixes the Tx data rate of 11AX.
989 *
990 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
991 *
992 * Supported Feature: STA/SAP
993 *
994 * Usage: Internal
995 *
996 * </ioctl>
997 */
998#define WE_SET_11AX_RATE 91
999
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001000/*
1001 * <ioctl>
1002 * enable_dcm - enable Dual Carrier Modulation(DCM)
1003 *
1004 * @INPUT: 0/1
1005 *
1006 * @OUTPUT: None
1007 *
1008 * This IOCTL enables/disables DCM.
1009 *
1010 * @E.g: iwpriv wlan0 enable_dcm <0/1>
1011 *
1012 * Supported Feature: STA/SAP
1013 *
1014 * Usage: Internal
1015 *
1016 * </ioctl>
1017 */
1018#define WE_SET_DCM 92
1019
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001020/*
1021 * <ioctl>
Naveen Rawat53448ea2017-11-27 11:43:18 -08001022 * range_ext - enable Range extension
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001023 *
1024 * @INPUT: 0/1
1025 *
1026 * @OUTPUT: None
1027 *
1028 * This IOCTL enables/disables Range extension.
1029 *
Naveen Rawat53448ea2017-11-27 11:43:18 -08001030 * @E.g: iwpriv wlan0 range_ext <1/0>
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001031 *
1032 * Supported Feature: STA/SAP
1033 *
1034 * Usage: Internal
1035 *
1036 * </ioctl>
1037 */
1038#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001039
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301040/*
1041 * <ioctl>
1042 * wow_ito - sets the timeout value for inactivity data while
1043 * in power save mode during wow
1044 *
1045 * @INPUT: int
1046 *
1047 * @OUTPUT: None
1048 *
1049 * This IOCTL set the timeout value for inactivity data in power save mode
1050 *
1051 * @E.g: iwpriv wlan0 wow_ito 20
1052 *
1053 * Supported Feature: STA
1054 *
1055 * Usage: External
1056 *
1057 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001058 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301059#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1060
Jeff Johnson011c4502017-10-05 15:25:56 -07001061/*
1062 * <ioctl>
1063 * pdev_reset - reset the pdev
1064 *
1065 * @INPUT: Reset command to initiate:
1066 * TX_FLUSH = 1
1067 * WARM_RESET = 2
1068 * COLD_RESET = 3
1069 * WARM_RESET_RESTORE_CAL = 4
1070 * COLD_RESET_RESTORE_CAL = 5
1071 *
1072 * @OUTPUT: None
1073 *
1074 * This IOCTL is used to reset the pdev. The primary use is
1075 * for internal testing. It is not expected that this will
1076 * be used on a production device.
1077 *
1078 * @E.g: iwpriv wlan0 pdev_reset <command>
1079 * iwpriv wlan0 pdev_reset 1
1080 *
1081 * Supported Feature: None
1082 *
1083 * Usage: Internal
1084 *
1085 * </ioctl>
1086 */
1087#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301088
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301089/*
1090 * setModDTIM - Change Modulated DTIM
1091 *
1092 * @INPUT: set_value.
1093 *
1094 * @OUTPUT: None
1095 *
1096 * This IOCTL is used to change modulated DTIM
1097 * value without WIFI OFF/ON.
1098 *
1099 * @E.g: iwpriv wlan0 setModDTIM <value>
1100 * iwpriv wlan0 setModDTIM 2
1101 *
1102 * Supported Feature: N/A
1103 *
1104 * Usage: Internal/External
1105 *
1106 * </ioctl>
1107 */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05301108#define WE_SET_MODULATED_DTIM 96
1109
1110#ifdef WLAN_FEATURE_MOTION_DETECTION
1111#define WE_MOTION_DET_START_STOP 97
1112#define WE_MOTION_DET_BASE_LINE_START_STOP 98
1113#endif /* WLAN_FEATURE_MOTION_DETECTION */
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301114
Krishna Reddya50d09f2019-02-04 14:55:06 +05301115/*
Krishna Reddy64c14da2019-02-12 20:23:12 +05301116 * set_btc_mode Set BTCoexMode
Krishna Reddya50d09f2019-02-04 14:55:06 +05301117 *
1118 * @INPUT: set_value.
1119 *
1120 * @OUTPUT: None
1121 *
1122 * This IOCTL is used to set the BT COex operating mode
Krishna Reddy64c14da2019-02-12 20:23:12 +05301123 * Allowed values are 0(TDD), 1(FDD), 2(Hybrid)
Krishna Reddya50d09f2019-02-04 14:55:06 +05301124 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301125 * @E.g: iwpriv wlan0 set_btc_mode <value>
1126 * iwpriv wlan0 set_btc_mode 2
Krishna Reddya50d09f2019-02-04 14:55:06 +05301127 *
1128 * Supported Feature: N/A
1129 *
1130 * Usage: Internal/External
1131 *
1132 * </ioctl>
1133 */
1134#define WE_SET_BTCOEX_MODE 99
1135
1136/*
Krishna Reddy64c14da2019-02-12 20:23:12 +05301137 * set_btc_rssi- Set WLAN low RSSI threshold for BTCOex
Krishna Reddya50d09f2019-02-04 14:55:06 +05301138 *
1139 * @INPUT: set_value.
1140 *
1141 * @OUTPUT: None
1142 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301143 * This IOCTL is used to modify the threshold at which
1144 * the COex mode changes from TDD to Hybrid mode
Krishna Reddya50d09f2019-02-04 14:55:06 +05301145 * Allowed values are from -100 to 0
1146 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301147 * @E.g: iwpriv wlan0 set_btc_rssi <value>
1148 * iwpriv wlan0 set_btc_rssi -70
Krishna Reddya50d09f2019-02-04 14:55:06 +05301149 *
1150 * Supported Feature: N/A
1151 *
1152 * Usage: Internal/External
1153 *
1154 * </ioctl>
1155 */
1156#define WE_SET_BTCOEX_RSSI_THRESHOLD 100
1157
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001158/* Private ioctls and their sub-ioctls */
1159#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1160#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001161#define WE_GET_WLAN_DBG 4
1162#define WE_GET_MAX_ASSOC 6
1163/* 7 is unused */
1164#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301165
1166/*
1167 * <ioctl>
1168 * getconcurrency - Get concurrency mode
1169 *
1170 * @INPUT: None
1171 *
1172 * @OUTPUT: It shows concurrency value
1173 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1174 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1175 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1176 *
1177 * This IOCTL is used to retrieve concurrency mode.
1178 *
1179 * @E.g: iwpriv wlan0 getconcurrency
1180 * wlan0 getconcurrency:5
1181 * Above value shows STA+P2P_Client
1182 *
1183 * Supported Feature: Concurrency
1184 *
1185 * Usage: Internal/External
1186 *
1187 * </ioctl>
1188 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001189#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301190/*
1191 * <ioctl>
1192 * get_nss - Get the number of spatial STBC streams (NSS)
1193 *
1194 * @INPUT: None
1195 *
1196 * @OUTPUT: NSS
1197 * wlan0 get_nss:2
1198 *
1199 * This IOTCL used to get the number of spatial STBC streams
1200 *
1201 * @E.g: iwpriv wlan0 get_nss
1202 *
1203 * Supported Feature: STA
1204 *
1205 * Usage: Internal/External
1206 *
1207 * </ioctl>
1208 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001209#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301210/*
1211 * <ioctl>
1212 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1213 *
1214 * @INPUT: None
1215 *
1216 * @OUTPUT: ldpc
1217 * wlan0 get_ldpc:1
1218 *
1219 * This IOTCL used to gets the low density parity check (LDPC)
1220 *
1221 * @E.g: iwpriv wlan0 get_ldpc
1222 *
1223 * Supported Feature: STA
1224 *
1225 * Usage: Internal/External
1226 *
1227 * </ioctl>
1228 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001229#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301230/*
1231 * <ioctl>
1232 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1233 *
1234 * @INPUT: None
1235 *
1236 * @OUTPUT: TXSTBC
1237 * wlan0 get_tx_stbc:1
1238 *
1239 * This IOTCL get the value of the current Tx space time block code (STBC)
1240 *
1241 * @E.g: iwpriv wlan0 get_tx_stbc
1242 *
1243 * Supported Feature: STA
1244 *
1245 * Usage: Internal/External
1246 *
1247 * </ioctl>
1248 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001249#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301250/*
1251 * <ioctl>
1252 * get_rx_stbc - Gets the value of the current Rx STBC
1253 *
1254 * @INPUT: None
1255 *
1256 * @OUTPUT: Rx STBC
1257 * wlan0 get_rx_stbc:1
1258 *
1259 * This IOTCL used to get the value of the current Rx STBC
1260 *
1261 * @E.g: iwpriv wlan0 get_rx_stbc
1262 *
1263 * Supported Feature: STA
1264 *
1265 * Usage: Internal/External
1266 *
1267 * </ioctl>
1268 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001269#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301270/*
1271 * <ioctl>
1272 * get_shortgi - Get the value of the current short GI setting
1273 *
1274 * @INPUT: None
1275 *
1276 * @OUTPUT: Enable/disable of shortgi
1277 * wlan0 get_shortgi:1
1278 *
1279 * This IOCTL gets the value of the current short GI setting
1280 *
1281 * @E.g: iwpriv wlan0 get_shortgi
1282 *
1283 * Supported Feature: STA
1284 *
1285 * Usage: Internal/External
1286 *
1287 * </ioctl>
1288 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001289#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301290/*
1291 * <ioctl>
1292 * get_rtscts - Get the value of the current RTS/CTS setting.
1293 *
1294 * @INPUT: None
1295 *
1296 * @OUTPUT: Enable/disable of RTS/CTS
1297 * wlan0 get_rtscts:33
1298 *
1299 * This IOTCL get the value of the current RTS/CTS setting.
1300 *
1301 * @E.g: iwpriv wlan0 get_rtscts
1302 *
1303 * Supported Feature: STA
1304 *
1305 * Usage: Internal/External
1306 *
1307 * </ioctl>
1308 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001309#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301310/*
1311 * <ioctl>
1312 * get_chwidth - Get the current channel width setting
1313 *
1314 * @INPUT: None
1315 *
1316 * @OUTPUT: channel width
1317 * wlan0 get_chwidth:0
1318 *
1319 * This IOTCL get the current channel width setting.
1320 *
1321 * @E.g: iwpriv wlan0 get_chwidth
1322 *
1323 * Supported Feature: STA
1324 *
1325 * Usage: Internal/External
1326 *
1327 * </ioctl>
1328 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001329#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301330/*
1331 * <ioctl>
1332 * get_anienable - Get the anienable
1333 *
1334 * @INPUT: None
1335 *
1336 * @OUTPUT:
1337 * wlan0 get_anienable:0
1338 *
1339 * This IOTCL get the anienable
1340 *
1341 * @E.g: iwpriv wlan0 get_anienable
1342 *
1343 * Supported Feature: STA
1344 *
1345 * Usage: Internal/External
1346 *
1347 * </ioctl>
1348 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001349#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301350/*
1351 * <ioctl>
1352 * get_aniplen - Get the aniplen
1353 *
1354 * @INPUT: None
1355 *
1356 * @OUTPUT:
1357 * wlan0 get_aniplen:0
1358 *
1359 * This IOTCL get the aniplen
1360 *
1361 * @E.g: iwpriv wlan0 get_aniplen
1362 *
1363 * Supported Feature: STA
1364 *
1365 * Usage: Internal/External
1366 *
1367 * </ioctl>
1368 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001369#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301370/*
1371 * <ioctl>
1372 * get_anilislen- Get the anilislen
1373 *
1374 * @INPUT: None
1375 *
1376 * @OUTPUT:
1377 * wlan0 get_anilislen:0
1378 *
1379 * This IOTCL used to get anilislen
1380 *
1381 * @E.g: iwpriv wlan0 get_anilislen
1382 *
1383 * Supported Feature: STA
1384 *
1385 * Usage: Internal/External
1386 *
1387 * </ioctl>
1388 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001389#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301390/*
1391 * <ioctl>
1392 * get_aniofdmlvl - Get the OFDM level
1393 *
1394 * @INPUT: None
1395 *
1396 * @OUTPUT: OFDM
1397 * wlan0 get_aniofdmlvl:0
1398 *
1399 * This IOTCL used to get ofdm level
1400 *
1401 * @E.g: iwpriv wlan0 get_aniofdmlvl
1402 *
1403 * Supported Feature: STA
1404 *
1405 * Usage: Internal/External
1406 *
1407 * </ioctl>
1408 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001409#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301410/*
1411 * <ioctl>
1412 * get_aniccklvl - Get the cck level
1413 *
1414 * @INPUT: None
1415 *
1416 * @OUTPUT:
1417 * wlan0 get_aniccklvl:0
1418 *
1419 * This IOTCL used to get cck level
1420 *
1421 * @E.g: iwpriv wlan0 get_aniccklvl
1422 *
1423 * Supported Feature: STA
1424 *
1425 * Usage: Internal/External
1426 *
1427 * </ioctl>
1428 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001429#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301430/*
1431 * <ioctl>
1432 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1433 *
1434 * @INPUT: None
1435 *
1436 * @OUTPUT: Enable/disable dynamic channel bandwidth
1437 * wlan0 get_cwmenable:0
1438 *
1439 * This IOTCL get the value of the dynamic channel bandwidth setting
1440 *
1441 * @E.g: iwpriv wlan0 get_cwmenable
1442 *
1443 * Supported Feature: STA
1444 *
1445 * Usage: Internal/External
1446 *
1447 * </ioctl>
1448 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001449#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301450/*
1451 * <ioctl>
1452 * get_txchainmask - Get the txchainmask that was set
1453 *
1454 * @INPUT: None
1455 *
1456 * @OUTPUT: txchainmask
1457 * wlan0 get_txchainmask:1
1458 *
1459 * This IOCTL gets the txchainmask that was set
1460 * This command is useful if it was previously set
1461 *
1462 * @E.g: iwpriv wlan0 get_txchainmask
1463 *
1464 * Supported Feature: STA
1465 *
1466 * Usage: Internal/External
1467 *
1468 * </ioctl>
1469 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001470#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301471/*
1472 * <ioctl>
1473 * get_rxchainmask - Get the rxchainmask that was set
1474 *
1475 * @INPUT: None
1476 *
1477 * @OUTPUT: rxchainmask
1478 * wlan0 get_rxchainmask:1
1479 *
1480 * This IOCTL gets the rxchainmask that was set
1481 * This command is useful only if it was previously set.
1482 *
1483 * @E.g: iwpriv wlan0 get_rxchainmask
1484 *
1485 * Supported Feature: STA
1486 *
1487 * Usage: Internal/External
1488 *
1489 * </ioctl>
1490 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001491#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301492/*
1493 * <ioctl>
1494 * get_11nrate - Get the fixed Tx data rate
1495 *
1496 * @INPUT: None
1497 *
1498 * @OUTPUT: Using this command does not return the same value as set
1499 * wlan0 get_11nrate:0
1500 *
1501 * This IOCTL gets the fixed Tx data rate
1502 * This command is useful only if setting the fixed Tx rate.
1503 *
1504 * @E.g: iwpriv wlan0 get_11nrate
1505 *
1506 * Supported Feature: STA
1507 *
1508 * Usage: Internal/External
1509 *
1510 * </ioctl>
1511 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001512#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301513/*
1514 * <ioctl>
1515 * get_ampdu - Get the maximum subframe of ampdu
1516 *
1517 * @INPUT: None
1518 *
1519 * @OUTPUT: Maximum subframe of ampdu
1520 * wlan0 get_ampdu:1
1521 *
1522 * This IOCTL gets the maximum subframe of ampdu
1523 * This command is useful only if setting ampdu.
1524 *
1525 * @E.g: iwpriv wlan0 get_ampdu
1526 *
1527 * Supported Feature: STA
1528 *
1529 * Usage: Internal/External
1530 *
1531 * </ioctl>
1532 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001533#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301534/*
1535 * <ioctl>
1536 * get_amsdu - Get the maximum subframe of amsdu
1537 *
1538 * @INPUT: None
1539 *
1540 * @OUTPUT: Maximum subframe of amsdu
1541 * wlan0 get_amsdu:1
1542 *
1543 * This IOCTL gets the maximum subframe of amsdu.
1544 * This command is useful only if setting amsdu
1545 *
1546 * @E.g: iwpriv wlan0 get_amsdu
1547 *
1548 * Supported Feature: STA
1549 *
1550 * Usage: Internal/External
1551 *
1552 * </ioctl>
1553 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001554#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301555/*
1556 * <ioctl>
1557 * get_txpow2g - Get the current 2 GHz Tx power setting
1558 *
1559 * @INPUT: None
1560 *
1561 * @OUTPUT: Tx Power in dbm
1562 * wlan0 get_txpow2g:0
1563 *
1564 * This IOCTL gets the current 2 GHz Tx power setting
1565 * This command is useful if setting Tx power
1566 *
1567 * @E.g: iwpriv wlan0 get_txpow2g
1568 *
1569 * Supported Feature: STA
1570 *
1571 * Usage: Internal/External
1572 *
1573 * </ioctl>
1574 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001575#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301576/*
1577 * <ioctl>
1578 * get_txpow5g - Get the current 5 GHz Tx power setting
1579 *
1580 * @INPUT: None
1581 *
1582 * @OUTPUT: Tx Power in dbm
1583 * wlan0 get_txpow5g:0
1584 *
1585 * This IOCTL gets the current 5 GHz Tx power setting
1586 * This command is useful if setting Tx power
1587 *
1588 * @E.g: iwpriv wlan0 get_txpow5g
1589 *
1590 * Supported Feature: STA
1591 *
1592 * Usage: Internal/External
1593 *
1594 * </ioctl>
1595 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001596#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001597/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001598#define WE_GET_PPS_PAID_MATCH 32
1599#define WE_GET_PPS_GID_MATCH 33
1600#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1601#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1602#define WE_GET_PPS_EOF_PAD_DELIM 36
1603#define WE_GET_PPS_MACADDR_MISMATCH 37
1604#define WE_GET_PPS_DELIM_CRC_FAIL 38
1605#define WE_GET_PPS_GID_NSTS_ZERO 39
1606#define WE_GET_PPS_RSSI_CHECK 40
1607/* Private ioctl for QPower */
1608#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1609#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1610#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1611#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001612/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301613/*
1614 * <ioctl>
1615 * get_gtxHTMcs - Get the tx HTM
1616 *
1617 * @INPUT: None
1618 *
1619 * @OUTPUT: HTM
1620 * wlan0 get_gtxHTMcs:32896
1621 *
1622 * This IOTCL used to get HTM
1623 *
1624 * @E.g: iwpriv wlan0 get_gtxHTMcs
1625 *
1626 * Supported Feature: STA
1627 *
1628 * Usage: Internal/External
1629 *
1630 * </ioctl>
1631 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001632#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301633/*
1634 * <ioctl>
1635 * get_gtxVHTMcs - Get the VHTM
1636 *
1637 * @INPUT: None
1638 *
1639 * @OUTPUT: VHTM
1640 * wlan0 get_gtxVHTMcs:524800
1641 *
1642 * This IOTCL used to get the VHTM
1643 *
1644 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1645 *
1646 * Supported Feature: STA
1647 *
1648 * Usage: Internal/External
1649 *
1650 * </ioctl>
1651 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001652#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301653/*
1654 * <ioctl>
1655 * get_gtxUsrCfg - Get the tx cfg
1656 *
1657 * @INPUT: None
1658 *
1659 * @OUTPUT: TXCFG
1660 * wlan0 get_gtxUsrCfg:32
1661 *
1662 * This IOTCL used to get the tx cfg
1663 *
1664 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1665 *
1666 * Supported Feature: STA
1667 *
1668 * Usage: Internal/External
1669 *
1670 * </ioctl>
1671 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001672#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301673/*
1674 * <ioctl>
1675 * get_gtxThre - Get the tx threshold
1676 *
1677 * @INPUT: None
1678 *
1679 * @OUTPUT: Threshold
1680 * wlan0 get_gtxThre:3
1681 *
1682 * This IOCTL is used to get tx threshold
1683 *
1684 * @E.g: iwpriv wlan0 get_gtxThre
1685 *
1686 * Supported Feature: STA
1687 *
1688 * Usage: Internal/External
1689 *
1690 * </ioctl>
1691 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001692#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301693/*
1694 * <ioctl>
1695 * get_gtxMargin - Get the tx margin
1696 *
1697 * @INPUT: None
1698 *
1699 * @OUTPUT: GTXMARGIN
1700 * wlan0 get_gtxMargin:2
1701 *
1702 * This IOCTL is used to set tx margin
1703 *
1704 * @E.g: iwpriv wlan0 get_gtxMargin
1705 *
1706 * Supported Feature: STA
1707 *
1708 * Usage: Internal/External
1709 *
1710 * </ioctl>
1711 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001712#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301713/*
1714 * <ioctl>
1715 * get_gtxStep - Get the tx step
1716 *
1717 * @INPUT: None
1718 *
1719 * @OUTPUT: GTXSTEP
1720 * wlan0 get_gtxStep:0
1721 *
1722 * This IOCTL is used to get the gtx step
1723 *
1724 * @E.g: iwpriv wlan0 get_gtxStep
1725 *
1726 * Supported Feature: STA
1727 *
1728 * Usage: Internal/External
1729 *
1730 * </ioctl>
1731 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001732#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301733/*
1734 * <ioctl>
1735 * get_gtxMinTpc - Get the tx miminum tpc
1736 *
1737 * @INPUT: None
1738 *
1739 * @OUTPUT: TPC
1740 * wlan0 get_gtxMinTpc:0
1741 *
1742 * This IOCTL is used to get tx miminum tpc
1743 *
1744 * @E.g: iwpriv wlan0 get_gtxMinTpc
1745 *
1746 * Supported Feature: STA
1747 *
1748 * Usage: Internal/External
1749 *
1750 * </ioctl>
1751 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001752#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301753/*
1754 * <ioctl>
1755 * get_gtxBWMask - Get the tx BW MASK
1756 *
1757 * @INPUT: None
1758 *
1759 * @OUTPUT: MASK
1760 * wlan0 get_gtxBWMask:15
1761 *
1762 * This IOCTL is used get gtx bw mask
1763 *
1764 * @E.g: iwpriv wlan0 get_gtxBWMask
1765 *
1766 * Supported Feature: STA
1767 *
1768 * Usage: Internal/External
1769 *
1770 * </ioctl>
1771 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001772#define WE_GET_GTX_BWMASK 54
1773#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001774#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001775#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001776
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001777/*
1778 * <ioctl>
1779 * get_dcm - Get dcm enablement value
1780 *
1781 * @INPUT: None
1782 *
1783 * @OUTPUT: 0/1
1784 * wlan0 get_dcm
1785 *
1786 * This IOCTL is used get dcm value
1787 *
1788 * Supported Feature: STA/SAP
1789 *
1790 * Usage: Internal
1791 *
1792 * </ioctl>
1793 */
1794#define WE_GET_DCM 60
1795
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001796/*
1797 * <ioctl>
1798 * get_dcm - Get range extension enablement value
1799 *
1800 * @INPUT: None
1801 *
1802 * @OUTPUT: 0/1
1803 * wlan0 get_range_ext
1804 *
1805 * This IOCTL is used get range_extension value
1806 *
1807 * Supported Feature: STA/SAP
1808 *
1809 * Usage: Internal
1810 *
1811 * </ioctl>
1812 */
1813#define WE_GET_RANGE_EXT 61
1814
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001815/* Private ioctls and their sub-ioctls */
1816#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1817
1818/* Private ioctls and their sub-ioctls */
1819#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1820#define WE_WOWL_ADD_PTRN 1
1821#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301822/*
1823 * <ioctl>
1824 * neighbor - Send neighbor report request
1825 *
1826 * @INPUT: string
1827 *
1828 * @OUTPUT: None
1829 *
1830 * This IOCTL create a Neighbor report request and send it to peer
1831 *
1832 * @E.g: iwpriv wlan0 neighbor "SSID"
1833 *
1834 * Supported Feature: 11k
1835 *
1836 * Usage: Internal/External
1837 *
1838 * </ioctl>
1839 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001840#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301841/*
1842 * <ioctl>
1843 * set_ap_wps_ie - Set the P2P IE of the probe response
1844 *
1845 * @INPUT: string
1846 *
1847 * @OUTPUT: None
1848 *
1849 * This IOCTL sets the P2P IE of the probe response
1850 *
1851 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1852 *
1853 * Supported Feature: STA
1854 *
1855 * Usage: Internal/External
1856 *
1857 * </ioctl>
1858 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001859#define WE_SET_AP_WPS_IE 4
Jeff Johnson0fcc94e2019-03-06 19:48:17 -08001860
1861/* 5 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001862
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07001863/*
1864 * <ioctl>
1865 * unit_test - execute component-level unit tests
1866 *
1867 * @INPUT: string - the name of the component to test.
1868 * All tests are executed if unspecified
1869 * @OUTPUT: None
1870 *
1871 * Usage: Internal only
1872 * </ioctl>
1873 */
1874#define WE_UNIT_TEST 6
1875
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001876/* Private ioctls and their sub-ioctls */
1877#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1878#define WE_SET_WLAN_DBG 1
1879#define WE_SET_DP_TRACE 2
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301880#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001881
1882/* Private ioctls and their sub-ioctls */
1883#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1884#define WE_WLAN_VERSION 1
1885#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301886/*
1887 * <ioctl>
1888 * getConfig - gets the values of all configurations listed in WCNSS
1889 *
1890 * @INPUT: None
1891 *
1892 * @OUTPUT: Current configuration to the sys log
1893 * wlan0 getConfig: WLAN configuration written to system log
1894 *
1895 * This IOCTL gets the values of all configurations listed in WCNSS
1896 *
1897 * @E.g: iwpriv wlan0 getConfig
1898 *
1899 * Supported Feature: STA
1900 *
1901 * Usage: Internal/External
1902 *
1903 * </ioctl>
1904 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001905#define WE_GET_CFG 3
1906#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301907/*
1908 * <ioctl>
1909 * getChannelList - Get the available channel list while in QCMobileAP
1910 *
1911 * @INPUT: None
1912 *
1913 * @OUTPUT: Channel list
1914 * wlan0 getChannelList:36 US 1..165
1915 *
1916 * This IOCTL gets the available channel list while in QCMobileAP
1917 *
1918 * @E.g: iwpriv wlan0 getChannelList
1919 *
1920 * Supported Feature: STA
1921 *
1922 * Usage: Internal/External
1923 *
1924 * </ioctl>
1925 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001926#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301927/*
1928 * <ioctl>
1929 * getRSSI - Get the Received Signal Strength Indicator
1930 *
1931 * @INPUT: None
1932 *
1933 * @OUTPUT: RSSI
1934 * wlan0 getRSSI:rsssi=-32
1935 *
1936 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1937 *
1938 * @E.g: iwpriv wlan0 getRSSI
1939 *
1940 * Supported Feature: STA
1941 *
1942 * Usage: Internal/External
1943 *
1944 * </ioctl>
1945 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001946#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001947
1948/*
1949 * <ioctl>
1950 * getSuspendStats - Get suspend/resume stats
1951 *
1952 * @INPUT: None
1953 *
1954 * @OUTPUT: character string containing formatted suspend/resume stats
1955 *
1956 * This ioctl is used to get suspend/resume stats formatted for display.
1957 * Currently it includes suspend/resume counts, wow wake up reasons, and
1958 * suspend fail reasons.
1959 *
1960 * @E.g: iwpriv wlan0 getSuspendStats
1961 * iwpriv wlan0 getSuspendStats
1962 *
1963 * Supported Feature: suspend/resume
1964 *
1965 * Usage: Internal
1966 *
1967 * </ioctl>
1968 */
1969#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001970#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05301971/*
1972 * <ioctl>
1973 * getTdlsPeers - Get all TDLS peers.
1974 *
1975 * @INPUT: None
1976 *
1977 * @OUTPUT: Returns the MAC address of all the TDLS peers
1978 * wlan0 getTdlsPeers:
1979 * MAC Id cap up RSSI
1980 * ---------------------------------
1981 * 00:0a:f5:0e:bd:18 2 Y Y -44
1982 * 00:0a:f5:bf:0e:12 0 N N 0
1983 *
1984 * This IOCTL is used to get all TDLS peers.
1985 *
1986 * @E.g: iwpriv wlan0 getTdlsPeers
1987 *
1988 * Supported Feature: TDLS
1989 *
1990 * Usage: Internal/External
1991 *
1992 * </ioctl>
1993 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001994#define WE_GET_TDLS_PEERS 8
1995#endif
1996#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05301997/*
1998 * <ioctl>
1999 * getPMFInfo - get the PMF info of the connected session
2000 *
2001 * @INPUT: None
2002 *
2003 * @OUTPUT:
2004 * wlan0 getPMFInfo:
2005 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
2006 * Number of Unprotected Disassocs 0
2007 * Number of Unprotected Deauths 0
2008 *
2009 * This IOCTL is used to get the PMF stats/status of the current
2010 * connection.
2011 *
2012 * @e.g:iwpriv wlan0 getPMFInfo
2013 *
2014 * Supported Feature: PMF
2015 *
2016 * Usage: Internal/External
2017 *
2018 * </ioctl>
2019 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002020#define WE_GET_11W_INFO 9
2021#endif
2022#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05302023/*
2024 * <ioctl>
2025 * getIbssSTAs - get ibss sta info
2026 *
2027 * @INPUT: None
2028 *
2029 * @OUTPUT: Give the MAC of the IBSS STA
2030 * wlan0 getIbssSTAs:
2031 * 1 .8c:fd:f0:01:9c:bf
2032 *
2033 * This IOCTL is used to get ibss sta info
2034 *
2035 * @E.g: iwpriv wlan0 getIbssSTAs
2036 *
2037 * Supported Feature: IBSS
2038 *
2039 * Usage: Internal/External
2040 *
2041 * </ioctl>
2042 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002043#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302044/*
2045 * <ioctl>
2046 * getphymode - Get the current phymode.
2047 *
2048 * @INPUT: None
2049 *
2050 * @OUTPUT: In phymode
2051 * wlan0 getphymode:AUTO MODE
2052 *
2053 * This IOCTL used to gets the current phymode.
2054 *
2055 * @E.g: iwpriv wlan0 getphymode
2056 *
2057 * Supported Feature: STA
2058 *
2059 * Usage: Internal/External
2060 *
2061 * </ioctl>
2062 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002063#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002064
2065/*
2066 * <ioctl>
2067 * getOemDataCap - Get the oem data caps.
2068 *
2069 * @INPUT: None
2070 *
2071 * @OUTPUT: oem data capability
2072 *
2073 * This IOCTL used to gets the current oem data cap.
2074 *
2075 * @E.g: iwpriv wlan0 getOemDataCap
2076 *
2077 * Usage: Internal/External
2078 *
2079 * </ioctl>
2080 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002081#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002082
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302083/*
2084 * <ioctl>
2085 * getSNR - Enable SNR Monitoring
2086 *
2087 * @INPUT: None
2088 *
2089 * @OUTPUT: Signal strength/ratio
2090 * wlan0 getSNR:1
2091 *
2092 * This IOCTL is used to get ibss sta info
2093 *
2094 * @E.g: iwpriv wlan0 getSNR
2095 *
2096 * Supported Feature: STA
2097 *
2098 * Usage: Internal/External
2099 *
2100 * </ioctl>
2101 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002102
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002103#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302104#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002105
Krunal Soni6c3859f2018-06-01 19:57:40 -07002106/*
2107 * <ioctl>
2108 *
2109 * get_ba_timeout - to get timeout for each AC
2110 *
2111 * @INPUT: None
2112 *
2113 * @OUTPUT: displays timeout value for each access class
2114 *
2115 * @E.g.: iwpriv wlan0 get_ba_timeout
2116 *
2117 * Usage: Internal
2118 *
2119 * </ioctl>
2120 */
2121#define WE_GET_BA_AGEING_TIMEOUT 16
2122
Krunal Soni5e483782018-10-25 15:42:44 -07002123/*
2124 * <ioctl>
2125 *
2126 * sta_cxn_info - STA connection information
2127 *
2128 * @INPUT: none
2129 *
2130 * @OUTPUT: STA's connection information
2131 *
2132 * This IOCTL is used to get connection's information.
2133 *
2134 * @E.g: iwpriv wlan0 get_cxn_info
2135 *
2136 * Usage: Internal
2137 *
2138 * </ioctl>
2139 */
2140#define WE_GET_STA_CXN_INFO 17
2141
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002142/* Private ioctls and their sub-ioctls */
2143#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302144
2145/*
2146 * <ioctl>
2147 * reassoc - Trigger STA re-association to the connected AP
2148 *
2149 * @INPUT: None
2150 *
2151 * @OUTPUT: None
2152 *
2153 * This IOCTL is used to trigger STA reassociation to the connected AP.
2154 *
2155 * @E.g: iwpriv wlan0 reassoc
2156 *
2157 * Supported Feature: Roaming
2158 *
2159 * Usage: Internal
2160 *
2161 * </ioctl>
2162 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002163#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302164/*
2165 * <ioctl>
2166 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2167 *
2168 * @INPUT: None
2169 *
2170 * @OUTPUT: print ibss peer in info logs
Jeff Johnson52f19d52019-02-26 08:35:38 -08002171 * peer_info->numIBSSPeers = 1
Abhishek Singh49b654e2016-12-01 16:11:17 +05302172 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2173 *
2174 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2175 * in info logs
2176 *
2177 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2178 *
2179 * Supported Feature: IBSS
2180 *
2181 * Usage: Internal/External
2182 *
2183 * </ioctl>
2184 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002185#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002186/* Sub ioctls 11 to 16 are not used */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002187#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302188/*
2189 * <ioctl>
2190 * stop_obss_scan - Stop obss scan
2191 *
2192 * @INPUT: None
2193 *
2194 * @OUTPUT: None
2195 *
2196 * This IOCTL is used to stop obss scan
2197 *
2198 * @E.g: iwpriv wlan0 stop_obss_scan
2199 *
2200 * Supported Feature: Scan
2201 *
2202 * Usage: Internal/External
2203 *
2204 * </ioctl>
2205 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002206#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002207
2208/* Private ioctls and their sub-ioctls */
2209#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2210
2211#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302212/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002213
Manjeet Singhf82ed072016-07-08 11:40:00 +05302214#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002215
Kabilan Kannan6894e6a2017-11-09 14:37:55 -08002216/* subcommand 5 is unused */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302217
Abhishek Singh49b654e2016-12-01 16:11:17 +05302218/*
2219 * <ioctl>
2220 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2221 *
Jeff Johnson0a082d92019-03-04 12:25:49 -08002222 * @INPUT: sta_id
Abhishek Singh49b654e2016-12-01 16:11:17 +05302223 *
Jeff Johnson0a082d92019-03-04 12:25:49 -08002224 * @OUTPUT: print ibss peer corresponding to sta_id in info logs
Abhishek Singh49b654e2016-12-01 16:11:17 +05302225 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2226 *
2227 * This IOCTL is used to print the specific ibss peers's MAC,
2228 * rate and RSSI in info logs
2229 *
2230 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2231 * iwpriv wlan0 ibssPeerInfo 0
2232 *
2233 * Supported Feature: IBSS
2234 *
2235 * Usage: Internal/External
2236 *
2237 * </ioctl>
2238 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002239#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002240#define WE_UNIT_TEST_CMD 7
2241
2242#define WE_MTRACE_DUMP_CMD 8
2243#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2244
2245
2246#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2247#define WE_LED_FLASHING_PARAM 10
2248#endif
2249
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302250/*
2251 * <ioctl>
2252 * pm_clist - Increments the index value of the concurrent connection list
2253 * and update with the input parameters provided.
2254 *
2255 * @INPUT: Following 8 arguments:
2256 * @vdev_id: vdev id
2257 * @tx_streams: TX streams
2258 * @rx_streams: RX streams
2259 * @chain_mask: Chain mask
2260 * @type: vdev_type
2261 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2262 * @sub_type: vdev_subtype
2263 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2264 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2265 * @channel: Channel
2266 * @mac: Mac id
2267 *
2268 * @OUTPUT: None
2269 *
2270 * This IOCTL is used to increments the index value of the concurrent connection
2271 * list and update with the input parameters provided.
2272 *
2273 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2274 * sub_type channel mac
2275 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2276 *
2277 * Supported Feature: DBS
2278 *
2279 * Usage: Internal/External
2280 *
2281 * </ioctl>
2282 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002283#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302284
2285/*
2286 * <ioctl>
2287 * pm_dlist - Delete the index from the concurrent connection list that is
2288 * present in the given vdev_id.
2289 *
2290 * @INPUT: delete_all, vdev_id
2291 * @delete_all: delete all indices
2292 * @vdev_id: vdev id
2293 *
2294 * @OUTPUT: None
2295 *
2296 * This IOCTL is used to delete the index from the concurrent connection list
2297 * that is present in the given vdev_id.
2298 *
2299 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2300 * iwpriv wlan0 pm_dlist 0 1
2301 *
2302 * Supported Feature: DBS
2303 *
2304 * Usage: Internal/External
2305 *
2306 * </ioctl>
2307 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002308#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302309
2310/*
2311 * <ioctl>
2312 * pm_dbs - Set dbs capability and system preference
2313 *
2314 * @INPUT: dbs, system_pref
2315 * @dbs: Value of DBS capability to be set
2316 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002317 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302318 *
2319 * @OUTPUT: None
2320 *
2321 * This IOCTL is used to set dbs capability and system preference.
2322 *
2323 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2324 * iwpriv wlan0 pm_dbs 1 0
2325 *
2326 * Supported Feature: DBS
2327 *
2328 * Usage: Internal/External
2329 *
2330 * </ioctl>
2331 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002332#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302333
2334/*
2335 * <ioctl>
2336 * pm_pcl - Set pcl for concurrency mode.
2337 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002338 * @INPUT: policy_mgr_con_mode
2339 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302340 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2341 *
2342 * @OUTPUT: None
2343 *
2344 * This IOCTL is used to set pcl for concurrency mode.
2345 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002346 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302347 * iwpriv wlan0 pm_pcl 0
2348 *
2349 * Supported Feature: DBS
2350 *
2351 * Usage: Internal/External
2352 *
2353 * </ioctl>
2354 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002355#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302356
2357/*
2358 * <ioctl>
2359 * pm_cinfo - Shows the concurrent connection list.
2360 *
2361 * @INPUT: None
2362 *
2363 * @OUTPUT: None
2364 *
2365 * This IOCTL is used to show the concurrent connection list.
2366 *
2367 * @E.g: iwpriv wlan0 pm_cinfo
2368 *
2369 * Supported Feature: DBS
2370 *
2371 * Usage: Internal/External
2372 *
2373 * </ioctl>
2374 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002375#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302376
2377/*
2378 * <ioctl>
2379 * pm_ulist - Updates the index value of the concurrent connection list
2380 * with the input parameters provided.
2381 *
2382 * @INPUT: Following 8 arguments:
2383 * @vdev_id: vdev id
2384 * @tx_streams: TX streams
2385 * @rx_streams: RX streams
2386 * @chain_mask: Chain mask
2387 * @type: vdev_type
2388 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2389 * @sub_type: vdev_subtype
2390 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2391 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2392 * @channel: Channel
2393 * @mac: Mac id
2394 *
2395 * @OUTPUT: None
2396 *
2397 * This IOCTL is used to updates the index value of the concurrent
2398 * connection list with the input parameters provided.
2399 *
2400 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2401 * sub_type channel mac
2402 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2403 *
2404 * Supported Feature: DBS
2405 *
2406 * Usage: Internal/External
2407 *
2408 * </ioctl>
2409 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002410#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302411
2412/*
2413 * <ioctl>
2414 * pm_query_action - Initiate actions needed on current connections as
2415 * per the channel provided.
2416 *
2417 * @INPUT: channel
2418 * @channel: Channel on which new connection will be.
2419 *
2420 * @OUTPUT: None
2421 *
2422 * This IOCTL is used to initiate actions needed on current connections
2423 * as per the channel provided.
2424 *
2425 * @E.g: iwpriv wlan0 pm_query_action channel
2426 * iwpriv wlan0 pm_query_action 6
2427 *
2428 * Supported Feature: DBS
2429 *
2430 * Usage: Internal/External
2431 *
2432 * </ioctl>
2433 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002434#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302435
2436/*
2437 * <ioctl>
2438 * pm_query_allow - Checks for allowed concurrency combination
2439 *
2440 * @INPUT: mode, channel, bandwidth
2441 * @mode: new connection mode
2442 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2443 * @channel: channel on which new connection is coming up
2444 * @bandwidth: Bandwidth requested by the connection
2445 * 0:None 1:5MHz 2:10MHz 3:20MHz
2446 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2447 *
2448 * @OUTPUT: None
2449 *
2450 * This IOCTL is used to checks for allowed concurrency combination.
2451 *
2452 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2453 * iwpriv wlan0 pm_query_allow 0 6 4
2454 *
2455 * Supported Feature: DBS
2456 *
2457 * Usage: Internal/External
2458 *
2459 * </ioctl>
2460 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002461#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302462
2463/*
2464 * <ioctl>
2465 * pm_run_scenario - Create scenario with number of connections provided.
2466 *
2467 * @INPUT: num_of_conn
2468 * @num_of_conn: the number of connections (values: 1~3)
2469 *
2470 * @OUTPUT: None
2471 *
2472 * This IOCTL is used to create scenario with the number of connections
2473 * provided.
2474 *
2475 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2476 * iwpriv wlan0 pm_run_scenario 1
2477 *
2478 * Supported Feature: DBS
2479 *
2480 * Usage: Internal/External
2481 *
2482 * </ioctl>
2483 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002484#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302485
2486/*
2487 * <ioctl>
2488 * pm_set_hw_mode - Set hardware for single/dual mac.
2489 *
2490 * @INPUT: hw_mode
2491 * 0:single mac 1:dual mac
Liangwei Dong509c3472018-05-30 07:05:59 -04002492 * 2: 2x2 5g + 1x1 2g dbs mode
2493 * 3: 2x2 2g + 1x1 5g dbs mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302494 *
2495 * @OUTPUT: None
2496 *
2497 * This IOCTL is used to set hardware for single/dual mac.
2498 *
2499 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2500 * iwpriv wlan0 pm_set_hw_mode 1
2501 *
2502 * Supported Feature: DBS
2503 *
2504 * Usage: Internal/External
2505 *
2506 * </ioctl>
2507 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002508#define WE_POLICY_SET_HW_MODE_CMD 20
2509
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302510/*
2511 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002512 * ch_avoid - unit test SAP channel avoidance
2513 *
2514 * @INPUT: chan avoid ranges
2515 *
2516 * @OUTPUT: none
2517 *
2518 * This IOCTL is used to fake a channel avoidance event.
2519 * To test SAP/GO chan switch during chan avoid event process.
2520 *
2521 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2522 *
2523 * Supported Feature: SAP chan avoidance.
2524 *
2525 * Usage: Internal
2526 *
2527 * </ioctl>
2528 */
2529#define WE_SET_CHAN_AVOID 21
2530
2531/*
2532 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302533 * set_scan_cfg - Set dual MAC scan config parameters.
2534 *
2535 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2536 * @dbs: Value of DBS bit
2537 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2538 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2539 *
2540 * @OUTPUT: None
2541 *
2542 * This IOCTL is used to set the dual MAC scan config.
2543 *
2544 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2545 * single_mac_scan_with_dbs
2546 * iwpriv wlan0 set_scan_cfg 1 0 1
2547 *
2548 * Supported Feature: DBS
2549 *
2550 * Usage: Internal/External
2551 *
2552 * </ioctl>
2553 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002554#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302555
2556/*
2557 * <ioctl>
2558 * set_fw_mode_cfg - Sets the dual mac FW mode config
2559 *
2560 * @INPUT: dbs, dfs
2561 * @dbs: DBS bit
2562 * @dfs: Agile DFS bit
2563 *
2564 * @OUTPUT: None
2565 *
2566 * This IOCTL is used to set the dual mac FW mode config.
2567 *
2568 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2569 * iwpriv wlan0 set_fw_mode_cfg 1 1
2570 *
2571 * Supported Feature: DBS
2572 *
2573 * Usage: Internal/External
2574 *
2575 * </ioctl>
2576 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002577#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002578#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002579/*
2580 * <ioctl>
2581 * txrx_stats - TXRX statistics query
2582 *
2583 * @INPUT: query category, mac id (default mac id is 0)
2584 *
2585 * @OUTPUT: TXRX statistics result
2586 *
2587 * This IOCTL is used to get TXRX statistics counters.
2588 *
2589 * @E.g: iwpriv wlan0 txrx_stats 21 0
2590 * iwpriv wlan0 txrx_stats 21 1
2591 *
2592 * Usage: Internal
2593 *
2594 * </ioctl>
2595 */
2596#define WE_SET_TXRX_STATS 24
2597
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002598
2599#ifdef FEATURE_WLAN_TDLS
2600#undef MAX_VAR_ARGS
2601#define MAX_VAR_ARGS 11
2602#else
2603#undef MAX_VAR_ARGS
2604#define MAX_VAR_ARGS 9
2605#endif
2606
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302607#ifdef WLAN_FEATURE_MOTION_DETECTION
2608#undef MAX_VAR_ARGS
2609#define MAX_VAR_ARGS 15
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302610#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302611#define WE_MOTION_DET_CONFIG_PARAM 25
2612#define WE_MOTION_DET_BASE_LINE_CONFIG_PARAM 26
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302613
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302614#define WE_SET_THERMAL_THROTTLE_CFG 27
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002615/*
2616 * <ioctl>
2617 * fips_test - Perform a FIPS test
2618 *
2619 * @INPUT: Binary representation of the following packed structure
2620 *
2621 * @OUTPUT: Binary representation of the following packed structure
2622 *
2623 * This IOCTL is used to perform FIPS certification testing
2624 *
2625 * @E.g: iwpriv wlan0 fips_test <test vector>
2626 *
2627 * iwpriv wlan0 fips_test <tbd>
2628 *
2629 * Supported Feature: FIPS
2630 *
2631 * Usage: Internal
2632 *
2633 * </ioctl>
2634 */
2635#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2636
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002637/* Private ioctls (with no sub-ioctls) */
2638/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302639/*
2640 * <ioctl>
2641 * addTspec - Add TSPEC for each AC
2642 *
2643 * @INPUT: 19 TSPEC params
2644 * @[arg0]: handle
2645 * @[arg1]: tid
2646 * @[arg2]: dir
2647 * @[arg3]: psb
2648 * @[arg4]: up
2649 * @[arg5]: nomMsduSize
2650 * @[arg6]: maxMsduSize
2651 * @[arg7]: minDataRate
2652 * @[arg8]: meanDataRate
2653 * @[arg9]: peakDataRate
2654 * @[arg10]: maxBurstSize
2655 * @[arg11]: minPhyRate
2656 * @[arg12]: sba
2657 * @[arg13]: minServiceIntv
2658 * @[arg14]: suspendIntv
2659 * @[arg15]: burstSizeDefn
2660 * @[arg16]: ackPolicy
2661 * @[arg17]: inactivityPeriod
2662 * @[arg18]: maxServiceIntv
2663 *
2664 * @OUTPUT: Success/Failure
2665 *
2666 * This IOCTL is used to add TSPEC for each AC.
2667 *
2668 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2669 * <maxMsduSize> <minDataRate> <meanDataRate>
2670 * <peakDataRate> <maxBurstSize> <minPhyRate>
2671 * <sba> <minServiceIntv> <suspendIntv>
2672 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2673 * <maxServiceIntv>
2674 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2675 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2676 * wlan0 addTspec:3
2677 *
2678 * Supported Feature: WMM
2679 *
2680 * Usage: Internal/External
2681 *
2682 * </ioctl>
2683 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002684#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302685/*
2686 * <ioctl>
2687 * delTspec - Delete TSPEC entry for each AC
2688 *
2689 * @INPUT: 1 TSPEC param
2690 * @[arg0]: handle
2691 *
2692 * @OUTPUT: Success/Failure
2693 *
2694 * This IOCTL is used to delete TSPEC entry for each AC.
2695 *
2696 * @E.g: iwpriv wlan0 delTspec <handle>
2697 * iwpriv wlan0 delTspec 7001
2698 * wlan0 delTspec:16
2699 *
2700 * Supported Feature: WMM
2701 *
2702 * Usage: Internal/External
2703 *
2704 * </ioctl>
2705 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002706#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302707/*
2708 * <ioctl>
2709 * getTspec - Get TSPEC entry for each AC
2710 *
2711 * @INPUT: 1 TSPEC param
2712 * @[arg0]: handle
2713 *
2714 * @OUTPUT: Success/Failure
2715 *
2716 * This IOCTL is used to get TSPEC entry for each AC.
2717 *
2718 * @E.g: iwpriv wlan0 getTspec <handle>
2719 * iwpriv wlan0 getTspec 7001
2720 * wlan0 delTspec:18
2721 *
2722 * Supported Feature: WMM
2723 *
2724 * Usage: Internal/External
2725 *
2726 * </ioctl>
2727 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002728#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2729
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002730/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2731/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2732/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002733#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2734#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002735/* (SIOCIWFIRSTPRIV + 16) is currently unused */
Krunal Sonif9ba53d2019-01-03 21:44:41 -08002736
2737#ifdef FEATURE_WLM_STATS
2738/*
2739 * <ioctl>
2740 *
2741 * get_wlm_stats - Get stats from FW for game latency
2742 *
2743 * @INPUT: BITMASK inform of decimal number
2744 *
2745 * @OUTPUT: HEX string given by FW
2746 *
2747 * This IOCTL is used to get game latency related STATS from FW
2748 *
2749 * @E.g.: iwpriv wlan0 get_wlm_stats 1
2750 *
2751 * Usage: internal
2752 *
2753 * </ioctl>
2754 */
2755#define WLAN_GET_WLM_STATS (SIOCIWFIRSTPRIV + 17)
2756#endif
2757
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002758/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2759
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002760#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002761
2762/* Private ioctl for setting the host offload feature */
2763#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2764
2765/* Private ioctl to get the statistics */
2766#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2767
2768/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302769/*
2770 * <ioctl>
2771 * setKeepAlive - Set the keep alive feature
2772 *
2773 * @INPUT: 28 bytes of information in the order of packet type, time period
2774 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2775 *
2776 * @OUTPUT: None
2777 *
2778 * This IOCTL sets the keep alive feature to send either NULL
2779 * or unsolicited ARP response packets
2780 *
2781 * @E.g: iwpriv wlan0 setKeepAlive
2782 *
2783 * Supported Feature: STA
2784 *
2785 * Usage: Internal/External
2786 *
2787 * </ioctl>
2788 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002789#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2790
2791#ifdef WLAN_FEATURE_PACKET_FILTERING
2792/* Private ioctl to set the packet filtering params */
2793#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2794#endif
2795
2796
2797#ifdef FEATURE_WLAN_SCAN_PNO
2798/* Private ioctl to get the statistics */
2799#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2800#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302801/*
2802 * <ioctl>
2803 * SETBAND - Set the operational band
2804 *
2805 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2806 *
2807 * @OUTPUT: None
2808 *
2809 * This IOCTL Set the operational band If the new band is different from the
2810 * current operational band, it aborts the pending scan requests, flushes
2811 * the existing scan results, and then change * the band capability
2812 *
2813 * @E.g: iwpriv wlan0 SETBAND <value>
2814 *
2815 * Supported Feature: STA
2816 *
2817 * Usage: Internal/External
2818 *
2819 * </ioctl>
2820 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002821#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2822
Dustin Brown0cbc7572016-12-16 13:54:40 -08002823#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002824/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002825
2826/* Private ioctls and their sub-ioctls */
2827#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2828#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002829#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002830#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302831/* Private sub ioctl for enabling and setting histogram interval of profiling */
2832#define WE_ENABLE_FW_PROFILE 4
2833#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002834
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002835/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002836#define WE_SET_WLAN_SUSPEND 6
2837#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002838
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002839/*
2840 * <ioctl>
2841 * log_buffer - prints host/target related communication logs via dmesg
2842 *
2843 * @INPUT: Log Id, Count
2844 *
2845 * Log Id:
2846 * 0) HTC_CREDIT_HISTORY_LOG
2847 * 1) COMMAND_LOG,
2848 * 2) COMMAND_TX_CMP_LOG,
2849 * 3) MGMT_COMMAND_LOG,
2850 * 4) MGMT_COMMAND_TX_CMP_LOG,
2851 * 5) EVENT_LOG,
2852 * 6) RX_EVENT_LOG,
2853 * 7) MGMT_EVENT_LOG
2854 *
2855 * @OUTPUT: None
2856 *
2857 * @E.g:
2858 * # print up to 10 of the most recent records from HTC Credit History
2859 * iwpriv wlan0 log_buffer 0 10
2860 * # print up to 3 of the most recent records from Event Log
2861 * iwpriv wlan0 log_buffer 5 3
2862 *
2863 * Supported Feature: WLAN Trace
2864 *
2865 * Usage: Internal/External
2866 *
2867 * </ioctl>
2868 */
2869#define WE_LOG_BUFFER 8
2870
Krunal Soni6c3859f2018-06-01 19:57:40 -07002871/*
2872 * <ioctl>
2873 * set_ba_timeout - sets Block ACK aging timeout value for each Access class
2874 *
2875 * @INPUT: Access Class [0:BK, 1:BE, 2:VI, 3:VO], Timeout value
2876 *
2877 * @OUTPUT: None
2878 *
2879 * @E.g.:
2880 * # to set duration of 2 seconds for BE
2881 * iwpriv wlan0 set_ba_timeout 1 2
2882 * # to set duration of 3 seconds for VO
2883 * iwpriv wlan0 set_ba_timeout 3 3
2884 *
2885 * Usage: Internal
2886 *
2887 * </ioctl>
2888 */
2889#define WE_SET_BA_AGEING_TIMEOUT 9
2890
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002891enum host_target_comm_log {
2892 HTC_CREDIT_HISTORY_LOG = 0,
2893 COMMAND_LOG,
2894 COMMAND_TX_CMP_LOG,
2895 MGMT_COMMAND_LOG,
2896 MGMT_COMMAND_TX_CMP_LOG,
2897 EVENT_LOG,
2898 RX_EVENT_LOG,
2899 MGMT_EVENT_LOG
2900};
2901
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002902/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2903
2904/* 802.11p IOCTL */
2905#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2906
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302907/*
2908 * <ioctl>
2909 * getLinkSpeed - Gets the current link speed in Mbps
2910 *
2911 * @INPUT: None
2912 *
2913 * @OUTPUT: linkspeed in mbps
2914 * wlan0 getLinkSpeed:7
2915 *
2916 * This IOCTL is used get the current link speed in Mbps
2917 *
2918 * @E.g: iwpriv wlan0 getLinkSpeed
2919 *
2920 * Supported Feature: STA
2921 *
2922 * Usage: Internal/External
2923 *
2924 * </ioctl>
2925 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002926#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2927
2928#define WLAN_STATS_INVALID 0
2929#define WLAN_STATS_RETRY_CNT 1
2930#define WLAN_STATS_MUL_RETRY_CNT 2
2931#define WLAN_STATS_TX_FRM_CNT 3
2932#define WLAN_STATS_RX_FRM_CNT 4
2933#define WLAN_STATS_FRM_DUP_CNT 5
2934#define WLAN_STATS_FAIL_CNT 6
2935#define WLAN_STATS_RTS_FAIL_CNT 7
2936#define WLAN_STATS_ACK_FAIL_CNT 8
2937#define WLAN_STATS_RTS_SUC_CNT 9
2938#define WLAN_STATS_RX_DISCARD_CNT 10
2939#define WLAN_STATS_RX_ERROR_CNT 11
2940#define WLAN_STATS_TX_BYTE_CNT 12
2941
2942#define WLAN_STATS_RX_BYTE_CNT 13
2943#define WLAN_STATS_RX_RATE 14
2944#define WLAN_STATS_TX_RATE 15
2945
2946#define WLAN_STATS_RX_UC_BYTE_CNT 16
2947#define WLAN_STATS_RX_MC_BYTE_CNT 17
2948#define WLAN_STATS_RX_BC_BYTE_CNT 18
2949#define WLAN_STATS_TX_UC_BYTE_CNT 19
2950#define WLAN_STATS_TX_MC_BYTE_CNT 20
2951#define WLAN_STATS_TX_BC_BYTE_CNT 21
2952
2953#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2954 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2955 *__p++ = __type; \
2956 *__p++ = __size; \
2957 memcpy(__p, __val, __size); \
2958 __p += __size; \
2959 __tlen += __size + 2; \
2960 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002961 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002962 } \
2963 } while (0)
2964
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002965#define TX_PER_TRACKING_DEFAULT_RATIO 5
2966#define TX_PER_TRACKING_MAX_RATIO 10
2967#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2968
2969#define WLAN_ADAPTER 0
2970#define P2P_ADAPTER 1
2971
2972/**
2973 * mem_alloc_copy_from_user_helper - copy from user helper
2974 * @wrqu_data: wireless extensions request data
2975 * @len: length of @wrqu_data
2976 *
2977 * Helper function to allocate buffer and copy user data.
2978 *
2979 * Return: On success return a pointer to a kernel buffer containing a
2980 * copy of the userspace data (with an additional NUL character
2981 * appended for safety). On failure return %NULL.
2982 */
2983void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2984{
2985 u8 *ptr = NULL;
2986
2987 /* in order to protect the code, an extra byte is post
2988 * appended to the buffer and the null termination is added.
2989 * However, when allocating (len+1) byte of memory, we need to
2990 * make sure that there is no uint overflow when doing
2991 * addition. In theory check len < UINT_MAX protects the uint
2992 * overflow. For wlan private ioctl, the buffer size is much
2993 * less than UINT_MAX, as a good guess, now, it is assumed
2994 * that the private command buffer size is no greater than 4K
2995 * (4096 bytes). So we use 4096 as the upper boundary for now.
2996 */
2997 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002998 hdd_err("Invalid length: %zu max: %u",
2999 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003000 return NULL;
3001 }
3002
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07003003 ptr = qdf_mem_malloc(len + 1);
Jeff Johnsond36fa332019-03-18 13:42:25 -07003004 if (!ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003005 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003006 return NULL;
3007 }
3008
3009 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003010 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07003011 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003012 return NULL;
3013 }
3014 ptr[len] = '\0';
3015 return ptr;
3016}
3017
3018/**
3019 * hdd_priv_get_data() - Get pointer to ioctl private data
3020 * @p_priv_data: pointer to iw_point struct to be filled
3021 * @wrqu: Pointer to IOCTL Data received from userspace
3022 *
3023 * Helper function to get compatible struct iw_point passed to ioctl
3024 *
3025 * Return - 0 if p_priv_data successfully filled, error otherwise
3026 */
3027int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
3028{
Jeff Johnsond36fa332019-03-18 13:42:25 -07003029 if ((!p_priv_data) || (!wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003030 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003031
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003032#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07003033 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003034 struct compat_iw_point *p_compat_priv_data;
3035
3036 /* Compat task:
3037 * typecast to compat structure and copy the members.
3038 */
3039 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
3040
3041 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
3042 p_priv_data->length = p_compat_priv_data->length;
3043 p_priv_data->flags = p_compat_priv_data->flags;
3044 } else {
3045#endif /* #ifdef CONFIG_COMPAT */
3046
3047 /* Non compat task: directly copy the structure. */
3048 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
3049
3050#ifdef CONFIG_COMPAT
3051 }
3052#endif /* #ifdef CONFIG_COMPAT */
3053
3054 return 0;
3055}
3056
Jeff Johnson441e1f72017-02-07 08:50:49 -08003057static int hdd_check_wext_control(enum hdd_wext_control wext_control,
3058 struct iw_request_info *info)
3059{
3060 switch (wext_control) {
3061 default:
3062 case hdd_wext_disabled:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003063 hdd_err_rl("Rejecting disabled ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003064 return -ENOTSUPP;
3065 case hdd_wext_deprecated:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003066 hdd_warn_rl("Using deprecated ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003067 return 0;
3068 case hdd_wext_enabled:
3069 return 0;
3070 }
3071}
3072
Jeff Johnson82797b62017-08-11 15:31:27 -07003073int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08003074 struct iw_request_info *info)
3075{
3076 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
3077 info);
3078}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003079
3080/**
3081 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003082 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003083 * @length: Size of the data copied
3084 * @buffer: Pointer to char buffer.
3085 * @buf_len: Length of the char buffer.
3086 *
3087 * This function called when the "iwpriv wlan0 get_stats" command is given.
3088 * It used to collect the txrx stats when the device is configured in SAP mode.
3089 *
3090 * Return - none
3091 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003092void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003093 char *buffer, uint16_t buf_len)
3094{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003095 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003096 uint32_t len = 0;
3097 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
3098 uint32_t total_rx_delv = 0, total_rx_refused = 0;
3099 int i = 0;
Mohit Khanna81418772018-10-30 14:14:46 -07003100 struct hdd_context *hdd_ctx = adapter->hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003101
3102 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003103 total_rx_pkt += stats->rx_packets[i];
3104 total_rx_dropped += stats->rx_dropped[i];
3105 total_rx_delv += stats->rx_delivered[i];
3106 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003107 }
3108
3109 len = scnprintf(buffer, buf_len,
Mohit Khanna81418772018-10-30 14:14:46 -07003110 "\nTransmit[%lu] - "
3111 "called %u, dropped %u orphan %u,"
3112 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
3113 "\n[classified] BK %u, BE %u, VI %u, VO %u"
3114 "\n\nReceive[%lu] - "
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003115 "packets %u, dropped %u, unsolict_arp_n_mcast_drp %u, delivered %u, refused %u\n"
Mohit Khanna81418772018-10-30 14:14:46 -07003116 "GRO - agg %u non-agg %u flushes(%u %u) disabled(conc %u low-tput %u)\n",
3117 qdf_system_ticks(),
3118 stats->tx_called,
3119 stats->tx_dropped,
3120 stats->tx_orphaned,
3121 stats->tx_dropped_ac[SME_AC_BK],
3122 stats->tx_dropped_ac[SME_AC_BE],
3123 stats->tx_dropped_ac[SME_AC_VI],
3124 stats->tx_dropped_ac[SME_AC_VO],
3125 stats->tx_classified_ac[SME_AC_BK],
3126 stats->tx_classified_ac[SME_AC_BE],
3127 stats->tx_classified_ac[SME_AC_VI],
3128 stats->tx_classified_ac[SME_AC_VO],
3129 qdf_system_ticks(),
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003130 total_rx_pkt, total_rx_dropped,
3131 qdf_atomic_read(&stats->rx_usolict_arp_n_mcast_drp),
3132 total_rx_delv,
Mohit Khanna81418772018-10-30 14:14:46 -07003133 total_rx_refused,
3134 stats->rx_aggregated, stats->rx_non_aggregated,
3135 stats->rx_gro_flushes,
3136 stats->rx_gro_force_flushes,
3137 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_concurrency),
3138 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_low_tput));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003139
3140 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003141 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003142 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003143 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna81418772018-10-30 14:14:46 -07003144 "Rx CPU[%d]:"
3145 "packets %u, dropped %u, delivered %u, refused %u\n",
3146 i, stats->rx_packets[i], stats->rx_dropped[i],
3147 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003148 }
3149
3150 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003151 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003152 "\nCurrent status: %s"
3153 "\ntx-flow timer start count %u"
3154 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003155 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3156 stats->txflow_timer_cnt,
3157 stats->txflow_pause_cnt,
3158 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003159
Leo Changfdb45c32016-10-28 11:09:23 -07003160 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003161 adapter->vdev_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003162 *length = len + 1;
3163}
3164
3165/**
Dustin Brownd9322482017-01-09 12:46:03 -08003166 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3167 * @hdd_ctx: The Hdd context owning the stats to be written
3168 * @buffer: The char buffer to write to
3169 * @max_len: The maximum number of chars to write
3170 *
3171 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3172 *
3173 * Return - length of written content, negative number on error
3174 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003175#ifdef QCA_SUPPORT_CP_STATS
3176static 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}
3213#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003214static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
Dustin Brownd9322482017-01-09 12:46:03 -08003215 char *buffer, uint16_t max_len)
3216{
3217 QDF_STATUS status;
3218 struct suspend_resume_stats *sr_stats;
3219 struct sir_wake_lock_stats wow_stats;
3220
3221 sr_stats = &hdd_ctx->suspend_resume_stats;
3222
3223 status = wma_get_wakelock_stats(&wow_stats);
3224 if (QDF_IS_STATUS_ERROR(status)) {
3225 hdd_err("Failed to get WoW stats");
3226 return qdf_status_to_os_return(status);
3227 }
3228
3229 return scnprintf(buffer, max_len,
3230 "\n"
3231 "Suspends: %u\n"
3232 "Resumes: %u\n"
3233 "\n"
3234 "Suspend Fail Reasons\n"
3235 "\tIPA: %u\n"
3236 "\tRadar: %u\n"
3237 "\tRoam: %u\n"
3238 "\tScan: %u\n"
3239 "\tInitial Wakeup: %u\n"
3240 "\n"
3241 "WoW Wake Reasons\n"
3242 "\tunicast: %u\n"
3243 "\tbroadcast: %u\n"
3244 "\tIPv4 multicast: %u\n"
3245 "\tIPv6 multicast: %u\n"
3246 "\tIPv6 multicast RA: %u\n"
3247 "\tIPv6 multicast NS: %u\n"
3248 "\tIPv6 multicast NA: %u\n"
3249 "\tICMPv4: %u\n"
3250 "\tICMPv6: %u\n"
3251 "\tRSSI Breach: %u\n"
3252 "\tLow RSSI: %u\n"
3253 "\tG-Scan: %u\n"
3254 "\tPNO Complete: %u\n"
3255 "\tPNO Match: %u\n",
3256 sr_stats->suspends,
3257 sr_stats->resumes,
3258 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3259 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3260 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3261 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3262 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP],
3263 wow_stats.wow_ucast_wake_up_count,
3264 wow_stats.wow_bcast_wake_up_count,
3265 wow_stats.wow_ipv4_mcast_wake_up_count,
3266 wow_stats.wow_ipv6_mcast_wake_up_count,
3267 wow_stats.wow_ipv6_mcast_ra_stats,
3268 wow_stats.wow_ipv6_mcast_ns_stats,
3269 wow_stats.wow_ipv6_mcast_na_stats,
3270 wow_stats.wow_icmpv4_count,
3271 wow_stats.wow_icmpv6_count,
3272 wow_stats.wow_rssi_breach_wake_up_count,
3273 wow_stats.wow_low_rssi_wake_up_count,
3274 wow_stats.wow_gscan_wake_up_count,
3275 wow_stats.wow_pno_complete_wake_up_count,
3276 wow_stats.wow_pno_match_wake_up_count);
3277}
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003278#endif
Dustin Brownd9322482017-01-09 12:46:03 -08003279/**
Govind Singha471e5e2015-10-12 17:11:14 +05303280 * hdd_wlan_list_fw_profile() - Get fw profiling points
3281 * @length: Size of the data copied
3282 * @buffer: Pointer to char buffer.
3283 * @buf_len: Length of the char buffer.
3284 *
3285 * This function called when the "iwpriv wlan0 listProfile" command is given.
3286 * It is used to get the supported profiling points in FW.
3287 *
3288 * Return - none
3289 */
3290void hdd_wlan_list_fw_profile(uint16_t *length,
3291 char *buffer, uint16_t buf_len)
3292{
3293 uint32_t len = 0;
3294
3295 len = scnprintf(buffer, buf_len,
3296 "PROF_CPU_IDLE: %u\n"
3297 "PROF_PPDU_PROC: %u\n"
3298 "PROF_PPDU_POST: %u\n"
3299 "PROF_HTT_TX_INPUT: %u\n"
3300 "PROF_MSDU_ENQ: %u\n"
3301 "PROF_PPDU_POST_HAL: %u\n"
3302 "PROF_COMPUTE_TX_TIME: %u\n",
3303 PROF_CPU_IDLE,
3304 PROF_PPDU_PROC,
3305 PROF_PPDU_POST,
3306 PROF_HTT_TX_INPUT,
3307 PROF_MSDU_ENQ,
3308 PROF_PPDU_POST_HAL,
3309 PROF_COMPUTE_TX_TIME);
3310
3311 *length = len + 1;
3312}
Mohit Khannac9649652018-11-28 18:10:28 -08003313
3314#define HDD_DUMP_STAT_HELP(STAT_ID) \
3315 hdd_nofl_info("%u -- %s", STAT_ID, (# STAT_ID))
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003316/**
3317 * hdd_display_stats_help() - print statistics help
3318 *
3319 * Return: none
3320 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003321static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003322{
Nirav Shahe6194ac2018-07-13 11:04:41 +05303323 hdd_nofl_info("iwpriv wlan0 dumpStats [option] - dump statistics");
3324 hdd_nofl_info("iwpriv wlan0 clearStats [option] - clear statistics");
3325 hdd_nofl_info("options:");
Mohit Khannac9649652018-11-28 18:10:28 -08003326 HDD_DUMP_STAT_HELP(CDP_TXRX_PATH_STATS);
3327 HDD_DUMP_STAT_HELP(CDP_TXRX_HIST_STATS);
3328 HDD_DUMP_STAT_HELP(CDP_TXRX_TSO_STATS);
3329 HDD_DUMP_STAT_HELP(CDP_HDD_NETIF_OPER_HISTORY);
3330 HDD_DUMP_STAT_HELP(CDP_DUMP_TX_FLOW_POOL_INFO);
3331 HDD_DUMP_STAT_HELP(CDP_TXRX_DESC_STATS);
3332 HDD_DUMP_STAT_HELP(CDP_HIF_STATS);
3333 HDD_DUMP_STAT_HELP(CDP_NAPI_STATS);
3334 HDD_DUMP_STAT_HELP(CDP_DP_NAPI_STATS);
3335 HDD_DUMP_STAT_HELP(CDP_DP_RX_THREAD_STATS);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003336}
Govind Singha471e5e2015-10-12 17:11:14 +05303337
3338/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003339 * hdd_wlan_dump_stats() - display dump Stats
3340 * @adapter: adapter handle
3341 * @value: value from user
3342 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003343 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003344 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003345int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003346{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003347 int ret = 0;
3348 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003349 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003350
Jeff Johnson0e07ca12018-11-12 21:04:45 -08003351 hdd_debug("%d", value);
3352
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003353 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003354 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003355 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3356 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003357 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003358 wlan_hdd_display_netif_queue_history
3359 (hdd_ctx,
3360 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003361 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003362 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303363 hdd_display_hif_stats();
3364 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003365 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003366 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303367 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003368 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003369 if (hdd_display_napi_stats()) {
3370 hdd_err("error displaying napi stats");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303371 ret = -EFAULT;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003372 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003373 break;
Mohit Khannac9649652018-11-28 18:10:28 -08003374 case CDP_DP_RX_THREAD_STATS:
3375 dp_txrx_ext_dump_stats(cds_get_context(QDF_MODULE_ID_SOC),
3376 CDP_DP_RX_THREAD_STATS);
3377 break;
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303378 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003379 sme_display_disconnect_stats(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003380 adapter->vdev_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303381 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003382 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003383 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003384 value,
3385 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003386 if (status == QDF_STATUS_E_INVAL) {
3387 hdd_display_stats_help();
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303388 ret = -EINVAL;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003389 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003390 break;
3391 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003392 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003393}
3394
3395/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003396 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003397 * @adapter: Adapter upon which the IBSS client is active
Jeff Johnson0a082d92019-03-04 12:25:49 -08003398 * @sta_id: Station index of the IBSS peer
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003399 *
3400 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3401 * otherwise an appropriate QDF_STATUS_E_* failure code.
3402 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003403static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnson0a082d92019-03-04 12:25:49 -08003404 uint8_t sta_id)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003405{
3406 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003407 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnson93107ad2019-02-26 08:14:46 -08003408 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson52f19d52019-02-26 08:35:38 -08003409 tSirPeerInfoRspParams *peer_info = &sta_ctx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003410
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003411 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003412 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003413 hdd_get_ibss_peer_info_cb,
Jeff Johnson0a082d92019-03-04 12:25:49 -08003414 false, sta_id);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003415
3416 if (QDF_STATUS_SUCCESS == status) {
3417 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003418
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003419 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003420 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003421 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3422 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003423 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003424 return QDF_STATUS_E_FAILURE;
3425 }
3426
3427 /** Print the peer info */
Jeff Johnson52f19d52019-02-26 08:35:38 -08003428 hdd_debug("peer_info->numIBSSPeers = %d ", peer_info->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003429 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003430 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
Jeff Johnson52f19d52019-02-26 08:35:38 -08003431 uint32_t tx_rate = peer_info->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003432
Jeff Johnson52f19d52019-02-26 08:35:38 -08003433 qdf_mem_copy(mac_addr, peer_info->peerInfoParams[0].
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003434 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003435 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003436 mac_addr, (int)tx_rate,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003437 (int)peer_info->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003438 }
3439 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003440 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003441 }
3442
3443 return status;
3444}
3445
3446/**
3447 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003448 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003449 *
3450 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3451 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3452 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003453static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003454{
3455 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003456 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnson93107ad2019-02-26 08:14:46 -08003457 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson52f19d52019-02-26 08:35:38 -08003458 tSirPeerInfoRspParams *peer_info = &sta_ctx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003459 int i;
3460
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003461 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003462 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003463 hdd_get_ibss_peer_info_cb,
3464 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003465
3466 if (QDF_STATUS_SUCCESS == status) {
3467 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003468
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003469 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003470 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003471 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3472 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003473 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003474 return QDF_STATUS_E_FAILURE;
3475 }
3476
3477 /** Print the peer info */
Jeff Johnson52f19d52019-02-26 08:35:38 -08003478 hdd_debug("peer_info->numIBSSPeers = %d ",
3479 (int)peer_info->numPeers);
3480 for (i = 0; i < peer_info->numPeers; i++) {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003481 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3482 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003483
Jeff Johnson52f19d52019-02-26 08:35:38 -08003484 tx_rate = peer_info->peerInfoParams[i].txRate;
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003485 qdf_mem_copy(mac_addr,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003486 peer_info->peerInfoParams[i].mac_addr,
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003487 sizeof(mac_addr));
3488
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003489 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003490 mac_addr, (int)tx_rate,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003491 (int)peer_info->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003492 }
3493 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003494 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003495 }
3496
3497 return status;
3498}
3499
3500/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303501 * hdd_get_ldpc() - Get adapter LDPC
3502 * @adapter: adapter being queried
3503 * @value: where to store the value
3504 *
3505 * Return: 0 on success, negative errno on failure
3506 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003507int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303508{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003509 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303510 int ret;
3511
Dustin Brown491d54b2018-03-14 12:39:11 -07003512 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003513 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303514 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3515 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003516 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303517 } else {
3518 *value = ret;
3519 ret = 0;
3520 }
3521 return ret;
3522}
3523
Jeff Johnson3d278b02017-08-29 14:17:47 -07003524int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303525{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003526 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303527 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003528 QDF_STATUS status;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003529 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303530 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303531
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003532 hdd_debug("%d", value);
Jeff Johnson1ca04762018-10-25 10:24:39 -07003533
3534 if (!mac_handle) {
3535 hdd_err("NULL Mac handle");
3536 return -EINVAL;
3537 }
3538
Dustin Brown05d81302018-09-11 16:49:22 -07003539 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003540 if (QDF_STATUS_SUCCESS != status) {
3541 hdd_err("Failed to get HT capability info");
3542 return -EIO;
3543 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003544
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303545 ht_cap_info.adv_coding_cap = value;
Dustin Brown05d81302018-09-11 16:49:22 -07003546 status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003547 if (QDF_STATUS_SUCCESS != status) {
3548 hdd_err("Failed to set HT capability info");
3549 return -EIO;
3550 }
Vignesh Viswanathanecd4de72018-11-22 13:02:20 +05303551 status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303552 if (QDF_IS_STATUS_ERROR(status)) {
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003553 hdd_err("Failed to set VHT LDPC capability info");
3554 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303555 }
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_ADVANCE_CODING,
3558 value);
3559 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003560 hdd_err("Failed to set LDPC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003561 ret = sme_update_he_ldpc_supp(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003562 if (ret)
3563 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303564
3565 return ret;
3566}
3567
3568/**
3569 * hdd_get_tx_stbc() - Get adapter TX 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_tx_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_TX_STBC);
3583 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003584 hdd_err("Failed to get TX 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_tx_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 Johnson57ff4fa2018-10-25 10:29:47 -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.tx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003617 hdd_err("TX 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_TX_STBC,
3623 value);
3624 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003625 hdd_err("Failed to set TX STBC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003626 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003627 if (ret)
3628 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303629
3630 return ret;
3631}
3632
3633/**
3634 * hdd_get_rx_stbc() - Get adapter RX STBC
3635 * @adapter: adapter being queried
3636 * @value: where to store the value
3637 *
3638 * Return: 0 on success, negative errno on failure
3639 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003640int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303641{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003642 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303643 int ret;
3644
Dustin Brown491d54b2018-03-14 12:39:11 -07003645 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003646 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303647 WNI_CFG_HT_CAP_INFO_RX_STBC);
3648 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003649 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303650 } else {
3651 *value = ret;
3652 ret = 0;
3653 }
3654
3655 return ret;
3656}
3657
Jeff Johnson3d278b02017-08-29 14:17:47 -07003658int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303659{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003660 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303661 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303662 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303663 QDF_STATUS status;
3664 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303665
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003666 hdd_debug("%d", value);
Jeff Johnsonb6645852018-10-25 10:35:41 -07003667
3668 if (!mac_handle) {
3669 hdd_err("NULL Mac handle");
3670 return -EINVAL;
3671 }
3672
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303673 if (value) {
3674 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003675 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303676 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303677 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003678 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303679 return -EIO;
3680 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303681 if (!ht_cap_info.rx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003682 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303683 return -EINVAL;
3684 }
3685 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003686 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303687 WNI_CFG_HT_CAP_INFO_RX_STBC,
3688 value);
3689 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003690 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303691
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003692 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003693 if (ret)
3694 hdd_err("Failed to set HE RX STBC value");
3695
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303696 return ret;
3697}
3698
3699/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003700 * iw_get_linkspeed() - Get current link speed ioctl
3701 * @dev: device upon which the ioctl was received
3702 * @info: ioctl request information
3703 * @wrqu: ioctl request data
3704 * @extra: extra ioctl buffer
3705 *
3706 * Return: 0 on success, non-zero on error
3707 */
3708static int __iw_get_linkspeed(struct net_device *dev,
3709 struct iw_request_info *info,
3710 union iwreq_data *wrqu, char *extra)
3711{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003712 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson21451ae2019-03-10 21:54:04 -07003713 char *out_link_speed = (char *)extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003714 int len = sizeof(uint32_t) + 1;
3715 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003716 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003717 int ret;
3718 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003719
Dustin Brownfdf17c12018-03-14 12:55:34 -07003720 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303721
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003722 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003723 ret = wlan_hdd_validate_context(hdd_ctx);
3724 if (0 != ret)
3725 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003726
Jeff Johnson441e1f72017-02-07 08:50:49 -08003727 ret = hdd_check_private_wext_control(hdd_ctx, info);
3728 if (0 != ret)
3729 return ret;
3730
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003731 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003732 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003733 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003734
3735 wrqu->data.length = len;
3736 /* return the linkspeed as a string */
Jeff Johnson21451ae2019-03-10 21:54:04 -07003737 rc = snprintf(out_link_speed, len, "%u", link_speed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003738 if ((rc < 0) || (rc >= len)) {
3739 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003740 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003741 return -EIO;
3742 }
3743
Dustin Browne74003f2018-03-14 12:51:58 -07003744 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003745 /* a value is being successfully returned */
3746 return 0;
3747}
3748
3749static int iw_get_linkspeed(struct net_device *dev,
3750 struct iw_request_info *info,
3751 union iwreq_data *wrqu, char *extra)
3752{
Dustin Brown389e5072018-11-08 17:10:01 +05303753 int errno;
3754 struct osif_vdev_sync *vdev_sync;
3755
3756 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
3757 if (errno)
3758 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003759
Dustin Brown389e5072018-11-08 17:10:01 +05303760 errno = __iw_get_linkspeed(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003761
Dustin Brown389e5072018-11-08 17:10:01 +05303762 osif_vdev_sync_op_stop(vdev_sync);
3763
3764 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003765}
3766
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003767#ifdef FEATURE_WLM_STATS
3768static void wlan_get_wlm_stats_cb(void *cookie, const char *data)
3769{
3770 struct osif_request *request;
3771 char *priv;
3772
3773 request = osif_request_get(cookie);
3774 if (!request) {
3775 hdd_err("Obsolete request");
3776 return;
3777 }
3778 priv = osif_request_priv(request);
3779 strlcpy(priv, data, WE_MAX_STR_LEN);
3780 osif_request_complete(request);
3781 osif_request_put(request);
3782}
3783
3784static int wlan_get_wlm_stats(struct hdd_adapter *adapter, uint32_t bitmask,
3785 char *response)
3786{
3787 struct osif_request *request;
3788 void *cookie;
3789 int errno;
3790 char *priv;
3791 static const struct osif_request_params params = {
3792 .priv_size = WE_MAX_STR_LEN,
3793 .timeout_ms = 2000,
3794 };
3795
3796 if (!adapter) {
3797 hdd_err("NULL argument");
3798 return -EINVAL;
3799 }
3800 request = osif_request_alloc(&params);
3801 if (!request) {
3802 hdd_err("Request allocation failure");
3803 return -ENOMEM;
3804 }
3805 cookie = osif_request_cookie(request);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003806 errno = wma_wlm_stats_req(adapter->vdev_id, bitmask,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003807 params.priv_size,
3808 wlan_get_wlm_stats_cb, cookie);
3809 if (errno) {
3810 hdd_err("Request failed be sent, %d", errno);
3811 goto cleanup;
3812 }
3813 errno = osif_request_wait_for_response(request);
3814 if (errno) {
3815 hdd_err("Timeout happened, can't complete the req");
3816 goto cleanup;
3817 }
3818 priv = osif_request_priv(request);
3819 strlcpy(response, priv, params.priv_size);
3820
3821cleanup:
3822 osif_request_put(request);
3823
3824 return errno;
3825}
3826
3827/*
3828 * Due to a limitation in iwpriv the "get_wlm_stats" ioctl is defined
3829 * to take as input a variable-length string as opposed to taking a
3830 * single integer "bitmask" value. Hence we must have a buffer large
3831 * enough to hold a string representing the largest possible
3832 * value. MAX_INT = 2,147,483,647 which can be fit in 10 chars.
3833 * Round up to 12 to hold the trailing NUL and be a multiple of 4.
3834 */
3835#define WLM_USER_DATA_SIZE 12
3836
3837static int __iw_get_wlm_stats(struct net_device *dev,
3838 struct iw_request_info *info,
3839 union iwreq_data *wrqu, char *extra)
3840{
3841 struct iw_point priv_data;
3842 char user_data[WLM_USER_DATA_SIZE] = {0};
3843 uint32_t bitmask = 0;
3844 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
3845 struct hdd_context *hdd_ctx;
3846 int errno;
3847
3848 hdd_enter_dev(dev);
3849
3850 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3851 errno = wlan_hdd_validate_context(hdd_ctx);
3852 if (errno)
3853 return errno;
3854
3855 if (!capable(CAP_NET_ADMIN)) {
3856 hdd_err("permission check failed");
3857 return -EPERM;
3858 }
3859
3860 /*
3861 * Since this is GETTER iwpriv ioctl, driver needs to
3862 * copy SET data from user space to kernel space.
3863 * Helper function to get iwreq_data with compat handling.
3864 */
3865 if (hdd_priv_get_data(&priv_data, wrqu))
3866 return -EINVAL;
3867
3868 /*
3869 * priv_data.pointer should be pointing to data given
3870 * to iwpriv command.
3871 *
3872 * For example "iwpriv wlan0 get_wlm_stats 1234"
3873 *
3874 * priv_data.pointer should be pointing to "1234"
3875 * priv_data.length should be zero as this GETTER iwpriv ioctl
3876 */
3877 if (!priv_data.pointer) {
3878 hdd_err("NULL data pointer");
3879 return -EINVAL;
3880 }
3881
3882 /*
3883 * ideally driver should have used priv_data.length to copy
3884 * data from priv_data.pointer but this iwpriv IOCTL has been
3885 * declared as GETTER in nature which makes length field zero
3886 * for input arguments but priv_data.pointer still points to
3887 * user's input argument (just doesn't pass the length of the
3888 * argument)
3889 */
3890 if (copy_from_user(user_data, priv_data.pointer,
3891 sizeof(user_data) - 1)) {
3892 hdd_err("failed to copy data from user buffer");
3893 return -EFAULT;
3894 }
3895
3896 /*
3897 * user data is given in ascii, convert ascii to integer
3898 */
3899 if (kstrtou32(user_data, 0, &bitmask)) {
3900 hdd_err("failed to parse input %s", user_data);
3901 return -EFAULT;
3902 }
3903
3904 if (wlan_get_wlm_stats(adapter, bitmask, extra)) {
3905 hdd_err("returning failure");
3906 return -EFAULT;
3907 }
3908 wrqu->data.length = strlen(extra) + 1;
3909
3910 return 0;
3911}
3912
Dustin Brown96b98dd2019-03-06 12:39:37 -08003913static int iw_get_wlm_stats(struct net_device *net_dev,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003914 struct iw_request_info *info,
3915 union iwreq_data *wrqu, char *extra)
3916{
Dustin Brown96b98dd2019-03-06 12:39:37 -08003917 struct osif_vdev_sync *vdev_sync;
3918 int errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003919
Dustin Brown96b98dd2019-03-06 12:39:37 -08003920 errno = osif_vdev_sync_op_start(net_dev, &vdev_sync);
3921 if (errno)
3922 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003923
Dustin Brown96b98dd2019-03-06 12:39:37 -08003924 errno = __iw_get_wlm_stats(net_dev, info, wrqu, extra);
3925
3926 osif_vdev_sync_op_stop(vdev_sync);
3927
3928 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003929}
3930#endif /* FEATURE_WLM_STATS */
3931
Jeff Johnsonc1713242018-10-23 13:45:42 -07003932int wlan_hdd_update_phymode(struct hdd_adapter *adapter, int new_phymode)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003933{
Jeff Johnsonc1713242018-10-23 13:45:42 -07003934 struct net_device *net = adapter->dev;
3935 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
3936 mac_handle_t mac_handle = phddctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003937 bool band_24 = false, band_5g = false;
3938 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08003939 struct sme_config_params *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003940 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303941 uint8_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003942 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07003943 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003944 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303945 int retval = 0;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303946 uint8_t band_capability;
3947 QDF_STATUS status;
Wu Gaoed616a12019-01-16 15:19:21 +08003948 uint32_t channel_bonding_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003949
Jeff Johnsonc1713242018-10-23 13:45:42 -07003950 if (!mac_handle)
3951 return -EINVAL;
3952
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003953 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003954
Wu Gaoed616a12019-01-16 15:19:21 +08003955 ucfg_mlme_get_channel_bonding_24ghz(phddctx->psoc,
3956 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003957 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003958 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003959 ch_bond24 = true;
3960
Wu Gaoed616a12019-01-16 15:19:21 +08003961 ucfg_mlme_get_channel_bonding_5ghz(phddctx->psoc,
3962 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003963 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003964 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003965 ch_bond5g = true;
3966
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303967 status = wlan_mlme_get_band_capability(phddctx->psoc, &band_capability);
3968 if (QDF_IS_STATUS_ERROR(status)) {
3969 hdd_err("Failed to get MLME Band capability");
3970 return -EIO;
3971 }
3972
3973 if (band_capability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003974 band_24 = band_5g = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303975 else if (band_capability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003976 band_24 = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303977 else if (band_capability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003978 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003979
Jeff Johnsonc1713242018-10-23 13:45:42 -07003980 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc, &vhtchanwidth);
3981 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003982 hdd_err("Failed to get channel_width");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303983
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003984 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 -08003985 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3986
3987 switch (new_phymode) {
3988 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003989 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003990 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003991 phymode = eCSR_DOT11_MODE_AUTO;
3992 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3993 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003994 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003995 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3996 } 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_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004002 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004003 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004004 phymode = eCSR_DOT11_MODE_11a;
4005 hdd_dot11mode = eHDD_DOT11_MODE_11a;
4006 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004007 curr_band = BAND_5G;
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_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004014 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
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_11b;
4017 hdd_dot11mode = eHDD_DOT11_MODE_11b;
4018 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
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;
4025 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004026 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004027 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004028 phymode = eCSR_DOT11_MODE_11g;
4029 hdd_dot11mode = eHDD_DOT11_MODE_11g;
4030 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004031 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004032 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004033 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004034 return -EIO;
4035 }
4036 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07004037 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004038 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
4039 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
4040 */
4041 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004042 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004043 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004044 phymode = eCSR_DOT11_MODE_11n;
4045 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4046 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004047 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004048 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004049 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004050 return -EIO;
4051 }
4052 break;
4053 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004054 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004055 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004056 phymode = eCSR_DOT11_MODE_11n;
4057 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4058 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004059 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004060 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004061 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004062 return -EIO;
4063 }
4064 break;
4065 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004066 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004067 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004068 phymode = eCSR_DOT11_MODE_11n;
4069 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4070 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004071 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004072 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004073 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004074 return -EIO;
4075 }
4076 break;
4077 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004078 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004079 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004080 phymode = eCSR_DOT11_MODE_11n;
4081 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4082 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004083 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004084 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004085 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004086 return -EIO;
4087 }
4088 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004089 case IEEE80211_MODE_11AC_VHT20:
4090 case IEEE80211_MODE_11AC_VHT40:
4091 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004092 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07004093 phymode = eCSR_DOT11_MODE_11ac;
4094 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
4095 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
4096 if (band_5g && band_24) {
4097 curr_band = BAND_ALL;
4098 break;
4099 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004100 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07004101 break;
4102 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
4103 curr_band = BAND_2G;
4104 break;
4105 }
4106 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
4107 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004108 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004109 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004110 return -EIO;
4111 }
4112 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004113 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004114 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004115 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004116 phymode = eCSR_DOT11_MODE_AUTO;
4117 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4118 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004119 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004120 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004121 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004122 return -EIO;
4123 }
4124 break;
4125 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004126 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004127 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004128 phymode = eCSR_DOT11_MODE_AUTO;
4129 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4130 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
4131 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004132 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004133 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004134 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004135 return -EIO;
4136 }
4137 break;
4138 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004139 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004140 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004141 phymode = eCSR_DOT11_MODE_11n;
4142 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4143 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004144 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004145 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004146 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004147 return -EIO;
4148 }
4149 break;
4150 default:
4151 return -EIO;
4152 }
4153
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004154 switch (new_phymode) {
4155 case IEEE80211_MODE_11AC_VHT20:
4156 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4157 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
4158 break;
4159 case IEEE80211_MODE_11AC_VHT40:
4160 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
4161 break;
4162 case IEEE80211_MODE_11AC_VHT80:
4163 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
4164 break;
4165 default:
Jeff Johnsonc1713242018-10-23 13:45:42 -07004166 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc,
4167 &vhtchanwidth);
4168 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07004169 hdd_err("Failed to get channel_width");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004170 break;
4171 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004172
4173 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304174 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4175 if (!sme_config) {
4176 hdd_err("Failed to allocate memory for sme_config");
4177 return -ENOMEM;
4178 }
4179 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004180 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304181 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004182#ifdef QCA_HT_2040_COEX
4183 if (phymode == eCSR_DOT11_MODE_11n &&
4184 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304185 sme_config->csrConfig.obssEnabled = false;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004186 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004187 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004188 eHT_CHAN_HT20, false);
4189 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004190 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304191 retval = -EIO;
4192 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004193 }
4194 } else if (phymode == eCSR_DOT11_MODE_11n &&
4195 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304196 sme_config->csrConfig.obssEnabled = true;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004197 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004198 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004199 eHT_CHAN_HT20, true);
4200 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004201 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304202 retval = -EIO;
4203 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004204 }
4205 }
4206#endif
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05304207 status = ucfg_mlme_set_band_capability(phddctx->psoc,
4208 curr_band);
4209 if (QDF_IS_STATUS_ERROR(status)) {
4210 hdd_err("failed to set MLME band capability");
4211 goto free;
4212 }
4213
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304214 if (curr_band == BAND_2G) {
4215 status = ucfg_mlme_set_11h_enabled(phddctx->psoc, 0);
4216 if (!QDF_IS_STATUS_SUCCESS(status)) {
4217 hdd_err("Failed to set 11h_enable flag");
4218 goto free;
4219 }
4220 }
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004221 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304222 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07004223 else if (curr_band == BAND_5G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304224 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004225 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304226 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
4227 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004228 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004229 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004230
4231 phddctx->config->dot11Mode = hdd_dot11mode;
Wu Gaoed616a12019-01-16 15:19:21 +08004232 ucfg_mlme_set_channel_bonding_24ghz(
4233 phddctx->psoc,
4234 sme_config->csrConfig.channelBondingMode24GHz);
4235 ucfg_mlme_set_channel_bonding_5ghz(
4236 phddctx->psoc,
4237 sme_config->csrConfig.channelBondingMode5GHz);
Krunal Sonidf0f8742016-09-26 14:56:31 -07004238 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004239 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304240 retval = -EIO;
4241 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004242 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304243
4244 if (band_5g) {
4245 struct ieee80211_supported_band *band;
4246
Wu Gaoed616a12019-01-16 15:19:21 +08004247 ucfg_mlme_get_channel_bonding_5ghz(
4248 phddctx->psoc, &channel_bonding_mode);
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304249 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
Wu Gaoed616a12019-01-16 15:19:21 +08004250 if (channel_bonding_mode)
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304251 band->ht_cap.cap |=
4252 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4253 else
4254 band->ht_cap.cap &=
4255 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4256 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004257
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004258 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004259 phymode, chwidth, curr_band, vhtchanwidth);
4260 }
4261
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304262free:
4263 if (sme_config)
4264 qdf_mem_free(sme_config);
4265 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004266}
4267
Jeff Johnson011c4502017-10-05 15:25:56 -07004268static int hdd_validate_pdev_reset(int value)
4269{
4270 if ((value < 1) || (value > 5)) {
4271 hdd_warn(" Invalid value %d: Use any one of the below values\n"
4272 " TX_FLUSH = 1\n"
4273 " WARM_RESET = 2\n"
4274 " COLD_RESET = 3\n"
4275 " WARM_RESET_RESTORE_CAL = 4\n"
4276 " COLD_RESET_RESTORE_CAL = 5", value);
4277
4278 return -EINVAL;
4279 }
4280
4281 return 0;
4282}
4283
4284static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
4285{
4286 int ret;
4287
4288 hdd_debug("%d", value);
4289
4290 ret = hdd_validate_pdev_reset(value);
4291 if (ret)
4292 return ret;
4293
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004294 ret = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07004295 WMI_PDEV_PARAM_PDEV_RESET,
4296 value, PDEV_CMD);
4297
4298 return ret;
4299}
4300
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004301static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
4302{
4303 int errno;
4304 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004305 uint32_t bonding_mode;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08004306 struct sme_config_params *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004307 mac_handle_t mac_handle;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004308
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004309 mac_handle = hdd_ctx->mac_handle;
4310 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004311 return -EINVAL;
4312
4313 /* updating channel bonding only on 5Ghz */
4314 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4315
4316 switch (ch_width) {
4317 case eHT_CHANNEL_WIDTH_20MHZ:
4318 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4319 break;
4320
4321 case eHT_CHANNEL_WIDTH_40MHZ:
4322 case eHT_CHANNEL_WIDTH_80MHZ:
Kiran Kumar Lokere9df090b2019-02-07 18:48:22 -08004323 bonding_mode = 1;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004324 break;
4325
4326 default:
4327 hdd_err("Invalid channel width 0->20 1->40 2->80");
4328 return -EINVAL;
4329 }
4330
4331 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4332 if (!sme_config) {
4333 hdd_err("failed to allocate memory for sme_config");
4334 return -ENOMEM;
4335 }
4336
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004337 errno = wma_cli_set_command(adapter->vdev_id, WMI_VDEV_PARAM_CHWIDTH,
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004338 ch_width, VDEV_CMD);
4339 if (errno)
4340 goto free_config;
4341
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004342 sme_get_config_param(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004343 sme_config->csrConfig.channelBondingMode5GHz = bonding_mode;
Kiran Kumar Lokere9df090b2019-02-07 18:48:22 -08004344 sme_config->csrConfig.channelBondingMode24GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004345 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004346
4347free_config:
4348 qdf_mem_free(sme_config);
4349
4350 return errno;
4351}
4352
Jeff Johnsondeab8572018-11-13 15:29:53 -08004353static int hdd_we_set_11d_state(struct hdd_adapter *adapter, int state_11d)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004354{
Jeff Johnsondeab8572018-11-13 15:29:53 -08004355 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004356 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004357 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304358 QDF_STATUS status;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004359
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004360 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004361 return -EINVAL;
4362
4363 switch (state_11d) {
4364 case ENABLE_11D:
4365 enable_11d = true;
4366 break;
4367 case DISABLE_11D:
4368 enable_11d = false;
4369 break;
4370 default:
4371 return -EINVAL;
4372 }
4373
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304374 status = ucfg_mlme_set_11d_enabled(hdd_ctx->psoc, enable_11d);
4375 if (!QDF_IS_STATUS_SUCCESS(status))
4376 hdd_err("Invalid 11d_enable flag");
Dustin Brownd90f61a2018-04-26 12:25:58 -07004377
Dustin Brownea82d562018-05-23 12:07:16 -07004378 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004379
4380 return 0;
4381}
4382
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004383static int hdd_we_set_power(struct hdd_adapter *adapter, int value)
4384{
4385 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4386 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4387
4388 if (!mac_handle)
4389 return -EINVAL;
4390
4391 switch (value) {
4392 case 1:
4393 /* Enable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004394 sme_save_usr_ps_cfg(mac_handle, true);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004395 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004396 SME_PS_ENABLE);
4397 return 0;
4398 case 2:
4399 /* Disable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004400 sme_save_usr_ps_cfg(mac_handle, false);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004401 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004402 SME_PS_DISABLE);
4403 return 0;
4404 case 3:
4405 /* Enable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004406 sme_ps_uapsd_enable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004407 return 0;
4408 case 4:
4409 /* Disable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004410 sme_ps_uapsd_disable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004411 return 0;
4412 default:
4413 hdd_err("Invalid value %d", value);
4414 return -EINVAL;
4415 }
4416}
4417
Jeff Johnsoneb4368a2018-10-19 13:02:52 -07004418static int hdd_we_set_max_assoc(struct hdd_adapter *adapter, int value)
4419{
4420 struct hdd_context *hdd_ctx;
4421 QDF_STATUS status;
4422
4423 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4424 status = ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, value);
4425 if (QDF_IS_STATUS_ERROR(status))
4426 hdd_err("cfg set failed, value %d status %d", value, status);
4427
4428 return qdf_status_to_os_return(status);
4429}
4430
Jeff Johnson693722c2018-10-19 13:11:16 -07004431static int hdd_we_set_data_inactivity_timeout(struct hdd_adapter *adapter,
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004432 int inactivity_timeout)
Jeff Johnson693722c2018-10-19 13:11:16 -07004433{
4434 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004435 QDF_STATUS status;
Jeff Johnson693722c2018-10-19 13:11:16 -07004436
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004437 status = ucfg_mlme_set_ps_data_inactivity_timeout(hdd_ctx->psoc,
4438 inactivity_timeout);
Jeff Johnson693722c2018-10-19 13:11:16 -07004439
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004440 return qdf_status_to_os_return(status);
Jeff Johnson693722c2018-10-19 13:11:16 -07004441}
4442
Jeff Johnson94511942018-10-19 13:15:22 -07004443static int hdd_we_set_wow_data_inactivity_timeout(struct hdd_adapter *adapter,
4444 int value)
4445{
4446 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4447 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Jeff Johnson94511942018-10-19 13:15:22 -07004448
4449 if (!mac_handle)
4450 return -EINVAL;
4451
Wu Gaoa796d712019-01-07 14:15:32 +08004452 if (!cfg_in_range(CFG_PMO_WOW_DATA_INACTIVITY_TIMEOUT, value)) {
Jeff Johnson94511942018-10-19 13:15:22 -07004453 hdd_err_rl("Invalid value %d", value);
4454 return -EINVAL;
4455 }
4456
Wu Gaoa796d712019-01-07 14:15:32 +08004457 ucfg_pmo_set_wow_data_inactivity_timeout(hdd_ctx->psoc, (uint8_t)value);
Jeff Johnson94511942018-10-19 13:15:22 -07004458
Wu Gaoa796d712019-01-07 14:15:32 +08004459 return 0;
Jeff Johnson94511942018-10-19 13:15:22 -07004460}
4461
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004462static int hdd_we_set_tx_power(struct hdd_adapter *adapter, int value)
4463{
4464 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4465 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4466 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4467 QDF_STATUS status;
4468
4469 if (!mac_handle)
4470 return -EINVAL;
4471
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004472 status = sme_set_tx_power(mac_handle, adapter->vdev_id,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004473 sta_ctx->conn_info.bssid,
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004474 adapter->device_mode, value);
4475
4476 if (QDF_IS_STATUS_ERROR(status))
4477 hdd_err("cfg set failed, value %d status %d", value, status);
4478
4479 return qdf_status_to_os_return(status);
4480}
4481
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004482static int hdd_we_set_max_tx_power(struct hdd_adapter *adapter, int value)
4483{
4484 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4485 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4486 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4487 QDF_STATUS status;
4488
4489 if (!mac_handle)
4490 return -EINVAL;
4491
4492 status = sme_set_max_tx_power(mac_handle,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004493 sta_ctx->conn_info.bssid,
4494 sta_ctx->conn_info.bssid,
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004495 value);
4496
4497 if (QDF_IS_STATUS_ERROR(status))
4498 hdd_err("cfg set failed, value %d status %d", value, status);
4499
4500 return qdf_status_to_os_return(status);
4501}
4502
Jeff Johnsonf3892b52018-10-23 11:32:04 -07004503static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power)
4504{
4505 QDF_STATUS status;
4506
4507 hdd_debug("power %d dBm", power);
4508 status = sme_set_max_tx_power_per_band(BAND_2G, power);
4509 if (QDF_IS_STATUS_ERROR(status))
4510 hdd_err("cfg set failed, value %d status %d", power, status);
4511
4512 return qdf_status_to_os_return(status);
4513}
4514
Jeff Johnson175004c2018-10-23 12:03:16 -07004515static int hdd_we_set_max_tx_power_5_0(struct hdd_adapter *adapter, int power)
4516{
4517 QDF_STATUS status;
4518
4519 hdd_debug("power %d dBm", power);
4520 status = sme_set_max_tx_power_per_band(BAND_5G, power);
4521 if (QDF_IS_STATUS_ERROR(status))
4522 hdd_err("cfg set failed, value %d status %d", power, status);
4523
4524 return qdf_status_to_os_return(status);
4525}
4526
Jeff Johnson0187c622019-01-04 06:39:44 -08004527#ifdef HASTINGS_BT_WAR
4528
4529/*
4530 * replicate logic:
4531 * iwpriv wlan0 setUnitTestCmd 19 2 23 1 => enable WAR
4532 * iwpriv wlan0 setUnitTestCmd 19 2 23 0 => disable WAR
4533 */
4534
4535#define HASTINGS_WAR_FW_PARAM_ID 23
4536
4537static int hdd_hastings_bt_war_set_fw(struct hdd_context *hdd_ctx,
4538 uint32_t value)
4539{
4540 uint32_t vdev_id = 0; /* not used */
4541 uint32_t module_id = WLAN_MODULE_WAL;
4542 uint32_t arg_count = 2;
4543 uint32_t arg[2] = {HASTINGS_WAR_FW_PARAM_ID, value};
4544 QDF_STATUS status;
4545
4546 status = wma_form_unit_test_cmd_and_send(vdev_id, module_id,
4547 arg_count, arg);
4548
4549 return qdf_status_to_os_return(status);
4550}
4551
4552int hdd_hastings_bt_war_enable_fw(struct hdd_context *hdd_ctx)
4553{
4554 return hdd_hastings_bt_war_set_fw(hdd_ctx, 1);
4555}
4556
4557int hdd_hastings_bt_war_disable_fw(struct hdd_context *hdd_ctx)
4558{
4559 return hdd_hastings_bt_war_set_fw(hdd_ctx, 0);
4560}
4561
4562/* value to restore the config when the WAR is disabled */
4563static uint32_t iface_change_wait_time_checkpoint;
4564static void checkpoint_iface_change_wait_time(struct hdd_context *hdd_ctx)
4565{
4566 struct hdd_config *config = hdd_ctx->config;
4567
4568 /* did we already checkpoint a value ? */
4569 if (iface_change_wait_time_checkpoint)
4570 return;
4571
4572 /* checkpoint current value */
4573 iface_change_wait_time_checkpoint = config->iface_change_wait_time;
4574
4575 /* was the timer enabled when we checkpointed? */
4576 if (iface_change_wait_time_checkpoint)
4577 return;
4578
4579 /* WAR was enabled at boot, use default when disable */
4580 iface_change_wait_time_checkpoint =
4581 cfg_default(CFG_INTERFACE_CHANGE_WAIT);
4582}
4583
4584static int hdd_hastings_war_enable(struct hdd_context *hdd_ctx)
4585{
4586 struct hdd_config *config = hdd_ctx->config;
4587
4588 config->iface_change_wait_time = 0;
4589
4590 return hdd_hastings_bt_war_enable_fw(hdd_ctx);
4591}
4592
4593static int hdd_hastings_war_disable(struct hdd_context *hdd_ctx)
4594{
4595 struct hdd_config *config = hdd_ctx->config;
4596
4597 config->iface_change_wait_time = iface_change_wait_time_checkpoint;
4598
4599 return hdd_hastings_bt_war_disable_fw(hdd_ctx);
4600}
4601
4602static int hdd_we_set_hastings_bt_war(struct hdd_adapter *adapter, int enable)
4603{
4604 int errno;
4605 struct hdd_context *hdd_ctx;
4606
4607 errno = hdd_validate_adapter(adapter);
4608 if (errno)
4609 return errno;
4610
4611 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4612 checkpoint_iface_change_wait_time(hdd_ctx);
4613
4614 return enable ?
4615 hdd_hastings_war_enable(hdd_ctx) :
4616 hdd_hastings_war_disable(hdd_ctx);
4617}
4618#endif
4619
Jeff Johnson5bee39b2018-10-23 12:34:38 -07004620static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level)
4621{
4622 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4623 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4624 QDF_STATUS status;
4625
4626 if (!mac_handle)
4627 return -EINVAL;
4628
4629 hdd_debug("Thermal Mitigation Level %d", level);
4630 status = sme_set_thermal_level(mac_handle, level);
4631 if (QDF_IS_STATUS_ERROR(status))
4632 hdd_err("cfg set failed, value %d status %d", level, status);
4633
4634 return qdf_status_to_os_return(status);
4635}
4636
Jeff Johnson38912642018-10-24 15:01:40 -07004637static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss)
4638{
4639 QDF_STATUS status;
4640
4641 hdd_debug("NSS %d", nss);
4642
4643 if ((nss > 2) || (nss <= 0)) {
4644 hdd_err("Invalid NSS: %d", nss);
4645 return -EINVAL;
4646 }
4647
4648 status = hdd_update_nss(adapter, nss);
4649 if (QDF_IS_STATUS_ERROR(status))
4650 hdd_err("cfg set failed, value %d status %d", nss, status);
4651
4652 return qdf_status_to_os_return(status);
4653}
4654
Jeff Johnsonce996b32018-10-25 10:52:40 -07004655static int hdd_we_set_short_gi(struct hdd_adapter *adapter, int sgi)
4656{
4657 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
4658 int errno;
4659
4660 hdd_debug("Short GI %d", sgi);
4661
4662 if (!mac_handle) {
4663 hdd_err("NULL Mac handle");
4664 return -EINVAL;
4665 }
4666
4667 if (sgi & HDD_AUTO_RATE_SGI)
4668 errno = sme_set_auto_rate_he_sgi(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004669 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004670 sgi);
4671 else
4672 errno = sme_update_ht_config(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004673 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004674 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4675 sgi);
4676 if (errno)
4677 hdd_err("cfg set failed, value %d status %d", sgi, errno);
4678
4679 return errno;
4680}
4681
Jeff Johnson71d80382018-10-25 15:45:01 -07004682static int hdd_we_set_rtscts(struct hdd_adapter *adapter, int rtscts)
4683{
4684 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4685 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4686 uint32_t value;
4687 uint32_t rts_threshold_val;
4688 QDF_STATUS status;
4689 int errno;
4690
4691 hdd_debug("RTSCTS %d", rtscts);
4692
4693 if (!mac_handle) {
4694 hdd_err("NULL Mac handle");
4695 return -EINVAL;
4696 }
4697
4698 status = ucfg_mlme_get_rts_threshold(hdd_ctx->psoc,
4699 &rts_threshold_val);
4700 if (QDF_IS_STATUS_ERROR(status)) {
4701 hdd_err("Get rts threshold failed, status %d", status);
4702 return -EINVAL;
4703 }
4704
4705 if ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_RTSCTS_ENABLE) {
4706 value = rts_threshold_val;
4707 } else if (((rtscts & HDD_RTSCTS_EN_MASK) == 0) ||
4708 ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_CTS_ENABLE)) {
4709 value = cfg_max(CFG_RTS_THRESHOLD);
4710 } else {
4711 hdd_err_rl("Invalid value %d", rtscts);
4712 return -EINVAL;
4713 }
4714
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004715 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson71d80382018-10-25 15:45:01 -07004716 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4717 rtscts, VDEV_CMD);
4718 if (errno) {
4719 hdd_err("Failed to set firmware, errno %d", errno);
4720 return errno;
4721 }
4722
4723 status = ucfg_mlme_set_rts_threshold(hdd_ctx->psoc, value);
4724 if (QDF_IS_STATUS_ERROR(status)) {
4725 hdd_err("Set rts threshold failed, status %d", status);
4726 return -EINVAL;
4727 }
4728
4729 return 0;
4730}
4731
Jeff Johnson50b15882018-10-26 10:27:37 -07004732static int hdd_we_set_11n_rate(struct hdd_adapter *adapter, int rate_code)
4733{
4734 uint8_t preamble = 0, nss = 0, rix = 0;
4735 int errno;
4736
4737 hdd_debug("Rate code %d", rate_code);
4738
4739 if (rate_code != 0xff) {
4740 rix = RC_2_RATE_IDX(rate_code);
4741 if (rate_code & 0x80) {
4742 preamble = WMI_RATE_PREAMBLE_HT;
4743 nss = HT_RC_2_STREAMS(rate_code) - 1;
4744 } else {
4745 nss = 0;
4746 rix = RC_2_RATE_IDX(rate_code);
4747 if (rate_code & 0x10) {
4748 preamble = WMI_RATE_PREAMBLE_CCK;
4749 if (rix != 0x3)
4750 /* Enable Short preamble
4751 * always for CCK except 1mbps
4752 */
4753 rix |= 0x4;
4754 } else {
4755 preamble = WMI_RATE_PREAMBLE_OFDM;
4756 }
4757 }
4758 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4759 }
4760
4761 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4762 rate_code, rix, preamble, nss);
4763
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004764 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson50b15882018-10-26 10:27:37 -07004765 WMI_VDEV_PARAM_FIXED_RATE,
4766 rate_code, VDEV_CMD);
4767 if (errno)
4768 hdd_err("Failed to set firmware, errno %d", errno);
4769
4770 return errno;
4771}
4772
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004773static int hdd_we_set_vht_rate(struct hdd_adapter *adapter, int rate_code)
4774{
4775 uint8_t preamble = 0, nss = 0, rix = 0;
4776 int errno;
4777
4778 hdd_debug("Rate code %d", rate_code);
4779
4780 if (rate_code != 0xff) {
4781 rix = RC_2_RATE_IDX_11AC(rate_code);
4782 preamble = WMI_RATE_PREAMBLE_VHT;
4783 nss = HT_RC_2_STREAMS_11AC(rate_code) - 1;
4784 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4785 }
4786
4787 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4788 rate_code, rix, preamble, nss);
4789
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004790 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004791 WMI_VDEV_PARAM_FIXED_RATE,
4792 rate_code, VDEV_CMD);
4793 if (errno)
4794 hdd_err("Failed to set firmware, errno %d", errno);
4795
4796 return errno;
4797}
4798
Jeff Johnson7c433502018-11-12 15:00:52 -08004799static int hdd_we_set_ampdu(struct hdd_adapter *adapter, int ampdu)
4800{
4801 hdd_debug("AMPDU %d", ampdu);
4802
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004803 return wma_cli_set_command(adapter->vdev_id,
Jeff Johnson7c433502018-11-12 15:00:52 -08004804 GEN_VDEV_PARAM_AMPDU,
4805 ampdu, GEN_CMD);
4806}
4807
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004808static int hdd_we_set_amsdu(struct hdd_adapter *adapter, int amsdu)
4809{
4810 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4811 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4812 int errno;
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304813 QDF_STATUS status;
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004814
4815 hdd_debug("AMSDU %d", amsdu);
4816
4817 if (!mac_handle) {
4818 hdd_err("NULL Mac handle");
4819 return -EINVAL;
4820 }
4821
4822 if (amsdu > 1)
4823 sme_set_amsdu(mac_handle, true);
4824 else
4825 sme_set_amsdu(mac_handle, false);
4826
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004827 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004828 GEN_VDEV_PARAM_AMSDU,
4829 amsdu, GEN_CMD);
4830 if (errno) {
4831 hdd_err("Failed to set firmware, errno %d", errno);
4832 return errno;
4833 }
4834
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304835 status = ucfg_mlme_set_max_amsdu_num(hdd_ctx->psoc,
4836 amsdu);
4837 if (QDF_IS_STATUS_ERROR(status))
4838 hdd_err("Failed to set Max AMSDU Num to cfg");
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004839
4840 return 0;
4841}
4842
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004843static int hdd_we_clear_stats(struct hdd_adapter *adapter, int option)
4844{
4845 hdd_debug("option %d", option);
4846
4847 switch (option) {
4848 case CDP_HDD_STATS:
4849 memset(&adapter->stats, 0, sizeof(adapter->stats));
4850 memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
4851 break;
4852 case CDP_TXRX_HIST_STATS:
4853 wlan_hdd_clear_tx_rx_histogram(adapter->hdd_ctx);
4854 break;
4855 case CDP_HDD_NETIF_OPER_HISTORY:
4856 wlan_hdd_clear_netif_queue_history(adapter->hdd_ctx);
4857 break;
4858 case CDP_HIF_STATS:
4859 hdd_clear_hif_stats();
4860 break;
4861 case CDP_NAPI_STATS:
4862 hdd_clear_napi_stats();
4863 break;
4864 default:
4865 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4866 option);
4867 }
4868
4869 return 0;
4870}
4871
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004872static int hdd_we_set_green_tx_param(struct hdd_adapter *adapter,
4873 green_tx_param id,
4874 const char *id_string,
4875 int value)
4876{
4877 int errno;
4878
4879 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004880 errno = wma_cli_set_command(adapter->vdev_id, id, value, GTX_CMD);
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004881 if (errno)
4882 hdd_err("Failed to set firmware, errno %d", errno);
4883
4884 return errno;
4885}
4886
4887#define hdd_we_set_green_tx_param(adapter, id, value) \
4888 hdd_we_set_green_tx_param(adapter, id, #id, value)
4889
4890static int hdd_we_set_gtx_ht_mcs(struct hdd_adapter *adapter, int value)
4891{
4892 return hdd_we_set_green_tx_param(adapter,
4893 WMI_VDEV_PARAM_GTX_HT_MCS,
4894 value);
4895}
4896
4897static int hdd_we_set_gtx_vht_mcs(struct hdd_adapter *adapter, int value)
4898{
4899 return hdd_we_set_green_tx_param(adapter,
4900 WMI_VDEV_PARAM_GTX_VHT_MCS,
4901 value);
4902}
4903
4904static int hdd_we_set_gtx_usrcfg(struct hdd_adapter *adapter, int value)
4905{
4906 return hdd_we_set_green_tx_param(adapter,
4907 WMI_VDEV_PARAM_GTX_USR_CFG,
4908 value);
4909}
4910
4911static int hdd_we_set_gtx_thre(struct hdd_adapter *adapter, int value)
4912{
4913 return hdd_we_set_green_tx_param(adapter,
4914 WMI_VDEV_PARAM_GTX_THRE,
4915 value);
4916}
4917
4918static int hdd_we_set_gtx_margin(struct hdd_adapter *adapter, int value)
4919{
4920 return hdd_we_set_green_tx_param(adapter,
4921 WMI_VDEV_PARAM_GTX_MARGIN,
4922 value);
4923}
4924
4925static int hdd_we_set_gtx_step(struct hdd_adapter *adapter, int value)
4926{
4927 return hdd_we_set_green_tx_param(adapter,
4928 WMI_VDEV_PARAM_GTX_STEP,
4929 value);
4930}
4931
4932static int hdd_we_set_gtx_mintpc(struct hdd_adapter *adapter, int value)
4933{
4934 return hdd_we_set_green_tx_param(adapter,
4935 WMI_VDEV_PARAM_GTX_MINTPC,
4936 value);
4937}
4938
4939static int hdd_we_set_gtx_bwmask(struct hdd_adapter *adapter, int value)
4940{
4941 return hdd_we_set_green_tx_param(adapter,
4942 WMI_VDEV_PARAM_GTX_BW_MASK,
4943 value);
4944}
4945
Jeff Johnsond0477f22018-10-29 12:26:25 -07004946static int hdd_we_packet_power_save(struct hdd_adapter *adapter,
4947 packet_power_save id,
4948 const char *id_string,
4949 int value)
4950{
4951 int errno;
4952
4953 if (adapter->device_mode != QDF_STA_MODE) {
4954 hdd_err_rl("Not supported in mode %d", adapter->device_mode);
4955 return -EINVAL;
4956 }
4957
4958 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004959 errno = wma_cli_set_command(adapter->vdev_id, id, value, PPS_CMD);
Jeff Johnsond0477f22018-10-29 12:26:25 -07004960 if (errno)
4961 hdd_err("Failed to set firmware, errno %d", errno);
4962
4963 return errno;
4964}
4965
4966#define hdd_we_packet_power_save(adapter, id, value) \
4967 hdd_we_packet_power_save(adapter, id, #id, value)
4968
4969static int hdd_we_pps_paid_match(struct hdd_adapter *adapter, int value)
4970{
4971 return hdd_we_packet_power_save(adapter,
4972 WMI_VDEV_PPS_PAID_MATCH,
4973 value);
4974}
4975
4976static int hdd_we_pps_gid_match(struct hdd_adapter *adapter, int value)
4977{
4978 return hdd_we_packet_power_save(adapter,
4979 WMI_VDEV_PPS_GID_MATCH,
4980 value);
4981}
4982
4983static int hdd_we_pps_early_tim_clear(struct hdd_adapter *adapter, int value)
4984{
4985 return hdd_we_packet_power_save(adapter,
4986 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4987 value);
4988}
4989
4990static int hdd_we_pps_early_dtim_clear(struct hdd_adapter *adapter, int value)
4991{
4992 return hdd_we_packet_power_save(adapter,
4993 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4994 value);
4995}
4996
4997static int hdd_we_pps_eof_pad_delim(struct hdd_adapter *adapter, int value)
4998{
4999 return hdd_we_packet_power_save(adapter,
5000 WMI_VDEV_PPS_EOF_PAD_DELIM,
5001 value);
5002}
5003
5004static int hdd_we_pps_macaddr_mismatch(struct hdd_adapter *adapter, int value)
5005{
5006 return hdd_we_packet_power_save(adapter,
5007 WMI_VDEV_PPS_MACADDR_MISMATCH,
5008 value);
5009}
5010
5011static int hdd_we_pps_delim_crc_fail(struct hdd_adapter *adapter, int value)
5012{
5013 return hdd_we_packet_power_save(adapter,
5014 WMI_VDEV_PPS_DELIM_CRC_FAIL,
5015 value);
5016}
5017
5018static int hdd_we_pps_gid_nsts_zero(struct hdd_adapter *adapter, int value)
5019{
5020 return hdd_we_packet_power_save(adapter,
5021 WMI_VDEV_PPS_GID_NSTS_ZERO,
5022 value);
5023}
5024
5025static int hdd_we_pps_rssi_check(struct hdd_adapter *adapter, int value)
5026{
5027 return hdd_we_packet_power_save(adapter,
5028 WMI_VDEV_PPS_RSSI_CHECK,
5029 value);
5030}
5031
5032static int hdd_we_pps_5g_ebt(struct hdd_adapter *adapter, int value)
5033{
5034 return hdd_we_packet_power_save(adapter,
5035 WMI_VDEV_PPS_5G_EBT,
5036 value);
5037}
5038
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07005039static int hdd_we_set_qpower(struct hdd_adapter *adapter,
5040 enum wmi_sta_powersave_param id,
5041 const char *id_string,
5042 int value)
5043{
5044 int errno;
5045
5046 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005047 errno = wma_cli_set_command(adapter->vdev_id, id, value, QPOWER_CMD);
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07005048 if (errno)
5049 hdd_err("Failed to set firmware, errno %d", errno);
5050
5051 return errno;
5052}
5053
5054#define hdd_we_set_qpower(adapter, id, value) \
5055 hdd_we_set_qpower(adapter, id, #id, value)
5056
5057static int
5058hdd_we_set_qpower_max_pspoll_count(struct hdd_adapter *adapter, int value)
5059{
5060 enum wmi_sta_powersave_param id =
5061 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT;
5062
5063 return hdd_we_set_qpower(adapter, id, value);
5064}
5065
5066static int
5067hdd_we_set_qpower_max_tx_before_wake(struct hdd_adapter *adapter, int value)
5068{
5069 enum wmi_sta_powersave_param id =
5070 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE;
5071
5072 return hdd_we_set_qpower(adapter, id, value);
5073}
5074
5075static int
5076hdd_we_set_qpower_spec_pspoll_wake_interval(struct hdd_adapter *adapter,
5077 int value)
5078{
5079 enum wmi_sta_powersave_param id =
5080 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL;
5081
5082 return hdd_we_set_qpower(adapter, id, value);
5083}
5084
5085static int
5086hdd_we_set_qpower_spec_max_spec_nodata_pspoll(struct hdd_adapter *adapter,
5087 int value)
5088{
5089 enum wmi_sta_powersave_param id =
5090 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL;
5091
5092 return hdd_we_set_qpower(adapter, id, value);
5093}
5094
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005095static int hdd_we_set_pdev(struct hdd_adapter *adapter,
5096 WMI_PDEV_PARAM id,
5097 const char *id_string,
5098 int value)
5099{
5100 int errno;
5101
5102 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005103 errno = wma_cli_set_command(adapter->vdev_id, id, value, PDEV_CMD);
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005104 if (errno)
5105 hdd_err("Failed to set firmware, errno %d", errno);
5106
5107 return errno;
5108}
5109
5110#define hdd_we_set_pdev(adapter, id, value) \
5111 hdd_we_set_pdev(adapter, id, #id, value)
5112
5113static int hdd_we_set_ani_en_dis(struct hdd_adapter *adapter, int value)
5114{
5115 return hdd_we_set_pdev(adapter,
5116 WMI_PDEV_PARAM_ANI_ENABLE,
5117 value);
5118}
5119
5120static int hdd_we_set_ani_poll_period(struct hdd_adapter *adapter, int value)
5121{
5122 return hdd_we_set_pdev(adapter,
5123 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
5124 value);
5125}
5126
5127static int hdd_we_set_ani_listen_period(struct hdd_adapter *adapter, int value)
5128{
5129 return hdd_we_set_pdev(adapter,
5130 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
5131 value);
5132}
5133
5134static int hdd_we_set_ani_ofdm_level(struct hdd_adapter *adapter, int value)
5135{
5136 return hdd_we_set_pdev(adapter,
5137 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
5138 value);
5139}
5140
5141static int hdd_we_set_ani_cck_level(struct hdd_adapter *adapter, int value)
5142{
5143 return hdd_we_set_pdev(adapter,
5144 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
5145 value);
5146}
5147
5148static int hdd_we_set_dynamic_bw(struct hdd_adapter *adapter, int value)
5149{
5150 return hdd_we_set_pdev(adapter,
5151 WMI_PDEV_PARAM_DYNAMIC_BW,
5152 value);
5153}
5154
5155static int hdd_we_set_cts_cbw(struct hdd_adapter *adapter, int value)
5156{
5157 return hdd_we_set_pdev(adapter,
5158 WMI_PDEV_PARAM_CTS_CBW,
5159 value);
5160}
5161
5162static int hdd_we_set_tx_chainmask(struct hdd_adapter *adapter, int value)
5163{
5164 int errno;
5165
5166 errno = hdd_we_set_pdev(adapter,
5167 WMI_PDEV_PARAM_TX_CHAIN_MASK,
5168 value);
5169 if (errno)
5170 return errno;
5171
5172 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5173}
5174
5175static int hdd_we_set_rx_chainmask(struct hdd_adapter *adapter, int value)
5176{
5177 int errno;
5178
5179 errno = hdd_we_set_pdev(adapter,
5180 WMI_PDEV_PARAM_RX_CHAIN_MASK,
5181 value);
5182 if (errno)
5183 return errno;
5184
5185 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5186}
5187
5188static int hdd_we_set_txpow_2g(struct hdd_adapter *adapter, int value)
5189{
5190 return hdd_we_set_pdev(adapter,
5191 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
5192 value);
5193}
5194
5195static int hdd_we_set_txpow_5g(struct hdd_adapter *adapter, int value)
5196{
5197 return hdd_we_set_pdev(adapter,
5198 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
5199 value);
5200}
5201
Jeff Johnson2e381272018-11-10 09:33:39 -08005202static int hdd_we_set_vdev(struct hdd_adapter *adapter,
5203 int id,
5204 const char *id_string,
5205 int value)
5206{
5207 int errno;
5208
5209 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005210 errno = wma_cli_set_command(adapter->vdev_id, id, value, VDEV_CMD);
Jeff Johnson2e381272018-11-10 09:33:39 -08005211 if (errno)
5212 hdd_err("Failed to set firmware, errno %d", errno);
5213
5214 return errno;
5215}
5216
5217#define hdd_we_set_vdev(adapter, id, value) \
5218 hdd_we_set_vdev(adapter, id, #id, value)
5219
5220static int hdd_we_set_txrx_fwstats(struct hdd_adapter *adapter, int value)
5221{
5222 return hdd_we_set_vdev(adapter,
5223 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
5224 value);
5225}
5226
5227static int hdd_we_txrx_fwstats_reset(struct hdd_adapter *adapter, int value)
5228{
5229 return hdd_we_set_vdev(adapter,
5230 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
5231 value);
5232}
5233
5234static int hdd_we_set_htsmps(struct hdd_adapter *adapter, int value)
5235{
5236 return hdd_we_set_vdev(adapter,
5237 WMI_STA_SMPS_FORCE_MODE_CMDID,
5238 value);
5239}
5240
5241static int hdd_we_set_early_rx_adjust_enable(struct hdd_adapter *adapter,
5242 int value)
5243{
5244 if ((value != 0) && (value != 1))
5245 return -EINVAL;
5246
5247 return hdd_we_set_vdev(adapter,
5248 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
5249 value);
5250}
5251
5252static int hdd_we_set_early_rx_tgt_bmiss_num(struct hdd_adapter *adapter,
5253 int value)
5254{
5255 return hdd_we_set_vdev(adapter,
5256 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
5257 value);
5258}
5259
5260static int hdd_we_set_early_rx_bmiss_sample_cycle(struct hdd_adapter *adapter,
5261 int value)
5262{
5263 return hdd_we_set_vdev(adapter,
5264 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
5265 value);
5266}
5267
5268static int hdd_we_set_early_rx_slop_step(struct hdd_adapter *adapter, int value)
5269{
5270 return hdd_we_set_vdev(adapter,
5271 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
5272 value);
5273}
5274
5275static int hdd_we_set_early_rx_init_slop(struct hdd_adapter *adapter, int value)
5276{
5277 return hdd_we_set_vdev(adapter,
5278 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
5279 value);
5280}
5281
5282static int hdd_we_set_early_rx_adjust_pause(struct hdd_adapter *adapter,
5283 int value)
5284{
5285 if ((value != 0) && (value != 1))
5286 return -EINVAL;
5287
5288 return hdd_we_set_vdev(adapter,
5289 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
5290 value);
5291}
5292
5293static int hdd_we_set_early_rx_drift_sample(struct hdd_adapter *adapter,
5294 int value)
5295{
5296 return hdd_we_set_vdev(adapter,
5297 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
5298 value);
5299}
5300
5301static int hdd_we_set_dcm(struct hdd_adapter *adapter, int value)
5302{
5303 return hdd_we_set_vdev(adapter,
5304 WMI_VDEV_PARAM_HE_DCM,
5305 value);
5306}
5307
5308static int hdd_we_set_range_ext(struct hdd_adapter *adapter, int value)
5309{
5310 return hdd_we_set_vdev(adapter,
5311 WMI_VDEV_PARAM_HE_RANGE_EXT,
5312 value);
5313}
5314
Jeff Johnson22e57f12018-11-10 16:02:00 -08005315static int hdd_we_set_dbg(struct hdd_adapter *adapter,
5316 int id,
5317 const char *id_string,
5318 int value)
5319{
5320 int errno;
5321
5322 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005323 errno = wma_cli_set_command(adapter->vdev_id, id, value, DBG_CMD);
Jeff Johnson22e57f12018-11-10 16:02:00 -08005324 if (errno)
5325 hdd_err("Failed to set firmware, errno %d", errno);
5326
5327 return errno;
5328}
5329
5330#define hdd_we_set_dbg(adapter, id, value) \
5331 hdd_we_set_dbg(adapter, id, #id, value)
5332
5333static int hdd_we_dbglog_log_level(struct hdd_adapter *adapter, int value)
5334{
5335 return hdd_we_set_dbg(adapter,
5336 WMI_DBGLOG_LOG_LEVEL,
5337 value);
5338}
5339
5340static int hdd_we_dbglog_vap_enable(struct hdd_adapter *adapter, int value)
5341{
5342 return hdd_we_set_dbg(adapter,
5343 WMI_DBGLOG_VAP_ENABLE,
5344 value);
5345}
5346
5347static int hdd_we_dbglog_vap_disable(struct hdd_adapter *adapter, int value)
5348{
5349 return hdd_we_set_dbg(adapter,
5350 WMI_DBGLOG_VAP_DISABLE,
5351 value);
5352}
5353
5354static int hdd_we_dbglog_module_enable(struct hdd_adapter *adapter, int value)
5355{
5356 return hdd_we_set_dbg(adapter,
5357 WMI_DBGLOG_MODULE_ENABLE,
5358 value);
5359}
5360
5361static int hdd_we_dbglog_module_disable(struct hdd_adapter *adapter, int value)
5362{
5363 return hdd_we_set_dbg(adapter,
5364 WMI_DBGLOG_MODULE_DISABLE,
5365 value);
5366}
5367
5368static int hdd_we_dbglog_mod_log_level(struct hdd_adapter *adapter, int value)
5369{
5370 return hdd_we_set_dbg(adapter,
5371 WMI_DBGLOG_MOD_LOG_LEVEL,
5372 value);
5373}
5374
5375static int hdd_we_dbglog_type(struct hdd_adapter *adapter, int value)
5376{
5377 return hdd_we_set_dbg(adapter,
5378 WMI_DBGLOG_TYPE,
5379 value);
5380}
5381
5382static int hdd_we_dbglog_report_enable(struct hdd_adapter *adapter, int value)
5383{
5384 return hdd_we_set_dbg(adapter,
5385 WMI_DBGLOG_REPORT_ENABLE,
5386 value);
5387}
5388
5389static int hdd_we_start_fw_profile(struct hdd_adapter *adapter, int value)
5390{
5391 return hdd_we_set_dbg(adapter,
5392 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5393 value);
5394}
5395
Jeff Johnson274a1d62018-11-12 20:31:51 -08005396static int hdd_we_set_channel(struct hdd_adapter *adapter, int channel)
5397{
5398 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5399 QDF_STATUS status;
5400
5401 hdd_debug("Set Channel %d Session ID %d mode %d", channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005402 adapter->vdev_id, adapter->device_mode);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005403
5404 if (!hdd_ctx->mac_handle)
5405 return -EINVAL;
5406
5407 switch (adapter->device_mode) {
5408 case QDF_STA_MODE:
5409 case QDF_P2P_CLIENT_MODE:
5410 /* supported */
5411 break;
5412 default:
5413 hdd_err("change channel not supported for device mode %d",
5414 adapter->device_mode);
5415 return -EINVAL;
5416 }
5417
5418 status = sme_ext_change_channel(hdd_ctx->mac_handle, channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005419 adapter->vdev_id);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005420 if (status != QDF_STATUS_SUCCESS)
5421 hdd_err("Error in change channel status %d", status);
5422
5423 return qdf_status_to_os_return(status);
5424}
5425
Jeff Johnson0e07ca12018-11-12 21:04:45 -08005426static int hdd_we_mcc_config_latency(struct hdd_adapter *adapter, int latency)
5427{
5428 hdd_debug("MCC latency %d", latency);
5429
5430 wlan_hdd_set_mcc_latency(adapter, latency);
5431
5432 return 0;
5433}
5434
5435static int hdd_we_mcc_config_quota(struct hdd_adapter *adapter, int quota)
5436{
5437 hdd_debug("MCC quota %dms", quota);
5438
5439 return wlan_hdd_set_mcc_p2p_quota(adapter, quota);
5440}
5441
Jeff Johnson33ec1982018-11-12 21:40:33 -08005442static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value)
5443{
5444 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5445
5446 if (!hdd_ctx->mac_handle)
5447 return -EINVAL;
5448
5449 sme_update_connect_debug(hdd_ctx->mac_handle, value);
5450
5451 return 0;
5452}
5453
Jeff Johnsone50951c2018-11-13 12:20:23 -08005454static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value)
5455{
5456 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5457
5458 hdd_debug("%d", value);
5459
Abhishek Singh935e4772018-11-21 14:14:10 +05305460 if (!hdd_ctx->psoc)
Jeff Johnsone50951c2018-11-13 12:20:23 -08005461 return -EINVAL;
5462
Abhishek Singh935e4772018-11-21 14:14:10 +05305463 if (value)
5464 ucfg_scan_psoc_set_disable(hdd_ctx->psoc, REASON_USER_SPACE);
5465 else
5466 ucfg_scan_psoc_set_enable(hdd_ctx->psoc, REASON_USER_SPACE);
Jeff Johnsone50951c2018-11-13 12:20:23 -08005467
5468 return 0;
5469}
5470
Jeff Johnsond3f1efd2018-11-13 13:26:19 -08005471static int hdd_we_set_conc_system_pref(struct hdd_adapter *adapter,
5472 int preference)
5473{
5474 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5475
5476 hdd_debug("%d", preference);
5477
5478 if (!hdd_ctx->psoc)
5479 return -EINVAL;
5480
5481 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, preference);
5482
5483 return 0;
5484}
5485
Jeff Johnson74696bb2018-11-13 13:30:36 -08005486static int hdd_we_set_11ax_rate(struct hdd_adapter *adapter, int rate)
5487{
5488 return hdd_set_11ax_rate(adapter, rate, NULL);
5489}
5490
Jeff Johnsonb43ec122018-11-13 14:17:08 -08005491static int hdd_we_set_modulated_dtim(struct hdd_adapter *adapter, int value)
5492{
5493 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5494
5495 hdd_debug("%d", value);
5496
5497 if (!hdd_ctx->psoc)
5498 return -EINVAL;
5499
5500 if ((value < cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM)) ||
5501 (value > cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM))) {
5502 hdd_err("Invalid value %d", value);
5503 return -EINVAL;
5504 }
5505
5506 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, value);
5507
5508 return 0;
5509}
5510
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305511#ifdef WLAN_FEATURE_MOTION_DETECTION
5512/**
5513 * hdd_we_motion_det_start_stop - start/stop motion detection
5514 * @adapter: hdd adapter
5515 * @value: start/stop value to set
5516 *
5517 * Return: 0 on success, error on failure
5518 */
5519static int hdd_we_motion_det_start_stop(struct hdd_adapter *adapter, int value)
5520{
5521 struct sme_motion_det_en motion_det;
5522 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5523
5524 if (value < 0 || value > 1) {
5525 hdd_err("Invalid value %d in mt_start", value);
5526 return -EINVAL;
5527 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005528 motion_det.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305529 motion_det.enable = value;
5530
5531 if (!value)
5532 adapter->motion_detection_mode = 0;
5533
5534 sme_motion_det_enable(hdd_ctx->mac_handle, &motion_det);
5535
5536 return 0;
5537}
5538
5539/**
5540 * hdd_we_motion_det_base_line_start_stop - start/stop md baselining
5541 * @adapter: hdd adapter
5542 * @value: start/stop value to set
5543 *
5544 * Return: 0 on success, error on failure
5545 */
5546static int hdd_we_motion_det_base_line_start_stop(struct hdd_adapter *adapter,
5547 int value)
5548{
5549 struct sme_motion_det_base_line_en motion_det_base_line;
5550 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5551
5552 if (value < 0 || value > 1) {
5553 hdd_err("Invalid value %d in mt_bl_start", value);
5554 return -EINVAL;
5555 }
5556
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005557 motion_det_base_line.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305558 motion_det_base_line.enable = value;
5559 sme_motion_det_base_line_enable(hdd_ctx->mac_handle,
5560 &motion_det_base_line);
5561
5562 return 0;
5563}
5564#endif /* WLAN_FEATURE_MOTION_DETECTION */
5565
Krishna Reddya50d09f2019-02-04 14:55:06 +05305566int wlan_hdd_set_btcoex_mode(struct hdd_adapter *adapter, int value)
5567{
5568 struct coex_config_params coex_cfg_params = {0};
5569
5570 coex_cfg_params.config_type = WMI_COEX_CONFIG_BTC_MODE;
5571 coex_cfg_params.config_arg1 = value;
5572 coex_cfg_params.vdev_id = adapter->vdev_id;
5573
5574 if (value < cfg_min(CFG_BTC_MODE) || value > cfg_max(CFG_BTC_MODE)) {
5575 hdd_err_rl("Invalid value %d", value);
5576 return -EINVAL;
5577 }
5578
5579 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5580 hdd_err_rl("Failed to send coex BTC mode");
5581 return -EINVAL;
5582 }
5583
5584 return 0;
5585}
5586
5587int wlan_hdd_set_btcoex_rssi_threshold(struct hdd_adapter *adapter, int value)
5588{
5589 struct coex_config_params coex_cfg_params = {0};
5590
5591 coex_cfg_params.config_type = WMI_COEX_CONFIG_BT_LOW_RSSI_THRESHOLD;
5592 coex_cfg_params.config_arg1 = value;
5593 coex_cfg_params.vdev_id = adapter->vdev_id;
5594
5595 if (value < cfg_min(CFG_WLAN_LOW_RSSI_THRESHOLD) ||
5596 value > cfg_max(CFG_WLAN_LOW_RSSI_THRESHOLD)) {
5597 hdd_err_rl("Invalid value %d", value);
5598 return -EINVAL;
5599 }
5600
5601 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5602 hdd_err_rl("Failed to send coex BTC RSSI Threshold");
5603 return -EINVAL;
5604 }
5605 return 0;
5606}
Jeff Johnson3ba27322018-11-13 17:58:28 -08005607typedef int (*setint_getnone_fn)(struct hdd_adapter *adapter, int value);
5608static const setint_getnone_fn setint_getnone_cb[] = {
5609 [WE_SET_11D_STATE] = hdd_we_set_11d_state,
5610 [WE_SET_POWER] = hdd_we_set_power,
5611 [WE_SET_MAX_ASSOC] = hdd_we_set_max_assoc,
5612 [WE_SET_DATA_INACTIVITY_TO] = hdd_we_set_data_inactivity_timeout,
5613 [WE_SET_WOW_DATA_INACTIVITY_TO] =
5614 hdd_we_set_wow_data_inactivity_timeout,
5615 [WE_SET_MC_RATE] = wlan_hdd_set_mc_rate,
5616 [WE_SET_TX_POWER] = hdd_we_set_tx_power,
5617 [WE_SET_MAX_TX_POWER] = hdd_we_set_max_tx_power,
5618 [WE_SET_MAX_TX_POWER_2_4] = hdd_we_set_max_tx_power_2_4,
5619 [WE_SET_MAX_TX_POWER_5_0] = hdd_we_set_max_tx_power_5_0,
Jeff Johnson0187c622019-01-04 06:39:44 -08005620#ifdef HASTINGS_BT_WAR
5621 [WE_SET_HASTINGS_BT_WAR] = hdd_we_set_hastings_bt_war,
5622#endif
Jeff Johnson3ba27322018-11-13 17:58:28 -08005623 [WE_SET_TM_LEVEL] = hdd_we_set_tm_level,
5624 [WE_SET_PHYMODE] = wlan_hdd_update_phymode,
5625 [WE_SET_NSS] = hdd_we_set_nss,
5626 [WE_SET_GTX_HT_MCS] = hdd_we_set_gtx_ht_mcs,
5627 [WE_SET_GTX_VHT_MCS] = hdd_we_set_gtx_vht_mcs,
5628 [WE_SET_GTX_USRCFG] = hdd_we_set_gtx_usrcfg,
5629 [WE_SET_GTX_THRE] = hdd_we_set_gtx_thre,
5630 [WE_SET_GTX_MARGIN] = hdd_we_set_gtx_margin,
5631 [WE_SET_GTX_STEP] = hdd_we_set_gtx_step,
5632 [WE_SET_GTX_MINTPC] = hdd_we_set_gtx_mintpc,
5633 [WE_SET_GTX_BWMASK] = hdd_we_set_gtx_bwmask,
5634 [WE_SET_LDPC] = hdd_set_ldpc,
5635 [WE_SET_TX_STBC] = hdd_set_tx_stbc,
5636 [WE_SET_RX_STBC] = hdd_set_rx_stbc,
5637 [WE_SET_SHORT_GI] = hdd_we_set_short_gi,
5638 [WE_SET_RTSCTS] = hdd_we_set_rtscts,
5639 [WE_SET_CHWIDTH] = hdd_we_set_ch_width,
5640 [WE_SET_ANI_EN_DIS] = hdd_we_set_ani_en_dis,
5641 [WE_SET_ANI_POLL_PERIOD] = hdd_we_set_ani_poll_period,
5642 [WE_SET_ANI_LISTEN_PERIOD] = hdd_we_set_ani_listen_period,
5643 [WE_SET_ANI_OFDM_LEVEL] = hdd_we_set_ani_ofdm_level,
5644 [WE_SET_ANI_CCK_LEVEL] = hdd_we_set_ani_cck_level,
5645 [WE_SET_DYNAMIC_BW] = hdd_we_set_dynamic_bw,
5646 [WE_SET_CTS_CBW] = hdd_we_set_cts_cbw,
5647 [WE_SET_11N_RATE] = hdd_we_set_11n_rate,
5648 [WE_SET_VHT_RATE] = hdd_we_set_vht_rate,
5649 [WE_SET_AMPDU] = hdd_we_set_ampdu,
5650 [WE_SET_AMSDU] = hdd_we_set_amsdu,
5651 [WE_SET_TX_CHAINMASK] = hdd_we_set_tx_chainmask,
5652 [WE_SET_RX_CHAINMASK] = hdd_we_set_rx_chainmask,
5653 [WE_SET_TXPOW_2G] = hdd_we_set_txpow_2g,
5654 [WE_SET_TXPOW_5G] = hdd_we_set_txpow_5g,
5655 [WE_DBGLOG_LOG_LEVEL] = hdd_we_dbglog_log_level,
5656 [WE_DBGLOG_VAP_ENABLE] = hdd_we_dbglog_vap_enable,
5657 [WE_DBGLOG_VAP_DISABLE] = hdd_we_dbglog_vap_disable,
5658 [WE_DBGLOG_MODULE_ENABLE] = hdd_we_dbglog_module_enable,
5659 [WE_DBGLOG_MODULE_DISABLE] = hdd_we_dbglog_module_disable,
5660 [WE_DBGLOG_MOD_LOG_LEVEL] = hdd_we_dbglog_mod_log_level,
5661 [WE_DBGLOG_TYPE] = hdd_we_dbglog_type,
5662 [WE_DBGLOG_REPORT_ENABLE] = hdd_we_dbglog_report_enable,
5663 [WE_SET_TXRX_FWSTATS] = hdd_we_set_txrx_fwstats,
5664 [WE_TXRX_FWSTATS_RESET] = hdd_we_txrx_fwstats_reset,
5665 [WE_DUMP_STATS] = hdd_wlan_dump_stats,
5666 [WE_CLEAR_STATS] = hdd_we_clear_stats,
5667 [WE_PPS_PAID_MATCH] = hdd_we_pps_paid_match,
5668 [WE_PPS_GID_MATCH] = hdd_we_pps_gid_match,
5669 [WE_PPS_EARLY_TIM_CLEAR] = hdd_we_pps_early_tim_clear,
5670 [WE_PPS_EARLY_DTIM_CLEAR] = hdd_we_pps_early_dtim_clear,
5671 [WE_PPS_EOF_PAD_DELIM] = hdd_we_pps_eof_pad_delim,
5672 [WE_PPS_MACADDR_MISMATCH] = hdd_we_pps_macaddr_mismatch,
5673 [WE_PPS_DELIM_CRC_FAIL] = hdd_we_pps_delim_crc_fail,
5674 [WE_PPS_GID_NSTS_ZERO] = hdd_we_pps_gid_nsts_zero,
5675 [WE_PPS_RSSI_CHECK] = hdd_we_pps_rssi_check,
5676 [WE_PPS_5G_EBT] = hdd_we_pps_5g_ebt,
5677 [WE_SET_HTSMPS] = hdd_we_set_htsmps,
5678 [WE_SET_QPOWER_MAX_PSPOLL_COUNT] = hdd_we_set_qpower_max_pspoll_count,
5679 [WE_SET_QPOWER_MAX_TX_BEFORE_WAKE] =
5680 hdd_we_set_qpower_max_tx_before_wake,
5681 [WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL] =
5682 hdd_we_set_qpower_spec_pspoll_wake_interval,
5683 [WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL] =
5684 hdd_we_set_qpower_spec_max_spec_nodata_pspoll,
5685 [WE_MCC_CONFIG_LATENCY] = hdd_we_mcc_config_latency,
5686 [WE_MCC_CONFIG_QUOTA] = hdd_we_mcc_config_quota,
5687 [WE_SET_DEBUG_LOG] = hdd_we_set_debug_log,
5688 [WE_SET_EARLY_RX_ADJUST_ENABLE] = hdd_we_set_early_rx_adjust_enable,
5689 [WE_SET_EARLY_RX_TGT_BMISS_NUM] = hdd_we_set_early_rx_tgt_bmiss_num,
5690 [WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE] =
5691 hdd_we_set_early_rx_bmiss_sample_cycle,
5692 [WE_SET_EARLY_RX_SLOP_STEP] = hdd_we_set_early_rx_slop_step,
5693 [WE_SET_EARLY_RX_INIT_SLOP] = hdd_we_set_early_rx_init_slop,
5694 [WE_SET_EARLY_RX_ADJUST_PAUSE] = hdd_we_set_early_rx_adjust_pause,
5695 [WE_SET_EARLY_RX_DRIFT_SAMPLE] = hdd_we_set_early_rx_drift_sample,
5696 [WE_SET_SCAN_DISABLE] = hdd_we_set_scan_disable,
5697 [WE_START_FW_PROFILE] = hdd_we_start_fw_profile,
5698 [WE_SET_CHANNEL] = hdd_we_set_channel,
5699 [WE_SET_CONC_SYSTEM_PREF] = hdd_we_set_conc_system_pref,
5700 [WE_SET_11AX_RATE] = hdd_we_set_11ax_rate,
5701 [WE_SET_DCM] = hdd_we_set_dcm,
5702 [WE_SET_RANGE_EXT] = hdd_we_set_range_ext,
5703 [WE_SET_PDEV_RESET] = hdd_handle_pdev_reset,
5704 [WE_SET_MODULATED_DTIM] = hdd_we_set_modulated_dtim,
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305705#ifdef WLAN_FEATURE_MOTION_DETECTION
5706 [WE_MOTION_DET_START_STOP] = hdd_we_motion_det_start_stop,
5707 [WE_MOTION_DET_BASE_LINE_START_STOP] =
5708 hdd_we_motion_det_base_line_start_stop,
5709#endif /* WLAN_FEATURE_MOTION_DETECTION */
Krishna Reddya50d09f2019-02-04 14:55:06 +05305710 [WE_SET_BTCOEX_MODE] = wlan_hdd_set_btcoex_mode,
5711 [WE_SET_BTCOEX_RSSI_THRESHOLD] = wlan_hdd_set_btcoex_rssi_threshold,
Jeff Johnson3ba27322018-11-13 17:58:28 -08005712};
5713
5714static setint_getnone_fn hdd_get_setint_getnone_cb(int param)
5715{
5716 if (param < 0)
5717 return NULL;
5718
5719 if (param >= QDF_ARRAY_SIZE(setint_getnone_cb))
5720 return NULL;
5721
5722 return setint_getnone_cb[param];
5723}
5724
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005725/**
5726 * iw_setint_getnone() - Generic "set integer" private ioctl handler
5727 * @dev: device upon which the ioctl was received
5728 * @info: ioctl request information
5729 * @wrqu: ioctl request data
5730 * @extra: ioctl extra data
5731 *
5732 * Return: 0 on success, non-zero on error
5733 */
5734static int __iw_setint_getnone(struct net_device *dev,
5735 struct iw_request_info *info,
5736 union iwreq_data *wrqu, char *extra)
5737{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005738 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005739 struct hdd_context *hdd_ctx;
Jeff Johnson3ba27322018-11-13 17:58:28 -08005740 setint_getnone_fn cb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005741 int *value = (int *)extra;
5742 int sub_cmd = value[0];
5743 int set_value = value[1];
5744 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005745
Dustin Brownfdf17c12018-03-14 12:55:34 -07005746 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305747
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005748 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005749 ret = wlan_hdd_validate_context(hdd_ctx);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005750 if (ret)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005751 return ret;
5752
Jeff Johnson441e1f72017-02-07 08:50:49 -08005753 ret = hdd_check_private_wext_control(hdd_ctx, info);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005754 if (ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08005755 return ret;
5756
Jeff Johnson3ba27322018-11-13 17:58:28 -08005757 cb = hdd_get_setint_getnone_cb(sub_cmd);
5758 if (!cb) {
Rajeev Kumard0565362018-03-01 12:02:01 -08005759 hdd_debug("Invalid sub command %d", sub_cmd);
Jeff Johnson3ba27322018-11-13 17:58:28 -08005760 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005761 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005762
Jeff Johnson3ba27322018-11-13 17:58:28 -08005763 ret = cb(adapter, set_value);
5764
Dustin Browne74003f2018-03-14 12:51:58 -07005765 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005766
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005767 return ret;
5768}
5769
5770static int iw_setint_getnone(struct net_device *dev,
5771 struct iw_request_info *info,
5772 union iwreq_data *wrqu,
5773 char *extra)
5774{
Dustin Brown389e5072018-11-08 17:10:01 +05305775 int errno;
5776 struct osif_vdev_sync *vdev_sync;
5777
5778 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5779 if (errno)
5780 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005781
Dustin Brown389e5072018-11-08 17:10:01 +05305782 errno = __iw_setint_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005783
Dustin Brown389e5072018-11-08 17:10:01 +05305784 osif_vdev_sync_op_stop(vdev_sync);
5785
5786 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005787}
5788
5789/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005790 * __iw_setnone_get_threeint() - return three value to up layer.
5791 *
5792 * @dev: pointer of net_device of this wireless card
5793 * @info: meta data about Request sent
5794 * @wrqu: include request info
5795 * @extra: buf used for in/Output
5796 *
5797 * Return: execute result
5798 */
5799static int __iw_setnone_get_threeint(struct net_device *dev,
5800 struct iw_request_info *info,
5801 union iwreq_data *wrqu, char *extra)
5802{
5803 int ret = 0; /* success */
5804 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005805 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005806 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005807
Dustin Brownfdf17c12018-03-14 12:55:34 -07005808 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005809 ret = wlan_hdd_validate_context(hdd_ctx);
5810 if (0 != ret)
5811 return ret;
5812
Jeff Johnson441e1f72017-02-07 08:50:49 -08005813 ret = hdd_check_private_wext_control(hdd_ctx, info);
5814 if (0 != ret)
5815 return ret;
5816
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005817 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005818 switch (value[0]) {
5819 case WE_GET_TSF:
5820 ret = hdd_indicate_tsf(adapter, value, 3);
5821 break;
5822 default:
5823 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5824 break;
5825 }
5826 return ret;
5827}
5828
5829/**
5830 * iw_setnone_get_threeint() - return three value to up layer.
5831 *
5832 * @dev: pointer of net_device of this wireless card
5833 * @info: meta data about Request sent
5834 * @wrqu: include request info
5835 * @extra: buf used for in/Output
5836 *
5837 * Return: execute result
5838 */
5839static int iw_setnone_get_threeint(struct net_device *dev,
5840 struct iw_request_info *info,
5841 union iwreq_data *wrqu, char *extra)
5842{
Dustin Brown389e5072018-11-08 17:10:01 +05305843 int errno;
5844 struct osif_vdev_sync *vdev_sync;
5845
5846 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5847 if (errno)
5848 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005849
Dustin Brown389e5072018-11-08 17:10:01 +05305850 errno = __iw_setnone_get_threeint(dev, info, wrqu, extra);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005851
Dustin Brown389e5072018-11-08 17:10:01 +05305852 osif_vdev_sync_op_stop(vdev_sync);
5853
5854 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005855}
5856
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005857#ifdef WLAN_UNIT_TEST
Dustin Brown7d038e52018-11-29 14:28:13 -08005858typedef uint32_t (*hdd_ut_callback)(void);
5859
5860struct hdd_ut_entry {
5861 const hdd_ut_callback callback;
5862 const char *name;
5863};
5864
5865struct hdd_ut_entry hdd_ut_entries[] = {
5866 { .name = "dsc", .callback = dsc_unit_test },
Dustin Brown05a0658f2019-03-05 11:27:38 -08005867 { .name = "qdf_delayed_work", .callback = qdf_delayed_work_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005868 { .name = "qdf_ht", .callback = qdf_ht_unit_test },
5869 { .name = "qdf_periodic_work",
5870 .callback = qdf_periodic_work_unit_test },
Dustin Brown128e2d02019-02-15 12:59:07 -08005871 { .name = "qdf_slist", .callback = qdf_slist_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005872 { .name = "qdf_talloc", .callback = qdf_talloc_unit_test },
5873 { .name = "qdf_types", .callback = qdf_types_unit_test },
Dustin Brown7d038e52018-11-29 14:28:13 -08005874};
5875
5876#define hdd_for_each_ut_entry(cursor) \
5877 for (cursor = hdd_ut_entries; \
5878 cursor < hdd_ut_entries + ARRAY_SIZE(hdd_ut_entries); \
5879 cursor++)
5880
5881static struct hdd_ut_entry *hdd_ut_lookup(const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005882{
Dustin Brown7d038e52018-11-29 14:28:13 -08005883 struct hdd_ut_entry *entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005884
Dustin Brown7d038e52018-11-29 14:28:13 -08005885 hdd_for_each_ut_entry(entry) {
5886 if (qdf_str_eq(entry->name, name))
5887 return entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005888 }
5889
Dustin Brown7d038e52018-11-29 14:28:13 -08005890 return NULL;
5891}
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005892
Dustin Brown7d038e52018-11-29 14:28:13 -08005893static uint32_t hdd_ut_single(const struct hdd_ut_entry *entry)
5894{
5895 uint32_t errors;
5896
5897 hdd_nofl_info("START: '%s'", entry->name);
5898
5899 errors = entry->callback();
5900 if (errors)
5901 hdd_nofl_err("FAIL: '%s' with %u errors", entry->name, errors);
5902 else
5903 hdd_nofl_info("PASS: '%s'", entry->name);
5904
5905 return errors;
5906}
5907
5908static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
5909{
5910 struct hdd_ut_entry *entry;
5911 uint32_t errors = 0;
5912
5913 hdd_nofl_info("Unit tests begin");
5914
5915 if (!name || !name[0] || qdf_str_eq(name, "all")) {
5916 hdd_for_each_ut_entry(entry)
5917 errors += hdd_ut_single(entry);
5918 } else {
5919 entry = hdd_ut_lookup(name);
5920 if (entry)
5921 errors += hdd_ut_single(entry);
5922 else
5923 hdd_nofl_err("Unit test '%s' not found", name);
5924 }
5925
5926 hdd_nofl_info("Unit tests complete");
5927
5928 return errors ? -EPERM : 0;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005929}
5930#else
Dustin Brown7d038e52018-11-29 14:28:13 -08005931static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005932{
5933 return -EOPNOTSUPP;
5934}
5935#endif /* WLAN_UNIT_TEST */
5936
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005937/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005938 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5939 * @dev: device upon which the ioctl was received
5940 * @info: ioctl request information
5941 * @wrqu: ioctl request data
5942 * @extra: ioctl extra data
5943 *
5944 * Return: 0 on success, non-zero on error
5945 */
5946static int __iw_setchar_getnone(struct net_device *dev,
5947 struct iw_request_info *info,
5948 union iwreq_data *wrqu, char *extra)
5949{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005950 int sub_cmd;
5951 int ret;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005952 char *str_arg = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005953 struct hdd_adapter *adapter = (netdev_priv(dev));
5954 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005955 struct iw_point s_priv_data;
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005956 bool neighbor_report_req_support = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005957
Dustin Brownfdf17c12018-03-14 12:55:34 -07005958 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005959
Mukul Sharma34777c62015-11-02 20:22:30 +05305960 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005961 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305962 return -EPERM;
5963 }
5964
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005965 ret = wlan_hdd_validate_context(hdd_ctx);
5966 if (0 != ret)
5967 return ret;
5968
Jeff Johnson441e1f72017-02-07 08:50:49 -08005969 ret = hdd_check_private_wext_control(hdd_ctx, info);
5970 if (0 != ret)
5971 return ret;
5972
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005973 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005974 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005975 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005976
5977 /* make sure all params are correctly passed to function */
Jeff Johnsond36fa332019-03-18 13:42:25 -07005978 if ((!s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005979 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005980
5981 sub_cmd = s_priv_data.flags;
5982
5983 /* ODD number is used for set, copy data using copy_from_user */
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005984 str_arg = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005985 s_priv_data.length);
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005986 if (!str_arg) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005987 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005988 return -ENOMEM;
5989 }
5990
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005991 hdd_debug("Received length: %d data: %s",
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005992 s_priv_data.length, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005993
5994 switch (sub_cmd) {
5995 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005996 hdd_debug("ADD_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305997 if (!hdd_add_wowl_ptrn(adapter, str_arg))
5998 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005999 break;
6000 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006001 hdd_debug("DEL_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05306002 if (!hdd_del_wowl_ptrn(adapter, str_arg))
6003 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006004 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006005 case WE_NEIGHBOR_REPORT_REQUEST:
6006 {
Jeff Johnson84b34332019-03-09 18:21:35 -08006007 tRrmNeighborReq request;
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006008 tRrmNeighborRspCallbackInfo callback;
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05306009 bool rrm_enabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006010
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05306011 ucfg_wlan_mlme_get_rrm_enabled(hdd_ctx->psoc,
6012 &rrm_enabled);
6013
6014 if (rrm_enabled) {
Jeff Johnson84b34332019-03-09 18:21:35 -08006015 request.neighbor_report_offload = false;
6016 request.no_ssid =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006017 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306018 hdd_debug("Neighbor Request ssid present %d",
Jeff Johnson84b34332019-03-09 18:21:35 -08006019 request.no_ssid);
6020 if (!request.no_ssid) {
6021 request.ssid.length =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006022 (s_priv_data.length - 1) >
6023 32 ? 32 : (s_priv_data.length - 1);
Jeff Johnson84b34332019-03-09 18:21:35 -08006024 qdf_mem_copy(request.ssid.ssId,
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006025 str_arg,
Jeff Johnson84b34332019-03-09 18:21:35 -08006026 request.ssid.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006027 }
6028
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306029 /*
6030 * If 11k offload is supported by FW and enabled
6031 * in the ini, set the offload to true
6032 */
Manikandan Mohan06d38d82018-11-26 18:36:58 -08006033 if (QDF_IS_STATUS_ERROR(
6034 ucfg_fwol_is_neighbor_report_req_supported(
6035 hdd_ctx->psoc, &neighbor_report_req_support)))
6036 hdd_err("Neighbor report req bit get fail");
6037
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306038 if (hdd_ctx->config->is_11k_offload_supported &&
Manikandan Mohan06d38d82018-11-26 18:36:58 -08006039 neighbor_report_req_support) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306040 hdd_debug("Neighbor report offloaded to FW");
Jeff Johnson84b34332019-03-09 18:21:35 -08006041 request.neighbor_report_offload = true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306042 }
6043
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006044 callback.neighborRspCallback = NULL;
6045 callback.neighborRspCallbackContext = NULL;
6046 callback.timeout = 5000; /* 5 seconds */
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306047 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006048 hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006049 adapter->vdev_id,
Jeff Johnson84b34332019-03-09 18:21:35 -08006050 &request,
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006051 &callback);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006052 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006053 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006054 ret = -EINVAL;
6055 }
6056 }
6057 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006058 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08006059 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006060 break;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006061 case WE_UNIT_TEST:
6062 ret = hdd_we_unit_test(hdd_ctx, str_arg);
6063 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006064 default:
6065 {
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006066 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006067 ret = -EINVAL;
6068 break;
6069 }
6070 }
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006071
6072 qdf_mem_free(str_arg);
Dustin Browne74003f2018-03-14 12:51:58 -07006073 hdd_exit();
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006074
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006075 return ret;
6076}
6077
6078static int iw_setchar_getnone(struct net_device *dev,
6079 struct iw_request_info *info,
6080 union iwreq_data *wrqu, char *extra)
6081{
Dustin Brown389e5072018-11-08 17:10:01 +05306082 int errno;
6083 struct osif_vdev_sync *vdev_sync;
6084
6085 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6086 if (errno)
6087 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006088
Dustin Brown389e5072018-11-08 17:10:01 +05306089 errno = __iw_setchar_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006090
Dustin Brown389e5072018-11-08 17:10:01 +05306091 osif_vdev_sync_op_stop(vdev_sync);
6092
6093 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006094}
6095
6096/**
6097 * iw_setnone_getint() - Generic "get integer" private ioctl handler
6098 * @dev: device upon which the ioctl was received
6099 * @info: ioctl request information
6100 * @wrqu: ioctl request data
6101 * @extra: ioctl extra data
6102 *
6103 * Return: 0 on success, non-zero on error
6104 */
6105static int __iw_setnone_getint(struct net_device *dev,
6106 struct iw_request_info *info,
6107 union iwreq_data *wrqu, char *extra)
6108{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006109 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006110 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006111 int *value = (int *)extra;
6112 int ret;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08006113 struct sme_config_params *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006114 struct hdd_context *hdd_ctx;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306115 QDF_STATUS status;
6116 bool bval = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006117
Dustin Brownfdf17c12018-03-14 12:55:34 -07006118 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306119
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006120 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006121 ret = wlan_hdd_validate_context(hdd_ctx);
6122 if (0 != ret)
6123 return ret;
6124
Jeff Johnson441e1f72017-02-07 08:50:49 -08006125 ret = hdd_check_private_wext_control(hdd_ctx, info);
6126 if (0 != ret)
6127 return ret;
6128
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08006129 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6130 if (!sme_config) {
6131 hdd_err("failed to allocate memory for sme_config");
6132 return -ENOMEM;
6133 }
6134
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006135 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006136 switch (value[0]) {
6137 case WE_GET_11D_STATE:
6138 {
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05306139 status = ucfg_mlme_is_11d_enabled(hdd_ctx->psoc, &bval);
6140 if (!QDF_IS_STATUS_SUCCESS(status))
6141 hdd_err("Invalid 11d_enable flag");
6142 *value = bval;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006143 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006144
6145 break;
6146 }
6147
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006148 case WE_GET_WLAN_DBG:
6149 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306150 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006151 *value = 0;
6152 break;
6153 }
6154 case WE_GET_MAX_ASSOC:
6155 {
Dustin Brown05d81302018-09-11 16:49:22 -07006156 if (ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, *value) !=
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306157 QDF_STATUS_SUCCESS) {
6158 hdd_err("CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006159 ret = -EIO;
6160 }
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306161
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006162 break;
6163 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006164
6165 case WE_GET_CONCURRENCY_MODE:
6166 {
Dustin Brown05d81302018-09-11 16:49:22 -07006167 *value = policy_mgr_get_concurrency_mode(hdd_ctx->psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006168
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006169 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006170 break;
6171 }
6172
6173 case WE_GET_NSS:
6174 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006175 sme_get_config_param(mac_handle, sme_config);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306176 status = ucfg_mlme_get_vht_enable2x2(hdd_ctx->psoc, &bval);
6177 if (!QDF_IS_STATUS_SUCCESS(status))
6178 hdd_err("unable to get vht_enable2x2");
6179 *value = (bval == 0) ? 1 : 2;
Dustin Brown05d81302018-09-11 16:49:22 -07006180 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc))
Srinivas Girigowda576b2352017-08-25 14:44:26 -07006181 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006182 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006183 break;
6184 }
6185
6186 case WE_GET_GTX_HT_MCS:
6187 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006188 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006189 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006190 WMI_VDEV_PARAM_GTX_HT_MCS,
6191 GTX_CMD);
6192 break;
6193 }
6194
6195 case WE_GET_GTX_VHT_MCS:
6196 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006197 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006198 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006199 WMI_VDEV_PARAM_GTX_VHT_MCS,
6200 GTX_CMD);
6201 break;
6202 }
6203
6204 case WE_GET_GTX_USRCFG:
6205 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006206 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006207 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006208 WMI_VDEV_PARAM_GTX_USR_CFG,
6209 GTX_CMD);
6210 break;
6211 }
6212
6213 case WE_GET_GTX_THRE:
6214 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006215 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006216 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006217 WMI_VDEV_PARAM_GTX_THRE,
6218 GTX_CMD);
6219 break;
6220 }
6221
6222 case WE_GET_GTX_MARGIN:
6223 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006224 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006225 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006226 WMI_VDEV_PARAM_GTX_MARGIN,
6227 GTX_CMD);
6228 break;
6229 }
6230
6231 case WE_GET_GTX_STEP:
6232 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006233 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006234 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006235 WMI_VDEV_PARAM_GTX_STEP,
6236 GTX_CMD);
6237 break;
6238 }
6239
6240 case WE_GET_GTX_MINTPC:
6241 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006242 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006243 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006244 WMI_VDEV_PARAM_GTX_MINTPC,
6245 GTX_CMD);
6246 break;
6247 }
6248
6249 case WE_GET_GTX_BWMASK:
6250 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006251 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006252 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006253 WMI_VDEV_PARAM_GTX_BW_MASK,
6254 GTX_CMD);
6255 break;
6256 }
6257
6258 case WE_GET_LDPC:
6259 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006260 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006261 break;
6262 }
6263
6264 case WE_GET_TX_STBC:
6265 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006266 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006267 break;
6268 }
6269
6270 case WE_GET_RX_STBC:
6271 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006272 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006273 break;
6274 }
6275
6276 case WE_GET_SHORT_GI:
6277 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006278 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006279 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08006280 WMI_VDEV_PARAM_SGI,
6281 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006282 break;
6283 }
6284
6285 case WE_GET_RTSCTS:
6286 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006287 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006288 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006289 WMI_VDEV_PARAM_ENABLE_RTSCTS,
6290 VDEV_CMD);
6291 break;
6292 }
6293
6294 case WE_GET_CHWIDTH:
6295 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006296 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006297 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006298 WMI_VDEV_PARAM_CHWIDTH,
6299 VDEV_CMD);
6300 break;
6301 }
6302
6303 case WE_GET_ANI_EN_DIS:
6304 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006305 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006306 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006307 WMI_PDEV_PARAM_ANI_ENABLE,
6308 PDEV_CMD);
6309 break;
6310 }
6311
6312 case WE_GET_ANI_POLL_PERIOD:
6313 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006314 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006315 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006316 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
6317 PDEV_CMD);
6318 break;
6319 }
6320
6321 case WE_GET_ANI_LISTEN_PERIOD:
6322 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006323 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006324 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006325 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
6326 PDEV_CMD);
6327 break;
6328 }
6329
6330 case WE_GET_ANI_OFDM_LEVEL:
6331 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006332 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006333 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006334 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
6335 PDEV_CMD);
6336 break;
6337 }
6338
6339 case WE_GET_ANI_CCK_LEVEL:
6340 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006341 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006342 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006343 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
6344 PDEV_CMD);
6345 break;
6346 }
6347
6348 case WE_GET_DYNAMIC_BW:
6349 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006350 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006351 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006352 WMI_PDEV_PARAM_DYNAMIC_BW,
6353 PDEV_CMD);
6354 break;
6355 }
6356
6357 case WE_GET_11N_RATE:
6358 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006359 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006360 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006361 WMI_VDEV_PARAM_FIXED_RATE,
6362 VDEV_CMD);
6363 break;
6364 }
6365
6366 case WE_GET_AMPDU:
6367 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006368 hdd_debug("GET AMPDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006369 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006370 GEN_VDEV_PARAM_AMPDU,
6371 GEN_CMD);
6372 break;
6373 }
6374
6375 case WE_GET_AMSDU:
6376 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006377 hdd_debug("GET AMSDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006378 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006379 GEN_VDEV_PARAM_AMSDU,
6380 GEN_CMD);
6381 break;
6382 }
6383
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006384 case WE_GET_ROAM_SYNCH_DELAY:
6385 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006386 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006387 *value = wma_cli_get_command(adapter->vdev_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006388 GEN_VDEV_ROAM_SYNCH_DELAY,
6389 GEN_CMD);
6390 break;
6391 }
6392
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006393 case WE_GET_TX_CHAINMASK:
6394 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006395 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006396 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006397 WMI_PDEV_PARAM_TX_CHAIN_MASK,
6398 PDEV_CMD);
6399 break;
6400 }
6401
6402 case WE_GET_RX_CHAINMASK:
6403 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006404 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006405 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006406 WMI_PDEV_PARAM_RX_CHAIN_MASK,
6407 PDEV_CMD);
6408 break;
6409 }
6410
6411 case WE_GET_TXPOW_2G:
6412 {
Wu Gao5f764082019-01-04 15:54:38 +08006413 uint8_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006414
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006415 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006416 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006417 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
6418 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006419 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow2g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006420 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006421 break;
6422 }
6423
6424 case WE_GET_TXPOW_5G:
6425 {
Wu Gao5f764082019-01-04 15:54:38 +08006426 uint8_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006427
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006428 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006429 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006430 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
6431 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006432 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow5g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006433 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006434 break;
6435 }
6436
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006437 case WE_GET_PPS_PAID_MATCH:
6438 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006439 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006440 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006441 WMI_VDEV_PPS_PAID_MATCH,
6442 PPS_CMD);
6443 break;
6444 }
6445
6446 case WE_GET_PPS_GID_MATCH:
6447 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006448 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006449 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006450 WMI_VDEV_PPS_GID_MATCH,
6451 PPS_CMD);
6452 break;
6453 }
6454
6455 case WE_GET_PPS_EARLY_TIM_CLEAR:
6456 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006457 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006458 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006459 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
6460 PPS_CMD);
6461 break;
6462 }
6463
6464 case WE_GET_PPS_EARLY_DTIM_CLEAR:
6465 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006466 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006467 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006468 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
6469 PPS_CMD);
6470 break;
6471 }
6472
6473 case WE_GET_PPS_EOF_PAD_DELIM:
6474 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006475 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006476 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006477 WMI_VDEV_PPS_EOF_PAD_DELIM,
6478 PPS_CMD);
6479 break;
6480 }
6481
6482 case WE_GET_PPS_MACADDR_MISMATCH:
6483 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006484 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006485 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006486 WMI_VDEV_PPS_MACADDR_MISMATCH,
6487 PPS_CMD);
6488 break;
6489 }
6490
6491 case WE_GET_PPS_DELIM_CRC_FAIL:
6492 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006493 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006494 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006495 WMI_VDEV_PPS_DELIM_CRC_FAIL,
6496 PPS_CMD);
6497 break;
6498 }
6499
6500 case WE_GET_PPS_GID_NSTS_ZERO:
6501 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006502 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006503 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006504 WMI_VDEV_PPS_GID_NSTS_ZERO,
6505 PPS_CMD);
6506 break;
6507 }
6508
6509 case WE_GET_PPS_RSSI_CHECK:
6510 {
6511
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006512 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006513 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006514 WMI_VDEV_PPS_RSSI_CHECK,
6515 PPS_CMD);
6516 break;
6517 }
6518
6519 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
6520 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006521 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006522 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006523 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
6524 QPOWER_CMD);
6525 break;
6526 }
6527
6528 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
6529 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006530 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006531 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006532 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
6533 QPOWER_CMD);
6534 break;
6535 }
6536
6537 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
6538 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006539 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006540 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006541 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
6542 QPOWER_CMD);
6543 break;
6544 }
6545
6546 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
6547 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006548 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006549 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006550 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
6551 QPOWER_CMD);
6552 break;
6553 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006554 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006555 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006556 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006557 case WE_GET_TEMPERATURE:
6558 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006559 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006560 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006561 break;
6562 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006563 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006564 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006565 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006566 WMI_VDEV_PARAM_HE_DCM,
6567 VDEV_CMD);
6568 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006569 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006570 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006571 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006572 WMI_VDEV_PARAM_HE_RANGE_EXT,
6573 VDEV_CMD);
6574 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006575 default:
6576 {
Jeff Johnson99bac312016-06-28 10:38:18 -07006577 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006578 value[0]);
6579 break;
6580 }
6581 }
Dustin Browne74003f2018-03-14 12:51:58 -07006582 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306583 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006584 return ret;
6585}
6586
6587static int iw_setnone_getint(struct net_device *dev,
6588 struct iw_request_info *info,
6589 union iwreq_data *wrqu, char *extra)
6590{
Dustin Brown389e5072018-11-08 17:10:01 +05306591 int errno;
6592 struct osif_vdev_sync *vdev_sync;
6593
6594 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6595 if (errno)
6596 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006597
Dustin Brown389e5072018-11-08 17:10:01 +05306598 errno = __iw_setnone_getint(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006599
Dustin Brown389e5072018-11-08 17:10:01 +05306600 osif_vdev_sync_op_stop(vdev_sync);
6601
6602 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006603}
6604
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306605static int hdd_set_fwtest(int argc, int cmd, int value)
6606{
6607 struct set_fwtest_params *fw_test;
6608
6609 /* check for max number of arguments */
6610 if (argc > (WMA_MAX_NUM_ARGS) ||
6611 argc != HDD_FWTEST_PARAMS) {
6612 hdd_err("Too Many args %d", argc);
6613 return -EINVAL;
6614 }
6615 /*
6616 * check if number of arguments are 3 then, check
6617 * then set the default value for sounding interval.
6618 */
6619 if (HDD_FWTEST_PARAMS == argc) {
6620 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
6621 value = HDD_FWTEST_SU_DEFAULT_VALUE;
6622 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6623 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6624 }
6625 /* check sounding interval value should not exceed to max */
6626 if (value > HDD_FWTEST_MAX_VALUE) {
6627 hdd_err("Invalid arguments value should not exceed max: %d",
6628 value);
6629 return -EINVAL;
6630 }
6631 fw_test = qdf_mem_malloc(sizeof(*fw_test));
Jeff Johnsond36fa332019-03-18 13:42:25 -07006632 if (!fw_test) {
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306633 hdd_err("qdf_mem_malloc failed for fw_test");
6634 return -ENOMEM;
6635 }
6636 fw_test->arg = cmd;
6637 fw_test->value = value;
6638 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6639 qdf_mem_free(fw_test);
6640 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6641 return -EINVAL;
6642 }
6643 return 0;
6644}
6645
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006646/**
6647 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6648 * @dev: device upon which the ioctl was received
6649 * @info: ioctl request information
6650 * @wrqu: ioctl request data
6651 * @extra: ioctl extra data
6652 *
6653 * Return: 0 on success, non-zero on error
6654 */
6655static int __iw_set_three_ints_getnone(struct net_device *dev,
6656 struct iw_request_info *info,
6657 union iwreq_data *wrqu, char *extra)
6658{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006659 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006660 int *value = (int *)extra;
6661 int sub_cmd = value[0];
6662 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08006663 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006664 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08006665 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006666
Dustin Brownfdf17c12018-03-14 12:55:34 -07006667 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306668
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006669 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006670 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006671 return -EPERM;
6672 }
6673
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006674 ret = wlan_hdd_validate_context(hdd_ctx);
6675 if (0 != ret)
6676 return ret;
6677
Jeff Johnson441e1f72017-02-07 08:50:49 -08006678 ret = hdd_check_private_wext_control(hdd_ctx, info);
6679 if (0 != ret)
6680 return ret;
6681
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006682 switch (sub_cmd) {
6683
6684 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006685 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6686 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006687 break;
6688 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306689 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006690 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306691
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006692 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6693 hdd_debug("Ioctl to set dual mac scan config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08006694 status =
6695 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
6696 &dual_mac_feature);
6697 if (status != QDF_STATUS_SUCCESS)
6698 hdd_err("can't get dual mac feature val, use def");
6699 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006700 hdd_err("Dual mac feature is disabled from INI");
6701 return -EPERM;
6702 }
6703 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Dustin Brown05d81302018-09-11 16:49:22 -07006704 policy_mgr_set_dual_mac_scan_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006705 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006706 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306707 case WE_SET_FW_TEST:
6708 {
6709 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6710 if (ret) {
6711 hdd_err("Not able to set fwtest %d", ret);
6712 return ret;
6713 }
6714 }
6715 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006716 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006717 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006718 break;
6719
6720 }
Dustin Browne74003f2018-03-14 12:51:58 -07006721 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006722 return ret;
6723}
6724
6725int iw_set_three_ints_getnone(struct net_device *dev,
6726 struct iw_request_info *info,
6727 union iwreq_data *wrqu, char *extra)
6728{
Dustin Brown389e5072018-11-08 17:10:01 +05306729 int errno;
6730 struct osif_vdev_sync *vdev_sync;
6731
6732 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6733 if (errno)
6734 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006735
Dustin Brown389e5072018-11-08 17:10:01 +05306736 errno = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006737
Dustin Brown389e5072018-11-08 17:10:01 +05306738 osif_vdev_sync_op_stop(vdev_sync);
6739
6740 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006741}
6742
6743/**
6744 * hdd_connection_state_string() - Get connection state string
6745 * @connection_state: enum to be converted to a string
6746 *
6747 * Return: the string equivalent of @connection_state
6748 */
6749static const char *
6750hdd_connection_state_string(eConnectionState connection_state)
6751{
6752 switch (connection_state) {
6753 CASE_RETURN_STRING(eConnectionState_NotConnected);
6754 CASE_RETURN_STRING(eConnectionState_Connecting);
6755 CASE_RETURN_STRING(eConnectionState_Associated);
6756 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6757 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6758 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6759 default:
6760 return "UNKNOWN";
6761 }
6762}
6763
Naveen Rawat910726a2017-03-06 11:42:51 -08006764#if defined(FEATURE_OEM_DATA_SUPPORT)
6765/**
6766 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6767 * wifi_pos api to get oem data caps
6768 * @dev: net device upon which the request was received
6769 * @info: ioctl request information
6770 * @wrqu: ioctl request data
6771 * @extra: ioctl data payload
6772 *
6773 * Return: 0 for success, negative errno value on failure
6774 */
6775static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6776 struct iw_request_info *info,
6777 union iwreq_data *wrqu, char *extra)
6778{
6779 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6780}
6781#elif defined(WIFI_POS_CONVERGED)
6782static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6783 struct iw_request_info *info,
6784 union iwreq_data *wrqu, char *extra)
6785{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006786 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006787 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006788
Dustin Brown05d81302018-09-11 16:49:22 -07006789 return os_if_wifi_pos_populate_caps(hdd_ctx->psoc,
Naveen Rawat910726a2017-03-06 11:42:51 -08006790 (struct wifi_pos_driver_caps *)extra);
6791}
6792#else
6793static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6794 struct iw_request_info *info,
6795 union iwreq_data *wrqu, char *extra)
6796{
6797 return -ENOTSUPP;
6798}
6799#endif
6800
Krunal Soni5e483782018-10-25 15:42:44 -07006801#ifdef WLAN_UNIT_TEST
6802static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6803 struct hdd_adapter *adapter,
6804 char *extra)
6805{
6806 QDF_STATUS status;
6807
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006808 status = sme_get_sta_cxn_info(hdd_ctx->mac_handle, adapter->vdev_id,
Krunal Soni5e483782018-10-25 15:42:44 -07006809 extra, WE_MAX_STR_LEN);
6810 if (status != QDF_STATUS_SUCCESS)
6811 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6812 "\nNo active connection");
6813
6814 return 0;
6815}
6816#else
6817static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6818 struct hdd_adapter *adapter,
6819 char *extra)
6820{
6821 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6822 "\nNot supported");
6823 return -ENOTSUPP;
6824}
6825#endif
6826
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006827/**
6828 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6829 * @dev: device upon which the ioctl was received
6830 * @info: ioctl request information
6831 * @wrqu: ioctl request data
6832 * @extra: ioctl extra data
6833 *
6834 * Return: 0 on success, non-zero on error
6835 */
6836static int __iw_get_char_setnone(struct net_device *dev,
6837 struct iw_request_info *info,
6838 union iwreq_data *wrqu, char *extra)
6839{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006840 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006841 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006842 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006843 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006844 int ret;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306845 QDF_STATUS status;
6846 uint8_t value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006847
Dustin Brownfdf17c12018-03-14 12:55:34 -07006848 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306849
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006850 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006851 ret = wlan_hdd_validate_context(hdd_ctx);
6852 if (0 != ret)
6853 return ret;
6854
Jeff Johnson441e1f72017-02-07 08:50:49 -08006855 ret = hdd_check_private_wext_control(hdd_ctx, info);
6856 if (0 != ret)
6857 return ret;
6858
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006859 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006860 switch (sub_cmd) {
6861 case WE_WLAN_VERSION:
6862 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006863 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6864 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006865 break;
6866 }
6867
6868 case WE_GET_STATS:
6869 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006870 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006871 extra, WE_MAX_STR_LEN);
6872 break;
6873 }
6874
Dustin Brownd9322482017-01-09 12:46:03 -08006875 case WE_GET_SUSPEND_RESUME_STATS:
6876 {
6877 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6878 WE_MAX_STR_LEN);
6879 if (ret >= 0) {
6880 wrqu->data.length = ret;
6881 ret = 0;
6882 }
6883
6884 break;
6885 }
6886
Govind Singha471e5e2015-10-12 17:11:14 +05306887 case WE_LIST_FW_PROFILE:
6888 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6889 extra, WE_MAX_STR_LEN);
6890 break;
6891
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006892 /* The case prints the current state of the HDD, SME, CSR, PE,
6893 * TL it can be extended for WDI Global State as well. And
6894 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6895 * and P2P_GO have not been added as of now.
6896 */
6897 case WE_GET_STATES:
6898 {
6899 int buf = 0, len = 0;
6900 int adapter_num = 0;
6901 int count = 0, check = 1;
6902
Jeff Johnsond377dce2017-10-04 10:32:42 -07006903 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006904
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006905 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006906 struct hdd_adapter *stat_adapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006907
6908 /* Print wlan0 or p2p0 states based on the adapter_num
6909 * by using the correct adapter
6910 */
6911 while (adapter_num < 2) {
6912 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006913 stat_adapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006914 buf =
6915 scnprintf(extra + len,
6916 WE_MAX_STR_LEN - len,
6917 "\n\n wlan0 States:-");
6918 len += buf;
6919 } else if (P2P_ADAPTER == adapter_num) {
6920 buf =
6921 scnprintf(extra + len,
6922 WE_MAX_STR_LEN - len,
6923 "\n\n p2p0 States:-");
6924 len += buf;
6925
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006926 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006927 buf =
6928 scnprintf(extra + len,
6929 WE_MAX_STR_LEN -
6930 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006931 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006932 len += buf;
6933 break;
6934 }
6935
6936 /* Printing p2p0 states only in the
6937 * case when the device is configured
6938 * as a p2p_client
6939 */
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006940 stat_adapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006941 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006942 QDF_P2P_CLIENT_MODE);
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006943 if (!stat_adapter) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006944 buf =
6945 scnprintf(extra + len,
6946 WE_MAX_STR_LEN -
6947 len,
6948 "\n Device not configured as P2P_CLIENT.");
6949 len += buf;
6950 break;
6951 }
6952 }
6953
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006954 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006955 buf = scnprintf(extra + len,
6956 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006957 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006958 len += buf;
6959 break;
6960 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006961 sta_ctx =
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006962 WLAN_HDD_GET_STATION_CTX_PTR(stat_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006963
6964
6965 buf =
6966 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6967 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006968 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006969 "\n Neighbour Roam State - %s"
6970 "\n CSR State - %s"
6971 "\n CSR Substate - %s",
6972 hdd_connection_state_string
Jeff Johnsone7951512019-02-27 10:02:51 -08006973 (sta_ctx->conn_info.conn_state),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006974 mac_trace_get_neighbour_roam_state
6975 (sme_get_neighbor_roam_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006976 (mac_handle, stat_adapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006977 mac_trace_getcsr_roam_state
6978 (sme_get_current_roam_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006979 (mac_handle, stat_adapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006980 mac_trace_getcsr_roam_sub_state
6981 (sme_get_current_roam_sub_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006982 (mac_handle, stat_adapter->vdev_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006983 );
6984 len += buf;
6985 adapter_num++;
6986 }
6987
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006988 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006989 /* Printing Lim State starting with global lim states */
6990 buf =
6991 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006992 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006993 "\n Global Sme State - %s "
6994 "\n Global mlm State - %s " "\n",
6995 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006996 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006997 mac_trace_get_lim_mlm_state
Jeff Johnson71d465a2018-12-05 11:13:30 -08006998 (sme_get_lim_mlm_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006999 );
7000 len += buf;
7001
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007002 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007003 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007004 buf =
7005 scnprintf(extra + len,
7006 WE_MAX_STR_LEN -
7007 len,
7008 "\n Lim Valid Session %d:-"
7009 "\n PE Sme State - %s "
7010 "\n PE Mlm State - %s "
7011 "\n", check,
7012 mac_trace_get_lim_sme_state
7013 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007014 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007015 mac_trace_get_lim_mlm_state
7016 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007017 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007018 );
7019
7020 len += buf;
7021 check++;
7022 }
7023 count++;
7024 }
7025 }
7026
7027 wrqu->data.length = strlen(extra) + 1;
7028 break;
7029 }
7030
7031 case WE_GET_CFG:
7032 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007033 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007034 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007035 extra,
7036 QCSAP_IOCTL_MAX_STR_LEN);
7037 wrqu->data.length = strlen(extra) + 1;
7038 break;
7039 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007040 case WE_GET_RSSI:
7041 {
7042 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007043
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007044 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007045 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
7046 wrqu->data.length = strlen(extra) + 1;
7047 break;
7048 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007049
7050 case WE_GET_WMM_STATUS:
7051 {
7052 snprintf(extra, WE_MAX_STR_LEN,
7053 "\nDir: 0=up, 1=down, 3=both\n"
7054 "|------------------------|\n"
7055 "|AC | ACM |Admitted| Dir |\n"
7056 "|------------------------|\n"
7057 "|VO | %d | %3s | %d |\n"
7058 "|VI | %d | %3s | %d |\n"
7059 "|BE | %d | %3s | %d |\n"
7060 "|BK | %d | %3s | %d |\n"
7061 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007062 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007063 ac_status[SME_AC_VO].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007064 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007065 ac_status[SME_AC_VO].
Jeff Johnsona5548972019-03-09 14:22:18 -08007066 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007067 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007068 ac_status[SME_AC_VO].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007069 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007070 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007071 ac_status[SME_AC_VI].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007072 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007073 ac_status[SME_AC_VI].
Jeff Johnsona5548972019-03-09 14:22:18 -08007074 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007075 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007076 ac_status[SME_AC_VI].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007077 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007078 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007079 ac_status[SME_AC_BE].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007080 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007081 ac_status[SME_AC_BE].
Jeff Johnsona5548972019-03-09 14:22:18 -08007082 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007083 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007084 ac_status[SME_AC_BE].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007085 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007086 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007087 ac_status[SME_AC_BK].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007088 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007089 ac_status[SME_AC_BK].
Jeff Johnsona5548972019-03-09 14:22:18 -08007090 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007091 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007092 ac_status[SME_AC_BK].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007093 ts_info.direction);
7094
7095 wrqu->data.length = strlen(extra) + 1;
7096 break;
7097 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07007098
7099 case WE_GET_BA_AGEING_TIMEOUT:
7100 {
7101 uint8_t ac_cat = 4;
Srinivas Girigowda167ea822019-03-21 17:19:30 -07007102 uint32_t duration[QCA_WLAN_AC_ALL], i;
Krunal Soni6c3859f2018-06-01 19:57:40 -07007103 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
7104
7105 if (!soc) {
7106 hdd_err("Invalid SOC handle");
7107 break;
7108 }
7109
7110 for (i = 0; i < ac_cat; i++)
7111 cdp_get_ba_timeout(soc, i, &duration[i]);
7112
7113 snprintf(extra, WE_MAX_STR_LEN,
7114 "\n|------------------------------|\n"
7115 "|AC | BA aging timeout duration |\n"
7116 "|--------------------------------|\n"
7117 "|VO | %d |\n"
7118 "|VI | %d |\n"
7119 "|BE | %d |\n"
7120 "|BK | %d |\n"
7121 "|--------------------------------|\n",
7122 duration[3], duration[2], duration[1], duration[0]);
7123
7124 wrqu->data.length = strlen(extra) + 1;
7125 break;
7126 }
7127
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007128 case WE_GET_CHANNEL_LIST:
7129 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307130 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007131 uint8_t i, len;
7132 char *buf;
Wu Gaoaa155142019-01-14 15:09:26 +08007133 uint8_t ubuf[CFG_COUNTRY_CODE_LEN];
7134 uint8_t ubuf_len = CFG_COUNTRY_CODE_LEN;
Srinivas Girigowdac231df62017-03-24 18:27:57 -07007135 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007136
7137 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05307138 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007139 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307140 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007141 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007142 return -EINVAL;
7143 }
7144 buf = extra;
7145 /*
Wu Gao0821b0d2019-01-11 17:31:11 +08007146 * Maximum channels = CFG_VALID_CHANNEL_LIST_LEN.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007147 * Maximum buffer needed = 5 * number of channels.
7148 * Check ifsufficient buffer is available and then
7149 * proceed to fill the buffer.
7150 */
7151 if (WE_MAX_STR_LEN <
Wu Gao0821b0d2019-01-11 17:31:11 +08007152 (5 * CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007153 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007154 return -EINVAL;
7155 }
7156 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
7157 channel_list.num_channels);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007158 if (QDF_STATUS_SUCCESS == sme_get_country_code(mac_handle,
7159 ubuf,
7160 &ubuf_len)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007161 /* Printing Country code in getChannelList */
7162 for (i = 0; i < (ubuf_len - 1); i++)
7163 len += scnprintf(buf + len,
7164 WE_MAX_STR_LEN - len,
7165 "%c", ubuf[i]);
7166 }
7167 for (i = 0; i < channel_list.num_channels; i++) {
7168 len +=
7169 scnprintf(buf + len, WE_MAX_STR_LEN - len,
7170 " %u", channel_list.channels[i]);
7171 }
7172 wrqu->data.length = strlen(extra) + 1;
7173
7174 break;
7175 }
7176#ifdef FEATURE_WLAN_TDLS
7177 case WE_GET_TDLS_PEERS:
7178 {
7179 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007180 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007181 WE_MAX_STR_LEN) + 1;
7182 break;
7183 }
7184#endif
7185#ifdef WLAN_FEATURE_11W
7186 case WE_GET_11W_INFO:
7187 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007188 struct csr_roam_profile *roam_profile =
7189 hdd_roam_profile(adapter);
7190
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007191 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007192 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007193
7194 snprintf(extra, WE_MAX_STR_LEN,
7195 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
7196 "\n Number of Unprotected Disassocs %d"
7197 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007198 roam_profile->BSSIDs.bssid->bytes[0],
7199 roam_profile->BSSIDs.bssid->bytes[1],
7200 roam_profile->BSSIDs.bssid->bytes[2],
7201 roam_profile->BSSIDs.bssid->bytes[3],
7202 roam_profile->BSSIDs.bssid->bytes[4],
7203 roam_profile->BSSIDs.bssid->bytes[5],
7204 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07007205 adapter->hdd_stats.hdd_pmf_stats.
7206 num_unprot_disassoc_rx,
7207 adapter->hdd_stats.hdd_pmf_stats.
7208 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007209
7210 wrqu->data.length = strlen(extra) + 1;
7211 break;
7212 }
7213#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007214 case WE_GET_IBSS_STA_INFO:
7215 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07007216 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007217 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007218 int idx = 0;
7219 int length = 0, buf = 0;
7220
Naveen Rawatc45d1622016-07-05 12:20:09 -07007221 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07007222 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnson0a082d92019-03-04 12:25:49 -08007223 sta_ctx->conn_info.sta_id[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007224 buf = snprintf
7225 ((extra + length),
7226 WE_MAX_STR_LEN - length,
7227 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnson0a082d92019-03-04 12:25:49 -08007228 sta_ctx->conn_info.sta_id[idx],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007229 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007230 peer_macaddr[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007231 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007232 peer_macaddr[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007233 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007234 peer_macaddr[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007235 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007236 peer_macaddr[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007237 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007238 peer_macaddr[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007239 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007240 peer_macaddr[idx].bytes[5]
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007241 );
7242 length += buf;
7243 }
7244 }
7245 wrqu->data.length = strlen(extra) + 1;
7246 break;
7247 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007248 case WE_GET_PHYMODE:
7249 {
7250 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007251 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007252 eCsrPhyMode phymode;
Jeff Johnsondbae0172019-03-09 17:01:56 -08007253 enum band_info current_band;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08007254 struct sme_config_params *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007255
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007256 sme_config = qdf_mem_malloc(sizeof(*sme_config));
7257 if (!sme_config) {
7258 hdd_err("Out of memory");
7259 ret = -ENOMEM;
7260 break;
7261 }
7262
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007263 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007264 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007265 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007266 ch_bond24 = true;
7267
7268 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007269 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007270 ch_bond5g = true;
7271
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007272 qdf_mem_free(sme_config);
7273
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007274 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307275 if ((QDF_STATUS_SUCCESS !=
Harprit Chhabada5dff30e2019-03-12 17:56:45 -07007276 ucfg_reg_get_band(hddctx->pdev, &current_band))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007277 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007278 return -EIO;
7279 }
7280
7281 switch (phymode) {
7282 case eCSR_DOT11_MODE_AUTO:
7283 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
7284 break;
7285 case eCSR_DOT11_MODE_11n:
7286 case eCSR_DOT11_MODE_11n_ONLY:
Jeff Johnsondbae0172019-03-09 17:01:56 -08007287 if (current_band == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007288 if (ch_bond24)
7289 snprintf(extra, WE_MAX_STR_LEN,
7290 "11NGHT40");
7291 else
7292 snprintf(extra, WE_MAX_STR_LEN,
7293 "11NGHT20");
Jeff Johnsondbae0172019-03-09 17:01:56 -08007294 } else if (current_band == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007295 if (ch_bond5g)
7296 snprintf(extra, WE_MAX_STR_LEN,
7297 "11NAHT40");
7298 else
7299 snprintf(extra, WE_MAX_STR_LEN,
7300 "11NAHT20");
7301 } else {
7302 snprintf(extra, WE_MAX_STR_LEN, "11N");
7303 }
7304 break;
7305 case eCSR_DOT11_MODE_abg:
7306 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
7307 break;
7308 case eCSR_DOT11_MODE_11a:
7309 snprintf(extra, WE_MAX_STR_LEN, "11A");
7310 break;
7311 case eCSR_DOT11_MODE_11b:
7312 case eCSR_DOT11_MODE_11b_ONLY:
7313 snprintf(extra, WE_MAX_STR_LEN, "11B");
7314 break;
7315 case eCSR_DOT11_MODE_11g:
7316 case eCSR_DOT11_MODE_11g_ONLY:
7317 snprintf(extra, WE_MAX_STR_LEN, "11G");
7318 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007319 case eCSR_DOT11_MODE_11ac:
7320 case eCSR_DOT11_MODE_11ac_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307321 status =
7322 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7323 &value);
7324 if (!QDF_IS_STATUS_SUCCESS(status))
7325 hdd_err("Failed to set channel_width");
7326 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007327 snprintf(extra, WE_MAX_STR_LEN,
7328 "11ACVHT20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307329 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007330 snprintf(extra, WE_MAX_STR_LEN,
7331 "11ACVHT40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307332 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007333 snprintf(extra, WE_MAX_STR_LEN,
7334 "11ACVHT80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307335 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007336 snprintf(extra, WE_MAX_STR_LEN,
7337 "11ACVHT160");
7338 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007339 case eCSR_DOT11_MODE_11ax:
7340 case eCSR_DOT11_MODE_11ax_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307341 status =
7342 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7343 &value);
7344 if (!QDF_IS_STATUS_SUCCESS(status))
7345 hdd_err("Failed to set channel_width");
7346
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007347 /* currently using vhtChannelWidth */
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307348 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007349 snprintf(extra, WE_MAX_STR_LEN,
7350 "11AX_HE_20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307351 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007352 snprintf(extra, WE_MAX_STR_LEN,
7353 "11AX_HE_40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307354 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007355 snprintf(extra, WE_MAX_STR_LEN,
7356 "11AX_HE_80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307357 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007358 snprintf(extra, WE_MAX_STR_LEN,
7359 "11AX_HE_160");
7360 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007361 }
7362
7363 wrqu->data.length = strlen(extra) + 1;
7364 break;
7365 }
7366
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007367 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08007368 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007369 case WE_GET_SNR:
7370 {
7371 int8_t s7snr = 0;
7372 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007373 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07007374 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007375
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007376 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007377 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307378 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007379 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307380
Jeff Johnsond377dce2017-10-04 10:32:42 -07007381 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsona8fef4e2019-03-11 14:38:49 -07007382 if (!hdd_ctx->config->enable_snr_monitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007383 eConnectionState_Associated !=
Jeff Johnsone7951512019-02-27 10:02:51 -08007384 sta_ctx->conn_info.conn_state) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007385 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsona8fef4e2019-03-11 14:38:49 -07007386 hdd_ctx->config->enable_snr_monitoring,
Jeff Johnsone7951512019-02-27 10:02:51 -08007387 sta_ctx->conn_info.conn_state);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007388 return -ENONET;
7389 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007390 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007391 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
7392 wrqu->data.length = strlen(extra) + 1;
7393 break;
7394 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007395
Krunal Soni5e483782018-10-25 15:42:44 -07007396 case WE_GET_STA_CXN_INFO:
7397 ret = hdd_get_sta_cxn_info(hdd_ctx, adapter, extra);
7398 wrqu->data.length = strlen(extra) + 1;
7399 break;
7400
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007401 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007402 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007403 break;
7404 }
Dustin Brownd9322482017-01-09 12:46:03 -08007405
Dustin Browne74003f2018-03-14 12:51:58 -07007406 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08007407 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007408}
7409
7410static int iw_get_char_setnone(struct net_device *dev,
7411 struct iw_request_info *info,
7412 union iwreq_data *wrqu, char *extra)
7413{
Dustin Brown389e5072018-11-08 17:10:01 +05307414 int errno;
7415 struct osif_vdev_sync *vdev_sync;
7416
7417 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7418 if (errno)
7419 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007420
Dustin Brown389e5072018-11-08 17:10:01 +05307421 errno = __iw_get_char_setnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007422
Dustin Brown389e5072018-11-08 17:10:01 +05307423 osif_vdev_sync_op_stop(vdev_sync);
7424
7425 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007426}
7427
7428/**
7429 * iw_setnone_getnone() - Generic "action" private ioctl handler
7430 * @dev: device upon which the ioctl was received
7431 * @info: ioctl request information
7432 * @wrqu: ioctl request data
7433 * @extra: ioctl extra data
7434 *
7435 * Return: 0 on success, non-zero on error
7436 */
7437static int __iw_setnone_getnone(struct net_device *dev,
7438 struct iw_request_info *info,
7439 union iwreq_data *wrqu, char *extra)
7440{
Jeff Johnson3d278b02017-08-29 14:17:47 -07007441 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007442 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007443 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007444 int ret;
7445 int sub_cmd;
7446
Dustin Brownfdf17c12018-03-14 12:55:34 -07007447 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307448
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007449 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007450 ret = wlan_hdd_validate_context(hdd_ctx);
7451 if (0 != ret)
7452 return ret;
7453
Jeff Johnson441e1f72017-02-07 08:50:49 -08007454 ret = hdd_check_private_wext_control(hdd_ctx, info);
7455 if (0 != ret)
7456 return ret;
7457
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007458#ifdef CONFIG_COMPAT
7459 /* this ioctl is a special case where a sub-ioctl is used and both
7460 * the number of get and set args is 0. in this specific case the
7461 * logic in iwpriv places the sub_cmd in the data.flags portion of
7462 * the iwreq. unfortunately the location of this field will be
7463 * different between 32-bit and 64-bit userspace, and the standard
7464 * compat support in the kernel does not handle this case. so we
7465 * need to explicitly handle it here.
7466 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07007467 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007468 struct compat_iw_point *compat_iw_point =
7469 (struct compat_iw_point *)&wrqu->data;
7470 sub_cmd = compat_iw_point->flags;
7471 } else {
7472 sub_cmd = wrqu->data.flags;
7473 }
7474#else
7475 sub_cmd = wrqu->data.flags;
7476#endif
7477
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007478 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007479 switch (sub_cmd) {
Govind Singha471e5e2015-10-12 17:11:14 +05307480 case WE_GET_FW_PROFILE_DATA:
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007481 ret = wma_cli_set_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05307482 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
7483 0, DBG_CMD);
7484 break;
7485
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007486 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007487 hdd_wlan_get_ibss_peer_info_all(adapter);
7488 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007489
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007490 case WE_SET_REASSOC_TRIGGER:
7491 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07007492 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307493 tSirMacAddr bssid;
Jeff Johnson29c78672019-02-26 21:05:53 -08007494 uint32_t roam_id = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307495 uint8_t operating_ch =
Jeff Johnson8626e932019-02-27 18:35:22 -08007496 adapter->session.station.conn_info.channel;
Jeff Johnson9ff16952019-02-26 20:58:44 -08007497 tCsrRoamModifyProfileFields mod_fields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007498
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007499 sme_get_modify_profile_fields(mac_handle, adapter->vdev_id,
Jeff Johnson9ff16952019-02-26 20:58:44 -08007500 &mod_fields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307501 if (roaming_offload_enabled(hdd_ctx)) {
7502 qdf_mem_copy(bssid,
Jeff Johnsone04b6992019-02-27 14:06:55 -08007503 &adapter->session.station.conn_info.bssid,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307504 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08007505 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307506 bssid, operating_ch);
7507 } else {
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007508 sme_roam_reassoc(mac_handle, adapter->vdev_id,
Jeff Johnson29c78672019-02-26 21:05:53 -08007509 NULL, mod_fields, &roam_id, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307510 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007511 return 0;
7512 }
7513
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007514 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007515 /*
7516 * 1.OBSS Scan is mandatory while operating in 2.4GHz
7517 * 2.OBSS scan is stopped by Firmware during the disassociation
7518 * 3.OBSS stop comamnd is added for debugging purpose
7519 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007520 if (!mac_handle) {
7521 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007522 return -EINVAL;
7523 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007524 sme_ht40_stop_obss_scan(mac_handle, adapter->vdev_id);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007525 break;
7526
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007527 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007528 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007529 break;
7530 }
Dustin Browne74003f2018-03-14 12:51:58 -07007531 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007532 return ret;
7533}
7534
7535static int iw_setnone_getnone(struct net_device *dev,
7536 struct iw_request_info *info,
7537 union iwreq_data *wrqu, char *extra)
7538{
Dustin Brown389e5072018-11-08 17:10:01 +05307539 int errno;
7540 struct osif_vdev_sync *vdev_sync;
7541
7542 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7543 if (errno)
7544 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007545
Dustin Brown389e5072018-11-08 17:10:01 +05307546 errno = __iw_setnone_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007547
Dustin Brown389e5072018-11-08 17:10:01 +05307548 osif_vdev_sync_op_stop(vdev_sync);
7549
7550 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007551}
7552
Krunal Sonia6e505b2017-01-12 12:25:18 -08007553#ifdef MPC_UT_FRAMEWORK
Liangwei Dong509c3472018-05-30 07:05:59 -04007554static void
7555hdd_policy_mgr_set_hw_mode_ut(struct hdd_context *hdd_ctx,
7556 struct hdd_adapter *adapter, int cmd)
7557{
7558 enum hw_mode_ss_config mac0_ss;
7559 enum hw_mode_bandwidth mac0_bw;
7560 enum hw_mode_ss_config mac1_ss;
7561 enum hw_mode_bandwidth mac1_bw;
7562 enum hw_mode_mac_band_cap mac0_band_cap;
7563 enum hw_mode_dbs_capab dbs;
7564
7565 switch (cmd) {
7566 case 0:
7567 hdd_debug("set hw mode for single mac");
7568 mac0_ss = HW_MODE_SS_2x2;
7569 mac0_bw = HW_MODE_80_MHZ;
7570 mac1_ss = HW_MODE_SS_0x0;
7571 mac1_bw = HW_MODE_BW_NONE;
7572 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7573 dbs = HW_MODE_DBS_NONE;
7574 break;
7575 case 1:
7576 hdd_debug("set hw mode for dual mac");
7577 mac0_ss = HW_MODE_SS_1x1;
7578 mac0_bw = HW_MODE_80_MHZ;
7579 mac1_ss = HW_MODE_SS_1x1;
7580 mac1_bw = HW_MODE_40_MHZ;
7581 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7582 dbs = HW_MODE_DBS;
7583 break;
7584 case 2:
7585 hdd_debug("set hw mode for 2x2 5g + 1x1 2g");
7586 mac0_ss = HW_MODE_SS_2x2;
7587 mac0_bw = HW_MODE_80_MHZ;
7588 mac1_ss = HW_MODE_SS_1x1;
7589 mac1_bw = HW_MODE_40_MHZ;
7590 mac0_band_cap = HW_MODE_MAC_BAND_5G;
7591 dbs = HW_MODE_DBS;
7592 break;
7593 case 3:
7594 hdd_debug("set hw mode for 2x2 2g + 1x1 5g");
7595 mac0_ss = HW_MODE_SS_2x2;
7596 mac0_bw = HW_MODE_40_MHZ;
7597 mac1_ss = HW_MODE_SS_1x1;
7598 mac1_bw = HW_MODE_40_MHZ;
7599 mac0_band_cap = HW_MODE_MAC_BAND_2G;
7600 dbs = HW_MODE_DBS;
7601 break;
7602 default:
7603 hdd_err("unknown cmd %d", cmd);
7604 return;
7605 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007606 policy_mgr_pdev_set_hw_mode(hdd_ctx->psoc, adapter->vdev_id,
Liangwei Dong509c3472018-05-30 07:05:59 -04007607 mac0_ss, mac0_bw, mac1_ss, mac1_bw,
7608 mac0_band_cap, dbs, HW_MODE_AGILE_DFS_NONE,
7609 HW_MODE_SBS_NONE,
7610 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
7611}
7612
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007613static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007614 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007615{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08007616 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08007617 case WE_POLICY_MANAGER_CLIST_CMD:
7618 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007619 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307620 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307621 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7622 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7623 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7624 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307625 return 0;
7626 }
Dustin Brown05d81302018-09-11 16:49:22 -07007627 policy_mgr_incr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007628 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7629 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007630 }
7631 break;
7632
7633 case WE_POLICY_MANAGER_DLIST_CMD:
7634 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007635 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307636 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307637 hdd_err("Invalid input params 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_decr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007641 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007642 }
7643 break;
7644
7645 case WE_POLICY_MANAGER_ULIST_CMD:
7646 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007647 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307648 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307649 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7650 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7651 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7652 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307653 return 0;
7654 }
Dustin Brown05d81302018-09-11 16:49:22 -07007655 policy_mgr_update_connection_info_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007656 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7657 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007658 }
7659 break;
7660
7661 case WE_POLICY_MANAGER_DBS_CMD:
7662 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007663 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007664 if (apps_args[0] == 0)
7665 wma_set_dbs_capability_ut(0);
7666 else
7667 wma_set_dbs_capability_ut(1);
7668
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007669 if (apps_args[1] >= PM_THROUGHPUT &&
7670 apps_args[1] <= PM_LATENCY) {
Liangwei Dong509c3472018-05-30 07:05:59 -04007671 hdd_debug("setting system pref to [%d]\n",
7672 apps_args[1]);
Krunal Sonie71838d2018-09-27 10:45:05 -07007673 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc,
7674 apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007675 }
7676 }
7677 break;
7678
7679 case WE_POLICY_MANAGER_PCL_CMD:
7680 {
7681 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
7682 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
7683 uint32_t pcl_len = 0, i = 0;
7684
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007685 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007686
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307687 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307688 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307689 return 0;
7690 }
Dustin Brown05d81302018-09-11 16:49:22 -07007691 policy_mgr_get_pcl(hdd_ctx->psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08007692 pcl, &pcl_len,
7693 weight_list, QDF_ARRAY_SIZE(weight_list));
Liangwei Dong509c3472018-05-30 07:05:59 -04007694 hdd_debug("PCL list for role[%d] is {", apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007695 for (i = 0 ; i < pcl_len; i++)
Liangwei Dong509c3472018-05-30 07:05:59 -04007696 hdd_debug(" %d, ", pcl[i]);
7697 hdd_debug("}--------->\n");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007698 }
7699 break;
7700
7701 case WE_POLICY_SET_HW_MODE_CMD:
7702 {
Liangwei Dong509c3472018-05-30 07:05:59 -04007703 hdd_debug("pm_set_hw_mode cmd %d", apps_args[0]);
7704 hdd_policy_mgr_set_hw_mode_ut(hdd_ctx, adapter, apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007705 }
7706 break;
7707
7708 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7709 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007710 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307711 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307712 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307713 return 0;
7714 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07007715 policy_mgr_current_connections_update(
Dustin Brown05d81302018-09-11 16:49:22 -07007716 hdd_ctx->psoc,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007717 adapter->vdev_id, apps_args[0],
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07007718 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007719 }
7720 break;
7721
7722 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7723 {
7724 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007725
Dustin Brown5e89ef82018-03-14 11:50:23 -07007726 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307727 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307728 (apps_args[2] < 0)) {
7729 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307730 return 0;
7731 }
Dustin Brown05d81302018-09-11 16:49:22 -07007732 allow = policy_mgr_allow_concurrency(hdd_ctx->psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08007733 apps_args[0], apps_args[1], apps_args[2]);
Liangwei Dong509c3472018-05-30 07:05:59 -04007734 hdd_debug("allow %d {0 = don't allow, 1 = allow}", allow);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007735 }
7736 break;
7737
7738 case WE_POLICY_MANAGER_SCENARIO_CMD:
7739 {
7740 clean_report(hdd_ctx);
7741 if (apps_args[0] == 1) {
7742 wlan_hdd_one_connection_scenario(hdd_ctx);
7743 } else if (apps_args[0] == 2) {
7744 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007745 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007746 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007747 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007748 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007749 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007750 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007751 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007752 } else if (apps_args[0] == 3) {
7753 /* MCC on same band with 2x2 same mac*/
7754 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007755 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007756 /* MCC on diff band with 2x2 same mac*/
7757 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007758 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007759 /* MCC on diff band with 1x1 diff mac */
7760 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007761 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007762 /* MCC on diff band with 1x1 same mac */
7763 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007764 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007765 /* SCC on same band with 2x2 same mac */
7766 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007767 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007768 /* SCC on same band with 1x1 same mac */
7769 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007770 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007771 /* MCC on same band with 2x2 same mac */
7772 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007773 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007774 /* MCC on same band with 1x1 same mac */
7775 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007776 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007777 }
7778 print_report(hdd_ctx);
7779 }
7780 break;
7781 }
7782 return 0;
7783}
7784#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007785static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007786 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007787{
7788 return 0;
7789}
7790#endif
7791
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007792/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007793 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7794 * @hdd_ctx: hdd_context
7795 * @num_args: input args number
7796 * @apps_args: args data ptr
7797 *
7798 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7799 *
7800 * Return: void
7801 */
7802#if WLAN_DEBUG
7803static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7804 int num_args, int *apps_args)
7805{
7806 struct ch_avoid_ind_type ch_avoid;
7807 int cnt = 0, i;
7808
7809 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7810 num_args % 2 != 0)
7811 return;
7812 hdd_info("simulate ch avoid num_args %d", num_args);
7813 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7814 ch_avoid.avoid_freq_range[cnt].start_freq =
7815 apps_args[i];
7816 ch_avoid.avoid_freq_range[cnt].end_freq =
7817 apps_args[++i];
7818
7819 hdd_info("simulate ch avoid [%d %d]",
7820 ch_avoid.avoid_freq_range[cnt].start_freq,
7821 ch_avoid.avoid_freq_range[cnt].end_freq);
7822 cnt++;
7823 }
7824 ch_avoid.ch_avoid_range_cnt = cnt;
Dustin Brown05d81302018-09-11 16:49:22 -07007825 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->psoc, &ch_avoid);
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007826}
7827#else
7828static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7829 int num_args, int *apps_args)
7830{
7831}
7832#endif
7833/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007834 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7835 * @dev: device upon which the ioctl was received
7836 * @info: ioctl request information
7837 * @wrqu: ioctl request data
7838 * @extra: ioctl extra data
7839 *
7840 * This is an SSR-protected generic handler for private ioctls which
7841 * take multiple arguments. Note that this implementation is also
7842 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7843 * interfaces.
7844 *
7845 * Return: 0 on success, non-zero on error
7846 */
7847static int __iw_set_var_ints_getnone(struct net_device *dev,
7848 struct iw_request_info *info,
7849 union iwreq_data *wrqu, char *extra)
7850{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007851 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007852 mac_handle_t mac_handle;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007853 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007854 int sub_cmd;
7855 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007856 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007857 int ret, num_args;
chenguoaa7c90c2018-05-24 17:08:47 +08007858 void *soc = NULL;
7859 struct cdp_pdev *pdev = NULL;
7860 struct cdp_vdev *vdev = NULL;
7861 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007862
Dustin Brownfdf17c12018-03-14 12:55:34 -07007863 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307864
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007865 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007866 ret = wlan_hdd_validate_context(hdd_ctx);
7867 if (0 != ret)
7868 return ret;
7869
Jeff Johnson441e1f72017-02-07 08:50:49 -08007870 ret = hdd_check_private_wext_control(hdd_ctx, info);
7871 if (0 != ret)
7872 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007873
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007874 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007875 sub_cmd = wrqu->data.flags;
7876 num_args = wrqu->data.length;
7877
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007878 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007879
7880 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007881 case WE_IBSS_GET_PEER_INFO:
7882 {
7883 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007884 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007885 }
7886 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007887
7888 case WE_P2P_NOA_CMD:
7889 {
Jeff Johnson156cd082019-03-10 21:49:54 -07007890 struct p2p_app_set_ps p2p_noa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007891
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007892 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007893 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
Dustin Brown458027c2018-10-19 12:26:27 -07007894 qdf_opmode_str(adapter->device_mode),
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007895 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007896 return -EINVAL;
7897 }
7898
Jeff Johnson156cd082019-03-10 21:49:54 -07007899 p2p_noa.opp_ps = apps_args[0];
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007900 p2p_noa.ct_window = apps_args[1];
Jeff Johnson156cd082019-03-10 21:49:54 -07007901 p2p_noa.duration = apps_args[2];
7902 p2p_noa.interval = apps_args[3];
7903 p2p_noa.count = apps_args[4];
7904 p2p_noa.single_noa_duration = apps_args[5];
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007905 p2p_noa.ps_selection = apps_args[6];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007906
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007907 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 -07007908 apps_args[0], apps_args[1], apps_args[2],
7909 apps_args[3], apps_args[4],
7910 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007911
Jeff Johnson156cd082019-03-10 21:49:54 -07007912 hdd_set_p2p_ps(dev, &p2p_noa);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007913
7914 }
7915 break;
7916
7917 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7918 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007919 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007920 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307921 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007922 }
7923 break;
7924
7925 case WE_MTRACE_DUMP_CMD:
7926 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007927 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007928 apps_args[0], apps_args[1],
7929 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007930 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007931 apps_args[1], apps_args[2],
7932 apps_args[3]);
7933
7934 }
7935 break;
7936
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007937 case WE_POLICY_MANAGER_CINFO_CMD:
7938 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007939 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007940 uint32_t i = 0, len = 0;
7941
Krunal Sonia6e505b2017-01-12 12:25:18 -08007942 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007943 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007944 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007945 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007946 pr_info("|table_index[%d]\t\t\n", i);
7947 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
7948 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
7949 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7950 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7951 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7952 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7953 pr_info("+--------------------------+\n");
7954 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007955 }
7956 }
7957 break;
7958
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007959 case WE_UNIT_TEST_CMD:
7960 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007961 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007962
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007963 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7964 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007965 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007966 return -EINVAL;
7967 }
Sourav Mohapatraea7210b2018-11-16 16:58:52 +05307968 if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307969 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007970 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007971 return -EINVAL;
7972 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007973 status = sme_send_unit_test_cmd(adapter->vdev_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007974 apps_args[0],
7975 apps_args[1],
7976 &apps_args[2]);
7977 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007978 hdd_err("sme_send_unit_test_cmd returned %d", status);
7979 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007980 }
7981 }
7982 break;
7983#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7984 case WE_LED_FLASHING_PARAM:
7985 {
7986 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007987
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007988 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007989 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007990 return -EINVAL;
7991 }
7992 for (i = 0; i < num_args; i++) {
7993 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007994 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007995 return -EINVAL;
7996 }
7997 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007998 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007999 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008000 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008001 1, apps_args[2], apps_args[3]);
8002 }
8003 break;
8004#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05308005 case WE_SET_PKTLOG:
8006 {
8007 int ret;
8008
8009 if (num_args < 1 || num_args > 2) {
8010 hdd_err("pktlog: either 1 or 2 parameters are required");
8011 return -EINVAL;
8012 }
8013
8014 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
8015 apps_args[1]);
8016 if (ret)
8017 return ret;
8018 break;
8019 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05308020 case WE_MAC_PWR_DEBUG_CMD:
8021 {
8022 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05308023 int i, j;
8024
8025 if (num_args < 3) {
8026 hdd_err("number of arguments can't be null %d",
8027 num_args);
8028 return -EINVAL;
8029 }
8030 if (num_args - 3 != apps_args[2]) {
8031 hdd_err("arg list of size %d doesn't match num_args %d",
8032 num_args-3, apps_args[2]);
8033 return -EINVAL;
8034 }
8035 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
8036 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
8037 hdd_err("Invalid MODULE ID %d", apps_args[1]);
8038 return -EINVAL;
8039 }
8040 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
8041 hdd_err("Too Many args %d", apps_args[2]);
8042 return -EINVAL;
8043 }
8044 mac_pwr_dbg_args.pdev_id = apps_args[0];
8045 mac_pwr_dbg_args.module_id = apps_args[1];
8046 mac_pwr_dbg_args.num_args = apps_args[2];
8047
8048 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
8049 mac_pwr_dbg_args.args[i] = apps_args[j];
8050
8051 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008052 sme_process_mac_pwr_dbg_cmd(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008053 adapter->vdev_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05308054 &mac_pwr_dbg_args)) {
8055 return -EINVAL;
8056 }
8057 }
8058 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08008059 case WE_POLICY_MANAGER_CLIST_CMD:
8060 case WE_POLICY_MANAGER_DLIST_CMD:
8061 case WE_POLICY_MANAGER_ULIST_CMD:
8062 case WE_POLICY_MANAGER_DBS_CMD:
8063 case WE_POLICY_MANAGER_PCL_CMD:
8064 case WE_POLICY_SET_HW_MODE_CMD:
8065 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
8066 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
8067 case WE_POLICY_MANAGER_SCENARIO_CMD:
8068 {
Krunal Soni3de68532018-09-05 12:16:58 -07008069 if (!hdd_ctx->config->is_unit_test_framework_enabled) {
8070 hdd_warn_rl("UT framework is disabled");
8071 return -EINVAL;
8072 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008073 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Soni3de68532018-09-05 12:16:58 -07008074 sub_cmd, apps_args);
Krunal Sonia6e505b2017-01-12 12:25:18 -08008075 }
8076 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08008077 case WE_SET_CHAN_AVOID:
8078 {
8079 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
8080 }
8081 break;
chenguoaa7c90c2018-05-24 17:08:47 +08008082 case WE_SET_TXRX_STATS:
8083 {
8084 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008085 adapter->vdev_id);
chenguoaa7c90c2018-05-24 17:08:47 +08008086
8087 if (ret != 0) {
8088 hdd_err("Invalid handles");
8089 break;
8090 }
8091
8092 req.stats = apps_args[0];
8093 /* default value of secondary parameter is 0(mac_id) */
8094 req.mac_id = apps_args[1];
8095
8096 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
8097 req.stats, req.mac_id);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008098 if (apps_args[0] == CDP_TXRX_STATS_28) {
Jeff Johnson457c2422019-02-27 13:56:04 -08008099 if (sta_ctx->conn_info.is_authenticated) {
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008100 hdd_debug("ap mac addr: %pM",
Jeff Johnsone04b6992019-02-27 14:06:55 -08008101 (void *)&sta_ctx->conn_info.bssid);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008102 req.peer_addr =
Jeff Johnsone04b6992019-02-27 14:06:55 -08008103 (char *)&sta_ctx->conn_info.bssid;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008104 }
8105 }
chenguoaa7c90c2018-05-24 17:08:47 +08008106 ret = cdp_txrx_stats_request(soc, vdev, &req);
8107 break;
8108 }
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308109#ifdef WLAN_FEATURE_MOTION_DETECTION
8110 case WE_MOTION_DET_CONFIG_PARAM:
8111 {
8112 struct sme_motion_det_cfg motion_det_cfg;
8113
8114 if (num_args != 15) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308115 hdd_err_rl("mt_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308116 return -EINVAL;
8117 }
8118
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008119 motion_det_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308120 motion_det_cfg.time_t1 = apps_args[0];
8121 motion_det_cfg.time_t2 = apps_args[1];
8122 motion_det_cfg.n1 = apps_args[2];
8123 motion_det_cfg.n2 = apps_args[3];
8124 motion_det_cfg.time_t1_gap = apps_args[4];
8125 motion_det_cfg.time_t2_gap = apps_args[5];
8126 motion_det_cfg.coarse_K = apps_args[6];
8127 motion_det_cfg.fine_K = apps_args[7];
8128 motion_det_cfg.coarse_Q = apps_args[8];
8129 motion_det_cfg.fine_Q = apps_args[9];
8130 motion_det_cfg.md_coarse_thr_high = apps_args[10];
8131 motion_det_cfg.md_fine_thr_high = apps_args[11];
8132 motion_det_cfg.md_coarse_thr_low = apps_args[12];
8133 motion_det_cfg.md_fine_thr_low = apps_args[13];
8134 adapter->motion_detection_mode = apps_args[14];
8135 sme_motion_det_config(hdd_ctx->mac_handle, &motion_det_cfg);
8136 }
8137 break;
8138 case WE_MOTION_DET_BASE_LINE_CONFIG_PARAM:
8139 {
8140 struct sme_motion_det_base_line_cfg motion_det_base_line_cfg;
8141
8142 if (num_args != 4) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308143 hdd_err_rl("mt_bl_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308144 return -EINVAL;
8145 }
8146
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008147 motion_det_base_line_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308148 motion_det_base_line_cfg.bl_time_t = apps_args[0];
8149 motion_det_base_line_cfg.bl_packet_gap = apps_args[1];
8150 motion_det_base_line_cfg.bl_n = apps_args[2];
8151 motion_det_base_line_cfg.bl_num_meas = apps_args[3];
8152 sme_motion_det_base_line_config(hdd_ctx->mac_handle,
8153 &motion_det_base_line_cfg);
8154 }
8155 break;
8156#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308157#ifdef FW_THERMAL_THROTTLE_SUPPORT
8158 case WE_SET_THERMAL_THROTTLE_CFG:
8159 {
8160 QDF_STATUS status;
8161
8162 if (num_args != 7) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308163 hdd_err_rl("set_thermal_cfg: Invalid no of args");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308164 return -EINVAL;
8165 }
8166
8167 /* Check for valid inputs */
8168 if (apps_args[0] < 0 || apps_args[0] > 1 || apps_args[1] < 0 ||
8169 apps_args[2] < 0 || apps_args[2] > 100 ||
8170 apps_args[3] < 0 || apps_args[3] > 3 || apps_args[4] < 0 ||
8171 apps_args[5] < 0 || apps_args[6] < 0 ||
8172 apps_args[5] <= apps_args[4])
8173 return -EINVAL;
8174
8175 status = sme_set_thermal_throttle_cfg(hdd_ctx->mac_handle,
8176 apps_args[0],
8177 apps_args[1],
8178 apps_args[2],
8179 apps_args[3],
8180 apps_args[6]);
8181 if (QDF_IS_STATUS_ERROR(status))
8182 return qdf_status_to_os_return(status);
8183
8184 if (!apps_args[6]) {
8185 status = sme_set_thermal_mgmt(hdd_ctx->mac_handle,
8186 apps_args[4],
8187 apps_args[5]);
8188 if (QDF_IS_STATUS_ERROR(status))
8189 return qdf_status_to_os_return(status);
8190 }
8191 break;
8192 }
8193#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008194 default:
8195 {
Jeff Johnson99bac312016-06-28 10:38:18 -07008196 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008197 }
8198 break;
8199 }
Dustin Browne74003f2018-03-14 12:51:58 -07008200 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008201 return 0;
8202}
8203
8204/**
8205 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
8206 * @dev: pointer to net_device structure
8207 * @info: pointer to iw_request_info structure
8208 * @wrqu: pointer to iwreq_data
8209 * @extra; extra
8210 *
8211 * Return: 0 on success, error number otherwise
8212 *
8213 */
8214static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
8215 struct iw_request_info *info,
8216 union iwreq_data *wrqu, char *extra)
8217{
8218 union iwreq_data u_priv_wrqu;
8219 int apps_args[MAX_VAR_ARGS] = {0};
Dustin Brown389e5072018-11-08 17:10:01 +05308220 int errno, num_args;
8221 struct osif_vdev_sync *vdev_sync;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008222
Mukul Sharma64a70e82015-11-02 20:05:09 +05308223 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008224 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05308225 return -EPERM;
8226 }
8227
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008228 /* Helper function to get iwreq_data with compat handling. */
8229 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
8230 return -EINVAL;
8231
Jeff Johnsond36fa332019-03-18 13:42:25 -07008232 if (!u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008233 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008234 return -EINVAL;
8235 }
8236
8237 num_args = u_priv_wrqu.data.length;
8238 if (num_args > MAX_VAR_ARGS)
8239 num_args = MAX_VAR_ARGS;
8240
8241 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
Dustin Brown389e5072018-11-08 17:10:01 +05308242 sizeof(int) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008243 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008244 return -EFAULT;
8245 }
8246
Dustin Brown389e5072018-11-08 17:10:01 +05308247 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8248 if (errno)
8249 return errno;
8250
Dustin Brown389e5072018-11-08 17:10:01 +05308251 errno = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
8252 (char *)&apps_args);
Dustin Brown389e5072018-11-08 17:10:01 +05308253
8254 osif_vdev_sync_op_stop(vdev_sync);
8255
8256 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008257}
8258
8259/**
8260 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
8261 * @dev: device upon which the ioctl was received
8262 * @info: ioctl request information
8263 * @wrqu: ioctl request data
8264 * @extra: ioctl extra data
8265 *
8266 * This is a generic handler for private ioctls which take multiple
8267 * arguments. Note that this implementation is also somewhat unique
8268 * in that it is shared by both STA-mode and SAP-mode interfaces.
8269 *
8270 * Return: 0 on success, non-zero on error
8271 */
8272int iw_set_var_ints_getnone(struct net_device *dev,
8273 struct iw_request_info *info,
8274 union iwreq_data *wrqu, char *extra)
8275{
Dustin Brown389e5072018-11-08 17:10:01 +05308276 int errno;
8277 struct osif_vdev_sync *vdev_sync;
8278
8279 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8280 if (errno)
8281 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008282
Dustin Brown389e5072018-11-08 17:10:01 +05308283 errno = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
Dustin Brown389e5072018-11-08 17:10:01 +05308284
8285 osif_vdev_sync_op_stop(vdev_sync);
8286
8287 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008288}
8289
8290/**
8291 * iw_add_tspec - Add TSpec private ioctl handler
8292 * @dev: device upon which the ioctl was received
8293 * @info: ioctl request information
8294 * @wrqu: ioctl request data
8295 * @extra: ioctl extra data
8296 *
8297 * Return: 0 on success, non-zero on error
8298 */
8299static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
8300 union iwreq_data *wrqu, char *extra)
8301{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008302 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008303 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008304 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008305 int params[HDD_WLAN_WMM_PARAM_COUNT];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008306 struct sme_qos_wmmtspecinfo tspec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008307 uint32_t handle;
8308 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008309 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008310 int ret;
8311
Dustin Brownfdf17c12018-03-14 12:55:34 -07008312 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308313
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008314 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008315 ret = wlan_hdd_validate_context(hdd_ctx);
8316 if (0 != ret)
8317 return ret;
8318
Jeff Johnson441e1f72017-02-07 08:50:49 -08008319 ret = hdd_check_private_wext_control(hdd_ctx, info);
8320 if (0 != ret)
8321 return ret;
8322
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008323 /* make sure the application is sufficiently priviledged */
8324 /* note that the kernel will do this for "set" ioctls, but since */
8325 /* this ioctl wants to return status to user space it must be */
8326 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008327 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008328 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008329
8330 /* we must be associated in order to add a tspec */
Jeff Johnsone7951512019-02-27 10:02:51 -08008331 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008332 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008333 return 0;
8334 }
8335 /* since we are defined to be a "get" ioctl, and since the number */
8336 /* of params exceeds the number of params that wireless extensions */
8337 /* will pass down in the iwreq_data, we must copy the "set" params. */
8338 /* We must handle the compat for iwreq_data in 32U/64K environment. */
8339
8340 /* helper function to get iwreq_data with compat handling. */
8341 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008342 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008343 return 0;
8344 }
8345 /* make sure all params are correctly passed to function */
Jeff Johnsond36fa332019-03-18 13:42:25 -07008346 if ((!s_priv_data.pointer) ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008347 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
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 }
8351 /* from user space ourselves */
8352 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
8353 /* hmmm, can't get them */
8354 return -EIO;
8355 }
8356 /* clear the tspec */
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008357 memset(&tspec, 0, sizeof(tspec));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008358
8359 /* validate the handle */
8360 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8361 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8362 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008363 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008364 return 0;
8365 }
8366 /* validate the TID */
8367 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
8368 /* out of range */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008369 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008370 return 0;
8371 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008372 tspec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008373
8374 /* validate the direction */
8375 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
8376 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008377 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008378 break;
8379
8380 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008381 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008382 break;
8383
8384 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008385 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008386 break;
8387
8388 default:
8389 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008390 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008391 return 0;
8392 }
8393
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008394 tspec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008395
8396 /* validate the user priority */
8397 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
8398 /* out of range */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008399 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008400 return 0;
8401 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008402 tspec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
8403 if (0 > tspec.ts_info.up || SME_QOS_WMM_UP_MAX < tspec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008404 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008405 return 0;
8406 }
8407
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008408 hdd_debug("TS_INFO PSB %d UP %d !!!",
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008409 tspec.ts_info.psb, tspec.ts_info.up);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008410
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008411 tspec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
8412 tspec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
8413 tspec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
8414 tspec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
8415 tspec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
8416 tspec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
8417 tspec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
8418 tspec.surplus_bw_allowance =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008419 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008420 tspec.min_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008421 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008422 tspec.max_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008423 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008424 tspec.suspension_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008425 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008426 tspec.inactivity_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008427 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
8428
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008429 tspec.ts_info.burst_size_defn =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008430 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
8431
8432 /* validate the ts info ack policy */
8433 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
Abhinav Kumarab576712018-11-05 14:32:49 +05308434 case TS_INFO_ACK_POLICY_NORMAL_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008435 tspec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008436 break;
8437
Abhinav Kumarab576712018-11-05 14:32:49 +05308438 case TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008439 tspec.ts_info.ack_policy =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008440 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
8441 break;
8442
8443 default:
8444 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008445 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008446 return 0;
8447 }
8448
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008449 *wmm_status = hdd_wmm_addts(adapter, handle, &tspec);
Dustin Browne74003f2018-03-14 12:51:58 -07008450 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008451 return 0;
8452}
8453
8454static int iw_add_tspec(struct net_device *dev,
8455 struct iw_request_info *info,
8456 union iwreq_data *wrqu, char *extra)
8457{
Dustin Brown389e5072018-11-08 17:10:01 +05308458 int errno;
8459 struct osif_vdev_sync *vdev_sync;
8460
8461 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8462 if (errno)
8463 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008464
Dustin Brown389e5072018-11-08 17:10:01 +05308465 errno = __iw_add_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008466
Dustin Brown389e5072018-11-08 17:10:01 +05308467 osif_vdev_sync_op_stop(vdev_sync);
8468
8469 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008470}
8471
8472/**
8473 * iw_del_tspec - Delete TSpec private ioctl handler
8474 * @dev: device upon which the ioctl was received
8475 * @info: ioctl request information
8476 * @wrqu: ioctl request data
8477 * @extra: ioctl extra data
8478 *
8479 * Return: 0 on success, non-zero on error
8480 */
8481static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
8482 union iwreq_data *wrqu, char *extra)
8483{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008484 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008485 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008486 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008487 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008488 uint32_t handle;
8489 int ret;
8490
Dustin Brownfdf17c12018-03-14 12:55:34 -07008491 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308492
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008493 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008494 ret = wlan_hdd_validate_context(hdd_ctx);
8495 if (0 != ret)
8496 return ret;
8497
Jeff Johnson441e1f72017-02-07 08:50:49 -08008498 ret = hdd_check_private_wext_control(hdd_ctx, info);
8499 if (0 != ret)
8500 return ret;
8501
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008502 /* make sure the application is sufficiently priviledged */
8503 /* note that the kernel will do this for "set" ioctls, but since */
8504 /* this ioctl wants to return status to user space it must be */
8505 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008506 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008507 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008508
8509 /* although we are defined to be a "get" ioctl, the params we require */
8510 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8511 /* is no need to copy the params from user space */
8512
8513 /* validate the handle */
8514 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8515 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8516 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008517 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008518 return 0;
8519 }
8520
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008521 *wmm_status = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008522 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008523 return 0;
8524}
8525
8526static int iw_del_tspec(struct net_device *dev,
8527 struct iw_request_info *info,
8528 union iwreq_data *wrqu, char *extra)
8529{
Dustin Brown389e5072018-11-08 17:10:01 +05308530 int errno;
8531 struct osif_vdev_sync *vdev_sync;
8532
8533 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8534 if (errno)
8535 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008536
Dustin Brown389e5072018-11-08 17:10:01 +05308537 errno = __iw_del_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008538
Dustin Brown389e5072018-11-08 17:10:01 +05308539 osif_vdev_sync_op_stop(vdev_sync);
8540
8541 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008542}
8543
8544/**
8545 * iw_get_tspec - Get TSpec private ioctl handler
8546 * @dev: device upon which the ioctl was received
8547 * @info: ioctl request information
8548 * @wrqu: ioctl request data
8549 * @extra: ioctl extra data
8550 *
8551 * Return: 0 on success, non-zero on error
8552 */
8553static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
8554 union iwreq_data *wrqu, char *extra)
8555{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008556 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008557 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008558 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008559 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008560 uint32_t handle;
8561 int ret;
8562
Dustin Brownfdf17c12018-03-14 12:55:34 -07008563 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308564
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008565 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008566 ret = wlan_hdd_validate_context(hdd_ctx);
8567 if (0 != ret)
8568 return ret;
8569
Jeff Johnson441e1f72017-02-07 08:50:49 -08008570 ret = hdd_check_private_wext_control(hdd_ctx, info);
8571 if (0 != ret)
8572 return ret;
8573
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008574 /* although we are defined to be a "get" ioctl, the params we require */
8575 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8576 /* is no need to copy the params from user space */
8577
8578 /* validate the handle */
8579 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8580 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8581 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008582 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008583 return 0;
8584 }
8585
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008586 *wmm_status = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008587 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008588 return 0;
8589}
8590
8591static int iw_get_tspec(struct net_device *dev,
8592 struct iw_request_info *info,
8593 union iwreq_data *wrqu, char *extra)
8594{
Dustin Brown389e5072018-11-08 17:10:01 +05308595 int errno;
8596 struct osif_vdev_sync *vdev_sync;
8597
8598 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8599 if (errno)
8600 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008601
Dustin Brown389e5072018-11-08 17:10:01 +05308602 errno = __iw_get_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008603
Dustin Brown389e5072018-11-08 17:10:01 +05308604 osif_vdev_sync_op_stop(vdev_sync);
8605
8606 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008607}
8608
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008609/**
8610 * iw_set_fties - Set FT IEs private ioctl handler
8611 * @dev: device upon which the ioctl was received
8612 * @info: ioctl request information
8613 * @wrqu: ioctl request data
8614 * @extra: ioctl extra data
8615 *
8616 * Each time the supplicant has the auth_request or reassoc request
8617 * IEs ready they are pushed to the driver. The driver will in turn
8618 * use it to send out the auth req and reassoc req for 11r FT Assoc.
8619 *
8620 * Return: 0 on success, non-zero on error
8621 */
8622static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
8623 union iwreq_data *wrqu, char *extra)
8624{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008625 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008626 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008627 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008628 int ret;
8629
Dustin Brownfdf17c12018-03-14 12:55:34 -07008630 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308631
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008632 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008633 ret = wlan_hdd_validate_context(hdd_ctx);
8634 if (0 != ret)
8635 return ret;
8636
Jeff Johnson441e1f72017-02-07 08:50:49 -08008637 ret = hdd_check_private_wext_control(hdd_ctx, info);
8638 if (0 != ret)
8639 return ret;
8640
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008641 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008642 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008643 return -EINVAL;
8644 }
Jeff Johnsond36fa332019-03-18 13:42:25 -07008645 if (!wrqu->data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008646 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008647 return -EINVAL;
8648 }
8649 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsone7951512019-02-27 10:02:51 -08008650 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008651 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008652 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008653 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008654 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008655 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008656
8657 /* Pass the received FT IEs to SME */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008658 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->vdev_id,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008659 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07008660 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008661 return 0;
8662}
8663
8664static int iw_set_fties(struct net_device *dev,
8665 struct iw_request_info *info,
8666 union iwreq_data *wrqu, char *extra)
8667{
Dustin Brown389e5072018-11-08 17:10:01 +05308668 int errno;
8669 struct osif_vdev_sync *vdev_sync;
8670
8671 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8672 if (errno)
8673 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008674
Dustin Brown389e5072018-11-08 17:10:01 +05308675 errno = __iw_set_fties(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008676
Dustin Brown389e5072018-11-08 17:10:01 +05308677 osif_vdev_sync_op_stop(vdev_sync);
8678
8679 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008680}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008681
Dustin Brown0cbc7572016-12-16 13:54:40 -08008682/**
8683 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
8684 * @dev: device upon which the ioctl was received
8685 * @info: ioctl request information
8686 * @wrqu: ioctl request data
8687 * @extra: ioctl extra data
8688 *
Dustin Brown860566f2017-01-31 15:24:43 -08008689 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
8690 * time being to provide guidance in migrating to standard APIs.
8691 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08008692 * Return: 0 on success, non-zero on error
8693 */
8694static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
8695 struct iw_request_info *info,
8696 union iwreq_data *wrqu,
8697 char *extra)
8698{
Dustin Brown860566f2017-01-31 15:24:43 -08008699 hdd_err("\n"
8700 "setMCBCFilter is obsolete. Use the following instead:\n"
8701 "Configure multicast filtering via the ‘ip’ command.\n"
8702 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
8703 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
8704 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
8705 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
8706 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07008707 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08008708}
8709
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008710/**
8711 * iw_set_host_offload - Set host offload ioctl handler
8712 * @dev: device upon which the ioctl was received
8713 * @info: ioctl request information
8714 * @wrqu: ioctl request data
8715 * @extra: ioctl extra data
8716 *
8717 * Return: 0 on success, non-zero on error
8718 */
8719static int __iw_set_host_offload(struct net_device *dev,
8720 struct iw_request_info *info,
8721 union iwreq_data *wrqu, char *extra)
8722{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008723 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008724 struct host_offload_req *user_request =
8725 (struct host_offload_req *) extra;
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008726 struct sir_host_offload_req offload_request;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008727 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008728 int ret;
8729
Dustin Brownfdf17c12018-03-14 12:55:34 -07008730 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308731
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008732 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008733 ret = wlan_hdd_validate_context(hdd_ctx);
8734 if (0 != ret)
8735 return ret;
8736
Jeff Johnson441e1f72017-02-07 08:50:49 -08008737 ret = hdd_check_private_wext_control(hdd_ctx, info);
8738 if (0 != ret)
8739 return ret;
8740
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008741 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008742 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008743 return -EINVAL;
8744 }
8745
8746 /* Debug display of request components. */
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008747 switch (user_request->offloadType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008748 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008749 hdd_debug("Host offload request: ARP reply");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008750 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008751 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008752 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008753 break;
8754 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008755 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07008756 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008757 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008758 hdd_debug(" ARP offload enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008759 hdd_debug(" IP address: %pI4",
8760 user_request->params.hostIpv4Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008761 }
8762 break;
8763
8764 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008765 hdd_debug("Host offload request: neighbor discovery");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008766 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008767 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008768 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008769 break;
8770 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008771 hdd_debug(" enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008772 hdd_debug(" IP address: %pI6c",
8773 user_request->params.hostIpv6Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008774 }
8775 }
8776
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008777 qdf_mem_zero(&offload_request, sizeof(offload_request));
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008778 offload_request.offloadType = user_request->offloadType;
8779 offload_request.enableOrDisable = user_request->enableOrDisable;
8780 qdf_mem_copy(&offload_request.params, &user_request->params,
8781 sizeof(user_request->params));
8782 qdf_mem_copy(&offload_request.bssid, &user_request->bssId.bytes,
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05308783 QDF_MAC_ADDR_SIZE);
8784
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308785 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008786 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008787 adapter->vdev_id, &offload_request)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008788 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008789 return -EINVAL;
8790 }
Dustin Browne74003f2018-03-14 12:51:58 -07008791 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008792 return 0;
8793}
8794
8795static int iw_set_host_offload(struct net_device *dev,
8796 struct iw_request_info *info,
8797 union iwreq_data *wrqu, char *extra)
8798{
Dustin Brown389e5072018-11-08 17:10:01 +05308799 int errno;
8800 struct osif_vdev_sync *vdev_sync;
8801
8802 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8803 if (errno)
8804 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008805
Dustin Brown389e5072018-11-08 17:10:01 +05308806 errno = __iw_set_host_offload(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008807
Dustin Brown389e5072018-11-08 17:10:01 +05308808 osif_vdev_sync_op_stop(vdev_sync);
8809
8810 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008811}
8812
8813/**
8814 * iw_set_keepalive_params - Set keepalive params ioctl handler
8815 * @dev: device upon which the ioctl was received
8816 * @info: ioctl request information
8817 * @wrqu: ioctl request data
8818 * @extra: ioctl extra data
8819 *
8820 * Return: 0 on success, non-zero on error
8821 */
8822static int __iw_set_keepalive_params(struct net_device *dev,
8823 struct iw_request_info *info,
8824 union iwreq_data *wrqu, char *extra)
8825{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008826 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson562ccad2019-02-06 22:10:24 -08008827 struct keep_alive_req *request = (struct keep_alive_req *)extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008828 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008829 int ret;
8830
Dustin Brownfdf17c12018-03-14 12:55:34 -07008831 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308832
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008833 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008834 ret = wlan_hdd_validate_context(hdd_ctx);
8835 if (0 != ret)
8836 return ret;
8837
Jeff Johnson441e1f72017-02-07 08:50:49 -08008838 ret = hdd_check_private_wext_control(hdd_ctx, info);
8839 if (0 != ret)
8840 return ret;
8841
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008842 if (wrqu->data.length != sizeof(*request)) {
8843 hdd_err("Invalid length %d", wrqu->data.length);
8844 return -EINVAL;
8845 }
8846
Wu Gao93816212018-08-31 16:49:54 +08008847 if (request->timePeriod > cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008848 hdd_err("Value of timePeriod %d exceed Max limit %d",
8849 request->timePeriod,
Wu Gao93816212018-08-31 16:49:54 +08008850 cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008851 return -EINVAL;
8852 }
8853
8854 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008855 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Jeff Johnson562ccad2019-02-06 22:10:24 -08008856 request->timePeriod, sizeof(struct keep_alive_req));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008857
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008858 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008859 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008860 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008861 break;
8862
8863 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008864 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008865
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008866 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008867 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8868 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008869
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008870 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008871 request->destIpv4Addr[0], request->destIpv4Addr[1],
8872 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008873
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008874 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -08008875 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008876 break;
8877 }
8878
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008879 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008880
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308881 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008882 sme_set_keep_alive(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008883 adapter->vdev_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008884 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008885 return -EINVAL;
8886 }
Dustin Browne74003f2018-03-14 12:51:58 -07008887 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008888 return 0;
8889}
8890
8891static int iw_set_keepalive_params(struct net_device *dev,
8892 struct iw_request_info *info,
8893 union iwreq_data *wrqu,
8894 char *extra)
8895{
Dustin Brown389e5072018-11-08 17:10:01 +05308896 int errno;
8897 struct osif_vdev_sync *vdev_sync;
8898
8899 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8900 if (errno)
8901 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008902
Dustin Brown389e5072018-11-08 17:10:01 +05308903 errno = __iw_set_keepalive_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008904
Dustin Brown389e5072018-11-08 17:10:01 +05308905 osif_vdev_sync_op_stop(vdev_sync);
8906
8907 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008908}
8909
8910#ifdef WLAN_FEATURE_PACKET_FILTERING
8911/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308912 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8913 * @priv_data: Pointer to the priv data from user space
8914 * @request: Pointer to the struct containing the copied data from user space
8915 *
8916 * Return: False on invalid length, true otherwise
8917 */
8918static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8919 uint16_t length)
8920{
8921 int max_params_size, rcvd_params_size;
8922
8923 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8924 sizeof(struct pkt_filter_param_cfg);
8925
8926 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8927 hdd_err("Less than minimum number of arguments needed");
8928 return false;
8929 }
8930
8931 rcvd_params_size = request->num_params *
8932 sizeof(struct pkt_filter_param_cfg);
8933
8934 if (length != sizeof(struct pkt_filter_cfg) -
8935 max_params_size + rcvd_params_size) {
8936 hdd_err("Arguments do not match the number of params provided");
8937 return false;
8938 }
8939
8940 return true;
8941}
8942
8943/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008944 * __iw_set_packet_filter_params() - set packet filter parameters in target
8945 * @dev: Pointer to netdev
8946 * @info: Pointer to iw request info
8947 * @wrqu: Pointer to data
8948 * @extra: Pointer to extra data
8949 *
8950 * Return: 0 on success, non-zero on error
8951 */
8952static int __iw_set_packet_filter_params(struct net_device *dev,
8953 struct iw_request_info *info,
8954 union iwreq_data *wrqu, char *extra)
8955{
8956 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008957 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008958 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008959 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008960 struct pkt_filter_cfg *request = NULL;
8961
Mukul Sharma472382f2015-11-02 20:16:31 +05308962 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008963 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308964 return -EPERM;
8965 }
8966
Dustin Brownfdf17c12018-03-14 12:55:34 -07008967 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308968
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008969 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8970 ret = wlan_hdd_validate_context(hdd_ctx);
8971 if (0 != ret)
8972 return ret;
8973
Jeff Johnson441e1f72017-02-07 08:50:49 -08008974 ret = hdd_check_private_wext_control(hdd_ctx, info);
8975 if (0 != ret)
8976 return ret;
8977
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008978 if (hdd_priv_get_data(&priv_data, wrqu)) {
8979 hdd_err("failed to get priv data");
8980 return -EINVAL;
8981 }
8982
Jeff Johnsond36fa332019-03-18 13:42:25 -07008983 if ((!priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008984 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008985 priv_data.pointer, priv_data.length);
8986 return -EINVAL;
8987 }
8988
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308989 if (adapter->device_mode != QDF_STA_MODE) {
8990 hdd_err("Packet filter not supported for this mode :%d",
8991 adapter->device_mode);
8992 return -ENOTSUPP;
8993 }
8994
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308995 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8996 hdd_err("Packet filter not supported in disconnected state");
8997 return -ENOTSUPP;
8998 }
8999
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009000 /* copy data using copy_from_user */
9001 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
9002 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05309003
Jeff Johnsond36fa332019-03-18 13:42:25 -07009004 if (!request) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009005 hdd_err("mem_alloc_copy_from_user_helper fail");
9006 return -ENOMEM;
9007 }
9008
Sourav Mohapatra69d07802018-05-31 17:09:05 +05309009 if (!validate_packet_filter_params_size(request, priv_data.length)) {
9010 hdd_err("Invalid priv data length %d", priv_data.length);
9011 qdf_mem_free(request);
9012 return -EINVAL;
9013 }
9014
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05309015 if (request->filter_action == HDD_RCV_FILTER_SET)
9016 hdd_ctx->user_configured_pkt_filter_rules |=
9017 1 << request->filter_id;
9018 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
9019 hdd_ctx->user_configured_pkt_filter_rules &=
9020 ~(1 << request->filter_id);
9021
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009022 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->vdev_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009023
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07009024 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07009025 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009026 return ret;
9027}
9028
9029/**
9030 * iw_set_packet_filter_params() - set packet filter parameters in target
9031 * @dev: Pointer to netdev
9032 * @info: Pointer to iw request info
9033 * @wrqu: Pointer to data
9034 * @extra: Pointer to extra data
9035 *
9036 * Return: 0 on success, non-zero on error
9037 */
9038static int iw_set_packet_filter_params(struct net_device *dev,
9039 struct iw_request_info *info,
9040 union iwreq_data *wrqu, char *extra)
9041{
Dustin Brown389e5072018-11-08 17:10:01 +05309042 int errno;
9043 struct osif_vdev_sync *vdev_sync;
9044
9045 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9046 if (errno)
9047 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009048
Dustin Brown389e5072018-11-08 17:10:01 +05309049 errno = __iw_set_packet_filter_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009050
Dustin Brown389e5072018-11-08 17:10:01 +05309051 osif_vdev_sync_op_stop(vdev_sync);
9052
9053 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009054}
9055#endif
9056
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009057#ifdef QCA_SUPPORT_CP_STATS
9058static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
9059{
9060 return wlan_hdd_get_station_stats(adapter);
9061}
9062#else /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08009063struct hdd_statistics_priv {
9064 tCsrSummaryStatsInfo summary_stats;
9065 tCsrGlobalClassAStatsInfo class_a_stats;
9066 tCsrGlobalClassDStatsInfo class_d_stats;
9067};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009068
Jeff Johnsond37833f2018-03-07 14:22:44 -08009069/**
9070 * hdd_statistics_cb() - "Get statistics" callback function
Jeff Johnsonced658b2018-03-08 09:54:01 -08009071 * @stats: statistics payload
9072 * @context: opaque context originally passed to SME. HDD always passes
9073 * a cookie for the request context
Jeff Johnsond37833f2018-03-07 14:22:44 -08009074 *
9075 * Return: None
9076 */
Jeff Johnsonced658b2018-03-08 09:54:01 -08009077static void hdd_statistics_cb(void *stats, void *context)
Jeff Johnsond37833f2018-03-07 14:22:44 -08009078{
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009079 struct osif_request *request;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009080 struct hdd_statistics_priv *priv;
9081 tCsrSummaryStatsInfo *summary_stats;
9082 tCsrGlobalClassAStatsInfo *class_a_stats;
9083 tCsrGlobalClassDStatsInfo *class_d_stats;
Jeff Johnsond37833f2018-03-07 14:22:44 -08009084
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009085 request = osif_request_get(context);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009086 if (!request) {
9087 hdd_err("Obsolete request");
9088 return;
Jeff Johnsond37833f2018-03-07 14:22:44 -08009089 }
9090
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009091 priv = osif_request_priv(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009092
9093 summary_stats = (tCsrSummaryStatsInfo *)stats;
9094 priv->summary_stats = *summary_stats;
9095
9096 class_a_stats = (tCsrGlobalClassAStatsInfo *)(summary_stats + 1);
9097 priv->class_a_stats = *class_a_stats;
9098
9099 class_d_stats = (tCsrGlobalClassDStatsInfo *)(class_a_stats + 1);
9100 priv->class_d_stats = *class_d_stats;
9101
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009102 osif_request_complete(request);
9103 osif_request_put(request);
Jeff Johnsond37833f2018-03-07 14:22:44 -08009104}
9105
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009106static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009107{
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009108 int ret = 0;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009109 void *cookie;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009110 QDF_STATUS status;
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009111 struct osif_request *request;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009112 struct hdd_station_ctx *sta_ctx;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009113 struct hdd_statistics_priv *priv;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009114 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009115 static const struct osif_request_params params = {
Jeff Johnsonced658b2018-03-08 09:54:01 -08009116 .priv_size = sizeof(*priv),
9117 .timeout_ms = WLAN_WAIT_TIME_STATS,
9118 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009119
Jeff Johnsonced658b2018-03-08 09:54:01 -08009120 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009121 request = osif_request_alloc(&params);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009122 if (!request) {
9123 hdd_warn("request allocation failed");
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009124 return -EINVAL;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009125 }
9126
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009127 cookie = osif_request_cookie(request);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07009128 status = sme_get_statistics(hdd_ctx->mac_handle, eCSR_HDD,
Jeff Johnsonced658b2018-03-08 09:54:01 -08009129 SME_SUMMARY_STATS |
9130 SME_GLOBAL_CLASSA_STATS |
9131 SME_GLOBAL_CLASSD_STATS,
9132 hdd_statistics_cb,
Jeff Johnson0a082d92019-03-04 12:25:49 -08009133 sta_ctx->conn_info.sta_id[0],
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009134 cookie, adapter->vdev_id);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009135
9136 if (QDF_STATUS_SUCCESS != status) {
9137 hdd_warn("Unable to retrieve SME statistics");
9138 goto put_request;
9139 }
9140
9141 /* request was sent -- wait for the response */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009142 ret = osif_request_wait_for_response(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009143 if (ret) {
9144 hdd_err("Failed to wait for statistics, errno %d", ret);
9145 goto put_request;
9146 }
9147
9148 /* update the adapter cache with the fresh results */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009149 priv = osif_request_priv(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009150 adapter->hdd_stats.summary_stat = priv->summary_stats;
9151 adapter->hdd_stats.class_a_stat = priv->class_a_stats;
9152 adapter->hdd_stats.class_d_stat = priv->class_d_stats;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009153
9154put_request:
9155 /*
9156 * either we never sent a request, we sent a request and
9157 * received a response or we sent a request and timed out.
9158 * regardless we are done with the request.
9159 */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009160 osif_request_put(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009161 return ret;
9162}
9163#endif /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08009164
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009165static int __iw_get_statistics(struct net_device *dev,
9166 struct iw_request_info *info,
9167 union iwreq_data *wrqu, char *extra)
9168{
9169 int ret;
9170 char *p;
9171 int tlen;
9172 struct hdd_station_ctx *sta_ctx;
9173 tCsrSummaryStatsInfo *summary_stats;
9174 tCsrGlobalClassAStatsInfo *class_a_stats;
9175 tCsrGlobalClassDStatsInfo *class_d_stats;
9176 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
9177 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9178
9179 hdd_enter_dev(dev);
9180
9181 ret = wlan_hdd_validate_context(hdd_ctx);
9182 if (0 != ret)
9183 return ret;
9184
9185 ret = hdd_check_private_wext_control(hdd_ctx, info);
9186 if (0 != ret)
9187 return ret;
9188
9189 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsone7951512019-02-27 10:02:51 -08009190 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009191 wrqu->data.length = 0;
9192 return 0;
9193 }
9194
9195 hdd_get_wlan_stats(adapter);
9196
9197 summary_stats = &(adapter->hdd_stats.summary_stat);
9198 class_a_stats = &(adapter->hdd_stats.class_a_stat);
9199 class_d_stats = &(adapter->hdd_stats.class_d_stat);
9200
Jeff Johnsonced658b2018-03-08 09:54:01 -08009201 p = extra;
9202 tlen = 0;
9203
9204 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
9205 sizeof(summary_stats->retry_cnt),
9206 &(summary_stats->retry_cnt[0]), tlen);
9207
9208 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
9209 sizeof(summary_stats->multiple_retry_cnt),
9210 &(summary_stats->multiple_retry_cnt[0]), tlen);
9211
9212 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
9213 sizeof(summary_stats->tx_frm_cnt),
9214 &(summary_stats->tx_frm_cnt[0]), tlen);
9215
9216 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
9217 sizeof(summary_stats->rx_frm_cnt),
9218 &(summary_stats->rx_frm_cnt), tlen);
9219
9220 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
9221 sizeof(summary_stats->frm_dup_cnt),
9222 &(summary_stats->frm_dup_cnt), tlen);
9223
9224 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
9225 sizeof(summary_stats->fail_cnt),
9226 &(summary_stats->fail_cnt[0]), tlen);
9227
9228 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
9229 sizeof(summary_stats->rts_fail_cnt),
9230 &(summary_stats->rts_fail_cnt), tlen);
9231
9232 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
9233 sizeof(summary_stats->ack_fail_cnt),
9234 &(summary_stats->ack_fail_cnt), tlen);
9235
9236 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
9237 sizeof(summary_stats->rts_succ_cnt),
9238 &(summary_stats->rts_succ_cnt), tlen);
9239
9240 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
9241 sizeof(summary_stats->rx_discard_cnt),
9242 &(summary_stats->rx_discard_cnt), tlen);
9243
9244 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
9245 sizeof(summary_stats->rx_error_cnt),
9246 &(summary_stats->rx_error_cnt), tlen);
9247
9248 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
9249 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9250 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9251
9252 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
9253 sizeof(class_d_stats->rx_byte_cnt),
9254 &(class_d_stats->rx_byte_cnt), tlen);
9255
9256 FILL_TLV(p, WLAN_STATS_RX_RATE,
9257 sizeof(class_d_stats->rx_rate),
9258 &(class_d_stats->rx_rate), tlen);
9259
9260 /* Transmit rate, in units of 500 kbit/sec */
9261 FILL_TLV(p, WLAN_STATS_TX_RATE,
9262 sizeof(class_a_stats->tx_rate),
9263 &(class_a_stats->tx_rate), tlen);
9264
9265 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
9266 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
9267 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
9268 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
9269 sizeof(class_d_stats->rx_mc_byte_cnt),
9270 &(class_d_stats->rx_mc_byte_cnt), tlen);
9271 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
9272 sizeof(class_d_stats->rx_bc_byte_cnt),
9273 &(class_d_stats->rx_bc_byte_cnt), tlen);
9274 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
9275 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9276 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9277 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
9278 sizeof(class_d_stats->tx_mc_byte_cnt),
9279 &(class_d_stats->tx_mc_byte_cnt), tlen);
9280 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
9281 sizeof(class_d_stats->tx_bc_byte_cnt),
9282 &(class_d_stats->tx_bc_byte_cnt), tlen);
9283
9284 wrqu->data.length = tlen;
9285
Dustin Browne74003f2018-03-14 12:51:58 -07009286 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009287
9288 return 0;
9289}
9290
9291static int iw_get_statistics(struct net_device *dev,
9292 struct iw_request_info *info,
9293 union iwreq_data *wrqu, char *extra)
9294{
Dustin Brown389e5072018-11-08 17:10:01 +05309295 int errno;
9296 struct osif_vdev_sync *vdev_sync;
9297
9298 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9299 if (errno)
9300 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009301
Dustin Brown389e5072018-11-08 17:10:01 +05309302 errno = __iw_get_statistics(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009303
Dustin Brown389e5072018-11-08 17:10:01 +05309304 osif_vdev_sync_op_stop(vdev_sync);
9305
9306 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009307}
9308
9309#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009310/*Max Len for PNO notification*/
9311#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05309312static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
9313 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009314{
Abhishek Singh0481d662017-04-11 18:20:11 +05309315 struct vdev_osif_priv *osif_priv;
9316 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009317 union iwreq_data wrqu;
9318 char buf[MAX_PNO_NOTIFY_LEN + 1];
9319
Abhishek Singh0481d662017-04-11 18:20:11 +05309320 wlan_vdev_obj_lock(vdev);
9321 osif_priv = wlan_vdev_get_ospriv(vdev);
9322 wlan_vdev_obj_unlock(vdev);
9323 if (!osif_priv) {
9324 hdd_err("osif_priv is null");
9325 return;
9326 }
9327
9328 wdev = osif_priv->wdev;
9329 if (!wdev) {
9330 hdd_err("wdev is null");
9331 return;
9332 }
9333
9334 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009335
9336 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05309337 qdf_mem_zero(&wrqu, sizeof(wrqu));
9338 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009339
9340 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05309341 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009342
9343 wrqu.data.pointer = buf;
9344 wrqu.data.length = strlen(buf);
9345
9346 /* send the event */
9347
Abhishek Singh0481d662017-04-11 18:20:11 +05309348 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009349}
9350
9351/**
9352 * __iw_set_pno() - Preferred Network Offload ioctl handler
9353 * @dev: device upon which the ioctl was received
9354 * @info: ioctl request information
9355 * @wrqu: ioctl request data
9356 * @extra: ioctl extra data
9357 *
9358 * This function parses a Preferred Network Offload command
9359 * Input is string based and expected to be of the form:
9360 *
9361 * <enable(1) | disable(0)>
9362 * when enabling:
9363 * <number of networks>
9364 * for each network:
9365 * <ssid_len> <ssid> <authentication> <encryption>
9366 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07009367 * <scan_time (seconds)>
9368 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009369 * <suspend mode>
9370 *
9371 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07009372 * 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 -08009373 *
9374 * this translates into:
9375 * -----------------------------
9376 * enable PNO
9377 * 2 networks
9378 * Network 1:
9379 * test - with authentication type 0 and encryption type 0,
9380 * search on 3 channels: 1 6 and 11,
9381 * SSID bcast type is unknown (directed probe will be sent if
9382 * AP not found) and must meet -40dBm RSSI
9383 * Network 2:
9384 * test2 - with authentication type 4 and encryption type 4,
9385 * search on 6 channels 1, 2, 3, 4, 5 and 6
9386 * bcast type is non-bcast (directed probe will be sent)
9387 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009388 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07009389 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009390 */
9391static int __iw_set_pno(struct net_device *dev,
9392 struct iw_request_info *info,
9393 union iwreq_data *wrqu, char *extra)
9394{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009395 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009396 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05309397 uint8_t value;
9398 struct wlan_objmgr_vdev *vdev;
9399 struct wlan_objmgr_psoc *psoc;
9400 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009401 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309402 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05309403 uint8_t i, j, params;
9404 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309405 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009406
9407 /* request is a large struct, so we make it static to avoid
9408 * stack overflow. This API is only invoked via ioctl, so it
9409 * is serialized by the kernel rtnl_lock and hence does not
9410 * need to be reentrant
9411 */
Abhishek Singh0481d662017-04-11 18:20:11 +05309412 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009413
Dustin Brownfdf17c12018-03-14 12:55:34 -07009414 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009415
9416 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9417 ret = wlan_hdd_validate_context(hdd_ctx);
9418 if (ret)
9419 return ret;
9420
Jeff Johnson441e1f72017-02-07 08:50:49 -08009421 ret = hdd_check_private_wext_control(hdd_ctx, info);
9422 if (0 != ret)
9423 return ret;
9424
Dustin Brown07901ec2018-09-07 11:02:41 -07009425 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->pdev,
9426 dev->dev_addr,
9427 WLAN_LEGACY_MAC_ID);
Abhishek Singh0481d662017-04-11 18:20:11 +05309428 if (!vdev) {
9429 hdd_err("vdev object is NULL");
9430 return -EIO;
9431 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009432
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309433 /* making sure argument string ends with '\0' */
9434 len = (wrqu->data.length + 1);
9435 data = qdf_mem_malloc(len);
9436 if (!data) {
9437 hdd_err("fail to allocate memory %zu", len);
9438 return -EINVAL;
9439 }
9440 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309441 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009442
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05309443 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
9444
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309445 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009446 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309447 ret = -EINVAL;
9448 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009449 }
9450
Abhishek Singh0481d662017-04-11 18:20:11 +05309451 if (!value) {
9452 status = ucfg_scan_pno_stop(vdev);
9453 if (QDF_IS_STATUS_ERROR(status)) {
9454 hdd_err("Failed to disabled PNO");
9455 ret = -EINVAL;
9456 } else {
9457 hdd_debug("PNO scan disabled");
9458 }
9459 goto exit;
9460 }
9461
9462 if (ucfg_scan_get_pno_in_progress(vdev)) {
9463 hdd_debug("pno is already in progress");
9464 ret = -EBUSY;
9465 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009466 }
9467
9468 ptr += offset;
9469
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309470 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009471 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309472 ret = -EINVAL;
9473 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009474 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309475 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009476
Abhishek Singh0481d662017-04-11 18:20:11 +05309477 hdd_debug("PNO enable networks count %d offset %d",
9478 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009479
Abhishek Singh0481d662017-04-11 18:20:11 +05309480 if ((0 == req.networks_cnt) ||
9481 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009482 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05309483 req.networks_cnt);
9484 ret = -EINVAL;
9485 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009486 }
9487
9488 ptr += offset;
9489
Abhishek Singh0481d662017-04-11 18:20:11 +05309490 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009491
Abhishek Singh0481d662017-04-11 18:20:11 +05309492 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009493
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309494 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309495 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009496 &offset);
9497
9498 if (1 != params) {
9499 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309500 ret = -EINVAL;
9501 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009502 }
9503
Abhishek Singh0481d662017-04-11 18:20:11 +05309504 if ((0 == req.networks_list[i].ssid.length) ||
9505 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009506 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309507 req.networks_list[i].ssid.length, i);
9508 ret = -EINVAL;
9509 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009510 }
9511
9512 /* Advance to SSID */
9513 ptr += offset;
9514
Abhishek Singh0481d662017-04-11 18:20:11 +05309515 memcpy(req.networks_list[i].ssid.ssid, ptr,
9516 req.networks_list[i].ssid.length);
9517 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009518
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309519 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309520 &(req.networks_list[i].authentication),
9521 &(req.networks_list[i].encryption),
9522 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009523 &offset);
9524
9525 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009526 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309527 ret = -EINVAL;
9528 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009529 }
9530
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009531 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309532 req.networks_list[i].ssid.length,
9533 req.networks_list[i].ssid.length,
9534 req.networks_list[i].ssid.ssid,
9535 req.networks_list[i].authentication,
9536 req.networks_list[i].encryption,
9537 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009538
9539 /* Advance to channel list */
9540 ptr += offset;
9541
Abhishek Singh0481d662017-04-11 18:20:11 +05309542 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
9543 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009544 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05309545 ret = -EINVAL;
9546 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009547 }
9548
Abhishek Singh0481d662017-04-11 18:20:11 +05309549 if (0 != req.networks_list[i].channel_cnt) {
9550 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009551 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309552 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05309553 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009554 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009555 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309556 ret = -EINVAL;
9557 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009558 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309559 if (!IS_CHANNEL_VALID(value)) {
9560 hdd_err("invalid channel: %hhu", value);
9561 ret = -EINVAL;
9562 goto exit;
9563 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309564 req.networks_list[i].channels[j] =
9565 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009566 /* Advance to next channel number */
9567 ptr += offset;
9568 }
9569 }
9570
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309571 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309572 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009573 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009574 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009575 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309576 ret = -EINVAL;
9577 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009578 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309579 if (req.networks_list[i].bc_new_type > 2) {
9580 hdd_err("invalid bcast nw type: %u",
9581 req.networks_list[i].bc_new_type);
9582 ret = -EINVAL;
9583 goto exit;
9584 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009585
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009586 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309587 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009588
9589 /* Advance to rssi Threshold */
9590 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309591 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309592 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009593 &offset)) {
9594 hdd_err("PNO rssi threshold input is not valid %s",
9595 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309596 ret = -EINVAL;
9597 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009598 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009599 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309600 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009601 /* Advance to next network */
9602 ptr += offset;
9603 } /* For ucNetworkCount */
9604
Abhishek Singh0481d662017-04-11 18:20:11 +05309605 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309606 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05309607 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07009608 ptr += offset;
9609 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309610 if (req.fast_scan_period == 0) {
9611 hdd_err("invalid fast scan period %u",
9612 req.fast_scan_period);
9613 ret = -EINVAL;
9614 goto exit;
9615 }
Dustin Brown43e87292016-10-10 10:38:25 -07009616
Abhishek Singh0481d662017-04-11 18:20:11 +05309617 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309618 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07009619 &offset) > 0)
9620 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05309621 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07009622
Dustin Brown07901ec2018-09-07 11:02:41 -07009623 wlan_pdev_obj_lock(hdd_ctx->pdev);
9624 psoc = wlan_pdev_get_psoc(hdd_ctx->pdev);
9625 wlan_pdev_obj_unlock(hdd_ctx->pdev);
Abhishek Singh0481d662017-04-11 18:20:11 +05309626 ucfg_scan_register_pno_cb(psoc,
9627 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009628
Abhishek Singh0481d662017-04-11 18:20:11 +05309629 ucfg_scan_get_pno_def_params(vdev, &req);
9630 status = ucfg_scan_pno_start(vdev, &req);
9631 if (QDF_IS_STATUS_ERROR(status)) {
9632 hdd_err("Failed to enable PNO");
9633 ret = -EINVAL;
9634 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009635
Abhishek Singh0481d662017-04-11 18:20:11 +05309636exit:
9637 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009638
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309639 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05309640 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009641}
9642
9643static int iw_set_pno(struct net_device *dev,
9644 struct iw_request_info *info,
9645 union iwreq_data *wrqu, char *extra)
9646{
Dustin Brown389e5072018-11-08 17:10:01 +05309647 int errno;
9648 struct osif_vdev_sync *vdev_sync;
9649
9650 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9651 if (errno)
9652 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009653
Dustin Brown389e5072018-11-08 17:10:01 +05309654 errno = __iw_set_pno(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009655
Dustin Brown389e5072018-11-08 17:10:01 +05309656 osif_vdev_sync_op_stop(vdev_sync);
9657
9658 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009659}
9660#endif /* FEATURE_WLAN_SCAN_PNO */
9661
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009662static int __iw_set_band_config(struct net_device *dev,
9663 struct iw_request_info *info,
9664 union iwreq_data *wrqu, char *extra)
9665{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009666 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009667 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08009668 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009669 int *value = (int *)extra;
9670
Dustin Brownfdf17c12018-03-14 12:55:34 -07009671 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009672
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309673 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009674 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309675 return -EPERM;
9676 }
9677
Jeff Johnson441e1f72017-02-07 08:50:49 -08009678 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9679 ret = hdd_check_private_wext_control(hdd_ctx, info);
9680 if (0 != ret)
9681 return ret;
9682
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07009683 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009684}
9685
9686static int iw_set_band_config(struct net_device *dev,
9687 struct iw_request_info *info,
9688 union iwreq_data *wrqu, char *extra)
9689{
Dustin Brown389e5072018-11-08 17:10:01 +05309690 int errno;
9691 struct osif_vdev_sync *vdev_sync;
9692
9693 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9694 if (errno)
9695 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009696
Dustin Brown389e5072018-11-08 17:10:01 +05309697 errno = __iw_set_band_config(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009698
Dustin Brown389e5072018-11-08 17:10:01 +05309699 osif_vdev_sync_op_stop(vdev_sync);
9700
9701 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009702}
9703
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009704static int printk_adapter(void *priv, const char *fmt, ...)
9705{
9706 int ret;
9707 va_list args;
9708
9709 va_start(args, fmt);
9710 ret = vprintk(fmt, args);
9711 ret += printk("\n");
9712 va_end(args);
9713
9714 return ret;
9715}
9716
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009717static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
9718{
9719 qdf_abstract_print *print = &printk_adapter;
9720
9721 switch (log_id) {
9722 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009723 cds_print_htc_credit_history(count, print, NULL);
9724 break;
9725 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009726 wma_print_wmi_cmd_log(count, print, NULL);
9727 break;
9728 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009729 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
9730 break;
9731 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009732 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
9733 break;
9734 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009735 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
9736 break;
9737 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009738 wma_print_wmi_event_log(count, print, NULL);
9739 break;
9740 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009741 wma_print_wmi_rx_event_log(count, print, NULL);
9742 break;
9743 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009744 wma_print_wmi_mgmt_event_log(count, print, NULL);
9745 break;
9746 default:
9747 print(NULL, "Invalid Log Id %d", log_id);
9748 break;
9749 }
9750}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009751
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009752#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
9753int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
9754{
9755 struct hdd_context *hdd_ctx;
9756 int ret;
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309757 bool crash_inject;
9758 QDF_STATUS status;
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009759
9760 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
9761 v1, v2);
9762 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
9763 v1, v2);
9764 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309765
Vignesh Viswanathana1f3a1a2018-10-04 13:10:46 +05309766 status = ucfg_mlme_get_crash_inject(hdd_ctx->psoc, &crash_inject);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309767 if (QDF_IS_STATUS_ERROR(status)) {
9768 hdd_err("Failed to get crash inject ini config");
9769 return 0;
9770 }
9771
9772 if (!crash_inject) {
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009773 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
9774 return 0;
9775 }
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309776
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009777 if (v1 == 3) {
9778 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
9779 return 0;
9780 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009781 ret = wma_cli_set2_command(adapter->vdev_id,
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009782 GEN_PARAM_CRASH_INJECT,
9783 v1, v2, GEN_CMD);
9784 return ret;
9785}
9786#endif
9787
Nirav Shahd21a2e32018-04-20 16:34:43 +05309788#ifdef CONFIG_DP_TRACE
9789void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
9790{
9791 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
9792 cmd_type, count);
9793 if (cmd_type == DUMP_DP_TRACE)
9794 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
9795 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
9796 qdf_dp_trace_enable_live_mode();
9797 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
9798 qdf_dp_trace_clear_buffer();
9799 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
9800 qdf_dp_trace_disable_live_mode();
9801}
9802#endif
9803
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009804static int __iw_set_two_ints_getnone(struct net_device *dev,
9805 struct iw_request_info *info,
9806 union iwreq_data *wrqu, char *extra)
9807{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009808 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009809 int *value = (int *)extra;
9810 int sub_cmd = value[0];
9811 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08009812 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009813 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08009814 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009815
Dustin Brownfdf17c12018-03-14 12:55:34 -07009816 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009817
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009818 ret = wlan_hdd_validate_context(hdd_ctx);
9819 if (0 != ret)
9820 return ret;
9821
Jeff Johnson441e1f72017-02-07 08:50:49 -08009822 ret = hdd_check_private_wext_control(hdd_ctx, info);
9823 if (0 != ret)
9824 return ret;
9825
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009826 switch (sub_cmd) {
9827 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009828 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009829 ret = wma_cli_set_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009830 WMI_STA_SMPS_PARAM_CMDID,
9831 value[1] << WMA_SMPS_PARAM_VALUE_S
9832 | value[2],
9833 VDEV_CMD);
9834 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009835 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009836 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009837 break;
Govind Singha471e5e2015-10-12 17:11:14 +05309838 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07009839 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309840 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009841 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309842 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
9843 value[1], value[2], DBG_CMD);
9844 break;
9845 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07009846 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309847 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009848 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309849 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
9850 value[1], value[2], DBG_CMD);
9851 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009852 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
9853 hdd_debug("Ioctl to set dual fw mode config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08009854 status =
9855 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
9856 &dual_mac_feature);
9857 if (status != QDF_STATUS_SUCCESS)
9858 hdd_err("can't get dual mac feature val, use def");
9859 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009860 hdd_err("Dual mac feature is disabled from INI");
9861 return -EPERM;
9862 }
9863 hdd_debug("%d %d", value[1], value[2]);
Dustin Brown05d81302018-09-11 16:49:22 -07009864 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009865 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009866 break;
9867 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05309868 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009869 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009870 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009871 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009872 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07009873 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08009874 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
9875 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009876 break;
9877 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07009878 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009879 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009880 case WE_LOG_BUFFER: {
9881 int log_id = value[1];
9882 uint32_t count = value[2] < 0 ? 0 : value[2];
9883
9884 hdd_ioctl_log_buffer(log_id, count);
9885
9886 break;
9887 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07009888 case WE_SET_BA_AGEING_TIMEOUT:
9889 {
9890 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
9891
9892 if (!soc) {
9893 hdd_err("Invalid handles");
9894 break;
9895 }
9896 cdp_set_ba_timeout(soc, value[1], value[2]);
9897 break;
9898 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009899 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07009900 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009901 break;
9902 }
9903
9904 return ret;
9905}
9906
9907static int iw_set_two_ints_getnone(struct net_device *dev,
9908 struct iw_request_info *info,
9909 union iwreq_data *wrqu, char *extra)
9910{
Dustin Brown389e5072018-11-08 17:10:01 +05309911 int errno;
9912 struct osif_vdev_sync *vdev_sync;
9913
9914 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9915 if (errno)
9916 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009917
Dustin Brown389e5072018-11-08 17:10:01 +05309918 errno = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009919
Dustin Brown389e5072018-11-08 17:10:01 +05309920 osif_vdev_sync_op_stop(vdev_sync);
9921
9922 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009923}
9924
9925/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009926
9927static const iw_handler we_private[] = {
9928
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009929 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9930 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9931 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009932 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9933 iw_set_three_ints_getnone,
9934 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009935 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009936 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9937 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009938 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9939 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309940#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009941 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309942#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009943 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9944 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9945 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009946 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009947 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9948 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9949 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9950 iw_set_keepalive_params,
9951#ifdef WLAN_FEATURE_PACKET_FILTERING
9952 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9953 iw_set_packet_filter_params,
9954#endif
9955#ifdef FEATURE_WLAN_SCAN_PNO
9956 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9957#endif
9958 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009959 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9960 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009961 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08009962#ifdef FEATURE_WLM_STATS
9963 [WLAN_GET_WLM_STATS - SIOCIWFIRSTPRIV] = iw_get_wlm_stats,
9964#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009965 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9966 iw_set_two_ints_getnone,
9967 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9968 iw_set_dot11p_channel_sched,
9969};
9970
9971/*Maximum command length can be only 15 */
9972static const struct iw_priv_args we_private_args[] = {
9973
9974 /* handlers for main ioctl */
9975 {WLAN_PRIV_SET_INT_GET_NONE,
9976 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9977 0,
9978 ""},
9979
9980 /* handlers for sub-ioctl */
9981 {WE_SET_11D_STATE,
9982 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9983 0,
9984 "set11Dstate"},
9985
9986 {WE_WOWL,
9987 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9988 0,
9989 "wowl"},
9990
9991 {WE_SET_POWER,
9992 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9993 0,
9994 "setPower"},
9995
9996 {WE_SET_MAX_ASSOC,
9997 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9998 0,
9999 "setMaxAssoc"},
10000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010001 {WE_SET_SCAN_DISABLE,
10002 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10003 0,
10004 "scan_disable"},
10005
10006 {WE_SET_DATA_INACTIVITY_TO,
10007 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10008 0,
10009 "inactivityTO"},
10010
Mukul Sharmaed92f2f2017-04-20 00:06:28 +053010011 {WE_SET_WOW_DATA_INACTIVITY_TO,
10012 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10013 0,
10014 "wow_ito"},
10015
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010016 {WE_SET_MAX_TX_POWER,
10017 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10018 0,
10019 "setMaxTxPower"},
10020
10021 {WE_SET_TX_POWER,
10022 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10023 0,
10024 "setTxPower"},
10025
10026 {WE_SET_MC_RATE,
10027 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10028 0,
10029 "setMcRate"},
10030
10031 {WE_SET_MAX_TX_POWER_2_4,
10032 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10033 0,
10034 "setTxMaxPower2G"},
10035
10036 {WE_SET_MAX_TX_POWER_5_0,
10037 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10038 0,
10039 "setTxMaxPower5G"},
10040
Nirav Shahbb8e47c2018-05-17 16:56:41 +053010041#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080010042 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +053010043 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080010044 0,
10045 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +053010046#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080010047
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010048 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
10049 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -080010050 * will support both
10051 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010052 {WE_SET_MAX_TX_POWER,
10053 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10054 0,
10055 "setTxMaxPower"},
10056
Jeff Johnson0187c622019-01-04 06:39:44 -080010057#ifdef HASTINGS_BT_WAR
10058 {WE_SET_HASTINGS_BT_WAR,
10059 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10060 0,
10061 "hastings_bt_war"},
10062#endif
10063
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010064 {WE_SET_TM_LEVEL,
10065 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10066 0,
10067 "setTmLevel"},
10068
10069 {WE_SET_PHYMODE,
10070 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10071 0,
10072 "setphymode"},
10073
10074 {WE_SET_NSS,
10075 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10076 0,
10077 "nss"},
10078
10079 {WE_SET_LDPC,
10080 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10081 0,
10082 "ldpc"},
10083
10084 {WE_SET_TX_STBC,
10085 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10086 0,
10087 "tx_stbc"},
10088
10089 {WE_SET_RX_STBC,
10090 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10091 0,
10092 "rx_stbc"},
10093
10094 {WE_SET_SHORT_GI,
10095 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10096 0,
10097 "shortgi"},
10098
10099 {WE_SET_RTSCTS,
10100 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10101 0,
10102 "enablertscts"},
10103
10104 {WE_SET_CHWIDTH,
10105 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10106 0,
10107 "chwidth"},
10108
10109 {WE_SET_ANI_EN_DIS,
10110 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10111 0,
10112 "anienable"},
10113
10114 {WE_SET_ANI_POLL_PERIOD,
10115 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10116 0,
10117 "aniplen"},
10118
10119 {WE_SET_ANI_LISTEN_PERIOD,
10120 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10121 0,
10122 "anilislen"},
10123
10124 {WE_SET_ANI_OFDM_LEVEL,
10125 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10126 0,
10127 "aniofdmlvl"},
10128
10129 {WE_SET_ANI_CCK_LEVEL,
10130 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10131 0,
10132 "aniccklvl"},
10133
10134 {WE_SET_DYNAMIC_BW,
10135 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10136 0,
10137 "cwmenable"},
10138
10139 {WE_SET_CTS_CBW,
10140 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10141 0,
10142 "cts_cbw" },
10143
10144 {WE_SET_GTX_HT_MCS,
10145 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10146 0,
10147 "gtxHTMcs"},
10148
10149 {WE_SET_GTX_VHT_MCS,
10150 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10151 0,
10152 "gtxVHTMcs"},
10153
10154 {WE_SET_GTX_USRCFG,
10155 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10156 0,
10157 "gtxUsrCfg"},
10158
10159 {WE_SET_GTX_THRE,
10160 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10161 0,
10162 "gtxThre"},
10163
10164 {WE_SET_GTX_MARGIN,
10165 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10166 0,
10167 "gtxMargin"},
10168
10169 {WE_SET_GTX_STEP,
10170 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10171 0,
10172 "gtxStep"},
10173
10174 {WE_SET_GTX_MINTPC,
10175 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10176 0,
10177 "gtxMinTpc"},
10178
10179 {WE_SET_GTX_BWMASK,
10180 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10181 0,
10182 "gtxBWMask"},
10183
10184 {WE_SET_TX_CHAINMASK,
10185 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10186 0,
10187 "txchainmask"},
10188
10189 {WE_SET_RX_CHAINMASK,
10190 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10191 0,
10192 "rxchainmask"},
10193
10194 {WE_SET_11N_RATE,
10195 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10196 0,
10197 "set11NRates"},
10198
10199 {WE_SET_VHT_RATE,
10200 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10201 0,
10202 "set11ACRates"},
10203
10204 {WE_SET_AMPDU,
10205 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10206 0,
10207 "ampdu"},
10208
10209 {WE_SET_AMSDU,
10210 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10211 0,
10212 "amsdu"},
10213
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010214 {WE_SET_TXPOW_2G,
10215 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10216 0,
10217 "txpow2g"},
10218
10219 {WE_SET_TXPOW_5G,
10220 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10221 0,
10222 "txpow5g"},
10223
Wen Gong99768902018-04-25 12:07:49 +080010224#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010225 /* Sub-cmds DBGLOG specific commands */
10226 {WE_DBGLOG_LOG_LEVEL,
10227 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10228 0,
10229 "dl_loglevel"},
10230
10231 {WE_DBGLOG_VAP_ENABLE,
10232 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10233 0,
10234 "dl_vapon"},
10235
10236 {WE_DBGLOG_VAP_DISABLE,
10237 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10238 0,
10239 "dl_vapoff"},
10240
10241 {WE_DBGLOG_MODULE_ENABLE,
10242 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10243 0,
10244 "dl_modon"},
10245
10246 {WE_DBGLOG_MODULE_DISABLE,
10247 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10248 0,
10249 "dl_modoff"},
10250
10251 {WE_DBGLOG_MOD_LOG_LEVEL,
10252 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10253 0,
10254 "dl_mod_loglevel"},
10255
10256 {WE_DBGLOG_TYPE,
10257 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10258 0,
10259 "dl_type"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010260
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010261 {WE_DBGLOG_REPORT_ENABLE,
10262 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10263 0,
10264 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +080010265#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010266
10267 {WE_SET_TXRX_FWSTATS,
10268 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10269 0,
10270 "txrx_fw_stats"},
10271
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010272 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +080010273 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010274 0,
10275 "txrx_stats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010276#ifdef FW_THERMAL_THROTTLE_SUPPORT
10277 {WE_SET_THERMAL_THROTTLE_CFG,
10278 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10279 0,
10280 "set_thermal_cfg"},
10281#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Krishna Reddya50d09f2019-02-04 14:55:06 +053010282 {WE_SET_BTCOEX_MODE,
10283 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10284 0, "set_btc_mode" },
10285 {WE_SET_BTCOEX_RSSI_THRESHOLD,
10286 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10287 0, "set_btc_rssi" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010288 {WE_TXRX_FWSTATS_RESET,
10289 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10290 0,
10291 "txrx_fw_st_rst"},
10292
10293 {WE_PPS_PAID_MATCH,
10294 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10295 0, "paid_match"},
10296
10297 {WE_PPS_GID_MATCH,
10298 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10299 0, "gid_match"},
10300
10301 {WE_PPS_EARLY_TIM_CLEAR,
10302 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10303 0, "tim_clear"},
10304
10305 {WE_PPS_EARLY_DTIM_CLEAR,
10306 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10307 0, "dtim_clear"},
10308
10309 {WE_PPS_EOF_PAD_DELIM,
10310 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10311 0, "eof_delim"},
10312
10313 {WE_PPS_MACADDR_MISMATCH,
10314 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10315 0, "mac_match"},
10316
10317 {WE_PPS_DELIM_CRC_FAIL,
10318 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10319 0, "delim_fail"},
10320
10321 {WE_PPS_GID_NSTS_ZERO,
10322 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10323 0, "nsts_zero"},
10324
10325 {WE_PPS_RSSI_CHECK,
10326 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10327 0, "rssi_chk"},
10328
10329 {WE_PPS_5G_EBT,
10330 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10331 0, "5g_ebt"},
10332
10333 {WE_SET_HTSMPS,
10334 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10335 0, "htsmps"},
10336
10337 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
10338 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10339 0, "set_qpspollcnt"},
10340
10341 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
10342 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10343 0, "set_qtxwake"},
10344
10345 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10346 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10347 0, "set_qwakeintv"},
10348
10349 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10350 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10351 0, "set_qnodatapoll"},
10352
10353 /* handlers for MCC time quota and latency sub ioctls */
10354 {WE_MCC_CONFIG_LATENCY,
10355 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10356 0, "setMccLatency"},
10357
10358 {WE_MCC_CONFIG_QUOTA,
10359 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10360 0, "setMccQuota"},
10361
10362 {WE_SET_DEBUG_LOG,
10363 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10364 0, "setDbgLvl"},
10365
10366 /* handlers for early_rx power save */
10367 {WE_SET_EARLY_RX_ADJUST_ENABLE,
10368 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10369 0, "erx_enable"},
10370
10371 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
10372 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10373 0, "erx_bmiss_val"},
10374
10375 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
10376 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10377 0, "erx_bmiss_smpl"},
10378
10379 {WE_SET_EARLY_RX_SLOP_STEP,
10380 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10381 0, "erx_slop_step"},
10382
10383 {WE_SET_EARLY_RX_INIT_SLOP,
10384 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10385 0, "erx_init_slop"},
10386
10387 {WE_SET_EARLY_RX_ADJUST_PAUSE,
10388 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10389 0, "erx_adj_pause"},
10390
10391 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
10392 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10393 0, "erx_dri_sample"},
10394
10395 {WE_DUMP_STATS,
10396 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10397 0, "dumpStats"},
10398
10399 {WE_CLEAR_STATS,
10400 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10401 0, "clearStats"},
10402
Govind Singha471e5e2015-10-12 17:11:14 +053010403 {WE_START_FW_PROFILE,
10404 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10405 0, "startProfile"},
10406
Abhishek Singh1bdb1572015-10-16 16:24:19 +053010407 {WE_SET_CHANNEL,
10408 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10409 0, "setChanChange" },
10410
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +053010411 {WE_SET_CONC_SYSTEM_PREF,
10412 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10413 0, "setConcSysPref" },
10414
Jeff Johnson011c4502017-10-05 15:25:56 -070010415 {WE_SET_PDEV_RESET,
10416 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10417 0, "pdev_reset" },
10418
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010419 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -080010420 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10421 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010422
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010423 {WLAN_PRIV_SET_NONE_GET_INT,
10424 0,
10425 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10426 ""},
10427
10428 /* handlers for sub-ioctl */
10429 {WE_GET_11D_STATE,
10430 0,
10431 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10432 "get11Dstate"},
10433
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010434 {WE_GET_WLAN_DBG,
10435 0,
10436 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10437 "getwlandbg"},
10438
10439 {WE_GET_MAX_ASSOC,
10440 0,
10441 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10442 "getMaxAssoc"},
10443
10444 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010445 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10446 "getAutoChannel"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010447
10448 {WE_GET_CONCURRENCY_MODE,
10449 0,
10450 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10451 "getconcurrency"},
10452
10453 {WE_GET_NSS,
10454 0,
10455 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10456 "get_nss"},
10457
10458 {WE_GET_LDPC,
10459 0,
10460 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10461 "get_ldpc"},
10462
10463 {WE_GET_TX_STBC,
10464 0,
10465 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10466 "get_tx_stbc"},
10467
10468 {WE_GET_RX_STBC,
10469 0,
10470 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10471 "get_rx_stbc"},
10472
10473 {WE_GET_SHORT_GI,
10474 0,
10475 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10476 "get_shortgi"},
10477
10478 {WE_GET_RTSCTS,
10479 0,
10480 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10481 "get_rtscts"},
10482
10483 {WE_GET_CHWIDTH,
10484 0,
10485 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10486 "get_chwidth"},
10487
10488 {WE_GET_ANI_EN_DIS,
10489 0,
10490 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10491 "get_anienable"},
10492
10493 {WE_GET_ANI_POLL_PERIOD,
10494 0,
10495 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10496 "get_aniplen"},
10497
10498 {WE_GET_ANI_LISTEN_PERIOD,
10499 0,
10500 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10501 "get_anilislen"},
10502
10503 {WE_GET_ANI_OFDM_LEVEL,
10504 0,
10505 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10506 "get_aniofdmlvl"},
10507
10508 {WE_GET_ANI_CCK_LEVEL,
10509 0,
10510 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10511 "get_aniccklvl"},
10512
10513 {WE_GET_DYNAMIC_BW,
10514 0,
10515 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10516 "get_cwmenable"},
10517
10518 {WE_GET_GTX_HT_MCS,
10519 0,
10520 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10521 "get_gtxHTMcs"},
10522
10523 {WE_GET_GTX_VHT_MCS,
10524 0,
10525 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10526 "get_gtxVHTMcs"},
10527
10528 {WE_GET_GTX_USRCFG,
10529 0,
10530 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10531 "get_gtxUsrCfg"},
10532
10533 {WE_GET_GTX_THRE,
10534 0,
10535 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10536 "get_gtxThre"},
10537
10538 {WE_GET_GTX_MARGIN,
10539 0,
10540 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10541 "get_gtxMargin"},
10542
10543 {WE_GET_GTX_STEP,
10544 0,
10545 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10546 "get_gtxStep"},
10547
10548 {WE_GET_GTX_MINTPC,
10549 0,
10550 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10551 "get_gtxMinTpc"},
10552
10553 {WE_GET_GTX_BWMASK,
10554 0,
10555 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10556 "get_gtxBWMask"},
10557
10558 {WE_GET_TX_CHAINMASK,
10559 0,
10560 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10561 "get_txchainmask"},
10562
10563 {WE_GET_RX_CHAINMASK,
10564 0,
10565 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10566 "get_rxchainmask"},
10567
10568 {WE_GET_11N_RATE,
10569 0,
10570 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10571 "get_11nrate"},
10572
10573 {WE_GET_AMPDU,
10574 0,
10575 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10576 "get_ampdu"},
10577
10578 {WE_GET_AMSDU,
10579 0,
10580 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10581 "get_amsdu"},
10582
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010583 {WE_GET_TXPOW_2G,
10584 0,
10585 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10586 "get_txpow2g"},
10587
10588 {WE_GET_TXPOW_5G,
10589 0,
10590 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10591 "get_txpow5g"},
10592
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010593 {WE_GET_PPS_PAID_MATCH,
10594 0,
10595 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10596 "get_paid_match"},
10597
10598 {WE_GET_PPS_GID_MATCH,
10599 0,
10600 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10601 "get_gid_match"},
10602
10603 {WE_GET_PPS_EARLY_TIM_CLEAR,
10604 0,
10605 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10606 "get_tim_clear"},
10607
10608 {WE_GET_PPS_EARLY_DTIM_CLEAR,
10609 0,
10610 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10611 "get_dtim_clear"},
10612
10613 {WE_GET_PPS_EOF_PAD_DELIM,
10614 0,
10615 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10616 "get_eof_delim"},
10617
10618 {WE_GET_PPS_MACADDR_MISMATCH,
10619 0,
10620 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10621 "get_mac_match"},
10622
10623 {WE_GET_PPS_DELIM_CRC_FAIL,
10624 0,
10625 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10626 "get_delim_fail"},
10627
10628 {WE_GET_PPS_GID_NSTS_ZERO,
10629 0,
10630 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10631 "get_nsts_zero"},
10632
10633 {WE_GET_PPS_RSSI_CHECK,
10634 0,
10635 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10636 "get_rssi_chk"},
10637
10638 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
10639 0,
10640 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10641 "get_qpspollcnt"},
10642
10643 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
10644 0,
10645 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10646 "get_qtxwake"},
10647
10648 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10649 0,
10650 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10651 "get_qwakeintv"},
10652
10653 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10654 0,
10655 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10656 "get_qnodatapoll"},
10657
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010658 {WE_CAP_TSF,
10659 0,
10660 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10661 "cap_tsf"},
10662
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010663 {WE_GET_TEMPERATURE,
10664 0,
10665 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10666 "get_temp"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010667
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010668 {WE_GET_DCM,
10669 0,
10670 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10671 "get_dcm"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010672
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010673 {WE_GET_RANGE_EXT,
10674 0,
10675 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10676 "get_range_ext"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010677
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010678 /* handlers for main ioctl */
10679 {WLAN_PRIV_SET_CHAR_GET_NONE,
10680 IW_PRIV_TYPE_CHAR | 512,
10681 0,
10682 ""},
10683
10684 /* handlers for sub-ioctl */
10685 {WE_WOWL_ADD_PTRN,
10686 IW_PRIV_TYPE_CHAR | 512,
10687 0,
10688 "wowlAddPtrn"},
10689
10690 {WE_WOWL_DEL_PTRN,
10691 IW_PRIV_TYPE_CHAR | 512,
10692 0,
10693 "wowlDelPtrn"},
10694
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010695 /* handlers for sub-ioctl */
10696 {WE_NEIGHBOR_REPORT_REQUEST,
10697 IW_PRIV_TYPE_CHAR | 512,
10698 0,
10699 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080010700
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010701 {WE_SET_AP_WPS_IE,
10702 IW_PRIV_TYPE_CHAR | 512,
10703 0,
10704 "set_ap_wps_ie"},
10705
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070010706#ifdef WLAN_UNIT_TEST
10707 {WE_UNIT_TEST,
10708 IW_PRIV_TYPE_CHAR | 512,
10709 0,
10710 "unit_test"},
10711#endif
10712
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010713 /* handlers for main ioctl */
10714 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
10715 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10716 0,
10717 ""},
10718
10719 /* handlers for sub-ioctl */
10720 {WE_SET_WLAN_DBG,
10721 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10722 0,
10723 "setwlandbg"},
10724
Nirav Shahd21a2e32018-04-20 16:34:43 +053010725#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010726 /* handlers for sub-ioctl */
10727 {WE_SET_DP_TRACE,
10728 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10729 0,
10730 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010731#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010732
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053010733 {WE_SET_FW_TEST,
10734 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10735 0, "fw_test"},
10736
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010737 /* handlers for main ioctl */
10738 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
10739 0,
10740 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010741 ""},
10742
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010743 {WE_GET_TSF,
10744 0,
10745 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010746 "get_tsf"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010747
10748 {WE_SET_DUAL_MAC_SCAN_CONFIG,
10749 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10750 0,
10751 "set_scan_cfg"},
10752
10753 /* handlers for main ioctl */
10754 {WLAN_PRIV_GET_CHAR_SET_NONE,
10755 0,
10756 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10757 ""},
10758
10759 /* handlers for sub-ioctl */
10760 {WE_WLAN_VERSION,
10761 0,
10762 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10763 "version"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010764
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010765 {WE_GET_STATS,
10766 0,
10767 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10768 "getStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010769
Dustin Brownd9322482017-01-09 12:46:03 -080010770 {WE_GET_SUSPEND_RESUME_STATS,
10771 0,
10772 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10773 "getSuspendStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010774
Govind Singha471e5e2015-10-12 17:11:14 +053010775 {WE_LIST_FW_PROFILE,
10776 0,
10777 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10778 "listProfile"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010779
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010780 {WE_GET_STATES,
10781 0,
10782 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10783 "getHostStates"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010784
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010785 {WE_GET_CFG,
10786 0,
10787 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10788 "getConfig"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010789
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010790 {WE_GET_RSSI,
10791 0,
10792 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10793 "getRSSI"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010794
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010795 {WE_GET_WMM_STATUS,
10796 0,
10797 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10798 "getWmmStatus"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010799
10800 {WE_GET_CHANNEL_LIST,
10801 0,
10802 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10803 "getChannelList"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010804#ifdef FEATURE_WLAN_TDLS
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010805 {WE_GET_TDLS_PEERS,
10806 0,
10807 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10808 "getTdlsPeers"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010809#endif
10810#ifdef WLAN_FEATURE_11W
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010811 {WE_GET_11W_INFO,
10812 0,
10813 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10814 "getPMFInfo"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010815#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010816 {WE_GET_STA_CXN_INFO,
10817 0,
10818 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10819 "get_cxn_info" },
Krunal Soni5e483782018-10-25 15:42:44 -070010820
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010821 {WE_GET_IBSS_STA_INFO,
10822 0,
10823 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10824 "getIbssSTAs"},
10825
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010826 {WE_GET_PHYMODE,
10827 0,
10828 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10829 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010830#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010831 {WE_GET_OEM_DATA_CAP,
10832 0,
10833 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10834 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010835#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010836 {WE_GET_SNR,
10837 0,
10838 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10839 "getSNR"},
10840
Krunal Soni6c3859f2018-06-01 19:57:40 -070010841 {WE_GET_BA_AGEING_TIMEOUT,
10842 0,
10843 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10844 "get_ba_timeout"},
10845
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010846 /* handlers for main ioctl */
10847 {WLAN_PRIV_SET_NONE_GET_NONE,
10848 0,
10849 0,
10850 ""},
10851
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010852 /* handlers for sub-ioctl */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010853 {WE_IBSS_GET_PEER_INFO_ALL,
10854 0,
10855 0,
10856 "ibssPeerInfoAll"},
10857
Govind Singha471e5e2015-10-12 17:11:14 +053010858 {WE_GET_FW_PROFILE_DATA,
10859 0,
10860 0,
10861 "getProfileData"},
10862
10863 {WE_SET_REASSOC_TRIGGER,
10864 0,
10865 0,
10866 "reassoc"},
10867
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010868 {WE_STOP_OBSS_SCAN,
10869 0,
10870 0,
10871 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010872 /* handlers for main ioctl */
10873 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
10874 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10875 0,
10876 ""},
10877
10878 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010879 {WE_IBSS_GET_PEER_INFO,
10880 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10881 0,
10882 "ibssPeerInfo"},
10883
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010884#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010885 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010886 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
10887 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10888 0,
10889 "setdumplog"},
10890
10891 {WE_MTRACE_DUMP_CMD,
10892 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10893 0,
10894 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010895#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -080010896
10897 {WE_POLICY_MANAGER_CINFO_CMD,
10898 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10899 0,
10900 "pm_cinfo"},
10901
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010902#ifdef MPC_UT_FRAMEWORK
10903 {WE_POLICY_MANAGER_CLIST_CMD,
10904 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10905 0,
10906 "pm_clist"},
10907
10908 {WE_POLICY_MANAGER_DLIST_CMD,
10909 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10910 0,
10911 "pm_dlist"},
10912
10913 {WE_POLICY_MANAGER_DBS_CMD,
10914 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10915 0,
10916 "pm_dbs"},
10917
10918 {WE_POLICY_MANAGER_PCL_CMD,
10919 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10920 0,
10921 "pm_pcl"},
10922
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010923 {WE_POLICY_MANAGER_ULIST_CMD,
10924 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10925 0,
10926 "pm_ulist"},
10927
10928 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
10929 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10930 0,
10931 "pm_query_action"},
10932
10933 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
10934 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10935 0,
10936 "pm_query_allow"},
10937
10938 {WE_POLICY_MANAGER_SCENARIO_CMD,
10939 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10940 0,
10941 "pm_run_scenario"},
10942
10943 {WE_POLICY_SET_HW_MODE_CMD,
10944 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10945 0,
10946 "pm_set_hw_mode"},
10947#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010948 {WE_UNIT_TEST_CMD,
10949 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10950 0,
10951 "setUnitTestCmd"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010952
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010953 {WE_MAC_PWR_DEBUG_CMD,
10954 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10955 0,
10956 "halPwrDebug"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010957#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10958 {WE_LED_FLASHING_PARAM,
10959 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10960 0,
10961 "gpio_control"},
10962#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010963#ifdef WLAN_DEBUG
10964 {WE_SET_CHAN_AVOID,
10965 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10966 0,
10967 "ch_avoid"},
10968#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010969 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010970 {WLAN_PRIV_FIPS_TEST,
10971 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10972 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10973 "fips_test"},
10974
10975 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010976 {WLAN_PRIV_ADD_TSPEC,
10977 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10978 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10979 "addTspec"},
10980
10981 /* handlers for main ioctl */
10982 {WLAN_PRIV_DEL_TSPEC,
10983 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10984 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10985 "delTspec"},
10986
10987 /* handlers for main ioctl */
10988 {WLAN_PRIV_GET_TSPEC,
10989 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10990 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10991 "getTspec"},
10992
10993 /* handlers for main ioctl - host offload */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010994 {WLAN_PRIV_SET_HOST_OFFLOAD,
10995 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
10996 0,
10997 "setHostOffload"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010998
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010999 {WLAN_GET_WLAN_STATISTICS,
11000 0,
11001 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
11002 "getWlanStats"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011003
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011004 {WLAN_SET_KEEPALIVE_PARAMS,
Jeff Johnson562ccad2019-02-06 22:10:24 -080011005 IW_PRIV_TYPE_BYTE | sizeof(struct keep_alive_req) |
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011006 IW_PRIV_SIZE_FIXED,
11007 0,
11008 "setKeepAlive"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011009#ifdef WLAN_FEATURE_PACKET_FILTERING
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011010 {WLAN_SET_PACKET_FILTER_PARAMS,
11011 IW_PRIV_TYPE_BYTE |
11012 sizeof(struct pkt_filter_cfg),
11013 0,
11014 "setPktFilter"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011015#endif
11016#ifdef FEATURE_WLAN_SCAN_PNO
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011017 {WLAN_SET_PNO,
11018 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
11019 0,
11020 "setpno"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011021#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011022 {WLAN_SET_BAND_CONFIG,
11023 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11024 0,
11025 "SETBAND"},
Dustin Brown0cbc7572016-12-16 13:54:40 -080011026
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011027 {WLAN_PRIV_SET_MCBC_FILTER,
11028 0,
11029 0,
11030 "setMCBCFilter"},
11031
11032 {WLAN_GET_LINK_SPEED,
11033 IW_PRIV_TYPE_CHAR | 18,
11034 IW_PRIV_TYPE_CHAR | 5,
11035 "getLinkSpeed"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011036
Krunal Sonif9ba53d2019-01-03 21:44:41 -080011037#ifdef FEATURE_WLM_STATS
11038 {WLAN_GET_WLM_STATS,
11039 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
11040 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
11041 "get_wlm_stats"},
11042#endif
11043
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011044 /* handlers for main ioctl */
11045 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
11046 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
11047 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011048 ""},
11049
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011050 {WE_SET_SMPS_PARAM,
11051 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011052 0, "set_smps_param"},
11053
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011054 {WLAN_SET_DOT11P_CHANNEL_SCHED,
11055 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011056 0, "set_dot11p" },
11057
Jeff Johnsondf5d7792018-04-14 15:58:24 -070011058#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011059 {WE_SET_FW_CRASH_INJECT,
11060 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011061 0, "crash_inject"},
11062
Jeff Johnsondf5d7792018-04-14 15:58:24 -070011063#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053011064#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070011065 {WE_LOG_BUFFER,
11066 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011067 0, "log_buffer"},
11068
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011069#endif
Krunal Soni6c3859f2018-06-01 19:57:40 -070011070 {WE_SET_BA_AGEING_TIMEOUT,
11071 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011072 0, "set_ba_timeout"},
11073
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011074#ifdef WLAN_SUSPEND_RESUME_TEST
11075 {WE_SET_WLAN_SUSPEND,
11076 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011077 0, "wlan_suspend"},
11078
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011079 {WE_SET_WLAN_RESUME,
11080 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011081 0, "wlan_resume"},
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011082#endif
Govind Singha471e5e2015-10-12 17:11:14 +053011083 {WE_ENABLE_FW_PROFILE,
11084 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011085 0, "enableProfile"},
11086
Govind Singha471e5e2015-10-12 17:11:14 +053011087 {WE_SET_FW_PROFILE_HIST_INTVL,
11088 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011089 0, "set_hist_intvl"},
11090
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011091 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
11092 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011093 0, "set_fw_mode_cfg"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053011094#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011095 {WE_DUMP_DP_TRACE_LEVEL,
11096 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011097 0, "dump_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053011098#endif
Nirav Shah73713f72018-05-17 14:50:41 +053011099#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011100 {WE_SET_MON_MODE_CHAN,
11101 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011102 0, "setMonChan"},
Nirav Shah73713f72018-05-17 14:50:41 +053011103#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070011104 {WE_GET_ROAM_SYNCH_DELAY,
11105 0,
11106 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011107 "hostroamdelay"},
11108
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080011109 {WE_SET_11AX_RATE,
11110 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11111 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011112 "set_11ax_rate"},
11113
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070011114 {WE_SET_DCM,
11115 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11116 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011117 "enable_dcm"},
11118
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070011119 {WE_SET_RANGE_EXT,
11120 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11121 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011122 "range_ext"},
11123
Naveen Rawatc921c7b2017-06-13 17:29:51 -070011124 {WLAN_PRIV_SET_FTIES,
11125 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
11126 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011127 "set_ft_ies"},
11128
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011129#ifdef WLAN_FEATURE_MOTION_DETECTION
11130 {WE_MOTION_DET_START_STOP,
11131 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11132 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011133 "mt_start"},
11134
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011135 {WE_MOTION_DET_BASE_LINE_START_STOP,
11136 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11137 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011138 "mt_bl_start"},
11139
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011140 {WE_MOTION_DET_CONFIG_PARAM,
11141 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
11142 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011143 "mt_config"},
11144
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011145 {WE_MOTION_DET_BASE_LINE_CONFIG_PARAM,
11146 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
11147 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011148 "mt_bl_config"},
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011149#endif /* WLAN_FEATURE_MOTION_DETECTION */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011150};
11151
11152const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070011153 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053011154 .num_private = QDF_ARRAY_SIZE(we_private),
11155 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011156
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070011157 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011158 .private = (iw_handler *) we_private,
11159 .private_args = we_private_args,
11160 .get_wireless_stats = NULL,
11161};
11162
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011163void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011164{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011165 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011166
Dustin Browne7e71d32018-05-11 16:00:08 -070011167 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011168
Dustin Browne74003f2018-03-14 12:51:58 -070011169 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011170}
11171
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011172void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011173{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011174 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011175
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011176 rtnl_lock();
11177 dev->wireless_handlers = NULL;
11178 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011179
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011180 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011181}