blob: 6c746e0983800f899da8e3507adf3071e129ff9b [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05302 * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
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>
31#include <wlan_hdd_includes.h>
32#include <cds_api.h>
Rajeev Kumarea95edd2017-01-11 20:49:36 -080033#include "scheduler_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080034#include <net/arp.h>
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080035#include <cdp_txrx_cmn.h>
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070036#include <cdp_txrx_stats.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080037#include "sir_params.h"
38#include "csr_api.h"
39#include "csr_inside_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080040#include "sme_rrm_internal.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080041#include <ani_global.h>
42#include "dot11f.h"
43#include <wlan_hdd_wowl.h>
44#include <wlan_hdd_cfg.h>
45#include <wlan_hdd_wmm.h>
46#include "utils_api.h"
47#include "wlan_hdd_p2p.h"
48#ifdef FEATURE_WLAN_TDLS
49#include "wlan_hdd_tdls.h"
50#endif
51
52#include "cds_ieee80211_common.h"
53#include "ol_if_athvar.h"
54#include "dbglog_host.h"
55#include "wma.h"
56
57#include "wlan_hdd_power.h"
58#include "qwlan_version.h"
59#include "wlan_hdd_host_offload.h"
60
61#include <linux/wireless.h>
62#include <net/cfg80211.h>
63
64#include "wlan_hdd_misc.h"
65
66#include "qc_sap_ioctl.h"
67#include "sme_api.h"
68#include "wma_types.h"
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070069#include "qdf_str.h"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053070#include "qdf_trace.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080071#include "wlan_hdd_assoc.h"
72#include "wlan_hdd_ioctl.h"
73#include "wlan_hdd_scan.h"
74#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080075#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080076#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070077#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070078#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079#include "wlan_hdd_ocb.h"
80#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080081#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070082#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053083#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070084#ifdef WLAN_SUSPEND_RESUME_TEST
85#include "wlan_hdd_driver_ops.h"
86#include "hif.h"
Rajeev Kumar9bb2e852016-09-24 12:29:25 -070087#include "pld_common.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070088#endif
Dhanashri Atree7d442a2016-07-14 18:20:29 -070089#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053090#include "cds_utils.h"
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -070091#include "wlan_osif_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080092#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080093#include <cdp_txrx_stats.h>
94#include <cds_api.h>
Dustin Brown6099ddc2018-07-06 14:32:53 -070095#include "wlan_dsc_test.h"
Abhishek Singh0481d662017-04-11 18:20:11 +053096#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070097#include "wlan_hdd_regulatory.h"
98#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +053099#include "wlan_hdd_packet_filter_api.h"
Naveen Rawat3ff5cff2018-01-29 14:31:16 -0800100#include "wlan_cp_stats_mc_ucfg_api.h"
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +0530101#include "wlan_mlme_ucfg_api.h"
102#include "wlan_mlme_public_struct.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530103
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800104#define HDD_FINISH_ULA_TIME_OUT 800
105#define HDD_SET_MCBC_FILTERS_TO_FW 1
106#define HDD_DELETE_MCBC_FILTERS_FROM_FW 0
107
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800108/* Private ioctls and their sub-ioctls */
109#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
110#define WE_SET_11D_STATE 1
111#define WE_WOWL 2
112#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530113/*
114 * <ioctl>
115 * setMaxAssoc - Sets the maximum number of associated stations
116 *
117 * @INPUT: 1 to 32
118 *
119 * @OUTPUT: None
120 *
121 * This IOTCL sets the maximum number of associated stations
122 *
123 * @E.g: iwpriv wlan0 setMaxAssoc <value>
124 *
125 * Supported Feature: STA
126 *
127 * Usage: Internal/External
128 *
129 * </ioctl>
130 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800131#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530132/*
133 * <ioctl>
Jeff Johnsonf2cf6592018-05-06 16:27:44 -0700134 * scan_disable - Disable scan
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530135 *
136 * @INPUT: set_value
137 *
138 * @OUTPUT: None
139 *
140 * This IOCTL is used to set disable scan
141 *
142 * @E.g: iwpriv wlan0 scan_disable 1
143 *
144 * Supported Feature: Scan
145 *
146 * Usage: Internal/External
147 *
148 * </ioctl>
149 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800150#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530151/*
152 * <ioctl>
153 * inactivityTO - sets the timeout value for inactivity data while
154 * in power save mode
155 *
156 * @INPUT: int1…..int255
157 *
158 * @OUTPUT: None
159 *
160 * This IOCTL set the timeout value for inactivity data in power save mode
161 *
162 * @E.g: iwpriv wlan0 inactivityTO 20
163 *
164 * Supported Feature: STA
165 *
166 * Usage: Internal/External
167 *
168 * </ioctl>
169 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800170#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530171/*
172 * <ioctl>
173 * setMaxTxPower - Dynamically sets the maximum transmission power
174 *
175 * @INPUT: Transmission power in dBm
176 *
177 * @OUTPUT: None
178 *
179 * This IOCTL dynamically sets the maximum transmission power
180 * This setting does not persist over reboots
181 *
182 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
183 *
184 * Supported Feature: STA
185 *
186 * Usage: Internal/External
187 *
188 * </ioctl>
189 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800190#define WE_SET_MAX_TX_POWER 7
Jeff Johnsonfab9b252017-10-28 15:44:34 -0700191/* 8 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800192#define WE_SET_TM_LEVEL 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530193/*
194 * <ioctl>
195 * setphymode - Set the phymode dynamically
196 *
197 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
198 *
199 * @OUTPUT: None
200 *
201 * This IOCTL sets the phymode dynamically
202 *
203 * @E.g: iwpriv wlan0 setphymode 10
204 *
205 * Supported Feature: STA
206 *
207 * Usage: Internal/External
208 *
209 * </ioctl>
210 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800211#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530212/*
213 * <ioctl>
214 * nss - Set the number of spatial streams
215 *
216 * @INPUT: int1…..int3
217 *
218 * @OUTPUT: None
219 *
220 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
221 *
222 * @E.g: iwpriv wlan0 nss 2
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_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530231/*
232 * <ioctl>
233 * ldpc - Enables or disables LDPC
234 *
235 * @INPUT: 0 – Disable, 1 - Enable
236 *
237 * @OUTPUT: None
238 *
239 * This IOCTL enables or disables LDPC
240 *
241 * @E.g: iwpriv wlan0 ldpc 1
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_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530250/*
251 * <ioctl>
252 * tx_stbc - Enables or disables tx_stbc
253 *
254 * @INPUT: Int 0 – Disable, 1 - Enable
255 *
256 * @OUTPUT: None
257 *
258 * This IOTCL used to enables or disables tx_stbc
259 *
260 * @E.g: iwpriv wlan0 tx_stbc <value>
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_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530269/*
270 * <ioctl>
271 * rx_stbc - Set the rx_stbc parameter
272 *
273 * @INPUT: Int 0 – Disable, 1 - Enable
274 *
275 * @OUTPUT: None
276 *
277 * This IOTCL used to set rx_stbc parameter
278 *
279 * @E.g: iwpriv wlan0 rx_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_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530288/*
289 * <ioctl>
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800290 * shortgi - Sets the short-guard interval
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530291 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800292 * @INPUT: Fixed Rate: 0 - 400ns, 1 - 800ns, 2 - 1600ns, 3 - 3200us
293 * Auto Rate: 8 - 400ns, 9 - 800ns, 10 - 1600ns, 11 - 3200us
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530294 *
295 * @OUTPUT: None
296 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800297 * This IOCTL sets the short-guard interval.
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530298 *
299 * @E.g: iwpriv wlan0 shortgi <value>
300 *
301 * Supported Feature: STA
302 *
303 * Usage: Internal/External
304 *
305 * </ioctl>
306 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800307#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530308/*
309 * <ioctl>
310 * enablertscts - enables or disables rts/cts.
311 *
312 * @INPUT: 1-Enable , 0-Disable
313 *
314 * @OUTPUT: None
315 *
316 * This IOCTL enables or disables rts/cts.
317 *
318 * @E.g: iwpriv wlan0 enablertscts <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_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530327/*
328 * <ioctl>
329 * chwidth - Set the channel bandwidth
330 *
331 * @INPUT: 0-20mhz to 3-160mhz
332 *
333 * @OUTPUT: None
334 *
335 * This IOTCL used to set the channel bandwidth
336 *
337 * @E.g: iwpriv wlan0 chwidth 1
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_CHWIDTH 17
346#define WE_SET_ANI_EN_DIS 18
347#define WE_SET_ANI_POLL_PERIOD 19
348#define WE_SET_ANI_LISTEN_PERIOD 20
349#define WE_SET_ANI_OFDM_LEVEL 21
350#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530351/*
352 * <ioctl>
353 * cwmenable - Enables or disables the dynamic channel bandwidth
354 *
355 * @INPUT: 0-Disable, 1-Enable
356 *
357 * @OUTPUT: None
358 *
359 * This IOTCL used to enables or disables the dynamic channel bandwidth
360 *
361 * @E.g: iwpriv wlan0 cwmenable <value>
362 *
363 * Supported Feature: STA
364 *
365 * Usage: Internal/External
366 *
367 * </ioctl>
368 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800369#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530370/*
371 * <ioctl>
372 * txchainmask - This IOCTL sets the current Tx chain mask
373 *
374 * @INPUT: Mask Value
375 *
376 * @OUTPUT: None
377 *
378 * This IOCTL sets the current Tx chain mask
379 *
380 * @E.g: iwpriv wlan0 txchainmask 1
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_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530389/*
390 * <ioctl>
391 * rxchainmask - Sets the current Rx chain mask
392 *
393 * @INPUT: Mask Value
394 *
395 * @OUTPUT: None
396 *
397 * This IOCTL sets the current Rx chain mask. This command is the
398 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
399 *
400 * @E.g: iwpriv wlan0 rxchainmask <value>
401 *
402 * Supported Feature: STA
403 *
404 * Usage: Internal/External
405 *
406 * </ioctl>
407 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800408#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530409/*
410 * <ioctl>
411 * set11NRates - Fixes the Tx data rate of the 11N mode.
412 *
413 * @INPUT: 0x1b to 0x8f
414 *
415 * @OUTPUT: None
416 *
417 * This IOCTL fixes the Tx data rate of the 11N mode.
418 *
419 * @E.g: iwpriv wlan0 set11NRates 0x85
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_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530428/*
429 * <ioctl>
430 * ampdu - Set the the maximum subframe of ampdu
431 *
432 * @INPUT: int 1 to int 63
433 *
434 * @OUTPUT: None
435 *
436 * This IOCTL sets the maximum subframe of ampdu.
437 *
438 * @E.g: iwpriv wlan0 ampdu 9
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_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530447/*
448 * <ioctl>
449 * amsdu - Sets the maximum subframe of amsdu.
450 *
451 * @INPUT: int 1 to int 31
452 *
453 * @OUTPUT: None
454 *
455 * This IOCTL sets the maximum subframe of amsdu.
456 *
457 * @E.g: iwpriv wlan0 amsdu 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_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530466/*
467 * <ioctl>
468 * txpow2g - current 2 GHz Tx power setting
469 *
470 * @INPUT: Tx power in dBm
471 *
472 * @OUTPUT: None
473 *
474 * This IOTCL used to set 2 ghz tx power
475 *
476 * @E.g: iwpriv wlan0 txpow2g
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_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530485/*
486 * <ioctl>
487 * txpow5g - Current 5 GHz tx power setting
488 *
489 * @INPUT: Tx power in dBm
490 *
491 * @OUTPUT: None
492 *
493 * This IOTCL used to set the 5 ghz txpower
494 *
495 * @E.g: iwpriv wlan0 txpow5g
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_5G 30
504/* Private ioctl for firmware debug log */
505#define WE_DBGLOG_LOG_LEVEL 31
506#define WE_DBGLOG_VAP_ENABLE 32
507#define WE_DBGLOG_VAP_DISABLE 33
508#define WE_DBGLOG_MODULE_ENABLE 34
509#define WE_DBGLOG_MODULE_DISABLE 35
510#define WE_DBGLOG_MOD_LOG_LEVEL 36
511#define WE_DBGLOG_TYPE 37
512#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530513/*
514 * <ioctl>
515 * set11ACRates - Fixes the Tx data rate of 11AC
516 *
517 * @INPUT: 0x1 to 0x9
518 *
519 * @OUTPUT: None
520 *
521 * This IOCTL fixes the Tx data rate of 11AC.
522 *
523 * @E.g: iwpriv wlan0 set11ACRates 0x9
524 *
525 * Supported Feature: STA
526 *
527 * Usage: Internal/External
528 *
529 * </ioctl>
530 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800531#define WE_SET_VHT_RATE 39
532#define WE_DBGLOG_REPORT_ENABLE 40
533#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530534/*
535 * <ioctl>
536 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
537 *
538 * @INPUT: Transmission power in dBm
539 *
540 * @OUTPUT: None
541 *
542 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
543 * This setting does not persist over reboots
544 *
545 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
546 *
547 * Supported Feature: STA
548 *
549 * Usage: Internal/External
550 *
551 * </ioctl>
552 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800553#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530554/*
555 * <ioctl>
556 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
557 *
558 * @INPUT: Transmission power in dBm
559 *
560 * @OUTPUT: None
561 *
562 * This IOCTL sets the maximum transmit power for the 5-GHz band
563 * This setting does not persist over reboots
564 *
565 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
566 *
567 * Supported Feature: STA
568 *
569 * Usage: Internal/External
570 *
571 * </ioctl>
572 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800573#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800574#define WE_SET_PKTLOG 44
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530575/* Private ioctl for packet power save */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800576#define WE_PPS_PAID_MATCH 45
577#define WE_PPS_GID_MATCH 46
578#define WE_PPS_EARLY_TIM_CLEAR 47
579#define WE_PPS_EARLY_DTIM_CLEAR 48
580#define WE_PPS_EOF_PAD_DELIM 49
581#define WE_PPS_MACADDR_MISMATCH 50
582#define WE_PPS_DELIM_CRC_FAIL 51
583#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530584/*
585 * <ioctl>
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530586 * rssi_chk - Check the rssi
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530587 *
588 * @INPUT: One argument as input
589 *
590 * @OUTPUT: rssi
591 * wlan0 rssi_chk:56
592 *
593 * This IOTCL used to chek rssi
594 *
595 * @E.g: iwpriv wlan0 rssi_chk <value>
596 *
597 * Supported Feature: STA
598 *
599 * Usage: Internal/External
600 *
601 * </ioctl>
602 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800603#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530604/*
605 * <ioctl>
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530606 * htsmps - Sets the htsmps
607 *
608 * @INPUT: Atleast one int argument
609 *
610 * @OUTPUT: None
611 *
612 * This IOTCL used to set htsmps
613 *
614 * @E.g: iwpriv wlan0 htsmps <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_SET_HTSMPS 55
623/* Private ioctl for QPower */
624#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
625#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
626#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
627#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800628/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530629/*
630 * <ioctl>
631 * gtxHTMcs - Set the tx HTM value
632 *
633 * @INPUT: Atleast one int orgument
634 *
635 * @OUTPUT: None
636 *
637 * This IOTCL sets htm tx value
638 *
639 * @E.g: iwpriv wlan0 gtxHTMcs <value>
640 *
641 * Supported Feature: STA
642 *
643 * Usage: Internal/External
644 *
645 * </ioctl>
646 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800647#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530648/*
649 * <ioctl>
650 * gtxVHTMcs - Set gtxVHTMcs value
651 *
652 * @INPUT: Atleast one int argument
653 *
654 * @OUTPUT: None
655 *
656 * This IOTCL used to set gtxVHTMcs value
657 *
658 * @E.g: iwpriv wlan0 gtxVHTMcs <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_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530667/*
668 * <ioctl>
669 * gtxUsrCfg - Host request for GTX mask
670 *
671 * @INPUT: Atleast one int orgument
672 *
673 * @OUTPUT: None
674 *
675 * This IOTCL used send the host request for GTX mask
676 *
677 * @E.g: iwpriv wlan0 gtxUsrCfg <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_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530686/*
687 * <ioctl>
688 * gtxThre - Set the tx threshold
689 *
690 * @INPUT: Atleast one int argument
691 *
692 * @OUTPUT: None
693 *
694 * This IOTCL used to set tx threshold
695 *
696 * @E.g: iwpriv wlan0 gtxThre <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_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530705/*
706 * <ioctl>
707 * gtxMargin - Set the gtxMargin
708 *
709 * @INPUT: 1 to 32
710 *
711 * @OUTPUT: None
712 *
713 * This IOTCL use dto set gtxMargin
714 *
715 * @E.g: iwpriv wlan0 gtxMargini <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_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530724/*
725 * <ioctl>
726 * gtxStep - Set the gtxStep
727 *
728 * @INPUT: None
729 *
730 * @OUTPUT: None
731 *
732 * This IOTCL used to sets gtxStep
733 *
734 * @E.g: iwpriv wlan0 gtxStep <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_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530743/*
744 * <ioctl>
745 * gtxMinTpc - Sets the gtxMinTpc
746 *
747 * @INPUT: Atleast one int argument
748 *
749 * @OUTPUT: None
750 *
751 * This IOTCL sets the tx MinTpc
752 *
753 * @E.g: iwpriv wlan0 gtxMinTpc <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_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530762/*
763 * <ioctl>
764 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
765 *
766 * @INPUT: Mask value
767 *
768 * @OUTPUT: None
769 *
770 * This IOTCL used to set gtxBWMask
771 *
772 * @E.g: iwpriv wlan0 gtxBWMask <value>
773 *
774 * Supported Feature: STA
775 *
776 * Usage: Internal/External
777 *
778 * </ioctl>
779 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530780
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530781#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530782/*
783 * <ioctl>
784 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
785 *
786 * @INPUT: set_value
787 *
788 * @OUTPUT: None
789 *
790 * This IOCTL is used to set the MCC latency value in milliseconds
791 * during STA-P2P concurrency.
792 *
793 * If 0ms latency is provided, then FW will set to a default.
794 * Otherwise, latency must be at least 30ms.
795 *
796 * @E.g: iwpriv wlan0 setMccLatency 40
797 *
798 *
799 * Supported Feature: Concurrency
800 *
801 * Usage: Internal/External
802 *
803 * </ioctl>
804 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800805#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530806
807/*
808 * <ioctl>
809 * setMccQuota- Set the quota for P2P cases
810 *
811 * @INPUT: set_value [0,100]
812 *
813 * @OUTPUT: None
814 *
815 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
816 *
817 * Currently used to set time quota for 2 MCC vdevs/adapters using
818 * (operating channel, quota) for each mode.
819 * The info is provided run time using iwpriv command:
820 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
821 * Note: the quota provided in command is for the same mode in cmd.
822 * HDD checks if MCC mode is active, gets the second mode and its
823 * operating chan.
824 * Quota for the 2nd role is calculated as 100 - quota of first mode.
825 *
826 * @E.g: iwpriv wlan0 setMccQuota 50
827 * iwpriv p2p0 setMccQuota 50
828 *
829 * Supported Feature: Concurrency
830 *
831 * Usage: Internal/External
832 *
833 * </ioctl>
834 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800835#define WE_MCC_CONFIG_QUOTA 71
836/* Private IOCTL for debug connection issues */
837#define WE_SET_DEBUG_LOG 72
838#ifdef WE_SET_TX_POWER
839#undef WE_SET_TX_POWER
840#endif
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -0800841
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530842/*
843 * <ioctl>
844 * setTxPower - Set the current transmit power
845 *
846 * @INPUT: Transmission power in dBm
847 *
848 * @OUTPUT: None
849 *
850 * This IOCTL sets the current transmit power.
851 * This setting does not persist over reboots.
852 *
853 * @E.g: iwpriv wlan0 setTxPower 10
854 *
855 * Supported Feature: STA
856 *
857 * Usage: Internal/External
858 *
859 * </ioctl>
860 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800861#define WE_SET_TX_POWER 74
862/* Private ioctl for earlyrx power save feature */
863#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
864#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
865#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
866#define WE_SET_EARLY_RX_SLOP_STEP 78
867#define WE_SET_EARLY_RX_INIT_SLOP 79
868#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530869/*
870 * <ioctl>
871 * setMcRate - Set the data rate for multicast data
872 *
873 * @INPUT: 1 to 32
874 *
875 * @OUTPUT: None
876 *
877 * This IOCTL sets the data rate for multicast data. Note that this command
878 * is allowed only in STA, IBSS, or QCMobileAP mode
879 *
880 * @E.g: iwpriv wlan0 setMcRate <value>
881 *
882 * Supported Feature: STA
883 *
884 * Usage: Internal/External
885 *
886 * </ioctl>
887 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800888#define WE_SET_MC_RATE 81
889#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
890/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530891/*
892 * <ioctl>
893 * 5g_ebt - Sets the 5g_ebt
894 *
895 * @INPUT: <value>
896 *
897 * @OUTPUT: None
898 *
899 * This IOTCL used to set 5g_ebt
900 *
901 * @E.g: iwpriv wlan0 5g_ebt <value>
902 *
903 * Supported Feature: STA
904 *
905 * Usage: Internal/External
906 *
907 * </ioctl>
908 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800909#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530910/*
911 * <ioctl>
912 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
913 *
914 * @INPUT: 20 t0 160
915 *
916 * @OUTPUT: None
917 *
918 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
919 *
920 * @E.g: iwpriv wlan0 cts_cbw <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_SET_CTS_CBW 84
929#define WE_DUMP_STATS 85
930#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +0530931/* Private sub ioctl for starting/stopping the profiling */
932#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +0530933
Abhishek Singh3c507012016-12-01 11:15:42 +0530934/*
935 * <ioctl>
936 * setChanChange - Initiate channel change
937 *
938 * @INPUT: channel number to switch to.
939 *
940 * @OUTPUT: None
941 *
942 * This IOCTL is used to initiate a channel change.
943 * If called on STA/CLI interface it will send the
944 * ECSA action frame to the connected SAP/GO asking to
945 * initiate the ECSA, if supported.
946 * If called on SAP/GO interface it will initiate
947 * ECSA and ask connected peers to move to new channel.
948 *
949 * @E.g: iwpriv wlan0 setChanChange <channel>
950 * iwpriv wlan0 setChanChange 1
951 *
952 * Supported Feature: ECSA
953 *
954 * Usage: Internal/External
955 *
956 * </ioctl>
957 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +0530958#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +0530959#define WE_SET_CONC_SYSTEM_PREF 89
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800960
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800961/*
962 * <ioctl>
963 * set_11ax_rate - set 11ax rates to FW
964 *
965 * @INPUT: rate code
966 *
967 * @OUTPUT: None
968 *
969 * This IOCTL fixes the Tx data rate of 11AX.
970 *
971 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
972 *
973 * Supported Feature: STA/SAP
974 *
975 * Usage: Internal
976 *
977 * </ioctl>
978 */
979#define WE_SET_11AX_RATE 91
980
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -0700981/*
982 * <ioctl>
983 * enable_dcm - enable Dual Carrier Modulation(DCM)
984 *
985 * @INPUT: 0/1
986 *
987 * @OUTPUT: None
988 *
989 * This IOCTL enables/disables DCM.
990 *
991 * @E.g: iwpriv wlan0 enable_dcm <0/1>
992 *
993 * Supported Feature: STA/SAP
994 *
995 * Usage: Internal
996 *
997 * </ioctl>
998 */
999#define WE_SET_DCM 92
1000
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001001/*
1002 * <ioctl>
Naveen Rawat53448ea2017-11-27 11:43:18 -08001003 * range_ext - enable Range extension
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001004 *
1005 * @INPUT: 0/1
1006 *
1007 * @OUTPUT: None
1008 *
1009 * This IOCTL enables/disables Range extension.
1010 *
Naveen Rawat53448ea2017-11-27 11:43:18 -08001011 * @E.g: iwpriv wlan0 range_ext <1/0>
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001012 *
1013 * Supported Feature: STA/SAP
1014 *
1015 * Usage: Internal
1016 *
1017 * </ioctl>
1018 */
1019#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001020
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301021/*
1022 * <ioctl>
1023 * wow_ito - sets the timeout value for inactivity data while
1024 * in power save mode during wow
1025 *
1026 * @INPUT: int
1027 *
1028 * @OUTPUT: None
1029 *
1030 * This IOCTL set the timeout value for inactivity data in power save mode
1031 *
1032 * @E.g: iwpriv wlan0 wow_ito 20
1033 *
1034 * Supported Feature: STA
1035 *
1036 * Usage: External
1037 *
1038 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001039 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301040#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1041
Jeff Johnson011c4502017-10-05 15:25:56 -07001042/*
1043 * <ioctl>
1044 * pdev_reset - reset the pdev
1045 *
1046 * @INPUT: Reset command to initiate:
1047 * TX_FLUSH = 1
1048 * WARM_RESET = 2
1049 * COLD_RESET = 3
1050 * WARM_RESET_RESTORE_CAL = 4
1051 * COLD_RESET_RESTORE_CAL = 5
1052 *
1053 * @OUTPUT: None
1054 *
1055 * This IOCTL is used to reset the pdev. The primary use is
1056 * for internal testing. It is not expected that this will
1057 * be used on a production device.
1058 *
1059 * @E.g: iwpriv wlan0 pdev_reset <command>
1060 * iwpriv wlan0 pdev_reset 1
1061 *
1062 * Supported Feature: None
1063 *
1064 * Usage: Internal
1065 *
1066 * </ioctl>
1067 */
1068#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301069
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301070/*
1071 * setModDTIM - Change Modulated DTIM
1072 *
1073 * @INPUT: set_value.
1074 *
1075 * @OUTPUT: None
1076 *
1077 * This IOCTL is used to change modulated DTIM
1078 * value without WIFI OFF/ON.
1079 *
1080 * @E.g: iwpriv wlan0 setModDTIM <value>
1081 * iwpriv wlan0 setModDTIM 2
1082 *
1083 * Supported Feature: N/A
1084 *
1085 * Usage: Internal/External
1086 *
1087 * </ioctl>
1088 */
1089#define WE_SET_MODULATED_DTIM 96
1090
Kiran Kumar Lokere05e9a652018-04-10 20:27:38 -07001091/*
1092 * <ioctl>
1093 * set_ppdu_dur - Sets the global ppdu duration
1094 *
1095 * @INPUT: Atleast one int argument
1096 *
1097 * @OUTPUT: None
1098 *
1099 * This IOTCL used to set global ppdu duration
1100 *
1101 * @E.g: iwpriv wlan0 set_ppdu_dur <value>
1102 * Valid values are 1 to 4000
1103 *
1104 * Supported Feature: STA/SAP
1105 *
1106 * Usage: Internal
1107 *
1108 * </ioctl>
1109 */
1110#define WE_SET_PPDU_DUR 97
1111
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001112/* Private ioctls and their sub-ioctls */
1113#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1114#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001115#define WE_GET_WLAN_DBG 4
1116#define WE_GET_MAX_ASSOC 6
1117/* 7 is unused */
1118#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301119
1120/*
1121 * <ioctl>
1122 * getconcurrency - Get concurrency mode
1123 *
1124 * @INPUT: None
1125 *
1126 * @OUTPUT: It shows concurrency value
1127 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1128 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1129 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1130 *
1131 * This IOCTL is used to retrieve concurrency mode.
1132 *
1133 * @E.g: iwpriv wlan0 getconcurrency
1134 * wlan0 getconcurrency:5
1135 * Above value shows STA+P2P_Client
1136 *
1137 * Supported Feature: Concurrency
1138 *
1139 * Usage: Internal/External
1140 *
1141 * </ioctl>
1142 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001143#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301144/*
1145 * <ioctl>
1146 * get_nss - Get the number of spatial STBC streams (NSS)
1147 *
1148 * @INPUT: None
1149 *
1150 * @OUTPUT: NSS
1151 * wlan0 get_nss:2
1152 *
1153 * This IOTCL used to get the number of spatial STBC streams
1154 *
1155 * @E.g: iwpriv wlan0 get_nss
1156 *
1157 * Supported Feature: STA
1158 *
1159 * Usage: Internal/External
1160 *
1161 * </ioctl>
1162 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001163#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301164/*
1165 * <ioctl>
1166 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1167 *
1168 * @INPUT: None
1169 *
1170 * @OUTPUT: ldpc
1171 * wlan0 get_ldpc:1
1172 *
1173 * This IOTCL used to gets the low density parity check (LDPC)
1174 *
1175 * @E.g: iwpriv wlan0 get_ldpc
1176 *
1177 * Supported Feature: STA
1178 *
1179 * Usage: Internal/External
1180 *
1181 * </ioctl>
1182 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001183#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301184/*
1185 * <ioctl>
1186 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1187 *
1188 * @INPUT: None
1189 *
1190 * @OUTPUT: TXSTBC
1191 * wlan0 get_tx_stbc:1
1192 *
1193 * This IOTCL get the value of the current Tx space time block code (STBC)
1194 *
1195 * @E.g: iwpriv wlan0 get_tx_stbc
1196 *
1197 * Supported Feature: STA
1198 *
1199 * Usage: Internal/External
1200 *
1201 * </ioctl>
1202 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001203#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301204/*
1205 * <ioctl>
1206 * get_rx_stbc - Gets the value of the current Rx STBC
1207 *
1208 * @INPUT: None
1209 *
1210 * @OUTPUT: Rx STBC
1211 * wlan0 get_rx_stbc:1
1212 *
1213 * This IOTCL used to get the value of the current Rx STBC
1214 *
1215 * @E.g: iwpriv wlan0 get_rx_stbc
1216 *
1217 * Supported Feature: STA
1218 *
1219 * Usage: Internal/External
1220 *
1221 * </ioctl>
1222 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001223#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301224/*
1225 * <ioctl>
1226 * get_shortgi - Get the value of the current short GI setting
1227 *
1228 * @INPUT: None
1229 *
1230 * @OUTPUT: Enable/disable of shortgi
1231 * wlan0 get_shortgi:1
1232 *
1233 * This IOCTL gets the value of the current short GI setting
1234 *
1235 * @E.g: iwpriv wlan0 get_shortgi
1236 *
1237 * Supported Feature: STA
1238 *
1239 * Usage: Internal/External
1240 *
1241 * </ioctl>
1242 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001243#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301244/*
1245 * <ioctl>
1246 * get_rtscts - Get the value of the current RTS/CTS setting.
1247 *
1248 * @INPUT: None
1249 *
1250 * @OUTPUT: Enable/disable of RTS/CTS
1251 * wlan0 get_rtscts:33
1252 *
1253 * This IOTCL get the value of the current RTS/CTS setting.
1254 *
1255 * @E.g: iwpriv wlan0 get_rtscts
1256 *
1257 * Supported Feature: STA
1258 *
1259 * Usage: Internal/External
1260 *
1261 * </ioctl>
1262 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001263#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301264/*
1265 * <ioctl>
1266 * get_chwidth - Get the current channel width setting
1267 *
1268 * @INPUT: None
1269 *
1270 * @OUTPUT: channel width
1271 * wlan0 get_chwidth:0
1272 *
1273 * This IOTCL get the current channel width setting.
1274 *
1275 * @E.g: iwpriv wlan0 get_chwidth
1276 *
1277 * Supported Feature: STA
1278 *
1279 * Usage: Internal/External
1280 *
1281 * </ioctl>
1282 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001283#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301284/*
1285 * <ioctl>
1286 * get_anienable - Get the anienable
1287 *
1288 * @INPUT: None
1289 *
1290 * @OUTPUT:
1291 * wlan0 get_anienable:0
1292 *
1293 * This IOTCL get the anienable
1294 *
1295 * @E.g: iwpriv wlan0 get_anienable
1296 *
1297 * Supported Feature: STA
1298 *
1299 * Usage: Internal/External
1300 *
1301 * </ioctl>
1302 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001303#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301304/*
1305 * <ioctl>
1306 * get_aniplen - Get the aniplen
1307 *
1308 * @INPUT: None
1309 *
1310 * @OUTPUT:
1311 * wlan0 get_aniplen:0
1312 *
1313 * This IOTCL get the aniplen
1314 *
1315 * @E.g: iwpriv wlan0 get_aniplen
1316 *
1317 * Supported Feature: STA
1318 *
1319 * Usage: Internal/External
1320 *
1321 * </ioctl>
1322 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001323#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301324/*
1325 * <ioctl>
1326 * get_anilislen- Get the anilislen
1327 *
1328 * @INPUT: None
1329 *
1330 * @OUTPUT:
1331 * wlan0 get_anilislen:0
1332 *
1333 * This IOTCL used to get anilislen
1334 *
1335 * @E.g: iwpriv wlan0 get_anilislen
1336 *
1337 * Supported Feature: STA
1338 *
1339 * Usage: Internal/External
1340 *
1341 * </ioctl>
1342 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001343#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301344/*
1345 * <ioctl>
1346 * get_aniofdmlvl - Get the OFDM level
1347 *
1348 * @INPUT: None
1349 *
1350 * @OUTPUT: OFDM
1351 * wlan0 get_aniofdmlvl:0
1352 *
1353 * This IOTCL used to get ofdm level
1354 *
1355 * @E.g: iwpriv wlan0 get_aniofdmlvl
1356 *
1357 * Supported Feature: STA
1358 *
1359 * Usage: Internal/External
1360 *
1361 * </ioctl>
1362 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001363#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301364/*
1365 * <ioctl>
1366 * get_aniccklvl - Get the cck level
1367 *
1368 * @INPUT: None
1369 *
1370 * @OUTPUT:
1371 * wlan0 get_aniccklvl:0
1372 *
1373 * This IOTCL used to get cck level
1374 *
1375 * @E.g: iwpriv wlan0 get_aniccklvl
1376 *
1377 * Supported Feature: STA
1378 *
1379 * Usage: Internal/External
1380 *
1381 * </ioctl>
1382 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001383#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301384/*
1385 * <ioctl>
1386 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1387 *
1388 * @INPUT: None
1389 *
1390 * @OUTPUT: Enable/disable dynamic channel bandwidth
1391 * wlan0 get_cwmenable:0
1392 *
1393 * This IOTCL get the value of the dynamic channel bandwidth setting
1394 *
1395 * @E.g: iwpriv wlan0 get_cwmenable
1396 *
1397 * Supported Feature: STA
1398 *
1399 * Usage: Internal/External
1400 *
1401 * </ioctl>
1402 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001403#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301404/*
1405 * <ioctl>
1406 * get_txchainmask - Get the txchainmask that was set
1407 *
1408 * @INPUT: None
1409 *
1410 * @OUTPUT: txchainmask
1411 * wlan0 get_txchainmask:1
1412 *
1413 * This IOCTL gets the txchainmask that was set
1414 * This command is useful if it was previously set
1415 *
1416 * @E.g: iwpriv wlan0 get_txchainmask
1417 *
1418 * Supported Feature: STA
1419 *
1420 * Usage: Internal/External
1421 *
1422 * </ioctl>
1423 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001424#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301425/*
1426 * <ioctl>
1427 * get_rxchainmask - Get the rxchainmask that was set
1428 *
1429 * @INPUT: None
1430 *
1431 * @OUTPUT: rxchainmask
1432 * wlan0 get_rxchainmask:1
1433 *
1434 * This IOCTL gets the rxchainmask that was set
1435 * This command is useful only if it was previously set.
1436 *
1437 * @E.g: iwpriv wlan0 get_rxchainmask
1438 *
1439 * Supported Feature: STA
1440 *
1441 * Usage: Internal/External
1442 *
1443 * </ioctl>
1444 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001445#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301446/*
1447 * <ioctl>
1448 * get_11nrate - Get the fixed Tx data rate
1449 *
1450 * @INPUT: None
1451 *
1452 * @OUTPUT: Using this command does not return the same value as set
1453 * wlan0 get_11nrate:0
1454 *
1455 * This IOCTL gets the fixed Tx data rate
1456 * This command is useful only if setting the fixed Tx rate.
1457 *
1458 * @E.g: iwpriv wlan0 get_11nrate
1459 *
1460 * Supported Feature: STA
1461 *
1462 * Usage: Internal/External
1463 *
1464 * </ioctl>
1465 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001466#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301467/*
1468 * <ioctl>
1469 * get_ampdu - Get the maximum subframe of ampdu
1470 *
1471 * @INPUT: None
1472 *
1473 * @OUTPUT: Maximum subframe of ampdu
1474 * wlan0 get_ampdu:1
1475 *
1476 * This IOCTL gets the maximum subframe of ampdu
1477 * This command is useful only if setting ampdu.
1478 *
1479 * @E.g: iwpriv wlan0 get_ampdu
1480 *
1481 * Supported Feature: STA
1482 *
1483 * Usage: Internal/External
1484 *
1485 * </ioctl>
1486 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001487#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301488/*
1489 * <ioctl>
1490 * get_amsdu - Get the maximum subframe of amsdu
1491 *
1492 * @INPUT: None
1493 *
1494 * @OUTPUT: Maximum subframe of amsdu
1495 * wlan0 get_amsdu:1
1496 *
1497 * This IOCTL gets the maximum subframe of amsdu.
1498 * This command is useful only if setting amsdu
1499 *
1500 * @E.g: iwpriv wlan0 get_amsdu
1501 *
1502 * Supported Feature: STA
1503 *
1504 * Usage: Internal/External
1505 *
1506 * </ioctl>
1507 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001508#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301509/*
1510 * <ioctl>
1511 * get_txpow2g - Get the current 2 GHz Tx power setting
1512 *
1513 * @INPUT: None
1514 *
1515 * @OUTPUT: Tx Power in dbm
1516 * wlan0 get_txpow2g:0
1517 *
1518 * This IOCTL gets the current 2 GHz Tx power setting
1519 * This command is useful if setting Tx power
1520 *
1521 * @E.g: iwpriv wlan0 get_txpow2g
1522 *
1523 * Supported Feature: STA
1524 *
1525 * Usage: Internal/External
1526 *
1527 * </ioctl>
1528 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001529#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301530/*
1531 * <ioctl>
1532 * get_txpow5g - Get the current 5 GHz Tx power setting
1533 *
1534 * @INPUT: None
1535 *
1536 * @OUTPUT: Tx Power in dbm
1537 * wlan0 get_txpow5g:0
1538 *
1539 * This IOCTL gets the current 5 GHz Tx power setting
1540 * This command is useful if setting Tx power
1541 *
1542 * @E.g: iwpriv wlan0 get_txpow5g
1543 *
1544 * Supported Feature: STA
1545 *
1546 * Usage: Internal/External
1547 *
1548 * </ioctl>
1549 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001550#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001551/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001552#define WE_GET_PPS_PAID_MATCH 32
1553#define WE_GET_PPS_GID_MATCH 33
1554#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1555#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1556#define WE_GET_PPS_EOF_PAD_DELIM 36
1557#define WE_GET_PPS_MACADDR_MISMATCH 37
1558#define WE_GET_PPS_DELIM_CRC_FAIL 38
1559#define WE_GET_PPS_GID_NSTS_ZERO 39
1560#define WE_GET_PPS_RSSI_CHECK 40
1561/* Private ioctl for QPower */
1562#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1563#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1564#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1565#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001566/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301567/*
1568 * <ioctl>
1569 * get_gtxHTMcs - Get the tx HTM
1570 *
1571 * @INPUT: None
1572 *
1573 * @OUTPUT: HTM
1574 * wlan0 get_gtxHTMcs:32896
1575 *
1576 * This IOTCL used to get HTM
1577 *
1578 * @E.g: iwpriv wlan0 get_gtxHTMcs
1579 *
1580 * Supported Feature: STA
1581 *
1582 * Usage: Internal/External
1583 *
1584 * </ioctl>
1585 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001586#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301587/*
1588 * <ioctl>
1589 * get_gtxVHTMcs - Get the VHTM
1590 *
1591 * @INPUT: None
1592 *
1593 * @OUTPUT: VHTM
1594 * wlan0 get_gtxVHTMcs:524800
1595 *
1596 * This IOTCL used to get the VHTM
1597 *
1598 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1599 *
1600 * Supported Feature: STA
1601 *
1602 * Usage: Internal/External
1603 *
1604 * </ioctl>
1605 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001606#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301607/*
1608 * <ioctl>
1609 * get_gtxUsrCfg - Get the tx cfg
1610 *
1611 * @INPUT: None
1612 *
1613 * @OUTPUT: TXCFG
1614 * wlan0 get_gtxUsrCfg:32
1615 *
1616 * This IOTCL used to get the tx cfg
1617 *
1618 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1619 *
1620 * Supported Feature: STA
1621 *
1622 * Usage: Internal/External
1623 *
1624 * </ioctl>
1625 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001626#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301627/*
1628 * <ioctl>
1629 * get_gtxThre - Get the tx threshold
1630 *
1631 * @INPUT: None
1632 *
1633 * @OUTPUT: Threshold
1634 * wlan0 get_gtxThre:3
1635 *
1636 * This IOCTL is used to get tx threshold
1637 *
1638 * @E.g: iwpriv wlan0 get_gtxThre
1639 *
1640 * Supported Feature: STA
1641 *
1642 * Usage: Internal/External
1643 *
1644 * </ioctl>
1645 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001646#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301647/*
1648 * <ioctl>
1649 * get_gtxMargin - Get the tx margin
1650 *
1651 * @INPUT: None
1652 *
1653 * @OUTPUT: GTXMARGIN
1654 * wlan0 get_gtxMargin:2
1655 *
1656 * This IOCTL is used to set tx margin
1657 *
1658 * @E.g: iwpriv wlan0 get_gtxMargin
1659 *
1660 * Supported Feature: STA
1661 *
1662 * Usage: Internal/External
1663 *
1664 * </ioctl>
1665 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001666#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301667/*
1668 * <ioctl>
1669 * get_gtxStep - Get the tx step
1670 *
1671 * @INPUT: None
1672 *
1673 * @OUTPUT: GTXSTEP
1674 * wlan0 get_gtxStep:0
1675 *
1676 * This IOCTL is used to get the gtx step
1677 *
1678 * @E.g: iwpriv wlan0 get_gtxStep
1679 *
1680 * Supported Feature: STA
1681 *
1682 * Usage: Internal/External
1683 *
1684 * </ioctl>
1685 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001686#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301687/*
1688 * <ioctl>
1689 * get_gtxMinTpc - Get the tx miminum tpc
1690 *
1691 * @INPUT: None
1692 *
1693 * @OUTPUT: TPC
1694 * wlan0 get_gtxMinTpc:0
1695 *
1696 * This IOCTL is used to get tx miminum tpc
1697 *
1698 * @E.g: iwpriv wlan0 get_gtxMinTpc
1699 *
1700 * Supported Feature: STA
1701 *
1702 * Usage: Internal/External
1703 *
1704 * </ioctl>
1705 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001706#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301707/*
1708 * <ioctl>
1709 * get_gtxBWMask - Get the tx BW MASK
1710 *
1711 * @INPUT: None
1712 *
1713 * @OUTPUT: MASK
1714 * wlan0 get_gtxBWMask:15
1715 *
1716 * This IOCTL is used get gtx bw mask
1717 *
1718 * @E.g: iwpriv wlan0 get_gtxBWMask
1719 *
1720 * Supported Feature: STA
1721 *
1722 * Usage: Internal/External
1723 *
1724 * </ioctl>
1725 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001726#define WE_GET_GTX_BWMASK 54
1727#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001728#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001729#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001730
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001731/*
1732 * <ioctl>
1733 * get_dcm - Get dcm enablement value
1734 *
1735 * @INPUT: None
1736 *
1737 * @OUTPUT: 0/1
1738 * wlan0 get_dcm
1739 *
1740 * This IOCTL is used get dcm value
1741 *
1742 * Supported Feature: STA/SAP
1743 *
1744 * Usage: Internal
1745 *
1746 * </ioctl>
1747 */
1748#define WE_GET_DCM 60
1749
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001750/*
1751 * <ioctl>
1752 * get_dcm - Get range extension enablement value
1753 *
1754 * @INPUT: None
1755 *
1756 * @OUTPUT: 0/1
1757 * wlan0 get_range_ext
1758 *
1759 * This IOCTL is used get range_extension value
1760 *
1761 * Supported Feature: STA/SAP
1762 *
1763 * Usage: Internal
1764 *
1765 * </ioctl>
1766 */
1767#define WE_GET_RANGE_EXT 61
1768
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001769/* Private ioctls and their sub-ioctls */
1770#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1771
1772/* Private ioctls and their sub-ioctls */
1773#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1774#define WE_WOWL_ADD_PTRN 1
1775#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301776/*
1777 * <ioctl>
1778 * neighbor - Send neighbor report request
1779 *
1780 * @INPUT: string
1781 *
1782 * @OUTPUT: None
1783 *
1784 * This IOCTL create a Neighbor report request and send it to peer
1785 *
1786 * @E.g: iwpriv wlan0 neighbor "SSID"
1787 *
1788 * Supported Feature: 11k
1789 *
1790 * Usage: Internal/External
1791 *
1792 * </ioctl>
1793 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001794#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301795/*
1796 * <ioctl>
1797 * set_ap_wps_ie - Set the P2P IE of the probe response
1798 *
1799 * @INPUT: string
1800 *
1801 * @OUTPUT: None
1802 *
1803 * This IOCTL sets the P2P IE of the probe response
1804 *
1805 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1806 *
1807 * Supported Feature: STA
1808 *
1809 * Usage: Internal/External
1810 *
1811 * </ioctl>
1812 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001813#define WE_SET_AP_WPS_IE 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001814#define WE_SET_CONFIG 5
1815
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07001816/*
1817 * <ioctl>
1818 * unit_test - execute component-level unit tests
1819 *
1820 * @INPUT: string - the name of the component to test.
1821 * All tests are executed if unspecified
1822 * @OUTPUT: None
1823 *
1824 * Usage: Internal only
1825 * </ioctl>
1826 */
1827#define WE_UNIT_TEST 6
1828
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001829/* Private ioctls and their sub-ioctls */
1830#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1831#define WE_SET_WLAN_DBG 1
1832#define WE_SET_DP_TRACE 2
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301833#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001834
1835/* Private ioctls and their sub-ioctls */
1836#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1837#define WE_WLAN_VERSION 1
1838#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301839/*
1840 * <ioctl>
1841 * getConfig - gets the values of all configurations listed in WCNSS
1842 *
1843 * @INPUT: None
1844 *
1845 * @OUTPUT: Current configuration to the sys log
1846 * wlan0 getConfig: WLAN configuration written to system log
1847 *
1848 * This IOCTL gets the values of all configurations listed in WCNSS
1849 *
1850 * @E.g: iwpriv wlan0 getConfig
1851 *
1852 * Supported Feature: STA
1853 *
1854 * Usage: Internal/External
1855 *
1856 * </ioctl>
1857 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001858#define WE_GET_CFG 3
1859#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301860/*
1861 * <ioctl>
1862 * getChannelList - Get the available channel list while in QCMobileAP
1863 *
1864 * @INPUT: None
1865 *
1866 * @OUTPUT: Channel list
1867 * wlan0 getChannelList:36 US 1..165
1868 *
1869 * This IOCTL gets the available channel list while in QCMobileAP
1870 *
1871 * @E.g: iwpriv wlan0 getChannelList
1872 *
1873 * Supported Feature: STA
1874 *
1875 * Usage: Internal/External
1876 *
1877 * </ioctl>
1878 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001879#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301880/*
1881 * <ioctl>
1882 * getRSSI - Get the Received Signal Strength Indicator
1883 *
1884 * @INPUT: None
1885 *
1886 * @OUTPUT: RSSI
1887 * wlan0 getRSSI:rsssi=-32
1888 *
1889 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1890 *
1891 * @E.g: iwpriv wlan0 getRSSI
1892 *
1893 * Supported Feature: STA
1894 *
1895 * Usage: Internal/External
1896 *
1897 * </ioctl>
1898 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001899#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001900
1901/*
1902 * <ioctl>
1903 * getSuspendStats - Get suspend/resume stats
1904 *
1905 * @INPUT: None
1906 *
1907 * @OUTPUT: character string containing formatted suspend/resume stats
1908 *
1909 * This ioctl is used to get suspend/resume stats formatted for display.
1910 * Currently it includes suspend/resume counts, wow wake up reasons, and
1911 * suspend fail reasons.
1912 *
1913 * @E.g: iwpriv wlan0 getSuspendStats
1914 * iwpriv wlan0 getSuspendStats
1915 *
1916 * Supported Feature: suspend/resume
1917 *
1918 * Usage: Internal
1919 *
1920 * </ioctl>
1921 */
1922#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001923#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05301924/*
1925 * <ioctl>
1926 * getTdlsPeers - Get all TDLS peers.
1927 *
1928 * @INPUT: None
1929 *
1930 * @OUTPUT: Returns the MAC address of all the TDLS peers
1931 * wlan0 getTdlsPeers:
1932 * MAC Id cap up RSSI
1933 * ---------------------------------
1934 * 00:0a:f5:0e:bd:18 2 Y Y -44
1935 * 00:0a:f5:bf:0e:12 0 N N 0
1936 *
1937 * This IOCTL is used to get all TDLS peers.
1938 *
1939 * @E.g: iwpriv wlan0 getTdlsPeers
1940 *
1941 * Supported Feature: TDLS
1942 *
1943 * Usage: Internal/External
1944 *
1945 * </ioctl>
1946 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001947#define WE_GET_TDLS_PEERS 8
1948#endif
1949#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05301950/*
1951 * <ioctl>
1952 * getPMFInfo - get the PMF info of the connected session
1953 *
1954 * @INPUT: None
1955 *
1956 * @OUTPUT:
1957 * wlan0 getPMFInfo:
1958 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
1959 * Number of Unprotected Disassocs 0
1960 * Number of Unprotected Deauths 0
1961 *
1962 * This IOCTL is used to get the PMF stats/status of the current
1963 * connection.
1964 *
1965 * @e.g:iwpriv wlan0 getPMFInfo
1966 *
1967 * Supported Feature: PMF
1968 *
1969 * Usage: Internal/External
1970 *
1971 * </ioctl>
1972 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001973#define WE_GET_11W_INFO 9
1974#endif
1975#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05301976/*
1977 * <ioctl>
1978 * getIbssSTAs - get ibss sta info
1979 *
1980 * @INPUT: None
1981 *
1982 * @OUTPUT: Give the MAC of the IBSS STA
1983 * wlan0 getIbssSTAs:
1984 * 1 .8c:fd:f0:01:9c:bf
1985 *
1986 * This IOCTL is used to get ibss sta info
1987 *
1988 * @E.g: iwpriv wlan0 getIbssSTAs
1989 *
1990 * Supported Feature: IBSS
1991 *
1992 * Usage: Internal/External
1993 *
1994 * </ioctl>
1995 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001996#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301997/*
1998 * <ioctl>
1999 * getphymode - Get the current phymode.
2000 *
2001 * @INPUT: None
2002 *
2003 * @OUTPUT: In phymode
2004 * wlan0 getphymode:AUTO MODE
2005 *
2006 * This IOCTL used to gets the current phymode.
2007 *
2008 * @E.g: iwpriv wlan0 getphymode
2009 *
2010 * Supported Feature: STA
2011 *
2012 * Usage: Internal/External
2013 *
2014 * </ioctl>
2015 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002016#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002017
2018/*
2019 * <ioctl>
2020 * getOemDataCap - Get the oem data caps.
2021 *
2022 * @INPUT: None
2023 *
2024 * @OUTPUT: oem data capability
2025 *
2026 * This IOCTL used to gets the current oem data cap.
2027 *
2028 * @E.g: iwpriv wlan0 getOemDataCap
2029 *
2030 * Usage: Internal/External
2031 *
2032 * </ioctl>
2033 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002034#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002035
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302036/*
2037 * <ioctl>
2038 * getSNR - Enable SNR Monitoring
2039 *
2040 * @INPUT: None
2041 *
2042 * @OUTPUT: Signal strength/ratio
2043 * wlan0 getSNR:1
2044 *
2045 * This IOCTL is used to get ibss sta info
2046 *
2047 * @E.g: iwpriv wlan0 getSNR
2048 *
2049 * Supported Feature: STA
2050 *
2051 * Usage: Internal/External
2052 *
2053 * </ioctl>
2054 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002055
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002056#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302057#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002058
2059/* Private ioctls and their sub-ioctls */
2060#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302061
2062/*
2063 * <ioctl>
2064 * reassoc - Trigger STA re-association to the connected AP
2065 *
2066 * @INPUT: None
2067 *
2068 * @OUTPUT: None
2069 *
2070 * This IOCTL is used to trigger STA reassociation to the connected AP.
2071 *
2072 * @E.g: iwpriv wlan0 reassoc
2073 *
2074 * Supported Feature: Roaming
2075 *
2076 * Usage: Internal
2077 *
2078 * </ioctl>
2079 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002080#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302081/*
2082 * <ioctl>
2083 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2084 *
2085 * @INPUT: None
2086 *
2087 * @OUTPUT: print ibss peer in info logs
2088 * pPeerInfo->numIBSSPeers = 1
2089 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2090 *
2091 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2092 * in info logs
2093 *
2094 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2095 *
2096 * Supported Feature: IBSS
2097 *
2098 * Usage: Internal/External
2099 *
2100 * </ioctl>
2101 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002102#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002103/* Sub ioctls 11 to 16 are not used */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002104#define WE_GET_RECOVERY_STAT 17
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002105#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302106/*
2107 * <ioctl>
2108 * stop_obss_scan - Stop obss scan
2109 *
2110 * @INPUT: None
2111 *
2112 * @OUTPUT: None
2113 *
2114 * This IOCTL is used to stop obss scan
2115 *
2116 * @E.g: iwpriv wlan0 stop_obss_scan
2117 *
2118 * Supported Feature: Scan
2119 *
2120 * Usage: Internal/External
2121 *
2122 * </ioctl>
2123 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002124#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002125
2126/* Private ioctls and their sub-ioctls */
2127#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2128
2129#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302130/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002131
Manjeet Singhf82ed072016-07-08 11:40:00 +05302132#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002133
Kabilan Kannan6894e6a2017-11-09 14:37:55 -08002134/* subcommand 5 is unused */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302135
Abhishek Singh49b654e2016-12-01 16:11:17 +05302136/*
2137 * <ioctl>
2138 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2139 *
2140 * @INPUT: staid
2141 *
2142 * @OUTPUT: print ibss peer corresponding to staid in info logs
2143 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2144 *
2145 * This IOCTL is used to print the specific ibss peers's MAC,
2146 * rate and RSSI in info logs
2147 *
2148 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2149 * iwpriv wlan0 ibssPeerInfo 0
2150 *
2151 * Supported Feature: IBSS
2152 *
2153 * Usage: Internal/External
2154 *
2155 * </ioctl>
2156 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002157#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002158#define WE_UNIT_TEST_CMD 7
2159
2160#define WE_MTRACE_DUMP_CMD 8
2161#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2162
2163
2164#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2165#define WE_LED_FLASHING_PARAM 10
2166#endif
2167
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302168/*
2169 * <ioctl>
2170 * pm_clist - Increments the index value of the concurrent connection list
2171 * and update with the input parameters provided.
2172 *
2173 * @INPUT: Following 8 arguments:
2174 * @vdev_id: vdev id
2175 * @tx_streams: TX streams
2176 * @rx_streams: RX streams
2177 * @chain_mask: Chain mask
2178 * @type: vdev_type
2179 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2180 * @sub_type: vdev_subtype
2181 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2182 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2183 * @channel: Channel
2184 * @mac: Mac id
2185 *
2186 * @OUTPUT: None
2187 *
2188 * This IOCTL is used to increments the index value of the concurrent connection
2189 * list and update with the input parameters provided.
2190 *
2191 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2192 * sub_type channel mac
2193 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2194 *
2195 * Supported Feature: DBS
2196 *
2197 * Usage: Internal/External
2198 *
2199 * </ioctl>
2200 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002201#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302202
2203/*
2204 * <ioctl>
2205 * pm_dlist - Delete the index from the concurrent connection list that is
2206 * present in the given vdev_id.
2207 *
2208 * @INPUT: delete_all, vdev_id
2209 * @delete_all: delete all indices
2210 * @vdev_id: vdev id
2211 *
2212 * @OUTPUT: None
2213 *
2214 * This IOCTL is used to delete the index from the concurrent connection list
2215 * that is present in the given vdev_id.
2216 *
2217 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2218 * iwpriv wlan0 pm_dlist 0 1
2219 *
2220 * Supported Feature: DBS
2221 *
2222 * Usage: Internal/External
2223 *
2224 * </ioctl>
2225 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002226#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302227
2228/*
2229 * <ioctl>
2230 * pm_dbs - Set dbs capability and system preference
2231 *
2232 * @INPUT: dbs, system_pref
2233 * @dbs: Value of DBS capability to be set
2234 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002235 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302236 *
2237 * @OUTPUT: None
2238 *
2239 * This IOCTL is used to set dbs capability and system preference.
2240 *
2241 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2242 * iwpriv wlan0 pm_dbs 1 0
2243 *
2244 * Supported Feature: DBS
2245 *
2246 * Usage: Internal/External
2247 *
2248 * </ioctl>
2249 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002250#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302251
2252/*
2253 * <ioctl>
2254 * pm_pcl - Set pcl for concurrency mode.
2255 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002256 * @INPUT: policy_mgr_con_mode
2257 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302258 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2259 *
2260 * @OUTPUT: None
2261 *
2262 * This IOCTL is used to set pcl for concurrency mode.
2263 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002264 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302265 * iwpriv wlan0 pm_pcl 0
2266 *
2267 * Supported Feature: DBS
2268 *
2269 * Usage: Internal/External
2270 *
2271 * </ioctl>
2272 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002273#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302274
2275/*
2276 * <ioctl>
2277 * pm_cinfo - Shows the concurrent connection list.
2278 *
2279 * @INPUT: None
2280 *
2281 * @OUTPUT: None
2282 *
2283 * This IOCTL is used to show the concurrent connection list.
2284 *
2285 * @E.g: iwpriv wlan0 pm_cinfo
2286 *
2287 * Supported Feature: DBS
2288 *
2289 * Usage: Internal/External
2290 *
2291 * </ioctl>
2292 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002293#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302294
2295/*
2296 * <ioctl>
2297 * pm_ulist - Updates the index value of the concurrent connection list
2298 * with the input parameters provided.
2299 *
2300 * @INPUT: Following 8 arguments:
2301 * @vdev_id: vdev id
2302 * @tx_streams: TX streams
2303 * @rx_streams: RX streams
2304 * @chain_mask: Chain mask
2305 * @type: vdev_type
2306 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2307 * @sub_type: vdev_subtype
2308 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2309 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2310 * @channel: Channel
2311 * @mac: Mac id
2312 *
2313 * @OUTPUT: None
2314 *
2315 * This IOCTL is used to updates the index value of the concurrent
2316 * connection list with the input parameters provided.
2317 *
2318 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2319 * sub_type channel mac
2320 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2321 *
2322 * Supported Feature: DBS
2323 *
2324 * Usage: Internal/External
2325 *
2326 * </ioctl>
2327 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002328#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302329
2330/*
2331 * <ioctl>
2332 * pm_query_action - Initiate actions needed on current connections as
2333 * per the channel provided.
2334 *
2335 * @INPUT: channel
2336 * @channel: Channel on which new connection will be.
2337 *
2338 * @OUTPUT: None
2339 *
2340 * This IOCTL is used to initiate actions needed on current connections
2341 * as per the channel provided.
2342 *
2343 * @E.g: iwpriv wlan0 pm_query_action channel
2344 * iwpriv wlan0 pm_query_action 6
2345 *
2346 * Supported Feature: DBS
2347 *
2348 * Usage: Internal/External
2349 *
2350 * </ioctl>
2351 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002352#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302353
2354/*
2355 * <ioctl>
2356 * pm_query_allow - Checks for allowed concurrency combination
2357 *
2358 * @INPUT: mode, channel, bandwidth
2359 * @mode: new connection mode
2360 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2361 * @channel: channel on which new connection is coming up
2362 * @bandwidth: Bandwidth requested by the connection
2363 * 0:None 1:5MHz 2:10MHz 3:20MHz
2364 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2365 *
2366 * @OUTPUT: None
2367 *
2368 * This IOCTL is used to checks for allowed concurrency combination.
2369 *
2370 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2371 * iwpriv wlan0 pm_query_allow 0 6 4
2372 *
2373 * Supported Feature: DBS
2374 *
2375 * Usage: Internal/External
2376 *
2377 * </ioctl>
2378 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002379#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302380
2381/*
2382 * <ioctl>
2383 * pm_run_scenario - Create scenario with number of connections provided.
2384 *
2385 * @INPUT: num_of_conn
2386 * @num_of_conn: the number of connections (values: 1~3)
2387 *
2388 * @OUTPUT: None
2389 *
2390 * This IOCTL is used to create scenario with the number of connections
2391 * provided.
2392 *
2393 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2394 * iwpriv wlan0 pm_run_scenario 1
2395 *
2396 * Supported Feature: DBS
2397 *
2398 * Usage: Internal/External
2399 *
2400 * </ioctl>
2401 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002402#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302403
2404/*
2405 * <ioctl>
2406 * pm_set_hw_mode - Set hardware for single/dual mac.
2407 *
2408 * @INPUT: hw_mode
2409 * 0:single mac 1:dual mac
2410 *
2411 * @OUTPUT: None
2412 *
2413 * This IOCTL is used to set hardware for single/dual mac.
2414 *
2415 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2416 * iwpriv wlan0 pm_set_hw_mode 1
2417 *
2418 * Supported Feature: DBS
2419 *
2420 * Usage: Internal/External
2421 *
2422 * </ioctl>
2423 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002424#define WE_POLICY_SET_HW_MODE_CMD 20
2425
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302426/*
2427 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002428 * ch_avoid - unit test SAP channel avoidance
2429 *
2430 * @INPUT: chan avoid ranges
2431 *
2432 * @OUTPUT: none
2433 *
2434 * This IOCTL is used to fake a channel avoidance event.
2435 * To test SAP/GO chan switch during chan avoid event process.
2436 *
2437 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2438 *
2439 * Supported Feature: SAP chan avoidance.
2440 *
2441 * Usage: Internal
2442 *
2443 * </ioctl>
2444 */
2445#define WE_SET_CHAN_AVOID 21
2446
2447/*
2448 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302449 * set_scan_cfg - Set dual MAC scan config parameters.
2450 *
2451 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2452 * @dbs: Value of DBS bit
2453 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2454 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2455 *
2456 * @OUTPUT: None
2457 *
2458 * This IOCTL is used to set the dual MAC scan config.
2459 *
2460 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2461 * single_mac_scan_with_dbs
2462 * iwpriv wlan0 set_scan_cfg 1 0 1
2463 *
2464 * Supported Feature: DBS
2465 *
2466 * Usage: Internal/External
2467 *
2468 * </ioctl>
2469 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002470#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302471
2472/*
2473 * <ioctl>
2474 * set_fw_mode_cfg - Sets the dual mac FW mode config
2475 *
2476 * @INPUT: dbs, dfs
2477 * @dbs: DBS bit
2478 * @dfs: Agile DFS bit
2479 *
2480 * @OUTPUT: None
2481 *
2482 * This IOCTL is used to set the dual mac FW mode config.
2483 *
2484 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2485 * iwpriv wlan0 set_fw_mode_cfg 1 1
2486 *
2487 * Supported Feature: DBS
2488 *
2489 * Usage: Internal/External
2490 *
2491 * </ioctl>
2492 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002493#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002494#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002495/*
2496 * <ioctl>
2497 * txrx_stats - TXRX statistics query
2498 *
2499 * @INPUT: query category, mac id (default mac id is 0)
2500 *
2501 * @OUTPUT: TXRX statistics result
2502 *
2503 * This IOCTL is used to get TXRX statistics counters.
2504 *
2505 * @E.g: iwpriv wlan0 txrx_stats 21 0
2506 * iwpriv wlan0 txrx_stats 21 1
2507 *
2508 * Usage: Internal
2509 *
2510 * </ioctl>
2511 */
2512#define WE_SET_TXRX_STATS 24
2513
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002514
2515#ifdef FEATURE_WLAN_TDLS
2516#undef MAX_VAR_ARGS
2517#define MAX_VAR_ARGS 11
2518#else
2519#undef MAX_VAR_ARGS
2520#define MAX_VAR_ARGS 9
2521#endif
2522
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002523/*
2524 * <ioctl>
2525 * fips_test - Perform a FIPS test
2526 *
2527 * @INPUT: Binary representation of the following packed structure
2528 *
2529 * @OUTPUT: Binary representation of the following packed structure
2530 *
2531 * This IOCTL is used to perform FIPS certification testing
2532 *
2533 * @E.g: iwpriv wlan0 fips_test <test vector>
2534 *
2535 * iwpriv wlan0 fips_test <tbd>
2536 *
2537 * Supported Feature: FIPS
2538 *
2539 * Usage: Internal
2540 *
2541 * </ioctl>
2542 */
2543#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2544
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002545/* Private ioctls (with no sub-ioctls) */
2546/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302547/*
2548 * <ioctl>
2549 * addTspec - Add TSPEC for each AC
2550 *
2551 * @INPUT: 19 TSPEC params
2552 * @[arg0]: handle
2553 * @[arg1]: tid
2554 * @[arg2]: dir
2555 * @[arg3]: psb
2556 * @[arg4]: up
2557 * @[arg5]: nomMsduSize
2558 * @[arg6]: maxMsduSize
2559 * @[arg7]: minDataRate
2560 * @[arg8]: meanDataRate
2561 * @[arg9]: peakDataRate
2562 * @[arg10]: maxBurstSize
2563 * @[arg11]: minPhyRate
2564 * @[arg12]: sba
2565 * @[arg13]: minServiceIntv
2566 * @[arg14]: suspendIntv
2567 * @[arg15]: burstSizeDefn
2568 * @[arg16]: ackPolicy
2569 * @[arg17]: inactivityPeriod
2570 * @[arg18]: maxServiceIntv
2571 *
2572 * @OUTPUT: Success/Failure
2573 *
2574 * This IOCTL is used to add TSPEC for each AC.
2575 *
2576 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2577 * <maxMsduSize> <minDataRate> <meanDataRate>
2578 * <peakDataRate> <maxBurstSize> <minPhyRate>
2579 * <sba> <minServiceIntv> <suspendIntv>
2580 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2581 * <maxServiceIntv>
2582 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2583 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2584 * wlan0 addTspec:3
2585 *
2586 * Supported Feature: WMM
2587 *
2588 * Usage: Internal/External
2589 *
2590 * </ioctl>
2591 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002592#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302593/*
2594 * <ioctl>
2595 * delTspec - Delete TSPEC entry for each AC
2596 *
2597 * @INPUT: 1 TSPEC param
2598 * @[arg0]: handle
2599 *
2600 * @OUTPUT: Success/Failure
2601 *
2602 * This IOCTL is used to delete TSPEC entry for each AC.
2603 *
2604 * @E.g: iwpriv wlan0 delTspec <handle>
2605 * iwpriv wlan0 delTspec 7001
2606 * wlan0 delTspec:16
2607 *
2608 * Supported Feature: WMM
2609 *
2610 * Usage: Internal/External
2611 *
2612 * </ioctl>
2613 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002614#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302615/*
2616 * <ioctl>
2617 * getTspec - Get TSPEC entry for each AC
2618 *
2619 * @INPUT: 1 TSPEC param
2620 * @[arg0]: handle
2621 *
2622 * @OUTPUT: Success/Failure
2623 *
2624 * This IOCTL is used to get TSPEC entry for each AC.
2625 *
2626 * @E.g: iwpriv wlan0 getTspec <handle>
2627 * iwpriv wlan0 getTspec 7001
2628 * wlan0 delTspec:18
2629 *
2630 * Supported Feature: WMM
2631 *
2632 * Usage: Internal/External
2633 *
2634 * </ioctl>
2635 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002636#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2637
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002638/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2639/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2640/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002641#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2642#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002643/* (SIOCIWFIRSTPRIV + 16) is currently unused */
2644/* (SIOCIWFIRSTPRIV + 17) is currently unused */
2645/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2646
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002647#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002648
2649/* Private ioctl for setting the host offload feature */
2650#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2651
2652/* Private ioctl to get the statistics */
2653#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2654
2655/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302656/*
2657 * <ioctl>
2658 * setKeepAlive - Set the keep alive feature
2659 *
2660 * @INPUT: 28 bytes of information in the order of packet type, time period
2661 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2662 *
2663 * @OUTPUT: None
2664 *
2665 * This IOCTL sets the keep alive feature to send either NULL
2666 * or unsolicited ARP response packets
2667 *
2668 * @E.g: iwpriv wlan0 setKeepAlive
2669 *
2670 * Supported Feature: STA
2671 *
2672 * Usage: Internal/External
2673 *
2674 * </ioctl>
2675 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002676#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2677
2678#ifdef WLAN_FEATURE_PACKET_FILTERING
2679/* Private ioctl to set the packet filtering params */
2680#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2681#endif
2682
2683
2684#ifdef FEATURE_WLAN_SCAN_PNO
2685/* Private ioctl to get the statistics */
2686#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2687#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302688/*
2689 * <ioctl>
2690 * SETBAND - Set the operational band
2691 *
2692 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2693 *
2694 * @OUTPUT: None
2695 *
2696 * This IOCTL Set the operational band If the new band is different from the
2697 * current operational band, it aborts the pending scan requests, flushes
2698 * the existing scan results, and then change * the band capability
2699 *
2700 * @E.g: iwpriv wlan0 SETBAND <value>
2701 *
2702 * Supported Feature: STA
2703 *
2704 * Usage: Internal/External
2705 *
2706 * </ioctl>
2707 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002708#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2709
Dustin Brown0cbc7572016-12-16 13:54:40 -08002710#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002711/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002712
2713/* Private ioctls and their sub-ioctls */
2714#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2715#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002716#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002717#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302718/* Private sub ioctl for enabling and setting histogram interval of profiling */
2719#define WE_ENABLE_FW_PROFILE 4
2720#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002721
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002722/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002723#define WE_SET_WLAN_SUSPEND 6
2724#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002725
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002726/*
2727 * <ioctl>
2728 * log_buffer - prints host/target related communication logs via dmesg
2729 *
2730 * @INPUT: Log Id, Count
2731 *
2732 * Log Id:
2733 * 0) HTC_CREDIT_HISTORY_LOG
2734 * 1) COMMAND_LOG,
2735 * 2) COMMAND_TX_CMP_LOG,
2736 * 3) MGMT_COMMAND_LOG,
2737 * 4) MGMT_COMMAND_TX_CMP_LOG,
2738 * 5) EVENT_LOG,
2739 * 6) RX_EVENT_LOG,
2740 * 7) MGMT_EVENT_LOG
2741 *
2742 * @OUTPUT: None
2743 *
2744 * @E.g:
2745 * # print up to 10 of the most recent records from HTC Credit History
2746 * iwpriv wlan0 log_buffer 0 10
2747 * # print up to 3 of the most recent records from Event Log
2748 * iwpriv wlan0 log_buffer 5 3
2749 *
2750 * Supported Feature: WLAN Trace
2751 *
2752 * Usage: Internal/External
2753 *
2754 * </ioctl>
2755 */
2756#define WE_LOG_BUFFER 8
2757
2758enum host_target_comm_log {
2759 HTC_CREDIT_HISTORY_LOG = 0,
2760 COMMAND_LOG,
2761 COMMAND_TX_CMP_LOG,
2762 MGMT_COMMAND_LOG,
2763 MGMT_COMMAND_TX_CMP_LOG,
2764 EVENT_LOG,
2765 RX_EVENT_LOG,
2766 MGMT_EVENT_LOG
2767};
2768
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002769/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2770
2771/* 802.11p IOCTL */
2772#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2773
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302774/*
2775 * <ioctl>
2776 * getLinkSpeed - Gets the current link speed in Mbps
2777 *
2778 * @INPUT: None
2779 *
2780 * @OUTPUT: linkspeed in mbps
2781 * wlan0 getLinkSpeed:7
2782 *
2783 * This IOCTL is used get the current link speed in Mbps
2784 *
2785 * @E.g: iwpriv wlan0 getLinkSpeed
2786 *
2787 * Supported Feature: STA
2788 *
2789 * Usage: Internal/External
2790 *
2791 * </ioctl>
2792 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002793#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2794
2795#define WLAN_STATS_INVALID 0
2796#define WLAN_STATS_RETRY_CNT 1
2797#define WLAN_STATS_MUL_RETRY_CNT 2
2798#define WLAN_STATS_TX_FRM_CNT 3
2799#define WLAN_STATS_RX_FRM_CNT 4
2800#define WLAN_STATS_FRM_DUP_CNT 5
2801#define WLAN_STATS_FAIL_CNT 6
2802#define WLAN_STATS_RTS_FAIL_CNT 7
2803#define WLAN_STATS_ACK_FAIL_CNT 8
2804#define WLAN_STATS_RTS_SUC_CNT 9
2805#define WLAN_STATS_RX_DISCARD_CNT 10
2806#define WLAN_STATS_RX_ERROR_CNT 11
2807#define WLAN_STATS_TX_BYTE_CNT 12
2808
2809#define WLAN_STATS_RX_BYTE_CNT 13
2810#define WLAN_STATS_RX_RATE 14
2811#define WLAN_STATS_TX_RATE 15
2812
2813#define WLAN_STATS_RX_UC_BYTE_CNT 16
2814#define WLAN_STATS_RX_MC_BYTE_CNT 17
2815#define WLAN_STATS_RX_BC_BYTE_CNT 18
2816#define WLAN_STATS_TX_UC_BYTE_CNT 19
2817#define WLAN_STATS_TX_MC_BYTE_CNT 20
2818#define WLAN_STATS_TX_BC_BYTE_CNT 21
2819
2820#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2821 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2822 *__p++ = __type; \
2823 *__p++ = __size; \
2824 memcpy(__p, __val, __size); \
2825 __p += __size; \
2826 __tlen += __size + 2; \
2827 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002828 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002829 } \
2830 } while (0)
2831
2832#define VERSION_VALUE_MAX_LEN 32
2833
2834#define TX_PER_TRACKING_DEFAULT_RATIO 5
2835#define TX_PER_TRACKING_MAX_RATIO 10
2836#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2837
2838#define WLAN_ADAPTER 0
2839#define P2P_ADAPTER 1
2840
2841/**
2842 * mem_alloc_copy_from_user_helper - copy from user helper
2843 * @wrqu_data: wireless extensions request data
2844 * @len: length of @wrqu_data
2845 *
2846 * Helper function to allocate buffer and copy user data.
2847 *
2848 * Return: On success return a pointer to a kernel buffer containing a
2849 * copy of the userspace data (with an additional NUL character
2850 * appended for safety). On failure return %NULL.
2851 */
2852void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2853{
2854 u8 *ptr = NULL;
2855
2856 /* in order to protect the code, an extra byte is post
2857 * appended to the buffer and the null termination is added.
2858 * However, when allocating (len+1) byte of memory, we need to
2859 * make sure that there is no uint overflow when doing
2860 * addition. In theory check len < UINT_MAX protects the uint
2861 * overflow. For wlan private ioctl, the buffer size is much
2862 * less than UINT_MAX, as a good guess, now, it is assumed
2863 * that the private command buffer size is no greater than 4K
2864 * (4096 bytes). So we use 4096 as the upper boundary for now.
2865 */
2866 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002867 hdd_err("Invalid length: %zu max: %u",
2868 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002869 return NULL;
2870 }
2871
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002872 ptr = qdf_mem_malloc(len + 1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002873 if (NULL == ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002874 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002875 return NULL;
2876 }
2877
2878 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002879 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002880 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002881 return NULL;
2882 }
2883 ptr[len] = '\0';
2884 return ptr;
2885}
2886
2887/**
2888 * hdd_priv_get_data() - Get pointer to ioctl private data
2889 * @p_priv_data: pointer to iw_point struct to be filled
2890 * @wrqu: Pointer to IOCTL Data received from userspace
2891 *
2892 * Helper function to get compatible struct iw_point passed to ioctl
2893 *
2894 * Return - 0 if p_priv_data successfully filled, error otherwise
2895 */
2896int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
2897{
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002898 if ((NULL == p_priv_data) || (NULL == wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002899 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002900
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002901#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07002902 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002903 struct compat_iw_point *p_compat_priv_data;
2904
2905 /* Compat task:
2906 * typecast to compat structure and copy the members.
2907 */
2908 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
2909
2910 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
2911 p_priv_data->length = p_compat_priv_data->length;
2912 p_priv_data->flags = p_compat_priv_data->flags;
2913 } else {
2914#endif /* #ifdef CONFIG_COMPAT */
2915
2916 /* Non compat task: directly copy the structure. */
2917 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
2918
2919#ifdef CONFIG_COMPAT
2920 }
2921#endif /* #ifdef CONFIG_COMPAT */
2922
2923 return 0;
2924}
2925
Jeff Johnson441e1f72017-02-07 08:50:49 -08002926static int hdd_check_wext_control(enum hdd_wext_control wext_control,
2927 struct iw_request_info *info)
2928{
2929 switch (wext_control) {
2930 default:
2931 case hdd_wext_disabled:
2932 hdd_err("Rejecting disabled ioctl %x", info->cmd);
2933 return -ENOTSUPP;
2934 case hdd_wext_deprecated:
2935 hdd_warn("Using deprecated ioctl %x", info->cmd);
2936 return 0;
2937 case hdd_wext_enabled:
2938 return 0;
2939 }
2940}
2941
Jeff Johnson82797b62017-08-11 15:31:27 -07002942int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08002943 struct iw_request_info *info)
2944{
2945 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
2946 info);
2947}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002948
2949/**
2950 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07002951 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002952 * @length: Size of the data copied
2953 * @buffer: Pointer to char buffer.
2954 * @buf_len: Length of the char buffer.
2955 *
2956 * This function called when the "iwpriv wlan0 get_stats" command is given.
2957 * It used to collect the txrx stats when the device is configured in SAP mode.
2958 *
2959 * Return - none
2960 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07002961void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002962 char *buffer, uint16_t buf_len)
2963{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002964 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002965 uint32_t len = 0;
2966 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
2967 uint32_t total_rx_delv = 0, total_rx_refused = 0;
2968 int i = 0;
2969
2970 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002971 total_rx_pkt += stats->rx_packets[i];
2972 total_rx_dropped += stats->rx_dropped[i];
2973 total_rx_delv += stats->rx_delivered[i];
2974 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002975 }
2976
2977 len = scnprintf(buffer, buf_len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002978 "\nTransmit[%lu] - "
Mohit Khannad0b63f52017-02-18 18:05:52 -08002979 "called %u, dropped %u orphan %u,"
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002980 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
2981 "\n[classified] BK %u, BE %u, VI %u, VO %u"
2982 "\n\nReceive[%lu] - "
2983 "packets %u, dropped %u, delivered %u, refused %u"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002984 "\n",
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002985 qdf_system_ticks(),
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002986 stats->tx_called,
2987 stats->tx_dropped,
2988 stats->tx_orphaned,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002989
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002990 stats->tx_dropped_ac[SME_AC_BK],
2991 stats->tx_dropped_ac[SME_AC_BE],
2992 stats->tx_dropped_ac[SME_AC_VI],
2993 stats->tx_dropped_ac[SME_AC_VO],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002994
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002995 stats->tx_classified_ac[SME_AC_BK],
2996 stats->tx_classified_ac[SME_AC_BE],
2997 stats->tx_classified_ac[SME_AC_VI],
2998 stats->tx_classified_ac[SME_AC_VO],
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002999 qdf_system_ticks(),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003000 total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused
3001 );
3002
3003 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003004 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003005 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003006 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003007 "Rx CPU[%d]:"
3008 "packets %u, dropped %u, delivered %u, refused %u\n",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003009 i, stats->rx_packets[i], stats->rx_dropped[i],
3010 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003011 }
3012
3013 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003014 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003015 "\nCurrent status: %s"
3016 "\ntx-flow timer start count %u"
3017 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003018 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3019 stats->txflow_timer_cnt,
3020 stats->txflow_pause_cnt,
3021 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003022
Leo Changfdb45c32016-10-28 11:09:23 -07003023 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnson1b780e42017-10-31 14:11:45 -07003024 adapter->session_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003025 *length = len + 1;
3026}
3027
3028/**
Dustin Brownd9322482017-01-09 12:46:03 -08003029 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3030 * @hdd_ctx: The Hdd context owning the stats to be written
3031 * @buffer: The char buffer to write to
3032 * @max_len: The maximum number of chars to write
3033 *
3034 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3035 *
3036 * Return - length of written content, negative number on error
3037 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003038#ifdef QCA_SUPPORT_CP_STATS
3039static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
3040 char *buffer, uint16_t max_len)
3041{
3042 int ret;
3043 QDF_STATUS status;
3044 struct suspend_resume_stats *sr_stats;
3045
3046 sr_stats = &hdd_ctx->suspend_resume_stats;
3047 ret = scnprintf(buffer, max_len,
3048 "\n"
3049 "Suspends: %u\n"
3050 "Resumes: %u\n"
3051 "\n"
3052 "Suspend Fail Reasons\n"
3053 "\tIPA: %u\n"
3054 "\tRadar: %u\n"
3055 "\tRoam: %u\n"
3056 "\tScan: %u\n"
3057 "\tInitial Wakeup: %u\n"
3058 "\n",
3059 sr_stats->suspends, sr_stats->resumes,
3060 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3061 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3062 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3063 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3064 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]);
3065
3066 status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->hdd_psoc,
3067 &buffer[ret], max_len - ret,
3068 &ret);
3069 if (QDF_IS_STATUS_ERROR(status)) {
3070 hdd_err("Failed to get WoW stats");
3071 return qdf_status_to_os_return(status);
3072 }
3073
3074 return ret;
3075}
3076#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003077static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
Dustin Brownd9322482017-01-09 12:46:03 -08003078 char *buffer, uint16_t max_len)
3079{
3080 QDF_STATUS status;
3081 struct suspend_resume_stats *sr_stats;
3082 struct sir_wake_lock_stats wow_stats;
3083
3084 sr_stats = &hdd_ctx->suspend_resume_stats;
3085
3086 status = wma_get_wakelock_stats(&wow_stats);
3087 if (QDF_IS_STATUS_ERROR(status)) {
3088 hdd_err("Failed to get WoW stats");
3089 return qdf_status_to_os_return(status);
3090 }
3091
3092 return scnprintf(buffer, max_len,
3093 "\n"
3094 "Suspends: %u\n"
3095 "Resumes: %u\n"
3096 "\n"
3097 "Suspend Fail Reasons\n"
3098 "\tIPA: %u\n"
3099 "\tRadar: %u\n"
3100 "\tRoam: %u\n"
3101 "\tScan: %u\n"
3102 "\tInitial Wakeup: %u\n"
3103 "\n"
3104 "WoW Wake Reasons\n"
3105 "\tunicast: %u\n"
3106 "\tbroadcast: %u\n"
3107 "\tIPv4 multicast: %u\n"
3108 "\tIPv6 multicast: %u\n"
3109 "\tIPv6 multicast RA: %u\n"
3110 "\tIPv6 multicast NS: %u\n"
3111 "\tIPv6 multicast NA: %u\n"
3112 "\tICMPv4: %u\n"
3113 "\tICMPv6: %u\n"
3114 "\tRSSI Breach: %u\n"
3115 "\tLow RSSI: %u\n"
3116 "\tG-Scan: %u\n"
3117 "\tPNO Complete: %u\n"
3118 "\tPNO Match: %u\n",
3119 sr_stats->suspends,
3120 sr_stats->resumes,
3121 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3122 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3123 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3124 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3125 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP],
3126 wow_stats.wow_ucast_wake_up_count,
3127 wow_stats.wow_bcast_wake_up_count,
3128 wow_stats.wow_ipv4_mcast_wake_up_count,
3129 wow_stats.wow_ipv6_mcast_wake_up_count,
3130 wow_stats.wow_ipv6_mcast_ra_stats,
3131 wow_stats.wow_ipv6_mcast_ns_stats,
3132 wow_stats.wow_ipv6_mcast_na_stats,
3133 wow_stats.wow_icmpv4_count,
3134 wow_stats.wow_icmpv6_count,
3135 wow_stats.wow_rssi_breach_wake_up_count,
3136 wow_stats.wow_low_rssi_wake_up_count,
3137 wow_stats.wow_gscan_wake_up_count,
3138 wow_stats.wow_pno_complete_wake_up_count,
3139 wow_stats.wow_pno_match_wake_up_count);
3140}
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003141#endif
Dustin Brownd9322482017-01-09 12:46:03 -08003142/**
Govind Singha471e5e2015-10-12 17:11:14 +05303143 * hdd_wlan_list_fw_profile() - Get fw profiling points
3144 * @length: Size of the data copied
3145 * @buffer: Pointer to char buffer.
3146 * @buf_len: Length of the char buffer.
3147 *
3148 * This function called when the "iwpriv wlan0 listProfile" command is given.
3149 * It is used to get the supported profiling points in FW.
3150 *
3151 * Return - none
3152 */
3153void hdd_wlan_list_fw_profile(uint16_t *length,
3154 char *buffer, uint16_t buf_len)
3155{
3156 uint32_t len = 0;
3157
3158 len = scnprintf(buffer, buf_len,
3159 "PROF_CPU_IDLE: %u\n"
3160 "PROF_PPDU_PROC: %u\n"
3161 "PROF_PPDU_POST: %u\n"
3162 "PROF_HTT_TX_INPUT: %u\n"
3163 "PROF_MSDU_ENQ: %u\n"
3164 "PROF_PPDU_POST_HAL: %u\n"
3165 "PROF_COMPUTE_TX_TIME: %u\n",
3166 PROF_CPU_IDLE,
3167 PROF_PPDU_PROC,
3168 PROF_PPDU_POST,
3169 PROF_HTT_TX_INPUT,
3170 PROF_MSDU_ENQ,
3171 PROF_PPDU_POST_HAL,
3172 PROF_COMPUTE_TX_TIME);
3173
3174 *length = len + 1;
3175}
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003176/**
3177 * hdd_display_stats_help() - print statistics help
3178 *
3179 * Return: none
3180 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003181static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003182{
Nirav Shahe6194ac2018-07-13 11:04:41 +05303183 hdd_nofl_info("iwpriv wlan0 dumpStats [option] - dump statistics");
3184 hdd_nofl_info("iwpriv wlan0 clearStats [option] - clear statistics");
3185 hdd_nofl_info("options:");
3186 hdd_nofl_info(" 1 -- TXRX PATH statistics");
3187 hdd_nofl_info(" 2 -- TXRX HIST statistics");
3188 hdd_nofl_info(" 3 -- TSO statistics");
3189 hdd_nofl_info(" 4 -- Network queue statistics");
3190 hdd_nofl_info(" 5 -- Flow control statistics");
3191 hdd_nofl_info(" 6 -- Per Layer statistics");
3192 hdd_nofl_info(" 7 -- Copy engine interrupt statistics");
3193 hdd_nofl_info(" 9 -- NAPI statistics");
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003194}
Govind Singha471e5e2015-10-12 17:11:14 +05303195
3196/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003197 * hdd_wlan_dump_stats() - display dump Stats
3198 * @adapter: adapter handle
3199 * @value: value from user
3200 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003201 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003202 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003203int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003204{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003205 int ret = 0;
3206 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003207 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003208
3209 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003210 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003211 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3212 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003213
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003214 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003215 wlan_hdd_display_netif_queue_history
3216 (hdd_ctx,
3217 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003218 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003219
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003220 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303221 hdd_display_hif_stats();
3222 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003223
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003224 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003225 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303226 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003227
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003228 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003229 if (hdd_display_napi_stats()) {
3230 hdd_err("error displaying napi stats");
3231 ret = EFAULT;
3232 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003233 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003234
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303235 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003236 sme_display_disconnect_stats(hdd_ctx->mac_handle,
3237 adapter->session_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303238 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003239
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003240 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003241 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003242 value,
3243 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003244 if (status == QDF_STATUS_E_INVAL) {
3245 hdd_display_stats_help();
3246 ret = EINVAL;
3247 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003248 break;
3249 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003250 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003251}
3252
3253/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003254 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003255 * @adapter: Adapter upon which the IBSS client is active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003256 * @staIdx: Station index of the IBSS peer
3257 *
3258 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3259 * otherwise an appropriate QDF_STATUS_E_* failure code.
3260 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003261static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnsonaf2a0932016-10-05 14:52:57 -07003262 uint8_t staIdx)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003263{
3264 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003265 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003266 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003267 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003268
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003269 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003270 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003271 hdd_get_ibss_peer_info_cb,
3272 false, staIdx);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003273
3274 if (QDF_STATUS_SUCCESS == status) {
3275 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003276
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003277 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003278 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003279 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3280 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003281 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003282 return QDF_STATUS_E_FAILURE;
3283 }
3284
3285 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003286 hdd_debug("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003287 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003288 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3289 uint32_t tx_rate = pPeerInfo->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003290
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003291 qdf_mem_copy(mac_addr, pPeerInfo->peerInfoParams[0].
3292 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003293 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003294 mac_addr, (int)tx_rate,
3295 (int)pPeerInfo->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003296 }
3297 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003298 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003299 }
3300
3301 return status;
3302}
3303
3304/**
3305 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003306 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003307 *
3308 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3309 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3310 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003311static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003312{
3313 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003314 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003315 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003316 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003317 int i;
3318
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003319 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003320 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003321 hdd_get_ibss_peer_info_cb,
3322 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003323
3324 if (QDF_STATUS_SUCCESS == status) {
3325 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003326
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003327 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003328 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003329 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3330 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003331 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003332 return QDF_STATUS_E_FAILURE;
3333 }
3334
3335 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003336 hdd_debug("pPeerInfo->numIBSSPeers = %d ",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003337 (int)pPeerInfo->numPeers);
3338 for (i = 0; i < pPeerInfo->numPeers; i++) {
3339 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3340 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003341
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003342 tx_rate = pPeerInfo->peerInfoParams[i].txRate;
3343 qdf_mem_copy(mac_addr,
3344 pPeerInfo->peerInfoParams[i].mac_addr,
3345 sizeof(mac_addr));
3346
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003347 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003348 mac_addr, (int)tx_rate,
3349 (int)pPeerInfo->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003350 }
3351 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003352 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003353 }
3354
3355 return status;
3356}
3357
3358/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303359 * hdd_get_ldpc() - Get adapter LDPC
3360 * @adapter: adapter being queried
3361 * @value: where to store the value
3362 *
3363 * Return: 0 on success, negative errno on failure
3364 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003365int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303366{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003367 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303368 int ret;
3369
Dustin Brown491d54b2018-03-14 12:39:11 -07003370 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003371 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303372 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3373 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003374 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303375 } else {
3376 *value = ret;
3377 ret = 0;
3378 }
3379 return ret;
3380}
3381
3382/**
3383 * hdd_set_ldpc() - Set adapter LDPC
3384 * @adapter: adapter being modified
3385 * @value: new LDPC value
3386 *
3387 * Return: 0 on success, negative errno on failure
3388 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003389int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303390{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003391 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303392 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003393 QDF_STATUS status;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003394 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3395 struct hdd_config *config = hdd_ctx->config;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303396 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303397
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003398 hdd_debug("%d", value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303399 if (value) {
3400 /* make sure HT capabilities allow this */
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003401 if (!config->enable_rx_ldpc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003402 hdd_err("LDCP not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303403 return -EINVAL;
3404 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003405 } else if (!config->enable_rx_ldpc) {
3406 hdd_err("LDCP is already disabled");
3407 return 0;
3408 }
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303409 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->hdd_psoc, &ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003410 if (QDF_STATUS_SUCCESS != status) {
3411 hdd_err("Failed to get HT capability info");
3412 return -EIO;
3413 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003414
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303415 ht_cap_info.advCodingCap = value;
3416 status = ucfg_mlme_set_ht_cap_info(hdd_ctx->hdd_psoc, ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003417 if (QDF_STATUS_SUCCESS != status) {
3418 hdd_err("Failed to set HT capability info");
3419 return -EIO;
3420 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003421 status = sme_cfg_set_int(mac_handle, WNI_CFG_VHT_LDPC_CODING_CAP,
3422 value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003423 if (QDF_STATUS_SUCCESS != status) {
3424 hdd_err("Failed to set VHT LDPC capability info");
3425 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303426 }
3427
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003428 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303429 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
3430 value);
3431 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003432 hdd_err("Failed to set LDPC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003433 ret = sme_update_he_ldpc_supp(mac_handle, adapter->session_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003434 if (ret)
3435 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303436
3437 return ret;
3438}
3439
3440/**
3441 * hdd_get_tx_stbc() - Get adapter TX STBC
3442 * @adapter: adapter being queried
3443 * @value: where to store the value
3444 *
3445 * Return: 0 on success, negative errno on failure
3446 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003447int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303448{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003449 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303450 int ret;
3451
Dustin Brown491d54b2018-03-14 12:39:11 -07003452 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003453 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303454 WNI_CFG_HT_CAP_INFO_TX_STBC);
3455 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003456 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303457 } else {
3458 *value = ret;
3459 ret = 0;
3460 }
3461
3462 return ret;
3463}
3464
3465/**
3466 * hdd_set_tx_stbc() - Set adapter TX STBC
3467 * @adapter: adapter being modified
3468 * @value: new TX STBC value
3469 *
3470 * Return: 0 on success, negative errno on failure
3471 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003472int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303473{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003474 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303475 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303476 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303477 QDF_STATUS status;
3478 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303479
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003480 hdd_debug("%d", value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303481 if (value) {
3482 /* make sure HT capabilities allow this */
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303483 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->hdd_psoc,
3484 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303485 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003486 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303487 return -EIO;
3488 }
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303489 if (!ht_cap_info.txSTBC) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003490 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303491 return -EINVAL;
3492 }
3493 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003494 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303495 WNI_CFG_HT_CAP_INFO_TX_STBC,
3496 value);
3497 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003498 hdd_err("Failed to set TX STBC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003499 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003500 if (ret)
3501 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303502
3503 return ret;
3504}
3505
3506/**
3507 * hdd_get_rx_stbc() - Get adapter RX STBC
3508 * @adapter: adapter being queried
3509 * @value: where to store the value
3510 *
3511 * Return: 0 on success, negative errno on failure
3512 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003513int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303514{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003515 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303516 int ret;
3517
Dustin Brown491d54b2018-03-14 12:39:11 -07003518 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003519 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303520 WNI_CFG_HT_CAP_INFO_RX_STBC);
3521 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003522 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303523 } else {
3524 *value = ret;
3525 ret = 0;
3526 }
3527
3528 return ret;
3529}
3530
3531/**
3532 * hdd_set_rx_stbc() - Set adapter RX STBC
3533 * @adapter: adapter being modified
3534 * @value: new RX STBC value
3535 *
3536 * Return: 0 on success, negative errno on failure
3537 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003538int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303539{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003540 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303541 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303542 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303543 QDF_STATUS status;
3544 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303545
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003546 hdd_debug("%d", value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303547 if (value) {
3548 /* make sure HT capabilities allow this */
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303549 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->hdd_psoc,
3550 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303551 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003552 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303553 return -EIO;
3554 }
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303555 if (!ht_cap_info.rxSTBC) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003556 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303557 return -EINVAL;
3558 }
3559 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003560 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303561 WNI_CFG_HT_CAP_INFO_RX_STBC,
3562 value);
3563 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003564 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303565
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003566 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003567 if (ret)
3568 hdd_err("Failed to set HE RX STBC value");
3569
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303570 return ret;
3571}
3572
3573/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003574 * iw_get_linkspeed() - Get current link speed ioctl
3575 * @dev: device upon which the ioctl was received
3576 * @info: ioctl request information
3577 * @wrqu: ioctl request data
3578 * @extra: extra ioctl buffer
3579 *
3580 * Return: 0 on success, non-zero on error
3581 */
3582static int __iw_get_linkspeed(struct net_device *dev,
3583 struct iw_request_info *info,
3584 union iwreq_data *wrqu, char *extra)
3585{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003586 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003587 char *pLinkSpeed = (char *)extra;
3588 int len = sizeof(uint32_t) + 1;
3589 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003590 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003591 int ret;
3592 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003593
Dustin Brownfdf17c12018-03-14 12:55:34 -07003594 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303595
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003596 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003597 ret = wlan_hdd_validate_context(hdd_ctx);
3598 if (0 != ret)
3599 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003600
Jeff Johnson441e1f72017-02-07 08:50:49 -08003601 ret = hdd_check_private_wext_control(hdd_ctx, info);
3602 if (0 != ret)
3603 return ret;
3604
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003605 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003606 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003607 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003608
3609 wrqu->data.length = len;
3610 /* return the linkspeed as a string */
3611 rc = snprintf(pLinkSpeed, len, "%u", link_speed);
3612 if ((rc < 0) || (rc >= len)) {
3613 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003614 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003615 return -EIO;
3616 }
3617
Dustin Browne74003f2018-03-14 12:51:58 -07003618 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003619 /* a value is being successfully returned */
3620 return 0;
3621}
3622
3623static int iw_get_linkspeed(struct net_device *dev,
3624 struct iw_request_info *info,
3625 union iwreq_data *wrqu, char *extra)
3626{
3627 int ret;
3628
3629 cds_ssr_protect(__func__);
3630 ret = __iw_get_linkspeed(dev, info, wrqu, extra);
3631 cds_ssr_unprotect(__func__);
3632
3633 return ret;
3634}
3635
3636/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003637 * wlan_hdd_update_phymode() - handle change in PHY mode
3638 * @net: device upon which PHY mode change was received
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003639 * @mac_handle: umac handle for the driver
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003640 * @new_phymode: new PHY mode for the device
3641 * @phddctx: pointer to the HDD context
3642 *
3643 * This function is called when the device is set to a new PHY mode.
3644 * It takes a holistic look at the desired PHY mode along with the
3645 * configured capabilities of the driver and the reported capabilities
3646 * of the hardware in order to correctly configure all PHY-related
3647 * parameters.
3648 *
3649 * Return: 0 on success, negative errno value on error
3650 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003651int wlan_hdd_update_phymode(struct net_device *net, mac_handle_t mac_handle,
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003652 int new_phymode, struct hdd_context *phddctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003653{
3654#ifdef QCA_HT_2040_COEX
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003655 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303656 QDF_STATUS halStatus = QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003657#endif
3658 bool band_24 = false, band_5g = false;
3659 bool ch_bond24 = false, ch_bond5g = false;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303660 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003661 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003662 uint32_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003663 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07003664 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003665 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303666 int retval = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003667
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003668 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003669
3670 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
3671 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
3672 nChannelBondingMode24GHz))
3673 ch_bond24 = true;
3674
3675 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
3676 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
3677 nChannelBondingMode5GHz))
3678 ch_bond5g = true;
3679
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003680 if (phddctx->config->nBandCapability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003681 band_24 = band_5g = true;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003682 else if (phddctx->config->nBandCapability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003683 band_24 = true;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003684 else if (phddctx->config->nBandCapability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003685 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003686
3687 vhtchanwidth = phddctx->config->vhtChannelWidth;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003688 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 -08003689 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3690
3691 switch (new_phymode) {
3692 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003693 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003694 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003695 phymode = eCSR_DOT11_MODE_AUTO;
3696 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3697 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003698 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003699 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3700 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003701 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003702 return -EIO;
3703 }
3704 break;
3705 case IEEE80211_MODE_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003706 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003707 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003708 phymode = eCSR_DOT11_MODE_11a;
3709 hdd_dot11mode = eHDD_DOT11_MODE_11a;
3710 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003711 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003712 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003713 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003714 return -EIO;
3715 }
3716 break;
3717 case IEEE80211_MODE_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003718 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003719 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003720 phymode = eCSR_DOT11_MODE_11b;
3721 hdd_dot11mode = eHDD_DOT11_MODE_11b;
3722 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003723 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003724 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003725 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003726 return -EIO;
3727 }
3728 break;
3729 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003730 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003731 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003732 phymode = eCSR_DOT11_MODE_11g;
3733 hdd_dot11mode = eHDD_DOT11_MODE_11g;
3734 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003735 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003736 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003737 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003738 return -EIO;
3739 }
3740 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07003741 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003742 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
3743 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
3744 */
3745 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003746 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003747 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003748 phymode = eCSR_DOT11_MODE_11n;
3749 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3750 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003751 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003752 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003753 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003754 return -EIO;
3755 }
3756 break;
3757 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003758 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003759 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003760 phymode = eCSR_DOT11_MODE_11n;
3761 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3762 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003763 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003764 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003765 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003766 return -EIO;
3767 }
3768 break;
3769 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003770 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003771 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003772 phymode = eCSR_DOT11_MODE_11n;
3773 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3774 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003775 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003776 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003777 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003778 return -EIO;
3779 }
3780 break;
3781 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003782 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003783 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003784 phymode = eCSR_DOT11_MODE_11n;
3785 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3786 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003787 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003788 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003789 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003790 return -EIO;
3791 }
3792 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003793 case IEEE80211_MODE_11AC_VHT20:
3794 case IEEE80211_MODE_11AC_VHT40:
3795 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003796 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003797 phymode = eCSR_DOT11_MODE_11ac;
3798 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
3799 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3800 if (band_5g && band_24) {
3801 curr_band = BAND_ALL;
3802 break;
3803 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003804 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003805 break;
3806 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
3807 curr_band = BAND_2G;
3808 break;
3809 }
3810 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
3811 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003812 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003813 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003814 return -EIO;
3815 }
3816 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003817 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003818 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003819 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003820 phymode = eCSR_DOT11_MODE_AUTO;
3821 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3822 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003823 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003824 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003825 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003826 return -EIO;
3827 }
3828 break;
3829 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003830 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003831 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003832 phymode = eCSR_DOT11_MODE_AUTO;
3833 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3834 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3835 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003836 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003837 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003838 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003839 return -EIO;
3840 }
3841 break;
3842 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003843 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003844 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003845 phymode = eCSR_DOT11_MODE_11n;
3846 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3847 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003848 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003849 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003850 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003851 return -EIO;
3852 }
3853 break;
3854 default:
3855 return -EIO;
3856 }
3857
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003858 switch (new_phymode) {
3859 case IEEE80211_MODE_11AC_VHT20:
3860 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3861 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
3862 break;
3863 case IEEE80211_MODE_11AC_VHT40:
3864 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
3865 break;
3866 case IEEE80211_MODE_11AC_VHT80:
3867 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3868 break;
3869 default:
3870 vhtchanwidth = phddctx->config->vhtChannelWidth;
3871 break;
3872 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003873
3874 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303875 sme_config = qdf_mem_malloc(sizeof(*sme_config));
3876 if (!sme_config) {
3877 hdd_err("Failed to allocate memory for sme_config");
3878 return -ENOMEM;
3879 }
3880 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003881 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303882 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003883#ifdef QCA_HT_2040_COEX
3884 if (phymode == eCSR_DOT11_MODE_11n &&
3885 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303886 sme_config->csrConfig.obssEnabled = false;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003887 halStatus = sme_set_ht2040_mode(mac_handle,
Jeff Johnson1b780e42017-10-31 14:11:45 -07003888 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003889 eHT_CHAN_HT20, false);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303890 if (halStatus == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003891 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303892 retval = -EIO;
3893 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003894 }
3895 } else if (phymode == eCSR_DOT11_MODE_11n &&
3896 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303897 sme_config->csrConfig.obssEnabled = true;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003898 halStatus = sme_set_ht2040_mode(mac_handle,
Jeff Johnson1b780e42017-10-31 14:11:45 -07003899 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003900 eHT_CHAN_HT20, true);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303901 if (halStatus == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003902 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303903 retval = -EIO;
3904 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003905 }
3906 }
3907#endif
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303908 sme_config->csrConfig.eBand = curr_band;
3909 sme_config->csrConfig.bandCapability = curr_band;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003910 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303911 sme_config->csrConfig.Is11hSupportEnabled = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003912 else
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303913 sme_config->csrConfig.Is11hSupportEnabled =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003914 phddctx->config->Is11hSupportEnabled;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003915 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303916 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07003917 else if (curr_band == BAND_5G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303918 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003919 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303920 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
3921 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003922 }
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303923 sme_config->csrConfig.nVhtChannelWidth = vhtchanwidth;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003924 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003925
3926 phddctx->config->dot11Mode = hdd_dot11mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003927 phddctx->config->nChannelBondingMode24GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303928 sme_config->csrConfig.channelBondingMode24GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003929 phddctx->config->nChannelBondingMode5GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303930 sme_config->csrConfig.channelBondingMode5GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003931 phddctx->config->vhtChannelWidth = vhtchanwidth;
Krunal Sonidf0f8742016-09-26 14:56:31 -07003932 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003933 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303934 retval = -EIO;
3935 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003936 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05303937
3938 if (band_5g) {
3939 struct ieee80211_supported_band *band;
3940
3941 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
3942 if (phddctx->config->nChannelBondingMode5GHz)
3943 band->ht_cap.cap |=
3944 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3945 else
3946 band->ht_cap.cap &=
3947 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3948 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003949
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003950 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003951 phymode, chwidth, curr_band, vhtchanwidth);
3952 }
3953
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303954free:
3955 if (sme_config)
3956 qdf_mem_free(sme_config);
3957 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003958}
3959
Jeff Johnson011c4502017-10-05 15:25:56 -07003960static int hdd_validate_pdev_reset(int value)
3961{
3962 if ((value < 1) || (value > 5)) {
3963 hdd_warn(" Invalid value %d: Use any one of the below values\n"
3964 " TX_FLUSH = 1\n"
3965 " WARM_RESET = 2\n"
3966 " COLD_RESET = 3\n"
3967 " WARM_RESET_RESTORE_CAL = 4\n"
3968 " COLD_RESET_RESTORE_CAL = 5", value);
3969
3970 return -EINVAL;
3971 }
3972
3973 return 0;
3974}
3975
3976static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
3977{
3978 int ret;
3979
3980 hdd_debug("%d", value);
3981
3982 ret = hdd_validate_pdev_reset(value);
3983 if (ret)
3984 return ret;
3985
Jeff Johnson1b780e42017-10-31 14:11:45 -07003986 ret = wma_cli_set_command(adapter->session_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07003987 WMI_PDEV_PARAM_PDEV_RESET,
3988 value, PDEV_CMD);
3989
3990 return ret;
3991}
3992
Dustin Brown65a6f0d2018-04-26 10:54:41 -07003993static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
3994{
3995 int errno;
3996 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3997 ePhyChanBondState bonding_state;
3998 uint32_t bonding_mode;
3999 tSmeConfigParams *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004000 mac_handle_t mac_handle;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004001
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004002 mac_handle = hdd_ctx->mac_handle;
4003 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004004 return -EINVAL;
4005
4006 /* updating channel bonding only on 5Ghz */
4007 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4008
4009 switch (ch_width) {
4010 case eHT_CHANNEL_WIDTH_20MHZ:
4011 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4012 break;
4013
4014 case eHT_CHANNEL_WIDTH_40MHZ:
4015 case eHT_CHANNEL_WIDTH_80MHZ:
4016 bonding_state = csr_convert_cb_ini_value_to_phy_cb_state(
4017 hdd_ctx->config->nChannelBondingMode5GHz);
4018
4019 if (bonding_state == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE)
4020 return -EINVAL;
4021
4022 bonding_mode = hdd_ctx->config->nChannelBondingMode5GHz;
4023 break;
4024
4025 default:
4026 hdd_err("Invalid channel width 0->20 1->40 2->80");
4027 return -EINVAL;
4028 }
4029
4030 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4031 if (!sme_config) {
4032 hdd_err("failed to allocate memory for sme_config");
4033 return -ENOMEM;
4034 }
4035
4036 errno = wma_cli_set_command(adapter->session_id, WMI_VDEV_PARAM_CHWIDTH,
4037 ch_width, VDEV_CMD);
4038 if (errno)
4039 goto free_config;
4040
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004041 sme_get_config_param(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004042 sme_config->csrConfig.channelBondingMode5GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004043 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004044
4045free_config:
4046 qdf_mem_free(sme_config);
4047
4048 return errno;
4049}
4050
Dustin Brownd90f61a2018-04-26 12:25:58 -07004051static int hdd_we_set_11d_state(struct hdd_context *hdd_ctx, int state_11d)
4052{
4053 tSmeConfigParams *sme_config;
4054 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004055 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004056
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004057 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004058 return -EINVAL;
4059
4060 switch (state_11d) {
4061 case ENABLE_11D:
4062 enable_11d = true;
4063 break;
4064 case DISABLE_11D:
4065 enable_11d = false;
4066 break;
4067 default:
4068 return -EINVAL;
4069 }
4070
4071 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4072 if (!sme_config) {
4073 hdd_err("failed to allocate memory for sme_config");
4074 return -ENOMEM;
4075 }
4076
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004077 sme_get_config_param(mac_handle, sme_config);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004078 sme_config->csrConfig.Is11dSupportEnabled = enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004079 sme_update_config(mac_handle, sme_config);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004080
4081 qdf_mem_free(sme_config);
4082
Dustin Brownea82d562018-05-23 12:07:16 -07004083 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004084
4085 return 0;
4086}
4087
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004088/**
4089 * iw_setint_getnone() - Generic "set integer" private ioctl handler
4090 * @dev: device upon which the ioctl was received
4091 * @info: ioctl request information
4092 * @wrqu: ioctl request data
4093 * @extra: ioctl extra data
4094 *
4095 * Return: 0 on success, non-zero on error
4096 */
4097static int __iw_setint_getnone(struct net_device *dev,
4098 struct iw_request_info *info,
4099 union iwreq_data *wrqu, char *extra)
4100{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004101 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004102 mac_handle_t mac_handle;
Jeff Johnsond377dce2017-10-04 10:32:42 -07004103 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07004104 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004105 int *value = (int *)extra;
4106 int sub_cmd = value[0];
4107 int set_value = value[1];
4108 int ret;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304109 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004110
Dustin Brownfdf17c12018-03-14 12:55:34 -07004111 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05304112
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004113 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004114 ret = wlan_hdd_validate_context(hdd_ctx);
4115 if (0 != ret)
4116 return ret;
4117
Jeff Johnson441e1f72017-02-07 08:50:49 -08004118 ret = hdd_check_private_wext_control(hdd_ctx, info);
4119 if (0 != ret)
4120 return ret;
4121
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004122 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004123 switch (sub_cmd) {
4124 case WE_SET_11D_STATE:
Dustin Brownd90f61a2018-04-26 12:25:58 -07004125 ret = hdd_we_set_11d_state(hdd_ctx, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004126 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004127
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004128 case WE_SET_POWER:
4129 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004130 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304131 return -EINVAL;
4132
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004133 switch (set_value) {
4134 case 1:
4135 /* Enable PowerSave */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004136 sme_ps_enable_disable(mac_handle, adapter->session_id,
4137 SME_PS_ENABLE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004138 break;
4139 case 2:
4140 /* Disable PowerSave */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004141 sme_ps_enable_disable(mac_handle, adapter->session_id,
4142 SME_PS_DISABLE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004143 break;
4144 case 3: /* Enable UASPD */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004145 sme_ps_uapsd_enable(mac_handle, adapter->session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004146 break;
4147 case 4: /* Disable UASPD */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004148 sme_ps_uapsd_disable(mac_handle, adapter->session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004149 break;
4150 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07004151 hdd_err("Invalid arg %d in WE_SET_POWER IOCTL",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004152 set_value);
4153 ret = -EINVAL;
4154 break;
4155 }
4156 break;
4157 }
4158
4159 case WE_SET_MAX_ASSOC:
4160 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004161 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304162 return -EINVAL;
4163
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004164 if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) ||
4165 (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) {
4166 ret = -EINVAL;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004167 } else if (sme_cfg_set_int(mac_handle, WNI_CFG_ASSOC_STA_LIMIT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004168 set_value)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304169 != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004170 hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004171 ret = -EIO;
4172 }
4173 break;
4174 }
4175
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004176 case WE_SET_DATA_INACTIVITY_TO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004177 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304178 return -EINVAL;
4179
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004180 if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) ||
4181 (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) ||
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004182 (sme_cfg_set_int(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004183 WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304184 set_value) == QDF_STATUS_E_FAILURE)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004185 hdd_err("WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004186 ret = -EINVAL;
4187 }
4188 break;
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05304189 case WE_SET_WOW_DATA_INACTIVITY_TO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004190 if (!mac_handle) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304191 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004192 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304193 }
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05304194
4195 if ((set_value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) ||
4196 (set_value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX) ||
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004197 (sme_cfg_set_int(mac_handle,
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05304198 WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT,
4199 set_value) == QDF_STATUS_E_FAILURE)) {
4200 hdd_err("WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT fail");
4201 ret = -EINVAL;
4202 }
4203 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004204 case WE_SET_MC_RATE:
4205 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004206 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304207 return -EINVAL;
4208
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004209 ret = wlan_hdd_set_mc_rate(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004210 break;
4211 }
4212 case WE_SET_TX_POWER:
4213 {
Anurag Chouhan6d760662016-02-20 16:05:43 +05304214 struct qdf_mac_addr bssid;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004215
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004216 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304217 return -EINVAL;
4218
Jeff Johnsond377dce2017-10-04 10:32:42 -07004219 qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004220 if (sme_set_tx_power
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004221 (mac_handle, adapter->session_id, bssid,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004222 adapter->device_mode,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304223 set_value) != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004224 hdd_err("Setting tx power failed");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304225 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004226 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004227 }
4228 break;
4229 }
4230 case WE_SET_MAX_TX_POWER:
4231 {
Anurag Chouhan6d760662016-02-20 16:05:43 +05304232 struct qdf_mac_addr bssid;
4233 struct qdf_mac_addr selfMac;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004234
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004235 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304236 return -EINVAL;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004237
4238 hdd_debug("Setting maximum tx power %d dBm",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004239 set_value);
Jeff Johnsond377dce2017-10-04 10:32:42 -07004240 qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId);
4241 qdf_copy_macaddr(&selfMac, &sta_ctx->conn_info.bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004242
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004243 if (sme_set_max_tx_power(mac_handle, bssid, selfMac, set_value)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304244 != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004245 hdd_err("Setting maximum tx power failed");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304246 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004247 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004248 }
4249
4250 break;
4251 }
4252 case WE_SET_MAX_TX_POWER_2_4:
4253 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004254 hdd_debug("Setting maximum tx power %d dBm for 2.4 GHz band",
Jeff Johnson99bac312016-06-28 10:38:18 -07004255 set_value);
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004256 if (sme_set_max_tx_power_per_band(BAND_2G, set_value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304257 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004258 hdd_err("Setting max tx power failed for 2.4 GHz band");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304259 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004260 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004261 }
4262
4263 break;
4264 }
4265 case WE_SET_MAX_TX_POWER_5_0:
4266 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004267 hdd_debug("Setting maximum tx power %d dBm for 5.0 GHz band",
Jeff Johnson99bac312016-06-28 10:38:18 -07004268 set_value);
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004269 if (sme_set_max_tx_power_per_band(BAND_5G, set_value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304270 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004271 hdd_err("Setting max tx power failed for 5.0 GHz band");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304272 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004273 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004274 }
4275
4276 break;
4277 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004278
4279 case WE_SET_TM_LEVEL:
4280 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004281 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304282 return -EINVAL;
4283
Dustin Brown5e89ef82018-03-14 11:50:23 -07004284 hdd_debug("Set Thermal Mitigation Level %d", set_value);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004285 (void)sme_set_thermal_level(mac_handle, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004286 break;
4287 }
4288
4289 case WE_SET_PHYMODE:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004290 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304291 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004292
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004293 ret = wlan_hdd_update_phymode(dev, mac_handle, set_value,
4294 hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004295 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004296
4297 case WE_SET_NSS:
4298 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004299 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304300 return -EINVAL;
4301
Dustin Brown5e89ef82018-03-14 11:50:23 -07004302 hdd_debug("Set NSS = %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004303 if ((set_value > 2) || (set_value <= 0)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004304 hdd_err("NSS greater than 2 not supported");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004305 ret = -EINVAL;
4306 } else {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304307 if (QDF_STATUS_SUCCESS !=
Kiran Kumar Lokere44a29432018-01-24 16:10:30 -08004308 hdd_update_nss(adapter, set_value))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004309 ret = -EINVAL;
4310 }
4311 break;
4312 }
4313
4314 case WE_SET_GTX_HT_MCS:
4315 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004316 hdd_debug("WMI_VDEV_PARAM_GTX_HT_MCS %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004317 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004318 WMI_VDEV_PARAM_GTX_HT_MCS,
4319 set_value, GTX_CMD);
4320 break;
4321 }
4322
4323 case WE_SET_GTX_VHT_MCS:
4324 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004325 hdd_debug("WMI_VDEV_PARAM_GTX_VHT_MCS %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004326 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004327 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004328 WMI_VDEV_PARAM_GTX_VHT_MCS,
4329 set_value, GTX_CMD);
4330 break;
4331 }
4332
4333 case WE_SET_GTX_USRCFG:
4334 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004335 hdd_debug("WMI_VDEV_PARAM_GTX_USR_CFG %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004336 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004337 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004338 WMI_VDEV_PARAM_GTX_USR_CFG,
4339 set_value, GTX_CMD);
4340 break;
4341 }
4342
4343 case WE_SET_GTX_THRE:
4344 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004345 hdd_debug("WMI_VDEV_PARAM_GTX_THRE %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004346 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004347 WMI_VDEV_PARAM_GTX_THRE,
4348 set_value, GTX_CMD);
4349 break;
4350 }
4351
4352 case WE_SET_GTX_MARGIN:
4353 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004354 hdd_debug("WMI_VDEV_PARAM_GTX_MARGIN %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004355 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004356 WMI_VDEV_PARAM_GTX_MARGIN,
4357 set_value, GTX_CMD);
4358 break;
4359 }
4360
4361 case WE_SET_GTX_STEP:
4362 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004363 hdd_debug("WMI_VDEV_PARAM_GTX_STEP %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004364 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004365 WMI_VDEV_PARAM_GTX_STEP,
4366 set_value, GTX_CMD);
4367 break;
4368 }
4369
4370 case WE_SET_GTX_MINTPC:
4371 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004372 hdd_debug("WMI_VDEV_PARAM_GTX_MINTPC %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004373 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004374 WMI_VDEV_PARAM_GTX_MINTPC,
4375 set_value, GTX_CMD);
4376 break;
4377 }
4378
4379 case WE_SET_GTX_BWMASK:
4380 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004381 hdd_debug("WMI_VDEV_PARAM_GTX_BWMASK %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004382 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004383 WMI_VDEV_PARAM_GTX_BW_MASK,
4384 set_value, GTX_CMD);
4385 break;
4386 }
4387
4388 case WE_SET_LDPC:
4389 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004390 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304391 return -EINVAL;
4392
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004393 ret = hdd_set_ldpc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004394 break;
4395 }
4396
4397 case WE_SET_TX_STBC:
4398 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004399 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304400 return -EINVAL;
4401
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004402 ret = hdd_set_tx_stbc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004403 break;
4404 }
4405
4406 case WE_SET_RX_STBC:
4407 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004408 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304409 return -EINVAL;
4410
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004411 ret = hdd_set_rx_stbc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004412 break;
4413 }
4414
4415 case WE_SET_SHORT_GI:
4416 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004417 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304418 return -EINVAL;
4419
Dustin Brown5e89ef82018-03-14 11:50:23 -07004420 hdd_debug("WMI_VDEV_PARAM_SGI val %d", set_value);
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08004421 if (set_value & HDD_AUTO_RATE_SGI)
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004422 ret = sme_set_auto_rate_he_sgi(mac_handle,
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08004423 adapter->session_id,
4424 set_value);
4425 else
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004426 ret = sme_update_ht_config(mac_handle,
4427 adapter->session_id,
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08004428 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4429 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004430 if (ret)
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08004431 hdd_err("Failed to set ShortGI value %d", set_value);
4432
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004433 break;
4434 }
4435
4436 case WE_SET_RTSCTS:
4437 {
4438 uint32_t value;
4439
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004440 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304441 return -EINVAL;
4442
Dustin Brown5e89ef82018-03-14 11:50:23 -07004443 hdd_debug("WMI_VDEV_PARAM_ENABLE_RTSCTS val 0x%x", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004444
4445 if ((set_value & HDD_RTSCTS_EN_MASK) ==
4446 HDD_RTSCTS_ENABLE)
4447 value =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004448 (WLAN_HDD_GET_CTX(adapter))->config->
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004449 RTSThreshold;
4450 else if (((set_value & HDD_RTSCTS_EN_MASK) == 0)
4451 || ((set_value & HDD_RTSCTS_EN_MASK) ==
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304452 HDD_CTS_ENABLE)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004453 value = WNI_CFG_RTS_THRESHOLD_STAMAX;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304454 } else {
4455 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004456 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304457 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004458
Jeff Johnson1b780e42017-10-31 14:11:45 -07004459 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004460 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4461 set_value, VDEV_CMD);
4462 if (!ret) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004463 if (sme_cfg_set_int(mac_handle, WNI_CFG_RTS_THRESHOLD,
4464 value) != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004465 hdd_err("FAILED TO SET RTSCTS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304466 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004467 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004468 }
4469 }
4470
4471 break;
4472 }
4473
4474 case WE_SET_CHWIDTH:
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004475 ret = hdd_we_set_ch_width(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004476 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004477
4478 case WE_SET_ANI_EN_DIS:
4479 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004480 hdd_debug("WMI_PDEV_PARAM_ANI_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004481 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004482 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004483 WMI_PDEV_PARAM_ANI_ENABLE,
4484 set_value, PDEV_CMD);
4485 break;
4486 }
4487
4488 case WE_SET_ANI_POLL_PERIOD:
4489 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004490 hdd_debug("WMI_PDEV_PARAM_ANI_POLL_PERIOD val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004491 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004492 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004493 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
4494 set_value, PDEV_CMD);
4495 break;
4496 }
4497
4498 case WE_SET_ANI_LISTEN_PERIOD:
4499 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004500 hdd_debug("WMI_PDEV_PARAM_ANI_LISTEN_PERIOD val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004501 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004502 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004503 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
4504 set_value, PDEV_CMD);
4505 break;
4506 }
4507
4508 case WE_SET_ANI_OFDM_LEVEL:
4509 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004510 hdd_debug("WMI_PDEV_PARAM_ANI_OFDM_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004511 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004512 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004513 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
4514 set_value, PDEV_CMD);
4515 break;
4516 }
4517
4518 case WE_SET_ANI_CCK_LEVEL:
4519 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004520 hdd_debug("WMI_PDEV_PARAM_ANI_CCK_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004521 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004522 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004523 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
4524 set_value, PDEV_CMD);
4525 break;
4526 }
4527
4528 case WE_SET_DYNAMIC_BW:
4529 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004530 hdd_debug("WMI_PDEV_PARAM_DYNAMIC_BW val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004531 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004532 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004533 WMI_PDEV_PARAM_DYNAMIC_BW,
4534 set_value, PDEV_CMD);
4535 break;
4536 }
4537
4538 case WE_SET_CTS_CBW:
4539 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004540 hdd_debug("WE_SET_CTS_CBW val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004541 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004542 WMI_PDEV_PARAM_CTS_CBW,
4543 set_value, PDEV_CMD);
4544 break;
4545 }
4546
4547 case WE_SET_11N_RATE:
4548 {
4549 uint8_t preamble = 0, nss = 0, rix = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004550
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004551 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004552 set_value);
4553
4554 if (set_value != 0xff) {
4555 rix = RC_2_RATE_IDX(set_value);
4556 if (set_value & 0x80) {
4557 preamble = WMI_RATE_PREAMBLE_HT;
4558 nss = HT_RC_2_STREAMS(set_value) - 1;
4559 } else {
4560 nss = 0;
4561 rix = RC_2_RATE_IDX(set_value);
4562 if (set_value & 0x10) {
4563 preamble =
4564 WMI_RATE_PREAMBLE_CCK;
4565 if (rix != 0x3)
4566 /* Enable Short
4567 * preamble always for
4568 * CCK except 1mbps
4569 */
4570 rix |= 0x4;
4571 } else {
4572 preamble =
4573 WMI_RATE_PREAMBLE_OFDM;
4574 }
4575 }
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08004576 set_value = hdd_assemble_rate_code(preamble, nss, rix);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004577 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004578 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004579 set_value, rix, preamble, nss);
4580
Jeff Johnson1b780e42017-10-31 14:11:45 -07004581 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004582 WMI_VDEV_PARAM_FIXED_RATE,
4583 set_value, VDEV_CMD);
4584 break;
4585 }
4586
4587 case WE_SET_VHT_RATE:
4588 {
4589 uint8_t preamble = 0, nss = 0, rix = 0;
4590
4591 if (set_value != 0xff) {
4592 rix = RC_2_RATE_IDX_11AC(set_value);
4593 preamble = WMI_RATE_PREAMBLE_VHT;
4594 nss = HT_RC_2_STREAMS_11AC(set_value) - 1;
4595
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08004596 set_value = hdd_assemble_rate_code(preamble, nss, rix);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004597 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004598 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004599 set_value, rix, preamble, nss);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004600 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004601 WMI_VDEV_PARAM_FIXED_RATE,
4602 set_value, VDEV_CMD);
4603 break;
4604 }
4605
4606 case WE_SET_AMPDU:
4607 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004608 hdd_debug("SET AMPDU val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004609 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004610 GEN_VDEV_PARAM_AMPDU,
4611 set_value, GEN_CMD);
4612 break;
4613 }
4614
4615 case WE_SET_AMSDU:
4616 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004617 hdd_debug("SET AMSDU val %d", set_value);
Arif Hussain0e246802018-05-01 18:13:44 -07004618 if (set_value > 1)
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004619 sme_set_amsdu(mac_handle, true);
Arif Hussain0e246802018-05-01 18:13:44 -07004620 else
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004621 sme_set_amsdu(mac_handle, false);
Arif Hussain0e246802018-05-01 18:13:44 -07004622
Jeff Johnson1b780e42017-10-31 14:11:45 -07004623 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004624 GEN_VDEV_PARAM_AMSDU,
4625 set_value, GEN_CMD);
Deepak Dhamdhere612392c2016-08-28 02:56:51 -07004626 /* Update the stored ini value */
4627 if (!ret)
4628 hdd_ctx->config->max_amsdu_num = set_value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004629 break;
4630 }
4631
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004632 case WE_SET_TX_CHAINMASK:
4633 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004634 hdd_debug("WMI_PDEV_PARAM_TX_CHAIN_MASK val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004635 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004636 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004637 WMI_PDEV_PARAM_TX_CHAIN_MASK,
4638 set_value, PDEV_CMD);
Abhishek Singh1571ca72018-04-17 15:14:21 +05304639 ret = hdd_set_antenna_mode(adapter, hdd_ctx, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004640 break;
4641 }
4642
4643 case WE_SET_RX_CHAINMASK:
4644 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004645 hdd_debug("WMI_PDEV_PARAM_RX_CHAIN_MASK val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004646 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004647 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004648 WMI_PDEV_PARAM_RX_CHAIN_MASK,
4649 set_value, PDEV_CMD);
Abhishek Singh1571ca72018-04-17 15:14:21 +05304650 ret = hdd_set_antenna_mode(adapter, hdd_ctx, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004651 break;
4652 }
4653
4654 case WE_SET_TXPOW_2G:
4655 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004656 hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT2G val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004657 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004658 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004659 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
4660 set_value, PDEV_CMD);
4661 break;
4662 }
4663
4664 case WE_SET_TXPOW_5G:
4665 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004666 hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT5G val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004667 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004668 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004669 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
4670 set_value, PDEV_CMD);
4671 break;
4672 }
4673
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004674 /* Firmware debug log */
4675 case WE_DBGLOG_LOG_LEVEL:
4676 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004677 hdd_debug("WE_DBGLOG_LOG_LEVEL val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004678 hdd_ctx->fw_log_settings.dl_loglevel = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004679 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004680 WMI_DBGLOG_LOG_LEVEL,
4681 set_value, DBG_CMD);
4682 break;
4683 }
4684
4685 case WE_DBGLOG_VAP_ENABLE:
4686 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004687 hdd_debug("WE_DBGLOG_VAP_ENABLE val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004688 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004689 WMI_DBGLOG_VAP_ENABLE,
4690 set_value, DBG_CMD);
4691 break;
4692 }
4693
4694 case WE_DBGLOG_VAP_DISABLE:
4695 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004696 hdd_debug("WE_DBGLOG_VAP_DISABLE val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004697 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004698 WMI_DBGLOG_VAP_DISABLE,
4699 set_value, DBG_CMD);
4700 break;
4701 }
4702
4703 case WE_DBGLOG_MODULE_ENABLE:
4704 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004705 hdd_debug("WE_DBGLOG_MODULE_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004706 set_value);
4707 hdd_ctx->fw_log_settings.enable = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004708 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004709 WMI_DBGLOG_MODULE_ENABLE,
4710 set_value, DBG_CMD);
4711 break;
4712 }
4713
4714 case WE_DBGLOG_MODULE_DISABLE:
4715 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004716 hdd_debug("WE_DBGLOG_MODULE_DISABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004717 set_value);
4718 hdd_ctx->fw_log_settings.enable = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004719 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004720 WMI_DBGLOG_MODULE_DISABLE,
4721 set_value, DBG_CMD);
4722 break;
4723 }
4724 case WE_DBGLOG_MOD_LOG_LEVEL:
4725 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004726 hdd_debug("WE_DBGLOG_MOD_LOG_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004727 set_value);
4728
4729 if (hdd_ctx->fw_log_settings.index >= MAX_MOD_LOGLEVEL)
4730 hdd_ctx->fw_log_settings.index = 0;
4731
4732 hdd_ctx->fw_log_settings.
4733 dl_mod_loglevel[hdd_ctx->fw_log_settings.index] =
4734 set_value;
4735 hdd_ctx->fw_log_settings.index++;
4736
Jeff Johnson1b780e42017-10-31 14:11:45 -07004737 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004738 WMI_DBGLOG_MOD_LOG_LEVEL,
4739 set_value, DBG_CMD);
4740 break;
4741 }
4742
4743 case WE_DBGLOG_TYPE:
4744 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004745 hdd_debug("WE_DBGLOG_TYPE val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004746 hdd_ctx->fw_log_settings.dl_type = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004747 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004748 WMI_DBGLOG_TYPE,
4749 set_value, DBG_CMD);
4750 break;
4751 }
4752 case WE_DBGLOG_REPORT_ENABLE:
4753 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004754 hdd_debug("WE_DBGLOG_REPORT_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004755 set_value);
4756 hdd_ctx->fw_log_settings.dl_report = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004757 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004758 WMI_DBGLOG_REPORT_ENABLE,
4759 set_value, DBG_CMD);
4760 break;
4761 }
4762
4763 case WE_SET_TXRX_FWSTATS:
4764 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004765 hdd_debug("WE_SET_TXRX_FWSTATS val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004766 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004767 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
4768 set_value, VDEV_CMD);
4769 break;
4770 }
4771
4772 case WE_TXRX_FWSTATS_RESET:
4773 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004774 hdd_debug("WE_TXRX_FWSTATS_RESET val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004775 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004776 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
4777 set_value, VDEV_CMD);
4778 break;
4779 }
4780
4781 case WE_DUMP_STATS:
4782 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004783 hdd_debug("WE_DUMP_STATS val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004784 ret = hdd_wlan_dump_stats(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004785 break;
4786 }
4787
4788 case WE_CLEAR_STATS:
4789 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004790 hdd_debug("WE_CLEAR_STATS val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004791 switch (set_value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07004792 case CDP_HDD_STATS:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004793 memset(&adapter->stats, 0, sizeof(adapter->stats));
4794 memset(&adapter->hdd_stats, 0,
4795 sizeof(adapter->hdd_stats));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004796 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07004797 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004798 wlan_hdd_clear_tx_rx_histogram(hdd_ctx);
4799 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07004800 case CDP_HDD_NETIF_OPER_HISTORY:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004801 wlan_hdd_clear_netif_queue_history(hdd_ctx);
4802 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07004803 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05304804 hdd_clear_hif_stats();
4805 break;
Yun Park1027e8c2017-10-13 15:17:37 -07004806 case CDP_NAPI_STATS:
4807 hdd_clear_napi_stats();
4808 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004809 default:
Leo Changfdb45c32016-10-28 11:09:23 -07004810 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4811 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004812 }
4813 break;
4814 }
4815
4816 case WE_PPS_PAID_MATCH:
4817 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004818 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304819 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004820 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304821 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004822
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004823 hdd_debug("WMI_VDEV_PPS_PAID_MATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004824 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004825 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004826 WMI_VDEV_PPS_PAID_MATCH,
4827 set_value, PPS_CMD);
4828 break;
4829 }
4830
4831 case WE_PPS_GID_MATCH:
4832 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004833 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304834 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004835 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304836 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004837 hdd_debug("WMI_VDEV_PPS_GID_MATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004838 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004839 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004840 WMI_VDEV_PPS_GID_MATCH,
4841 set_value, PPS_CMD);
4842 break;
4843 }
4844
4845 case WE_PPS_EARLY_TIM_CLEAR:
4846 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004847 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304848 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004849 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304850 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004851 hdd_debug(" WMI_VDEV_PPS_EARLY_TIM_CLEAR val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004852 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004853 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004854 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4855 set_value, PPS_CMD);
4856 break;
4857 }
4858
4859 case WE_PPS_EARLY_DTIM_CLEAR:
4860 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004861 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304862 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004863 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304864 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004865 hdd_debug("WMI_VDEV_PPS_EARLY_DTIM_CLEAR val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004866 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004867 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004868 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4869 set_value, PPS_CMD);
4870 break;
4871 }
4872
4873 case WE_PPS_EOF_PAD_DELIM:
4874 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004875 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304876 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004877 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304878 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004879 hdd_debug("WMI_VDEV_PPS_EOF_PAD_DELIM val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004880 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004881 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004882 WMI_VDEV_PPS_EOF_PAD_DELIM,
4883 set_value, PPS_CMD);
4884 break;
4885 }
4886
4887 case WE_PPS_MACADDR_MISMATCH:
4888 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004889 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304890 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004891 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304892 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004893 hdd_debug("WMI_VDEV_PPS_MACADDR_MISMATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004894 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004895 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004896 WMI_VDEV_PPS_MACADDR_MISMATCH,
4897 set_value, PPS_CMD);
4898 break;
4899 }
4900
4901 case WE_PPS_DELIM_CRC_FAIL:
4902 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004903 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304904 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004905 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304906 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004907 hdd_debug("WMI_VDEV_PPS_DELIM_CRC_FAIL val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004908 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004909 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004910 WMI_VDEV_PPS_DELIM_CRC_FAIL,
4911 set_value, PPS_CMD);
4912 break;
4913 }
4914
4915 case WE_PPS_GID_NSTS_ZERO:
4916 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004917 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304918 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004919 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304920 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004921 hdd_debug("WMI_VDEV_PPS_GID_NSTS_ZERO val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004922 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004923 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004924 WMI_VDEV_PPS_GID_NSTS_ZERO,
4925 set_value, PPS_CMD);
4926 break;
4927 }
4928
4929 case WE_PPS_RSSI_CHECK:
4930 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004931 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304932 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004933 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304934 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004935 hdd_debug("WMI_VDEV_PPS_RSSI_CHECK val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004936 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004937 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004938 WMI_VDEV_PPS_RSSI_CHECK,
4939 set_value, PPS_CMD);
4940 break;
4941 }
4942
4943 case WE_PPS_5G_EBT:
4944 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004945 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304946 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004947 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304948 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004949
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004950 hdd_debug("WMI_VDEV_PPS_5G_EBT val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004951 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004952 WMI_VDEV_PPS_5G_EBT,
4953 set_value, PPS_CMD);
4954 break;
4955 }
4956
4957 case WE_SET_HTSMPS:
4958 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004959 hdd_debug("WE_SET_HTSMPS val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004960 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004961 WMI_STA_SMPS_FORCE_MODE_CMDID,
4962 set_value, VDEV_CMD);
4963 break;
4964 }
4965
4966 case WE_SET_QPOWER_MAX_PSPOLL_COUNT:
4967 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004968 hdd_debug("WE_SET_QPOWER_MAX_PSPOLL_COUNT val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004969 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004970 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004971 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
4972 set_value, QPOWER_CMD);
4973 break;
4974 }
4975
4976 case WE_SET_QPOWER_MAX_TX_BEFORE_WAKE:
4977 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004978 hdd_debug("WE_SET_QPOWER_MAX_TX_BEFORE_WAKE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004979 set_value);
4980 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07004981 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004982 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
4983 set_value, QPOWER_CMD);
4984 break;
4985 }
4986
4987 case WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
4988 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004989 hdd_debug("WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004990 set_value);
4991 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07004992 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004993 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
4994 set_value, QPOWER_CMD);
4995 break;
4996 }
4997
4998 case WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
4999 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005000 hdd_debug("WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005001 set_value);
5002 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005003 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005004 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
5005 set_value, QPOWER_CMD);
5006 break;
5007 }
5008
5009 case WE_MCC_CONFIG_LATENCY:
5010 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005011 wlan_hdd_set_mcc_latency(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005012 break;
5013 }
5014
5015 case WE_MCC_CONFIG_QUOTA:
5016 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005017 hdd_debug("iwpriv cmd to set MCC quota with val %dms",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005018 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005019 ret = wlan_hdd_set_mcc_p2p_quota(adapter,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08005020 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005021 break;
5022 }
5023 case WE_SET_DEBUG_LOG:
5024 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005025 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson4f7f7c62017-10-05 08:53:41 -07005026
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005027 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05305028 return -EINVAL;
5029
Nirav Shah1da77682016-05-03 20:16:39 +05305030
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005031 hdd_ctx->config->gEnableDebugLog = set_value;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005032 sme_update_connect_debug(mac_handle, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005033 break;
5034 }
5035 case WE_SET_EARLY_RX_ADJUST_ENABLE:
5036 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005037 hdd_debug("SET early_rx enable val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005038 if ((set_value == 0) || (set_value == 1))
5039 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005040 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005041 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
5042 set_value, VDEV_CMD);
5043 else
5044 ret = -EINVAL;
5045 break;
5046 }
5047 case WE_SET_EARLY_RX_TGT_BMISS_NUM:
5048 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005049 hdd_debug("SET early_rx bmiss val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005050 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005051 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
5052 set_value, VDEV_CMD);
5053 break;
5054 }
5055 case WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE:
5056 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005057 hdd_debug("SET early_rx bmiss sample cycle %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005058 set_value);
5059 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005060 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005061 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
5062 set_value, VDEV_CMD);
5063 break;
5064 }
5065 case WE_SET_EARLY_RX_SLOP_STEP:
5066 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005067 hdd_debug("SET early_rx bmiss slop step val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005068 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005069 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005070 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
5071 set_value, VDEV_CMD);
5072 break;
5073 }
5074 case WE_SET_EARLY_RX_INIT_SLOP:
5075 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005076 hdd_debug("SET early_rx init slop step val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005077 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005078 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005079 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
5080 set_value, VDEV_CMD);
5081 break;
5082 }
5083 case WE_SET_EARLY_RX_ADJUST_PAUSE:
5084 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005085 hdd_debug("SET early_rx adjust pause %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005086 if ((set_value == 0) || (set_value == 1))
5087 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005088 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005089 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
5090 set_value, VDEV_CMD);
5091 else
5092 ret = -EINVAL;
5093 break;
5094 }
5095 case WE_SET_EARLY_RX_DRIFT_SAMPLE:
5096 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005097 hdd_debug("SET early_rx drift sample %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005098 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005099 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
5100 set_value, VDEV_CMD);
5101 break;
5102 }
5103 case WE_SET_SCAN_DISABLE:
5104 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005105 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05305106 return -EINVAL;
5107
Dustin Brown5e89ef82018-03-14 11:50:23 -07005108 hdd_debug("SET SCAN DISABLE %d", set_value);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005109 sme_set_scan_disable(mac_handle, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005110 break;
5111 }
Govind Singha471e5e2015-10-12 17:11:14 +05305112 case WE_START_FW_PROFILE:
5113 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005114 hdd_debug("WE_START_FW_PROFILE %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005115 ret = wma_cli_set_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05305116 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5117 set_value, DBG_CMD);
5118 break;
5119 }
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305120 case WE_SET_CHANNEL:
5121 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005122 hdd_debug("Set Channel %d Session ID %d mode %d", set_value,
Jeff Johnson1b780e42017-10-31 14:11:45 -07005123 adapter->session_id, adapter->device_mode);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005124 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05305125 return -EINVAL;
5126
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305127
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005128 if ((QDF_STA_MODE == adapter->device_mode) ||
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005129 (QDF_P2P_CLIENT_MODE == adapter->device_mode)) {
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305130
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005131 status = sme_ext_change_channel(mac_handle,
5132 set_value,
5133 adapter->session_id);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305134 if (status != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005135 hdd_err("Error in change channel status %d",
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005136 status);
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305137 ret = -EINVAL;
5138 }
5139 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07005140 hdd_err("change channel not supported for device mode %d",
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005141 adapter->device_mode);
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305142 ret = -EINVAL;
5143 }
5144 break;
5145 }
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05305146 case WE_SET_CONC_SYSTEM_PREF:
5147 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005148 hdd_debug("New preference: %d", set_value);
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05305149 if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) &&
5150 (set_value <= CFG_CONC_SYSTEM_PREF_MAX))) {
5151 hdd_err("Invalid system preference %d", set_value);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305152 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07005153 break;
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05305154 }
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305155
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05305156 /* hdd_ctx, hdd_ctx->config are already checked for null */
5157 hdd_ctx->config->conc_system_pref = set_value;
5158 break;
5159 }
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08005160 case WE_SET_11AX_RATE:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005161 ret = hdd_set_11ax_rate(adapter, set_value, NULL);
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08005162 break;
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07005163 case WE_SET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07005164 hdd_debug("Set WMI_VDEV_PARAM_HE_DCM: %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005165 ret = wma_cli_set_command(adapter->session_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07005166 WMI_VDEV_PARAM_HE_DCM, set_value,
5167 VDEV_CMD);
5168 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07005169 case WE_SET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07005170 hdd_debug("Set WMI_VDEV_PARAM_HE_RANGE_EXT: %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005171 ret = wma_cli_set_command(adapter->session_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07005172 WMI_VDEV_PARAM_HE_RANGE_EXT,
5173 set_value, VDEV_CMD);
5174 break;
Jeff Johnson011c4502017-10-05 15:25:56 -07005175 case WE_SET_PDEV_RESET:
5176 ret = hdd_handle_pdev_reset(adapter, set_value);
5177 break;
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05305178 case WE_SET_MODULATED_DTIM:
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05305179 if ((set_value < CFG_ENABLE_MODULATED_DTIM_MIN) ||
5180 (set_value > CFG_ENABLE_MODULATED_DTIM_MAX)) {
5181 hdd_err("Invalid gEnableModuleDTIM value %d",
5182 set_value);
5183 return -EINVAL;
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05305184 }
Jeff Johnsonc66d3102018-02-28 11:58:26 -08005185
5186 hdd_ctx->config->enableModulatedDTIM = set_value;
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05305187 break;
Kiran Kumar Lokere05e9a652018-04-10 20:27:38 -07005188 case WE_SET_PPDU_DUR:
5189 /*Validate set value for Min and Max range*/
5190 if (!set_value || (set_value > 4000)) {
5191 hdd_err("Invalid ppdu duraion value: %d usec",
5192 set_value);
5193 return -EINVAL;
5194 }
5195 ret = wma_cli_set_command(adapter->session_id,
5196 WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID,
5197 set_value, PDEV_CMD);
5198 if (ret)
5199 hdd_err("SET_PPDU_DURATION_CMDID %d usec set failed",
5200 set_value);
5201 else
5202 hdd_debug("PDEV_PARAM_SET_PPDU_DUR_CMDID is set to %d",
5203 set_value);
5204 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005205 default:
Rajeev Kumard0565362018-03-01 12:02:01 -08005206 hdd_debug("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005207 ret = -EINVAL;
5208 break;
5209 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005210
Dustin Browne74003f2018-03-14 12:51:58 -07005211 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005212
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005213 return ret;
5214}
5215
5216static int iw_setint_getnone(struct net_device *dev,
5217 struct iw_request_info *info,
5218 union iwreq_data *wrqu,
5219 char *extra)
5220{
5221 int ret;
5222
5223 cds_ssr_protect(__func__);
5224 ret = __iw_setint_getnone(dev, info, wrqu, extra);
5225 cds_ssr_unprotect(__func__);
5226
5227 return ret;
5228}
5229
5230/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005231 * __iw_setnone_get_threeint() - return three value to up layer.
5232 *
5233 * @dev: pointer of net_device of this wireless card
5234 * @info: meta data about Request sent
5235 * @wrqu: include request info
5236 * @extra: buf used for in/Output
5237 *
5238 * Return: execute result
5239 */
5240static int __iw_setnone_get_threeint(struct net_device *dev,
5241 struct iw_request_info *info,
5242 union iwreq_data *wrqu, char *extra)
5243{
5244 int ret = 0; /* success */
5245 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005246 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005247 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005248
Dustin Brownfdf17c12018-03-14 12:55:34 -07005249 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005250 ret = wlan_hdd_validate_context(hdd_ctx);
5251 if (0 != ret)
5252 return ret;
5253
Jeff Johnson441e1f72017-02-07 08:50:49 -08005254 ret = hdd_check_private_wext_control(hdd_ctx, info);
5255 if (0 != ret)
5256 return ret;
5257
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005258 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005259 switch (value[0]) {
5260 case WE_GET_TSF:
5261 ret = hdd_indicate_tsf(adapter, value, 3);
5262 break;
5263 default:
5264 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5265 break;
5266 }
5267 return ret;
5268}
5269
5270/**
5271 * iw_setnone_get_threeint() - return three value to up layer.
5272 *
5273 * @dev: pointer of net_device of this wireless card
5274 * @info: meta data about Request sent
5275 * @wrqu: include request info
5276 * @extra: buf used for in/Output
5277 *
5278 * Return: execute result
5279 */
5280static int iw_setnone_get_threeint(struct net_device *dev,
5281 struct iw_request_info *info,
5282 union iwreq_data *wrqu, char *extra)
5283{
5284 int ret;
5285
5286 cds_ssr_protect(__func__);
5287 ret = __iw_setnone_get_threeint(dev, info, wrqu, extra);
5288 cds_ssr_unprotect(__func__);
5289
5290 return ret;
5291}
5292
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005293#ifdef WLAN_UNIT_TEST
5294static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *component)
5295{
5296 uint32_t errors = 0;
5297 bool all = !component || !component[0];
5298
5299 if (all)
5300 hdd_info("Starting unit tests for all components");
5301 else
5302 hdd_info("Starting unit tests for component '%s'", component);
5303
Dustin Brown6099ddc2018-07-06 14:32:53 -07005304 if (all || qdf_str_eq(component, "dsc"))
5305 errors += dsc_unit_test();
5306
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005307 /* add future tests here */
5308
5309 if (errors) {
5310 hdd_err("Unit tests failed with %u errors", errors);
5311 return -EPERM;
5312 }
5313
5314 hdd_info("Unit tests passed successfully");
5315
5316 return 0;
5317}
5318#else
5319static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *component)
5320{
5321 return -EOPNOTSUPP;
5322}
5323#endif /* WLAN_UNIT_TEST */
5324
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005325/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005326 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5327 * @dev: device upon which the ioctl was received
5328 * @info: ioctl request information
5329 * @wrqu: ioctl request data
5330 * @extra: ioctl extra data
5331 *
5332 * Return: 0 on success, non-zero on error
5333 */
5334static int __iw_setchar_getnone(struct net_device *dev,
5335 struct iw_request_info *info,
5336 union iwreq_data *wrqu, char *extra)
5337{
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005338 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005339 int sub_cmd;
5340 int ret;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005341 char *str_arg = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005342 struct hdd_adapter *adapter = (netdev_priv(dev));
5343 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005344 struct hdd_config *pConfig = hdd_ctx->config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005345 struct iw_point s_priv_data;
5346
Dustin Brownfdf17c12018-03-14 12:55:34 -07005347 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005348
Mukul Sharma34777c62015-11-02 20:22:30 +05305349 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005350 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305351 return -EPERM;
5352 }
5353
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005354 ret = wlan_hdd_validate_context(hdd_ctx);
5355 if (0 != ret)
5356 return ret;
5357
Jeff Johnson441e1f72017-02-07 08:50:49 -08005358 ret = hdd_check_private_wext_control(hdd_ctx, info);
5359 if (0 != ret)
5360 return ret;
5361
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005362 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005363 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005364 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005365
5366 /* make sure all params are correctly passed to function */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005367 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005368 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005369
5370 sub_cmd = s_priv_data.flags;
5371
5372 /* ODD number is used for set, copy data using copy_from_user */
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005373 str_arg = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005374 s_priv_data.length);
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005375 if (!str_arg) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005376 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005377 return -ENOMEM;
5378 }
5379
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005380 hdd_debug("Received length: %d data: %s",
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005381 s_priv_data.length, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005382
5383 switch (sub_cmd) {
5384 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005385 hdd_debug("ADD_PTRN");
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005386 hdd_add_wowl_ptrn(adapter, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005387 break;
5388 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005389 hdd_debug("DEL_PTRN");
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005390 hdd_del_wowl_ptrn(adapter, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005391 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005392 case WE_NEIGHBOR_REPORT_REQUEST:
5393 {
5394 tRrmNeighborReq neighborReq;
5395 tRrmNeighborRspCallbackInfo callbackInfo;
5396
5397 if (pConfig->fRrmEnable) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305398 neighborReq.neighbor_report_offload = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005399 neighborReq.no_ssid =
5400 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305401 hdd_debug("Neighbor Request ssid present %d",
5402 neighborReq.no_ssid);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005403 if (!neighborReq.no_ssid) {
5404 neighborReq.ssid.length =
5405 (s_priv_data.length - 1) >
5406 32 ? 32 : (s_priv_data.length - 1);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305407 qdf_mem_copy(neighborReq.ssid.ssId,
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005408 str_arg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005409 neighborReq.ssid.length);
5410 }
5411
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305412 /*
5413 * If 11k offload is supported by FW and enabled
5414 * in the ini, set the offload to true
5415 */
5416 if (hdd_ctx->config->is_11k_offload_supported &&
5417 (hdd_ctx->config->offload_11k_enable_bitmask &
5418 OFFLOAD_11K_BITMASK_NEIGHBOR_REPORT_REQUEST)) {
5419 hdd_debug("Neighbor report offloaded to FW");
5420 neighborReq.neighbor_report_offload = true;
5421 }
5422
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005423 callbackInfo.neighborRspCallback = NULL;
5424 callbackInfo.neighborRspCallbackContext = NULL;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305425 callbackInfo.timeout = 5000; /* 5 seconds */
5426 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005427 hdd_ctx->mac_handle,
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305428 adapter->session_id,
5429 &neighborReq,
5430 &callbackInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005431 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005432 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005433 ret = -EINVAL;
5434 }
5435 }
5436 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005437 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08005438 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005439 break;
5440 case WE_SET_CONFIG:
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005441 status = hdd_execute_global_config_command(hdd_ctx, str_arg);
5442 if (QDF_IS_STATUS_ERROR(status))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005443 ret = -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005444
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005445 break;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005446 case WE_UNIT_TEST:
5447 ret = hdd_we_unit_test(hdd_ctx, str_arg);
5448 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005449 default:
5450 {
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005451 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005452 ret = -EINVAL;
5453 break;
5454 }
5455 }
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005456
5457 qdf_mem_free(str_arg);
Dustin Browne74003f2018-03-14 12:51:58 -07005458 hdd_exit();
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005459
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005460 return ret;
5461}
5462
5463static int iw_setchar_getnone(struct net_device *dev,
5464 struct iw_request_info *info,
5465 union iwreq_data *wrqu, char *extra)
5466{
5467 int ret;
5468
5469 cds_ssr_protect(__func__);
5470 ret = __iw_setchar_getnone(dev, info, wrqu, extra);
5471 cds_ssr_unprotect(__func__);
5472
5473 return ret;
5474}
5475
5476/**
5477 * iw_setnone_getint() - Generic "get integer" private ioctl handler
5478 * @dev: device upon which the ioctl was received
5479 * @info: ioctl request information
5480 * @wrqu: ioctl request data
5481 * @extra: ioctl extra data
5482 *
5483 * Return: 0 on success, non-zero on error
5484 */
5485static int __iw_setnone_getint(struct net_device *dev,
5486 struct iw_request_info *info,
5487 union iwreq_data *wrqu, char *extra)
5488{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005489 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005490 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005491 int *value = (int *)extra;
5492 int ret;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305493 tSmeConfigParams *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005494 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005495
Dustin Brownfdf17c12018-03-14 12:55:34 -07005496 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305497
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005498 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005499 ret = wlan_hdd_validate_context(hdd_ctx);
5500 if (0 != ret)
5501 return ret;
5502
Jeff Johnson441e1f72017-02-07 08:50:49 -08005503 ret = hdd_check_private_wext_control(hdd_ctx, info);
5504 if (0 != ret)
5505 return ret;
5506
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08005507 sme_config = qdf_mem_malloc(sizeof(*sme_config));
5508 if (!sme_config) {
5509 hdd_err("failed to allocate memory for sme_config");
5510 return -ENOMEM;
5511 }
5512
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005513 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005514 switch (value[0]) {
5515 case WE_GET_11D_STATE:
5516 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005517 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005518
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305519 *value = sme_config->csrConfig.Is11dSupportEnabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005520
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005521 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005522
5523 break;
5524 }
5525
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005526 case WE_GET_WLAN_DBG:
5527 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05305528 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005529 *value = 0;
5530 break;
5531 }
5532 case WE_GET_MAX_ASSOC:
5533 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005534 if (sme_cfg_get_int(mac_handle, WNI_CFG_ASSOC_STA_LIMIT,
5535 (uint32_t *) value) != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005536 hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005537 ret = -EIO;
5538 }
5539 break;
5540 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005541
5542 case WE_GET_CONCURRENCY_MODE:
5543 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08005544 *value = policy_mgr_get_concurrency_mode(hdd_ctx->hdd_psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005545
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005546 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005547 break;
5548 }
5549
5550 case WE_GET_NSS:
5551 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005552 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305553 *value = (sme_config->csrConfig.enable2x2 == 0) ? 1 : 2;
Srinivas Girigowda576b2352017-08-25 14:44:26 -07005554 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->hdd_psoc))
5555 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005556 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005557 break;
5558 }
5559
5560 case WE_GET_GTX_HT_MCS:
5561 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005562 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005563 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005564 WMI_VDEV_PARAM_GTX_HT_MCS,
5565 GTX_CMD);
5566 break;
5567 }
5568
5569 case WE_GET_GTX_VHT_MCS:
5570 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005571 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005572 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005573 WMI_VDEV_PARAM_GTX_VHT_MCS,
5574 GTX_CMD);
5575 break;
5576 }
5577
5578 case WE_GET_GTX_USRCFG:
5579 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005580 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005581 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005582 WMI_VDEV_PARAM_GTX_USR_CFG,
5583 GTX_CMD);
5584 break;
5585 }
5586
5587 case WE_GET_GTX_THRE:
5588 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005589 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005590 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005591 WMI_VDEV_PARAM_GTX_THRE,
5592 GTX_CMD);
5593 break;
5594 }
5595
5596 case WE_GET_GTX_MARGIN:
5597 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005598 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005599 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005600 WMI_VDEV_PARAM_GTX_MARGIN,
5601 GTX_CMD);
5602 break;
5603 }
5604
5605 case WE_GET_GTX_STEP:
5606 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005607 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005608 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005609 WMI_VDEV_PARAM_GTX_STEP,
5610 GTX_CMD);
5611 break;
5612 }
5613
5614 case WE_GET_GTX_MINTPC:
5615 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005616 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005617 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005618 WMI_VDEV_PARAM_GTX_MINTPC,
5619 GTX_CMD);
5620 break;
5621 }
5622
5623 case WE_GET_GTX_BWMASK:
5624 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005625 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005626 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005627 WMI_VDEV_PARAM_GTX_BW_MASK,
5628 GTX_CMD);
5629 break;
5630 }
5631
5632 case WE_GET_LDPC:
5633 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005634 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005635 break;
5636 }
5637
5638 case WE_GET_TX_STBC:
5639 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005640 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005641 break;
5642 }
5643
5644 case WE_GET_RX_STBC:
5645 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005646 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005647 break;
5648 }
5649
5650 case WE_GET_SHORT_GI:
5651 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005652 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005653 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08005654 WMI_VDEV_PARAM_SGI,
5655 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005656 break;
5657 }
5658
5659 case WE_GET_RTSCTS:
5660 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005661 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005662 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005663 WMI_VDEV_PARAM_ENABLE_RTSCTS,
5664 VDEV_CMD);
5665 break;
5666 }
5667
5668 case WE_GET_CHWIDTH:
5669 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005670 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005671 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005672 WMI_VDEV_PARAM_CHWIDTH,
5673 VDEV_CMD);
5674 break;
5675 }
5676
5677 case WE_GET_ANI_EN_DIS:
5678 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005679 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005680 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005681 WMI_PDEV_PARAM_ANI_ENABLE,
5682 PDEV_CMD);
5683 break;
5684 }
5685
5686 case WE_GET_ANI_POLL_PERIOD:
5687 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005688 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005689 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005690 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
5691 PDEV_CMD);
5692 break;
5693 }
5694
5695 case WE_GET_ANI_LISTEN_PERIOD:
5696 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005697 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005698 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005699 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
5700 PDEV_CMD);
5701 break;
5702 }
5703
5704 case WE_GET_ANI_OFDM_LEVEL:
5705 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005706 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005707 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005708 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
5709 PDEV_CMD);
5710 break;
5711 }
5712
5713 case WE_GET_ANI_CCK_LEVEL:
5714 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005715 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005716 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005717 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
5718 PDEV_CMD);
5719 break;
5720 }
5721
5722 case WE_GET_DYNAMIC_BW:
5723 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005724 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005725 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005726 WMI_PDEV_PARAM_DYNAMIC_BW,
5727 PDEV_CMD);
5728 break;
5729 }
5730
5731 case WE_GET_11N_RATE:
5732 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005733 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005734 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005735 WMI_VDEV_PARAM_FIXED_RATE,
5736 VDEV_CMD);
5737 break;
5738 }
5739
5740 case WE_GET_AMPDU:
5741 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005742 hdd_debug("GET AMPDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005743 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005744 GEN_VDEV_PARAM_AMPDU,
5745 GEN_CMD);
5746 break;
5747 }
5748
5749 case WE_GET_AMSDU:
5750 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005751 hdd_debug("GET AMSDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005752 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005753 GEN_VDEV_PARAM_AMSDU,
5754 GEN_CMD);
5755 break;
5756 }
5757
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07005758 case WE_GET_ROAM_SYNCH_DELAY:
5759 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005760 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005761 *value = wma_cli_get_command(adapter->session_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07005762 GEN_VDEV_ROAM_SYNCH_DELAY,
5763 GEN_CMD);
5764 break;
5765 }
5766
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005767 case WE_GET_TX_CHAINMASK:
5768 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005769 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005770 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005771 WMI_PDEV_PARAM_TX_CHAIN_MASK,
5772 PDEV_CMD);
5773 break;
5774 }
5775
5776 case WE_GET_RX_CHAINMASK:
5777 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005778 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005779 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005780 WMI_PDEV_PARAM_RX_CHAIN_MASK,
5781 PDEV_CMD);
5782 break;
5783 }
5784
5785 case WE_GET_TXPOW_2G:
5786 {
5787 uint32_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005788
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005789 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005790 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005791 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
5792 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305793 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005794 sme_cfg_get_int(mac_handle, WNI_CFG_CURRENT_TX_POWER_LEVEL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005795 &txpow2g)) {
5796 return -EIO;
5797 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005798 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005799 break;
5800 }
5801
5802 case WE_GET_TXPOW_5G:
5803 {
5804 uint32_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005805
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005806 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005807 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005808 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
5809 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305810 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005811 sme_cfg_get_int(mac_handle, WNI_CFG_CURRENT_TX_POWER_LEVEL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005812 &txpow5g)) {
5813 return -EIO;
5814 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005815 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005816 break;
5817 }
5818
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005819 case WE_GET_PPS_PAID_MATCH:
5820 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005821 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005822 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005823 WMI_VDEV_PPS_PAID_MATCH,
5824 PPS_CMD);
5825 break;
5826 }
5827
5828 case WE_GET_PPS_GID_MATCH:
5829 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005830 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005831 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005832 WMI_VDEV_PPS_GID_MATCH,
5833 PPS_CMD);
5834 break;
5835 }
5836
5837 case WE_GET_PPS_EARLY_TIM_CLEAR:
5838 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005839 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005840 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005841 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
5842 PPS_CMD);
5843 break;
5844 }
5845
5846 case WE_GET_PPS_EARLY_DTIM_CLEAR:
5847 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005848 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005849 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005850 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
5851 PPS_CMD);
5852 break;
5853 }
5854
5855 case WE_GET_PPS_EOF_PAD_DELIM:
5856 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005857 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005858 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005859 WMI_VDEV_PPS_EOF_PAD_DELIM,
5860 PPS_CMD);
5861 break;
5862 }
5863
5864 case WE_GET_PPS_MACADDR_MISMATCH:
5865 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005866 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005867 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005868 WMI_VDEV_PPS_MACADDR_MISMATCH,
5869 PPS_CMD);
5870 break;
5871 }
5872
5873 case WE_GET_PPS_DELIM_CRC_FAIL:
5874 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005875 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005876 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005877 WMI_VDEV_PPS_DELIM_CRC_FAIL,
5878 PPS_CMD);
5879 break;
5880 }
5881
5882 case WE_GET_PPS_GID_NSTS_ZERO:
5883 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005884 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005885 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005886 WMI_VDEV_PPS_GID_NSTS_ZERO,
5887 PPS_CMD);
5888 break;
5889 }
5890
5891 case WE_GET_PPS_RSSI_CHECK:
5892 {
5893
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005894 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005895 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005896 WMI_VDEV_PPS_RSSI_CHECK,
5897 PPS_CMD);
5898 break;
5899 }
5900
5901 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
5902 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005903 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005904 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005905 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
5906 QPOWER_CMD);
5907 break;
5908 }
5909
5910 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
5911 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005912 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005913 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005914 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
5915 QPOWER_CMD);
5916 break;
5917 }
5918
5919 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
5920 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005921 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005922 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005923 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
5924 QPOWER_CMD);
5925 break;
5926 }
5927
5928 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
5929 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005930 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005931 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005932 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
5933 QPOWER_CMD);
5934 break;
5935 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005936 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005937 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005938 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005939 case WE_GET_TEMPERATURE:
5940 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005941 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005942 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005943 break;
5944 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07005945 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07005946 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005947 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07005948 WMI_VDEV_PARAM_HE_DCM,
5949 VDEV_CMD);
5950 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07005951 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07005952 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005953 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07005954 WMI_VDEV_PARAM_HE_RANGE_EXT,
5955 VDEV_CMD);
5956 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005957 default:
5958 {
Jeff Johnson99bac312016-06-28 10:38:18 -07005959 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005960 value[0]);
5961 break;
5962 }
5963 }
Dustin Browne74003f2018-03-14 12:51:58 -07005964 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305965 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005966 return ret;
5967}
5968
5969static int iw_setnone_getint(struct net_device *dev,
5970 struct iw_request_info *info,
5971 union iwreq_data *wrqu, char *extra)
5972{
5973 int ret;
5974
5975 cds_ssr_protect(__func__);
5976 ret = __iw_setnone_getint(dev, info, wrqu, extra);
5977 cds_ssr_unprotect(__func__);
5978
5979 return ret;
5980}
5981
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05305982static int hdd_set_fwtest(int argc, int cmd, int value)
5983{
5984 struct set_fwtest_params *fw_test;
5985
5986 /* check for max number of arguments */
5987 if (argc > (WMA_MAX_NUM_ARGS) ||
5988 argc != HDD_FWTEST_PARAMS) {
5989 hdd_err("Too Many args %d", argc);
5990 return -EINVAL;
5991 }
5992 /*
5993 * check if number of arguments are 3 then, check
5994 * then set the default value for sounding interval.
5995 */
5996 if (HDD_FWTEST_PARAMS == argc) {
5997 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
5998 value = HDD_FWTEST_SU_DEFAULT_VALUE;
5999 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6000 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6001 }
6002 /* check sounding interval value should not exceed to max */
6003 if (value > HDD_FWTEST_MAX_VALUE) {
6004 hdd_err("Invalid arguments value should not exceed max: %d",
6005 value);
6006 return -EINVAL;
6007 }
6008 fw_test = qdf_mem_malloc(sizeof(*fw_test));
6009 if (NULL == fw_test) {
6010 hdd_err("qdf_mem_malloc failed for fw_test");
6011 return -ENOMEM;
6012 }
6013 fw_test->arg = cmd;
6014 fw_test->value = value;
6015 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6016 qdf_mem_free(fw_test);
6017 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6018 return -EINVAL;
6019 }
6020 return 0;
6021}
6022
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006023/**
6024 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6025 * @dev: device upon which the ioctl was received
6026 * @info: ioctl request information
6027 * @wrqu: ioctl request data
6028 * @extra: ioctl extra data
6029 *
6030 * Return: 0 on success, non-zero on error
6031 */
6032static int __iw_set_three_ints_getnone(struct net_device *dev,
6033 struct iw_request_info *info,
6034 union iwreq_data *wrqu, char *extra)
6035{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006036 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006037 int *value = (int *)extra;
6038 int sub_cmd = value[0];
6039 int ret;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006040 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006041
Dustin Brownfdf17c12018-03-14 12:55:34 -07006042 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306043
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006044 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006045 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006046 return -EPERM;
6047 }
6048
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006049 ret = wlan_hdd_validate_context(hdd_ctx);
6050 if (0 != ret)
6051 return ret;
6052
Jeff Johnson441e1f72017-02-07 08:50:49 -08006053 ret = hdd_check_private_wext_control(hdd_ctx, info);
6054 if (0 != ret)
6055 return ret;
6056
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006057 switch (sub_cmd) {
6058
6059 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006060 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6061 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006062 break;
6063 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306064 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006065 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306066
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006067 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6068 hdd_debug("Ioctl to set dual mac scan config");
Tushnim Bhattacharyya49ed8ab2017-05-26 18:20:10 -07006069 if (hdd_ctx->config->dual_mac_feature_disable ==
6070 DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006071 hdd_err("Dual mac feature is disabled from INI");
6072 return -EPERM;
6073 }
6074 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006075 policy_mgr_set_dual_mac_scan_config(hdd_ctx->hdd_psoc,
6076 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006077 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306078 case WE_SET_FW_TEST:
6079 {
6080 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6081 if (ret) {
6082 hdd_err("Not able to set fwtest %d", ret);
6083 return ret;
6084 }
6085 }
6086 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006087 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006088 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006089 break;
6090
6091 }
Dustin Browne74003f2018-03-14 12:51:58 -07006092 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006093 return ret;
6094}
6095
6096int iw_set_three_ints_getnone(struct net_device *dev,
6097 struct iw_request_info *info,
6098 union iwreq_data *wrqu, char *extra)
6099{
6100 int ret;
6101
6102 cds_ssr_protect(__func__);
6103 ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
6104 cds_ssr_unprotect(__func__);
6105
6106 return ret;
6107}
6108
6109/**
6110 * hdd_connection_state_string() - Get connection state string
6111 * @connection_state: enum to be converted to a string
6112 *
6113 * Return: the string equivalent of @connection_state
6114 */
6115static const char *
6116hdd_connection_state_string(eConnectionState connection_state)
6117{
6118 switch (connection_state) {
6119 CASE_RETURN_STRING(eConnectionState_NotConnected);
6120 CASE_RETURN_STRING(eConnectionState_Connecting);
6121 CASE_RETURN_STRING(eConnectionState_Associated);
6122 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6123 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6124 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6125 default:
6126 return "UNKNOWN";
6127 }
6128}
6129
Naveen Rawat910726a2017-03-06 11:42:51 -08006130#if defined(FEATURE_OEM_DATA_SUPPORT)
6131/**
6132 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6133 * wifi_pos api to get oem data caps
6134 * @dev: net device upon which the request was received
6135 * @info: ioctl request information
6136 * @wrqu: ioctl request data
6137 * @extra: ioctl data payload
6138 *
6139 * Return: 0 for success, negative errno value on failure
6140 */
6141static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6142 struct iw_request_info *info,
6143 union iwreq_data *wrqu, char *extra)
6144{
6145 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6146}
6147#elif defined(WIFI_POS_CONVERGED)
6148static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6149 struct iw_request_info *info,
6150 union iwreq_data *wrqu, char *extra)
6151{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006152 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006153 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006154
6155 return os_if_wifi_pos_populate_caps(hdd_ctx->hdd_psoc,
6156 (struct wifi_pos_driver_caps *)extra);
6157}
6158#else
6159static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6160 struct iw_request_info *info,
6161 union iwreq_data *wrqu, char *extra)
6162{
6163 return -ENOTSUPP;
6164}
6165#endif
6166
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006167/**
6168 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6169 * @dev: device upon which the ioctl was received
6170 * @info: ioctl request information
6171 * @wrqu: ioctl request data
6172 * @extra: ioctl extra data
6173 *
6174 * Return: 0 on success, non-zero on error
6175 */
6176static int __iw_get_char_setnone(struct net_device *dev,
6177 struct iw_request_info *info,
6178 union iwreq_data *wrqu, char *extra)
6179{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006180 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006181 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006182 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006183 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006184 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006185
Dustin Brownfdf17c12018-03-14 12:55:34 -07006186 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306187
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006188 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006189 ret = wlan_hdd_validate_context(hdd_ctx);
6190 if (0 != ret)
6191 return ret;
6192
Jeff Johnson441e1f72017-02-07 08:50:49 -08006193 ret = hdd_check_private_wext_control(hdd_ctx, info);
6194 if (0 != ret)
6195 return ret;
6196
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006197 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006198 switch (sub_cmd) {
6199 case WE_WLAN_VERSION:
6200 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006201 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6202 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006203 break;
6204 }
6205
6206 case WE_GET_STATS:
6207 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006208 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006209 extra, WE_MAX_STR_LEN);
6210 break;
6211 }
6212
Dustin Brownd9322482017-01-09 12:46:03 -08006213 case WE_GET_SUSPEND_RESUME_STATS:
6214 {
6215 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6216 WE_MAX_STR_LEN);
6217 if (ret >= 0) {
6218 wrqu->data.length = ret;
6219 ret = 0;
6220 }
6221
6222 break;
6223 }
6224
Govind Singha471e5e2015-10-12 17:11:14 +05306225 case WE_LIST_FW_PROFILE:
6226 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6227 extra, WE_MAX_STR_LEN);
6228 break;
6229
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006230 /* The case prints the current state of the HDD, SME, CSR, PE,
6231 * TL it can be extended for WDI Global State as well. And
6232 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6233 * and P2P_GO have not been added as of now.
6234 */
6235 case WE_GET_STATES:
6236 {
6237 int buf = 0, len = 0;
6238 int adapter_num = 0;
6239 int count = 0, check = 1;
6240
Jeff Johnsond377dce2017-10-04 10:32:42 -07006241 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006242
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006243 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson3d278b02017-08-29 14:17:47 -07006244 struct hdd_adapter *useAdapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006245
6246 /* Print wlan0 or p2p0 states based on the adapter_num
6247 * by using the correct adapter
6248 */
6249 while (adapter_num < 2) {
6250 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006251 useAdapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006252 buf =
6253 scnprintf(extra + len,
6254 WE_MAX_STR_LEN - len,
6255 "\n\n wlan0 States:-");
6256 len += buf;
6257 } else if (P2P_ADAPTER == adapter_num) {
6258 buf =
6259 scnprintf(extra + len,
6260 WE_MAX_STR_LEN - len,
6261 "\n\n p2p0 States:-");
6262 len += buf;
6263
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006264 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006265 buf =
6266 scnprintf(extra + len,
6267 WE_MAX_STR_LEN -
6268 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006269 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006270 len += buf;
6271 break;
6272 }
6273
6274 /* Printing p2p0 states only in the
6275 * case when the device is configured
6276 * as a p2p_client
6277 */
6278 useAdapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006279 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006280 QDF_P2P_CLIENT_MODE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006281 if (!useAdapter) {
6282 buf =
6283 scnprintf(extra + len,
6284 WE_MAX_STR_LEN -
6285 len,
6286 "\n Device not configured as P2P_CLIENT.");
6287 len += buf;
6288 break;
6289 }
6290 }
6291
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006292 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006293 buf = scnprintf(extra + len,
6294 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006295 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006296 len += buf;
6297 break;
6298 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006299 sta_ctx =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006300 WLAN_HDD_GET_STATION_CTX_PTR(useAdapter);
6301
6302
6303 buf =
6304 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6305 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006306 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006307 "\n Neighbour Roam State - %s"
6308 "\n CSR State - %s"
6309 "\n CSR Substate - %s",
6310 hdd_connection_state_string
Jeff Johnsond377dce2017-10-04 10:32:42 -07006311 (sta_ctx->conn_info.connState),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006312 mac_trace_get_neighbour_roam_state
6313 (sme_get_neighbor_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006314 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006315 mac_trace_getcsr_roam_state
6316 (sme_get_current_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006317 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006318 mac_trace_getcsr_roam_sub_state
6319 (sme_get_current_roam_sub_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006320 (mac_handle, useAdapter->session_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006321 );
6322 len += buf;
6323 adapter_num++;
6324 }
6325
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006326 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006327 /* Printing Lim State starting with global lim states */
6328 buf =
6329 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006330 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006331 "\n Global Sme State - %s "
6332 "\n Global mlm State - %s " "\n",
6333 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006334 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006335 mac_trace_get_lim_mlm_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006336 (sme_get_lim_sme_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006337 );
6338 len += buf;
6339
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006340 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006341 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006342 buf =
6343 scnprintf(extra + len,
6344 WE_MAX_STR_LEN -
6345 len,
6346 "\n Lim Valid Session %d:-"
6347 "\n PE Sme State - %s "
6348 "\n PE Mlm State - %s "
6349 "\n", check,
6350 mac_trace_get_lim_sme_state
6351 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006352 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006353 mac_trace_get_lim_mlm_state
6354 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006355 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006356 );
6357
6358 len += buf;
6359 check++;
6360 }
6361 count++;
6362 }
6363 }
6364
6365 wrqu->data.length = strlen(extra) + 1;
6366 break;
6367 }
6368
6369 case WE_GET_CFG:
6370 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006371 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006372 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006373 extra,
6374 QCSAP_IOCTL_MAX_STR_LEN);
6375 wrqu->data.length = strlen(extra) + 1;
6376 break;
6377 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006378 case WE_GET_RSSI:
6379 {
6380 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006381
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006382 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006383 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
6384 wrqu->data.length = strlen(extra) + 1;
6385 break;
6386 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006387
6388 case WE_GET_WMM_STATUS:
6389 {
6390 snprintf(extra, WE_MAX_STR_LEN,
6391 "\nDir: 0=up, 1=down, 3=both\n"
6392 "|------------------------|\n"
6393 "|AC | ACM |Admitted| Dir |\n"
6394 "|------------------------|\n"
6395 "|VO | %d | %3s | %d |\n"
6396 "|VI | %d | %3s | %d |\n"
6397 "|BE | %d | %3s | %d |\n"
6398 "|BK | %d | %3s | %d |\n"
6399 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006400 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006401 wmmAcStatus[SME_AC_VO].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006402 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006403 wmmAcStatus[SME_AC_VO].
6404 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006405 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006406 wmmAcStatus[SME_AC_VO].wmmAcTspecInfo.
6407 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006408 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006409 wmmAcStatus[SME_AC_VI].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006410 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006411 wmmAcStatus[SME_AC_VI].
6412 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006413 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006414 wmmAcStatus[SME_AC_VI].wmmAcTspecInfo.
6415 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006416 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006417 wmmAcStatus[SME_AC_BE].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006418 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006419 wmmAcStatus[SME_AC_BE].
6420 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006421 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006422 wmmAcStatus[SME_AC_BE].wmmAcTspecInfo.
6423 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006424 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006425 wmmAcStatus[SME_AC_BK].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006426 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006427 wmmAcStatus[SME_AC_BK].
6428 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006429 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006430 wmmAcStatus[SME_AC_BK].wmmAcTspecInfo.
6431 ts_info.direction);
6432
6433 wrqu->data.length = strlen(extra) + 1;
6434 break;
6435 }
6436 case WE_GET_CHANNEL_LIST:
6437 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306438 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006439 uint8_t i, len;
6440 char *buf;
6441 uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN];
6442 uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN;
Srinivas Girigowdac231df62017-03-24 18:27:57 -07006443 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006444
6445 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05306446 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006447 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306448 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006449 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006450 return -EINVAL;
6451 }
6452 buf = extra;
6453 /*
6454 * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN.
6455 * Maximum buffer needed = 5 * number of channels.
6456 * Check ifsufficient buffer is available and then
6457 * proceed to fill the buffer.
6458 */
6459 if (WE_MAX_STR_LEN <
6460 (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006461 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006462 return -EINVAL;
6463 }
6464 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
6465 channel_list.num_channels);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006466 if (QDF_STATUS_SUCCESS == sme_get_country_code(mac_handle,
6467 ubuf,
6468 &ubuf_len)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006469 /* Printing Country code in getChannelList */
6470 for (i = 0; i < (ubuf_len - 1); i++)
6471 len += scnprintf(buf + len,
6472 WE_MAX_STR_LEN - len,
6473 "%c", ubuf[i]);
6474 }
6475 for (i = 0; i < channel_list.num_channels; i++) {
6476 len +=
6477 scnprintf(buf + len, WE_MAX_STR_LEN - len,
6478 " %u", channel_list.channels[i]);
6479 }
6480 wrqu->data.length = strlen(extra) + 1;
6481
6482 break;
6483 }
6484#ifdef FEATURE_WLAN_TDLS
6485 case WE_GET_TDLS_PEERS:
6486 {
6487 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006488 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006489 WE_MAX_STR_LEN) + 1;
6490 break;
6491 }
6492#endif
6493#ifdef WLAN_FEATURE_11W
6494 case WE_GET_11W_INFO:
6495 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006496 struct csr_roam_profile *roam_profile =
6497 hdd_roam_profile(adapter);
6498
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006499 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006500 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006501
6502 snprintf(extra, WE_MAX_STR_LEN,
6503 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
6504 "\n Number of Unprotected Disassocs %d"
6505 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006506 roam_profile->BSSIDs.bssid->bytes[0],
6507 roam_profile->BSSIDs.bssid->bytes[1],
6508 roam_profile->BSSIDs.bssid->bytes[2],
6509 roam_profile->BSSIDs.bssid->bytes[3],
6510 roam_profile->BSSIDs.bssid->bytes[4],
6511 roam_profile->BSSIDs.bssid->bytes[5],
6512 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07006513 adapter->hdd_stats.hdd_pmf_stats.
6514 num_unprot_disassoc_rx,
6515 adapter->hdd_stats.hdd_pmf_stats.
6516 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006517
6518 wrqu->data.length = strlen(extra) + 1;
6519 break;
6520 }
6521#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006522 case WE_GET_IBSS_STA_INFO:
6523 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07006524 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006525 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006526 int idx = 0;
6527 int length = 0, buf = 0;
6528
Naveen Rawatc45d1622016-07-05 12:20:09 -07006529 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07006530 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07006531 sta_ctx->conn_info.staId[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006532 buf = snprintf
6533 ((extra + length),
6534 WE_MAX_STR_LEN - length,
6535 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnsond377dce2017-10-04 10:32:42 -07006536 sta_ctx->conn_info.staId[idx],
6537 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006538 peerMacAddress[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006539 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006540 peerMacAddress[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006541 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006542 peerMacAddress[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006543 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006544 peerMacAddress[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006545 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006546 peerMacAddress[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006547 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006548 peerMacAddress[idx].bytes[5]
6549 );
6550 length += buf;
6551 }
6552 }
6553 wrqu->data.length = strlen(extra) + 1;
6554 break;
6555 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006556 case WE_GET_PHYMODE:
6557 {
6558 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006559 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006560 eCsrPhyMode phymode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006561 enum band_info currBand;
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006562 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006563
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006564 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6565 if (!sme_config) {
6566 hdd_err("Out of memory");
6567 ret = -ENOMEM;
6568 break;
6569 }
6570
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006571 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006572 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006573 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006574 ch_bond24 = true;
6575
6576 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006577 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006578 ch_bond5g = true;
6579
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006580 qdf_mem_free(sme_config);
6581
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006582 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306583 if ((QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006584 sme_get_freq_band(mac_handle, &currBand))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006585 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006586 return -EIO;
6587 }
6588
6589 switch (phymode) {
6590 case eCSR_DOT11_MODE_AUTO:
6591 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
6592 break;
6593 case eCSR_DOT11_MODE_11n:
6594 case eCSR_DOT11_MODE_11n_ONLY:
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006595 if (currBand == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006596 if (ch_bond24)
6597 snprintf(extra, WE_MAX_STR_LEN,
6598 "11NGHT40");
6599 else
6600 snprintf(extra, WE_MAX_STR_LEN,
6601 "11NGHT20");
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006602 } else if (currBand == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006603 if (ch_bond5g)
6604 snprintf(extra, WE_MAX_STR_LEN,
6605 "11NAHT40");
6606 else
6607 snprintf(extra, WE_MAX_STR_LEN,
6608 "11NAHT20");
6609 } else {
6610 snprintf(extra, WE_MAX_STR_LEN, "11N");
6611 }
6612 break;
6613 case eCSR_DOT11_MODE_abg:
6614 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
6615 break;
6616 case eCSR_DOT11_MODE_11a:
6617 snprintf(extra, WE_MAX_STR_LEN, "11A");
6618 break;
6619 case eCSR_DOT11_MODE_11b:
6620 case eCSR_DOT11_MODE_11b_ONLY:
6621 snprintf(extra, WE_MAX_STR_LEN, "11B");
6622 break;
6623 case eCSR_DOT11_MODE_11g:
6624 case eCSR_DOT11_MODE_11g_ONLY:
6625 snprintf(extra, WE_MAX_STR_LEN, "11G");
6626 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006627 case eCSR_DOT11_MODE_11ac:
6628 case eCSR_DOT11_MODE_11ac_ONLY:
6629 if (hddctx->config->vhtChannelWidth ==
6630 eHT_CHANNEL_WIDTH_20MHZ)
6631 snprintf(extra, WE_MAX_STR_LEN,
6632 "11ACVHT20");
6633 else if (hddctx->config->vhtChannelWidth ==
6634 eHT_CHANNEL_WIDTH_40MHZ)
6635 snprintf(extra, WE_MAX_STR_LEN,
6636 "11ACVHT40");
6637 else if (hddctx->config->vhtChannelWidth ==
6638 eHT_CHANNEL_WIDTH_80MHZ)
6639 snprintf(extra, WE_MAX_STR_LEN,
6640 "11ACVHT80");
6641 else if (hddctx->config->vhtChannelWidth ==
6642 eHT_CHANNEL_WIDTH_160MHZ)
6643 snprintf(extra, WE_MAX_STR_LEN,
6644 "11ACVHT160");
6645 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006646 case eCSR_DOT11_MODE_11ax:
6647 case eCSR_DOT11_MODE_11ax_ONLY:
6648 /* currently using vhtChannelWidth */
6649 if (hddctx->config->vhtChannelWidth ==
6650 eHT_CHANNEL_WIDTH_20MHZ)
6651 snprintf(extra, WE_MAX_STR_LEN,
6652 "11AX_HE_20");
6653 else if (hddctx->config->vhtChannelWidth ==
6654 eHT_CHANNEL_WIDTH_40MHZ)
6655 snprintf(extra, WE_MAX_STR_LEN,
6656 "11AX_HE_40");
6657 else if (hddctx->config->vhtChannelWidth ==
6658 eHT_CHANNEL_WIDTH_80MHZ)
6659 snprintf(extra, WE_MAX_STR_LEN,
6660 "11AX_HE_80");
6661 else if (hddctx->config->vhtChannelWidth ==
6662 eHT_CHANNEL_WIDTH_160MHZ)
6663 snprintf(extra, WE_MAX_STR_LEN,
6664 "11AX_HE_160");
6665 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006666 }
6667
6668 wrqu->data.length = strlen(extra) + 1;
6669 break;
6670 }
6671
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006672 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08006673 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006674 case WE_GET_SNR:
6675 {
6676 int8_t s7snr = 0;
6677 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006678 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07006679 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006680
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006681 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006682 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05306683 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006684 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05306685
Jeff Johnsond377dce2017-10-04 10:32:42 -07006686 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006687 if (0 == hdd_ctx->config->fEnableSNRMonitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006688 eConnectionState_Associated !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07006689 sta_ctx->conn_info.connState) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006690 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006691 hdd_ctx->config->fEnableSNRMonitoring,
Jeff Johnsond377dce2017-10-04 10:32:42 -07006692 sta_ctx->conn_info.connState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006693 return -ENONET;
6694 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006695 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006696 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
6697 wrqu->data.length = strlen(extra) + 1;
6698 break;
6699 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006700
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006701 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006702 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006703 break;
6704 }
Dustin Brownd9322482017-01-09 12:46:03 -08006705
Dustin Browne74003f2018-03-14 12:51:58 -07006706 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08006707 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006708}
6709
6710static int iw_get_char_setnone(struct net_device *dev,
6711 struct iw_request_info *info,
6712 union iwreq_data *wrqu, char *extra)
6713{
6714 int ret;
6715
6716 cds_ssr_protect(__func__);
6717 ret = __iw_get_char_setnone(dev, info, wrqu, extra);
6718 cds_ssr_unprotect(__func__);
6719
6720 return ret;
6721}
6722
6723/**
6724 * iw_setnone_getnone() - Generic "action" private ioctl handler
6725 * @dev: device upon which the ioctl was received
6726 * @info: ioctl request information
6727 * @wrqu: ioctl request data
6728 * @extra: ioctl extra data
6729 *
6730 * Return: 0 on success, non-zero on error
6731 */
6732static int __iw_setnone_getnone(struct net_device *dev,
6733 struct iw_request_info *info,
6734 union iwreq_data *wrqu, char *extra)
6735{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006736 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006737 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006738 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006739 int ret;
6740 int sub_cmd;
6741
Dustin Brownfdf17c12018-03-14 12:55:34 -07006742 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306743
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006744 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006745 ret = wlan_hdd_validate_context(hdd_ctx);
6746 if (0 != ret)
6747 return ret;
6748
Jeff Johnson441e1f72017-02-07 08:50:49 -08006749 ret = hdd_check_private_wext_control(hdd_ctx, info);
6750 if (0 != ret)
6751 return ret;
6752
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006753#ifdef CONFIG_COMPAT
6754 /* this ioctl is a special case where a sub-ioctl is used and both
6755 * the number of get and set args is 0. in this specific case the
6756 * logic in iwpriv places the sub_cmd in the data.flags portion of
6757 * the iwreq. unfortunately the location of this field will be
6758 * different between 32-bit and 64-bit userspace, and the standard
6759 * compat support in the kernel does not handle this case. so we
6760 * need to explicitly handle it here.
6761 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07006762 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006763 struct compat_iw_point *compat_iw_point =
6764 (struct compat_iw_point *)&wrqu->data;
6765 sub_cmd = compat_iw_point->flags;
6766 } else {
6767 sub_cmd = wrqu->data.flags;
6768 }
6769#else
6770 sub_cmd = wrqu->data.flags;
6771#endif
6772
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006773 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006774 switch (sub_cmd) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006775
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006776 case WE_GET_RECOVERY_STAT:
6777 sme_get_recovery_stats(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006778 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006779
Govind Singha471e5e2015-10-12 17:11:14 +05306780 case WE_GET_FW_PROFILE_DATA:
Jeff Johnson1b780e42017-10-31 14:11:45 -07006781 ret = wma_cli_set_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05306782 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
6783 0, DBG_CMD);
6784 break;
6785
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006786 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006787 hdd_wlan_get_ibss_peer_info_all(adapter);
6788 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006789
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006790 case WE_SET_REASSOC_TRIGGER:
6791 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07006792 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306793 tSirMacAddr bssid;
Krunal Sonibfd05492017-10-03 15:48:37 -07006794 uint32_t roamId = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306795 uint8_t operating_ch =
Jeff Johnsonb9424862017-10-30 08:49:35 -07006796 adapter->session.station.conn_info.operationChannel;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006797 tCsrRoamModifyProfileFields modProfileFields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006798
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006799 sme_get_modify_profile_fields(mac_handle, adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006800 &modProfileFields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306801 if (roaming_offload_enabled(hdd_ctx)) {
6802 qdf_mem_copy(bssid,
Jeff Johnsonb9424862017-10-30 08:49:35 -07006803 &adapter->session.station.conn_info.bssId,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306804 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08006805 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306806 bssid, operating_ch);
6807 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006808 sme_roam_reassoc(mac_handle, adapter->session_id,
6809 NULL, modProfileFields, &roamId, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306810 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006811 return 0;
6812 }
6813
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006814 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006815 /*
6816 * 1.OBSS Scan is mandatory while operating in 2.4GHz
6817 * 2.OBSS scan is stopped by Firmware during the disassociation
6818 * 3.OBSS stop comamnd is added for debugging purpose
6819 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006820 if (!mac_handle) {
6821 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006822 return -EINVAL;
6823 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006824 sme_ht40_stop_obss_scan(mac_handle, adapter->session_id);
6825 break;
6826
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006827 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006828 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006829 break;
6830 }
Dustin Browne74003f2018-03-14 12:51:58 -07006831 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006832 return ret;
6833}
6834
6835static int iw_setnone_getnone(struct net_device *dev,
6836 struct iw_request_info *info,
6837 union iwreq_data *wrqu, char *extra)
6838{
6839 int ret;
6840
6841 cds_ssr_protect(__func__);
6842 ret = __iw_setnone_getnone(dev, info, wrqu, extra);
6843 cds_ssr_unprotect(__func__);
6844
6845 return ret;
6846}
6847
Krunal Sonia6e505b2017-01-12 12:25:18 -08006848#ifdef MPC_UT_FRAMEWORK
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006849static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07006850 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08006851{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08006852 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08006853 case WE_POLICY_MANAGER_CLIST_CMD:
6854 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006855 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306856 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306857 (apps_args[2] < 0) || (apps_args[3] < 0) ||
6858 (apps_args[4] < 0) || (apps_args[5] < 0) ||
6859 (apps_args[6] < 0) || (apps_args[7] < 0)) {
6860 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306861 return 0;
6862 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006863 policy_mgr_incr_connection_count_utfw(hdd_ctx->hdd_psoc,
6864 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
6865 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006866 }
6867 break;
6868
6869 case WE_POLICY_MANAGER_DLIST_CMD:
6870 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006871 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306872 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306873 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306874 return 0;
6875 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006876 policy_mgr_decr_connection_count_utfw(hdd_ctx->hdd_psoc,
6877 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006878 }
6879 break;
6880
6881 case WE_POLICY_MANAGER_ULIST_CMD:
6882 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006883 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306884 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306885 (apps_args[2] < 0) || (apps_args[3] < 0) ||
6886 (apps_args[4] < 0) || (apps_args[5] < 0) ||
6887 (apps_args[6] < 0) || (apps_args[7] < 0)) {
6888 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306889 return 0;
6890 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006891 policy_mgr_update_connection_info_utfw(hdd_ctx->hdd_psoc,
6892 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
6893 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006894 }
6895 break;
6896
6897 case WE_POLICY_MANAGER_DBS_CMD:
6898 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006899 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08006900 if (apps_args[0] == 0)
6901 wma_set_dbs_capability_ut(0);
6902 else
6903 wma_set_dbs_capability_ut(1);
6904
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006905 if (apps_args[1] >= PM_THROUGHPUT &&
6906 apps_args[1] <= PM_LATENCY) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08006907 pr_info("setting system pref to [%d]\n", apps_args[1]);
6908 hdd_ctx->config->conc_system_pref = apps_args[1];
6909 }
6910 }
6911 break;
6912
6913 case WE_POLICY_MANAGER_PCL_CMD:
6914 {
6915 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
6916 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
6917 uint32_t pcl_len = 0, i = 0;
6918
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07006919 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08006920
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306921 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306922 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306923 return 0;
6924 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006925 policy_mgr_get_pcl(hdd_ctx->hdd_psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08006926 pcl, &pcl_len,
6927 weight_list, QDF_ARRAY_SIZE(weight_list));
6928 pr_info("PCL list for role[%d] is {", apps_args[0]);
6929 for (i = 0 ; i < pcl_len; i++)
6930 pr_info(" %d, ", pcl[i]);
6931 pr_info("}--------->\n");
6932 }
6933 break;
6934
6935 case WE_POLICY_SET_HW_MODE_CMD:
6936 {
6937 if (apps_args[0] == 0) {
6938 hdd_err("set hw mode for single mac");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006939 policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc,
Jeff Johnson1b780e42017-10-31 14:11:45 -07006940 adapter->session_id,
Krunal Sonia6e505b2017-01-12 12:25:18 -08006941 HW_MODE_SS_2x2,
6942 HW_MODE_80_MHZ,
6943 HW_MODE_SS_0x0, HW_MODE_BW_NONE,
Liangwei Dong0f9c75d2018-05-22 22:14:37 -04006944 HW_MODE_MAC_BAND_NONE,
Krunal Sonia6e505b2017-01-12 12:25:18 -08006945 HW_MODE_DBS_NONE,
6946 HW_MODE_AGILE_DFS_NONE,
6947 HW_MODE_SBS_NONE,
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07006948 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006949 } else if (apps_args[0] == 1) {
6950 hdd_err("set hw mode for dual mac");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006951 policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc,
Jeff Johnson1b780e42017-10-31 14:11:45 -07006952 adapter->session_id,
Krunal Sonia6e505b2017-01-12 12:25:18 -08006953 HW_MODE_SS_1x1,
6954 HW_MODE_80_MHZ,
6955 HW_MODE_SS_1x1, HW_MODE_40_MHZ,
Liangwei Dong0f9c75d2018-05-22 22:14:37 -04006956 HW_MODE_MAC_BAND_NONE,
Krunal Sonia6e505b2017-01-12 12:25:18 -08006957 HW_MODE_DBS,
6958 HW_MODE_AGILE_DFS_NONE,
6959 HW_MODE_SBS_NONE,
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07006960 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006961 }
6962 }
6963 break;
6964
6965 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
6966 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07006967 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306968 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306969 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306970 return 0;
6971 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07006972 policy_mgr_current_connections_update(
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006973 hdd_ctx->hdd_psoc,
Jeff Johnson1b780e42017-10-31 14:11:45 -07006974 adapter->session_id, apps_args[0],
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07006975 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006976 }
6977 break;
6978
6979 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
6980 {
6981 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006982
Dustin Brown5e89ef82018-03-14 11:50:23 -07006983 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306984 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306985 (apps_args[2] < 0)) {
6986 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306987 return 0;
6988 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006989 allow = policy_mgr_allow_concurrency(hdd_ctx->hdd_psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08006990 apps_args[0], apps_args[1], apps_args[2]);
6991 pr_info("allow %d {0 = don't allow, 1 = allow}", allow);
6992 }
6993 break;
6994
6995 case WE_POLICY_MANAGER_SCENARIO_CMD:
6996 {
6997 clean_report(hdd_ctx);
6998 if (apps_args[0] == 1) {
6999 wlan_hdd_one_connection_scenario(hdd_ctx);
7000 } else if (apps_args[0] == 2) {
7001 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007002 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007003 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007004 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007005 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007006 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007007 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007008 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007009 } else if (apps_args[0] == 3) {
7010 /* MCC on same band with 2x2 same mac*/
7011 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007012 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007013 /* MCC on diff band with 2x2 same mac*/
7014 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007015 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007016 /* MCC on diff band with 1x1 diff mac */
7017 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007018 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007019 /* MCC on diff band with 1x1 same mac */
7020 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007021 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007022 /* SCC on same band with 2x2 same mac */
7023 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007024 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007025 /* SCC on same band with 1x1 same mac */
7026 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007027 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007028 /* MCC on same band with 2x2 same mac */
7029 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007030 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007031 /* MCC on same band with 1x1 same mac */
7032 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007033 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007034 }
7035 print_report(hdd_ctx);
7036 }
7037 break;
7038 }
7039 return 0;
7040}
7041#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007042static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007043 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007044{
7045 return 0;
7046}
7047#endif
7048
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007049/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007050 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7051 * @hdd_ctx: hdd_context
7052 * @num_args: input args number
7053 * @apps_args: args data ptr
7054 *
7055 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7056 *
7057 * Return: void
7058 */
7059#if WLAN_DEBUG
7060static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7061 int num_args, int *apps_args)
7062{
7063 struct ch_avoid_ind_type ch_avoid;
7064 int cnt = 0, i;
7065
7066 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7067 num_args % 2 != 0)
7068 return;
7069 hdd_info("simulate ch avoid num_args %d", num_args);
7070 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7071 ch_avoid.avoid_freq_range[cnt].start_freq =
7072 apps_args[i];
7073 ch_avoid.avoid_freq_range[cnt].end_freq =
7074 apps_args[++i];
7075
7076 hdd_info("simulate ch avoid [%d %d]",
7077 ch_avoid.avoid_freq_range[cnt].start_freq,
7078 ch_avoid.avoid_freq_range[cnt].end_freq);
7079 cnt++;
7080 }
7081 ch_avoid.ch_avoid_range_cnt = cnt;
7082 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->hdd_psoc, &ch_avoid);
7083}
7084#else
7085static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7086 int num_args, int *apps_args)
7087{
7088}
7089#endif
7090/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007091 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7092 * @dev: device upon which the ioctl was received
7093 * @info: ioctl request information
7094 * @wrqu: ioctl request data
7095 * @extra: ioctl extra data
7096 *
7097 * This is an SSR-protected generic handler for private ioctls which
7098 * take multiple arguments. Note that this implementation is also
7099 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7100 * interfaces.
7101 *
7102 * Return: 0 on success, non-zero on error
7103 */
7104static int __iw_set_var_ints_getnone(struct net_device *dev,
7105 struct iw_request_info *info,
7106 union iwreq_data *wrqu, char *extra)
7107{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007108 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007109 mac_handle_t mac_handle;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007110 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007111 int sub_cmd;
7112 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007113 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007114 int ret, num_args;
chenguoaa7c90c2018-05-24 17:08:47 +08007115 void *soc = NULL;
7116 struct cdp_pdev *pdev = NULL;
7117 struct cdp_vdev *vdev = NULL;
7118 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007119
Dustin Brownfdf17c12018-03-14 12:55:34 -07007120 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307121
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007122 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007123 ret = wlan_hdd_validate_context(hdd_ctx);
7124 if (0 != ret)
7125 return ret;
7126
Jeff Johnson441e1f72017-02-07 08:50:49 -08007127 ret = hdd_check_private_wext_control(hdd_ctx, info);
7128 if (0 != ret)
7129 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007130
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007131 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007132 sub_cmd = wrqu->data.flags;
7133 num_args = wrqu->data.length;
7134
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007135 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007136
7137 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007138 case WE_IBSS_GET_PEER_INFO:
7139 {
7140 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007141 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007142 }
7143 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007144
7145 case WE_P2P_NOA_CMD:
7146 {
Srinivas Girigowda5d5fdc52017-03-24 22:30:57 -07007147 struct p2p_app_set_ps p2pNoA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007148
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007149 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007150 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
7151 hdd_device_mode_to_string(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007152 adapter->device_mode),
7153 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007154 return -EINVAL;
7155 }
7156
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007157 p2pNoA.opp_ps = apps_args[0];
7158 p2pNoA.ctWindow = apps_args[1];
7159 p2pNoA.duration = apps_args[2];
7160 p2pNoA.interval = apps_args[3];
7161 p2pNoA.count = apps_args[4];
7162 p2pNoA.single_noa_duration = apps_args[5];
7163 p2pNoA.psSelection = apps_args[6];
7164
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007165 hdd_debug("P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d interval %d count %d single noa duration %d PsSelection %x",
Jeff Johnson99bac312016-06-28 10:38:18 -07007166 apps_args[0], apps_args[1], apps_args[2],
7167 apps_args[3], apps_args[4],
7168 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007169
7170 hdd_set_p2p_ps(dev, &p2pNoA);
7171
7172 }
7173 break;
7174
7175 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7176 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007177 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007178 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307179 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007180 }
7181 break;
7182
7183 case WE_MTRACE_DUMP_CMD:
7184 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007185 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007186 apps_args[0], apps_args[1],
7187 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007188 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007189 apps_args[1], apps_args[2],
7190 apps_args[3]);
7191
7192 }
7193 break;
7194
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007195 case WE_POLICY_MANAGER_CINFO_CMD:
7196 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007197 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007198 uint32_t i = 0, len = 0;
7199
Krunal Sonia6e505b2017-01-12 12:25:18 -08007200 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007201 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007202 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007203 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007204 pr_info("|table_index[%d]\t\t\n", i);
7205 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
7206 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
7207 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7208 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7209 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7210 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7211 pr_info("+--------------------------+\n");
7212 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007213 }
7214 }
7215 break;
7216
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007217 case WE_UNIT_TEST_CMD:
7218 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007219 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007220
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007221 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7222 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007223 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007224 return -EINVAL;
7225 }
Krunal Soniaadaa272017-10-04 16:42:55 -07007226 if ((apps_args[1] >= (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307227 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007228 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007229 return -EINVAL;
7230 }
Jeff Johnson1b780e42017-10-31 14:11:45 -07007231 status = sme_send_unit_test_cmd(adapter->session_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007232 apps_args[0],
7233 apps_args[1],
7234 &apps_args[2]);
7235 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007236 hdd_err("sme_send_unit_test_cmd returned %d", status);
7237 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007238 }
7239 }
7240 break;
7241#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7242 case WE_LED_FLASHING_PARAM:
7243 {
7244 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007245
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007246 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007247 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007248 return -EINVAL;
7249 }
7250 for (i = 0; i < num_args; i++) {
7251 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007252 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007253 return -EINVAL;
7254 }
7255 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007256 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007257 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007258 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007259 1, apps_args[2], apps_args[3]);
7260 }
7261 break;
7262#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05307263 case WE_SET_PKTLOG:
7264 {
7265 int ret;
7266
7267 if (num_args < 1 || num_args > 2) {
7268 hdd_err("pktlog: either 1 or 2 parameters are required");
7269 return -EINVAL;
7270 }
7271
7272 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
7273 apps_args[1]);
7274 if (ret)
7275 return ret;
7276 break;
7277 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05307278 case WE_MAC_PWR_DEBUG_CMD:
7279 {
7280 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05307281 int i, j;
7282
7283 if (num_args < 3) {
7284 hdd_err("number of arguments can't be null %d",
7285 num_args);
7286 return -EINVAL;
7287 }
7288 if (num_args - 3 != apps_args[2]) {
7289 hdd_err("arg list of size %d doesn't match num_args %d",
7290 num_args-3, apps_args[2]);
7291 return -EINVAL;
7292 }
7293 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
7294 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
7295 hdd_err("Invalid MODULE ID %d", apps_args[1]);
7296 return -EINVAL;
7297 }
7298 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
7299 hdd_err("Too Many args %d", apps_args[2]);
7300 return -EINVAL;
7301 }
7302 mac_pwr_dbg_args.pdev_id = apps_args[0];
7303 mac_pwr_dbg_args.module_id = apps_args[1];
7304 mac_pwr_dbg_args.num_args = apps_args[2];
7305
7306 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
7307 mac_pwr_dbg_args.args[i] = apps_args[j];
7308
7309 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007310 sme_process_mac_pwr_dbg_cmd(mac_handle,
7311 adapter->session_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05307312 &mac_pwr_dbg_args)) {
7313 return -EINVAL;
7314 }
7315 }
7316 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08007317 case WE_POLICY_MANAGER_CLIST_CMD:
7318 case WE_POLICY_MANAGER_DLIST_CMD:
7319 case WE_POLICY_MANAGER_ULIST_CMD:
7320 case WE_POLICY_MANAGER_DBS_CMD:
7321 case WE_POLICY_MANAGER_PCL_CMD:
7322 case WE_POLICY_SET_HW_MODE_CMD:
7323 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7324 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7325 case WE_POLICY_MANAGER_SCENARIO_CMD:
7326 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007327 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Sonia6e505b2017-01-12 12:25:18 -08007328 sub_cmd, apps_args);
7329 }
7330 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007331 case WE_SET_CHAN_AVOID:
7332 {
7333 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
7334 }
7335 break;
chenguoaa7c90c2018-05-24 17:08:47 +08007336 case WE_SET_TXRX_STATS:
7337 {
7338 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
7339 adapter->session_id);
7340
7341 if (ret != 0) {
7342 hdd_err("Invalid handles");
7343 break;
7344 }
7345
7346 req.stats = apps_args[0];
7347 /* default value of secondary parameter is 0(mac_id) */
7348 req.mac_id = apps_args[1];
7349
7350 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
7351 req.stats, req.mac_id);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007352 if (apps_args[0] == CDP_TXRX_STATS_28) {
7353 if (sta_ctx->conn_info.uIsAuthenticated) {
7354 hdd_debug("ap mac addr: %pM",
7355 (void *)&sta_ctx->conn_info.bssId);
7356 req.peer_addr =
7357 (char *)&sta_ctx->conn_info.bssId;
7358 }
7359 }
chenguoaa7c90c2018-05-24 17:08:47 +08007360 ret = cdp_txrx_stats_request(soc, vdev, &req);
7361 break;
7362 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007363 default:
7364 {
Jeff Johnson99bac312016-06-28 10:38:18 -07007365 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007366 }
7367 break;
7368 }
Dustin Browne74003f2018-03-14 12:51:58 -07007369 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007370 return 0;
7371}
7372
7373/**
7374 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
7375 * @dev: pointer to net_device structure
7376 * @info: pointer to iw_request_info structure
7377 * @wrqu: pointer to iwreq_data
7378 * @extra; extra
7379 *
7380 * Return: 0 on success, error number otherwise
7381 *
7382 */
7383static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
7384 struct iw_request_info *info,
7385 union iwreq_data *wrqu, char *extra)
7386{
7387 union iwreq_data u_priv_wrqu;
7388 int apps_args[MAX_VAR_ARGS] = {0};
7389 int ret, num_args;
7390
Mukul Sharma64a70e82015-11-02 20:05:09 +05307391 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007392 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05307393 return -EPERM;
7394 }
7395
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007396 /* Helper function to get iwreq_data with compat handling. */
7397 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
7398 return -EINVAL;
7399
7400 if (NULL == u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007401 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007402 return -EINVAL;
7403 }
7404
7405 num_args = u_priv_wrqu.data.length;
7406 if (num_args > MAX_VAR_ARGS)
7407 num_args = MAX_VAR_ARGS;
7408
7409 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
7410 (sizeof(int)) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007411 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007412 return -EFAULT;
7413 }
7414
7415 cds_ssr_protect(__func__);
7416 ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
7417 (char *)&apps_args);
7418 cds_ssr_unprotect(__func__);
7419 return ret;
7420}
7421
7422/**
7423 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7424 * @dev: device upon which the ioctl was received
7425 * @info: ioctl request information
7426 * @wrqu: ioctl request data
7427 * @extra: ioctl extra data
7428 *
7429 * This is a generic handler for private ioctls which take multiple
7430 * arguments. Note that this implementation is also somewhat unique
7431 * in that it is shared by both STA-mode and SAP-mode interfaces.
7432 *
7433 * Return: 0 on success, non-zero on error
7434 */
7435int iw_set_var_ints_getnone(struct net_device *dev,
7436 struct iw_request_info *info,
7437 union iwreq_data *wrqu, char *extra)
7438{
7439 int ret;
7440
7441 cds_ssr_protect(__func__);
7442 ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
7443 cds_ssr_unprotect(__func__);
7444 return ret;
7445}
7446
7447/**
7448 * iw_add_tspec - Add TSpec private ioctl handler
7449 * @dev: device upon which the ioctl was received
7450 * @info: ioctl request information
7451 * @wrqu: ioctl request data
7452 * @extra: ioctl extra data
7453 *
7454 * Return: 0 on success, non-zero on error
7455 */
7456static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
7457 union iwreq_data *wrqu, char *extra)
7458{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007459 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07007460 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007461 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7462 int params[HDD_WLAN_WMM_PARAM_COUNT];
Abhishek Singh12be60f2017-08-11 13:52:42 +05307463 struct sme_qos_wmmtspecinfo tSpec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007464 uint32_t handle;
7465 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007466 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007467 int ret;
7468
Dustin Brownfdf17c12018-03-14 12:55:34 -07007469 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307470
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007471 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007472 ret = wlan_hdd_validate_context(hdd_ctx);
7473 if (0 != ret)
7474 return ret;
7475
Jeff Johnson441e1f72017-02-07 08:50:49 -08007476 ret = hdd_check_private_wext_control(hdd_ctx, info);
7477 if (0 != ret)
7478 return ret;
7479
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007480 /* make sure the application is sufficiently priviledged */
7481 /* note that the kernel will do this for "set" ioctls, but since */
7482 /* this ioctl wants to return status to user space it must be */
7483 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007484 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007485 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007486
7487 /* we must be associated in order to add a tspec */
Jeff Johnsond377dce2017-10-04 10:32:42 -07007488 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007489 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7490 return 0;
7491 }
7492 /* since we are defined to be a "get" ioctl, and since the number */
7493 /* of params exceeds the number of params that wireless extensions */
7494 /* will pass down in the iwreq_data, we must copy the "set" params. */
7495 /* We must handle the compat for iwreq_data in 32U/64K environment. */
7496
7497 /* helper function to get iwreq_data with compat handling. */
7498 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
7499 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7500 return 0;
7501 }
7502 /* make sure all params are correctly passed to function */
7503 if ((NULL == s_priv_data.pointer) ||
7504 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
7505 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7506 return 0;
7507 }
7508 /* from user space ourselves */
7509 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
7510 /* hmmm, can't get them */
7511 return -EIO;
7512 }
7513 /* clear the tspec */
7514 memset(&tSpec, 0, sizeof(tSpec));
7515
7516 /* validate the handle */
7517 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7518 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7519 /* that one is reserved */
7520 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7521 return 0;
7522 }
7523 /* validate the TID */
7524 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
7525 /* out of range */
7526 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7527 return 0;
7528 }
7529 tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
7530
7531 /* validate the direction */
7532 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
7533 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
7534 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
7535 break;
7536
7537 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
7538 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
7539 break;
7540
7541 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
7542 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
7543 break;
7544
7545 default:
7546 /* unknown */
7547 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7548 return 0;
7549 }
7550
7551 tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
7552
7553 /* validate the user priority */
7554 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
7555 /* out of range */
7556 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7557 return 0;
7558 }
7559 tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
7560 if (0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007561 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007562 return 0;
7563 }
7564
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007565 hdd_debug("TS_INFO PSB %d UP %d !!!",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007566 tSpec.ts_info.psb, tSpec.ts_info.up);
7567
7568 tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
7569 tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
7570 tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
7571 tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
7572 tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
7573 tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
7574 tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
7575 tSpec.surplus_bw_allowance =
7576 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
7577 tSpec.min_service_interval =
7578 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
7579 tSpec.max_service_interval =
7580 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
7581 tSpec.suspension_interval =
7582 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
7583 tSpec.inactivity_interval =
7584 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
7585
7586 tSpec.ts_info.burst_size_defn =
7587 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
7588
7589 /* validate the ts info ack policy */
7590 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
7591 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK:
7592 tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
7593 break;
7594
7595 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
7596 tSpec.ts_info.ack_policy =
7597 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
7598 break;
7599
7600 default:
7601 /* unknown */
7602 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7603 return 0;
7604 }
7605
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007606 *pStatus = hdd_wmm_addts(adapter, handle, &tSpec);
Dustin Browne74003f2018-03-14 12:51:58 -07007607 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007608 return 0;
7609}
7610
7611static int iw_add_tspec(struct net_device *dev,
7612 struct iw_request_info *info,
7613 union iwreq_data *wrqu, char *extra)
7614{
7615 int ret;
7616
7617 cds_ssr_protect(__func__);
7618 ret = __iw_add_tspec(dev, info, wrqu, extra);
7619 cds_ssr_unprotect(__func__);
7620
7621 return ret;
7622}
7623
7624/**
7625 * iw_del_tspec - Delete TSpec private ioctl handler
7626 * @dev: device upon which the ioctl was received
7627 * @info: ioctl request information
7628 * @wrqu: ioctl request data
7629 * @extra: ioctl extra data
7630 *
7631 * Return: 0 on success, non-zero on error
7632 */
7633static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
7634 union iwreq_data *wrqu, char *extra)
7635{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007636 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007637 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007638 int *params = (int *)extra;
7639 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7640 uint32_t handle;
7641 int ret;
7642
Dustin Brownfdf17c12018-03-14 12:55:34 -07007643 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307644
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007645 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007646 ret = wlan_hdd_validate_context(hdd_ctx);
7647 if (0 != ret)
7648 return ret;
7649
Jeff Johnson441e1f72017-02-07 08:50:49 -08007650 ret = hdd_check_private_wext_control(hdd_ctx, info);
7651 if (0 != ret)
7652 return ret;
7653
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007654 /* make sure the application is sufficiently priviledged */
7655 /* note that the kernel will do this for "set" ioctls, but since */
7656 /* this ioctl wants to return status to user space it must be */
7657 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007658 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007659 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007660
7661 /* although we are defined to be a "get" ioctl, the params we require */
7662 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
7663 /* is no need to copy the params from user space */
7664
7665 /* validate the handle */
7666 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7667 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7668 /* that one is reserved */
7669 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7670 return 0;
7671 }
7672
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007673 *pStatus = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07007674 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007675 return 0;
7676}
7677
7678static int iw_del_tspec(struct net_device *dev,
7679 struct iw_request_info *info,
7680 union iwreq_data *wrqu, char *extra)
7681{
7682 int ret;
7683
7684 cds_ssr_protect(__func__);
7685 ret = __iw_del_tspec(dev, info, wrqu, extra);
7686 cds_ssr_unprotect(__func__);
7687
7688 return ret;
7689}
7690
7691/**
7692 * iw_get_tspec - Get TSpec private ioctl handler
7693 * @dev: device upon which the ioctl was received
7694 * @info: ioctl request information
7695 * @wrqu: ioctl request data
7696 * @extra: ioctl extra data
7697 *
7698 * Return: 0 on success, non-zero on error
7699 */
7700static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
7701 union iwreq_data *wrqu, char *extra)
7702{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007703 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007704 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007705 int *params = (int *)extra;
7706 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7707 uint32_t handle;
7708 int ret;
7709
Dustin Brownfdf17c12018-03-14 12:55:34 -07007710 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307711
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007712 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007713 ret = wlan_hdd_validate_context(hdd_ctx);
7714 if (0 != ret)
7715 return ret;
7716
Jeff Johnson441e1f72017-02-07 08:50:49 -08007717 ret = hdd_check_private_wext_control(hdd_ctx, info);
7718 if (0 != ret)
7719 return ret;
7720
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007721 /* although we are defined to be a "get" ioctl, the params we require */
7722 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
7723 /* is no need to copy the params from user space */
7724
7725 /* validate the handle */
7726 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7727 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7728 /* that one is reserved */
7729 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7730 return 0;
7731 }
7732
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007733 *pStatus = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07007734 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007735 return 0;
7736}
7737
7738static int iw_get_tspec(struct net_device *dev,
7739 struct iw_request_info *info,
7740 union iwreq_data *wrqu, char *extra)
7741{
7742 int ret;
7743
7744 cds_ssr_protect(__func__);
7745 ret = __iw_get_tspec(dev, info, wrqu, extra);
7746 cds_ssr_unprotect(__func__);
7747
7748 return ret;
7749}
7750
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007751/**
7752 * iw_set_fties - Set FT IEs private ioctl handler
7753 * @dev: device upon which the ioctl was received
7754 * @info: ioctl request information
7755 * @wrqu: ioctl request data
7756 * @extra: ioctl extra data
7757 *
7758 * Each time the supplicant has the auth_request or reassoc request
7759 * IEs ready they are pushed to the driver. The driver will in turn
7760 * use it to send out the auth req and reassoc req for 11r FT Assoc.
7761 *
7762 * Return: 0 on success, non-zero on error
7763 */
7764static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
7765 union iwreq_data *wrqu, char *extra)
7766{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007767 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07007768 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007769 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007770 int ret;
7771
Dustin Brownfdf17c12018-03-14 12:55:34 -07007772 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307773
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007774 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007775 ret = wlan_hdd_validate_context(hdd_ctx);
7776 if (0 != ret)
7777 return ret;
7778
Jeff Johnson441e1f72017-02-07 08:50:49 -08007779 ret = hdd_check_private_wext_control(hdd_ctx, info);
7780 if (0 != ret)
7781 return ret;
7782
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007783 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007784 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007785 return -EINVAL;
7786 }
7787 if (wrqu->data.pointer == NULL) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007788 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007789 return -EINVAL;
7790 }
7791 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsond377dce2017-10-04 10:32:42 -07007792 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007793 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007794 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007795 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007796 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007797 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007798
7799 /* Pass the received FT IEs to SME */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007800 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->session_id,
7801 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07007802 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007803 return 0;
7804}
7805
7806static int iw_set_fties(struct net_device *dev,
7807 struct iw_request_info *info,
7808 union iwreq_data *wrqu, char *extra)
7809{
7810 int ret;
7811
7812 cds_ssr_protect(__func__);
7813 ret = __iw_set_fties(dev, info, wrqu, extra);
7814 cds_ssr_unprotect(__func__);
7815
7816 return ret;
7817}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007818
Dustin Brown0cbc7572016-12-16 13:54:40 -08007819/**
7820 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
7821 * @dev: device upon which the ioctl was received
7822 * @info: ioctl request information
7823 * @wrqu: ioctl request data
7824 * @extra: ioctl extra data
7825 *
Dustin Brown860566f2017-01-31 15:24:43 -08007826 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
7827 * time being to provide guidance in migrating to standard APIs.
7828 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08007829 * Return: 0 on success, non-zero on error
7830 */
7831static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
7832 struct iw_request_info *info,
7833 union iwreq_data *wrqu,
7834 char *extra)
7835{
Dustin Brown860566f2017-01-31 15:24:43 -08007836 hdd_err("\n"
7837 "setMCBCFilter is obsolete. Use the following instead:\n"
7838 "Configure multicast filtering via the ‘ip’ command.\n"
7839 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
7840 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
7841 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
7842 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
7843 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007844 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08007845}
7846
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007847/**
7848 * iw_set_host_offload - Set host offload ioctl handler
7849 * @dev: device upon which the ioctl was received
7850 * @info: ioctl request information
7851 * @wrqu: ioctl request data
7852 * @extra: ioctl extra data
7853 *
7854 * Return: 0 on success, non-zero on error
7855 */
7856static int __iw_set_host_offload(struct net_device *dev,
7857 struct iw_request_info *info,
7858 union iwreq_data *wrqu, char *extra)
7859{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007860 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Srinivas Girigowda077143e2017-03-25 10:47:27 -07007861 struct host_offload_req *pRequest = (struct host_offload_req *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007862 tSirHostOffloadReq offloadRequest;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007863 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007864 int ret;
7865
Dustin Brownfdf17c12018-03-14 12:55:34 -07007866 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307867
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007868 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007869 ret = wlan_hdd_validate_context(hdd_ctx);
7870 if (0 != ret)
7871 return ret;
7872
Jeff Johnson441e1f72017-02-07 08:50:49 -08007873 ret = hdd_check_private_wext_control(hdd_ctx, info);
7874 if (0 != ret)
7875 return ret;
7876
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007877 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007878 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007879 return -EINVAL;
7880 }
7881
7882 /* Debug display of request components. */
7883 switch (pRequest->offloadType) {
7884 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007885 hdd_debug("Host offload request: ARP reply");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007886 switch (pRequest->enableOrDisable) {
7887 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007888 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007889 break;
7890 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007891 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07007892 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007893 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007894 hdd_debug(" ARP offload enable");
7895 hdd_debug(" IP address: %d.%d.%d.%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007896 pRequest->params.hostIpv4Addr[0],
7897 pRequest->params.hostIpv4Addr[1],
7898 pRequest->params.hostIpv4Addr[2],
7899 pRequest->params.hostIpv4Addr[3]);
7900 }
7901 break;
7902
7903 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007904 hdd_debug("Host offload request: neighbor discovery");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007905 switch (pRequest->enableOrDisable) {
7906 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007907 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007908 break;
7909 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007910 hdd_debug(" enable");
7911 hdd_debug(" IP address: %x:%x:%x:%x:%x:%x:%x:%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007912 *(uint16_t *) (pRequest->params.hostIpv6Addr),
7913 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7914 2),
7915 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7916 4),
7917 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7918 6),
7919 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7920 8),
7921 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7922 10),
7923 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7924 12),
7925 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7926 14));
7927 }
7928 }
7929
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05307930 qdf_mem_zero(&offloadRequest, sizeof(offloadRequest));
7931 offloadRequest.offloadType = pRequest->offloadType;
7932 offloadRequest.enableOrDisable = pRequest->enableOrDisable;
7933 qdf_mem_copy(&offloadRequest.params, &pRequest->params,
7934 sizeof(pRequest->params));
7935 qdf_mem_copy(&offloadRequest.bssid, &pRequest->bssId.bytes,
7936 QDF_MAC_ADDR_SIZE);
7937
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307938 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007939 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnson1b780e42017-10-31 14:11:45 -07007940 adapter->session_id, &offloadRequest)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007941 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007942 return -EINVAL;
7943 }
Dustin Browne74003f2018-03-14 12:51:58 -07007944 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007945 return 0;
7946}
7947
7948static int iw_set_host_offload(struct net_device *dev,
7949 struct iw_request_info *info,
7950 union iwreq_data *wrqu, char *extra)
7951{
7952 int ret;
7953
7954 cds_ssr_protect(__func__);
7955 ret = __iw_set_host_offload(dev, info, wrqu, extra);
7956 cds_ssr_unprotect(__func__);
7957
7958 return ret;
7959}
7960
7961/**
7962 * iw_set_keepalive_params - Set keepalive params ioctl handler
7963 * @dev: device upon which the ioctl was received
7964 * @info: ioctl request information
7965 * @wrqu: ioctl request data
7966 * @extra: ioctl extra data
7967 *
7968 * Return: 0 on success, non-zero on error
7969 */
7970static int __iw_set_keepalive_params(struct net_device *dev,
7971 struct iw_request_info *info,
7972 union iwreq_data *wrqu, char *extra)
7973{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007974 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08007975 tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007976 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007977 int ret;
7978
Dustin Brownfdf17c12018-03-14 12:55:34 -07007979 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307980
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007981 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007982 ret = wlan_hdd_validate_context(hdd_ctx);
7983 if (0 != ret)
7984 return ret;
7985
Jeff Johnson441e1f72017-02-07 08:50:49 -08007986 ret = hdd_check_private_wext_control(hdd_ctx, info);
7987 if (0 != ret)
7988 return ret;
7989
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08007990 if (wrqu->data.length != sizeof(*request)) {
7991 hdd_err("Invalid length %d", wrqu->data.length);
7992 return -EINVAL;
7993 }
7994
7995 if (request->timePeriod > WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX) {
7996 hdd_err("Value of timePeriod %d exceed Max limit %d",
7997 request->timePeriod,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007998 WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX);
7999 return -EINVAL;
8000 }
8001
8002 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008003 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008004 request->timePeriod, sizeof(tSirKeepAliveReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008005
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008006 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008007 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008008 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008009 break;
8010
8011 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008012 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008013
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008014 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008015 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8016 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008017
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008018 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008019 request->destIpv4Addr[0], request->destIpv4Addr[1],
8020 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008021
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008022 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -08008023 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008024 break;
8025 }
8026
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008027 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008028
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308029 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008030 sme_set_keep_alive(hdd_ctx->mac_handle,
8031 adapter->session_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008032 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008033 return -EINVAL;
8034 }
Dustin Browne74003f2018-03-14 12:51:58 -07008035 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008036 return 0;
8037}
8038
8039static int iw_set_keepalive_params(struct net_device *dev,
8040 struct iw_request_info *info,
8041 union iwreq_data *wrqu,
8042 char *extra)
8043{
8044 int ret;
8045
8046 cds_ssr_protect(__func__);
8047 ret = __iw_set_keepalive_params(dev, info, wrqu, extra);
8048 cds_ssr_unprotect(__func__);
8049
8050 return ret;
8051}
8052
8053#ifdef WLAN_FEATURE_PACKET_FILTERING
8054/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308055 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8056 * @priv_data: Pointer to the priv data from user space
8057 * @request: Pointer to the struct containing the copied data from user space
8058 *
8059 * Return: False on invalid length, true otherwise
8060 */
8061static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8062 uint16_t length)
8063{
8064 int max_params_size, rcvd_params_size;
8065
8066 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8067 sizeof(struct pkt_filter_param_cfg);
8068
8069 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8070 hdd_err("Less than minimum number of arguments needed");
8071 return false;
8072 }
8073
8074 rcvd_params_size = request->num_params *
8075 sizeof(struct pkt_filter_param_cfg);
8076
8077 if (length != sizeof(struct pkt_filter_cfg) -
8078 max_params_size + rcvd_params_size) {
8079 hdd_err("Arguments do not match the number of params provided");
8080 return false;
8081 }
8082
8083 return true;
8084}
8085
8086/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008087 * __iw_set_packet_filter_params() - set packet filter parameters in target
8088 * @dev: Pointer to netdev
8089 * @info: Pointer to iw request info
8090 * @wrqu: Pointer to data
8091 * @extra: Pointer to extra data
8092 *
8093 * Return: 0 on success, non-zero on error
8094 */
8095static int __iw_set_packet_filter_params(struct net_device *dev,
8096 struct iw_request_info *info,
8097 union iwreq_data *wrqu, char *extra)
8098{
8099 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008100 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008101 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008102 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008103 struct pkt_filter_cfg *request = NULL;
8104
Mukul Sharma472382f2015-11-02 20:16:31 +05308105 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008106 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308107 return -EPERM;
8108 }
8109
Dustin Brownfdf17c12018-03-14 12:55:34 -07008110 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308111
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008112 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8113 ret = wlan_hdd_validate_context(hdd_ctx);
8114 if (0 != ret)
8115 return ret;
8116
Jeff Johnson441e1f72017-02-07 08:50:49 -08008117 ret = hdd_check_private_wext_control(hdd_ctx, info);
8118 if (0 != ret)
8119 return ret;
8120
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008121 if (hdd_priv_get_data(&priv_data, wrqu)) {
8122 hdd_err("failed to get priv data");
8123 return -EINVAL;
8124 }
8125
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308126 if ((NULL == priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008127 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008128 priv_data.pointer, priv_data.length);
8129 return -EINVAL;
8130 }
8131
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308132 if (adapter->device_mode != QDF_STA_MODE) {
8133 hdd_err("Packet filter not supported for this mode :%d",
8134 adapter->device_mode);
8135 return -ENOTSUPP;
8136 }
8137
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308138 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8139 hdd_err("Packet filter not supported in disconnected state");
8140 return -ENOTSUPP;
8141 }
8142
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008143 /* copy data using copy_from_user */
8144 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
8145 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308146
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008147 if (NULL == request) {
8148 hdd_err("mem_alloc_copy_from_user_helper fail");
8149 return -ENOMEM;
8150 }
8151
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308152 if (!validate_packet_filter_params_size(request, priv_data.length)) {
8153 hdd_err("Invalid priv data length %d", priv_data.length);
8154 qdf_mem_free(request);
8155 return -EINVAL;
8156 }
8157
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05308158 if (request->filter_action == HDD_RCV_FILTER_SET)
8159 hdd_ctx->user_configured_pkt_filter_rules |=
8160 1 << request->filter_id;
8161 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
8162 hdd_ctx->user_configured_pkt_filter_rules &=
8163 ~(1 << request->filter_id);
8164
Jeff Johnson1b780e42017-10-31 14:11:45 -07008165 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008166
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07008167 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07008168 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008169 return ret;
8170}
8171
8172/**
8173 * iw_set_packet_filter_params() - set packet filter parameters in target
8174 * @dev: Pointer to netdev
8175 * @info: Pointer to iw request info
8176 * @wrqu: Pointer to data
8177 * @extra: Pointer to extra data
8178 *
8179 * Return: 0 on success, non-zero on error
8180 */
8181static int iw_set_packet_filter_params(struct net_device *dev,
8182 struct iw_request_info *info,
8183 union iwreq_data *wrqu, char *extra)
8184{
8185 int ret;
8186
8187 cds_ssr_protect(__func__);
8188 ret = __iw_set_packet_filter_params(dev, info, wrqu, extra);
8189 cds_ssr_unprotect(__func__);
8190
8191 return ret;
8192}
8193#endif
8194
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008195#ifdef QCA_SUPPORT_CP_STATS
8196static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
8197{
8198 return wlan_hdd_get_station_stats(adapter);
8199}
8200#else /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008201struct hdd_statistics_priv {
8202 tCsrSummaryStatsInfo summary_stats;
8203 tCsrGlobalClassAStatsInfo class_a_stats;
8204 tCsrGlobalClassDStatsInfo class_d_stats;
8205};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008206
Jeff Johnsond37833f2018-03-07 14:22:44 -08008207/**
8208 * hdd_statistics_cb() - "Get statistics" callback function
Jeff Johnsonced658b2018-03-08 09:54:01 -08008209 * @stats: statistics payload
8210 * @context: opaque context originally passed to SME. HDD always passes
8211 * a cookie for the request context
Jeff Johnsond37833f2018-03-07 14:22:44 -08008212 *
8213 * Return: None
8214 */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008215static void hdd_statistics_cb(void *stats, void *context)
Jeff Johnsond37833f2018-03-07 14:22:44 -08008216{
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008217 struct osif_request *request;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008218 struct hdd_statistics_priv *priv;
8219 tCsrSummaryStatsInfo *summary_stats;
8220 tCsrGlobalClassAStatsInfo *class_a_stats;
8221 tCsrGlobalClassDStatsInfo *class_d_stats;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008222
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008223 request = osif_request_get(context);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008224 if (!request) {
8225 hdd_err("Obsolete request");
8226 return;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008227 }
8228
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008229 priv = osif_request_priv(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008230
8231 summary_stats = (tCsrSummaryStatsInfo *)stats;
8232 priv->summary_stats = *summary_stats;
8233
8234 class_a_stats = (tCsrGlobalClassAStatsInfo *)(summary_stats + 1);
8235 priv->class_a_stats = *class_a_stats;
8236
8237 class_d_stats = (tCsrGlobalClassDStatsInfo *)(class_a_stats + 1);
8238 priv->class_d_stats = *class_d_stats;
8239
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008240 osif_request_complete(request);
8241 osif_request_put(request);
Jeff Johnsond37833f2018-03-07 14:22:44 -08008242}
8243
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008244static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008245{
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008246 int ret = 0;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008247 void *cookie;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008248 QDF_STATUS status;
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008249 struct osif_request *request;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008250 struct hdd_station_ctx *sta_ctx;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008251 struct hdd_statistics_priv *priv;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008252 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008253 static const struct osif_request_params params = {
Jeff Johnsonced658b2018-03-08 09:54:01 -08008254 .priv_size = sizeof(*priv),
8255 .timeout_ms = WLAN_WAIT_TIME_STATS,
8256 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008257
Jeff Johnsonced658b2018-03-08 09:54:01 -08008258 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008259 request = osif_request_alloc(&params);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008260 if (!request) {
8261 hdd_warn("request allocation failed");
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008262 return -EINVAL;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008263 }
8264
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008265 cookie = osif_request_cookie(request);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008266 status = sme_get_statistics(hdd_ctx->mac_handle, eCSR_HDD,
Jeff Johnsonced658b2018-03-08 09:54:01 -08008267 SME_SUMMARY_STATS |
8268 SME_GLOBAL_CLASSA_STATS |
8269 SME_GLOBAL_CLASSD_STATS,
8270 hdd_statistics_cb,
8271 sta_ctx->conn_info.staId[0],
8272 cookie, adapter->session_id);
8273
8274 if (QDF_STATUS_SUCCESS != status) {
8275 hdd_warn("Unable to retrieve SME statistics");
8276 goto put_request;
8277 }
8278
8279 /* request was sent -- wait for the response */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008280 ret = osif_request_wait_for_response(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008281 if (ret) {
8282 hdd_err("Failed to wait for statistics, errno %d", ret);
8283 goto put_request;
8284 }
8285
8286 /* update the adapter cache with the fresh results */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008287 priv = osif_request_priv(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008288 adapter->hdd_stats.summary_stat = priv->summary_stats;
8289 adapter->hdd_stats.class_a_stat = priv->class_a_stats;
8290 adapter->hdd_stats.class_d_stat = priv->class_d_stats;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008291
8292put_request:
8293 /*
8294 * either we never sent a request, we sent a request and
8295 * received a response or we sent a request and timed out.
8296 * regardless we are done with the request.
8297 */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008298 osif_request_put(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008299 return ret;
8300}
8301#endif /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008302
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008303static int __iw_get_statistics(struct net_device *dev,
8304 struct iw_request_info *info,
8305 union iwreq_data *wrqu, char *extra)
8306{
8307 int ret;
8308 char *p;
8309 int tlen;
8310 struct hdd_station_ctx *sta_ctx;
8311 tCsrSummaryStatsInfo *summary_stats;
8312 tCsrGlobalClassAStatsInfo *class_a_stats;
8313 tCsrGlobalClassDStatsInfo *class_d_stats;
8314 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
8315 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8316
8317 hdd_enter_dev(dev);
8318
8319 ret = wlan_hdd_validate_context(hdd_ctx);
8320 if (0 != ret)
8321 return ret;
8322
8323 ret = hdd_check_private_wext_control(hdd_ctx, info);
8324 if (0 != ret)
8325 return ret;
8326
8327 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
8328 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
8329 wrqu->data.length = 0;
8330 return 0;
8331 }
8332
8333 hdd_get_wlan_stats(adapter);
8334
8335 summary_stats = &(adapter->hdd_stats.summary_stat);
8336 class_a_stats = &(adapter->hdd_stats.class_a_stat);
8337 class_d_stats = &(adapter->hdd_stats.class_d_stat);
8338
Jeff Johnsonced658b2018-03-08 09:54:01 -08008339 p = extra;
8340 tlen = 0;
8341
8342 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
8343 sizeof(summary_stats->retry_cnt),
8344 &(summary_stats->retry_cnt[0]), tlen);
8345
8346 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
8347 sizeof(summary_stats->multiple_retry_cnt),
8348 &(summary_stats->multiple_retry_cnt[0]), tlen);
8349
8350 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
8351 sizeof(summary_stats->tx_frm_cnt),
8352 &(summary_stats->tx_frm_cnt[0]), tlen);
8353
8354 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
8355 sizeof(summary_stats->rx_frm_cnt),
8356 &(summary_stats->rx_frm_cnt), tlen);
8357
8358 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
8359 sizeof(summary_stats->frm_dup_cnt),
8360 &(summary_stats->frm_dup_cnt), tlen);
8361
8362 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
8363 sizeof(summary_stats->fail_cnt),
8364 &(summary_stats->fail_cnt[0]), tlen);
8365
8366 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
8367 sizeof(summary_stats->rts_fail_cnt),
8368 &(summary_stats->rts_fail_cnt), tlen);
8369
8370 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
8371 sizeof(summary_stats->ack_fail_cnt),
8372 &(summary_stats->ack_fail_cnt), tlen);
8373
8374 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
8375 sizeof(summary_stats->rts_succ_cnt),
8376 &(summary_stats->rts_succ_cnt), tlen);
8377
8378 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
8379 sizeof(summary_stats->rx_discard_cnt),
8380 &(summary_stats->rx_discard_cnt), tlen);
8381
8382 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
8383 sizeof(summary_stats->rx_error_cnt),
8384 &(summary_stats->rx_error_cnt), tlen);
8385
8386 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
8387 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8388 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8389
8390 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
8391 sizeof(class_d_stats->rx_byte_cnt),
8392 &(class_d_stats->rx_byte_cnt), tlen);
8393
8394 FILL_TLV(p, WLAN_STATS_RX_RATE,
8395 sizeof(class_d_stats->rx_rate),
8396 &(class_d_stats->rx_rate), tlen);
8397
8398 /* Transmit rate, in units of 500 kbit/sec */
8399 FILL_TLV(p, WLAN_STATS_TX_RATE,
8400 sizeof(class_a_stats->tx_rate),
8401 &(class_a_stats->tx_rate), tlen);
8402
8403 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
8404 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
8405 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
8406 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
8407 sizeof(class_d_stats->rx_mc_byte_cnt),
8408 &(class_d_stats->rx_mc_byte_cnt), tlen);
8409 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
8410 sizeof(class_d_stats->rx_bc_byte_cnt),
8411 &(class_d_stats->rx_bc_byte_cnt), tlen);
8412 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
8413 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8414 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8415 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
8416 sizeof(class_d_stats->tx_mc_byte_cnt),
8417 &(class_d_stats->tx_mc_byte_cnt), tlen);
8418 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
8419 sizeof(class_d_stats->tx_bc_byte_cnt),
8420 &(class_d_stats->tx_bc_byte_cnt), tlen);
8421
8422 wrqu->data.length = tlen;
8423
Dustin Browne74003f2018-03-14 12:51:58 -07008424 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008425
8426 return 0;
8427}
8428
8429static int iw_get_statistics(struct net_device *dev,
8430 struct iw_request_info *info,
8431 union iwreq_data *wrqu, char *extra)
8432{
8433 int ret;
8434
8435 cds_ssr_protect(__func__);
8436 ret = __iw_get_statistics(dev, info, wrqu, extra);
8437 cds_ssr_unprotect(__func__);
8438
8439 return ret;
8440}
8441
8442#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008443/*Max Len for PNO notification*/
8444#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05308445static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
8446 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008447{
Abhishek Singh0481d662017-04-11 18:20:11 +05308448 struct vdev_osif_priv *osif_priv;
8449 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008450 union iwreq_data wrqu;
8451 char buf[MAX_PNO_NOTIFY_LEN + 1];
8452
Abhishek Singh0481d662017-04-11 18:20:11 +05308453 wlan_vdev_obj_lock(vdev);
8454 osif_priv = wlan_vdev_get_ospriv(vdev);
8455 wlan_vdev_obj_unlock(vdev);
8456 if (!osif_priv) {
8457 hdd_err("osif_priv is null");
8458 return;
8459 }
8460
8461 wdev = osif_priv->wdev;
8462 if (!wdev) {
8463 hdd_err("wdev is null");
8464 return;
8465 }
8466
8467 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008468
8469 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05308470 qdf_mem_zero(&wrqu, sizeof(wrqu));
8471 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008472
8473 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05308474 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008475
8476 wrqu.data.pointer = buf;
8477 wrqu.data.length = strlen(buf);
8478
8479 /* send the event */
8480
Abhishek Singh0481d662017-04-11 18:20:11 +05308481 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008482}
8483
8484/**
8485 * __iw_set_pno() - Preferred Network Offload ioctl handler
8486 * @dev: device upon which the ioctl was received
8487 * @info: ioctl request information
8488 * @wrqu: ioctl request data
8489 * @extra: ioctl extra data
8490 *
8491 * This function parses a Preferred Network Offload command
8492 * Input is string based and expected to be of the form:
8493 *
8494 * <enable(1) | disable(0)>
8495 * when enabling:
8496 * <number of networks>
8497 * for each network:
8498 * <ssid_len> <ssid> <authentication> <encryption>
8499 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07008500 * <scan_time (seconds)>
8501 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008502 * <suspend mode>
8503 *
8504 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07008505 * 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 -08008506 *
8507 * this translates into:
8508 * -----------------------------
8509 * enable PNO
8510 * 2 networks
8511 * Network 1:
8512 * test - with authentication type 0 and encryption type 0,
8513 * search on 3 channels: 1 6 and 11,
8514 * SSID bcast type is unknown (directed probe will be sent if
8515 * AP not found) and must meet -40dBm RSSI
8516 * Network 2:
8517 * test2 - with authentication type 4 and encryption type 4,
8518 * search on 6 channels 1, 2, 3, 4, 5 and 6
8519 * bcast type is non-bcast (directed probe will be sent)
8520 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008521 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07008522 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008523 */
8524static int __iw_set_pno(struct net_device *dev,
8525 struct iw_request_info *info,
8526 union iwreq_data *wrqu, char *extra)
8527{
Jeff Johnson3d278b02017-08-29 14:17:47 -07008528 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008529 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05308530 uint8_t value;
8531 struct wlan_objmgr_vdev *vdev;
8532 struct wlan_objmgr_psoc *psoc;
8533 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008534 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308535 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05308536 uint8_t i, j, params;
8537 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308538 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008539
8540 /* request is a large struct, so we make it static to avoid
8541 * stack overflow. This API is only invoked via ioctl, so it
8542 * is serialized by the kernel rtnl_lock and hence does not
8543 * need to be reentrant
8544 */
Abhishek Singh0481d662017-04-11 18:20:11 +05308545 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008546
Dustin Brownfdf17c12018-03-14 12:55:34 -07008547 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008548
8549 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8550 ret = wlan_hdd_validate_context(hdd_ctx);
8551 if (ret)
8552 return ret;
8553
Jeff Johnson441e1f72017-02-07 08:50:49 -08008554 ret = hdd_check_private_wext_control(hdd_ctx, info);
8555 if (0 != ret)
8556 return ret;
8557
Abhishek Singh0481d662017-04-11 18:20:11 +05308558 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->hdd_pdev,
8559 dev->dev_addr, WLAN_LEGACY_MAC_ID);
8560 if (!vdev) {
8561 hdd_err("vdev object is NULL");
8562 return -EIO;
8563 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008564
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308565 /* making sure argument string ends with '\0' */
8566 len = (wrqu->data.length + 1);
8567 data = qdf_mem_malloc(len);
8568 if (!data) {
8569 hdd_err("fail to allocate memory %zu", len);
8570 return -EINVAL;
8571 }
8572 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308573 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008574
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05308575 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
8576
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308577 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008578 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308579 ret = -EINVAL;
8580 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008581 }
8582
Abhishek Singh0481d662017-04-11 18:20:11 +05308583 if (!value) {
8584 status = ucfg_scan_pno_stop(vdev);
8585 if (QDF_IS_STATUS_ERROR(status)) {
8586 hdd_err("Failed to disabled PNO");
8587 ret = -EINVAL;
8588 } else {
8589 hdd_debug("PNO scan disabled");
8590 }
8591 goto exit;
8592 }
8593
8594 if (ucfg_scan_get_pno_in_progress(vdev)) {
8595 hdd_debug("pno is already in progress");
8596 ret = -EBUSY;
8597 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008598 }
8599
8600 ptr += offset;
8601
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308602 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008603 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308604 ret = -EINVAL;
8605 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008606 }
Abhishek Singh0481d662017-04-11 18:20:11 +05308607 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008608
Abhishek Singh0481d662017-04-11 18:20:11 +05308609 hdd_debug("PNO enable networks count %d offset %d",
8610 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008611
Abhishek Singh0481d662017-04-11 18:20:11 +05308612 if ((0 == req.networks_cnt) ||
8613 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008614 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05308615 req.networks_cnt);
8616 ret = -EINVAL;
8617 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008618 }
8619
8620 ptr += offset;
8621
Abhishek Singh0481d662017-04-11 18:20:11 +05308622 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008623
Abhishek Singh0481d662017-04-11 18:20:11 +05308624 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008625
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308626 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308627 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008628 &offset);
8629
8630 if (1 != params) {
8631 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308632 ret = -EINVAL;
8633 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008634 }
8635
Abhishek Singh0481d662017-04-11 18:20:11 +05308636 if ((0 == req.networks_list[i].ssid.length) ||
8637 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008638 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308639 req.networks_list[i].ssid.length, i);
8640 ret = -EINVAL;
8641 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008642 }
8643
8644 /* Advance to SSID */
8645 ptr += offset;
8646
Abhishek Singh0481d662017-04-11 18:20:11 +05308647 memcpy(req.networks_list[i].ssid.ssid, ptr,
8648 req.networks_list[i].ssid.length);
8649 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008650
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308651 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308652 &(req.networks_list[i].authentication),
8653 &(req.networks_list[i].encryption),
8654 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008655 &offset);
8656
8657 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008658 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308659 ret = -EINVAL;
8660 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008661 }
8662
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008663 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308664 req.networks_list[i].ssid.length,
8665 req.networks_list[i].ssid.length,
8666 req.networks_list[i].ssid.ssid,
8667 req.networks_list[i].authentication,
8668 req.networks_list[i].encryption,
8669 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008670
8671 /* Advance to channel list */
8672 ptr += offset;
8673
Abhishek Singh0481d662017-04-11 18:20:11 +05308674 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
8675 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008676 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05308677 ret = -EINVAL;
8678 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008679 }
8680
Abhishek Singh0481d662017-04-11 18:20:11 +05308681 if (0 != req.networks_list[i].channel_cnt) {
8682 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008683 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308684 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05308685 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008686 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008687 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308688 ret = -EINVAL;
8689 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008690 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308691 if (!IS_CHANNEL_VALID(value)) {
8692 hdd_err("invalid channel: %hhu", value);
8693 ret = -EINVAL;
8694 goto exit;
8695 }
Abhishek Singh0481d662017-04-11 18:20:11 +05308696 req.networks_list[i].channels[j] =
8697 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008698 /* Advance to next channel number */
8699 ptr += offset;
8700 }
8701 }
8702
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308703 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308704 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008705 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008706 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008707 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308708 ret = -EINVAL;
8709 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008710 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308711 if (req.networks_list[i].bc_new_type > 2) {
8712 hdd_err("invalid bcast nw type: %u",
8713 req.networks_list[i].bc_new_type);
8714 ret = -EINVAL;
8715 goto exit;
8716 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008717
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008718 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308719 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008720
8721 /* Advance to rssi Threshold */
8722 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308723 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308724 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008725 &offset)) {
8726 hdd_err("PNO rssi threshold input is not valid %s",
8727 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308728 ret = -EINVAL;
8729 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008730 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008731 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308732 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008733 /* Advance to next network */
8734 ptr += offset;
8735 } /* For ucNetworkCount */
8736
Abhishek Singh0481d662017-04-11 18:20:11 +05308737 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308738 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05308739 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07008740 ptr += offset;
8741 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308742 if (req.fast_scan_period == 0) {
8743 hdd_err("invalid fast scan period %u",
8744 req.fast_scan_period);
8745 ret = -EINVAL;
8746 goto exit;
8747 }
Dustin Brown43e87292016-10-10 10:38:25 -07008748
Abhishek Singh0481d662017-04-11 18:20:11 +05308749 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308750 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07008751 &offset) > 0)
8752 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05308753 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07008754
Abhishek Singh0481d662017-04-11 18:20:11 +05308755 wlan_pdev_obj_lock(hdd_ctx->hdd_pdev);
8756 psoc = wlan_pdev_get_psoc(hdd_ctx->hdd_pdev);
8757 wlan_pdev_obj_unlock(hdd_ctx->hdd_pdev);
8758 ucfg_scan_register_pno_cb(psoc,
8759 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008760
Abhishek Singh0481d662017-04-11 18:20:11 +05308761 ucfg_scan_get_pno_def_params(vdev, &req);
8762 status = ucfg_scan_pno_start(vdev, &req);
8763 if (QDF_IS_STATUS_ERROR(status)) {
8764 hdd_err("Failed to enable PNO");
8765 ret = -EINVAL;
8766 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008767
Abhishek Singh0481d662017-04-11 18:20:11 +05308768exit:
8769 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008770
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308771 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05308772 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008773}
8774
8775static int iw_set_pno(struct net_device *dev,
8776 struct iw_request_info *info,
8777 union iwreq_data *wrqu, char *extra)
8778{
8779 int ret;
8780
8781 cds_ssr_protect(__func__);
8782 ret = __iw_set_pno(dev, info, wrqu, extra);
8783 cds_ssr_unprotect(__func__);
8784
8785 return ret;
8786}
8787#endif /* FEATURE_WLAN_SCAN_PNO */
8788
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008789static int __iw_set_band_config(struct net_device *dev,
8790 struct iw_request_info *info,
8791 union iwreq_data *wrqu, char *extra)
8792{
Jeff Johnson3d278b02017-08-29 14:17:47 -07008793 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008794 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08008795 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008796 int *value = (int *)extra;
8797
Dustin Brownfdf17c12018-03-14 12:55:34 -07008798 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008799
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05308800 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008801 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05308802 return -EPERM;
8803 }
8804
Jeff Johnson441e1f72017-02-07 08:50:49 -08008805 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8806 ret = hdd_check_private_wext_control(hdd_ctx, info);
8807 if (0 != ret)
8808 return ret;
8809
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07008810 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008811}
8812
8813static int iw_set_band_config(struct net_device *dev,
8814 struct iw_request_info *info,
8815 union iwreq_data *wrqu, char *extra)
8816{
8817 int ret;
8818
8819 cds_ssr_protect(__func__);
8820 ret = __iw_set_band_config(dev, info, wrqu, extra);
8821 cds_ssr_unprotect(__func__);
8822
8823 return ret;
8824}
8825
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008826static int printk_adapter(void *priv, const char *fmt, ...)
8827{
8828 int ret;
8829 va_list args;
8830
8831 va_start(args, fmt);
8832 ret = vprintk(fmt, args);
8833 ret += printk("\n");
8834 va_end(args);
8835
8836 return ret;
8837}
8838
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008839static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
8840{
8841 qdf_abstract_print *print = &printk_adapter;
8842
8843 switch (log_id) {
8844 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008845 cds_print_htc_credit_history(count, print, NULL);
8846 break;
8847 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008848 wma_print_wmi_cmd_log(count, print, NULL);
8849 break;
8850 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008851 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
8852 break;
8853 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008854 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
8855 break;
8856 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008857 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
8858 break;
8859 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008860 wma_print_wmi_event_log(count, print, NULL);
8861 break;
8862 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008863 wma_print_wmi_rx_event_log(count, print, NULL);
8864 break;
8865 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008866 wma_print_wmi_mgmt_event_log(count, print, NULL);
8867 break;
8868 default:
8869 print(NULL, "Invalid Log Id %d", log_id);
8870 break;
8871 }
8872}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008873
Jeff Johnsondf5d7792018-04-14 15:58:24 -07008874#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
8875int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
8876{
8877 struct hdd_context *hdd_ctx;
8878 int ret;
8879
8880 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
8881 v1, v2);
8882 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
8883 v1, v2);
8884 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8885 if (!hdd_ctx->config->crash_inject_enabled) {
8886 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
8887 return 0;
8888 }
8889 if (v1 == 3) {
8890 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
8891 return 0;
8892 }
8893 ret = wma_cli_set2_command(adapter->session_id,
8894 GEN_PARAM_CRASH_INJECT,
8895 v1, v2, GEN_CMD);
8896 return ret;
8897}
8898#endif
8899
Nirav Shahd21a2e32018-04-20 16:34:43 +05308900#ifdef CONFIG_DP_TRACE
8901void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
8902{
8903 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
8904 cmd_type, count);
8905 if (cmd_type == DUMP_DP_TRACE)
8906 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
8907 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
8908 qdf_dp_trace_enable_live_mode();
8909 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
8910 qdf_dp_trace_clear_buffer();
8911 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
8912 qdf_dp_trace_disable_live_mode();
8913}
8914#endif
8915
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008916static int __iw_set_two_ints_getnone(struct net_device *dev,
8917 struct iw_request_info *info,
8918 union iwreq_data *wrqu, char *extra)
8919{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008920 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008921 int *value = (int *)extra;
8922 int sub_cmd = value[0];
8923 int ret;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008924 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008925
Dustin Brownfdf17c12018-03-14 12:55:34 -07008926 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08008927
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008928 ret = wlan_hdd_validate_context(hdd_ctx);
8929 if (0 != ret)
8930 return ret;
8931
Jeff Johnson441e1f72017-02-07 08:50:49 -08008932 ret = hdd_check_private_wext_control(hdd_ctx, info);
8933 if (0 != ret)
8934 return ret;
8935
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008936 switch (sub_cmd) {
8937 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008938 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07008939 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008940 WMI_STA_SMPS_PARAM_CMDID,
8941 value[1] << WMA_SMPS_PARAM_VALUE_S
8942 | value[2],
8943 VDEV_CMD);
8944 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008945 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07008946 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008947 break;
Govind Singha471e5e2015-10-12 17:11:14 +05308948 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07008949 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05308950 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07008951 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05308952 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
8953 value[1], value[2], DBG_CMD);
8954 break;
8955 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07008956 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05308957 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07008958 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05308959 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
8960 value[1], value[2], DBG_CMD);
8961 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008962 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
8963 hdd_debug("Ioctl to set dual fw mode config");
Tushnim Bhattacharyya49ed8ab2017-05-26 18:20:10 -07008964 if (hdd_ctx->config->dual_mac_feature_disable ==
8965 DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008966 hdd_err("Dual mac feature is disabled from INI");
8967 return -EPERM;
8968 }
8969 hdd_debug("%d %d", value[1], value[2]);
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08008970 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->hdd_psoc,
8971 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008972 break;
8973 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05308974 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008975 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07008976 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008977 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07008978 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07008979 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08008980 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
8981 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07008982 break;
8983 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07008984 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07008985 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008986 case WE_LOG_BUFFER: {
8987 int log_id = value[1];
8988 uint32_t count = value[2] < 0 ? 0 : value[2];
8989
8990 hdd_ioctl_log_buffer(log_id, count);
8991
8992 break;
8993 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008994 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07008995 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008996 break;
8997 }
8998
8999 return ret;
9000}
9001
9002static int iw_set_two_ints_getnone(struct net_device *dev,
9003 struct iw_request_info *info,
9004 union iwreq_data *wrqu, char *extra)
9005{
9006 int ret;
9007
9008 cds_ssr_protect(__func__);
9009 ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
9010 cds_ssr_unprotect(__func__);
9011
9012 return ret;
9013}
9014
9015/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009016
9017static const iw_handler we_private[] = {
9018
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009019 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9020 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9021 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009022 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9023 iw_set_three_ints_getnone,
9024 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009025 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009026 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9027 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009028 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9029 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309030#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009031 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309032#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009033 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9034 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9035 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009036 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009037 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9038 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9039 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9040 iw_set_keepalive_params,
9041#ifdef WLAN_FEATURE_PACKET_FILTERING
9042 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9043 iw_set_packet_filter_params,
9044#endif
9045#ifdef FEATURE_WLAN_SCAN_PNO
9046 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9047#endif
9048 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009049 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9050 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009051 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
9052 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9053 iw_set_two_ints_getnone,
9054 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9055 iw_set_dot11p_channel_sched,
9056};
9057
9058/*Maximum command length can be only 15 */
9059static const struct iw_priv_args we_private_args[] = {
9060
9061 /* handlers for main ioctl */
9062 {WLAN_PRIV_SET_INT_GET_NONE,
9063 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9064 0,
9065 ""},
9066
9067 /* handlers for sub-ioctl */
9068 {WE_SET_11D_STATE,
9069 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9070 0,
9071 "set11Dstate"},
9072
9073 {WE_WOWL,
9074 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9075 0,
9076 "wowl"},
9077
9078 {WE_SET_POWER,
9079 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9080 0,
9081 "setPower"},
9082
9083 {WE_SET_MAX_ASSOC,
9084 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9085 0,
9086 "setMaxAssoc"},
9087
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009088 {WE_SET_SCAN_DISABLE,
9089 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9090 0,
9091 "scan_disable"},
9092
9093 {WE_SET_DATA_INACTIVITY_TO,
9094 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9095 0,
9096 "inactivityTO"},
9097
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05309098 {WE_SET_WOW_DATA_INACTIVITY_TO,
9099 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9100 0,
9101 "wow_ito"},
9102
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009103 {WE_SET_MAX_TX_POWER,
9104 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9105 0,
9106 "setMaxTxPower"},
9107
9108 {WE_SET_TX_POWER,
9109 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9110 0,
9111 "setTxPower"},
9112
9113 {WE_SET_MC_RATE,
9114 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9115 0,
9116 "setMcRate"},
9117
9118 {WE_SET_MAX_TX_POWER_2_4,
9119 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9120 0,
9121 "setTxMaxPower2G"},
9122
9123 {WE_SET_MAX_TX_POWER_5_0,
9124 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9125 0,
9126 "setTxMaxPower5G"},
9127
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309128#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009129 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05309130 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009131 0,
9132 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309133#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009134
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009135 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
9136 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -08009137 * will support both
9138 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009139 {WE_SET_MAX_TX_POWER,
9140 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9141 0,
9142 "setTxMaxPower"},
9143
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009144 {WE_SET_TM_LEVEL,
9145 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9146 0,
9147 "setTmLevel"},
9148
9149 {WE_SET_PHYMODE,
9150 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9151 0,
9152 "setphymode"},
9153
9154 {WE_SET_NSS,
9155 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9156 0,
9157 "nss"},
9158
9159 {WE_SET_LDPC,
9160 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9161 0,
9162 "ldpc"},
9163
9164 {WE_SET_TX_STBC,
9165 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9166 0,
9167 "tx_stbc"},
9168
9169 {WE_SET_RX_STBC,
9170 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9171 0,
9172 "rx_stbc"},
9173
9174 {WE_SET_SHORT_GI,
9175 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9176 0,
9177 "shortgi"},
9178
9179 {WE_SET_RTSCTS,
9180 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9181 0,
9182 "enablertscts"},
9183
9184 {WE_SET_CHWIDTH,
9185 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9186 0,
9187 "chwidth"},
9188
9189 {WE_SET_ANI_EN_DIS,
9190 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9191 0,
9192 "anienable"},
9193
9194 {WE_SET_ANI_POLL_PERIOD,
9195 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9196 0,
9197 "aniplen"},
9198
9199 {WE_SET_ANI_LISTEN_PERIOD,
9200 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9201 0,
9202 "anilislen"},
9203
9204 {WE_SET_ANI_OFDM_LEVEL,
9205 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9206 0,
9207 "aniofdmlvl"},
9208
9209 {WE_SET_ANI_CCK_LEVEL,
9210 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9211 0,
9212 "aniccklvl"},
9213
9214 {WE_SET_DYNAMIC_BW,
9215 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9216 0,
9217 "cwmenable"},
9218
9219 {WE_SET_CTS_CBW,
9220 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9221 0,
9222 "cts_cbw" },
9223
9224 {WE_SET_GTX_HT_MCS,
9225 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9226 0,
9227 "gtxHTMcs"},
9228
9229 {WE_SET_GTX_VHT_MCS,
9230 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9231 0,
9232 "gtxVHTMcs"},
9233
9234 {WE_SET_GTX_USRCFG,
9235 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9236 0,
9237 "gtxUsrCfg"},
9238
9239 {WE_SET_GTX_THRE,
9240 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9241 0,
9242 "gtxThre"},
9243
9244 {WE_SET_GTX_MARGIN,
9245 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9246 0,
9247 "gtxMargin"},
9248
9249 {WE_SET_GTX_STEP,
9250 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9251 0,
9252 "gtxStep"},
9253
9254 {WE_SET_GTX_MINTPC,
9255 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9256 0,
9257 "gtxMinTpc"},
9258
9259 {WE_SET_GTX_BWMASK,
9260 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9261 0,
9262 "gtxBWMask"},
9263
9264 {WE_SET_TX_CHAINMASK,
9265 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9266 0,
9267 "txchainmask"},
9268
9269 {WE_SET_RX_CHAINMASK,
9270 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9271 0,
9272 "rxchainmask"},
9273
9274 {WE_SET_11N_RATE,
9275 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9276 0,
9277 "set11NRates"},
9278
9279 {WE_SET_VHT_RATE,
9280 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9281 0,
9282 "set11ACRates"},
9283
9284 {WE_SET_AMPDU,
9285 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9286 0,
9287 "ampdu"},
9288
9289 {WE_SET_AMSDU,
9290 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9291 0,
9292 "amsdu"},
9293
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009294 {WE_SET_TXPOW_2G,
9295 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9296 0,
9297 "txpow2g"},
9298
9299 {WE_SET_TXPOW_5G,
9300 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9301 0,
9302 "txpow5g"},
9303
Wen Gong99768902018-04-25 12:07:49 +08009304#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009305 /* Sub-cmds DBGLOG specific commands */
9306 {WE_DBGLOG_LOG_LEVEL,
9307 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9308 0,
9309 "dl_loglevel"},
9310
9311 {WE_DBGLOG_VAP_ENABLE,
9312 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9313 0,
9314 "dl_vapon"},
9315
9316 {WE_DBGLOG_VAP_DISABLE,
9317 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9318 0,
9319 "dl_vapoff"},
9320
9321 {WE_DBGLOG_MODULE_ENABLE,
9322 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9323 0,
9324 "dl_modon"},
9325
9326 {WE_DBGLOG_MODULE_DISABLE,
9327 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9328 0,
9329 "dl_modoff"},
9330
9331 {WE_DBGLOG_MOD_LOG_LEVEL,
9332 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9333 0,
9334 "dl_mod_loglevel"},
9335
9336 {WE_DBGLOG_TYPE,
9337 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9338 0,
9339 "dl_type"},
9340 {WE_DBGLOG_REPORT_ENABLE,
9341 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9342 0,
9343 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +08009344#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009345
9346 {WE_SET_TXRX_FWSTATS,
9347 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9348 0,
9349 "txrx_fw_stats"},
9350
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009351 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +08009352 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009353 0,
9354 "txrx_stats"},
9355
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009356 {WE_TXRX_FWSTATS_RESET,
9357 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9358 0,
9359 "txrx_fw_st_rst"},
9360
9361 {WE_PPS_PAID_MATCH,
9362 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9363 0, "paid_match"},
9364
9365 {WE_PPS_GID_MATCH,
9366 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9367 0, "gid_match"},
9368
9369 {WE_PPS_EARLY_TIM_CLEAR,
9370 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9371 0, "tim_clear"},
9372
9373 {WE_PPS_EARLY_DTIM_CLEAR,
9374 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9375 0, "dtim_clear"},
9376
9377 {WE_PPS_EOF_PAD_DELIM,
9378 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9379 0, "eof_delim"},
9380
9381 {WE_PPS_MACADDR_MISMATCH,
9382 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9383 0, "mac_match"},
9384
9385 {WE_PPS_DELIM_CRC_FAIL,
9386 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9387 0, "delim_fail"},
9388
9389 {WE_PPS_GID_NSTS_ZERO,
9390 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9391 0, "nsts_zero"},
9392
9393 {WE_PPS_RSSI_CHECK,
9394 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9395 0, "rssi_chk"},
9396
9397 {WE_PPS_5G_EBT,
9398 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9399 0, "5g_ebt"},
9400
9401 {WE_SET_HTSMPS,
9402 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9403 0, "htsmps"},
9404
9405 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
9406 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9407 0, "set_qpspollcnt"},
9408
9409 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
9410 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9411 0, "set_qtxwake"},
9412
9413 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
9414 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9415 0, "set_qwakeintv"},
9416
9417 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
9418 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9419 0, "set_qnodatapoll"},
9420
9421 /* handlers for MCC time quota and latency sub ioctls */
9422 {WE_MCC_CONFIG_LATENCY,
9423 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9424 0, "setMccLatency"},
9425
9426 {WE_MCC_CONFIG_QUOTA,
9427 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9428 0, "setMccQuota"},
9429
9430 {WE_SET_DEBUG_LOG,
9431 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9432 0, "setDbgLvl"},
9433
9434 /* handlers for early_rx power save */
9435 {WE_SET_EARLY_RX_ADJUST_ENABLE,
9436 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9437 0, "erx_enable"},
9438
9439 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
9440 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9441 0, "erx_bmiss_val"},
9442
9443 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
9444 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9445 0, "erx_bmiss_smpl"},
9446
9447 {WE_SET_EARLY_RX_SLOP_STEP,
9448 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9449 0, "erx_slop_step"},
9450
9451 {WE_SET_EARLY_RX_INIT_SLOP,
9452 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9453 0, "erx_init_slop"},
9454
9455 {WE_SET_EARLY_RX_ADJUST_PAUSE,
9456 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9457 0, "erx_adj_pause"},
9458
9459 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
9460 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9461 0, "erx_dri_sample"},
9462
9463 {WE_DUMP_STATS,
9464 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9465 0, "dumpStats"},
9466
9467 {WE_CLEAR_STATS,
9468 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9469 0, "clearStats"},
9470
Govind Singha471e5e2015-10-12 17:11:14 +05309471 {WE_START_FW_PROFILE,
9472 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9473 0, "startProfile"},
9474
Abhishek Singh1bdb1572015-10-16 16:24:19 +05309475 {WE_SET_CHANNEL,
9476 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9477 0, "setChanChange" },
9478
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05309479 {WE_SET_CONC_SYSTEM_PREF,
9480 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9481 0, "setConcSysPref" },
9482
Jeff Johnson011c4502017-10-05 15:25:56 -07009483 {WE_SET_PDEV_RESET,
9484 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9485 0, "pdev_reset" },
9486
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05309487 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -08009488 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9489 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05309490
Kiran Kumar Lokere05e9a652018-04-10 20:27:38 -07009491 {WE_SET_PPDU_DUR,
9492 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9493 0, "set_ppdu_dur" },
9494
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009495 {WLAN_PRIV_SET_NONE_GET_INT,
9496 0,
9497 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9498 ""},
9499
9500 /* handlers for sub-ioctl */
9501 {WE_GET_11D_STATE,
9502 0,
9503 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9504 "get11Dstate"},
9505
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009506 {WE_GET_WLAN_DBG,
9507 0,
9508 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9509 "getwlandbg"},
9510
9511 {WE_GET_MAX_ASSOC,
9512 0,
9513 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9514 "getMaxAssoc"},
9515
9516 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
9517 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9518 "getAutoChannel" },
9519
9520 {WE_GET_CONCURRENCY_MODE,
9521 0,
9522 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9523 "getconcurrency"},
9524
9525 {WE_GET_NSS,
9526 0,
9527 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9528 "get_nss"},
9529
9530 {WE_GET_LDPC,
9531 0,
9532 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9533 "get_ldpc"},
9534
9535 {WE_GET_TX_STBC,
9536 0,
9537 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9538 "get_tx_stbc"},
9539
9540 {WE_GET_RX_STBC,
9541 0,
9542 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9543 "get_rx_stbc"},
9544
9545 {WE_GET_SHORT_GI,
9546 0,
9547 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9548 "get_shortgi"},
9549
9550 {WE_GET_RTSCTS,
9551 0,
9552 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9553 "get_rtscts"},
9554
9555 {WE_GET_CHWIDTH,
9556 0,
9557 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9558 "get_chwidth"},
9559
9560 {WE_GET_ANI_EN_DIS,
9561 0,
9562 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9563 "get_anienable"},
9564
9565 {WE_GET_ANI_POLL_PERIOD,
9566 0,
9567 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9568 "get_aniplen"},
9569
9570 {WE_GET_ANI_LISTEN_PERIOD,
9571 0,
9572 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9573 "get_anilislen"},
9574
9575 {WE_GET_ANI_OFDM_LEVEL,
9576 0,
9577 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9578 "get_aniofdmlvl"},
9579
9580 {WE_GET_ANI_CCK_LEVEL,
9581 0,
9582 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9583 "get_aniccklvl"},
9584
9585 {WE_GET_DYNAMIC_BW,
9586 0,
9587 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9588 "get_cwmenable"},
9589
9590 {WE_GET_GTX_HT_MCS,
9591 0,
9592 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9593 "get_gtxHTMcs"},
9594
9595 {WE_GET_GTX_VHT_MCS,
9596 0,
9597 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9598 "get_gtxVHTMcs"},
9599
9600 {WE_GET_GTX_USRCFG,
9601 0,
9602 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9603 "get_gtxUsrCfg"},
9604
9605 {WE_GET_GTX_THRE,
9606 0,
9607 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9608 "get_gtxThre"},
9609
9610 {WE_GET_GTX_MARGIN,
9611 0,
9612 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9613 "get_gtxMargin"},
9614
9615 {WE_GET_GTX_STEP,
9616 0,
9617 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9618 "get_gtxStep"},
9619
9620 {WE_GET_GTX_MINTPC,
9621 0,
9622 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9623 "get_gtxMinTpc"},
9624
9625 {WE_GET_GTX_BWMASK,
9626 0,
9627 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9628 "get_gtxBWMask"},
9629
9630 {WE_GET_TX_CHAINMASK,
9631 0,
9632 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9633 "get_txchainmask"},
9634
9635 {WE_GET_RX_CHAINMASK,
9636 0,
9637 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9638 "get_rxchainmask"},
9639
9640 {WE_GET_11N_RATE,
9641 0,
9642 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9643 "get_11nrate"},
9644
9645 {WE_GET_AMPDU,
9646 0,
9647 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9648 "get_ampdu"},
9649
9650 {WE_GET_AMSDU,
9651 0,
9652 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9653 "get_amsdu"},
9654
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009655 {WE_GET_TXPOW_2G,
9656 0,
9657 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9658 "get_txpow2g"},
9659
9660 {WE_GET_TXPOW_5G,
9661 0,
9662 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9663 "get_txpow5g"},
9664
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009665 {WE_GET_PPS_PAID_MATCH,
9666 0,
9667 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9668 "get_paid_match"},
9669
9670 {WE_GET_PPS_GID_MATCH,
9671 0,
9672 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9673 "get_gid_match"},
9674
9675 {WE_GET_PPS_EARLY_TIM_CLEAR,
9676 0,
9677 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9678 "get_tim_clear"},
9679
9680 {WE_GET_PPS_EARLY_DTIM_CLEAR,
9681 0,
9682 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9683 "get_dtim_clear"},
9684
9685 {WE_GET_PPS_EOF_PAD_DELIM,
9686 0,
9687 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9688 "get_eof_delim"},
9689
9690 {WE_GET_PPS_MACADDR_MISMATCH,
9691 0,
9692 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9693 "get_mac_match"},
9694
9695 {WE_GET_PPS_DELIM_CRC_FAIL,
9696 0,
9697 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9698 "get_delim_fail"},
9699
9700 {WE_GET_PPS_GID_NSTS_ZERO,
9701 0,
9702 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9703 "get_nsts_zero"},
9704
9705 {WE_GET_PPS_RSSI_CHECK,
9706 0,
9707 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9708 "get_rssi_chk"},
9709
9710 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
9711 0,
9712 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9713 "get_qpspollcnt"},
9714
9715 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
9716 0,
9717 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9718 "get_qtxwake"},
9719
9720 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
9721 0,
9722 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9723 "get_qwakeintv"},
9724
9725 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
9726 0,
9727 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9728 "get_qnodatapoll"},
9729
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009730 {WE_CAP_TSF,
9731 0,
9732 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9733 "cap_tsf"},
9734
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009735 {WE_GET_TEMPERATURE,
9736 0,
9737 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9738 "get_temp"},
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07009739 {WE_GET_DCM,
9740 0,
9741 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9742 "get_dcm"},
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07009743 {WE_GET_RANGE_EXT,
9744 0,
9745 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9746 "get_range_ext"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009747 /* handlers for main ioctl */
9748 {WLAN_PRIV_SET_CHAR_GET_NONE,
9749 IW_PRIV_TYPE_CHAR | 512,
9750 0,
9751 ""},
9752
9753 /* handlers for sub-ioctl */
9754 {WE_WOWL_ADD_PTRN,
9755 IW_PRIV_TYPE_CHAR | 512,
9756 0,
9757 "wowlAddPtrn"},
9758
9759 {WE_WOWL_DEL_PTRN,
9760 IW_PRIV_TYPE_CHAR | 512,
9761 0,
9762 "wowlDelPtrn"},
9763
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009764 /* handlers for sub-ioctl */
9765 {WE_NEIGHBOR_REPORT_REQUEST,
9766 IW_PRIV_TYPE_CHAR | 512,
9767 0,
9768 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -08009769
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009770 {WE_SET_AP_WPS_IE,
9771 IW_PRIV_TYPE_CHAR | 512,
9772 0,
9773 "set_ap_wps_ie"},
9774
9775 {WE_SET_CONFIG,
9776 IW_PRIV_TYPE_CHAR | 512,
9777 0,
9778 "setConfig"},
9779
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07009780#ifdef WLAN_UNIT_TEST
9781 {WE_UNIT_TEST,
9782 IW_PRIV_TYPE_CHAR | 512,
9783 0,
9784 "unit_test"},
9785#endif
9786
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009787 /* handlers for main ioctl */
9788 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
9789 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9790 0,
9791 ""},
9792
9793 /* handlers for sub-ioctl */
9794 {WE_SET_WLAN_DBG,
9795 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9796 0,
9797 "setwlandbg"},
9798
Nirav Shahd21a2e32018-04-20 16:34:43 +05309799#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009800 /* handlers for sub-ioctl */
9801 {WE_SET_DP_TRACE,
9802 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9803 0,
9804 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +05309805#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009806
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05309807 {WE_SET_FW_TEST,
9808 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9809 0, "fw_test"},
9810
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009811 /* handlers for main ioctl */
9812 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
9813 0,
9814 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9815 "" },
9816 {WE_GET_TSF,
9817 0,
9818 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9819 "get_tsf" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009820
9821 {WE_SET_DUAL_MAC_SCAN_CONFIG,
9822 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9823 0,
9824 "set_scan_cfg"},
9825
9826 /* handlers for main ioctl */
9827 {WLAN_PRIV_GET_CHAR_SET_NONE,
9828 0,
9829 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9830 ""},
9831
9832 /* handlers for sub-ioctl */
9833 {WE_WLAN_VERSION,
9834 0,
9835 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9836 "version"},
9837 {WE_GET_STATS,
9838 0,
9839 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9840 "getStats"},
Dustin Brownd9322482017-01-09 12:46:03 -08009841 {WE_GET_SUSPEND_RESUME_STATS,
9842 0,
9843 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9844 "getSuspendStats"},
Govind Singha471e5e2015-10-12 17:11:14 +05309845 {WE_LIST_FW_PROFILE,
9846 0,
9847 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9848 "listProfile"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009849 {WE_GET_STATES,
9850 0,
9851 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9852 "getHostStates"},
9853 {WE_GET_CFG,
9854 0,
9855 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9856 "getConfig"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009857 {WE_GET_RSSI,
9858 0,
9859 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9860 "getRSSI"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009861 {WE_GET_WMM_STATUS,
9862 0,
9863 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9864 "getWmmStatus"},
9865 {
9866 WE_GET_CHANNEL_LIST,
9867 0,
9868 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9869 "getChannelList"
9870 },
9871#ifdef FEATURE_WLAN_TDLS
9872 {
9873 WE_GET_TDLS_PEERS,
9874 0,
9875 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9876 "getTdlsPeers"
9877 },
9878#endif
9879#ifdef WLAN_FEATURE_11W
9880 {
9881 WE_GET_11W_INFO,
9882 0,
9883 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9884 "getPMFInfo"
9885 },
9886#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009887 {
9888 WE_GET_IBSS_STA_INFO,
9889 0,
9890 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9891 "getIbssSTAs"
9892 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009893 {WE_GET_PHYMODE,
9894 0,
9895 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9896 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -08009897#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009898 {WE_GET_OEM_DATA_CAP,
9899 0,
9900 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9901 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -08009902#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009903 {WE_GET_SNR,
9904 0,
9905 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9906 "getSNR"},
9907
9908 /* handlers for main ioctl */
9909 {WLAN_PRIV_SET_NONE_GET_NONE,
9910 0,
9911 0,
9912 ""},
9913
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009914 /* handlers for sub-ioctl */
9915 {
9916 WE_IBSS_GET_PEER_INFO_ALL,
9917 0,
9918 0,
9919 "ibssPeerInfoAll"
9920 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009921 {WE_GET_RECOVERY_STAT,
9922 0,
9923 0,
9924 "getRecoverStat"},
Govind Singha471e5e2015-10-12 17:11:14 +05309925
9926 {WE_GET_FW_PROFILE_DATA,
9927 0,
9928 0,
9929 "getProfileData"},
9930
9931 {WE_SET_REASSOC_TRIGGER,
9932 0,
9933 0,
9934 "reassoc"},
9935
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009936 {WE_STOP_OBSS_SCAN,
9937 0,
9938 0,
9939 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009940 /* handlers for main ioctl */
9941 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
9942 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9943 0,
9944 ""},
9945
9946 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009947 {WE_IBSS_GET_PEER_INFO,
9948 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9949 0,
9950 "ibssPeerInfo"},
9951
Rachit Kankane0baf6e72018-01-19 15:01:50 +05309952#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009953 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009954 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
9955 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9956 0,
9957 "setdumplog"},
9958
9959 {WE_MTRACE_DUMP_CMD,
9960 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9961 0,
9962 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +05309963#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -08009964
9965 {WE_POLICY_MANAGER_CINFO_CMD,
9966 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9967 0,
9968 "pm_cinfo"},
9969
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009970#ifdef MPC_UT_FRAMEWORK
9971 {WE_POLICY_MANAGER_CLIST_CMD,
9972 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9973 0,
9974 "pm_clist"},
9975
9976 {WE_POLICY_MANAGER_DLIST_CMD,
9977 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9978 0,
9979 "pm_dlist"},
9980
9981 {WE_POLICY_MANAGER_DBS_CMD,
9982 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9983 0,
9984 "pm_dbs"},
9985
9986 {WE_POLICY_MANAGER_PCL_CMD,
9987 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9988 0,
9989 "pm_pcl"},
9990
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009991 {WE_POLICY_MANAGER_ULIST_CMD,
9992 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9993 0,
9994 "pm_ulist"},
9995
9996 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
9997 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9998 0,
9999 "pm_query_action"},
10000
10001 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
10002 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10003 0,
10004 "pm_query_allow"},
10005
10006 {WE_POLICY_MANAGER_SCENARIO_CMD,
10007 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10008 0,
10009 "pm_run_scenario"},
10010
10011 {WE_POLICY_SET_HW_MODE_CMD,
10012 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10013 0,
10014 "pm_set_hw_mode"},
10015#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010016 {
10017 WE_UNIT_TEST_CMD,
10018 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10019 0,
10020 "setUnitTestCmd"
10021 },
Manjeet Singhf82ed072016-07-08 11:40:00 +053010022 {
10023 WE_MAC_PWR_DEBUG_CMD,
10024 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10025 0,
10026 "halPwrDebug"
10027 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010028
10029#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10030 {WE_LED_FLASHING_PARAM,
10031 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10032 0,
10033 "gpio_control"},
10034#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010035#ifdef WLAN_DEBUG
10036 {WE_SET_CHAN_AVOID,
10037 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10038 0,
10039 "ch_avoid"},
10040#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010041 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010042 {WLAN_PRIV_FIPS_TEST,
10043 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10044 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10045 "fips_test"},
10046
10047 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010048 {WLAN_PRIV_ADD_TSPEC,
10049 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10050 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10051 "addTspec"},
10052
10053 /* handlers for main ioctl */
10054 {WLAN_PRIV_DEL_TSPEC,
10055 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10056 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10057 "delTspec"},
10058
10059 /* handlers for main ioctl */
10060 {WLAN_PRIV_GET_TSPEC,
10061 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10062 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10063 "getTspec"},
10064
10065 /* handlers for main ioctl - host offload */
10066 {
10067 WLAN_PRIV_SET_HOST_OFFLOAD,
Srinivas Girigowda077143e2017-03-25 10:47:27 -070010068 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010069 0,
10070 "setHostOffload"
10071 }
10072 ,
10073
10074 {
10075 WLAN_GET_WLAN_STATISTICS,
10076 0,
10077 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10078 "getWlanStats"
10079 }
10080 ,
10081
10082 {
10083 WLAN_SET_KEEPALIVE_PARAMS,
Mahesh A Saptasagar72d2e4b2016-04-20 12:44:17 +053010084 IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) |
10085 IW_PRIV_SIZE_FIXED,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010086 0,
10087 "setKeepAlive"
10088 }
10089 ,
10090#ifdef WLAN_FEATURE_PACKET_FILTERING
10091 {
10092 WLAN_SET_PACKET_FILTER_PARAMS,
Hanumanth Reddy Pothulab3ef4162016-10-25 15:13:26 +053010093 IW_PRIV_TYPE_BYTE |
10094 sizeof(struct pkt_filter_cfg),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010095 0,
10096 "setPktFilter"
10097 }
10098 ,
10099#endif
10100#ifdef FEATURE_WLAN_SCAN_PNO
10101 {
10102 WLAN_SET_PNO,
10103 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10104 0,
10105 "setpno"
10106 }
10107 ,
10108#endif
10109 {
10110 WLAN_SET_BAND_CONFIG,
10111 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10112 0,
10113 "SETBAND"
10114 }
10115 ,
10116 {
Dustin Brown0cbc7572016-12-16 13:54:40 -080010117 WLAN_PRIV_SET_MCBC_FILTER,
Dustin Brown860566f2017-01-31 15:24:43 -080010118 0,
Dustin Brown0cbc7572016-12-16 13:54:40 -080010119 0,
10120 "setMCBCFilter"
10121 }
10122 ,
Dustin Brown0cbc7572016-12-16 13:54:40 -080010123
10124 {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010125 WLAN_GET_LINK_SPEED,
10126 IW_PRIV_TYPE_CHAR | 18,
10127 IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed"
10128 }
10129 ,
10130
10131 /* handlers for main ioctl */
10132 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
10133 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10134 0,
10135 ""}
10136 ,
10137 {WE_SET_SMPS_PARAM,
10138 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10139 0, "set_smps_param"}
10140 ,
10141 {WLAN_SET_DOT11P_CHANNEL_SCHED,
10142 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
10143 0, "set_dot11p" }
10144 ,
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010145#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010146 {WE_SET_FW_CRASH_INJECT,
10147 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10148 0, "crash_inject"}
10149 ,
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010150#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053010151#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070010152 {WE_LOG_BUFFER,
10153 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10154 0, "log_buffer"}
10155 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010156#endif
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010157#ifdef WLAN_SUSPEND_RESUME_TEST
10158 {WE_SET_WLAN_SUSPEND,
10159 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10160 0, "wlan_suspend"}
10161 ,
10162 {WE_SET_WLAN_RESUME,
10163 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10164 0, "wlan_resume"}
10165 ,
10166#endif
Govind Singha471e5e2015-10-12 17:11:14 +053010167 {WE_ENABLE_FW_PROFILE,
10168 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10169 0, "enableProfile"}
10170 ,
10171 {WE_SET_FW_PROFILE_HIST_INTVL,
10172 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10173 0, "set_hist_intvl"}
10174 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010175 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
10176 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10177 0, "set_fw_mode_cfg"}
10178 ,
Nirav Shahd21a2e32018-04-20 16:34:43 +053010179#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010180 {WE_DUMP_DP_TRACE_LEVEL,
10181 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10182 0, "dump_dp_trace"}
10183 ,
Nirav Shahd21a2e32018-04-20 16:34:43 +053010184#endif
Nirav Shah73713f72018-05-17 14:50:41 +053010185#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070010186 {WE_SET_MON_MODE_CHAN,
10187 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10188 0, "setMonChan"}
10189 ,
Nirav Shah73713f72018-05-17 14:50:41 +053010190#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070010191 {WE_GET_ROAM_SYNCH_DELAY,
10192 0,
10193 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10194 "hostroamdelay"}
10195 ,
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080010196 {WE_SET_11AX_RATE,
10197 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10198 0,
10199 "set_11ax_rate"}
10200 ,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010201 {WE_SET_DCM,
10202 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10203 0,
10204 "enable_dcm"}
10205 ,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010206 {WE_SET_RANGE_EXT,
10207 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10208 0,
Naveen Rawat53448ea2017-11-27 11:43:18 -080010209 "range_ext"}
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010210 ,
Naveen Rawatc921c7b2017-06-13 17:29:51 -070010211
10212 {WLAN_PRIV_SET_FTIES,
10213 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
10214 0,
10215 "set_ft_ies"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010216};
10217
10218const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010219 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053010220 .num_private = QDF_ARRAY_SIZE(we_private),
10221 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010222
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010223 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010224 .private = (iw_handler *) we_private,
10225 .private_args = we_private_args,
10226 .get_wireless_stats = NULL,
10227};
10228
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010229void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010230{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010231 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010232
Dustin Browne7e71d32018-05-11 16:00:08 -070010233 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010234
Dustin Browne74003f2018-03-14 12:51:58 -070010235 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010236}
10237
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010238void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010239{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010240 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010241
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010242 rtnl_lock();
10243 dev->wireless_handlers = NULL;
10244 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010245
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010246 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010247}