blob: 08bfe00e82487c1cd40e23cd987cd2aef4aa2b45 [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"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053069#include "qdf_trace.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080070#include "wlan_hdd_assoc.h"
71#include "wlan_hdd_ioctl.h"
72#include "wlan_hdd_scan.h"
73#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080074#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080075#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070076#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070077#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080078#include "wlan_hdd_ocb.h"
79#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080080#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070081#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053082#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070083#ifdef WLAN_SUSPEND_RESUME_TEST
84#include "wlan_hdd_driver_ops.h"
85#include "hif.h"
Rajeev Kumar9bb2e852016-09-24 12:29:25 -070086#include "pld_common.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070087#endif
Dhanashri Atree7d442a2016-07-14 18:20:29 -070088#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053089#include "cds_utils.h"
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -070090#include "wlan_osif_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080091#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080092#include <cdp_txrx_stats.h>
93#include <cds_api.h>
Abhishek Singh0481d662017-04-11 18:20:11 +053094#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070095#include "wlan_hdd_regulatory.h"
96#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +053097#include "wlan_hdd_packet_filter_api.h"
Naveen Rawat3ff5cff2018-01-29 14:31:16 -080098#include "wlan_cp_stats_mc_ucfg_api.h"
Abhishek Singh0481d662017-04-11 18:20:11 +053099
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800100#define HDD_FINISH_ULA_TIME_OUT 800
101#define HDD_SET_MCBC_FILTERS_TO_FW 1
102#define HDD_DELETE_MCBC_FILTERS_FROM_FW 0
103
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800104/* Private ioctls and their sub-ioctls */
105#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
106#define WE_SET_11D_STATE 1
107#define WE_WOWL 2
108#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530109/*
110 * <ioctl>
111 * setMaxAssoc - Sets the maximum number of associated stations
112 *
113 * @INPUT: 1 to 32
114 *
115 * @OUTPUT: None
116 *
117 * This IOTCL sets the maximum number of associated stations
118 *
119 * @E.g: iwpriv wlan0 setMaxAssoc <value>
120 *
121 * Supported Feature: STA
122 *
123 * Usage: Internal/External
124 *
125 * </ioctl>
126 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800127#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530128/*
129 * <ioctl>
Jeff Johnsonf2cf6592018-05-06 16:27:44 -0700130 * scan_disable - Disable scan
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530131 *
132 * @INPUT: set_value
133 *
134 * @OUTPUT: None
135 *
136 * This IOCTL is used to set disable scan
137 *
138 * @E.g: iwpriv wlan0 scan_disable 1
139 *
140 * Supported Feature: Scan
141 *
142 * Usage: Internal/External
143 *
144 * </ioctl>
145 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800146#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530147/*
148 * <ioctl>
149 * inactivityTO - sets the timeout value for inactivity data while
150 * in power save mode
151 *
152 * @INPUT: int1…..int255
153 *
154 * @OUTPUT: None
155 *
156 * This IOCTL set the timeout value for inactivity data in power save mode
157 *
158 * @E.g: iwpriv wlan0 inactivityTO 20
159 *
160 * Supported Feature: STA
161 *
162 * Usage: Internal/External
163 *
164 * </ioctl>
165 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800166#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530167/*
168 * <ioctl>
169 * setMaxTxPower - Dynamically sets the maximum transmission power
170 *
171 * @INPUT: Transmission power in dBm
172 *
173 * @OUTPUT: None
174 *
175 * This IOCTL dynamically sets the maximum transmission power
176 * This setting does not persist over reboots
177 *
178 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
179 *
180 * Supported Feature: STA
181 *
182 * Usage: Internal/External
183 *
184 * </ioctl>
185 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800186#define WE_SET_MAX_TX_POWER 7
Jeff Johnsonfab9b252017-10-28 15:44:34 -0700187/* 8 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800188#define WE_SET_TM_LEVEL 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530189/*
190 * <ioctl>
191 * setphymode - Set the phymode dynamically
192 *
193 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
194 *
195 * @OUTPUT: None
196 *
197 * This IOCTL sets the phymode dynamically
198 *
199 * @E.g: iwpriv wlan0 setphymode 10
200 *
201 * Supported Feature: STA
202 *
203 * Usage: Internal/External
204 *
205 * </ioctl>
206 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800207#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530208/*
209 * <ioctl>
210 * nss - Set the number of spatial streams
211 *
212 * @INPUT: int1…..int3
213 *
214 * @OUTPUT: None
215 *
216 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
217 *
218 * @E.g: iwpriv wlan0 nss 2
219 *
220 * Supported Feature: STA
221 *
222 * Usage: Internal/External
223 *
224 * </ioctl>
225 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800226#define WE_SET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530227/*
228 * <ioctl>
229 * ldpc - Enables or disables LDPC
230 *
231 * @INPUT: 0 – Disable, 1 - Enable
232 *
233 * @OUTPUT: None
234 *
235 * This IOCTL enables or disables LDPC
236 *
237 * @E.g: iwpriv wlan0 ldpc 1
238 *
239 * Supported Feature: STA
240 *
241 * Usage: Internal/External
242 *
243 * </ioctl>
244 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800245#define WE_SET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530246/*
247 * <ioctl>
248 * tx_stbc - Enables or disables tx_stbc
249 *
250 * @INPUT: Int 0 – Disable, 1 - Enable
251 *
252 * @OUTPUT: None
253 *
254 * This IOTCL used to enables or disables tx_stbc
255 *
256 * @E.g: iwpriv wlan0 tx_stbc <value>
257 *
258 * Supported Feature: STA
259 *
260 * Usage: Internal/External
261 *
262 * </ioctl>
263 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800264#define WE_SET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530265/*
266 * <ioctl>
267 * rx_stbc - Set the rx_stbc parameter
268 *
269 * @INPUT: Int 0 – Disable, 1 - Enable
270 *
271 * @OUTPUT: None
272 *
273 * This IOTCL used to set rx_stbc parameter
274 *
275 * @E.g: iwpriv wlan0 rx_stbc <value>
276 *
277 * Supported Feature: STA
278 *
279 * Usage: Internal/External
280 *
281 * </ioctl>
282 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800283#define WE_SET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530284/*
285 * <ioctl>
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800286 * shortgi - Sets the short-guard interval
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530287 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800288 * @INPUT: Fixed Rate: 0 - 400ns, 1 - 800ns, 2 - 1600ns, 3 - 3200us
289 * Auto Rate: 8 - 400ns, 9 - 800ns, 10 - 1600ns, 11 - 3200us
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530290 *
291 * @OUTPUT: None
292 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800293 * This IOCTL sets the short-guard interval.
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530294 *
295 * @E.g: iwpriv wlan0 shortgi <value>
296 *
297 * Supported Feature: STA
298 *
299 * Usage: Internal/External
300 *
301 * </ioctl>
302 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800303#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530304/*
305 * <ioctl>
306 * enablertscts - enables or disables rts/cts.
307 *
308 * @INPUT: 1-Enable , 0-Disable
309 *
310 * @OUTPUT: None
311 *
312 * This IOCTL enables or disables rts/cts.
313 *
314 * @E.g: iwpriv wlan0 enablertscts <value>
315 *
316 * Supported Feature: STA
317 *
318 * Usage: Internal/External
319 *
320 * </ioctl>
321 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800322#define WE_SET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530323/*
324 * <ioctl>
325 * chwidth - Set the channel bandwidth
326 *
327 * @INPUT: 0-20mhz to 3-160mhz
328 *
329 * @OUTPUT: None
330 *
331 * This IOTCL used to set the channel bandwidth
332 *
333 * @E.g: iwpriv wlan0 chwidth 1
334 *
335 * Supported Feature: STA
336 *
337 * Usage: Internal/External
338 *
339 * </ioctl>
340 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800341#define WE_SET_CHWIDTH 17
342#define WE_SET_ANI_EN_DIS 18
343#define WE_SET_ANI_POLL_PERIOD 19
344#define WE_SET_ANI_LISTEN_PERIOD 20
345#define WE_SET_ANI_OFDM_LEVEL 21
346#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530347/*
348 * <ioctl>
349 * cwmenable - Enables or disables the dynamic channel bandwidth
350 *
351 * @INPUT: 0-Disable, 1-Enable
352 *
353 * @OUTPUT: None
354 *
355 * This IOTCL used to enables or disables the dynamic channel bandwidth
356 *
357 * @E.g: iwpriv wlan0 cwmenable <value>
358 *
359 * Supported Feature: STA
360 *
361 * Usage: Internal/External
362 *
363 * </ioctl>
364 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800365#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530366/*
367 * <ioctl>
368 * txchainmask - This IOCTL sets the current Tx chain mask
369 *
370 * @INPUT: Mask Value
371 *
372 * @OUTPUT: None
373 *
374 * This IOCTL sets the current Tx chain mask
375 *
376 * @E.g: iwpriv wlan0 txchainmask 1
377 *
378 * Supported Feature: STA
379 *
380 * Usage: Internal/External
381 *
382 * </ioctl>
383 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800384#define WE_SET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530385/*
386 * <ioctl>
387 * rxchainmask - Sets the current Rx chain mask
388 *
389 * @INPUT: Mask Value
390 *
391 * @OUTPUT: None
392 *
393 * This IOCTL sets the current Rx chain mask. This command is the
394 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
395 *
396 * @E.g: iwpriv wlan0 rxchainmask <value>
397 *
398 * Supported Feature: STA
399 *
400 * Usage: Internal/External
401 *
402 * </ioctl>
403 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800404#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530405/*
406 * <ioctl>
407 * set11NRates - Fixes the Tx data rate of the 11N mode.
408 *
409 * @INPUT: 0x1b to 0x8f
410 *
411 * @OUTPUT: None
412 *
413 * This IOCTL fixes the Tx data rate of the 11N mode.
414 *
415 * @E.g: iwpriv wlan0 set11NRates 0x85
416 *
417 * Supported Feature: STA
418 *
419 * Usage: Internal/External
420 *
421 * </ioctl>
422 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800423#define WE_SET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530424/*
425 * <ioctl>
426 * ampdu - Set the the maximum subframe of ampdu
427 *
428 * @INPUT: int 1 to int 63
429 *
430 * @OUTPUT: None
431 *
432 * This IOCTL sets the maximum subframe of ampdu.
433 *
434 * @E.g: iwpriv wlan0 ampdu 9
435 *
436 * Supported Feature: STA
437 *
438 * Usage: Internal/External
439 *
440 * </ioctl>
441 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800442#define WE_SET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530443/*
444 * <ioctl>
445 * amsdu - Sets the maximum subframe of amsdu.
446 *
447 * @INPUT: int 1 to int 31
448 *
449 * @OUTPUT: None
450 *
451 * This IOCTL sets the maximum subframe of amsdu.
452 *
453 * @E.g: iwpriv wlan0 amsdu 9
454 *
455 * Supported Feature: STA
456 *
457 * Usage: Internal/External
458 *
459 * </ioctl>
460 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800461#define WE_SET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530462/*
463 * <ioctl>
464 * txpow2g - current 2 GHz Tx power setting
465 *
466 * @INPUT: Tx power in dBm
467 *
468 * @OUTPUT: None
469 *
470 * This IOTCL used to set 2 ghz tx power
471 *
472 * @E.g: iwpriv wlan0 txpow2g
473 *
474 * Supported Feature: STA
475 *
476 * Usage: Internal/External
477 *
478 * </ioctl>
479 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800480#define WE_SET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530481/*
482 * <ioctl>
483 * txpow5g - Current 5 GHz tx power setting
484 *
485 * @INPUT: Tx power in dBm
486 *
487 * @OUTPUT: None
488 *
489 * This IOTCL used to set the 5 ghz txpower
490 *
491 * @E.g: iwpriv wlan0 txpow5g
492 *
493 * Supported Feature: STA
494 *
495 * Usage: Internal/External
496 *
497 * </ioctl>
498 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800499#define WE_SET_TXPOW_5G 30
500/* Private ioctl for firmware debug log */
501#define WE_DBGLOG_LOG_LEVEL 31
502#define WE_DBGLOG_VAP_ENABLE 32
503#define WE_DBGLOG_VAP_DISABLE 33
504#define WE_DBGLOG_MODULE_ENABLE 34
505#define WE_DBGLOG_MODULE_DISABLE 35
506#define WE_DBGLOG_MOD_LOG_LEVEL 36
507#define WE_DBGLOG_TYPE 37
508#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530509/*
510 * <ioctl>
511 * set11ACRates - Fixes the Tx data rate of 11AC
512 *
513 * @INPUT: 0x1 to 0x9
514 *
515 * @OUTPUT: None
516 *
517 * This IOCTL fixes the Tx data rate of 11AC.
518 *
519 * @E.g: iwpriv wlan0 set11ACRates 0x9
520 *
521 * Supported Feature: STA
522 *
523 * Usage: Internal/External
524 *
525 * </ioctl>
526 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800527#define WE_SET_VHT_RATE 39
528#define WE_DBGLOG_REPORT_ENABLE 40
529#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530530/*
531 * <ioctl>
532 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
533 *
534 * @INPUT: Transmission power in dBm
535 *
536 * @OUTPUT: None
537 *
538 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
539 * This setting does not persist over reboots
540 *
541 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
542 *
543 * Supported Feature: STA
544 *
545 * Usage: Internal/External
546 *
547 * </ioctl>
548 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800549#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530550/*
551 * <ioctl>
552 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
553 *
554 * @INPUT: Transmission power in dBm
555 *
556 * @OUTPUT: None
557 *
558 * This IOCTL sets the maximum transmit power for the 5-GHz band
559 * This setting does not persist over reboots
560 *
561 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
562 *
563 * Supported Feature: STA
564 *
565 * Usage: Internal/External
566 *
567 * </ioctl>
568 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800569#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800570#define WE_SET_PKTLOG 44
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530571/* Private ioctl for packet power save */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800572#define WE_PPS_PAID_MATCH 45
573#define WE_PPS_GID_MATCH 46
574#define WE_PPS_EARLY_TIM_CLEAR 47
575#define WE_PPS_EARLY_DTIM_CLEAR 48
576#define WE_PPS_EOF_PAD_DELIM 49
577#define WE_PPS_MACADDR_MISMATCH 50
578#define WE_PPS_DELIM_CRC_FAIL 51
579#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530580/*
581 * <ioctl>
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530582 * rssi_chk - Check the rssi
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530583 *
584 * @INPUT: One argument as input
585 *
586 * @OUTPUT: rssi
587 * wlan0 rssi_chk:56
588 *
589 * This IOTCL used to chek rssi
590 *
591 * @E.g: iwpriv wlan0 rssi_chk <value>
592 *
593 * Supported Feature: STA
594 *
595 * Usage: Internal/External
596 *
597 * </ioctl>
598 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800599#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530600/*
601 * <ioctl>
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530602 * htsmps - Sets the htsmps
603 *
604 * @INPUT: Atleast one int argument
605 *
606 * @OUTPUT: None
607 *
608 * This IOTCL used to set htsmps
609 *
610 * @E.g: iwpriv wlan0 htsmps <value>
611 *
612 * Supported Feature: STA
613 *
614 * Usage: Internal/External
615 *
616 * </ioctl>
617 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800618#define WE_SET_HTSMPS 55
619/* Private ioctl for QPower */
620#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
621#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
622#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
623#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800624/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530625/*
626 * <ioctl>
627 * gtxHTMcs - Set the tx HTM value
628 *
629 * @INPUT: Atleast one int orgument
630 *
631 * @OUTPUT: None
632 *
633 * This IOTCL sets htm tx value
634 *
635 * @E.g: iwpriv wlan0 gtxHTMcs <value>
636 *
637 * Supported Feature: STA
638 *
639 * Usage: Internal/External
640 *
641 * </ioctl>
642 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800643#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530644/*
645 * <ioctl>
646 * gtxVHTMcs - Set gtxVHTMcs value
647 *
648 * @INPUT: Atleast one int argument
649 *
650 * @OUTPUT: None
651 *
652 * This IOTCL used to set gtxVHTMcs value
653 *
654 * @E.g: iwpriv wlan0 gtxVHTMcs <value>
655 *
656 * Supported Feature: STA
657 *
658 * Usage: Internal/External
659 *
660 * </ioctl>
661 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800662#define WE_SET_GTX_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530663/*
664 * <ioctl>
665 * gtxUsrCfg - Host request for GTX mask
666 *
667 * @INPUT: Atleast one int orgument
668 *
669 * @OUTPUT: None
670 *
671 * This IOTCL used send the host request for GTX mask
672 *
673 * @E.g: iwpriv wlan0 gtxUsrCfg <value>
674 *
675 * Supported Feature: STA
676 *
677 * Usage: Internal/External
678 *
679 * </ioctl>
680 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800681#define WE_SET_GTX_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530682/*
683 * <ioctl>
684 * gtxThre - Set the tx threshold
685 *
686 * @INPUT: Atleast one int argument
687 *
688 * @OUTPUT: None
689 *
690 * This IOTCL used to set tx threshold
691 *
692 * @E.g: iwpriv wlan0 gtxThre <value>
693 *
694 * Supported Feature: STA
695 *
696 * Usage: Internal/External
697 *
698 * </ioctl>
699 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800700#define WE_SET_GTX_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530701/*
702 * <ioctl>
703 * gtxMargin - Set the gtxMargin
704 *
705 * @INPUT: 1 to 32
706 *
707 * @OUTPUT: None
708 *
709 * This IOTCL use dto set gtxMargin
710 *
711 * @E.g: iwpriv wlan0 gtxMargini <value>
712 *
713 * Supported Feature: STA
714 *
715 * Usage: Internal/External
716 *
717 * </ioctl>
718 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800719#define WE_SET_GTX_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530720/*
721 * <ioctl>
722 * gtxStep - Set the gtxStep
723 *
724 * @INPUT: None
725 *
726 * @OUTPUT: None
727 *
728 * This IOTCL used to sets gtxStep
729 *
730 * @E.g: iwpriv wlan0 gtxStep <value>
731 *
732 * Supported Feature: STA
733 *
734 * Usage: Internal/External
735 *
736 * </ioctl>
737 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800738#define WE_SET_GTX_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530739/*
740 * <ioctl>
741 * gtxMinTpc - Sets the gtxMinTpc
742 *
743 * @INPUT: Atleast one int argument
744 *
745 * @OUTPUT: None
746 *
747 * This IOTCL sets the tx MinTpc
748 *
749 * @E.g: iwpriv wlan0 gtxMinTpc <value>
750 *
751 * Supported Feature: STA
752 *
753 * Usage: Internal/External
754 *
755 * </ioctl>
756 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800757#define WE_SET_GTX_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530758/*
759 * <ioctl>
760 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
761 *
762 * @INPUT: Mask value
763 *
764 * @OUTPUT: None
765 *
766 * This IOTCL used to set gtxBWMask
767 *
768 * @E.g: iwpriv wlan0 gtxBWMask <value>
769 *
770 * Supported Feature: STA
771 *
772 * Usage: Internal/External
773 *
774 * </ioctl>
775 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530776
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530777#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530778/*
779 * <ioctl>
780 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
781 *
782 * @INPUT: set_value
783 *
784 * @OUTPUT: None
785 *
786 * This IOCTL is used to set the MCC latency value in milliseconds
787 * during STA-P2P concurrency.
788 *
789 * If 0ms latency is provided, then FW will set to a default.
790 * Otherwise, latency must be at least 30ms.
791 *
792 * @E.g: iwpriv wlan0 setMccLatency 40
793 *
794 *
795 * Supported Feature: Concurrency
796 *
797 * Usage: Internal/External
798 *
799 * </ioctl>
800 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800801#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530802
803/*
804 * <ioctl>
805 * setMccQuota- Set the quota for P2P cases
806 *
807 * @INPUT: set_value [0,100]
808 *
809 * @OUTPUT: None
810 *
811 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
812 *
813 * Currently used to set time quota for 2 MCC vdevs/adapters using
814 * (operating channel, quota) for each mode.
815 * The info is provided run time using iwpriv command:
816 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
817 * Note: the quota provided in command is for the same mode in cmd.
818 * HDD checks if MCC mode is active, gets the second mode and its
819 * operating chan.
820 * Quota for the 2nd role is calculated as 100 - quota of first mode.
821 *
822 * @E.g: iwpriv wlan0 setMccQuota 50
823 * iwpriv p2p0 setMccQuota 50
824 *
825 * Supported Feature: Concurrency
826 *
827 * Usage: Internal/External
828 *
829 * </ioctl>
830 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800831#define WE_MCC_CONFIG_QUOTA 71
832/* Private IOCTL for debug connection issues */
833#define WE_SET_DEBUG_LOG 72
834#ifdef WE_SET_TX_POWER
835#undef WE_SET_TX_POWER
836#endif
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -0800837
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530838/*
839 * <ioctl>
840 * setTxPower - Set the current transmit power
841 *
842 * @INPUT: Transmission power in dBm
843 *
844 * @OUTPUT: None
845 *
846 * This IOCTL sets the current transmit power.
847 * This setting does not persist over reboots.
848 *
849 * @E.g: iwpriv wlan0 setTxPower 10
850 *
851 * Supported Feature: STA
852 *
853 * Usage: Internal/External
854 *
855 * </ioctl>
856 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800857#define WE_SET_TX_POWER 74
858/* Private ioctl for earlyrx power save feature */
859#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
860#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
861#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
862#define WE_SET_EARLY_RX_SLOP_STEP 78
863#define WE_SET_EARLY_RX_INIT_SLOP 79
864#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530865/*
866 * <ioctl>
867 * setMcRate - Set the data rate for multicast data
868 *
869 * @INPUT: 1 to 32
870 *
871 * @OUTPUT: None
872 *
873 * This IOCTL sets the data rate for multicast data. Note that this command
874 * is allowed only in STA, IBSS, or QCMobileAP mode
875 *
876 * @E.g: iwpriv wlan0 setMcRate <value>
877 *
878 * Supported Feature: STA
879 *
880 * Usage: Internal/External
881 *
882 * </ioctl>
883 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800884#define WE_SET_MC_RATE 81
885#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
886/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530887/*
888 * <ioctl>
889 * 5g_ebt - Sets the 5g_ebt
890 *
891 * @INPUT: <value>
892 *
893 * @OUTPUT: None
894 *
895 * This IOTCL used to set 5g_ebt
896 *
897 * @E.g: iwpriv wlan0 5g_ebt <value>
898 *
899 * Supported Feature: STA
900 *
901 * Usage: Internal/External
902 *
903 * </ioctl>
904 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800905#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530906/*
907 * <ioctl>
908 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
909 *
910 * @INPUT: 20 t0 160
911 *
912 * @OUTPUT: None
913 *
914 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
915 *
916 * @E.g: iwpriv wlan0 cts_cbw <value>
917 *
918 * Supported Feature: STA
919 *
920 * Usage: Internal/External
921 *
922 * </ioctl>
923 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800924#define WE_SET_CTS_CBW 84
925#define WE_DUMP_STATS 85
926#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +0530927/* Private sub ioctl for starting/stopping the profiling */
928#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +0530929
Abhishek Singh3c507012016-12-01 11:15:42 +0530930/*
931 * <ioctl>
932 * setChanChange - Initiate channel change
933 *
934 * @INPUT: channel number to switch to.
935 *
936 * @OUTPUT: None
937 *
938 * This IOCTL is used to initiate a channel change.
939 * If called on STA/CLI interface it will send the
940 * ECSA action frame to the connected SAP/GO asking to
941 * initiate the ECSA, if supported.
942 * If called on SAP/GO interface it will initiate
943 * ECSA and ask connected peers to move to new channel.
944 *
945 * @E.g: iwpriv wlan0 setChanChange <channel>
946 * iwpriv wlan0 setChanChange 1
947 *
948 * Supported Feature: ECSA
949 *
950 * Usage: Internal/External
951 *
952 * </ioctl>
953 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +0530954#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +0530955#define WE_SET_CONC_SYSTEM_PREF 89
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800956
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800957/*
958 * <ioctl>
959 * set_11ax_rate - set 11ax rates to FW
960 *
961 * @INPUT: rate code
962 *
963 * @OUTPUT: None
964 *
965 * This IOCTL fixes the Tx data rate of 11AX.
966 *
967 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
968 *
969 * Supported Feature: STA/SAP
970 *
971 * Usage: Internal
972 *
973 * </ioctl>
974 */
975#define WE_SET_11AX_RATE 91
976
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -0700977/*
978 * <ioctl>
979 * enable_dcm - enable Dual Carrier Modulation(DCM)
980 *
981 * @INPUT: 0/1
982 *
983 * @OUTPUT: None
984 *
985 * This IOCTL enables/disables DCM.
986 *
987 * @E.g: iwpriv wlan0 enable_dcm <0/1>
988 *
989 * Supported Feature: STA/SAP
990 *
991 * Usage: Internal
992 *
993 * </ioctl>
994 */
995#define WE_SET_DCM 92
996
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -0700997/*
998 * <ioctl>
Naveen Rawat53448ea2017-11-27 11:43:18 -0800999 * range_ext - enable Range extension
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001000 *
1001 * @INPUT: 0/1
1002 *
1003 * @OUTPUT: None
1004 *
1005 * This IOCTL enables/disables Range extension.
1006 *
Naveen Rawat53448ea2017-11-27 11:43:18 -08001007 * @E.g: iwpriv wlan0 range_ext <1/0>
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001008 *
1009 * Supported Feature: STA/SAP
1010 *
1011 * Usage: Internal
1012 *
1013 * </ioctl>
1014 */
1015#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001016
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301017/*
1018 * <ioctl>
1019 * wow_ito - sets the timeout value for inactivity data while
1020 * in power save mode during wow
1021 *
1022 * @INPUT: int
1023 *
1024 * @OUTPUT: None
1025 *
1026 * This IOCTL set the timeout value for inactivity data in power save mode
1027 *
1028 * @E.g: iwpriv wlan0 wow_ito 20
1029 *
1030 * Supported Feature: STA
1031 *
1032 * Usage: External
1033 *
1034 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001035 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301036#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1037
Jeff Johnson011c4502017-10-05 15:25:56 -07001038/*
1039 * <ioctl>
1040 * pdev_reset - reset the pdev
1041 *
1042 * @INPUT: Reset command to initiate:
1043 * TX_FLUSH = 1
1044 * WARM_RESET = 2
1045 * COLD_RESET = 3
1046 * WARM_RESET_RESTORE_CAL = 4
1047 * COLD_RESET_RESTORE_CAL = 5
1048 *
1049 * @OUTPUT: None
1050 *
1051 * This IOCTL is used to reset the pdev. The primary use is
1052 * for internal testing. It is not expected that this will
1053 * be used on a production device.
1054 *
1055 * @E.g: iwpriv wlan0 pdev_reset <command>
1056 * iwpriv wlan0 pdev_reset 1
1057 *
1058 * Supported Feature: None
1059 *
1060 * Usage: Internal
1061 *
1062 * </ioctl>
1063 */
1064#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301065
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301066/*
1067 * setModDTIM - Change Modulated DTIM
1068 *
1069 * @INPUT: set_value.
1070 *
1071 * @OUTPUT: None
1072 *
1073 * This IOCTL is used to change modulated DTIM
1074 * value without WIFI OFF/ON.
1075 *
1076 * @E.g: iwpriv wlan0 setModDTIM <value>
1077 * iwpriv wlan0 setModDTIM 2
1078 *
1079 * Supported Feature: N/A
1080 *
1081 * Usage: Internal/External
1082 *
1083 * </ioctl>
1084 */
1085#define WE_SET_MODULATED_DTIM 96
1086
Kiran Kumar Lokere05e9a652018-04-10 20:27:38 -07001087/*
1088 * <ioctl>
1089 * set_ppdu_dur - Sets the global ppdu duration
1090 *
1091 * @INPUT: Atleast one int argument
1092 *
1093 * @OUTPUT: None
1094 *
1095 * This IOTCL used to set global ppdu duration
1096 *
1097 * @E.g: iwpriv wlan0 set_ppdu_dur <value>
1098 * Valid values are 1 to 4000
1099 *
1100 * Supported Feature: STA/SAP
1101 *
1102 * Usage: Internal
1103 *
1104 * </ioctl>
1105 */
1106#define WE_SET_PPDU_DUR 97
1107
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001108/* Private ioctls and their sub-ioctls */
1109#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1110#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001111#define WE_GET_WLAN_DBG 4
1112#define WE_GET_MAX_ASSOC 6
1113/* 7 is unused */
1114#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301115
1116/*
1117 * <ioctl>
1118 * getconcurrency - Get concurrency mode
1119 *
1120 * @INPUT: None
1121 *
1122 * @OUTPUT: It shows concurrency value
1123 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1124 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1125 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1126 *
1127 * This IOCTL is used to retrieve concurrency mode.
1128 *
1129 * @E.g: iwpriv wlan0 getconcurrency
1130 * wlan0 getconcurrency:5
1131 * Above value shows STA+P2P_Client
1132 *
1133 * Supported Feature: Concurrency
1134 *
1135 * Usage: Internal/External
1136 *
1137 * </ioctl>
1138 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001139#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301140/*
1141 * <ioctl>
1142 * get_nss - Get the number of spatial STBC streams (NSS)
1143 *
1144 * @INPUT: None
1145 *
1146 * @OUTPUT: NSS
1147 * wlan0 get_nss:2
1148 *
1149 * This IOTCL used to get the number of spatial STBC streams
1150 *
1151 * @E.g: iwpriv wlan0 get_nss
1152 *
1153 * Supported Feature: STA
1154 *
1155 * Usage: Internal/External
1156 *
1157 * </ioctl>
1158 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001159#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301160/*
1161 * <ioctl>
1162 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1163 *
1164 * @INPUT: None
1165 *
1166 * @OUTPUT: ldpc
1167 * wlan0 get_ldpc:1
1168 *
1169 * This IOTCL used to gets the low density parity check (LDPC)
1170 *
1171 * @E.g: iwpriv wlan0 get_ldpc
1172 *
1173 * Supported Feature: STA
1174 *
1175 * Usage: Internal/External
1176 *
1177 * </ioctl>
1178 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001179#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301180/*
1181 * <ioctl>
1182 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1183 *
1184 * @INPUT: None
1185 *
1186 * @OUTPUT: TXSTBC
1187 * wlan0 get_tx_stbc:1
1188 *
1189 * This IOTCL get the value of the current Tx space time block code (STBC)
1190 *
1191 * @E.g: iwpriv wlan0 get_tx_stbc
1192 *
1193 * Supported Feature: STA
1194 *
1195 * Usage: Internal/External
1196 *
1197 * </ioctl>
1198 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001199#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301200/*
1201 * <ioctl>
1202 * get_rx_stbc - Gets the value of the current Rx STBC
1203 *
1204 * @INPUT: None
1205 *
1206 * @OUTPUT: Rx STBC
1207 * wlan0 get_rx_stbc:1
1208 *
1209 * This IOTCL used to get the value of the current Rx STBC
1210 *
1211 * @E.g: iwpriv wlan0 get_rx_stbc
1212 *
1213 * Supported Feature: STA
1214 *
1215 * Usage: Internal/External
1216 *
1217 * </ioctl>
1218 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001219#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301220/*
1221 * <ioctl>
1222 * get_shortgi - Get the value of the current short GI setting
1223 *
1224 * @INPUT: None
1225 *
1226 * @OUTPUT: Enable/disable of shortgi
1227 * wlan0 get_shortgi:1
1228 *
1229 * This IOCTL gets the value of the current short GI setting
1230 *
1231 * @E.g: iwpriv wlan0 get_shortgi
1232 *
1233 * Supported Feature: STA
1234 *
1235 * Usage: Internal/External
1236 *
1237 * </ioctl>
1238 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001239#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301240/*
1241 * <ioctl>
1242 * get_rtscts - Get the value of the current RTS/CTS setting.
1243 *
1244 * @INPUT: None
1245 *
1246 * @OUTPUT: Enable/disable of RTS/CTS
1247 * wlan0 get_rtscts:33
1248 *
1249 * This IOTCL get the value of the current RTS/CTS setting.
1250 *
1251 * @E.g: iwpriv wlan0 get_rtscts
1252 *
1253 * Supported Feature: STA
1254 *
1255 * Usage: Internal/External
1256 *
1257 * </ioctl>
1258 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001259#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301260/*
1261 * <ioctl>
1262 * get_chwidth - Get the current channel width setting
1263 *
1264 * @INPUT: None
1265 *
1266 * @OUTPUT: channel width
1267 * wlan0 get_chwidth:0
1268 *
1269 * This IOTCL get the current channel width setting.
1270 *
1271 * @E.g: iwpriv wlan0 get_chwidth
1272 *
1273 * Supported Feature: STA
1274 *
1275 * Usage: Internal/External
1276 *
1277 * </ioctl>
1278 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001279#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301280/*
1281 * <ioctl>
1282 * get_anienable - Get the anienable
1283 *
1284 * @INPUT: None
1285 *
1286 * @OUTPUT:
1287 * wlan0 get_anienable:0
1288 *
1289 * This IOTCL get the anienable
1290 *
1291 * @E.g: iwpriv wlan0 get_anienable
1292 *
1293 * Supported Feature: STA
1294 *
1295 * Usage: Internal/External
1296 *
1297 * </ioctl>
1298 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001299#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301300/*
1301 * <ioctl>
1302 * get_aniplen - Get the aniplen
1303 *
1304 * @INPUT: None
1305 *
1306 * @OUTPUT:
1307 * wlan0 get_aniplen:0
1308 *
1309 * This IOTCL get the aniplen
1310 *
1311 * @E.g: iwpriv wlan0 get_aniplen
1312 *
1313 * Supported Feature: STA
1314 *
1315 * Usage: Internal/External
1316 *
1317 * </ioctl>
1318 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001319#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301320/*
1321 * <ioctl>
1322 * get_anilislen- Get the anilislen
1323 *
1324 * @INPUT: None
1325 *
1326 * @OUTPUT:
1327 * wlan0 get_anilislen:0
1328 *
1329 * This IOTCL used to get anilislen
1330 *
1331 * @E.g: iwpriv wlan0 get_anilislen
1332 *
1333 * Supported Feature: STA
1334 *
1335 * Usage: Internal/External
1336 *
1337 * </ioctl>
1338 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001339#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301340/*
1341 * <ioctl>
1342 * get_aniofdmlvl - Get the OFDM level
1343 *
1344 * @INPUT: None
1345 *
1346 * @OUTPUT: OFDM
1347 * wlan0 get_aniofdmlvl:0
1348 *
1349 * This IOTCL used to get ofdm level
1350 *
1351 * @E.g: iwpriv wlan0 get_aniofdmlvl
1352 *
1353 * Supported Feature: STA
1354 *
1355 * Usage: Internal/External
1356 *
1357 * </ioctl>
1358 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001359#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301360/*
1361 * <ioctl>
1362 * get_aniccklvl - Get the cck level
1363 *
1364 * @INPUT: None
1365 *
1366 * @OUTPUT:
1367 * wlan0 get_aniccklvl:0
1368 *
1369 * This IOTCL used to get cck level
1370 *
1371 * @E.g: iwpriv wlan0 get_aniccklvl
1372 *
1373 * Supported Feature: STA
1374 *
1375 * Usage: Internal/External
1376 *
1377 * </ioctl>
1378 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001379#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301380/*
1381 * <ioctl>
1382 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1383 *
1384 * @INPUT: None
1385 *
1386 * @OUTPUT: Enable/disable dynamic channel bandwidth
1387 * wlan0 get_cwmenable:0
1388 *
1389 * This IOTCL get the value of the dynamic channel bandwidth setting
1390 *
1391 * @E.g: iwpriv wlan0 get_cwmenable
1392 *
1393 * Supported Feature: STA
1394 *
1395 * Usage: Internal/External
1396 *
1397 * </ioctl>
1398 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001399#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301400/*
1401 * <ioctl>
1402 * get_txchainmask - Get the txchainmask that was set
1403 *
1404 * @INPUT: None
1405 *
1406 * @OUTPUT: txchainmask
1407 * wlan0 get_txchainmask:1
1408 *
1409 * This IOCTL gets the txchainmask that was set
1410 * This command is useful if it was previously set
1411 *
1412 * @E.g: iwpriv wlan0 get_txchainmask
1413 *
1414 * Supported Feature: STA
1415 *
1416 * Usage: Internal/External
1417 *
1418 * </ioctl>
1419 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001420#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301421/*
1422 * <ioctl>
1423 * get_rxchainmask - Get the rxchainmask that was set
1424 *
1425 * @INPUT: None
1426 *
1427 * @OUTPUT: rxchainmask
1428 * wlan0 get_rxchainmask:1
1429 *
1430 * This IOCTL gets the rxchainmask that was set
1431 * This command is useful only if it was previously set.
1432 *
1433 * @E.g: iwpriv wlan0 get_rxchainmask
1434 *
1435 * Supported Feature: STA
1436 *
1437 * Usage: Internal/External
1438 *
1439 * </ioctl>
1440 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001441#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301442/*
1443 * <ioctl>
1444 * get_11nrate - Get the fixed Tx data rate
1445 *
1446 * @INPUT: None
1447 *
1448 * @OUTPUT: Using this command does not return the same value as set
1449 * wlan0 get_11nrate:0
1450 *
1451 * This IOCTL gets the fixed Tx data rate
1452 * This command is useful only if setting the fixed Tx rate.
1453 *
1454 * @E.g: iwpriv wlan0 get_11nrate
1455 *
1456 * Supported Feature: STA
1457 *
1458 * Usage: Internal/External
1459 *
1460 * </ioctl>
1461 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001462#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301463/*
1464 * <ioctl>
1465 * get_ampdu - Get the maximum subframe of ampdu
1466 *
1467 * @INPUT: None
1468 *
1469 * @OUTPUT: Maximum subframe of ampdu
1470 * wlan0 get_ampdu:1
1471 *
1472 * This IOCTL gets the maximum subframe of ampdu
1473 * This command is useful only if setting ampdu.
1474 *
1475 * @E.g: iwpriv wlan0 get_ampdu
1476 *
1477 * Supported Feature: STA
1478 *
1479 * Usage: Internal/External
1480 *
1481 * </ioctl>
1482 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001483#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301484/*
1485 * <ioctl>
1486 * get_amsdu - Get the maximum subframe of amsdu
1487 *
1488 * @INPUT: None
1489 *
1490 * @OUTPUT: Maximum subframe of amsdu
1491 * wlan0 get_amsdu:1
1492 *
1493 * This IOCTL gets the maximum subframe of amsdu.
1494 * This command is useful only if setting amsdu
1495 *
1496 * @E.g: iwpriv wlan0 get_amsdu
1497 *
1498 * Supported Feature: STA
1499 *
1500 * Usage: Internal/External
1501 *
1502 * </ioctl>
1503 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001504#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301505/*
1506 * <ioctl>
1507 * get_txpow2g - Get the current 2 GHz Tx power setting
1508 *
1509 * @INPUT: None
1510 *
1511 * @OUTPUT: Tx Power in dbm
1512 * wlan0 get_txpow2g:0
1513 *
1514 * This IOCTL gets the current 2 GHz Tx power setting
1515 * This command is useful if setting Tx power
1516 *
1517 * @E.g: iwpriv wlan0 get_txpow2g
1518 *
1519 * Supported Feature: STA
1520 *
1521 * Usage: Internal/External
1522 *
1523 * </ioctl>
1524 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001525#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301526/*
1527 * <ioctl>
1528 * get_txpow5g - Get the current 5 GHz Tx power setting
1529 *
1530 * @INPUT: None
1531 *
1532 * @OUTPUT: Tx Power in dbm
1533 * wlan0 get_txpow5g:0
1534 *
1535 * This IOCTL gets the current 5 GHz Tx power setting
1536 * This command is useful if setting Tx power
1537 *
1538 * @E.g: iwpriv wlan0 get_txpow5g
1539 *
1540 * Supported Feature: STA
1541 *
1542 * Usage: Internal/External
1543 *
1544 * </ioctl>
1545 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001546#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001547/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001548#define WE_GET_PPS_PAID_MATCH 32
1549#define WE_GET_PPS_GID_MATCH 33
1550#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1551#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1552#define WE_GET_PPS_EOF_PAD_DELIM 36
1553#define WE_GET_PPS_MACADDR_MISMATCH 37
1554#define WE_GET_PPS_DELIM_CRC_FAIL 38
1555#define WE_GET_PPS_GID_NSTS_ZERO 39
1556#define WE_GET_PPS_RSSI_CHECK 40
1557/* Private ioctl for QPower */
1558#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1559#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1560#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1561#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001562/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301563/*
1564 * <ioctl>
1565 * get_gtxHTMcs - Get the tx HTM
1566 *
1567 * @INPUT: None
1568 *
1569 * @OUTPUT: HTM
1570 * wlan0 get_gtxHTMcs:32896
1571 *
1572 * This IOTCL used to get HTM
1573 *
1574 * @E.g: iwpriv wlan0 get_gtxHTMcs
1575 *
1576 * Supported Feature: STA
1577 *
1578 * Usage: Internal/External
1579 *
1580 * </ioctl>
1581 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001582#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301583/*
1584 * <ioctl>
1585 * get_gtxVHTMcs - Get the VHTM
1586 *
1587 * @INPUT: None
1588 *
1589 * @OUTPUT: VHTM
1590 * wlan0 get_gtxVHTMcs:524800
1591 *
1592 * This IOTCL used to get the VHTM
1593 *
1594 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1595 *
1596 * Supported Feature: STA
1597 *
1598 * Usage: Internal/External
1599 *
1600 * </ioctl>
1601 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001602#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301603/*
1604 * <ioctl>
1605 * get_gtxUsrCfg - Get the tx cfg
1606 *
1607 * @INPUT: None
1608 *
1609 * @OUTPUT: TXCFG
1610 * wlan0 get_gtxUsrCfg:32
1611 *
1612 * This IOTCL used to get the tx cfg
1613 *
1614 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1615 *
1616 * Supported Feature: STA
1617 *
1618 * Usage: Internal/External
1619 *
1620 * </ioctl>
1621 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001622#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301623/*
1624 * <ioctl>
1625 * get_gtxThre - Get the tx threshold
1626 *
1627 * @INPUT: None
1628 *
1629 * @OUTPUT: Threshold
1630 * wlan0 get_gtxThre:3
1631 *
1632 * This IOCTL is used to get tx threshold
1633 *
1634 * @E.g: iwpriv wlan0 get_gtxThre
1635 *
1636 * Supported Feature: STA
1637 *
1638 * Usage: Internal/External
1639 *
1640 * </ioctl>
1641 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001642#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301643/*
1644 * <ioctl>
1645 * get_gtxMargin - Get the tx margin
1646 *
1647 * @INPUT: None
1648 *
1649 * @OUTPUT: GTXMARGIN
1650 * wlan0 get_gtxMargin:2
1651 *
1652 * This IOCTL is used to set tx margin
1653 *
1654 * @E.g: iwpriv wlan0 get_gtxMargin
1655 *
1656 * Supported Feature: STA
1657 *
1658 * Usage: Internal/External
1659 *
1660 * </ioctl>
1661 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001662#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301663/*
1664 * <ioctl>
1665 * get_gtxStep - Get the tx step
1666 *
1667 * @INPUT: None
1668 *
1669 * @OUTPUT: GTXSTEP
1670 * wlan0 get_gtxStep:0
1671 *
1672 * This IOCTL is used to get the gtx step
1673 *
1674 * @E.g: iwpriv wlan0 get_gtxStep
1675 *
1676 * Supported Feature: STA
1677 *
1678 * Usage: Internal/External
1679 *
1680 * </ioctl>
1681 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001682#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301683/*
1684 * <ioctl>
1685 * get_gtxMinTpc - Get the tx miminum tpc
1686 *
1687 * @INPUT: None
1688 *
1689 * @OUTPUT: TPC
1690 * wlan0 get_gtxMinTpc:0
1691 *
1692 * This IOCTL is used to get tx miminum tpc
1693 *
1694 * @E.g: iwpriv wlan0 get_gtxMinTpc
1695 *
1696 * Supported Feature: STA
1697 *
1698 * Usage: Internal/External
1699 *
1700 * </ioctl>
1701 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001702#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301703/*
1704 * <ioctl>
1705 * get_gtxBWMask - Get the tx BW MASK
1706 *
1707 * @INPUT: None
1708 *
1709 * @OUTPUT: MASK
1710 * wlan0 get_gtxBWMask:15
1711 *
1712 * This IOCTL is used get gtx bw mask
1713 *
1714 * @E.g: iwpriv wlan0 get_gtxBWMask
1715 *
1716 * Supported Feature: STA
1717 *
1718 * Usage: Internal/External
1719 *
1720 * </ioctl>
1721 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001722#define WE_GET_GTX_BWMASK 54
1723#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001724#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001725#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001726
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001727/*
1728 * <ioctl>
1729 * get_dcm - Get dcm enablement value
1730 *
1731 * @INPUT: None
1732 *
1733 * @OUTPUT: 0/1
1734 * wlan0 get_dcm
1735 *
1736 * This IOCTL is used get dcm value
1737 *
1738 * Supported Feature: STA/SAP
1739 *
1740 * Usage: Internal
1741 *
1742 * </ioctl>
1743 */
1744#define WE_GET_DCM 60
1745
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001746/*
1747 * <ioctl>
1748 * get_dcm - Get range extension enablement value
1749 *
1750 * @INPUT: None
1751 *
1752 * @OUTPUT: 0/1
1753 * wlan0 get_range_ext
1754 *
1755 * This IOCTL is used get range_extension value
1756 *
1757 * Supported Feature: STA/SAP
1758 *
1759 * Usage: Internal
1760 *
1761 * </ioctl>
1762 */
1763#define WE_GET_RANGE_EXT 61
1764
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001765/* Private ioctls and their sub-ioctls */
1766#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1767
1768/* Private ioctls and their sub-ioctls */
1769#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1770#define WE_WOWL_ADD_PTRN 1
1771#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301772/*
1773 * <ioctl>
1774 * neighbor - Send neighbor report request
1775 *
1776 * @INPUT: string
1777 *
1778 * @OUTPUT: None
1779 *
1780 * This IOCTL create a Neighbor report request and send it to peer
1781 *
1782 * @E.g: iwpriv wlan0 neighbor "SSID"
1783 *
1784 * Supported Feature: 11k
1785 *
1786 * Usage: Internal/External
1787 *
1788 * </ioctl>
1789 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001790#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301791/*
1792 * <ioctl>
1793 * set_ap_wps_ie - Set the P2P IE of the probe response
1794 *
1795 * @INPUT: string
1796 *
1797 * @OUTPUT: None
1798 *
1799 * This IOCTL sets the P2P IE of the probe response
1800 *
1801 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1802 *
1803 * Supported Feature: STA
1804 *
1805 * Usage: Internal/External
1806 *
1807 * </ioctl>
1808 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001809#define WE_SET_AP_WPS_IE 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001810#define WE_SET_CONFIG 5
1811
1812/* Private ioctls and their sub-ioctls */
1813#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1814#define WE_SET_WLAN_DBG 1
1815#define WE_SET_DP_TRACE 2
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301816#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001817
1818/* Private ioctls and their sub-ioctls */
1819#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1820#define WE_WLAN_VERSION 1
1821#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301822/*
1823 * <ioctl>
1824 * getConfig - gets the values of all configurations listed in WCNSS
1825 *
1826 * @INPUT: None
1827 *
1828 * @OUTPUT: Current configuration to the sys log
1829 * wlan0 getConfig: WLAN configuration written to system log
1830 *
1831 * This IOCTL gets the values of all configurations listed in WCNSS
1832 *
1833 * @E.g: iwpriv wlan0 getConfig
1834 *
1835 * Supported Feature: STA
1836 *
1837 * Usage: Internal/External
1838 *
1839 * </ioctl>
1840 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001841#define WE_GET_CFG 3
1842#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301843/*
1844 * <ioctl>
1845 * getChannelList - Get the available channel list while in QCMobileAP
1846 *
1847 * @INPUT: None
1848 *
1849 * @OUTPUT: Channel list
1850 * wlan0 getChannelList:36 US 1..165
1851 *
1852 * This IOCTL gets the available channel list while in QCMobileAP
1853 *
1854 * @E.g: iwpriv wlan0 getChannelList
1855 *
1856 * Supported Feature: STA
1857 *
1858 * Usage: Internal/External
1859 *
1860 * </ioctl>
1861 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001862#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301863/*
1864 * <ioctl>
1865 * getRSSI - Get the Received Signal Strength Indicator
1866 *
1867 * @INPUT: None
1868 *
1869 * @OUTPUT: RSSI
1870 * wlan0 getRSSI:rsssi=-32
1871 *
1872 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1873 *
1874 * @E.g: iwpriv wlan0 getRSSI
1875 *
1876 * Supported Feature: STA
1877 *
1878 * Usage: Internal/External
1879 *
1880 * </ioctl>
1881 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001882#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001883
1884/*
1885 * <ioctl>
1886 * getSuspendStats - Get suspend/resume stats
1887 *
1888 * @INPUT: None
1889 *
1890 * @OUTPUT: character string containing formatted suspend/resume stats
1891 *
1892 * This ioctl is used to get suspend/resume stats formatted for display.
1893 * Currently it includes suspend/resume counts, wow wake up reasons, and
1894 * suspend fail reasons.
1895 *
1896 * @E.g: iwpriv wlan0 getSuspendStats
1897 * iwpriv wlan0 getSuspendStats
1898 *
1899 * Supported Feature: suspend/resume
1900 *
1901 * Usage: Internal
1902 *
1903 * </ioctl>
1904 */
1905#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001906#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05301907/*
1908 * <ioctl>
1909 * getTdlsPeers - Get all TDLS peers.
1910 *
1911 * @INPUT: None
1912 *
1913 * @OUTPUT: Returns the MAC address of all the TDLS peers
1914 * wlan0 getTdlsPeers:
1915 * MAC Id cap up RSSI
1916 * ---------------------------------
1917 * 00:0a:f5:0e:bd:18 2 Y Y -44
1918 * 00:0a:f5:bf:0e:12 0 N N 0
1919 *
1920 * This IOCTL is used to get all TDLS peers.
1921 *
1922 * @E.g: iwpriv wlan0 getTdlsPeers
1923 *
1924 * Supported Feature: TDLS
1925 *
1926 * Usage: Internal/External
1927 *
1928 * </ioctl>
1929 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001930#define WE_GET_TDLS_PEERS 8
1931#endif
1932#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05301933/*
1934 * <ioctl>
1935 * getPMFInfo - get the PMF info of the connected session
1936 *
1937 * @INPUT: None
1938 *
1939 * @OUTPUT:
1940 * wlan0 getPMFInfo:
1941 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
1942 * Number of Unprotected Disassocs 0
1943 * Number of Unprotected Deauths 0
1944 *
1945 * This IOCTL is used to get the PMF stats/status of the current
1946 * connection.
1947 *
1948 * @e.g:iwpriv wlan0 getPMFInfo
1949 *
1950 * Supported Feature: PMF
1951 *
1952 * Usage: Internal/External
1953 *
1954 * </ioctl>
1955 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001956#define WE_GET_11W_INFO 9
1957#endif
1958#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05301959/*
1960 * <ioctl>
1961 * getIbssSTAs - get ibss sta info
1962 *
1963 * @INPUT: None
1964 *
1965 * @OUTPUT: Give the MAC of the IBSS STA
1966 * wlan0 getIbssSTAs:
1967 * 1 .8c:fd:f0:01:9c:bf
1968 *
1969 * This IOCTL is used to get ibss sta info
1970 *
1971 * @E.g: iwpriv wlan0 getIbssSTAs
1972 *
1973 * Supported Feature: IBSS
1974 *
1975 * Usage: Internal/External
1976 *
1977 * </ioctl>
1978 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001979#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301980/*
1981 * <ioctl>
1982 * getphymode - Get the current phymode.
1983 *
1984 * @INPUT: None
1985 *
1986 * @OUTPUT: In phymode
1987 * wlan0 getphymode:AUTO MODE
1988 *
1989 * This IOCTL used to gets the current phymode.
1990 *
1991 * @E.g: iwpriv wlan0 getphymode
1992 *
1993 * Supported Feature: STA
1994 *
1995 * Usage: Internal/External
1996 *
1997 * </ioctl>
1998 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001999#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002000
2001/*
2002 * <ioctl>
2003 * getOemDataCap - Get the oem data caps.
2004 *
2005 * @INPUT: None
2006 *
2007 * @OUTPUT: oem data capability
2008 *
2009 * This IOCTL used to gets the current oem data cap.
2010 *
2011 * @E.g: iwpriv wlan0 getOemDataCap
2012 *
2013 * Usage: Internal/External
2014 *
2015 * </ioctl>
2016 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002017#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002018
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302019/*
2020 * <ioctl>
2021 * getSNR - Enable SNR Monitoring
2022 *
2023 * @INPUT: None
2024 *
2025 * @OUTPUT: Signal strength/ratio
2026 * wlan0 getSNR:1
2027 *
2028 * This IOCTL is used to get ibss sta info
2029 *
2030 * @E.g: iwpriv wlan0 getSNR
2031 *
2032 * Supported Feature: STA
2033 *
2034 * Usage: Internal/External
2035 *
2036 * </ioctl>
2037 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002038
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002039#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302040#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002041
2042/* Private ioctls and their sub-ioctls */
2043#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302044
2045/*
2046 * <ioctl>
2047 * reassoc - Trigger STA re-association to the connected AP
2048 *
2049 * @INPUT: None
2050 *
2051 * @OUTPUT: None
2052 *
2053 * This IOCTL is used to trigger STA reassociation to the connected AP.
2054 *
2055 * @E.g: iwpriv wlan0 reassoc
2056 *
2057 * Supported Feature: Roaming
2058 *
2059 * Usage: Internal
2060 *
2061 * </ioctl>
2062 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002063#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302064/*
2065 * <ioctl>
2066 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2067 *
2068 * @INPUT: None
2069 *
2070 * @OUTPUT: print ibss peer in info logs
2071 * pPeerInfo->numIBSSPeers = 1
2072 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2073 *
2074 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2075 * in info logs
2076 *
2077 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2078 *
2079 * Supported Feature: IBSS
2080 *
2081 * Usage: Internal/External
2082 *
2083 * </ioctl>
2084 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002085#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002086/* Sub ioctls 11 to 16 are not used */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002087#define WE_GET_RECOVERY_STAT 17
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002088#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302089/*
2090 * <ioctl>
2091 * stop_obss_scan - Stop obss scan
2092 *
2093 * @INPUT: None
2094 *
2095 * @OUTPUT: None
2096 *
2097 * This IOCTL is used to stop obss scan
2098 *
2099 * @E.g: iwpriv wlan0 stop_obss_scan
2100 *
2101 * Supported Feature: Scan
2102 *
2103 * Usage: Internal/External
2104 *
2105 * </ioctl>
2106 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002107#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002108
2109/* Private ioctls and their sub-ioctls */
2110#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2111
2112#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302113/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002114
Manjeet Singhf82ed072016-07-08 11:40:00 +05302115#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002116
Kabilan Kannan6894e6a2017-11-09 14:37:55 -08002117/* subcommand 5 is unused */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302118
Abhishek Singh49b654e2016-12-01 16:11:17 +05302119/*
2120 * <ioctl>
2121 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2122 *
2123 * @INPUT: staid
2124 *
2125 * @OUTPUT: print ibss peer corresponding to staid in info logs
2126 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2127 *
2128 * This IOCTL is used to print the specific ibss peers's MAC,
2129 * rate and RSSI in info logs
2130 *
2131 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2132 * iwpriv wlan0 ibssPeerInfo 0
2133 *
2134 * Supported Feature: IBSS
2135 *
2136 * Usage: Internal/External
2137 *
2138 * </ioctl>
2139 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002140#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002141#define WE_UNIT_TEST_CMD 7
2142
2143#define WE_MTRACE_DUMP_CMD 8
2144#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2145
2146
2147#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2148#define WE_LED_FLASHING_PARAM 10
2149#endif
2150
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302151/*
2152 * <ioctl>
2153 * pm_clist - Increments the index value of the concurrent connection list
2154 * and update with the input parameters provided.
2155 *
2156 * @INPUT: Following 8 arguments:
2157 * @vdev_id: vdev id
2158 * @tx_streams: TX streams
2159 * @rx_streams: RX streams
2160 * @chain_mask: Chain mask
2161 * @type: vdev_type
2162 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2163 * @sub_type: vdev_subtype
2164 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2165 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2166 * @channel: Channel
2167 * @mac: Mac id
2168 *
2169 * @OUTPUT: None
2170 *
2171 * This IOCTL is used to increments the index value of the concurrent connection
2172 * list and update with the input parameters provided.
2173 *
2174 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2175 * sub_type channel mac
2176 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2177 *
2178 * Supported Feature: DBS
2179 *
2180 * Usage: Internal/External
2181 *
2182 * </ioctl>
2183 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002184#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302185
2186/*
2187 * <ioctl>
2188 * pm_dlist - Delete the index from the concurrent connection list that is
2189 * present in the given vdev_id.
2190 *
2191 * @INPUT: delete_all, vdev_id
2192 * @delete_all: delete all indices
2193 * @vdev_id: vdev id
2194 *
2195 * @OUTPUT: None
2196 *
2197 * This IOCTL is used to delete the index from the concurrent connection list
2198 * that is present in the given vdev_id.
2199 *
2200 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2201 * iwpriv wlan0 pm_dlist 0 1
2202 *
2203 * Supported Feature: DBS
2204 *
2205 * Usage: Internal/External
2206 *
2207 * </ioctl>
2208 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002209#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302210
2211/*
2212 * <ioctl>
2213 * pm_dbs - Set dbs capability and system preference
2214 *
2215 * @INPUT: dbs, system_pref
2216 * @dbs: Value of DBS capability to be set
2217 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002218 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302219 *
2220 * @OUTPUT: None
2221 *
2222 * This IOCTL is used to set dbs capability and system preference.
2223 *
2224 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2225 * iwpriv wlan0 pm_dbs 1 0
2226 *
2227 * Supported Feature: DBS
2228 *
2229 * Usage: Internal/External
2230 *
2231 * </ioctl>
2232 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002233#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302234
2235/*
2236 * <ioctl>
2237 * pm_pcl - Set pcl for concurrency mode.
2238 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002239 * @INPUT: policy_mgr_con_mode
2240 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302241 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2242 *
2243 * @OUTPUT: None
2244 *
2245 * This IOCTL is used to set pcl for concurrency mode.
2246 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002247 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302248 * iwpriv wlan0 pm_pcl 0
2249 *
2250 * Supported Feature: DBS
2251 *
2252 * Usage: Internal/External
2253 *
2254 * </ioctl>
2255 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002256#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302257
2258/*
2259 * <ioctl>
2260 * pm_cinfo - Shows the concurrent connection list.
2261 *
2262 * @INPUT: None
2263 *
2264 * @OUTPUT: None
2265 *
2266 * This IOCTL is used to show the concurrent connection list.
2267 *
2268 * @E.g: iwpriv wlan0 pm_cinfo
2269 *
2270 * Supported Feature: DBS
2271 *
2272 * Usage: Internal/External
2273 *
2274 * </ioctl>
2275 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002276#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302277
2278/*
2279 * <ioctl>
2280 * pm_ulist - Updates the index value of the concurrent connection list
2281 * with the input parameters provided.
2282 *
2283 * @INPUT: Following 8 arguments:
2284 * @vdev_id: vdev id
2285 * @tx_streams: TX streams
2286 * @rx_streams: RX streams
2287 * @chain_mask: Chain mask
2288 * @type: vdev_type
2289 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2290 * @sub_type: vdev_subtype
2291 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2292 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2293 * @channel: Channel
2294 * @mac: Mac id
2295 *
2296 * @OUTPUT: None
2297 *
2298 * This IOCTL is used to updates the index value of the concurrent
2299 * connection list with the input parameters provided.
2300 *
2301 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2302 * sub_type channel mac
2303 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2304 *
2305 * Supported Feature: DBS
2306 *
2307 * Usage: Internal/External
2308 *
2309 * </ioctl>
2310 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002311#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302312
2313/*
2314 * <ioctl>
2315 * pm_query_action - Initiate actions needed on current connections as
2316 * per the channel provided.
2317 *
2318 * @INPUT: channel
2319 * @channel: Channel on which new connection will be.
2320 *
2321 * @OUTPUT: None
2322 *
2323 * This IOCTL is used to initiate actions needed on current connections
2324 * as per the channel provided.
2325 *
2326 * @E.g: iwpriv wlan0 pm_query_action channel
2327 * iwpriv wlan0 pm_query_action 6
2328 *
2329 * Supported Feature: DBS
2330 *
2331 * Usage: Internal/External
2332 *
2333 * </ioctl>
2334 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002335#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302336
2337/*
2338 * <ioctl>
2339 * pm_query_allow - Checks for allowed concurrency combination
2340 *
2341 * @INPUT: mode, channel, bandwidth
2342 * @mode: new connection mode
2343 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2344 * @channel: channel on which new connection is coming up
2345 * @bandwidth: Bandwidth requested by the connection
2346 * 0:None 1:5MHz 2:10MHz 3:20MHz
2347 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2348 *
2349 * @OUTPUT: None
2350 *
2351 * This IOCTL is used to checks for allowed concurrency combination.
2352 *
2353 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2354 * iwpriv wlan0 pm_query_allow 0 6 4
2355 *
2356 * Supported Feature: DBS
2357 *
2358 * Usage: Internal/External
2359 *
2360 * </ioctl>
2361 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002362#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302363
2364/*
2365 * <ioctl>
2366 * pm_run_scenario - Create scenario with number of connections provided.
2367 *
2368 * @INPUT: num_of_conn
2369 * @num_of_conn: the number of connections (values: 1~3)
2370 *
2371 * @OUTPUT: None
2372 *
2373 * This IOCTL is used to create scenario with the number of connections
2374 * provided.
2375 *
2376 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2377 * iwpriv wlan0 pm_run_scenario 1
2378 *
2379 * Supported Feature: DBS
2380 *
2381 * Usage: Internal/External
2382 *
2383 * </ioctl>
2384 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002385#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302386
2387/*
2388 * <ioctl>
2389 * pm_set_hw_mode - Set hardware for single/dual mac.
2390 *
2391 * @INPUT: hw_mode
2392 * 0:single mac 1:dual mac
2393 *
2394 * @OUTPUT: None
2395 *
2396 * This IOCTL is used to set hardware for single/dual mac.
2397 *
2398 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2399 * iwpriv wlan0 pm_set_hw_mode 1
2400 *
2401 * Supported Feature: DBS
2402 *
2403 * Usage: Internal/External
2404 *
2405 * </ioctl>
2406 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002407#define WE_POLICY_SET_HW_MODE_CMD 20
2408
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302409/*
2410 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002411 * ch_avoid - unit test SAP channel avoidance
2412 *
2413 * @INPUT: chan avoid ranges
2414 *
2415 * @OUTPUT: none
2416 *
2417 * This IOCTL is used to fake a channel avoidance event.
2418 * To test SAP/GO chan switch during chan avoid event process.
2419 *
2420 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2421 *
2422 * Supported Feature: SAP chan avoidance.
2423 *
2424 * Usage: Internal
2425 *
2426 * </ioctl>
2427 */
2428#define WE_SET_CHAN_AVOID 21
2429
2430/*
2431 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302432 * set_scan_cfg - Set dual MAC scan config parameters.
2433 *
2434 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2435 * @dbs: Value of DBS bit
2436 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2437 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2438 *
2439 * @OUTPUT: None
2440 *
2441 * This IOCTL is used to set the dual MAC scan config.
2442 *
2443 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2444 * single_mac_scan_with_dbs
2445 * iwpriv wlan0 set_scan_cfg 1 0 1
2446 *
2447 * Supported Feature: DBS
2448 *
2449 * Usage: Internal/External
2450 *
2451 * </ioctl>
2452 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002453#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302454
2455/*
2456 * <ioctl>
2457 * set_fw_mode_cfg - Sets the dual mac FW mode config
2458 *
2459 * @INPUT: dbs, dfs
2460 * @dbs: DBS bit
2461 * @dfs: Agile DFS bit
2462 *
2463 * @OUTPUT: None
2464 *
2465 * This IOCTL is used to set the dual mac FW mode config.
2466 *
2467 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2468 * iwpriv wlan0 set_fw_mode_cfg 1 1
2469 *
2470 * Supported Feature: DBS
2471 *
2472 * Usage: Internal/External
2473 *
2474 * </ioctl>
2475 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002476#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002477#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002478/*
2479 * <ioctl>
2480 * txrx_stats - TXRX statistics query
2481 *
2482 * @INPUT: query category, mac id (default mac id is 0)
2483 *
2484 * @OUTPUT: TXRX statistics result
2485 *
2486 * This IOCTL is used to get TXRX statistics counters.
2487 *
2488 * @E.g: iwpriv wlan0 txrx_stats 21 0
2489 * iwpriv wlan0 txrx_stats 21 1
2490 *
2491 * Usage: Internal
2492 *
2493 * </ioctl>
2494 */
2495#define WE_SET_TXRX_STATS 24
2496
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002497
2498#ifdef FEATURE_WLAN_TDLS
2499#undef MAX_VAR_ARGS
2500#define MAX_VAR_ARGS 11
2501#else
2502#undef MAX_VAR_ARGS
2503#define MAX_VAR_ARGS 9
2504#endif
2505
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002506/*
2507 * <ioctl>
2508 * fips_test - Perform a FIPS test
2509 *
2510 * @INPUT: Binary representation of the following packed structure
2511 *
2512 * @OUTPUT: Binary representation of the following packed structure
2513 *
2514 * This IOCTL is used to perform FIPS certification testing
2515 *
2516 * @E.g: iwpriv wlan0 fips_test <test vector>
2517 *
2518 * iwpriv wlan0 fips_test <tbd>
2519 *
2520 * Supported Feature: FIPS
2521 *
2522 * Usage: Internal
2523 *
2524 * </ioctl>
2525 */
2526#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2527
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002528/* Private ioctls (with no sub-ioctls) */
2529/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302530/*
2531 * <ioctl>
2532 * addTspec - Add TSPEC for each AC
2533 *
2534 * @INPUT: 19 TSPEC params
2535 * @[arg0]: handle
2536 * @[arg1]: tid
2537 * @[arg2]: dir
2538 * @[arg3]: psb
2539 * @[arg4]: up
2540 * @[arg5]: nomMsduSize
2541 * @[arg6]: maxMsduSize
2542 * @[arg7]: minDataRate
2543 * @[arg8]: meanDataRate
2544 * @[arg9]: peakDataRate
2545 * @[arg10]: maxBurstSize
2546 * @[arg11]: minPhyRate
2547 * @[arg12]: sba
2548 * @[arg13]: minServiceIntv
2549 * @[arg14]: suspendIntv
2550 * @[arg15]: burstSizeDefn
2551 * @[arg16]: ackPolicy
2552 * @[arg17]: inactivityPeriod
2553 * @[arg18]: maxServiceIntv
2554 *
2555 * @OUTPUT: Success/Failure
2556 *
2557 * This IOCTL is used to add TSPEC for each AC.
2558 *
2559 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2560 * <maxMsduSize> <minDataRate> <meanDataRate>
2561 * <peakDataRate> <maxBurstSize> <minPhyRate>
2562 * <sba> <minServiceIntv> <suspendIntv>
2563 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2564 * <maxServiceIntv>
2565 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2566 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2567 * wlan0 addTspec:3
2568 *
2569 * Supported Feature: WMM
2570 *
2571 * Usage: Internal/External
2572 *
2573 * </ioctl>
2574 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002575#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302576/*
2577 * <ioctl>
2578 * delTspec - Delete TSPEC entry for each AC
2579 *
2580 * @INPUT: 1 TSPEC param
2581 * @[arg0]: handle
2582 *
2583 * @OUTPUT: Success/Failure
2584 *
2585 * This IOCTL is used to delete TSPEC entry for each AC.
2586 *
2587 * @E.g: iwpriv wlan0 delTspec <handle>
2588 * iwpriv wlan0 delTspec 7001
2589 * wlan0 delTspec:16
2590 *
2591 * Supported Feature: WMM
2592 *
2593 * Usage: Internal/External
2594 *
2595 * </ioctl>
2596 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002597#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302598/*
2599 * <ioctl>
2600 * getTspec - Get TSPEC entry for each AC
2601 *
2602 * @INPUT: 1 TSPEC param
2603 * @[arg0]: handle
2604 *
2605 * @OUTPUT: Success/Failure
2606 *
2607 * This IOCTL is used to get TSPEC entry for each AC.
2608 *
2609 * @E.g: iwpriv wlan0 getTspec <handle>
2610 * iwpriv wlan0 getTspec 7001
2611 * wlan0 delTspec:18
2612 *
2613 * Supported Feature: WMM
2614 *
2615 * Usage: Internal/External
2616 *
2617 * </ioctl>
2618 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002619#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2620
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002621/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2622/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2623/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002624#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2625#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002626/* (SIOCIWFIRSTPRIV + 16) is currently unused */
2627/* (SIOCIWFIRSTPRIV + 17) is currently unused */
2628/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2629
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002630#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002631
2632/* Private ioctl for setting the host offload feature */
2633#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2634
2635/* Private ioctl to get the statistics */
2636#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2637
2638/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302639/*
2640 * <ioctl>
2641 * setKeepAlive - Set the keep alive feature
2642 *
2643 * @INPUT: 28 bytes of information in the order of packet type, time period
2644 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2645 *
2646 * @OUTPUT: None
2647 *
2648 * This IOCTL sets the keep alive feature to send either NULL
2649 * or unsolicited ARP response packets
2650 *
2651 * @E.g: iwpriv wlan0 setKeepAlive
2652 *
2653 * Supported Feature: STA
2654 *
2655 * Usage: Internal/External
2656 *
2657 * </ioctl>
2658 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002659#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2660
2661#ifdef WLAN_FEATURE_PACKET_FILTERING
2662/* Private ioctl to set the packet filtering params */
2663#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2664#endif
2665
2666
2667#ifdef FEATURE_WLAN_SCAN_PNO
2668/* Private ioctl to get the statistics */
2669#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2670#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302671/*
2672 * <ioctl>
2673 * SETBAND - Set the operational band
2674 *
2675 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2676 *
2677 * @OUTPUT: None
2678 *
2679 * This IOCTL Set the operational band If the new band is different from the
2680 * current operational band, it aborts the pending scan requests, flushes
2681 * the existing scan results, and then change * the band capability
2682 *
2683 * @E.g: iwpriv wlan0 SETBAND <value>
2684 *
2685 * Supported Feature: STA
2686 *
2687 * Usage: Internal/External
2688 *
2689 * </ioctl>
2690 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002691#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2692
Dustin Brown0cbc7572016-12-16 13:54:40 -08002693#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002694/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002695
2696/* Private ioctls and their sub-ioctls */
2697#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2698#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002699#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002700#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302701/* Private sub ioctl for enabling and setting histogram interval of profiling */
2702#define WE_ENABLE_FW_PROFILE 4
2703#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002704
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002705/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002706#define WE_SET_WLAN_SUSPEND 6
2707#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002708
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002709/*
2710 * <ioctl>
2711 * log_buffer - prints host/target related communication logs via dmesg
2712 *
2713 * @INPUT: Log Id, Count
2714 *
2715 * Log Id:
2716 * 0) HTC_CREDIT_HISTORY_LOG
2717 * 1) COMMAND_LOG,
2718 * 2) COMMAND_TX_CMP_LOG,
2719 * 3) MGMT_COMMAND_LOG,
2720 * 4) MGMT_COMMAND_TX_CMP_LOG,
2721 * 5) EVENT_LOG,
2722 * 6) RX_EVENT_LOG,
2723 * 7) MGMT_EVENT_LOG
2724 *
2725 * @OUTPUT: None
2726 *
2727 * @E.g:
2728 * # print up to 10 of the most recent records from HTC Credit History
2729 * iwpriv wlan0 log_buffer 0 10
2730 * # print up to 3 of the most recent records from Event Log
2731 * iwpriv wlan0 log_buffer 5 3
2732 *
2733 * Supported Feature: WLAN Trace
2734 *
2735 * Usage: Internal/External
2736 *
2737 * </ioctl>
2738 */
2739#define WE_LOG_BUFFER 8
2740
2741enum host_target_comm_log {
2742 HTC_CREDIT_HISTORY_LOG = 0,
2743 COMMAND_LOG,
2744 COMMAND_TX_CMP_LOG,
2745 MGMT_COMMAND_LOG,
2746 MGMT_COMMAND_TX_CMP_LOG,
2747 EVENT_LOG,
2748 RX_EVENT_LOG,
2749 MGMT_EVENT_LOG
2750};
2751
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002752/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2753
2754/* 802.11p IOCTL */
2755#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2756
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302757/*
2758 * <ioctl>
2759 * getLinkSpeed - Gets the current link speed in Mbps
2760 *
2761 * @INPUT: None
2762 *
2763 * @OUTPUT: linkspeed in mbps
2764 * wlan0 getLinkSpeed:7
2765 *
2766 * This IOCTL is used get the current link speed in Mbps
2767 *
2768 * @E.g: iwpriv wlan0 getLinkSpeed
2769 *
2770 * Supported Feature: STA
2771 *
2772 * Usage: Internal/External
2773 *
2774 * </ioctl>
2775 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002776#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2777
2778#define WLAN_STATS_INVALID 0
2779#define WLAN_STATS_RETRY_CNT 1
2780#define WLAN_STATS_MUL_RETRY_CNT 2
2781#define WLAN_STATS_TX_FRM_CNT 3
2782#define WLAN_STATS_RX_FRM_CNT 4
2783#define WLAN_STATS_FRM_DUP_CNT 5
2784#define WLAN_STATS_FAIL_CNT 6
2785#define WLAN_STATS_RTS_FAIL_CNT 7
2786#define WLAN_STATS_ACK_FAIL_CNT 8
2787#define WLAN_STATS_RTS_SUC_CNT 9
2788#define WLAN_STATS_RX_DISCARD_CNT 10
2789#define WLAN_STATS_RX_ERROR_CNT 11
2790#define WLAN_STATS_TX_BYTE_CNT 12
2791
2792#define WLAN_STATS_RX_BYTE_CNT 13
2793#define WLAN_STATS_RX_RATE 14
2794#define WLAN_STATS_TX_RATE 15
2795
2796#define WLAN_STATS_RX_UC_BYTE_CNT 16
2797#define WLAN_STATS_RX_MC_BYTE_CNT 17
2798#define WLAN_STATS_RX_BC_BYTE_CNT 18
2799#define WLAN_STATS_TX_UC_BYTE_CNT 19
2800#define WLAN_STATS_TX_MC_BYTE_CNT 20
2801#define WLAN_STATS_TX_BC_BYTE_CNT 21
2802
2803#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2804 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2805 *__p++ = __type; \
2806 *__p++ = __size; \
2807 memcpy(__p, __val, __size); \
2808 __p += __size; \
2809 __tlen += __size + 2; \
2810 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002811 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002812 } \
2813 } while (0)
2814
2815#define VERSION_VALUE_MAX_LEN 32
2816
2817#define TX_PER_TRACKING_DEFAULT_RATIO 5
2818#define TX_PER_TRACKING_MAX_RATIO 10
2819#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2820
2821#define WLAN_ADAPTER 0
2822#define P2P_ADAPTER 1
2823
2824/**
2825 * mem_alloc_copy_from_user_helper - copy from user helper
2826 * @wrqu_data: wireless extensions request data
2827 * @len: length of @wrqu_data
2828 *
2829 * Helper function to allocate buffer and copy user data.
2830 *
2831 * Return: On success return a pointer to a kernel buffer containing a
2832 * copy of the userspace data (with an additional NUL character
2833 * appended for safety). On failure return %NULL.
2834 */
2835void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2836{
2837 u8 *ptr = NULL;
2838
2839 /* in order to protect the code, an extra byte is post
2840 * appended to the buffer and the null termination is added.
2841 * However, when allocating (len+1) byte of memory, we need to
2842 * make sure that there is no uint overflow when doing
2843 * addition. In theory check len < UINT_MAX protects the uint
2844 * overflow. For wlan private ioctl, the buffer size is much
2845 * less than UINT_MAX, as a good guess, now, it is assumed
2846 * that the private command buffer size is no greater than 4K
2847 * (4096 bytes). So we use 4096 as the upper boundary for now.
2848 */
2849 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002850 hdd_err("Invalid length: %zu max: %u",
2851 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002852 return NULL;
2853 }
2854
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002855 ptr = qdf_mem_malloc(len + 1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002856 if (NULL == ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002857 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002858 return NULL;
2859 }
2860
2861 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002862 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002863 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002864 return NULL;
2865 }
2866 ptr[len] = '\0';
2867 return ptr;
2868}
2869
2870/**
2871 * hdd_priv_get_data() - Get pointer to ioctl private data
2872 * @p_priv_data: pointer to iw_point struct to be filled
2873 * @wrqu: Pointer to IOCTL Data received from userspace
2874 *
2875 * Helper function to get compatible struct iw_point passed to ioctl
2876 *
2877 * Return - 0 if p_priv_data successfully filled, error otherwise
2878 */
2879int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
2880{
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002881 if ((NULL == p_priv_data) || (NULL == wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002882 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002883
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002884#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07002885 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002886 struct compat_iw_point *p_compat_priv_data;
2887
2888 /* Compat task:
2889 * typecast to compat structure and copy the members.
2890 */
2891 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
2892
2893 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
2894 p_priv_data->length = p_compat_priv_data->length;
2895 p_priv_data->flags = p_compat_priv_data->flags;
2896 } else {
2897#endif /* #ifdef CONFIG_COMPAT */
2898
2899 /* Non compat task: directly copy the structure. */
2900 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
2901
2902#ifdef CONFIG_COMPAT
2903 }
2904#endif /* #ifdef CONFIG_COMPAT */
2905
2906 return 0;
2907}
2908
Jeff Johnson441e1f72017-02-07 08:50:49 -08002909static int hdd_check_wext_control(enum hdd_wext_control wext_control,
2910 struct iw_request_info *info)
2911{
2912 switch (wext_control) {
2913 default:
2914 case hdd_wext_disabled:
2915 hdd_err("Rejecting disabled ioctl %x", info->cmd);
2916 return -ENOTSUPP;
2917 case hdd_wext_deprecated:
2918 hdd_warn("Using deprecated ioctl %x", info->cmd);
2919 return 0;
2920 case hdd_wext_enabled:
2921 return 0;
2922 }
2923}
2924
Jeff Johnson82797b62017-08-11 15:31:27 -07002925int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08002926 struct iw_request_info *info)
2927{
2928 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
2929 info);
2930}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002931
2932/**
2933 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07002934 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002935 * @length: Size of the data copied
2936 * @buffer: Pointer to char buffer.
2937 * @buf_len: Length of the char buffer.
2938 *
2939 * This function called when the "iwpriv wlan0 get_stats" command is given.
2940 * It used to collect the txrx stats when the device is configured in SAP mode.
2941 *
2942 * Return - none
2943 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07002944void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002945 char *buffer, uint16_t buf_len)
2946{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002947 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002948 uint32_t len = 0;
2949 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
2950 uint32_t total_rx_delv = 0, total_rx_refused = 0;
2951 int i = 0;
2952
2953 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002954 total_rx_pkt += stats->rx_packets[i];
2955 total_rx_dropped += stats->rx_dropped[i];
2956 total_rx_delv += stats->rx_delivered[i];
2957 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002958 }
2959
2960 len = scnprintf(buffer, buf_len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002961 "\nTransmit[%lu] - "
Mohit Khannad0b63f52017-02-18 18:05:52 -08002962 "called %u, dropped %u orphan %u,"
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002963 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
2964 "\n[classified] BK %u, BE %u, VI %u, VO %u"
2965 "\n\nReceive[%lu] - "
2966 "packets %u, dropped %u, delivered %u, refused %u"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002967 "\n",
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002968 qdf_system_ticks(),
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002969 stats->tx_called,
2970 stats->tx_dropped,
2971 stats->tx_orphaned,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002972
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002973 stats->tx_dropped_ac[SME_AC_BK],
2974 stats->tx_dropped_ac[SME_AC_BE],
2975 stats->tx_dropped_ac[SME_AC_VI],
2976 stats->tx_dropped_ac[SME_AC_VO],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002977
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002978 stats->tx_classified_ac[SME_AC_BK],
2979 stats->tx_classified_ac[SME_AC_BE],
2980 stats->tx_classified_ac[SME_AC_VI],
2981 stats->tx_classified_ac[SME_AC_VO],
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002982 qdf_system_ticks(),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002983 total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused
2984 );
2985
2986 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002987 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002988 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002989 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002990 "Rx CPU[%d]:"
2991 "packets %u, dropped %u, delivered %u, refused %u\n",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07002992 i, stats->rx_packets[i], stats->rx_dropped[i],
2993 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002994 }
2995
2996 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002997 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002998 "\nCurrent status: %s"
2999 "\ntx-flow timer start count %u"
3000 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003001 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3002 stats->txflow_timer_cnt,
3003 stats->txflow_pause_cnt,
3004 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003005
Leo Changfdb45c32016-10-28 11:09:23 -07003006 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnson1b780e42017-10-31 14:11:45 -07003007 adapter->session_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003008 *length = len + 1;
3009}
3010
3011/**
Dustin Brownd9322482017-01-09 12:46:03 -08003012 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3013 * @hdd_ctx: The Hdd context owning the stats to be written
3014 * @buffer: The char buffer to write to
3015 * @max_len: The maximum number of chars to write
3016 *
3017 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3018 *
3019 * Return - length of written content, negative number on error
3020 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003021#ifdef QCA_SUPPORT_CP_STATS
3022static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
3023 char *buffer, uint16_t max_len)
3024{
3025 int ret;
3026 QDF_STATUS status;
3027 struct suspend_resume_stats *sr_stats;
3028
3029 sr_stats = &hdd_ctx->suspend_resume_stats;
3030 ret = scnprintf(buffer, max_len,
3031 "\n"
3032 "Suspends: %u\n"
3033 "Resumes: %u\n"
3034 "\n"
3035 "Suspend Fail Reasons\n"
3036 "\tIPA: %u\n"
3037 "\tRadar: %u\n"
3038 "\tRoam: %u\n"
3039 "\tScan: %u\n"
3040 "\tInitial Wakeup: %u\n"
3041 "\n",
3042 sr_stats->suspends, sr_stats->resumes,
3043 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3044 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3045 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3046 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3047 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]);
3048
3049 status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->hdd_psoc,
3050 &buffer[ret], max_len - ret,
3051 &ret);
3052 if (QDF_IS_STATUS_ERROR(status)) {
3053 hdd_err("Failed to get WoW stats");
3054 return qdf_status_to_os_return(status);
3055 }
3056
3057 return ret;
3058}
3059#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003060static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
Dustin Brownd9322482017-01-09 12:46:03 -08003061 char *buffer, uint16_t max_len)
3062{
3063 QDF_STATUS status;
3064 struct suspend_resume_stats *sr_stats;
3065 struct sir_wake_lock_stats wow_stats;
3066
3067 sr_stats = &hdd_ctx->suspend_resume_stats;
3068
3069 status = wma_get_wakelock_stats(&wow_stats);
3070 if (QDF_IS_STATUS_ERROR(status)) {
3071 hdd_err("Failed to get WoW stats");
3072 return qdf_status_to_os_return(status);
3073 }
3074
3075 return scnprintf(buffer, max_len,
3076 "\n"
3077 "Suspends: %u\n"
3078 "Resumes: %u\n"
3079 "\n"
3080 "Suspend Fail Reasons\n"
3081 "\tIPA: %u\n"
3082 "\tRadar: %u\n"
3083 "\tRoam: %u\n"
3084 "\tScan: %u\n"
3085 "\tInitial Wakeup: %u\n"
3086 "\n"
3087 "WoW Wake Reasons\n"
3088 "\tunicast: %u\n"
3089 "\tbroadcast: %u\n"
3090 "\tIPv4 multicast: %u\n"
3091 "\tIPv6 multicast: %u\n"
3092 "\tIPv6 multicast RA: %u\n"
3093 "\tIPv6 multicast NS: %u\n"
3094 "\tIPv6 multicast NA: %u\n"
3095 "\tICMPv4: %u\n"
3096 "\tICMPv6: %u\n"
3097 "\tRSSI Breach: %u\n"
3098 "\tLow RSSI: %u\n"
3099 "\tG-Scan: %u\n"
3100 "\tPNO Complete: %u\n"
3101 "\tPNO Match: %u\n",
3102 sr_stats->suspends,
3103 sr_stats->resumes,
3104 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3105 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3106 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3107 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3108 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP],
3109 wow_stats.wow_ucast_wake_up_count,
3110 wow_stats.wow_bcast_wake_up_count,
3111 wow_stats.wow_ipv4_mcast_wake_up_count,
3112 wow_stats.wow_ipv6_mcast_wake_up_count,
3113 wow_stats.wow_ipv6_mcast_ra_stats,
3114 wow_stats.wow_ipv6_mcast_ns_stats,
3115 wow_stats.wow_ipv6_mcast_na_stats,
3116 wow_stats.wow_icmpv4_count,
3117 wow_stats.wow_icmpv6_count,
3118 wow_stats.wow_rssi_breach_wake_up_count,
3119 wow_stats.wow_low_rssi_wake_up_count,
3120 wow_stats.wow_gscan_wake_up_count,
3121 wow_stats.wow_pno_complete_wake_up_count,
3122 wow_stats.wow_pno_match_wake_up_count);
3123}
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003124#endif
Dustin Brownd9322482017-01-09 12:46:03 -08003125/**
Govind Singha471e5e2015-10-12 17:11:14 +05303126 * hdd_wlan_list_fw_profile() - Get fw profiling points
3127 * @length: Size of the data copied
3128 * @buffer: Pointer to char buffer.
3129 * @buf_len: Length of the char buffer.
3130 *
3131 * This function called when the "iwpriv wlan0 listProfile" command is given.
3132 * It is used to get the supported profiling points in FW.
3133 *
3134 * Return - none
3135 */
3136void hdd_wlan_list_fw_profile(uint16_t *length,
3137 char *buffer, uint16_t buf_len)
3138{
3139 uint32_t len = 0;
3140
3141 len = scnprintf(buffer, buf_len,
3142 "PROF_CPU_IDLE: %u\n"
3143 "PROF_PPDU_PROC: %u\n"
3144 "PROF_PPDU_POST: %u\n"
3145 "PROF_HTT_TX_INPUT: %u\n"
3146 "PROF_MSDU_ENQ: %u\n"
3147 "PROF_PPDU_POST_HAL: %u\n"
3148 "PROF_COMPUTE_TX_TIME: %u\n",
3149 PROF_CPU_IDLE,
3150 PROF_PPDU_PROC,
3151 PROF_PPDU_POST,
3152 PROF_HTT_TX_INPUT,
3153 PROF_MSDU_ENQ,
3154 PROF_PPDU_POST_HAL,
3155 PROF_COMPUTE_TX_TIME);
3156
3157 *length = len + 1;
3158}
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003159/**
3160 * hdd_display_stats_help() - print statistics help
3161 *
3162 * Return: none
3163 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003164static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003165{
3166 hdd_err("iwpriv wlan0 dumpStats [option] - dump statistics");
3167 hdd_err("iwpriv wlan0 clearStats [option] - clear statistics");
3168 hdd_err("options:");
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003169 hdd_err(" 1 -- TXRX PATH statistics");
3170 hdd_err(" 2 -- TXRX HIST statistics");
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003171 hdd_err(" 3 -- TSO statistics");
3172 hdd_err(" 4 -- Network queue statistics");
3173 hdd_err(" 5 -- Flow control statistics");
3174 hdd_err(" 6 -- Per Layer statistics");
3175 hdd_err(" 7 -- Copy engine interrupt statistics");
3176 hdd_err(" 8 -- LRO statistics");
3177 hdd_err(" 9 -- NAPI statistics");
3178}
Govind Singha471e5e2015-10-12 17:11:14 +05303179
3180/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003181 * hdd_wlan_dump_stats() - display dump Stats
3182 * @adapter: adapter handle
3183 * @value: value from user
3184 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003185 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003186 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003187int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003188{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003189 int ret = 0;
3190 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003191 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003192
3193 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003194 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003195 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3196 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003197 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003198 wlan_hdd_display_netif_queue_history
3199 (hdd_ctx,
3200 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003201 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003202 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303203 hdd_display_hif_stats();
3204 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003205 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003206 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303207 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003208 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003209 if (hdd_display_napi_stats()) {
3210 hdd_err("error displaying napi stats");
3211 ret = EFAULT;
3212 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003213 break;
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303214 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003215 sme_display_disconnect_stats(hdd_ctx->mac_handle,
3216 adapter->session_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303217 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003218 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003219 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003220 value,
3221 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003222 if (status == QDF_STATUS_E_INVAL) {
3223 hdd_display_stats_help();
3224 ret = EINVAL;
3225 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003226 break;
3227 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003228 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003229}
3230
3231/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003232 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003233 * @adapter: Adapter upon which the IBSS client is active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003234 * @staIdx: Station index of the IBSS peer
3235 *
3236 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3237 * otherwise an appropriate QDF_STATUS_E_* failure code.
3238 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003239static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnsonaf2a0932016-10-05 14:52:57 -07003240 uint8_t staIdx)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003241{
3242 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003243 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003244 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003245 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003246
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003247 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003248 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003249 hdd_get_ibss_peer_info_cb,
3250 false, staIdx);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003251
3252 if (QDF_STATUS_SUCCESS == status) {
3253 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003254
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003255 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003256 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003257 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3258 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003259 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003260 return QDF_STATUS_E_FAILURE;
3261 }
3262
3263 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003264 hdd_debug("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003265 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003266 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3267 uint32_t tx_rate = pPeerInfo->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003268
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003269 qdf_mem_copy(mac_addr, pPeerInfo->peerInfoParams[0].
3270 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003271 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003272 mac_addr, (int)tx_rate,
3273 (int)pPeerInfo->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003274 }
3275 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003276 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003277 }
3278
3279 return status;
3280}
3281
3282/**
3283 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003284 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003285 *
3286 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3287 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3288 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003289static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003290{
3291 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003292 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003293 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003294 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003295 int i;
3296
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003297 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003298 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003299 hdd_get_ibss_peer_info_cb,
3300 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003301
3302 if (QDF_STATUS_SUCCESS == status) {
3303 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003304
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003305 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003306 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003307 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3308 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003309 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003310 return QDF_STATUS_E_FAILURE;
3311 }
3312
3313 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003314 hdd_debug("pPeerInfo->numIBSSPeers = %d ",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003315 (int)pPeerInfo->numPeers);
3316 for (i = 0; i < pPeerInfo->numPeers; i++) {
3317 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3318 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003319
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003320 tx_rate = pPeerInfo->peerInfoParams[i].txRate;
3321 qdf_mem_copy(mac_addr,
3322 pPeerInfo->peerInfoParams[i].mac_addr,
3323 sizeof(mac_addr));
3324
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003325 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003326 mac_addr, (int)tx_rate,
3327 (int)pPeerInfo->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003328 }
3329 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003330 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003331 }
3332
3333 return status;
3334}
3335
3336/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303337 * hdd_get_ldpc() - Get adapter LDPC
3338 * @adapter: adapter being queried
3339 * @value: where to store the value
3340 *
3341 * Return: 0 on success, negative errno on failure
3342 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003343int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303344{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003345 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303346 int ret;
3347
Dustin Brown491d54b2018-03-14 12:39:11 -07003348 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003349 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303350 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3351 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003352 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303353 } else {
3354 *value = ret;
3355 ret = 0;
3356 }
3357 return ret;
3358}
3359
3360/**
3361 * hdd_set_ldpc() - Set adapter LDPC
3362 * @adapter: adapter being modified
3363 * @value: new LDPC value
3364 *
3365 * Return: 0 on success, negative errno on failure
3366 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003367int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303368{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003369 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303370 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003371 QDF_STATUS status;
3372 uint32_t cfg_value;
3373 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3374 struct hdd_config *config = hdd_ctx->config;
3375 union {
3376 uint16_t cfg_value16;
3377 tSirMacHTCapabilityInfo ht_cap_info;
3378 } u;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303379
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003380 hdd_debug("%d", value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303381 if (value) {
3382 /* make sure HT capabilities allow this */
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003383 if (!config->enable_rx_ldpc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003384 hdd_err("LDCP not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303385 return -EINVAL;
3386 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003387 } else if (!config->enable_rx_ldpc) {
3388 hdd_err("LDCP is already disabled");
3389 return 0;
3390 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003391 status = sme_cfg_get_int(mac_handle, WNI_CFG_HT_CAP_INFO, &cfg_value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003392 if (QDF_STATUS_SUCCESS != status) {
3393 hdd_err("Failed to get HT capability info");
3394 return -EIO;
3395 }
3396 u.cfg_value16 = cfg_value & 0xFFFF;
3397
3398 u.ht_cap_info.advCodingCap = value;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003399 status = sme_cfg_set_int(mac_handle, WNI_CFG_HT_CAP_INFO,
3400 u.cfg_value16);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003401 if (QDF_STATUS_SUCCESS != status) {
3402 hdd_err("Failed to set HT capability info");
3403 return -EIO;
3404 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003405 status = sme_cfg_set_int(mac_handle, WNI_CFG_VHT_LDPC_CODING_CAP,
3406 value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003407 if (QDF_STATUS_SUCCESS != status) {
3408 hdd_err("Failed to set VHT LDPC capability info");
3409 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303410 }
3411
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003412 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303413 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
3414 value);
3415 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003416 hdd_err("Failed to set LDPC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003417 ret = sme_update_he_ldpc_supp(mac_handle, adapter->session_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003418 if (ret)
3419 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303420
3421 return ret;
3422}
3423
3424/**
3425 * hdd_get_tx_stbc() - Get adapter TX STBC
3426 * @adapter: adapter being queried
3427 * @value: where to store the value
3428 *
3429 * Return: 0 on success, negative errno on failure
3430 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003431int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303432{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003433 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303434 int ret;
3435
Dustin Brown491d54b2018-03-14 12:39:11 -07003436 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003437 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303438 WNI_CFG_HT_CAP_INFO_TX_STBC);
3439 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003440 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303441 } else {
3442 *value = ret;
3443 ret = 0;
3444 }
3445
3446 return ret;
3447}
3448
3449/**
3450 * hdd_set_tx_stbc() - Set adapter TX STBC
3451 * @adapter: adapter being modified
3452 * @value: new TX STBC value
3453 *
3454 * Return: 0 on success, negative errno on failure
3455 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003456int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303457{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003458 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303459 int ret;
3460
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003461 hdd_debug("%d", value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303462 if (value) {
3463 /* make sure HT capabilities allow this */
3464 QDF_STATUS status;
3465 uint32_t cfg_value;
3466 union {
3467 uint16_t cfg_value16;
3468 tSirMacHTCapabilityInfo ht_cap_info;
3469 } u;
3470
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003471 status = sme_cfg_get_int(mac_handle, WNI_CFG_HT_CAP_INFO,
3472 &cfg_value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303473 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003474 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303475 return -EIO;
3476 }
3477 u.cfg_value16 = cfg_value & 0xFFFF;
3478 if (!u.ht_cap_info.txSTBC) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003479 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303480 return -EINVAL;
3481 }
3482 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003483 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303484 WNI_CFG_HT_CAP_INFO_TX_STBC,
3485 value);
3486 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003487 hdd_err("Failed to set TX STBC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003488 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003489 if (ret)
3490 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303491
3492 return ret;
3493}
3494
3495/**
3496 * hdd_get_rx_stbc() - Get adapter RX STBC
3497 * @adapter: adapter being queried
3498 * @value: where to store the value
3499 *
3500 * Return: 0 on success, negative errno on failure
3501 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003502int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303503{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003504 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303505 int ret;
3506
Dustin Brown491d54b2018-03-14 12:39:11 -07003507 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003508 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303509 WNI_CFG_HT_CAP_INFO_RX_STBC);
3510 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003511 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303512 } else {
3513 *value = ret;
3514 ret = 0;
3515 }
3516
3517 return ret;
3518}
3519
3520/**
3521 * hdd_set_rx_stbc() - Set adapter RX STBC
3522 * @adapter: adapter being modified
3523 * @value: new RX STBC value
3524 *
3525 * Return: 0 on success, negative errno on failure
3526 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003527int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303528{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003529 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303530 int ret;
3531
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003532 hdd_debug("%d", value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303533 if (value) {
3534 /* make sure HT capabilities allow this */
3535 QDF_STATUS status;
3536 uint32_t cfg_value;
3537 union {
3538 uint16_t cfg_value16;
3539 tSirMacHTCapabilityInfo ht_cap_info;
3540 } u;
3541
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003542 status = sme_cfg_get_int(mac_handle, WNI_CFG_HT_CAP_INFO,
3543 &cfg_value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303544 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003545 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303546 return -EIO;
3547 }
3548 u.cfg_value16 = cfg_value & 0xFFFF;
3549 if (!u.ht_cap_info.rxSTBC) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003550 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303551 return -EINVAL;
3552 }
3553 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003554 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303555 WNI_CFG_HT_CAP_INFO_RX_STBC,
3556 value);
3557 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003558 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303559
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003560 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003561 if (ret)
3562 hdd_err("Failed to set HE RX STBC value");
3563
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303564 return ret;
3565}
3566
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08003567int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate)
3568{
3569 int set_value;
3570
3571 if (sme_is_feature_supported_by_fw(DOT11AX))
3572 set_value = WMI_ASSEMBLE_RATECODE_V1(rate, nss, preamble);
3573 else
3574 set_value = (preamble << 6) | (nss << 4) | rate;
3575
3576 return set_value;
3577}
3578
Jeff Johnson3d278b02017-08-29 14:17:47 -07003579int hdd_set_11ax_rate(struct hdd_adapter *adapter, int set_value,
Jeff Johnsone4c11db2018-05-05 23:22:32 -07003580 struct sap_config *sap_config)
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08003581{
3582 uint8_t preamble = 0, nss = 0, rix = 0;
3583 int ret;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003584 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08003585
3586 if (!sap_config) {
3587 if (!sme_is_feature_supported_by_fw(DOT11AX)) {
3588 hdd_err("Target does not support 11ax");
3589 return -EIO;
3590 }
3591 } else if (sap_config->SapHw_mode != eCSR_DOT11_MODE_11ax &&
3592 sap_config->SapHw_mode != eCSR_DOT11_MODE_11ax_ONLY) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07003593 hdd_err("Invalid hw mode, SAP hw_mode= 0x%x, ch = %d",
3594 sap_config->SapHw_mode, sap_config->channel);
3595 return -EIO;
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08003596 }
3597
3598 if (set_value != 0xff) {
3599 rix = RC_2_RATE_IDX_11AX(set_value);
3600 preamble = WMI_RATE_PREAMBLE_HE;
3601 nss = HT_RC_2_STREAMS_11AX(set_value);
3602
3603 set_value = hdd_assemble_rate_code(preamble, nss, rix);
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08003604 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003605 ret = sme_set_auto_rate_he_ltf(mac_handle, adapter->session_id,
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08003606 QCA_WLAN_HE_LTF_AUTO);
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08003607 }
3608
Dustin Brown5e89ef82018-03-14 11:50:23 -07003609 hdd_info("SET_11AX_RATE val %d rix %d preamble %x nss %d",
3610 set_value, rix, preamble, nss);
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08003611
Jeff Johnson1b780e42017-10-31 14:11:45 -07003612 ret = wma_cli_set_command(adapter->session_id,
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08003613 WMI_VDEV_PARAM_FIXED_RATE,
3614 set_value, VDEV_CMD);
3615
3616 return ret;
3617}
3618
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303619/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003620 * iw_get_linkspeed() - Get current link speed ioctl
3621 * @dev: device upon which the ioctl was received
3622 * @info: ioctl request information
3623 * @wrqu: ioctl request data
3624 * @extra: extra ioctl buffer
3625 *
3626 * Return: 0 on success, non-zero on error
3627 */
3628static int __iw_get_linkspeed(struct net_device *dev,
3629 struct iw_request_info *info,
3630 union iwreq_data *wrqu, char *extra)
3631{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003632 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003633 char *pLinkSpeed = (char *)extra;
3634 int len = sizeof(uint32_t) + 1;
3635 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003636 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003637 int ret;
3638 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003639
Dustin Brownfdf17c12018-03-14 12:55:34 -07003640 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303641
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003642 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003643 ret = wlan_hdd_validate_context(hdd_ctx);
3644 if (0 != ret)
3645 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003646
Jeff Johnson441e1f72017-02-07 08:50:49 -08003647 ret = hdd_check_private_wext_control(hdd_ctx, info);
3648 if (0 != ret)
3649 return ret;
3650
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003651 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003652 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003653 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003654
3655 wrqu->data.length = len;
3656 /* return the linkspeed as a string */
3657 rc = snprintf(pLinkSpeed, len, "%u", link_speed);
3658 if ((rc < 0) || (rc >= len)) {
3659 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003660 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003661 return -EIO;
3662 }
3663
Dustin Browne74003f2018-03-14 12:51:58 -07003664 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003665 /* a value is being successfully returned */
3666 return 0;
3667}
3668
3669static int iw_get_linkspeed(struct net_device *dev,
3670 struct iw_request_info *info,
3671 union iwreq_data *wrqu, char *extra)
3672{
3673 int ret;
3674
3675 cds_ssr_protect(__func__);
3676 ret = __iw_get_linkspeed(dev, info, wrqu, extra);
3677 cds_ssr_unprotect(__func__);
3678
3679 return ret;
3680}
3681
3682/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003683 * wlan_hdd_update_phymode() - handle change in PHY mode
3684 * @net: device upon which PHY mode change was received
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003685 * @mac_handle: umac handle for the driver
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003686 * @new_phymode: new PHY mode for the device
3687 * @phddctx: pointer to the HDD context
3688 *
3689 * This function is called when the device is set to a new PHY mode.
3690 * It takes a holistic look at the desired PHY mode along with the
3691 * configured capabilities of the driver and the reported capabilities
3692 * of the hardware in order to correctly configure all PHY-related
3693 * parameters.
3694 *
3695 * Return: 0 on success, negative errno value on error
3696 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003697int wlan_hdd_update_phymode(struct net_device *net, mac_handle_t mac_handle,
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003698 int new_phymode, struct hdd_context *phddctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003699{
3700#ifdef QCA_HT_2040_COEX
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003701 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303702 QDF_STATUS halStatus = QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003703#endif
3704 bool band_24 = false, band_5g = false;
3705 bool ch_bond24 = false, ch_bond5g = false;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303706 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003707 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003708 uint32_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003709 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07003710 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003711 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303712 int retval = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003713
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003714 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003715
3716 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
3717 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
3718 nChannelBondingMode24GHz))
3719 ch_bond24 = true;
3720
3721 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
3722 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
3723 nChannelBondingMode5GHz))
3724 ch_bond5g = true;
3725
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003726 if (phddctx->config->nBandCapability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003727 band_24 = band_5g = true;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003728 else if (phddctx->config->nBandCapability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003729 band_24 = true;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003730 else if (phddctx->config->nBandCapability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003731 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003732
3733 vhtchanwidth = phddctx->config->vhtChannelWidth;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003734 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 -08003735 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3736
3737 switch (new_phymode) {
3738 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003739 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003740 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003741 phymode = eCSR_DOT11_MODE_AUTO;
3742 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3743 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003744 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003745 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3746 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003747 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003748 return -EIO;
3749 }
3750 break;
3751 case IEEE80211_MODE_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003752 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003753 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003754 phymode = eCSR_DOT11_MODE_11a;
3755 hdd_dot11mode = eHDD_DOT11_MODE_11a;
3756 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003757 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003758 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003759 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003760 return -EIO;
3761 }
3762 break;
3763 case IEEE80211_MODE_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003764 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003765 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003766 phymode = eCSR_DOT11_MODE_11b;
3767 hdd_dot11mode = eHDD_DOT11_MODE_11b;
3768 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003769 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003770 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003771 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003772 return -EIO;
3773 }
3774 break;
3775 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003776 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003777 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003778 phymode = eCSR_DOT11_MODE_11g;
3779 hdd_dot11mode = eHDD_DOT11_MODE_11g;
3780 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003781 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003782 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003783 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003784 return -EIO;
3785 }
3786 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07003787 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003788 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
3789 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
3790 */
3791 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003792 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003793 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003794 phymode = eCSR_DOT11_MODE_11n;
3795 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3796 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003797 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003798 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003799 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003800 return -EIO;
3801 }
3802 break;
3803 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003804 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003805 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003806 phymode = eCSR_DOT11_MODE_11n;
3807 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3808 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003809 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003810 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003811 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003812 return -EIO;
3813 }
3814 break;
3815 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003816 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003817 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003818 phymode = eCSR_DOT11_MODE_11n;
3819 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3820 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003821 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003822 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003823 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003824 return -EIO;
3825 }
3826 break;
3827 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003828 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003829 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003830 phymode = eCSR_DOT11_MODE_11n;
3831 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3832 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003833 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003834 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003835 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003836 return -EIO;
3837 }
3838 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003839 case IEEE80211_MODE_11AC_VHT20:
3840 case IEEE80211_MODE_11AC_VHT40:
3841 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003842 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003843 phymode = eCSR_DOT11_MODE_11ac;
3844 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
3845 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3846 if (band_5g && band_24) {
3847 curr_band = BAND_ALL;
3848 break;
3849 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003850 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003851 break;
3852 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
3853 curr_band = BAND_2G;
3854 break;
3855 }
3856 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
3857 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003858 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003859 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003860 return -EIO;
3861 }
3862 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003863 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003864 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003865 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003866 phymode = eCSR_DOT11_MODE_AUTO;
3867 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3868 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003869 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003870 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003871 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003872 return -EIO;
3873 }
3874 break;
3875 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003876 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003877 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003878 phymode = eCSR_DOT11_MODE_AUTO;
3879 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3880 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3881 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003882 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003883 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003884 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003885 return -EIO;
3886 }
3887 break;
3888 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003889 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003890 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003891 phymode = eCSR_DOT11_MODE_11n;
3892 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3893 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003894 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003895 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003896 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003897 return -EIO;
3898 }
3899 break;
3900 default:
3901 return -EIO;
3902 }
3903
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003904 switch (new_phymode) {
3905 case IEEE80211_MODE_11AC_VHT20:
3906 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3907 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
3908 break;
3909 case IEEE80211_MODE_11AC_VHT40:
3910 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
3911 break;
3912 case IEEE80211_MODE_11AC_VHT80:
3913 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3914 break;
3915 default:
3916 vhtchanwidth = phddctx->config->vhtChannelWidth;
3917 break;
3918 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003919
3920 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303921 sme_config = qdf_mem_malloc(sizeof(*sme_config));
3922 if (!sme_config) {
3923 hdd_err("Failed to allocate memory for sme_config");
3924 return -ENOMEM;
3925 }
3926 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003927 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303928 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003929#ifdef QCA_HT_2040_COEX
3930 if (phymode == eCSR_DOT11_MODE_11n &&
3931 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303932 sme_config->csrConfig.obssEnabled = false;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003933 halStatus = sme_set_ht2040_mode(mac_handle,
Jeff Johnson1b780e42017-10-31 14:11:45 -07003934 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003935 eHT_CHAN_HT20, false);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303936 if (halStatus == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003937 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303938 retval = -EIO;
3939 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003940 }
3941 } else if (phymode == eCSR_DOT11_MODE_11n &&
3942 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303943 sme_config->csrConfig.obssEnabled = true;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003944 halStatus = sme_set_ht2040_mode(mac_handle,
Jeff Johnson1b780e42017-10-31 14:11:45 -07003945 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003946 eHT_CHAN_HT20, true);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303947 if (halStatus == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003948 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303949 retval = -EIO;
3950 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003951 }
3952 }
3953#endif
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303954 sme_config->csrConfig.eBand = curr_band;
3955 sme_config->csrConfig.bandCapability = curr_band;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003956 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303957 sme_config->csrConfig.Is11hSupportEnabled = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003958 else
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303959 sme_config->csrConfig.Is11hSupportEnabled =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003960 phddctx->config->Is11hSupportEnabled;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003961 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303962 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07003963 else if (curr_band == BAND_5G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303964 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003965 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303966 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
3967 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003968 }
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303969 sme_config->csrConfig.nVhtChannelWidth = vhtchanwidth;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003970 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003971
3972 phddctx->config->dot11Mode = hdd_dot11mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003973 phddctx->config->nChannelBondingMode24GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303974 sme_config->csrConfig.channelBondingMode24GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003975 phddctx->config->nChannelBondingMode5GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303976 sme_config->csrConfig.channelBondingMode5GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003977 phddctx->config->vhtChannelWidth = vhtchanwidth;
Krunal Sonidf0f8742016-09-26 14:56:31 -07003978 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003979 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303980 retval = -EIO;
3981 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003982 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05303983
3984 if (band_5g) {
3985 struct ieee80211_supported_band *band;
3986
3987 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
3988 if (phddctx->config->nChannelBondingMode5GHz)
3989 band->ht_cap.cap |=
3990 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3991 else
3992 band->ht_cap.cap &=
3993 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3994 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003995
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003996 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003997 phymode, chwidth, curr_band, vhtchanwidth);
3998 }
3999
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304000free:
4001 if (sme_config)
4002 qdf_mem_free(sme_config);
4003 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004004}
4005
Jeff Johnson011c4502017-10-05 15:25:56 -07004006static int hdd_validate_pdev_reset(int value)
4007{
4008 if ((value < 1) || (value > 5)) {
4009 hdd_warn(" Invalid value %d: Use any one of the below values\n"
4010 " TX_FLUSH = 1\n"
4011 " WARM_RESET = 2\n"
4012 " COLD_RESET = 3\n"
4013 " WARM_RESET_RESTORE_CAL = 4\n"
4014 " COLD_RESET_RESTORE_CAL = 5", value);
4015
4016 return -EINVAL;
4017 }
4018
4019 return 0;
4020}
4021
4022static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
4023{
4024 int ret;
4025
4026 hdd_debug("%d", value);
4027
4028 ret = hdd_validate_pdev_reset(value);
4029 if (ret)
4030 return ret;
4031
Jeff Johnson1b780e42017-10-31 14:11:45 -07004032 ret = wma_cli_set_command(adapter->session_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07004033 WMI_PDEV_PARAM_PDEV_RESET,
4034 value, PDEV_CMD);
4035
4036 return ret;
4037}
4038
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004039static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
4040{
4041 int errno;
4042 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4043 ePhyChanBondState bonding_state;
4044 uint32_t bonding_mode;
4045 tSmeConfigParams *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004046 mac_handle_t mac_handle;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004047
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004048 mac_handle = hdd_ctx->mac_handle;
4049 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004050 return -EINVAL;
4051
4052 /* updating channel bonding only on 5Ghz */
4053 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4054
4055 switch (ch_width) {
4056 case eHT_CHANNEL_WIDTH_20MHZ:
4057 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4058 break;
4059
4060 case eHT_CHANNEL_WIDTH_40MHZ:
4061 case eHT_CHANNEL_WIDTH_80MHZ:
4062 bonding_state = csr_convert_cb_ini_value_to_phy_cb_state(
4063 hdd_ctx->config->nChannelBondingMode5GHz);
4064
4065 if (bonding_state == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE)
4066 return -EINVAL;
4067
4068 bonding_mode = hdd_ctx->config->nChannelBondingMode5GHz;
4069 break;
4070
4071 default:
4072 hdd_err("Invalid channel width 0->20 1->40 2->80");
4073 return -EINVAL;
4074 }
4075
4076 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4077 if (!sme_config) {
4078 hdd_err("failed to allocate memory for sme_config");
4079 return -ENOMEM;
4080 }
4081
4082 errno = wma_cli_set_command(adapter->session_id, WMI_VDEV_PARAM_CHWIDTH,
4083 ch_width, VDEV_CMD);
4084 if (errno)
4085 goto free_config;
4086
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004087 sme_get_config_param(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004088 sme_config->csrConfig.channelBondingMode5GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004089 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004090
4091free_config:
4092 qdf_mem_free(sme_config);
4093
4094 return errno;
4095}
4096
Dustin Brownd90f61a2018-04-26 12:25:58 -07004097static int hdd_we_set_11d_state(struct hdd_context *hdd_ctx, int state_11d)
4098{
4099 tSmeConfigParams *sme_config;
4100 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004101 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004102
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004103 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004104 return -EINVAL;
4105
4106 switch (state_11d) {
4107 case ENABLE_11D:
4108 enable_11d = true;
4109 break;
4110 case DISABLE_11D:
4111 enable_11d = false;
4112 break;
4113 default:
4114 return -EINVAL;
4115 }
4116
4117 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4118 if (!sme_config) {
4119 hdd_err("failed to allocate memory for sme_config");
4120 return -ENOMEM;
4121 }
4122
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004123 sme_get_config_param(mac_handle, sme_config);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004124 sme_config->csrConfig.Is11dSupportEnabled = enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004125 sme_update_config(mac_handle, sme_config);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004126
4127 qdf_mem_free(sme_config);
4128
Dustin Brownea82d562018-05-23 12:07:16 -07004129 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004130
4131 return 0;
4132}
4133
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004134/**
4135 * iw_setint_getnone() - Generic "set integer" private ioctl handler
4136 * @dev: device upon which the ioctl was received
4137 * @info: ioctl request information
4138 * @wrqu: ioctl request data
4139 * @extra: ioctl extra data
4140 *
4141 * Return: 0 on success, non-zero on error
4142 */
4143static int __iw_setint_getnone(struct net_device *dev,
4144 struct iw_request_info *info,
4145 union iwreq_data *wrqu, char *extra)
4146{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004147 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004148 mac_handle_t mac_handle;
Jeff Johnsond377dce2017-10-04 10:32:42 -07004149 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07004150 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004151 int *value = (int *)extra;
4152 int sub_cmd = value[0];
4153 int set_value = value[1];
4154 int ret;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304155 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004156
Dustin Brownfdf17c12018-03-14 12:55:34 -07004157 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05304158
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004159 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004160 ret = wlan_hdd_validate_context(hdd_ctx);
4161 if (0 != ret)
4162 return ret;
4163
Jeff Johnson441e1f72017-02-07 08:50:49 -08004164 ret = hdd_check_private_wext_control(hdd_ctx, info);
4165 if (0 != ret)
4166 return ret;
4167
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004168 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004169 switch (sub_cmd) {
4170 case WE_SET_11D_STATE:
Dustin Brownd90f61a2018-04-26 12:25:58 -07004171 ret = hdd_we_set_11d_state(hdd_ctx, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004172 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004173
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004174 case WE_SET_POWER:
4175 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004176 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304177 return -EINVAL;
4178
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004179 switch (set_value) {
4180 case 1:
4181 /* Enable PowerSave */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004182 sme_ps_enable_disable(mac_handle, adapter->session_id,
4183 SME_PS_ENABLE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004184 break;
4185 case 2:
4186 /* Disable PowerSave */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004187 sme_ps_enable_disable(mac_handle, adapter->session_id,
4188 SME_PS_DISABLE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004189 break;
4190 case 3: /* Enable UASPD */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004191 sme_ps_uapsd_enable(mac_handle, adapter->session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004192 break;
4193 case 4: /* Disable UASPD */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004194 sme_ps_uapsd_disable(mac_handle, adapter->session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004195 break;
4196 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07004197 hdd_err("Invalid arg %d in WE_SET_POWER IOCTL",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004198 set_value);
4199 ret = -EINVAL;
4200 break;
4201 }
4202 break;
4203 }
4204
4205 case WE_SET_MAX_ASSOC:
4206 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004207 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304208 return -EINVAL;
4209
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004210 if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) ||
4211 (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) {
4212 ret = -EINVAL;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004213 } else if (sme_cfg_set_int(mac_handle, WNI_CFG_ASSOC_STA_LIMIT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004214 set_value)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304215 != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004216 hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004217 ret = -EIO;
4218 }
4219 break;
4220 }
4221
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004222 case WE_SET_DATA_INACTIVITY_TO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004223 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304224 return -EINVAL;
4225
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004226 if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) ||
4227 (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) ||
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004228 (sme_cfg_set_int(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004229 WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304230 set_value) == QDF_STATUS_E_FAILURE)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004231 hdd_err("WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004232 ret = -EINVAL;
4233 }
4234 break;
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05304235 case WE_SET_WOW_DATA_INACTIVITY_TO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004236 if (!mac_handle) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304237 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004238 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304239 }
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05304240
4241 if ((set_value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) ||
4242 (set_value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX) ||
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004243 (sme_cfg_set_int(mac_handle,
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05304244 WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT,
4245 set_value) == QDF_STATUS_E_FAILURE)) {
4246 hdd_err("WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT fail");
4247 ret = -EINVAL;
4248 }
4249 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004250 case WE_SET_MC_RATE:
4251 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004252 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304253 return -EINVAL;
4254
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004255 ret = wlan_hdd_set_mc_rate(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004256 break;
4257 }
4258 case WE_SET_TX_POWER:
4259 {
Anurag Chouhan6d760662016-02-20 16:05:43 +05304260 struct qdf_mac_addr bssid;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004261
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004262 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304263 return -EINVAL;
4264
Jeff Johnsond377dce2017-10-04 10:32:42 -07004265 qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004266 if (sme_set_tx_power
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004267 (mac_handle, adapter->session_id, bssid,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004268 adapter->device_mode,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304269 set_value) != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004270 hdd_err("Setting tx power failed");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304271 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004272 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004273 }
4274 break;
4275 }
4276 case WE_SET_MAX_TX_POWER:
4277 {
Anurag Chouhan6d760662016-02-20 16:05:43 +05304278 struct qdf_mac_addr bssid;
4279 struct qdf_mac_addr selfMac;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004280
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004281 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304282 return -EINVAL;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004283
4284 hdd_debug("Setting maximum tx power %d dBm",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004285 set_value);
Jeff Johnsond377dce2017-10-04 10:32:42 -07004286 qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId);
4287 qdf_copy_macaddr(&selfMac, &sta_ctx->conn_info.bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004288
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004289 if (sme_set_max_tx_power(mac_handle, bssid, selfMac, set_value)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304290 != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004291 hdd_err("Setting maximum tx power failed");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304292 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004293 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004294 }
4295
4296 break;
4297 }
4298 case WE_SET_MAX_TX_POWER_2_4:
4299 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004300 hdd_debug("Setting maximum tx power %d dBm for 2.4 GHz band",
Jeff Johnson99bac312016-06-28 10:38:18 -07004301 set_value);
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004302 if (sme_set_max_tx_power_per_band(BAND_2G, set_value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304303 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004304 hdd_err("Setting max tx power failed for 2.4 GHz band");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304305 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004306 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004307 }
4308
4309 break;
4310 }
4311 case WE_SET_MAX_TX_POWER_5_0:
4312 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004313 hdd_debug("Setting maximum tx power %d dBm for 5.0 GHz band",
Jeff Johnson99bac312016-06-28 10:38:18 -07004314 set_value);
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004315 if (sme_set_max_tx_power_per_band(BAND_5G, set_value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304316 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004317 hdd_err("Setting max tx power failed for 5.0 GHz band");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304318 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004319 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004320 }
4321
4322 break;
4323 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004324
4325 case WE_SET_TM_LEVEL:
4326 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004327 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304328 return -EINVAL;
4329
Dustin Brown5e89ef82018-03-14 11:50:23 -07004330 hdd_debug("Set Thermal Mitigation Level %d", set_value);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004331 (void)sme_set_thermal_level(mac_handle, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004332 break;
4333 }
4334
4335 case WE_SET_PHYMODE:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004336 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304337 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004338
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004339 ret = wlan_hdd_update_phymode(dev, mac_handle, set_value,
4340 hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004341 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004342
4343 case WE_SET_NSS:
4344 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004345 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304346 return -EINVAL;
4347
Dustin Brown5e89ef82018-03-14 11:50:23 -07004348 hdd_debug("Set NSS = %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004349 if ((set_value > 2) || (set_value <= 0)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004350 hdd_err("NSS greater than 2 not supported");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004351 ret = -EINVAL;
4352 } else {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304353 if (QDF_STATUS_SUCCESS !=
Kiran Kumar Lokere44a29432018-01-24 16:10:30 -08004354 hdd_update_nss(adapter, set_value))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004355 ret = -EINVAL;
4356 }
4357 break;
4358 }
4359
4360 case WE_SET_GTX_HT_MCS:
4361 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004362 hdd_debug("WMI_VDEV_PARAM_GTX_HT_MCS %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004363 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004364 WMI_VDEV_PARAM_GTX_HT_MCS,
4365 set_value, GTX_CMD);
4366 break;
4367 }
4368
4369 case WE_SET_GTX_VHT_MCS:
4370 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004371 hdd_debug("WMI_VDEV_PARAM_GTX_VHT_MCS %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004372 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_VHT_MCS,
4375 set_value, GTX_CMD);
4376 break;
4377 }
4378
4379 case WE_SET_GTX_USRCFG:
4380 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004381 hdd_debug("WMI_VDEV_PARAM_GTX_USR_CFG %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004382 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004383 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004384 WMI_VDEV_PARAM_GTX_USR_CFG,
4385 set_value, GTX_CMD);
4386 break;
4387 }
4388
4389 case WE_SET_GTX_THRE:
4390 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004391 hdd_debug("WMI_VDEV_PARAM_GTX_THRE %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004392 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004393 WMI_VDEV_PARAM_GTX_THRE,
4394 set_value, GTX_CMD);
4395 break;
4396 }
4397
4398 case WE_SET_GTX_MARGIN:
4399 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004400 hdd_debug("WMI_VDEV_PARAM_GTX_MARGIN %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004401 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004402 WMI_VDEV_PARAM_GTX_MARGIN,
4403 set_value, GTX_CMD);
4404 break;
4405 }
4406
4407 case WE_SET_GTX_STEP:
4408 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004409 hdd_debug("WMI_VDEV_PARAM_GTX_STEP %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004410 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004411 WMI_VDEV_PARAM_GTX_STEP,
4412 set_value, GTX_CMD);
4413 break;
4414 }
4415
4416 case WE_SET_GTX_MINTPC:
4417 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004418 hdd_debug("WMI_VDEV_PARAM_GTX_MINTPC %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004419 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004420 WMI_VDEV_PARAM_GTX_MINTPC,
4421 set_value, GTX_CMD);
4422 break;
4423 }
4424
4425 case WE_SET_GTX_BWMASK:
4426 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004427 hdd_debug("WMI_VDEV_PARAM_GTX_BWMASK %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004428 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004429 WMI_VDEV_PARAM_GTX_BW_MASK,
4430 set_value, GTX_CMD);
4431 break;
4432 }
4433
4434 case WE_SET_LDPC:
4435 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004436 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304437 return -EINVAL;
4438
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004439 ret = hdd_set_ldpc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004440 break;
4441 }
4442
4443 case WE_SET_TX_STBC:
4444 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004445 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304446 return -EINVAL;
4447
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004448 ret = hdd_set_tx_stbc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004449 break;
4450 }
4451
4452 case WE_SET_RX_STBC:
4453 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004454 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304455 return -EINVAL;
4456
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004457 ret = hdd_set_rx_stbc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004458 break;
4459 }
4460
4461 case WE_SET_SHORT_GI:
4462 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004463 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304464 return -EINVAL;
4465
Dustin Brown5e89ef82018-03-14 11:50:23 -07004466 hdd_debug("WMI_VDEV_PARAM_SGI val %d", set_value);
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08004467 if (set_value & HDD_AUTO_RATE_SGI)
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004468 ret = sme_set_auto_rate_he_sgi(mac_handle,
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08004469 adapter->session_id,
4470 set_value);
4471 else
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004472 ret = sme_update_ht_config(mac_handle,
4473 adapter->session_id,
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08004474 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4475 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004476 if (ret)
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -08004477 hdd_err("Failed to set ShortGI value %d", set_value);
4478
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004479 break;
4480 }
4481
4482 case WE_SET_RTSCTS:
4483 {
4484 uint32_t value;
4485
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004486 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05304487 return -EINVAL;
4488
Dustin Brown5e89ef82018-03-14 11:50:23 -07004489 hdd_debug("WMI_VDEV_PARAM_ENABLE_RTSCTS val 0x%x", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004490
4491 if ((set_value & HDD_RTSCTS_EN_MASK) ==
4492 HDD_RTSCTS_ENABLE)
4493 value =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004494 (WLAN_HDD_GET_CTX(adapter))->config->
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004495 RTSThreshold;
4496 else if (((set_value & HDD_RTSCTS_EN_MASK) == 0)
4497 || ((set_value & HDD_RTSCTS_EN_MASK) ==
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304498 HDD_CTS_ENABLE)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004499 value = WNI_CFG_RTS_THRESHOLD_STAMAX;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304500 } else {
4501 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004502 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304503 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004504
Jeff Johnson1b780e42017-10-31 14:11:45 -07004505 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004506 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4507 set_value, VDEV_CMD);
4508 if (!ret) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004509 if (sme_cfg_set_int(mac_handle, WNI_CFG_RTS_THRESHOLD,
4510 value) != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004511 hdd_err("FAILED TO SET RTSCTS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304512 ret = -EIO;
Dustin Brownc88e5962018-04-26 12:32:40 -07004513 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004514 }
4515 }
4516
4517 break;
4518 }
4519
4520 case WE_SET_CHWIDTH:
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004521 ret = hdd_we_set_ch_width(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004522 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004523
4524 case WE_SET_ANI_EN_DIS:
4525 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004526 hdd_debug("WMI_PDEV_PARAM_ANI_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004527 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004528 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004529 WMI_PDEV_PARAM_ANI_ENABLE,
4530 set_value, PDEV_CMD);
4531 break;
4532 }
4533
4534 case WE_SET_ANI_POLL_PERIOD:
4535 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004536 hdd_debug("WMI_PDEV_PARAM_ANI_POLL_PERIOD val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004537 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004538 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004539 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
4540 set_value, PDEV_CMD);
4541 break;
4542 }
4543
4544 case WE_SET_ANI_LISTEN_PERIOD:
4545 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004546 hdd_debug("WMI_PDEV_PARAM_ANI_LISTEN_PERIOD val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004547 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004548 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004549 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
4550 set_value, PDEV_CMD);
4551 break;
4552 }
4553
4554 case WE_SET_ANI_OFDM_LEVEL:
4555 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004556 hdd_debug("WMI_PDEV_PARAM_ANI_OFDM_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004557 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004558 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004559 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
4560 set_value, PDEV_CMD);
4561 break;
4562 }
4563
4564 case WE_SET_ANI_CCK_LEVEL:
4565 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004566 hdd_debug("WMI_PDEV_PARAM_ANI_CCK_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004567 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004568 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004569 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
4570 set_value, PDEV_CMD);
4571 break;
4572 }
4573
4574 case WE_SET_DYNAMIC_BW:
4575 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004576 hdd_debug("WMI_PDEV_PARAM_DYNAMIC_BW val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004577 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004578 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004579 WMI_PDEV_PARAM_DYNAMIC_BW,
4580 set_value, PDEV_CMD);
4581 break;
4582 }
4583
4584 case WE_SET_CTS_CBW:
4585 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004586 hdd_debug("WE_SET_CTS_CBW val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004587 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004588 WMI_PDEV_PARAM_CTS_CBW,
4589 set_value, PDEV_CMD);
4590 break;
4591 }
4592
4593 case WE_SET_11N_RATE:
4594 {
4595 uint8_t preamble = 0, nss = 0, rix = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004596
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004597 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004598 set_value);
4599
4600 if (set_value != 0xff) {
4601 rix = RC_2_RATE_IDX(set_value);
4602 if (set_value & 0x80) {
4603 preamble = WMI_RATE_PREAMBLE_HT;
4604 nss = HT_RC_2_STREAMS(set_value) - 1;
4605 } else {
4606 nss = 0;
4607 rix = RC_2_RATE_IDX(set_value);
4608 if (set_value & 0x10) {
4609 preamble =
4610 WMI_RATE_PREAMBLE_CCK;
4611 if (rix != 0x3)
4612 /* Enable Short
4613 * preamble always for
4614 * CCK except 1mbps
4615 */
4616 rix |= 0x4;
4617 } else {
4618 preamble =
4619 WMI_RATE_PREAMBLE_OFDM;
4620 }
4621 }
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08004622 set_value = hdd_assemble_rate_code(preamble, nss, rix);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004623 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004624 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004625 set_value, rix, preamble, nss);
4626
Jeff Johnson1b780e42017-10-31 14:11:45 -07004627 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004628 WMI_VDEV_PARAM_FIXED_RATE,
4629 set_value, VDEV_CMD);
4630 break;
4631 }
4632
4633 case WE_SET_VHT_RATE:
4634 {
4635 uint8_t preamble = 0, nss = 0, rix = 0;
4636
4637 if (set_value != 0xff) {
4638 rix = RC_2_RATE_IDX_11AC(set_value);
4639 preamble = WMI_RATE_PREAMBLE_VHT;
4640 nss = HT_RC_2_STREAMS_11AC(set_value) - 1;
4641
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08004642 set_value = hdd_assemble_rate_code(preamble, nss, rix);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004643 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004644 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004645 set_value, rix, preamble, nss);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004646 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004647 WMI_VDEV_PARAM_FIXED_RATE,
4648 set_value, VDEV_CMD);
4649 break;
4650 }
4651
4652 case WE_SET_AMPDU:
4653 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004654 hdd_debug("SET AMPDU val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004655 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004656 GEN_VDEV_PARAM_AMPDU,
4657 set_value, GEN_CMD);
4658 break;
4659 }
4660
4661 case WE_SET_AMSDU:
4662 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004663 hdd_debug("SET AMSDU val %d", set_value);
Arif Hussain0e246802018-05-01 18:13:44 -07004664 if (set_value > 1)
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004665 sme_set_amsdu(mac_handle, true);
Arif Hussain0e246802018-05-01 18:13:44 -07004666 else
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004667 sme_set_amsdu(mac_handle, false);
Arif Hussain0e246802018-05-01 18:13:44 -07004668
Jeff Johnson1b780e42017-10-31 14:11:45 -07004669 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004670 GEN_VDEV_PARAM_AMSDU,
4671 set_value, GEN_CMD);
Deepak Dhamdhere612392c2016-08-28 02:56:51 -07004672 /* Update the stored ini value */
4673 if (!ret)
4674 hdd_ctx->config->max_amsdu_num = set_value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004675 break;
4676 }
4677
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004678 case WE_SET_TX_CHAINMASK:
4679 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004680 hdd_debug("WMI_PDEV_PARAM_TX_CHAIN_MASK val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004681 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004682 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004683 WMI_PDEV_PARAM_TX_CHAIN_MASK,
4684 set_value, PDEV_CMD);
Abhishek Singh1571ca72018-04-17 15:14:21 +05304685 ret = hdd_set_antenna_mode(adapter, hdd_ctx, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004686 break;
4687 }
4688
4689 case WE_SET_RX_CHAINMASK:
4690 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004691 hdd_debug("WMI_PDEV_PARAM_RX_CHAIN_MASK val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004692 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004693 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004694 WMI_PDEV_PARAM_RX_CHAIN_MASK,
4695 set_value, PDEV_CMD);
Abhishek Singh1571ca72018-04-17 15:14:21 +05304696 ret = hdd_set_antenna_mode(adapter, hdd_ctx, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004697 break;
4698 }
4699
4700 case WE_SET_TXPOW_2G:
4701 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004702 hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT2G val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004703 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004704 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004705 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
4706 set_value, PDEV_CMD);
4707 break;
4708 }
4709
4710 case WE_SET_TXPOW_5G:
4711 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004712 hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT5G val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004713 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004714 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004715 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
4716 set_value, PDEV_CMD);
4717 break;
4718 }
4719
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004720 /* Firmware debug log */
4721 case WE_DBGLOG_LOG_LEVEL:
4722 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004723 hdd_debug("WE_DBGLOG_LOG_LEVEL val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004724 hdd_ctx->fw_log_settings.dl_loglevel = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004725 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004726 WMI_DBGLOG_LOG_LEVEL,
4727 set_value, DBG_CMD);
4728 break;
4729 }
4730
4731 case WE_DBGLOG_VAP_ENABLE:
4732 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004733 hdd_debug("WE_DBGLOG_VAP_ENABLE val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004734 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004735 WMI_DBGLOG_VAP_ENABLE,
4736 set_value, DBG_CMD);
4737 break;
4738 }
4739
4740 case WE_DBGLOG_VAP_DISABLE:
4741 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004742 hdd_debug("WE_DBGLOG_VAP_DISABLE val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004743 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004744 WMI_DBGLOG_VAP_DISABLE,
4745 set_value, DBG_CMD);
4746 break;
4747 }
4748
4749 case WE_DBGLOG_MODULE_ENABLE:
4750 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004751 hdd_debug("WE_DBGLOG_MODULE_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004752 set_value);
4753 hdd_ctx->fw_log_settings.enable = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004754 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004755 WMI_DBGLOG_MODULE_ENABLE,
4756 set_value, DBG_CMD);
4757 break;
4758 }
4759
4760 case WE_DBGLOG_MODULE_DISABLE:
4761 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004762 hdd_debug("WE_DBGLOG_MODULE_DISABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004763 set_value);
4764 hdd_ctx->fw_log_settings.enable = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004765 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004766 WMI_DBGLOG_MODULE_DISABLE,
4767 set_value, DBG_CMD);
4768 break;
4769 }
4770 case WE_DBGLOG_MOD_LOG_LEVEL:
4771 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004772 hdd_debug("WE_DBGLOG_MOD_LOG_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004773 set_value);
4774
4775 if (hdd_ctx->fw_log_settings.index >= MAX_MOD_LOGLEVEL)
4776 hdd_ctx->fw_log_settings.index = 0;
4777
4778 hdd_ctx->fw_log_settings.
4779 dl_mod_loglevel[hdd_ctx->fw_log_settings.index] =
4780 set_value;
4781 hdd_ctx->fw_log_settings.index++;
4782
Jeff Johnson1b780e42017-10-31 14:11:45 -07004783 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004784 WMI_DBGLOG_MOD_LOG_LEVEL,
4785 set_value, DBG_CMD);
4786 break;
4787 }
4788
4789 case WE_DBGLOG_TYPE:
4790 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004791 hdd_debug("WE_DBGLOG_TYPE val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004792 hdd_ctx->fw_log_settings.dl_type = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004793 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004794 WMI_DBGLOG_TYPE,
4795 set_value, DBG_CMD);
4796 break;
4797 }
4798 case WE_DBGLOG_REPORT_ENABLE:
4799 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004800 hdd_debug("WE_DBGLOG_REPORT_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004801 set_value);
4802 hdd_ctx->fw_log_settings.dl_report = set_value;
Jeff Johnson1b780e42017-10-31 14:11:45 -07004803 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004804 WMI_DBGLOG_REPORT_ENABLE,
4805 set_value, DBG_CMD);
4806 break;
4807 }
4808
4809 case WE_SET_TXRX_FWSTATS:
4810 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004811 hdd_debug("WE_SET_TXRX_FWSTATS val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004812 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004813 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
4814 set_value, VDEV_CMD);
4815 break;
4816 }
4817
4818 case WE_TXRX_FWSTATS_RESET:
4819 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004820 hdd_debug("WE_TXRX_FWSTATS_RESET val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004821 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004822 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
4823 set_value, VDEV_CMD);
4824 break;
4825 }
4826
4827 case WE_DUMP_STATS:
4828 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004829 hdd_debug("WE_DUMP_STATS val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004830 ret = hdd_wlan_dump_stats(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004831 break;
4832 }
4833
4834 case WE_CLEAR_STATS:
4835 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004836 hdd_debug("WE_CLEAR_STATS val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004837 switch (set_value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07004838 case CDP_HDD_STATS:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004839 memset(&adapter->stats, 0, sizeof(adapter->stats));
4840 memset(&adapter->hdd_stats, 0,
4841 sizeof(adapter->hdd_stats));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004842 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07004843 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004844 wlan_hdd_clear_tx_rx_histogram(hdd_ctx);
4845 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07004846 case CDP_HDD_NETIF_OPER_HISTORY:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004847 wlan_hdd_clear_netif_queue_history(hdd_ctx);
4848 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07004849 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05304850 hdd_clear_hif_stats();
4851 break;
Yun Park1027e8c2017-10-13 15:17:37 -07004852 case CDP_NAPI_STATS:
4853 hdd_clear_napi_stats();
4854 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004855 default:
Leo Changfdb45c32016-10-28 11:09:23 -07004856 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4857 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004858 }
4859 break;
4860 }
4861
4862 case WE_PPS_PAID_MATCH:
4863 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004864 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304865 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004866 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304867 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004868
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004869 hdd_debug("WMI_VDEV_PPS_PAID_MATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004870 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004871 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004872 WMI_VDEV_PPS_PAID_MATCH,
4873 set_value, PPS_CMD);
4874 break;
4875 }
4876
4877 case WE_PPS_GID_MATCH:
4878 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004879 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304880 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004881 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304882 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004883 hdd_debug("WMI_VDEV_PPS_GID_MATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004884 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004885 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004886 WMI_VDEV_PPS_GID_MATCH,
4887 set_value, PPS_CMD);
4888 break;
4889 }
4890
4891 case WE_PPS_EARLY_TIM_CLEAR:
4892 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004893 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304894 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004895 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304896 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004897 hdd_debug(" WMI_VDEV_PPS_EARLY_TIM_CLEAR val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004898 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004899 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004900 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4901 set_value, PPS_CMD);
4902 break;
4903 }
4904
4905 case WE_PPS_EARLY_DTIM_CLEAR:
4906 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004907 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304908 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004909 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304910 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004911 hdd_debug("WMI_VDEV_PPS_EARLY_DTIM_CLEAR val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004912 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004913 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004914 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4915 set_value, PPS_CMD);
4916 break;
4917 }
4918
4919 case WE_PPS_EOF_PAD_DELIM:
4920 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004921 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304922 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004923 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304924 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004925 hdd_debug("WMI_VDEV_PPS_EOF_PAD_DELIM val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004926 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004927 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004928 WMI_VDEV_PPS_EOF_PAD_DELIM,
4929 set_value, PPS_CMD);
4930 break;
4931 }
4932
4933 case WE_PPS_MACADDR_MISMATCH:
4934 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004935 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304936 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004937 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304938 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004939 hdd_debug("WMI_VDEV_PPS_MACADDR_MISMATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004940 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004941 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004942 WMI_VDEV_PPS_MACADDR_MISMATCH,
4943 set_value, PPS_CMD);
4944 break;
4945 }
4946
4947 case WE_PPS_DELIM_CRC_FAIL:
4948 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004949 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304950 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004951 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304952 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004953 hdd_debug("WMI_VDEV_PPS_DELIM_CRC_FAIL val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004954 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004955 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004956 WMI_VDEV_PPS_DELIM_CRC_FAIL,
4957 set_value, PPS_CMD);
4958 break;
4959 }
4960
4961 case WE_PPS_GID_NSTS_ZERO:
4962 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004963 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304964 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004965 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304966 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004967 hdd_debug("WMI_VDEV_PPS_GID_NSTS_ZERO val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004968 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004969 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004970 WMI_VDEV_PPS_GID_NSTS_ZERO,
4971 set_value, PPS_CMD);
4972 break;
4973 }
4974
4975 case WE_PPS_RSSI_CHECK:
4976 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004977 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304978 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004979 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304980 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004981 hdd_debug("WMI_VDEV_PPS_RSSI_CHECK val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004982 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004983 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004984 WMI_VDEV_PPS_RSSI_CHECK,
4985 set_value, PPS_CMD);
4986 break;
4987 }
4988
4989 case WE_PPS_5G_EBT:
4990 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004991 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304992 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07004993 break;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304994 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004995
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004996 hdd_debug("WMI_VDEV_PPS_5G_EBT val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07004997 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004998 WMI_VDEV_PPS_5G_EBT,
4999 set_value, PPS_CMD);
5000 break;
5001 }
5002
5003 case WE_SET_HTSMPS:
5004 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005005 hdd_debug("WE_SET_HTSMPS val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005006 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005007 WMI_STA_SMPS_FORCE_MODE_CMDID,
5008 set_value, VDEV_CMD);
5009 break;
5010 }
5011
5012 case WE_SET_QPOWER_MAX_PSPOLL_COUNT:
5013 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005014 hdd_debug("WE_SET_QPOWER_MAX_PSPOLL_COUNT val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005015 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005016 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005017 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
5018 set_value, QPOWER_CMD);
5019 break;
5020 }
5021
5022 case WE_SET_QPOWER_MAX_TX_BEFORE_WAKE:
5023 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005024 hdd_debug("WE_SET_QPOWER_MAX_TX_BEFORE_WAKE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005025 set_value);
5026 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005027 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005028 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
5029 set_value, QPOWER_CMD);
5030 break;
5031 }
5032
5033 case WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
5034 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005035 hdd_debug("WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005036 set_value);
5037 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005038 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005039 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
5040 set_value, QPOWER_CMD);
5041 break;
5042 }
5043
5044 case WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
5045 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005046 hdd_debug("WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005047 set_value);
5048 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005049 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005050 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
5051 set_value, QPOWER_CMD);
5052 break;
5053 }
5054
5055 case WE_MCC_CONFIG_LATENCY:
5056 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005057 wlan_hdd_set_mcc_latency(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005058 break;
5059 }
5060
5061 case WE_MCC_CONFIG_QUOTA:
5062 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005063 hdd_debug("iwpriv cmd to set MCC quota with val %dms",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005064 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005065 ret = wlan_hdd_set_mcc_p2p_quota(adapter,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08005066 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005067 break;
5068 }
5069 case WE_SET_DEBUG_LOG:
5070 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005071 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson4f7f7c62017-10-05 08:53:41 -07005072
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005073 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05305074 return -EINVAL;
5075
Nirav Shah1da77682016-05-03 20:16:39 +05305076
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005077 hdd_ctx->config->gEnableDebugLog = set_value;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005078 sme_update_connect_debug(mac_handle, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005079 break;
5080 }
5081 case WE_SET_EARLY_RX_ADJUST_ENABLE:
5082 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005083 hdd_debug("SET early_rx enable val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005084 if ((set_value == 0) || (set_value == 1))
5085 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005086 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005087 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
5088 set_value, VDEV_CMD);
5089 else
5090 ret = -EINVAL;
5091 break;
5092 }
5093 case WE_SET_EARLY_RX_TGT_BMISS_NUM:
5094 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005095 hdd_debug("SET early_rx bmiss val %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005096 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005097 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
5098 set_value, VDEV_CMD);
5099 break;
5100 }
5101 case WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE:
5102 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005103 hdd_debug("SET early_rx bmiss sample cycle %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005104 set_value);
5105 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005106 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005107 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
5108 set_value, VDEV_CMD);
5109 break;
5110 }
5111 case WE_SET_EARLY_RX_SLOP_STEP:
5112 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005113 hdd_debug("SET early_rx bmiss slop step val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005114 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005115 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005116 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
5117 set_value, VDEV_CMD);
5118 break;
5119 }
5120 case WE_SET_EARLY_RX_INIT_SLOP:
5121 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005122 hdd_debug("SET early_rx init slop step val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005123 set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005124 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005125 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
5126 set_value, VDEV_CMD);
5127 break;
5128 }
5129 case WE_SET_EARLY_RX_ADJUST_PAUSE:
5130 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005131 hdd_debug("SET early_rx adjust pause %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005132 if ((set_value == 0) || (set_value == 1))
5133 ret = wma_cli_set_command(
Jeff Johnson1b780e42017-10-31 14:11:45 -07005134 adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005135 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
5136 set_value, VDEV_CMD);
5137 else
5138 ret = -EINVAL;
5139 break;
5140 }
5141 case WE_SET_EARLY_RX_DRIFT_SAMPLE:
5142 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005143 hdd_debug("SET early_rx drift sample %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005144 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005145 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
5146 set_value, VDEV_CMD);
5147 break;
5148 }
5149 case WE_SET_SCAN_DISABLE:
5150 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005151 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05305152 return -EINVAL;
5153
Dustin Brown5e89ef82018-03-14 11:50:23 -07005154 hdd_debug("SET SCAN DISABLE %d", set_value);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005155 sme_set_scan_disable(mac_handle, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005156 break;
5157 }
Govind Singha471e5e2015-10-12 17:11:14 +05305158 case WE_START_FW_PROFILE:
5159 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005160 hdd_debug("WE_START_FW_PROFILE %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005161 ret = wma_cli_set_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05305162 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5163 set_value, DBG_CMD);
5164 break;
5165 }
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305166 case WE_SET_CHANNEL:
5167 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005168 hdd_debug("Set Channel %d Session ID %d mode %d", set_value,
Jeff Johnson1b780e42017-10-31 14:11:45 -07005169 adapter->session_id, adapter->device_mode);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005170 if (!mac_handle)
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05305171 return -EINVAL;
5172
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305173
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005174 if ((QDF_STA_MODE == adapter->device_mode) ||
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005175 (QDF_P2P_CLIENT_MODE == adapter->device_mode)) {
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305176
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005177 status = sme_ext_change_channel(mac_handle,
5178 set_value,
5179 adapter->session_id);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305180 if (status != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005181 hdd_err("Error in change channel status %d",
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005182 status);
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305183 ret = -EINVAL;
5184 }
5185 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07005186 hdd_err("change channel not supported for device mode %d",
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005187 adapter->device_mode);
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305188 ret = -EINVAL;
5189 }
5190 break;
5191 }
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05305192 case WE_SET_CONC_SYSTEM_PREF:
5193 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005194 hdd_debug("New preference: %d", set_value);
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05305195 if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) &&
5196 (set_value <= CFG_CONC_SYSTEM_PREF_MAX))) {
5197 hdd_err("Invalid system preference %d", set_value);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305198 ret = -EINVAL;
Dustin Brownc88e5962018-04-26 12:32:40 -07005199 break;
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05305200 }
Abhishek Singh1bdb1572015-10-16 16:24:19 +05305201
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05305202 /* hdd_ctx, hdd_ctx->config are already checked for null */
5203 hdd_ctx->config->conc_system_pref = set_value;
5204 break;
5205 }
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08005206 case WE_SET_11AX_RATE:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005207 ret = hdd_set_11ax_rate(adapter, set_value, NULL);
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08005208 break;
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07005209 case WE_SET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07005210 hdd_debug("Set WMI_VDEV_PARAM_HE_DCM: %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005211 ret = wma_cli_set_command(adapter->session_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07005212 WMI_VDEV_PARAM_HE_DCM, set_value,
5213 VDEV_CMD);
5214 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07005215 case WE_SET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07005216 hdd_debug("Set WMI_VDEV_PARAM_HE_RANGE_EXT: %d", set_value);
Jeff Johnson1b780e42017-10-31 14:11:45 -07005217 ret = wma_cli_set_command(adapter->session_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07005218 WMI_VDEV_PARAM_HE_RANGE_EXT,
5219 set_value, VDEV_CMD);
5220 break;
Jeff Johnson011c4502017-10-05 15:25:56 -07005221 case WE_SET_PDEV_RESET:
5222 ret = hdd_handle_pdev_reset(adapter, set_value);
5223 break;
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05305224 case WE_SET_MODULATED_DTIM:
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05305225 if ((set_value < CFG_ENABLE_MODULATED_DTIM_MIN) ||
5226 (set_value > CFG_ENABLE_MODULATED_DTIM_MAX)) {
5227 hdd_err("Invalid gEnableModuleDTIM value %d",
5228 set_value);
5229 return -EINVAL;
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05305230 }
Jeff Johnsonc66d3102018-02-28 11:58:26 -08005231
5232 hdd_ctx->config->enableModulatedDTIM = set_value;
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05305233 break;
Kiran Kumar Lokere05e9a652018-04-10 20:27:38 -07005234 case WE_SET_PPDU_DUR:
5235 /*Validate set value for Min and Max range*/
5236 if (!set_value || (set_value > 4000)) {
5237 hdd_err("Invalid ppdu duraion value: %d usec",
5238 set_value);
5239 return -EINVAL;
5240 }
5241 ret = wma_cli_set_command(adapter->session_id,
5242 WMI_PDEV_PARAM_SET_PPDU_DURATION_CMDID,
5243 set_value, PDEV_CMD);
5244 if (ret)
5245 hdd_err("SET_PPDU_DURATION_CMDID %d usec set failed",
5246 set_value);
5247 else
5248 hdd_debug("PDEV_PARAM_SET_PPDU_DUR_CMDID is set to %d",
5249 set_value);
5250 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005251 default:
Rajeev Kumard0565362018-03-01 12:02:01 -08005252 hdd_debug("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005253 ret = -EINVAL;
5254 break;
5255 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005256
Dustin Browne74003f2018-03-14 12:51:58 -07005257 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005258
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005259 return ret;
5260}
5261
5262static int iw_setint_getnone(struct net_device *dev,
5263 struct iw_request_info *info,
5264 union iwreq_data *wrqu,
5265 char *extra)
5266{
5267 int ret;
5268
5269 cds_ssr_protect(__func__);
5270 ret = __iw_setint_getnone(dev, info, wrqu, extra);
5271 cds_ssr_unprotect(__func__);
5272
5273 return ret;
5274}
5275
5276/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005277 * __iw_setnone_get_threeint() - return three value to up layer.
5278 *
5279 * @dev: pointer of net_device of this wireless card
5280 * @info: meta data about Request sent
5281 * @wrqu: include request info
5282 * @extra: buf used for in/Output
5283 *
5284 * Return: execute result
5285 */
5286static int __iw_setnone_get_threeint(struct net_device *dev,
5287 struct iw_request_info *info,
5288 union iwreq_data *wrqu, char *extra)
5289{
5290 int ret = 0; /* success */
5291 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005292 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005293 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005294
Dustin Brownfdf17c12018-03-14 12:55:34 -07005295 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005296 ret = wlan_hdd_validate_context(hdd_ctx);
5297 if (0 != ret)
5298 return ret;
5299
Jeff Johnson441e1f72017-02-07 08:50:49 -08005300 ret = hdd_check_private_wext_control(hdd_ctx, info);
5301 if (0 != ret)
5302 return ret;
5303
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005304 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005305 switch (value[0]) {
5306 case WE_GET_TSF:
5307 ret = hdd_indicate_tsf(adapter, value, 3);
5308 break;
5309 default:
5310 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5311 break;
5312 }
5313 return ret;
5314}
5315
5316/**
5317 * iw_setnone_get_threeint() - return three value to up layer.
5318 *
5319 * @dev: pointer of net_device of this wireless card
5320 * @info: meta data about Request sent
5321 * @wrqu: include request info
5322 * @extra: buf used for in/Output
5323 *
5324 * Return: execute result
5325 */
5326static int iw_setnone_get_threeint(struct net_device *dev,
5327 struct iw_request_info *info,
5328 union iwreq_data *wrqu, char *extra)
5329{
5330 int ret;
5331
5332 cds_ssr_protect(__func__);
5333 ret = __iw_setnone_get_threeint(dev, info, wrqu, extra);
5334 cds_ssr_unprotect(__func__);
5335
5336 return ret;
5337}
5338
5339/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005340 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5341 * @dev: device upon which the ioctl was received
5342 * @info: ioctl request information
5343 * @wrqu: ioctl request data
5344 * @extra: ioctl extra data
5345 *
5346 * Return: 0 on success, non-zero on error
5347 */
5348static int __iw_setchar_getnone(struct net_device *dev,
5349 struct iw_request_info *info,
5350 union iwreq_data *wrqu, char *extra)
5351{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305352 QDF_STATUS vstatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005353 int sub_cmd;
5354 int ret;
5355 char *pBuffer = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005356 struct hdd_adapter *adapter = (netdev_priv(dev));
5357 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005358 struct hdd_config *pConfig = hdd_ctx->config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005359 struct iw_point s_priv_data;
5360
Dustin Brownfdf17c12018-03-14 12:55:34 -07005361 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005362
Mukul Sharma34777c62015-11-02 20:22:30 +05305363 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005364 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305365 return -EPERM;
5366 }
5367
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005368 ret = wlan_hdd_validate_context(hdd_ctx);
5369 if (0 != ret)
5370 return ret;
5371
Jeff Johnson441e1f72017-02-07 08:50:49 -08005372 ret = hdd_check_private_wext_control(hdd_ctx, info);
5373 if (0 != ret)
5374 return ret;
5375
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005376 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005377 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005378 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005379
5380 /* make sure all params are correctly passed to function */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005381 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005382 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005383
5384 sub_cmd = s_priv_data.flags;
5385
5386 /* ODD number is used for set, copy data using copy_from_user */
5387 pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
5388 s_priv_data.length);
5389 if (NULL == pBuffer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005390 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005391 return -ENOMEM;
5392 }
5393
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005394 hdd_debug("Received length: %d data: %s",
5395 s_priv_data.length, pBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005396
5397 switch (sub_cmd) {
5398 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005399 hdd_debug("ADD_PTRN");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005400 hdd_add_wowl_ptrn(adapter, pBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005401 break;
5402 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005403 hdd_debug("DEL_PTRN");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005404 hdd_del_wowl_ptrn(adapter, pBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005405 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005406 case WE_NEIGHBOR_REPORT_REQUEST:
5407 {
5408 tRrmNeighborReq neighborReq;
5409 tRrmNeighborRspCallbackInfo callbackInfo;
5410
5411 if (pConfig->fRrmEnable) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305412 neighborReq.neighbor_report_offload = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005413 neighborReq.no_ssid =
5414 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305415 hdd_debug("Neighbor Request ssid present %d",
5416 neighborReq.no_ssid);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005417 if (!neighborReq.no_ssid) {
5418 neighborReq.ssid.length =
5419 (s_priv_data.length - 1) >
5420 32 ? 32 : (s_priv_data.length - 1);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305421 qdf_mem_copy(neighborReq.ssid.ssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005422 pBuffer,
5423 neighborReq.ssid.length);
5424 }
5425
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305426 /*
5427 * If 11k offload is supported by FW and enabled
5428 * in the ini, set the offload to true
5429 */
5430 if (hdd_ctx->config->is_11k_offload_supported &&
5431 (hdd_ctx->config->offload_11k_enable_bitmask &
5432 OFFLOAD_11K_BITMASK_NEIGHBOR_REPORT_REQUEST)) {
5433 hdd_debug("Neighbor report offloaded to FW");
5434 neighborReq.neighbor_report_offload = true;
5435 }
5436
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005437 callbackInfo.neighborRspCallback = NULL;
5438 callbackInfo.neighborRspCallbackContext = NULL;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305439 callbackInfo.timeout = 5000; /* 5 seconds */
5440 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005441 hdd_ctx->mac_handle,
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305442 adapter->session_id,
5443 &neighborReq,
5444 &callbackInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005445 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005446 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005447 ret = -EINVAL;
5448 }
5449 }
5450 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005451 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08005452 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005453 break;
5454 case WE_SET_CONFIG:
5455 vstatus = hdd_execute_global_config_command(hdd_ctx, pBuffer);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005456 if (QDF_STATUS_SUCCESS != vstatus)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005457 ret = -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005458
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005459 break;
5460 default:
5461 {
Jeff Johnson99bac312016-06-28 10:38:18 -07005462 hdd_err("Invalid sub command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005463 sub_cmd);
5464 ret = -EINVAL;
5465 break;
5466 }
5467 }
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07005468 qdf_mem_free(pBuffer);
Dustin Browne74003f2018-03-14 12:51:58 -07005469 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005470 return ret;
5471}
5472
5473static int iw_setchar_getnone(struct net_device *dev,
5474 struct iw_request_info *info,
5475 union iwreq_data *wrqu, char *extra)
5476{
5477 int ret;
5478
5479 cds_ssr_protect(__func__);
5480 ret = __iw_setchar_getnone(dev, info, wrqu, extra);
5481 cds_ssr_unprotect(__func__);
5482
5483 return ret;
5484}
5485
5486/**
5487 * iw_setnone_getint() - Generic "get integer" private ioctl handler
5488 * @dev: device upon which the ioctl was received
5489 * @info: ioctl request information
5490 * @wrqu: ioctl request data
5491 * @extra: ioctl extra data
5492 *
5493 * Return: 0 on success, non-zero on error
5494 */
5495static int __iw_setnone_getint(struct net_device *dev,
5496 struct iw_request_info *info,
5497 union iwreq_data *wrqu, char *extra)
5498{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005499 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005500 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005501 int *value = (int *)extra;
5502 int ret;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305503 tSmeConfigParams *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005504 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005505
Dustin Brownfdf17c12018-03-14 12:55:34 -07005506 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305507
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005508 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005509 ret = wlan_hdd_validate_context(hdd_ctx);
5510 if (0 != ret)
5511 return ret;
5512
Jeff Johnson441e1f72017-02-07 08:50:49 -08005513 ret = hdd_check_private_wext_control(hdd_ctx, info);
5514 if (0 != ret)
5515 return ret;
5516
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08005517 sme_config = qdf_mem_malloc(sizeof(*sme_config));
5518 if (!sme_config) {
5519 hdd_err("failed to allocate memory for sme_config");
5520 return -ENOMEM;
5521 }
5522
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005523 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005524 switch (value[0]) {
5525 case WE_GET_11D_STATE:
5526 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005527 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005528
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305529 *value = sme_config->csrConfig.Is11dSupportEnabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005530
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005531 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005532
5533 break;
5534 }
5535
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005536 case WE_GET_WLAN_DBG:
5537 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05305538 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005539 *value = 0;
5540 break;
5541 }
5542 case WE_GET_MAX_ASSOC:
5543 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005544 if (sme_cfg_get_int(mac_handle, WNI_CFG_ASSOC_STA_LIMIT,
5545 (uint32_t *) value) != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005546 hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005547 ret = -EIO;
5548 }
5549 break;
5550 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005551
5552 case WE_GET_CONCURRENCY_MODE:
5553 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08005554 *value = policy_mgr_get_concurrency_mode(hdd_ctx->hdd_psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005555
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005556 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005557 break;
5558 }
5559
5560 case WE_GET_NSS:
5561 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005562 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305563 *value = (sme_config->csrConfig.enable2x2 == 0) ? 1 : 2;
Srinivas Girigowda576b2352017-08-25 14:44:26 -07005564 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->hdd_psoc))
5565 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005566 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005567 break;
5568 }
5569
5570 case WE_GET_GTX_HT_MCS:
5571 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005572 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005573 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005574 WMI_VDEV_PARAM_GTX_HT_MCS,
5575 GTX_CMD);
5576 break;
5577 }
5578
5579 case WE_GET_GTX_VHT_MCS:
5580 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005581 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005582 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005583 WMI_VDEV_PARAM_GTX_VHT_MCS,
5584 GTX_CMD);
5585 break;
5586 }
5587
5588 case WE_GET_GTX_USRCFG:
5589 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005590 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005591 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005592 WMI_VDEV_PARAM_GTX_USR_CFG,
5593 GTX_CMD);
5594 break;
5595 }
5596
5597 case WE_GET_GTX_THRE:
5598 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005599 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005600 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005601 WMI_VDEV_PARAM_GTX_THRE,
5602 GTX_CMD);
5603 break;
5604 }
5605
5606 case WE_GET_GTX_MARGIN:
5607 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005608 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005609 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005610 WMI_VDEV_PARAM_GTX_MARGIN,
5611 GTX_CMD);
5612 break;
5613 }
5614
5615 case WE_GET_GTX_STEP:
5616 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005617 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005618 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005619 WMI_VDEV_PARAM_GTX_STEP,
5620 GTX_CMD);
5621 break;
5622 }
5623
5624 case WE_GET_GTX_MINTPC:
5625 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005626 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005627 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005628 WMI_VDEV_PARAM_GTX_MINTPC,
5629 GTX_CMD);
5630 break;
5631 }
5632
5633 case WE_GET_GTX_BWMASK:
5634 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005635 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005636 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005637 WMI_VDEV_PARAM_GTX_BW_MASK,
5638 GTX_CMD);
5639 break;
5640 }
5641
5642 case WE_GET_LDPC:
5643 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005644 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005645 break;
5646 }
5647
5648 case WE_GET_TX_STBC:
5649 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005650 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005651 break;
5652 }
5653
5654 case WE_GET_RX_STBC:
5655 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005656 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005657 break;
5658 }
5659
5660 case WE_GET_SHORT_GI:
5661 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005662 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005663 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08005664 WMI_VDEV_PARAM_SGI,
5665 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005666 break;
5667 }
5668
5669 case WE_GET_RTSCTS:
5670 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005671 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005672 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005673 WMI_VDEV_PARAM_ENABLE_RTSCTS,
5674 VDEV_CMD);
5675 break;
5676 }
5677
5678 case WE_GET_CHWIDTH:
5679 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005680 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005681 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005682 WMI_VDEV_PARAM_CHWIDTH,
5683 VDEV_CMD);
5684 break;
5685 }
5686
5687 case WE_GET_ANI_EN_DIS:
5688 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005689 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005690 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005691 WMI_PDEV_PARAM_ANI_ENABLE,
5692 PDEV_CMD);
5693 break;
5694 }
5695
5696 case WE_GET_ANI_POLL_PERIOD:
5697 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005698 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005699 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005700 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
5701 PDEV_CMD);
5702 break;
5703 }
5704
5705 case WE_GET_ANI_LISTEN_PERIOD:
5706 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005707 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005708 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005709 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
5710 PDEV_CMD);
5711 break;
5712 }
5713
5714 case WE_GET_ANI_OFDM_LEVEL:
5715 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005716 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005717 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005718 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
5719 PDEV_CMD);
5720 break;
5721 }
5722
5723 case WE_GET_ANI_CCK_LEVEL:
5724 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005725 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005726 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005727 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
5728 PDEV_CMD);
5729 break;
5730 }
5731
5732 case WE_GET_DYNAMIC_BW:
5733 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005734 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005735 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005736 WMI_PDEV_PARAM_DYNAMIC_BW,
5737 PDEV_CMD);
5738 break;
5739 }
5740
5741 case WE_GET_11N_RATE:
5742 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005743 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005744 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005745 WMI_VDEV_PARAM_FIXED_RATE,
5746 VDEV_CMD);
5747 break;
5748 }
5749
5750 case WE_GET_AMPDU:
5751 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005752 hdd_debug("GET AMPDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005753 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005754 GEN_VDEV_PARAM_AMPDU,
5755 GEN_CMD);
5756 break;
5757 }
5758
5759 case WE_GET_AMSDU:
5760 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005761 hdd_debug("GET AMSDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005762 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005763 GEN_VDEV_PARAM_AMSDU,
5764 GEN_CMD);
5765 break;
5766 }
5767
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07005768 case WE_GET_ROAM_SYNCH_DELAY:
5769 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005770 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005771 *value = wma_cli_get_command(adapter->session_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07005772 GEN_VDEV_ROAM_SYNCH_DELAY,
5773 GEN_CMD);
5774 break;
5775 }
5776
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005777 case WE_GET_TX_CHAINMASK:
5778 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005779 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005780 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005781 WMI_PDEV_PARAM_TX_CHAIN_MASK,
5782 PDEV_CMD);
5783 break;
5784 }
5785
5786 case WE_GET_RX_CHAINMASK:
5787 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005788 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005789 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005790 WMI_PDEV_PARAM_RX_CHAIN_MASK,
5791 PDEV_CMD);
5792 break;
5793 }
5794
5795 case WE_GET_TXPOW_2G:
5796 {
5797 uint32_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005798
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005799 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005800 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005801 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
5802 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305803 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005804 sme_cfg_get_int(mac_handle, WNI_CFG_CURRENT_TX_POWER_LEVEL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005805 &txpow2g)) {
5806 return -EIO;
5807 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005808 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005809 break;
5810 }
5811
5812 case WE_GET_TXPOW_5G:
5813 {
5814 uint32_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005815
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005816 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005817 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005818 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
5819 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305820 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005821 sme_cfg_get_int(mac_handle, WNI_CFG_CURRENT_TX_POWER_LEVEL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005822 &txpow5g)) {
5823 return -EIO;
5824 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005825 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005826 break;
5827 }
5828
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005829 case WE_GET_PPS_PAID_MATCH:
5830 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005831 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005832 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005833 WMI_VDEV_PPS_PAID_MATCH,
5834 PPS_CMD);
5835 break;
5836 }
5837
5838 case WE_GET_PPS_GID_MATCH:
5839 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005840 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005841 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005842 WMI_VDEV_PPS_GID_MATCH,
5843 PPS_CMD);
5844 break;
5845 }
5846
5847 case WE_GET_PPS_EARLY_TIM_CLEAR:
5848 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005849 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005850 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005851 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
5852 PPS_CMD);
5853 break;
5854 }
5855
5856 case WE_GET_PPS_EARLY_DTIM_CLEAR:
5857 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005858 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005859 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005860 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
5861 PPS_CMD);
5862 break;
5863 }
5864
5865 case WE_GET_PPS_EOF_PAD_DELIM:
5866 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005867 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005868 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005869 WMI_VDEV_PPS_EOF_PAD_DELIM,
5870 PPS_CMD);
5871 break;
5872 }
5873
5874 case WE_GET_PPS_MACADDR_MISMATCH:
5875 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005876 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005877 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005878 WMI_VDEV_PPS_MACADDR_MISMATCH,
5879 PPS_CMD);
5880 break;
5881 }
5882
5883 case WE_GET_PPS_DELIM_CRC_FAIL:
5884 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005885 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005886 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005887 WMI_VDEV_PPS_DELIM_CRC_FAIL,
5888 PPS_CMD);
5889 break;
5890 }
5891
5892 case WE_GET_PPS_GID_NSTS_ZERO:
5893 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005894 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
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_GID_NSTS_ZERO,
5897 PPS_CMD);
5898 break;
5899 }
5900
5901 case WE_GET_PPS_RSSI_CHECK:
5902 {
5903
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005904 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005905 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005906 WMI_VDEV_PPS_RSSI_CHECK,
5907 PPS_CMD);
5908 break;
5909 }
5910
5911 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
5912 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005913 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005914 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005915 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
5916 QPOWER_CMD);
5917 break;
5918 }
5919
5920 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
5921 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005922 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005923 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005924 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
5925 QPOWER_CMD);
5926 break;
5927 }
5928
5929 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
5930 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005931 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005932 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005933 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
5934 QPOWER_CMD);
5935 break;
5936 }
5937
5938 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
5939 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005940 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005941 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005942 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
5943 QPOWER_CMD);
5944 break;
5945 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005946 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005947 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005948 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005949 case WE_GET_TEMPERATURE:
5950 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005951 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005952 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005953 break;
5954 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07005955 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07005956 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005957 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07005958 WMI_VDEV_PARAM_HE_DCM,
5959 VDEV_CMD);
5960 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07005961 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07005962 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005963 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07005964 WMI_VDEV_PARAM_HE_RANGE_EXT,
5965 VDEV_CMD);
5966 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005967 default:
5968 {
Jeff Johnson99bac312016-06-28 10:38:18 -07005969 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005970 value[0]);
5971 break;
5972 }
5973 }
Dustin Browne74003f2018-03-14 12:51:58 -07005974 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305975 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005976 return ret;
5977}
5978
5979static int iw_setnone_getint(struct net_device *dev,
5980 struct iw_request_info *info,
5981 union iwreq_data *wrqu, char *extra)
5982{
5983 int ret;
5984
5985 cds_ssr_protect(__func__);
5986 ret = __iw_setnone_getint(dev, info, wrqu, extra);
5987 cds_ssr_unprotect(__func__);
5988
5989 return ret;
5990}
5991
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05305992static int hdd_set_fwtest(int argc, int cmd, int value)
5993{
5994 struct set_fwtest_params *fw_test;
5995
5996 /* check for max number of arguments */
5997 if (argc > (WMA_MAX_NUM_ARGS) ||
5998 argc != HDD_FWTEST_PARAMS) {
5999 hdd_err("Too Many args %d", argc);
6000 return -EINVAL;
6001 }
6002 /*
6003 * check if number of arguments are 3 then, check
6004 * then set the default value for sounding interval.
6005 */
6006 if (HDD_FWTEST_PARAMS == argc) {
6007 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
6008 value = HDD_FWTEST_SU_DEFAULT_VALUE;
6009 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6010 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6011 }
6012 /* check sounding interval value should not exceed to max */
6013 if (value > HDD_FWTEST_MAX_VALUE) {
6014 hdd_err("Invalid arguments value should not exceed max: %d",
6015 value);
6016 return -EINVAL;
6017 }
6018 fw_test = qdf_mem_malloc(sizeof(*fw_test));
6019 if (NULL == fw_test) {
6020 hdd_err("qdf_mem_malloc failed for fw_test");
6021 return -ENOMEM;
6022 }
6023 fw_test->arg = cmd;
6024 fw_test->value = value;
6025 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6026 qdf_mem_free(fw_test);
6027 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6028 return -EINVAL;
6029 }
6030 return 0;
6031}
6032
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006033/**
6034 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6035 * @dev: device upon which the ioctl was received
6036 * @info: ioctl request information
6037 * @wrqu: ioctl request data
6038 * @extra: ioctl extra data
6039 *
6040 * Return: 0 on success, non-zero on error
6041 */
6042static int __iw_set_three_ints_getnone(struct net_device *dev,
6043 struct iw_request_info *info,
6044 union iwreq_data *wrqu, char *extra)
6045{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006046 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006047 int *value = (int *)extra;
6048 int sub_cmd = value[0];
6049 int ret;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006050 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006051
Dustin Brownfdf17c12018-03-14 12:55:34 -07006052 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306053
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006054 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006055 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006056 return -EPERM;
6057 }
6058
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006059 ret = wlan_hdd_validate_context(hdd_ctx);
6060 if (0 != ret)
6061 return ret;
6062
Jeff Johnson441e1f72017-02-07 08:50:49 -08006063 ret = hdd_check_private_wext_control(hdd_ctx, info);
6064 if (0 != ret)
6065 return ret;
6066
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006067 switch (sub_cmd) {
6068
6069 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006070 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6071 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006072 break;
6073 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306074 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006075 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306076
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006077 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6078 hdd_debug("Ioctl to set dual mac scan config");
Tushnim Bhattacharyya49ed8ab2017-05-26 18:20:10 -07006079 if (hdd_ctx->config->dual_mac_feature_disable ==
6080 DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006081 hdd_err("Dual mac feature is disabled from INI");
6082 return -EPERM;
6083 }
6084 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006085 policy_mgr_set_dual_mac_scan_config(hdd_ctx->hdd_psoc,
6086 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006087 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306088 case WE_SET_FW_TEST:
6089 {
6090 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6091 if (ret) {
6092 hdd_err("Not able to set fwtest %d", ret);
6093 return ret;
6094 }
6095 }
6096 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006097 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006098 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006099 break;
6100
6101 }
Dustin Browne74003f2018-03-14 12:51:58 -07006102 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006103 return ret;
6104}
6105
6106int iw_set_three_ints_getnone(struct net_device *dev,
6107 struct iw_request_info *info,
6108 union iwreq_data *wrqu, char *extra)
6109{
6110 int ret;
6111
6112 cds_ssr_protect(__func__);
6113 ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
6114 cds_ssr_unprotect(__func__);
6115
6116 return ret;
6117}
6118
6119/**
6120 * hdd_connection_state_string() - Get connection state string
6121 * @connection_state: enum to be converted to a string
6122 *
6123 * Return: the string equivalent of @connection_state
6124 */
6125static const char *
6126hdd_connection_state_string(eConnectionState connection_state)
6127{
6128 switch (connection_state) {
6129 CASE_RETURN_STRING(eConnectionState_NotConnected);
6130 CASE_RETURN_STRING(eConnectionState_Connecting);
6131 CASE_RETURN_STRING(eConnectionState_Associated);
6132 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6133 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6134 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6135 default:
6136 return "UNKNOWN";
6137 }
6138}
6139
Naveen Rawat910726a2017-03-06 11:42:51 -08006140#if defined(FEATURE_OEM_DATA_SUPPORT)
6141/**
6142 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6143 * wifi_pos api to get oem data caps
6144 * @dev: net device upon which the request was received
6145 * @info: ioctl request information
6146 * @wrqu: ioctl request data
6147 * @extra: ioctl data payload
6148 *
6149 * Return: 0 for success, negative errno value on failure
6150 */
6151static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6152 struct iw_request_info *info,
6153 union iwreq_data *wrqu, char *extra)
6154{
6155 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6156}
6157#elif defined(WIFI_POS_CONVERGED)
6158static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6159 struct iw_request_info *info,
6160 union iwreq_data *wrqu, char *extra)
6161{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006162 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006163 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006164
6165 return os_if_wifi_pos_populate_caps(hdd_ctx->hdd_psoc,
6166 (struct wifi_pos_driver_caps *)extra);
6167}
6168#else
6169static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6170 struct iw_request_info *info,
6171 union iwreq_data *wrqu, char *extra)
6172{
6173 return -ENOTSUPP;
6174}
6175#endif
6176
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006177/**
6178 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6179 * @dev: device upon which the ioctl was received
6180 * @info: ioctl request information
6181 * @wrqu: ioctl request data
6182 * @extra: ioctl extra data
6183 *
6184 * Return: 0 on success, non-zero on error
6185 */
6186static int __iw_get_char_setnone(struct net_device *dev,
6187 struct iw_request_info *info,
6188 union iwreq_data *wrqu, char *extra)
6189{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006190 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006191 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006192 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006193 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006194 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006195
Dustin Brownfdf17c12018-03-14 12:55:34 -07006196 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306197
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006198 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006199 ret = wlan_hdd_validate_context(hdd_ctx);
6200 if (0 != ret)
6201 return ret;
6202
Jeff Johnson441e1f72017-02-07 08:50:49 -08006203 ret = hdd_check_private_wext_control(hdd_ctx, info);
6204 if (0 != ret)
6205 return ret;
6206
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006207 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006208 switch (sub_cmd) {
6209 case WE_WLAN_VERSION:
6210 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006211 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6212 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006213 break;
6214 }
6215
6216 case WE_GET_STATS:
6217 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006218 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006219 extra, WE_MAX_STR_LEN);
6220 break;
6221 }
6222
Dustin Brownd9322482017-01-09 12:46:03 -08006223 case WE_GET_SUSPEND_RESUME_STATS:
6224 {
6225 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6226 WE_MAX_STR_LEN);
6227 if (ret >= 0) {
6228 wrqu->data.length = ret;
6229 ret = 0;
6230 }
6231
6232 break;
6233 }
6234
Govind Singha471e5e2015-10-12 17:11:14 +05306235 case WE_LIST_FW_PROFILE:
6236 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6237 extra, WE_MAX_STR_LEN);
6238 break;
6239
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006240 /* The case prints the current state of the HDD, SME, CSR, PE,
6241 * TL it can be extended for WDI Global State as well. And
6242 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6243 * and P2P_GO have not been added as of now.
6244 */
6245 case WE_GET_STATES:
6246 {
6247 int buf = 0, len = 0;
6248 int adapter_num = 0;
6249 int count = 0, check = 1;
6250
Jeff Johnsond377dce2017-10-04 10:32:42 -07006251 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006252
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006253 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson3d278b02017-08-29 14:17:47 -07006254 struct hdd_adapter *useAdapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006255
6256 /* Print wlan0 or p2p0 states based on the adapter_num
6257 * by using the correct adapter
6258 */
6259 while (adapter_num < 2) {
6260 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006261 useAdapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006262 buf =
6263 scnprintf(extra + len,
6264 WE_MAX_STR_LEN - len,
6265 "\n\n wlan0 States:-");
6266 len += buf;
6267 } else if (P2P_ADAPTER == adapter_num) {
6268 buf =
6269 scnprintf(extra + len,
6270 WE_MAX_STR_LEN - len,
6271 "\n\n p2p0 States:-");
6272 len += buf;
6273
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006274 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006275 buf =
6276 scnprintf(extra + len,
6277 WE_MAX_STR_LEN -
6278 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006279 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006280 len += buf;
6281 break;
6282 }
6283
6284 /* Printing p2p0 states only in the
6285 * case when the device is configured
6286 * as a p2p_client
6287 */
6288 useAdapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006289 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006290 QDF_P2P_CLIENT_MODE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006291 if (!useAdapter) {
6292 buf =
6293 scnprintf(extra + len,
6294 WE_MAX_STR_LEN -
6295 len,
6296 "\n Device not configured as P2P_CLIENT.");
6297 len += buf;
6298 break;
6299 }
6300 }
6301
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006302 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006303 buf = scnprintf(extra + len,
6304 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006305 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006306 len += buf;
6307 break;
6308 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006309 sta_ctx =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006310 WLAN_HDD_GET_STATION_CTX_PTR(useAdapter);
6311
6312
6313 buf =
6314 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6315 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006316 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006317 "\n Neighbour Roam State - %s"
6318 "\n CSR State - %s"
6319 "\n CSR Substate - %s",
6320 hdd_connection_state_string
Jeff Johnsond377dce2017-10-04 10:32:42 -07006321 (sta_ctx->conn_info.connState),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006322 mac_trace_get_neighbour_roam_state
6323 (sme_get_neighbor_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006324 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006325 mac_trace_getcsr_roam_state
6326 (sme_get_current_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006327 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006328 mac_trace_getcsr_roam_sub_state
6329 (sme_get_current_roam_sub_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006330 (mac_handle, useAdapter->session_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006331 );
6332 len += buf;
6333 adapter_num++;
6334 }
6335
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006336 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006337 /* Printing Lim State starting with global lim states */
6338 buf =
6339 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006340 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006341 "\n Global Sme State - %s "
6342 "\n Global mlm State - %s " "\n",
6343 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006344 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006345 mac_trace_get_lim_mlm_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006346 (sme_get_lim_sme_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006347 );
6348 len += buf;
6349
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006350 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006351 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006352 buf =
6353 scnprintf(extra + len,
6354 WE_MAX_STR_LEN -
6355 len,
6356 "\n Lim Valid Session %d:-"
6357 "\n PE Sme State - %s "
6358 "\n PE Mlm State - %s "
6359 "\n", check,
6360 mac_trace_get_lim_sme_state
6361 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006362 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006363 mac_trace_get_lim_mlm_state
6364 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006365 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006366 );
6367
6368 len += buf;
6369 check++;
6370 }
6371 count++;
6372 }
6373 }
6374
6375 wrqu->data.length = strlen(extra) + 1;
6376 break;
6377 }
6378
6379 case WE_GET_CFG:
6380 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006381 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006382 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006383 extra,
6384 QCSAP_IOCTL_MAX_STR_LEN);
6385 wrqu->data.length = strlen(extra) + 1;
6386 break;
6387 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006388 case WE_GET_RSSI:
6389 {
6390 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006391
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006392 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006393 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
6394 wrqu->data.length = strlen(extra) + 1;
6395 break;
6396 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006397
6398 case WE_GET_WMM_STATUS:
6399 {
6400 snprintf(extra, WE_MAX_STR_LEN,
6401 "\nDir: 0=up, 1=down, 3=both\n"
6402 "|------------------------|\n"
6403 "|AC | ACM |Admitted| Dir |\n"
6404 "|------------------------|\n"
6405 "|VO | %d | %3s | %d |\n"
6406 "|VI | %d | %3s | %d |\n"
6407 "|BE | %d | %3s | %d |\n"
6408 "|BK | %d | %3s | %d |\n"
6409 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006410 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006411 wmmAcStatus[SME_AC_VO].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006412 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006413 wmmAcStatus[SME_AC_VO].
6414 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006415 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006416 wmmAcStatus[SME_AC_VO].wmmAcTspecInfo.
6417 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006418 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006419 wmmAcStatus[SME_AC_VI].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006420 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006421 wmmAcStatus[SME_AC_VI].
6422 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006423 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006424 wmmAcStatus[SME_AC_VI].wmmAcTspecInfo.
6425 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006426 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006427 wmmAcStatus[SME_AC_BE].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006428 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006429 wmmAcStatus[SME_AC_BE].
6430 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006431 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006432 wmmAcStatus[SME_AC_BE].wmmAcTspecInfo.
6433 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006434 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006435 wmmAcStatus[SME_AC_BK].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006436 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006437 wmmAcStatus[SME_AC_BK].
6438 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006439 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006440 wmmAcStatus[SME_AC_BK].wmmAcTspecInfo.
6441 ts_info.direction);
6442
6443 wrqu->data.length = strlen(extra) + 1;
6444 break;
6445 }
6446 case WE_GET_CHANNEL_LIST:
6447 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306448 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006449 uint8_t i, len;
6450 char *buf;
6451 uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN];
6452 uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN;
Srinivas Girigowdac231df62017-03-24 18:27:57 -07006453 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006454
6455 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05306456 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006457 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306458 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006459 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006460 return -EINVAL;
6461 }
6462 buf = extra;
6463 /*
6464 * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN.
6465 * Maximum buffer needed = 5 * number of channels.
6466 * Check ifsufficient buffer is available and then
6467 * proceed to fill the buffer.
6468 */
6469 if (WE_MAX_STR_LEN <
6470 (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006471 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006472 return -EINVAL;
6473 }
6474 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
6475 channel_list.num_channels);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006476 if (QDF_STATUS_SUCCESS == sme_get_country_code(mac_handle,
6477 ubuf,
6478 &ubuf_len)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006479 /* Printing Country code in getChannelList */
6480 for (i = 0; i < (ubuf_len - 1); i++)
6481 len += scnprintf(buf + len,
6482 WE_MAX_STR_LEN - len,
6483 "%c", ubuf[i]);
6484 }
6485 for (i = 0; i < channel_list.num_channels; i++) {
6486 len +=
6487 scnprintf(buf + len, WE_MAX_STR_LEN - len,
6488 " %u", channel_list.channels[i]);
6489 }
6490 wrqu->data.length = strlen(extra) + 1;
6491
6492 break;
6493 }
6494#ifdef FEATURE_WLAN_TDLS
6495 case WE_GET_TDLS_PEERS:
6496 {
6497 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006498 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006499 WE_MAX_STR_LEN) + 1;
6500 break;
6501 }
6502#endif
6503#ifdef WLAN_FEATURE_11W
6504 case WE_GET_11W_INFO:
6505 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006506 struct csr_roam_profile *roam_profile =
6507 hdd_roam_profile(adapter);
6508
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006509 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006510 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006511
6512 snprintf(extra, WE_MAX_STR_LEN,
6513 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
6514 "\n Number of Unprotected Disassocs %d"
6515 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006516 roam_profile->BSSIDs.bssid->bytes[0],
6517 roam_profile->BSSIDs.bssid->bytes[1],
6518 roam_profile->BSSIDs.bssid->bytes[2],
6519 roam_profile->BSSIDs.bssid->bytes[3],
6520 roam_profile->BSSIDs.bssid->bytes[4],
6521 roam_profile->BSSIDs.bssid->bytes[5],
6522 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07006523 adapter->hdd_stats.hdd_pmf_stats.
6524 num_unprot_disassoc_rx,
6525 adapter->hdd_stats.hdd_pmf_stats.
6526 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006527
6528 wrqu->data.length = strlen(extra) + 1;
6529 break;
6530 }
6531#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006532 case WE_GET_IBSS_STA_INFO:
6533 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07006534 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006535 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006536 int idx = 0;
6537 int length = 0, buf = 0;
6538
Naveen Rawatc45d1622016-07-05 12:20:09 -07006539 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07006540 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07006541 sta_ctx->conn_info.staId[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006542 buf = snprintf
6543 ((extra + length),
6544 WE_MAX_STR_LEN - length,
6545 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnsond377dce2017-10-04 10:32:42 -07006546 sta_ctx->conn_info.staId[idx],
6547 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006548 peerMacAddress[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006549 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006550 peerMacAddress[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006551 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006552 peerMacAddress[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006553 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006554 peerMacAddress[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006555 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006556 peerMacAddress[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006557 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006558 peerMacAddress[idx].bytes[5]
6559 );
6560 length += buf;
6561 }
6562 }
6563 wrqu->data.length = strlen(extra) + 1;
6564 break;
6565 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006566 case WE_GET_PHYMODE:
6567 {
6568 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006569 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006570 eCsrPhyMode phymode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006571 enum band_info currBand;
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006572 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006573
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006574 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6575 if (!sme_config) {
6576 hdd_err("Out of memory");
6577 ret = -ENOMEM;
6578 break;
6579 }
6580
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006581 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006582 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006583 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006584 ch_bond24 = true;
6585
6586 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006587 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006588 ch_bond5g = true;
6589
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006590 qdf_mem_free(sme_config);
6591
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006592 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306593 if ((QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006594 sme_get_freq_band(mac_handle, &currBand))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006595 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006596 return -EIO;
6597 }
6598
6599 switch (phymode) {
6600 case eCSR_DOT11_MODE_AUTO:
6601 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
6602 break;
6603 case eCSR_DOT11_MODE_11n:
6604 case eCSR_DOT11_MODE_11n_ONLY:
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006605 if (currBand == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006606 if (ch_bond24)
6607 snprintf(extra, WE_MAX_STR_LEN,
6608 "11NGHT40");
6609 else
6610 snprintf(extra, WE_MAX_STR_LEN,
6611 "11NGHT20");
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006612 } else if (currBand == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006613 if (ch_bond5g)
6614 snprintf(extra, WE_MAX_STR_LEN,
6615 "11NAHT40");
6616 else
6617 snprintf(extra, WE_MAX_STR_LEN,
6618 "11NAHT20");
6619 } else {
6620 snprintf(extra, WE_MAX_STR_LEN, "11N");
6621 }
6622 break;
6623 case eCSR_DOT11_MODE_abg:
6624 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
6625 break;
6626 case eCSR_DOT11_MODE_11a:
6627 snprintf(extra, WE_MAX_STR_LEN, "11A");
6628 break;
6629 case eCSR_DOT11_MODE_11b:
6630 case eCSR_DOT11_MODE_11b_ONLY:
6631 snprintf(extra, WE_MAX_STR_LEN, "11B");
6632 break;
6633 case eCSR_DOT11_MODE_11g:
6634 case eCSR_DOT11_MODE_11g_ONLY:
6635 snprintf(extra, WE_MAX_STR_LEN, "11G");
6636 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006637 case eCSR_DOT11_MODE_11ac:
6638 case eCSR_DOT11_MODE_11ac_ONLY:
6639 if (hddctx->config->vhtChannelWidth ==
6640 eHT_CHANNEL_WIDTH_20MHZ)
6641 snprintf(extra, WE_MAX_STR_LEN,
6642 "11ACVHT20");
6643 else if (hddctx->config->vhtChannelWidth ==
6644 eHT_CHANNEL_WIDTH_40MHZ)
6645 snprintf(extra, WE_MAX_STR_LEN,
6646 "11ACVHT40");
6647 else if (hddctx->config->vhtChannelWidth ==
6648 eHT_CHANNEL_WIDTH_80MHZ)
6649 snprintf(extra, WE_MAX_STR_LEN,
6650 "11ACVHT80");
6651 else if (hddctx->config->vhtChannelWidth ==
6652 eHT_CHANNEL_WIDTH_160MHZ)
6653 snprintf(extra, WE_MAX_STR_LEN,
6654 "11ACVHT160");
6655 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006656 case eCSR_DOT11_MODE_11ax:
6657 case eCSR_DOT11_MODE_11ax_ONLY:
6658 /* currently using vhtChannelWidth */
6659 if (hddctx->config->vhtChannelWidth ==
6660 eHT_CHANNEL_WIDTH_20MHZ)
6661 snprintf(extra, WE_MAX_STR_LEN,
6662 "11AX_HE_20");
6663 else if (hddctx->config->vhtChannelWidth ==
6664 eHT_CHANNEL_WIDTH_40MHZ)
6665 snprintf(extra, WE_MAX_STR_LEN,
6666 "11AX_HE_40");
6667 else if (hddctx->config->vhtChannelWidth ==
6668 eHT_CHANNEL_WIDTH_80MHZ)
6669 snprintf(extra, WE_MAX_STR_LEN,
6670 "11AX_HE_80");
6671 else if (hddctx->config->vhtChannelWidth ==
6672 eHT_CHANNEL_WIDTH_160MHZ)
6673 snprintf(extra, WE_MAX_STR_LEN,
6674 "11AX_HE_160");
6675 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006676 }
6677
6678 wrqu->data.length = strlen(extra) + 1;
6679 break;
6680 }
6681
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006682 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08006683 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006684 case WE_GET_SNR:
6685 {
6686 int8_t s7snr = 0;
6687 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006688 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07006689 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006690
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006691 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006692 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05306693 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006694 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05306695
Jeff Johnsond377dce2017-10-04 10:32:42 -07006696 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006697 if (0 == hdd_ctx->config->fEnableSNRMonitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006698 eConnectionState_Associated !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07006699 sta_ctx->conn_info.connState) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006700 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006701 hdd_ctx->config->fEnableSNRMonitoring,
Jeff Johnsond377dce2017-10-04 10:32:42 -07006702 sta_ctx->conn_info.connState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006703 return -ENONET;
6704 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006705 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006706 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
6707 wrqu->data.length = strlen(extra) + 1;
6708 break;
6709 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006710
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006711 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006712 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006713 break;
6714 }
Dustin Brownd9322482017-01-09 12:46:03 -08006715
Dustin Browne74003f2018-03-14 12:51:58 -07006716 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08006717 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006718}
6719
6720static int iw_get_char_setnone(struct net_device *dev,
6721 struct iw_request_info *info,
6722 union iwreq_data *wrqu, char *extra)
6723{
6724 int ret;
6725
6726 cds_ssr_protect(__func__);
6727 ret = __iw_get_char_setnone(dev, info, wrqu, extra);
6728 cds_ssr_unprotect(__func__);
6729
6730 return ret;
6731}
6732
6733/**
6734 * iw_setnone_getnone() - Generic "action" private ioctl handler
6735 * @dev: device upon which the ioctl was received
6736 * @info: ioctl request information
6737 * @wrqu: ioctl request data
6738 * @extra: ioctl extra data
6739 *
6740 * Return: 0 on success, non-zero on error
6741 */
6742static int __iw_setnone_getnone(struct net_device *dev,
6743 struct iw_request_info *info,
6744 union iwreq_data *wrqu, char *extra)
6745{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006746 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006747 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006748 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006749 int ret;
6750 int sub_cmd;
6751
Dustin Brownfdf17c12018-03-14 12:55:34 -07006752 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306753
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006754 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006755 ret = wlan_hdd_validate_context(hdd_ctx);
6756 if (0 != ret)
6757 return ret;
6758
Jeff Johnson441e1f72017-02-07 08:50:49 -08006759 ret = hdd_check_private_wext_control(hdd_ctx, info);
6760 if (0 != ret)
6761 return ret;
6762
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006763#ifdef CONFIG_COMPAT
6764 /* this ioctl is a special case where a sub-ioctl is used and both
6765 * the number of get and set args is 0. in this specific case the
6766 * logic in iwpriv places the sub_cmd in the data.flags portion of
6767 * the iwreq. unfortunately the location of this field will be
6768 * different between 32-bit and 64-bit userspace, and the standard
6769 * compat support in the kernel does not handle this case. so we
6770 * need to explicitly handle it here.
6771 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07006772 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006773 struct compat_iw_point *compat_iw_point =
6774 (struct compat_iw_point *)&wrqu->data;
6775 sub_cmd = compat_iw_point->flags;
6776 } else {
6777 sub_cmd = wrqu->data.flags;
6778 }
6779#else
6780 sub_cmd = wrqu->data.flags;
6781#endif
6782
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006783 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006784 switch (sub_cmd) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006785
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006786 case WE_GET_RECOVERY_STAT:
6787 sme_get_recovery_stats(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006788 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006789
Govind Singha471e5e2015-10-12 17:11:14 +05306790 case WE_GET_FW_PROFILE_DATA:
Jeff Johnson1b780e42017-10-31 14:11:45 -07006791 ret = wma_cli_set_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05306792 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
6793 0, DBG_CMD);
6794 break;
6795
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006796 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006797 hdd_wlan_get_ibss_peer_info_all(adapter);
6798 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006799
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006800 case WE_SET_REASSOC_TRIGGER:
6801 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07006802 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306803 tSirMacAddr bssid;
Krunal Sonibfd05492017-10-03 15:48:37 -07006804 uint32_t roamId = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306805 uint8_t operating_ch =
Jeff Johnsonb9424862017-10-30 08:49:35 -07006806 adapter->session.station.conn_info.operationChannel;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006807 tCsrRoamModifyProfileFields modProfileFields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006808
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006809 sme_get_modify_profile_fields(mac_handle, adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006810 &modProfileFields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306811 if (roaming_offload_enabled(hdd_ctx)) {
6812 qdf_mem_copy(bssid,
Jeff Johnsonb9424862017-10-30 08:49:35 -07006813 &adapter->session.station.conn_info.bssId,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306814 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08006815 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306816 bssid, operating_ch);
6817 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006818 sme_roam_reassoc(mac_handle, adapter->session_id,
6819 NULL, modProfileFields, &roamId, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05306820 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006821 return 0;
6822 }
6823
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006824 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006825 /*
6826 * 1.OBSS Scan is mandatory while operating in 2.4GHz
6827 * 2.OBSS scan is stopped by Firmware during the disassociation
6828 * 3.OBSS stop comamnd is added for debugging purpose
6829 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006830 if (!mac_handle) {
6831 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006832 return -EINVAL;
6833 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006834 sme_ht40_stop_obss_scan(mac_handle, adapter->session_id);
6835 break;
6836
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006837 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006838 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006839 break;
6840 }
Dustin Browne74003f2018-03-14 12:51:58 -07006841 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006842 return ret;
6843}
6844
6845static int iw_setnone_getnone(struct net_device *dev,
6846 struct iw_request_info *info,
6847 union iwreq_data *wrqu, char *extra)
6848{
6849 int ret;
6850
6851 cds_ssr_protect(__func__);
6852 ret = __iw_setnone_getnone(dev, info, wrqu, extra);
6853 cds_ssr_unprotect(__func__);
6854
6855 return ret;
6856}
6857
Krunal Sonia6e505b2017-01-12 12:25:18 -08006858#ifdef MPC_UT_FRAMEWORK
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006859static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07006860 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08006861{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08006862 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08006863 case WE_POLICY_MANAGER_CLIST_CMD:
6864 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006865 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306866 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306867 (apps_args[2] < 0) || (apps_args[3] < 0) ||
6868 (apps_args[4] < 0) || (apps_args[5] < 0) ||
6869 (apps_args[6] < 0) || (apps_args[7] < 0)) {
6870 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306871 return 0;
6872 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006873 policy_mgr_incr_connection_count_utfw(hdd_ctx->hdd_psoc,
6874 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
6875 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006876 }
6877 break;
6878
6879 case WE_POLICY_MANAGER_DLIST_CMD:
6880 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006881 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306882 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306883 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306884 return 0;
6885 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006886 policy_mgr_decr_connection_count_utfw(hdd_ctx->hdd_psoc,
6887 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006888 }
6889 break;
6890
6891 case WE_POLICY_MANAGER_ULIST_CMD:
6892 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006893 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306894 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306895 (apps_args[2] < 0) || (apps_args[3] < 0) ||
6896 (apps_args[4] < 0) || (apps_args[5] < 0) ||
6897 (apps_args[6] < 0) || (apps_args[7] < 0)) {
6898 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306899 return 0;
6900 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006901 policy_mgr_update_connection_info_utfw(hdd_ctx->hdd_psoc,
6902 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
6903 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006904 }
6905 break;
6906
6907 case WE_POLICY_MANAGER_DBS_CMD:
6908 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006909 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08006910 if (apps_args[0] == 0)
6911 wma_set_dbs_capability_ut(0);
6912 else
6913 wma_set_dbs_capability_ut(1);
6914
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006915 if (apps_args[1] >= PM_THROUGHPUT &&
6916 apps_args[1] <= PM_LATENCY) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08006917 pr_info("setting system pref to [%d]\n", apps_args[1]);
6918 hdd_ctx->config->conc_system_pref = apps_args[1];
6919 }
6920 }
6921 break;
6922
6923 case WE_POLICY_MANAGER_PCL_CMD:
6924 {
6925 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
6926 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
6927 uint32_t pcl_len = 0, i = 0;
6928
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07006929 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08006930
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306931 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306932 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306933 return 0;
6934 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006935 policy_mgr_get_pcl(hdd_ctx->hdd_psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08006936 pcl, &pcl_len,
6937 weight_list, QDF_ARRAY_SIZE(weight_list));
6938 pr_info("PCL list for role[%d] is {", apps_args[0]);
6939 for (i = 0 ; i < pcl_len; i++)
6940 pr_info(" %d, ", pcl[i]);
6941 pr_info("}--------->\n");
6942 }
6943 break;
6944
6945 case WE_POLICY_SET_HW_MODE_CMD:
6946 {
6947 if (apps_args[0] == 0) {
6948 hdd_err("set hw mode for single mac");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006949 policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc,
Jeff Johnson1b780e42017-10-31 14:11:45 -07006950 adapter->session_id,
Krunal Sonia6e505b2017-01-12 12:25:18 -08006951 HW_MODE_SS_2x2,
6952 HW_MODE_80_MHZ,
6953 HW_MODE_SS_0x0, HW_MODE_BW_NONE,
6954 HW_MODE_DBS_NONE,
6955 HW_MODE_AGILE_DFS_NONE,
6956 HW_MODE_SBS_NONE,
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07006957 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006958 } else if (apps_args[0] == 1) {
6959 hdd_err("set hw mode for dual mac");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006960 policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc,
Jeff Johnson1b780e42017-10-31 14:11:45 -07006961 adapter->session_id,
Krunal Sonia6e505b2017-01-12 12:25:18 -08006962 HW_MODE_SS_1x1,
6963 HW_MODE_80_MHZ,
6964 HW_MODE_SS_1x1, HW_MODE_40_MHZ,
6965 HW_MODE_DBS,
6966 HW_MODE_AGILE_DFS_NONE,
6967 HW_MODE_SBS_NONE,
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07006968 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006969 }
6970 }
6971 break;
6972
6973 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
6974 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07006975 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306976 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306977 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306978 return 0;
6979 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07006980 policy_mgr_current_connections_update(
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006981 hdd_ctx->hdd_psoc,
Jeff Johnson1b780e42017-10-31 14:11:45 -07006982 adapter->session_id, apps_args[0],
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07006983 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08006984 }
6985 break;
6986
6987 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
6988 {
6989 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006990
Dustin Brown5e89ef82018-03-14 11:50:23 -07006991 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306992 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05306993 (apps_args[2] < 0)) {
6994 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05306995 return 0;
6996 }
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006997 allow = policy_mgr_allow_concurrency(hdd_ctx->hdd_psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08006998 apps_args[0], apps_args[1], apps_args[2]);
6999 pr_info("allow %d {0 = don't allow, 1 = allow}", allow);
7000 }
7001 break;
7002
7003 case WE_POLICY_MANAGER_SCENARIO_CMD:
7004 {
7005 clean_report(hdd_ctx);
7006 if (apps_args[0] == 1) {
7007 wlan_hdd_one_connection_scenario(hdd_ctx);
7008 } else if (apps_args[0] == 2) {
7009 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007010 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007011 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007012 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007013 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007014 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007015 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007016 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007017 } else if (apps_args[0] == 3) {
7018 /* MCC on same band with 2x2 same mac*/
7019 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007020 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007021 /* MCC on diff band with 2x2 same mac*/
7022 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007023 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007024 /* MCC on diff band with 1x1 diff mac */
7025 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007026 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007027 /* MCC on diff band with 1x1 same mac */
7028 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007029 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007030 /* SCC on same band with 2x2 same mac */
7031 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007032 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007033 /* SCC on same band with 1x1 same mac */
7034 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007035 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007036 /* MCC on same band with 2x2 same mac */
7037 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007038 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007039 /* MCC on same band with 1x1 same mac */
7040 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007041 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007042 }
7043 print_report(hdd_ctx);
7044 }
7045 break;
7046 }
7047 return 0;
7048}
7049#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007050static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007051 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007052{
7053 return 0;
7054}
7055#endif
7056
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007057/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007058 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7059 * @hdd_ctx: hdd_context
7060 * @num_args: input args number
7061 * @apps_args: args data ptr
7062 *
7063 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7064 *
7065 * Return: void
7066 */
7067#if WLAN_DEBUG
7068static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7069 int num_args, int *apps_args)
7070{
7071 struct ch_avoid_ind_type ch_avoid;
7072 int cnt = 0, i;
7073
7074 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7075 num_args % 2 != 0)
7076 return;
7077 hdd_info("simulate ch avoid num_args %d", num_args);
7078 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7079 ch_avoid.avoid_freq_range[cnt].start_freq =
7080 apps_args[i];
7081 ch_avoid.avoid_freq_range[cnt].end_freq =
7082 apps_args[++i];
7083
7084 hdd_info("simulate ch avoid [%d %d]",
7085 ch_avoid.avoid_freq_range[cnt].start_freq,
7086 ch_avoid.avoid_freq_range[cnt].end_freq);
7087 cnt++;
7088 }
7089 ch_avoid.ch_avoid_range_cnt = cnt;
7090 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->hdd_psoc, &ch_avoid);
7091}
7092#else
7093static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7094 int num_args, int *apps_args)
7095{
7096}
7097#endif
7098/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007099 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7100 * @dev: device upon which the ioctl was received
7101 * @info: ioctl request information
7102 * @wrqu: ioctl request data
7103 * @extra: ioctl extra data
7104 *
7105 * This is an SSR-protected generic handler for private ioctls which
7106 * take multiple arguments. Note that this implementation is also
7107 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7108 * interfaces.
7109 *
7110 * Return: 0 on success, non-zero on error
7111 */
7112static int __iw_set_var_ints_getnone(struct net_device *dev,
7113 struct iw_request_info *info,
7114 union iwreq_data *wrqu, char *extra)
7115{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007116 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007117 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007118 int sub_cmd;
7119 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007120 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007121 int ret, num_args;
chenguoaa7c90c2018-05-24 17:08:47 +08007122 void *soc = NULL;
7123 struct cdp_pdev *pdev = NULL;
7124 struct cdp_vdev *vdev = NULL;
7125 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007126
Dustin Brownfdf17c12018-03-14 12:55:34 -07007127 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307128
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007129 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007130 ret = wlan_hdd_validate_context(hdd_ctx);
7131 if (0 != ret)
7132 return ret;
7133
Jeff Johnson441e1f72017-02-07 08:50:49 -08007134 ret = hdd_check_private_wext_control(hdd_ctx, info);
7135 if (0 != ret)
7136 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007137
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007138 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007139 sub_cmd = wrqu->data.flags;
7140 num_args = wrqu->data.length;
7141
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007142 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007143
7144 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007145 case WE_IBSS_GET_PEER_INFO:
7146 {
7147 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007148 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007149 }
7150 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007151
7152 case WE_P2P_NOA_CMD:
7153 {
Srinivas Girigowda5d5fdc52017-03-24 22:30:57 -07007154 struct p2p_app_set_ps p2pNoA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007155
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007156 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007157 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
7158 hdd_device_mode_to_string(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007159 adapter->device_mode),
7160 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007161 return -EINVAL;
7162 }
7163
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007164 p2pNoA.opp_ps = apps_args[0];
7165 p2pNoA.ctWindow = apps_args[1];
7166 p2pNoA.duration = apps_args[2];
7167 p2pNoA.interval = apps_args[3];
7168 p2pNoA.count = apps_args[4];
7169 p2pNoA.single_noa_duration = apps_args[5];
7170 p2pNoA.psSelection = apps_args[6];
7171
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007172 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 -07007173 apps_args[0], apps_args[1], apps_args[2],
7174 apps_args[3], apps_args[4],
7175 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007176
7177 hdd_set_p2p_ps(dev, &p2pNoA);
7178
7179 }
7180 break;
7181
7182 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7183 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007184 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007185 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307186 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007187 }
7188 break;
7189
7190 case WE_MTRACE_DUMP_CMD:
7191 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007192 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007193 apps_args[0], apps_args[1],
7194 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007195 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007196 apps_args[1], apps_args[2],
7197 apps_args[3]);
7198
7199 }
7200 break;
7201
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007202 case WE_POLICY_MANAGER_CINFO_CMD:
7203 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007204 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007205 uint32_t i = 0, len = 0;
7206
Krunal Sonia6e505b2017-01-12 12:25:18 -08007207 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007208 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007209 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007210 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007211 pr_info("|table_index[%d]\t\t\n", i);
7212 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
7213 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
7214 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7215 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7216 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7217 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7218 pr_info("+--------------------------+\n");
7219 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007220 }
7221 }
7222 break;
7223
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007224 case WE_UNIT_TEST_CMD:
7225 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007226 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007227
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007228 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7229 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007230 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007231 return -EINVAL;
7232 }
Krunal Soniaadaa272017-10-04 16:42:55 -07007233 if ((apps_args[1] >= (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307234 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007235 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007236 return -EINVAL;
7237 }
Jeff Johnson1b780e42017-10-31 14:11:45 -07007238 status = sme_send_unit_test_cmd(adapter->session_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007239 apps_args[0],
7240 apps_args[1],
7241 &apps_args[2]);
7242 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007243 hdd_err("sme_send_unit_test_cmd returned %d", status);
7244 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007245 }
7246 }
7247 break;
7248#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7249 case WE_LED_FLASHING_PARAM:
7250 {
7251 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007252
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007253 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007254 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007255 return -EINVAL;
7256 }
7257 for (i = 0; i < num_args; i++) {
7258 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007259 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007260 return -EINVAL;
7261 }
7262 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007263 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007264 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007265 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007266 1, apps_args[2], apps_args[3]);
7267 }
7268 break;
7269#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05307270 case WE_SET_PKTLOG:
7271 {
7272 int ret;
7273
7274 if (num_args < 1 || num_args > 2) {
7275 hdd_err("pktlog: either 1 or 2 parameters are required");
7276 return -EINVAL;
7277 }
7278
7279 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
7280 apps_args[1]);
7281 if (ret)
7282 return ret;
7283 break;
7284 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05307285 case WE_MAC_PWR_DEBUG_CMD:
7286 {
7287 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05307288 int i, j;
7289
7290 if (num_args < 3) {
7291 hdd_err("number of arguments can't be null %d",
7292 num_args);
7293 return -EINVAL;
7294 }
7295 if (num_args - 3 != apps_args[2]) {
7296 hdd_err("arg list of size %d doesn't match num_args %d",
7297 num_args-3, apps_args[2]);
7298 return -EINVAL;
7299 }
7300 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
7301 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
7302 hdd_err("Invalid MODULE ID %d", apps_args[1]);
7303 return -EINVAL;
7304 }
7305 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
7306 hdd_err("Too Many args %d", apps_args[2]);
7307 return -EINVAL;
7308 }
7309 mac_pwr_dbg_args.pdev_id = apps_args[0];
7310 mac_pwr_dbg_args.module_id = apps_args[1];
7311 mac_pwr_dbg_args.num_args = apps_args[2];
7312
7313 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
7314 mac_pwr_dbg_args.args[i] = apps_args[j];
7315
7316 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007317 sme_process_mac_pwr_dbg_cmd(mac_handle,
7318 adapter->session_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05307319 &mac_pwr_dbg_args)) {
7320 return -EINVAL;
7321 }
7322 }
7323 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08007324 case WE_POLICY_MANAGER_CLIST_CMD:
7325 case WE_POLICY_MANAGER_DLIST_CMD:
7326 case WE_POLICY_MANAGER_ULIST_CMD:
7327 case WE_POLICY_MANAGER_DBS_CMD:
7328 case WE_POLICY_MANAGER_PCL_CMD:
7329 case WE_POLICY_SET_HW_MODE_CMD:
7330 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7331 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7332 case WE_POLICY_MANAGER_SCENARIO_CMD:
7333 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007334 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Sonia6e505b2017-01-12 12:25:18 -08007335 sub_cmd, apps_args);
7336 }
7337 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007338 case WE_SET_CHAN_AVOID:
7339 {
7340 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
7341 }
7342 break;
chenguoaa7c90c2018-05-24 17:08:47 +08007343 case WE_SET_TXRX_STATS:
7344 {
7345 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
7346 adapter->session_id);
7347
7348 if (ret != 0) {
7349 hdd_err("Invalid handles");
7350 break;
7351 }
7352
7353 req.stats = apps_args[0];
7354 /* default value of secondary parameter is 0(mac_id) */
7355 req.mac_id = apps_args[1];
7356
7357 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
7358 req.stats, req.mac_id);
7359 ret = cdp_txrx_stats_request(soc, vdev, &req);
7360 break;
7361 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007362 default:
7363 {
Jeff Johnson99bac312016-06-28 10:38:18 -07007364 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007365 }
7366 break;
7367 }
Dustin Browne74003f2018-03-14 12:51:58 -07007368 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007369 return 0;
7370}
7371
7372/**
7373 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
7374 * @dev: pointer to net_device structure
7375 * @info: pointer to iw_request_info structure
7376 * @wrqu: pointer to iwreq_data
7377 * @extra; extra
7378 *
7379 * Return: 0 on success, error number otherwise
7380 *
7381 */
7382static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
7383 struct iw_request_info *info,
7384 union iwreq_data *wrqu, char *extra)
7385{
7386 union iwreq_data u_priv_wrqu;
7387 int apps_args[MAX_VAR_ARGS] = {0};
7388 int ret, num_args;
7389
Mukul Sharma64a70e82015-11-02 20:05:09 +05307390 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007391 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05307392 return -EPERM;
7393 }
7394
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007395 /* Helper function to get iwreq_data with compat handling. */
7396 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
7397 return -EINVAL;
7398
7399 if (NULL == u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007400 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007401 return -EINVAL;
7402 }
7403
7404 num_args = u_priv_wrqu.data.length;
7405 if (num_args > MAX_VAR_ARGS)
7406 num_args = MAX_VAR_ARGS;
7407
7408 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
7409 (sizeof(int)) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007410 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007411 return -EFAULT;
7412 }
7413
7414 cds_ssr_protect(__func__);
7415 ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
7416 (char *)&apps_args);
7417 cds_ssr_unprotect(__func__);
7418 return ret;
7419}
7420
7421/**
7422 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7423 * @dev: device upon which the ioctl was received
7424 * @info: ioctl request information
7425 * @wrqu: ioctl request data
7426 * @extra: ioctl extra data
7427 *
7428 * This is a generic handler for private ioctls which take multiple
7429 * arguments. Note that this implementation is also somewhat unique
7430 * in that it is shared by both STA-mode and SAP-mode interfaces.
7431 *
7432 * Return: 0 on success, non-zero on error
7433 */
7434int iw_set_var_ints_getnone(struct net_device *dev,
7435 struct iw_request_info *info,
7436 union iwreq_data *wrqu, char *extra)
7437{
7438 int ret;
7439
7440 cds_ssr_protect(__func__);
7441 ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
7442 cds_ssr_unprotect(__func__);
7443 return ret;
7444}
7445
7446/**
7447 * iw_add_tspec - Add TSpec private ioctl handler
7448 * @dev: device upon which the ioctl was received
7449 * @info: ioctl request information
7450 * @wrqu: ioctl request data
7451 * @extra: ioctl extra data
7452 *
7453 * Return: 0 on success, non-zero on error
7454 */
7455static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
7456 union iwreq_data *wrqu, char *extra)
7457{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007458 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07007459 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007460 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7461 int params[HDD_WLAN_WMM_PARAM_COUNT];
Abhishek Singh12be60f2017-08-11 13:52:42 +05307462 struct sme_qos_wmmtspecinfo tSpec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007463 uint32_t handle;
7464 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007465 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007466 int ret;
7467
Dustin Brownfdf17c12018-03-14 12:55:34 -07007468 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307469
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007470 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007471 ret = wlan_hdd_validate_context(hdd_ctx);
7472 if (0 != ret)
7473 return ret;
7474
Jeff Johnson441e1f72017-02-07 08:50:49 -08007475 ret = hdd_check_private_wext_control(hdd_ctx, info);
7476 if (0 != ret)
7477 return ret;
7478
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007479 /* make sure the application is sufficiently priviledged */
7480 /* note that the kernel will do this for "set" ioctls, but since */
7481 /* this ioctl wants to return status to user space it must be */
7482 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007483 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007484 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007485
7486 /* we must be associated in order to add a tspec */
Jeff Johnsond377dce2017-10-04 10:32:42 -07007487 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007488 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7489 return 0;
7490 }
7491 /* since we are defined to be a "get" ioctl, and since the number */
7492 /* of params exceeds the number of params that wireless extensions */
7493 /* will pass down in the iwreq_data, we must copy the "set" params. */
7494 /* We must handle the compat for iwreq_data in 32U/64K environment. */
7495
7496 /* helper function to get iwreq_data with compat handling. */
7497 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
7498 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7499 return 0;
7500 }
7501 /* make sure all params are correctly passed to function */
7502 if ((NULL == s_priv_data.pointer) ||
7503 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
7504 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7505 return 0;
7506 }
7507 /* from user space ourselves */
7508 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
7509 /* hmmm, can't get them */
7510 return -EIO;
7511 }
7512 /* clear the tspec */
7513 memset(&tSpec, 0, sizeof(tSpec));
7514
7515 /* validate the handle */
7516 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7517 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7518 /* that one is reserved */
7519 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7520 return 0;
7521 }
7522 /* validate the TID */
7523 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
7524 /* out of range */
7525 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7526 return 0;
7527 }
7528 tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
7529
7530 /* validate the direction */
7531 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
7532 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
7533 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
7534 break;
7535
7536 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
7537 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
7538 break;
7539
7540 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
7541 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
7542 break;
7543
7544 default:
7545 /* unknown */
7546 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7547 return 0;
7548 }
7549
7550 tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
7551
7552 /* validate the user priority */
7553 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
7554 /* out of range */
7555 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7556 return 0;
7557 }
7558 tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
7559 if (0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007560 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007561 return 0;
7562 }
7563
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007564 hdd_debug("TS_INFO PSB %d UP %d !!!",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007565 tSpec.ts_info.psb, tSpec.ts_info.up);
7566
7567 tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
7568 tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
7569 tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
7570 tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
7571 tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
7572 tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
7573 tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
7574 tSpec.surplus_bw_allowance =
7575 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
7576 tSpec.min_service_interval =
7577 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
7578 tSpec.max_service_interval =
7579 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
7580 tSpec.suspension_interval =
7581 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
7582 tSpec.inactivity_interval =
7583 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
7584
7585 tSpec.ts_info.burst_size_defn =
7586 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
7587
7588 /* validate the ts info ack policy */
7589 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
7590 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK:
7591 tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
7592 break;
7593
7594 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
7595 tSpec.ts_info.ack_policy =
7596 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
7597 break;
7598
7599 default:
7600 /* unknown */
7601 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7602 return 0;
7603 }
7604
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007605 *pStatus = hdd_wmm_addts(adapter, handle, &tSpec);
Dustin Browne74003f2018-03-14 12:51:58 -07007606 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007607 return 0;
7608}
7609
7610static int iw_add_tspec(struct net_device *dev,
7611 struct iw_request_info *info,
7612 union iwreq_data *wrqu, char *extra)
7613{
7614 int ret;
7615
7616 cds_ssr_protect(__func__);
7617 ret = __iw_add_tspec(dev, info, wrqu, extra);
7618 cds_ssr_unprotect(__func__);
7619
7620 return ret;
7621}
7622
7623/**
7624 * iw_del_tspec - Delete TSpec private ioctl handler
7625 * @dev: device upon which the ioctl was received
7626 * @info: ioctl request information
7627 * @wrqu: ioctl request data
7628 * @extra: ioctl extra data
7629 *
7630 * Return: 0 on success, non-zero on error
7631 */
7632static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
7633 union iwreq_data *wrqu, char *extra)
7634{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007635 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007636 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007637 int *params = (int *)extra;
7638 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7639 uint32_t handle;
7640 int ret;
7641
Dustin Brownfdf17c12018-03-14 12:55:34 -07007642 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307643
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007644 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007645 ret = wlan_hdd_validate_context(hdd_ctx);
7646 if (0 != ret)
7647 return ret;
7648
Jeff Johnson441e1f72017-02-07 08:50:49 -08007649 ret = hdd_check_private_wext_control(hdd_ctx, info);
7650 if (0 != ret)
7651 return ret;
7652
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007653 /* make sure the application is sufficiently priviledged */
7654 /* note that the kernel will do this for "set" ioctls, but since */
7655 /* this ioctl wants to return status to user space it must be */
7656 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007657 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007658 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007659
7660 /* although we are defined to be a "get" ioctl, the params we require */
7661 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
7662 /* is no need to copy the params from user space */
7663
7664 /* validate the handle */
7665 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7666 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7667 /* that one is reserved */
7668 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7669 return 0;
7670 }
7671
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007672 *pStatus = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07007673 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007674 return 0;
7675}
7676
7677static int iw_del_tspec(struct net_device *dev,
7678 struct iw_request_info *info,
7679 union iwreq_data *wrqu, char *extra)
7680{
7681 int ret;
7682
7683 cds_ssr_protect(__func__);
7684 ret = __iw_del_tspec(dev, info, wrqu, extra);
7685 cds_ssr_unprotect(__func__);
7686
7687 return ret;
7688}
7689
7690/**
7691 * iw_get_tspec - Get TSpec private ioctl handler
7692 * @dev: device upon which the ioctl was received
7693 * @info: ioctl request information
7694 * @wrqu: ioctl request data
7695 * @extra: ioctl extra data
7696 *
7697 * Return: 0 on success, non-zero on error
7698 */
7699static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
7700 union iwreq_data *wrqu, char *extra)
7701{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007702 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007703 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007704 int *params = (int *)extra;
7705 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7706 uint32_t handle;
7707 int ret;
7708
Dustin Brownfdf17c12018-03-14 12:55:34 -07007709 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307710
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007711 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007712 ret = wlan_hdd_validate_context(hdd_ctx);
7713 if (0 != ret)
7714 return ret;
7715
Jeff Johnson441e1f72017-02-07 08:50:49 -08007716 ret = hdd_check_private_wext_control(hdd_ctx, info);
7717 if (0 != ret)
7718 return ret;
7719
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007720 /* although we are defined to be a "get" ioctl, the params we require */
7721 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
7722 /* is no need to copy the params from user space */
7723
7724 /* validate the handle */
7725 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7726 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7727 /* that one is reserved */
7728 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7729 return 0;
7730 }
7731
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007732 *pStatus = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07007733 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007734 return 0;
7735}
7736
7737static int iw_get_tspec(struct net_device *dev,
7738 struct iw_request_info *info,
7739 union iwreq_data *wrqu, char *extra)
7740{
7741 int ret;
7742
7743 cds_ssr_protect(__func__);
7744 ret = __iw_get_tspec(dev, info, wrqu, extra);
7745 cds_ssr_unprotect(__func__);
7746
7747 return ret;
7748}
7749
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007750/**
7751 * iw_set_fties - Set FT IEs private ioctl handler
7752 * @dev: device upon which the ioctl was received
7753 * @info: ioctl request information
7754 * @wrqu: ioctl request data
7755 * @extra: ioctl extra data
7756 *
7757 * Each time the supplicant has the auth_request or reassoc request
7758 * IEs ready they are pushed to the driver. The driver will in turn
7759 * use it to send out the auth req and reassoc req for 11r FT Assoc.
7760 *
7761 * Return: 0 on success, non-zero on error
7762 */
7763static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
7764 union iwreq_data *wrqu, char *extra)
7765{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007766 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07007767 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007768 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007769 int ret;
7770
Dustin Brownfdf17c12018-03-14 12:55:34 -07007771 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307772
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007773 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007774 ret = wlan_hdd_validate_context(hdd_ctx);
7775 if (0 != ret)
7776 return ret;
7777
Jeff Johnson441e1f72017-02-07 08:50:49 -08007778 ret = hdd_check_private_wext_control(hdd_ctx, info);
7779 if (0 != ret)
7780 return ret;
7781
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007782 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007783 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007784 return -EINVAL;
7785 }
7786 if (wrqu->data.pointer == NULL) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007787 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007788 return -EINVAL;
7789 }
7790 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsond377dce2017-10-04 10:32:42 -07007791 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007792 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007793 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007794 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007795 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007796 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007797
7798 /* Pass the received FT IEs to SME */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007799 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->session_id,
7800 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07007801 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007802 return 0;
7803}
7804
7805static int iw_set_fties(struct net_device *dev,
7806 struct iw_request_info *info,
7807 union iwreq_data *wrqu, char *extra)
7808{
7809 int ret;
7810
7811 cds_ssr_protect(__func__);
7812 ret = __iw_set_fties(dev, info, wrqu, extra);
7813 cds_ssr_unprotect(__func__);
7814
7815 return ret;
7816}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007817
Dustin Brown0cbc7572016-12-16 13:54:40 -08007818/**
7819 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
7820 * @dev: device upon which the ioctl was received
7821 * @info: ioctl request information
7822 * @wrqu: ioctl request data
7823 * @extra: ioctl extra data
7824 *
Dustin Brown860566f2017-01-31 15:24:43 -08007825 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
7826 * time being to provide guidance in migrating to standard APIs.
7827 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08007828 * Return: 0 on success, non-zero on error
7829 */
7830static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
7831 struct iw_request_info *info,
7832 union iwreq_data *wrqu,
7833 char *extra)
7834{
Dustin Brown860566f2017-01-31 15:24:43 -08007835 hdd_err("\n"
7836 "setMCBCFilter is obsolete. Use the following instead:\n"
7837 "Configure multicast filtering via the ‘ip’ command.\n"
7838 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
7839 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
7840 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
7841 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
7842 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007843 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08007844}
7845
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007846/**
7847 * iw_set_host_offload - Set host offload ioctl handler
7848 * @dev: device upon which the ioctl was received
7849 * @info: ioctl request information
7850 * @wrqu: ioctl request data
7851 * @extra: ioctl extra data
7852 *
7853 * Return: 0 on success, non-zero on error
7854 */
7855static int __iw_set_host_offload(struct net_device *dev,
7856 struct iw_request_info *info,
7857 union iwreq_data *wrqu, char *extra)
7858{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007859 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Srinivas Girigowda077143e2017-03-25 10:47:27 -07007860 struct host_offload_req *pRequest = (struct host_offload_req *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007861 tSirHostOffloadReq offloadRequest;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007862 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007863 int ret;
7864
Dustin Brownfdf17c12018-03-14 12:55:34 -07007865 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307866
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007867 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007868 ret = wlan_hdd_validate_context(hdd_ctx);
7869 if (0 != ret)
7870 return ret;
7871
Jeff Johnson441e1f72017-02-07 08:50:49 -08007872 ret = hdd_check_private_wext_control(hdd_ctx, info);
7873 if (0 != ret)
7874 return ret;
7875
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007876 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007877 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007878 return -EINVAL;
7879 }
7880
7881 /* Debug display of request components. */
7882 switch (pRequest->offloadType) {
7883 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007884 hdd_debug("Host offload request: ARP reply");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007885 switch (pRequest->enableOrDisable) {
7886 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007887 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007888 break;
7889 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007890 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07007891 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007892 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007893 hdd_debug(" ARP offload enable");
7894 hdd_debug(" IP address: %d.%d.%d.%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007895 pRequest->params.hostIpv4Addr[0],
7896 pRequest->params.hostIpv4Addr[1],
7897 pRequest->params.hostIpv4Addr[2],
7898 pRequest->params.hostIpv4Addr[3]);
7899 }
7900 break;
7901
7902 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007903 hdd_debug("Host offload request: neighbor discovery");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007904 switch (pRequest->enableOrDisable) {
7905 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007906 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007907 break;
7908 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007909 hdd_debug(" enable");
7910 hdd_debug(" IP address: %x:%x:%x:%x:%x:%x:%x:%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007911 *(uint16_t *) (pRequest->params.hostIpv6Addr),
7912 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7913 2),
7914 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7915 4),
7916 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7917 6),
7918 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7919 8),
7920 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7921 10),
7922 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7923 12),
7924 *(uint16_t *) (pRequest->params.hostIpv6Addr +
7925 14));
7926 }
7927 }
7928
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05307929 qdf_mem_zero(&offloadRequest, sizeof(offloadRequest));
7930 offloadRequest.offloadType = pRequest->offloadType;
7931 offloadRequest.enableOrDisable = pRequest->enableOrDisable;
7932 qdf_mem_copy(&offloadRequest.params, &pRequest->params,
7933 sizeof(pRequest->params));
7934 qdf_mem_copy(&offloadRequest.bssid, &pRequest->bssId.bytes,
7935 QDF_MAC_ADDR_SIZE);
7936
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307937 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007938 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnson1b780e42017-10-31 14:11:45 -07007939 adapter->session_id, &offloadRequest)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007940 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007941 return -EINVAL;
7942 }
Dustin Browne74003f2018-03-14 12:51:58 -07007943 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007944 return 0;
7945}
7946
7947static int iw_set_host_offload(struct net_device *dev,
7948 struct iw_request_info *info,
7949 union iwreq_data *wrqu, char *extra)
7950{
7951 int ret;
7952
7953 cds_ssr_protect(__func__);
7954 ret = __iw_set_host_offload(dev, info, wrqu, extra);
7955 cds_ssr_unprotect(__func__);
7956
7957 return ret;
7958}
7959
7960/**
7961 * iw_set_keepalive_params - Set keepalive params ioctl handler
7962 * @dev: device upon which the ioctl was received
7963 * @info: ioctl request information
7964 * @wrqu: ioctl request data
7965 * @extra: ioctl extra data
7966 *
7967 * Return: 0 on success, non-zero on error
7968 */
7969static int __iw_set_keepalive_params(struct net_device *dev,
7970 struct iw_request_info *info,
7971 union iwreq_data *wrqu, char *extra)
7972{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007973 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08007974 tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007975 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007976 int ret;
7977
Dustin Brownfdf17c12018-03-14 12:55:34 -07007978 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307979
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007980 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007981 ret = wlan_hdd_validate_context(hdd_ctx);
7982 if (0 != ret)
7983 return ret;
7984
Jeff Johnson441e1f72017-02-07 08:50:49 -08007985 ret = hdd_check_private_wext_control(hdd_ctx, info);
7986 if (0 != ret)
7987 return ret;
7988
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08007989 if (wrqu->data.length != sizeof(*request)) {
7990 hdd_err("Invalid length %d", wrqu->data.length);
7991 return -EINVAL;
7992 }
7993
7994 if (request->timePeriod > WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX) {
7995 hdd_err("Value of timePeriod %d exceed Max limit %d",
7996 request->timePeriod,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007997 WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX);
7998 return -EINVAL;
7999 }
8000
8001 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008002 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008003 request->timePeriod, sizeof(tSirKeepAliveReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008004
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008005 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008006 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008007 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008008 break;
8009
8010 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008011 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008012
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008013 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008014 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8015 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008016
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008017 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008018 request->destIpv4Addr[0], request->destIpv4Addr[1],
8019 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008020
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008021 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -08008022 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008023 break;
8024 }
8025
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008026 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008027
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308028 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008029 sme_set_keep_alive(hdd_ctx->mac_handle,
8030 adapter->session_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008031 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008032 return -EINVAL;
8033 }
Dustin Browne74003f2018-03-14 12:51:58 -07008034 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008035 return 0;
8036}
8037
8038static int iw_set_keepalive_params(struct net_device *dev,
8039 struct iw_request_info *info,
8040 union iwreq_data *wrqu,
8041 char *extra)
8042{
8043 int ret;
8044
8045 cds_ssr_protect(__func__);
8046 ret = __iw_set_keepalive_params(dev, info, wrqu, extra);
8047 cds_ssr_unprotect(__func__);
8048
8049 return ret;
8050}
8051
8052#ifdef WLAN_FEATURE_PACKET_FILTERING
8053/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308054 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8055 * @priv_data: Pointer to the priv data from user space
8056 * @request: Pointer to the struct containing the copied data from user space
8057 *
8058 * Return: False on invalid length, true otherwise
8059 */
8060static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8061 uint16_t length)
8062{
8063 int max_params_size, rcvd_params_size;
8064
8065 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8066 sizeof(struct pkt_filter_param_cfg);
8067
8068 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8069 hdd_err("Less than minimum number of arguments needed");
8070 return false;
8071 }
8072
8073 rcvd_params_size = request->num_params *
8074 sizeof(struct pkt_filter_param_cfg);
8075
8076 if (length != sizeof(struct pkt_filter_cfg) -
8077 max_params_size + rcvd_params_size) {
8078 hdd_err("Arguments do not match the number of params provided");
8079 return false;
8080 }
8081
8082 return true;
8083}
8084
8085/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008086 * __iw_set_packet_filter_params() - set packet filter parameters in target
8087 * @dev: Pointer to netdev
8088 * @info: Pointer to iw request info
8089 * @wrqu: Pointer to data
8090 * @extra: Pointer to extra data
8091 *
8092 * Return: 0 on success, non-zero on error
8093 */
8094static int __iw_set_packet_filter_params(struct net_device *dev,
8095 struct iw_request_info *info,
8096 union iwreq_data *wrqu, char *extra)
8097{
8098 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008099 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008100 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008101 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008102 struct pkt_filter_cfg *request = NULL;
8103
Mukul Sharma472382f2015-11-02 20:16:31 +05308104 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008105 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308106 return -EPERM;
8107 }
8108
Dustin Brownfdf17c12018-03-14 12:55:34 -07008109 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308110
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008111 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8112 ret = wlan_hdd_validate_context(hdd_ctx);
8113 if (0 != ret)
8114 return ret;
8115
Jeff Johnson441e1f72017-02-07 08:50:49 -08008116 ret = hdd_check_private_wext_control(hdd_ctx, info);
8117 if (0 != ret)
8118 return ret;
8119
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008120 if (hdd_priv_get_data(&priv_data, wrqu)) {
8121 hdd_err("failed to get priv data");
8122 return -EINVAL;
8123 }
8124
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308125 if ((NULL == priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008126 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008127 priv_data.pointer, priv_data.length);
8128 return -EINVAL;
8129 }
8130
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308131 if (adapter->device_mode != QDF_STA_MODE) {
8132 hdd_err("Packet filter not supported for this mode :%d",
8133 adapter->device_mode);
8134 return -ENOTSUPP;
8135 }
8136
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308137 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8138 hdd_err("Packet filter not supported in disconnected state");
8139 return -ENOTSUPP;
8140 }
8141
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008142 /* copy data using copy_from_user */
8143 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
8144 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308145
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008146 if (NULL == request) {
8147 hdd_err("mem_alloc_copy_from_user_helper fail");
8148 return -ENOMEM;
8149 }
8150
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308151 if (!validate_packet_filter_params_size(request, priv_data.length)) {
8152 hdd_err("Invalid priv data length %d", priv_data.length);
8153 qdf_mem_free(request);
8154 return -EINVAL;
8155 }
8156
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05308157 if (request->filter_action == HDD_RCV_FILTER_SET)
8158 hdd_ctx->user_configured_pkt_filter_rules |=
8159 1 << request->filter_id;
8160 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
8161 hdd_ctx->user_configured_pkt_filter_rules &=
8162 ~(1 << request->filter_id);
8163
Jeff Johnson1b780e42017-10-31 14:11:45 -07008164 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008165
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07008166 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07008167 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008168 return ret;
8169}
8170
8171/**
8172 * iw_set_packet_filter_params() - set packet filter parameters in target
8173 * @dev: Pointer to netdev
8174 * @info: Pointer to iw request info
8175 * @wrqu: Pointer to data
8176 * @extra: Pointer to extra data
8177 *
8178 * Return: 0 on success, non-zero on error
8179 */
8180static int iw_set_packet_filter_params(struct net_device *dev,
8181 struct iw_request_info *info,
8182 union iwreq_data *wrqu, char *extra)
8183{
8184 int ret;
8185
8186 cds_ssr_protect(__func__);
8187 ret = __iw_set_packet_filter_params(dev, info, wrqu, extra);
8188 cds_ssr_unprotect(__func__);
8189
8190 return ret;
8191}
8192#endif
8193
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008194#ifdef QCA_SUPPORT_CP_STATS
8195static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
8196{
8197 return wlan_hdd_get_station_stats(adapter);
8198}
8199#else /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008200struct hdd_statistics_priv {
8201 tCsrSummaryStatsInfo summary_stats;
8202 tCsrGlobalClassAStatsInfo class_a_stats;
8203 tCsrGlobalClassDStatsInfo class_d_stats;
8204};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008205
Jeff Johnsond37833f2018-03-07 14:22:44 -08008206/**
8207 * hdd_statistics_cb() - "Get statistics" callback function
Jeff Johnsonced658b2018-03-08 09:54:01 -08008208 * @stats: statistics payload
8209 * @context: opaque context originally passed to SME. HDD always passes
8210 * a cookie for the request context
Jeff Johnsond37833f2018-03-07 14:22:44 -08008211 *
8212 * Return: None
8213 */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008214static void hdd_statistics_cb(void *stats, void *context)
Jeff Johnsond37833f2018-03-07 14:22:44 -08008215{
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008216 struct osif_request *request;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008217 struct hdd_statistics_priv *priv;
8218 tCsrSummaryStatsInfo *summary_stats;
8219 tCsrGlobalClassAStatsInfo *class_a_stats;
8220 tCsrGlobalClassDStatsInfo *class_d_stats;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008221
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008222 request = osif_request_get(context);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008223 if (!request) {
8224 hdd_err("Obsolete request");
8225 return;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008226 }
8227
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008228 priv = osif_request_priv(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008229
8230 summary_stats = (tCsrSummaryStatsInfo *)stats;
8231 priv->summary_stats = *summary_stats;
8232
8233 class_a_stats = (tCsrGlobalClassAStatsInfo *)(summary_stats + 1);
8234 priv->class_a_stats = *class_a_stats;
8235
8236 class_d_stats = (tCsrGlobalClassDStatsInfo *)(class_a_stats + 1);
8237 priv->class_d_stats = *class_d_stats;
8238
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008239 osif_request_complete(request);
8240 osif_request_put(request);
Jeff Johnsond37833f2018-03-07 14:22:44 -08008241}
8242
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008243static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008244{
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008245 int ret = 0;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008246 void *cookie;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008247 QDF_STATUS status;
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008248 struct osif_request *request;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008249 struct hdd_station_ctx *sta_ctx;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008250 struct hdd_statistics_priv *priv;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008251 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008252 static const struct osif_request_params params = {
Jeff Johnsonced658b2018-03-08 09:54:01 -08008253 .priv_size = sizeof(*priv),
8254 .timeout_ms = WLAN_WAIT_TIME_STATS,
8255 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008256
Jeff Johnsonced658b2018-03-08 09:54:01 -08008257 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008258 request = osif_request_alloc(&params);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008259 if (!request) {
8260 hdd_warn("request allocation failed");
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008261 return -EINVAL;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008262 }
8263
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008264 cookie = osif_request_cookie(request);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008265 status = sme_get_statistics(hdd_ctx->mac_handle, eCSR_HDD,
Jeff Johnsonced658b2018-03-08 09:54:01 -08008266 SME_SUMMARY_STATS |
8267 SME_GLOBAL_CLASSA_STATS |
8268 SME_GLOBAL_CLASSD_STATS,
8269 hdd_statistics_cb,
8270 sta_ctx->conn_info.staId[0],
8271 cookie, adapter->session_id);
8272
8273 if (QDF_STATUS_SUCCESS != status) {
8274 hdd_warn("Unable to retrieve SME statistics");
8275 goto put_request;
8276 }
8277
8278 /* request was sent -- wait for the response */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008279 ret = osif_request_wait_for_response(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008280 if (ret) {
8281 hdd_err("Failed to wait for statistics, errno %d", ret);
8282 goto put_request;
8283 }
8284
8285 /* update the adapter cache with the fresh results */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008286 priv = osif_request_priv(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008287 adapter->hdd_stats.summary_stat = priv->summary_stats;
8288 adapter->hdd_stats.class_a_stat = priv->class_a_stats;
8289 adapter->hdd_stats.class_d_stat = priv->class_d_stats;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008290
8291put_request:
8292 /*
8293 * either we never sent a request, we sent a request and
8294 * received a response or we sent a request and timed out.
8295 * regardless we are done with the request.
8296 */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008297 osif_request_put(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008298 return ret;
8299}
8300#endif /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008301
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008302static int __iw_get_statistics(struct net_device *dev,
8303 struct iw_request_info *info,
8304 union iwreq_data *wrqu, char *extra)
8305{
8306 int ret;
8307 char *p;
8308 int tlen;
8309 struct hdd_station_ctx *sta_ctx;
8310 tCsrSummaryStatsInfo *summary_stats;
8311 tCsrGlobalClassAStatsInfo *class_a_stats;
8312 tCsrGlobalClassDStatsInfo *class_d_stats;
8313 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
8314 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8315
8316 hdd_enter_dev(dev);
8317
8318 ret = wlan_hdd_validate_context(hdd_ctx);
8319 if (0 != ret)
8320 return ret;
8321
8322 ret = hdd_check_private_wext_control(hdd_ctx, info);
8323 if (0 != ret)
8324 return ret;
8325
8326 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
8327 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
8328 wrqu->data.length = 0;
8329 return 0;
8330 }
8331
8332 hdd_get_wlan_stats(adapter);
8333
8334 summary_stats = &(adapter->hdd_stats.summary_stat);
8335 class_a_stats = &(adapter->hdd_stats.class_a_stat);
8336 class_d_stats = &(adapter->hdd_stats.class_d_stat);
8337
Jeff Johnsonced658b2018-03-08 09:54:01 -08008338 p = extra;
8339 tlen = 0;
8340
8341 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
8342 sizeof(summary_stats->retry_cnt),
8343 &(summary_stats->retry_cnt[0]), tlen);
8344
8345 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
8346 sizeof(summary_stats->multiple_retry_cnt),
8347 &(summary_stats->multiple_retry_cnt[0]), tlen);
8348
8349 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
8350 sizeof(summary_stats->tx_frm_cnt),
8351 &(summary_stats->tx_frm_cnt[0]), tlen);
8352
8353 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
8354 sizeof(summary_stats->rx_frm_cnt),
8355 &(summary_stats->rx_frm_cnt), tlen);
8356
8357 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
8358 sizeof(summary_stats->frm_dup_cnt),
8359 &(summary_stats->frm_dup_cnt), tlen);
8360
8361 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
8362 sizeof(summary_stats->fail_cnt),
8363 &(summary_stats->fail_cnt[0]), tlen);
8364
8365 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
8366 sizeof(summary_stats->rts_fail_cnt),
8367 &(summary_stats->rts_fail_cnt), tlen);
8368
8369 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
8370 sizeof(summary_stats->ack_fail_cnt),
8371 &(summary_stats->ack_fail_cnt), tlen);
8372
8373 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
8374 sizeof(summary_stats->rts_succ_cnt),
8375 &(summary_stats->rts_succ_cnt), tlen);
8376
8377 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
8378 sizeof(summary_stats->rx_discard_cnt),
8379 &(summary_stats->rx_discard_cnt), tlen);
8380
8381 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
8382 sizeof(summary_stats->rx_error_cnt),
8383 &(summary_stats->rx_error_cnt), tlen);
8384
8385 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
8386 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8387 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8388
8389 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
8390 sizeof(class_d_stats->rx_byte_cnt),
8391 &(class_d_stats->rx_byte_cnt), tlen);
8392
8393 FILL_TLV(p, WLAN_STATS_RX_RATE,
8394 sizeof(class_d_stats->rx_rate),
8395 &(class_d_stats->rx_rate), tlen);
8396
8397 /* Transmit rate, in units of 500 kbit/sec */
8398 FILL_TLV(p, WLAN_STATS_TX_RATE,
8399 sizeof(class_a_stats->tx_rate),
8400 &(class_a_stats->tx_rate), tlen);
8401
8402 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
8403 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
8404 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
8405 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
8406 sizeof(class_d_stats->rx_mc_byte_cnt),
8407 &(class_d_stats->rx_mc_byte_cnt), tlen);
8408 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
8409 sizeof(class_d_stats->rx_bc_byte_cnt),
8410 &(class_d_stats->rx_bc_byte_cnt), tlen);
8411 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
8412 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8413 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8414 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
8415 sizeof(class_d_stats->tx_mc_byte_cnt),
8416 &(class_d_stats->tx_mc_byte_cnt), tlen);
8417 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
8418 sizeof(class_d_stats->tx_bc_byte_cnt),
8419 &(class_d_stats->tx_bc_byte_cnt), tlen);
8420
8421 wrqu->data.length = tlen;
8422
Dustin Browne74003f2018-03-14 12:51:58 -07008423 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008424
8425 return 0;
8426}
8427
8428static int iw_get_statistics(struct net_device *dev,
8429 struct iw_request_info *info,
8430 union iwreq_data *wrqu, char *extra)
8431{
8432 int ret;
8433
8434 cds_ssr_protect(__func__);
8435 ret = __iw_get_statistics(dev, info, wrqu, extra);
8436 cds_ssr_unprotect(__func__);
8437
8438 return ret;
8439}
8440
8441#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008442/*Max Len for PNO notification*/
8443#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05308444static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
8445 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008446{
Abhishek Singh0481d662017-04-11 18:20:11 +05308447 struct vdev_osif_priv *osif_priv;
8448 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008449 union iwreq_data wrqu;
8450 char buf[MAX_PNO_NOTIFY_LEN + 1];
8451
Abhishek Singh0481d662017-04-11 18:20:11 +05308452 wlan_vdev_obj_lock(vdev);
8453 osif_priv = wlan_vdev_get_ospriv(vdev);
8454 wlan_vdev_obj_unlock(vdev);
8455 if (!osif_priv) {
8456 hdd_err("osif_priv is null");
8457 return;
8458 }
8459
8460 wdev = osif_priv->wdev;
8461 if (!wdev) {
8462 hdd_err("wdev is null");
8463 return;
8464 }
8465
8466 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008467
8468 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05308469 qdf_mem_zero(&wrqu, sizeof(wrqu));
8470 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008471
8472 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05308473 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008474
8475 wrqu.data.pointer = buf;
8476 wrqu.data.length = strlen(buf);
8477
8478 /* send the event */
8479
Abhishek Singh0481d662017-04-11 18:20:11 +05308480 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008481}
8482
8483/**
8484 * __iw_set_pno() - Preferred Network Offload ioctl handler
8485 * @dev: device upon which the ioctl was received
8486 * @info: ioctl request information
8487 * @wrqu: ioctl request data
8488 * @extra: ioctl extra data
8489 *
8490 * This function parses a Preferred Network Offload command
8491 * Input is string based and expected to be of the form:
8492 *
8493 * <enable(1) | disable(0)>
8494 * when enabling:
8495 * <number of networks>
8496 * for each network:
8497 * <ssid_len> <ssid> <authentication> <encryption>
8498 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07008499 * <scan_time (seconds)>
8500 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008501 * <suspend mode>
8502 *
8503 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07008504 * 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 -08008505 *
8506 * this translates into:
8507 * -----------------------------
8508 * enable PNO
8509 * 2 networks
8510 * Network 1:
8511 * test - with authentication type 0 and encryption type 0,
8512 * search on 3 channels: 1 6 and 11,
8513 * SSID bcast type is unknown (directed probe will be sent if
8514 * AP not found) and must meet -40dBm RSSI
8515 * Network 2:
8516 * test2 - with authentication type 4 and encryption type 4,
8517 * search on 6 channels 1, 2, 3, 4, 5 and 6
8518 * bcast type is non-bcast (directed probe will be sent)
8519 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008520 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07008521 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008522 */
8523static int __iw_set_pno(struct net_device *dev,
8524 struct iw_request_info *info,
8525 union iwreq_data *wrqu, char *extra)
8526{
Jeff Johnson3d278b02017-08-29 14:17:47 -07008527 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008528 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05308529 uint8_t value;
8530 struct wlan_objmgr_vdev *vdev;
8531 struct wlan_objmgr_psoc *psoc;
8532 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008533 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308534 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05308535 uint8_t i, j, params;
8536 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308537 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008538
8539 /* request is a large struct, so we make it static to avoid
8540 * stack overflow. This API is only invoked via ioctl, so it
8541 * is serialized by the kernel rtnl_lock and hence does not
8542 * need to be reentrant
8543 */
Abhishek Singh0481d662017-04-11 18:20:11 +05308544 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008545
Dustin Brownfdf17c12018-03-14 12:55:34 -07008546 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008547
8548 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8549 ret = wlan_hdd_validate_context(hdd_ctx);
8550 if (ret)
8551 return ret;
8552
Jeff Johnson441e1f72017-02-07 08:50:49 -08008553 ret = hdd_check_private_wext_control(hdd_ctx, info);
8554 if (0 != ret)
8555 return ret;
8556
Abhishek Singh0481d662017-04-11 18:20:11 +05308557 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->hdd_pdev,
8558 dev->dev_addr, WLAN_LEGACY_MAC_ID);
8559 if (!vdev) {
8560 hdd_err("vdev object is NULL");
8561 return -EIO;
8562 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008563
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308564 /* making sure argument string ends with '\0' */
8565 len = (wrqu->data.length + 1);
8566 data = qdf_mem_malloc(len);
8567 if (!data) {
8568 hdd_err("fail to allocate memory %zu", len);
8569 return -EINVAL;
8570 }
8571 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308572 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008573
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05308574 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
8575
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308576 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008577 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308578 ret = -EINVAL;
8579 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008580 }
8581
Abhishek Singh0481d662017-04-11 18:20:11 +05308582 if (!value) {
8583 status = ucfg_scan_pno_stop(vdev);
8584 if (QDF_IS_STATUS_ERROR(status)) {
8585 hdd_err("Failed to disabled PNO");
8586 ret = -EINVAL;
8587 } else {
8588 hdd_debug("PNO scan disabled");
8589 }
8590 goto exit;
8591 }
8592
8593 if (ucfg_scan_get_pno_in_progress(vdev)) {
8594 hdd_debug("pno is already in progress");
8595 ret = -EBUSY;
8596 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008597 }
8598
8599 ptr += offset;
8600
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308601 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008602 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308603 ret = -EINVAL;
8604 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008605 }
Abhishek Singh0481d662017-04-11 18:20:11 +05308606 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008607
Abhishek Singh0481d662017-04-11 18:20:11 +05308608 hdd_debug("PNO enable networks count %d offset %d",
8609 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008610
Abhishek Singh0481d662017-04-11 18:20:11 +05308611 if ((0 == req.networks_cnt) ||
8612 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008613 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05308614 req.networks_cnt);
8615 ret = -EINVAL;
8616 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008617 }
8618
8619 ptr += offset;
8620
Abhishek Singh0481d662017-04-11 18:20:11 +05308621 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008622
Abhishek Singh0481d662017-04-11 18:20:11 +05308623 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008624
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308625 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308626 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008627 &offset);
8628
8629 if (1 != params) {
8630 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308631 ret = -EINVAL;
8632 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008633 }
8634
Abhishek Singh0481d662017-04-11 18:20:11 +05308635 if ((0 == req.networks_list[i].ssid.length) ||
8636 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008637 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308638 req.networks_list[i].ssid.length, i);
8639 ret = -EINVAL;
8640 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008641 }
8642
8643 /* Advance to SSID */
8644 ptr += offset;
8645
Abhishek Singh0481d662017-04-11 18:20:11 +05308646 memcpy(req.networks_list[i].ssid.ssid, ptr,
8647 req.networks_list[i].ssid.length);
8648 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008649
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308650 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308651 &(req.networks_list[i].authentication),
8652 &(req.networks_list[i].encryption),
8653 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008654 &offset);
8655
8656 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008657 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308658 ret = -EINVAL;
8659 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008660 }
8661
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008662 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308663 req.networks_list[i].ssid.length,
8664 req.networks_list[i].ssid.length,
8665 req.networks_list[i].ssid.ssid,
8666 req.networks_list[i].authentication,
8667 req.networks_list[i].encryption,
8668 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008669
8670 /* Advance to channel list */
8671 ptr += offset;
8672
Abhishek Singh0481d662017-04-11 18:20:11 +05308673 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
8674 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008675 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05308676 ret = -EINVAL;
8677 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008678 }
8679
Abhishek Singh0481d662017-04-11 18:20:11 +05308680 if (0 != req.networks_list[i].channel_cnt) {
8681 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008682 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308683 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05308684 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008685 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008686 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308687 ret = -EINVAL;
8688 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008689 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308690 if (!IS_CHANNEL_VALID(value)) {
8691 hdd_err("invalid channel: %hhu", value);
8692 ret = -EINVAL;
8693 goto exit;
8694 }
Abhishek Singh0481d662017-04-11 18:20:11 +05308695 req.networks_list[i].channels[j] =
8696 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008697 /* Advance to next channel number */
8698 ptr += offset;
8699 }
8700 }
8701
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308702 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308703 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008704 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008705 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008706 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308707 ret = -EINVAL;
8708 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008709 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308710 if (req.networks_list[i].bc_new_type > 2) {
8711 hdd_err("invalid bcast nw type: %u",
8712 req.networks_list[i].bc_new_type);
8713 ret = -EINVAL;
8714 goto exit;
8715 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008716
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008717 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308718 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008719
8720 /* Advance to rssi Threshold */
8721 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308722 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308723 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008724 &offset)) {
8725 hdd_err("PNO rssi threshold input is not valid %s",
8726 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308727 ret = -EINVAL;
8728 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008729 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008730 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308731 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008732 /* Advance to next network */
8733 ptr += offset;
8734 } /* For ucNetworkCount */
8735
Abhishek Singh0481d662017-04-11 18:20:11 +05308736 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308737 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05308738 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07008739 ptr += offset;
8740 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308741 if (req.fast_scan_period == 0) {
8742 hdd_err("invalid fast scan period %u",
8743 req.fast_scan_period);
8744 ret = -EINVAL;
8745 goto exit;
8746 }
Dustin Brown43e87292016-10-10 10:38:25 -07008747
Abhishek Singh0481d662017-04-11 18:20:11 +05308748 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308749 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07008750 &offset) > 0)
8751 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05308752 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07008753
Abhishek Singh0481d662017-04-11 18:20:11 +05308754 wlan_pdev_obj_lock(hdd_ctx->hdd_pdev);
8755 psoc = wlan_pdev_get_psoc(hdd_ctx->hdd_pdev);
8756 wlan_pdev_obj_unlock(hdd_ctx->hdd_pdev);
8757 ucfg_scan_register_pno_cb(psoc,
8758 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008759
Abhishek Singh0481d662017-04-11 18:20:11 +05308760 ucfg_scan_get_pno_def_params(vdev, &req);
8761 status = ucfg_scan_pno_start(vdev, &req);
8762 if (QDF_IS_STATUS_ERROR(status)) {
8763 hdd_err("Failed to enable PNO");
8764 ret = -EINVAL;
8765 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008766
Abhishek Singh0481d662017-04-11 18:20:11 +05308767exit:
8768 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008769
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308770 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05308771 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008772}
8773
8774static int iw_set_pno(struct net_device *dev,
8775 struct iw_request_info *info,
8776 union iwreq_data *wrqu, char *extra)
8777{
8778 int ret;
8779
8780 cds_ssr_protect(__func__);
8781 ret = __iw_set_pno(dev, info, wrqu, extra);
8782 cds_ssr_unprotect(__func__);
8783
8784 return ret;
8785}
8786#endif /* FEATURE_WLAN_SCAN_PNO */
8787
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008788static int __iw_set_band_config(struct net_device *dev,
8789 struct iw_request_info *info,
8790 union iwreq_data *wrqu, char *extra)
8791{
Jeff Johnson3d278b02017-08-29 14:17:47 -07008792 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008793 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08008794 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008795 int *value = (int *)extra;
8796
Dustin Brownfdf17c12018-03-14 12:55:34 -07008797 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008798
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05308799 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008800 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05308801 return -EPERM;
8802 }
8803
Jeff Johnson441e1f72017-02-07 08:50:49 -08008804 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8805 ret = hdd_check_private_wext_control(hdd_ctx, info);
8806 if (0 != ret)
8807 return ret;
8808
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07008809 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008810}
8811
8812static int iw_set_band_config(struct net_device *dev,
8813 struct iw_request_info *info,
8814 union iwreq_data *wrqu, char *extra)
8815{
8816 int ret;
8817
8818 cds_ssr_protect(__func__);
8819 ret = __iw_set_band_config(dev, info, wrqu, extra);
8820 cds_ssr_unprotect(__func__);
8821
8822 return ret;
8823}
8824
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008825static int printk_adapter(void *priv, const char *fmt, ...)
8826{
8827 int ret;
8828 va_list args;
8829
8830 va_start(args, fmt);
8831 ret = vprintk(fmt, args);
8832 ret += printk("\n");
8833 va_end(args);
8834
8835 return ret;
8836}
8837
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008838static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
8839{
8840 qdf_abstract_print *print = &printk_adapter;
8841
8842 switch (log_id) {
8843 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008844 cds_print_htc_credit_history(count, print, NULL);
8845 break;
8846 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008847 wma_print_wmi_cmd_log(count, print, NULL);
8848 break;
8849 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008850 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
8851 break;
8852 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008853 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
8854 break;
8855 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008856 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
8857 break;
8858 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008859 wma_print_wmi_event_log(count, print, NULL);
8860 break;
8861 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008862 wma_print_wmi_rx_event_log(count, print, NULL);
8863 break;
8864 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008865 wma_print_wmi_mgmt_event_log(count, print, NULL);
8866 break;
8867 default:
8868 print(NULL, "Invalid Log Id %d", log_id);
8869 break;
8870 }
8871}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008872
Jeff Johnsondf5d7792018-04-14 15:58:24 -07008873#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
8874int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
8875{
8876 struct hdd_context *hdd_ctx;
8877 int ret;
8878
8879 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
8880 v1, v2);
8881 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
8882 v1, v2);
8883 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8884 if (!hdd_ctx->config->crash_inject_enabled) {
8885 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
8886 return 0;
8887 }
8888 if (v1 == 3) {
8889 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
8890 return 0;
8891 }
8892 ret = wma_cli_set2_command(adapter->session_id,
8893 GEN_PARAM_CRASH_INJECT,
8894 v1, v2, GEN_CMD);
8895 return ret;
8896}
8897#endif
8898
Nirav Shahd21a2e32018-04-20 16:34:43 +05308899#ifdef CONFIG_DP_TRACE
8900void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
8901{
8902 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
8903 cmd_type, count);
8904 if (cmd_type == DUMP_DP_TRACE)
8905 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
8906 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
8907 qdf_dp_trace_enable_live_mode();
8908 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
8909 qdf_dp_trace_clear_buffer();
8910 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
8911 qdf_dp_trace_disable_live_mode();
8912}
8913#endif
8914
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008915static int __iw_set_two_ints_getnone(struct net_device *dev,
8916 struct iw_request_info *info,
8917 union iwreq_data *wrqu, char *extra)
8918{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008919 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008920 int *value = (int *)extra;
8921 int sub_cmd = value[0];
8922 int ret;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008923 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008924
Dustin Brownfdf17c12018-03-14 12:55:34 -07008925 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08008926
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008927 ret = wlan_hdd_validate_context(hdd_ctx);
8928 if (0 != ret)
8929 return ret;
8930
Jeff Johnson441e1f72017-02-07 08:50:49 -08008931 ret = hdd_check_private_wext_control(hdd_ctx, info);
8932 if (0 != ret)
8933 return ret;
8934
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008935 switch (sub_cmd) {
8936 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008937 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07008938 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008939 WMI_STA_SMPS_PARAM_CMDID,
8940 value[1] << WMA_SMPS_PARAM_VALUE_S
8941 | value[2],
8942 VDEV_CMD);
8943 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008944 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07008945 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008946 break;
Govind Singha471e5e2015-10-12 17:11:14 +05308947 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07008948 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05308949 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07008950 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05308951 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
8952 value[1], value[2], DBG_CMD);
8953 break;
8954 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07008955 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05308956 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07008957 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05308958 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
8959 value[1], value[2], DBG_CMD);
8960 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008961 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
8962 hdd_debug("Ioctl to set dual fw mode config");
Tushnim Bhattacharyya49ed8ab2017-05-26 18:20:10 -07008963 if (hdd_ctx->config->dual_mac_feature_disable ==
8964 DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008965 hdd_err("Dual mac feature is disabled from INI");
8966 return -EPERM;
8967 }
8968 hdd_debug("%d %d", value[1], value[2]);
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08008969 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->hdd_psoc,
8970 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008971 break;
8972 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05308973 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008974 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07008975 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008976 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07008977 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07008978 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08008979 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
8980 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07008981 break;
8982 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07008983 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07008984 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07008985 case WE_LOG_BUFFER: {
8986 int log_id = value[1];
8987 uint32_t count = value[2] < 0 ? 0 : value[2];
8988
8989 hdd_ioctl_log_buffer(log_id, count);
8990
8991 break;
8992 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008993 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07008994 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008995 break;
8996 }
8997
8998 return ret;
8999}
9000
9001static int iw_set_two_ints_getnone(struct net_device *dev,
9002 struct iw_request_info *info,
9003 union iwreq_data *wrqu, char *extra)
9004{
9005 int ret;
9006
9007 cds_ssr_protect(__func__);
9008 ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
9009 cds_ssr_unprotect(__func__);
9010
9011 return ret;
9012}
9013
9014/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009015
9016static const iw_handler we_private[] = {
9017
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009018 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9019 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9020 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009021 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9022 iw_set_three_ints_getnone,
9023 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009024 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009025 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9026 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009027 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9028 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309029#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009030 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309031#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009032 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9033 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9034 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009035 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009036 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9037 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9038 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9039 iw_set_keepalive_params,
9040#ifdef WLAN_FEATURE_PACKET_FILTERING
9041 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9042 iw_set_packet_filter_params,
9043#endif
9044#ifdef FEATURE_WLAN_SCAN_PNO
9045 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9046#endif
9047 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009048 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9049 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009050 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
9051 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9052 iw_set_two_ints_getnone,
9053 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9054 iw_set_dot11p_channel_sched,
9055};
9056
9057/*Maximum command length can be only 15 */
9058static const struct iw_priv_args we_private_args[] = {
9059
9060 /* handlers for main ioctl */
9061 {WLAN_PRIV_SET_INT_GET_NONE,
9062 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9063 0,
9064 ""},
9065
9066 /* handlers for sub-ioctl */
9067 {WE_SET_11D_STATE,
9068 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9069 0,
9070 "set11Dstate"},
9071
9072 {WE_WOWL,
9073 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9074 0,
9075 "wowl"},
9076
9077 {WE_SET_POWER,
9078 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9079 0,
9080 "setPower"},
9081
9082 {WE_SET_MAX_ASSOC,
9083 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9084 0,
9085 "setMaxAssoc"},
9086
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009087 {WE_SET_SCAN_DISABLE,
9088 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9089 0,
9090 "scan_disable"},
9091
9092 {WE_SET_DATA_INACTIVITY_TO,
9093 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9094 0,
9095 "inactivityTO"},
9096
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05309097 {WE_SET_WOW_DATA_INACTIVITY_TO,
9098 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9099 0,
9100 "wow_ito"},
9101
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009102 {WE_SET_MAX_TX_POWER,
9103 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9104 0,
9105 "setMaxTxPower"},
9106
9107 {WE_SET_TX_POWER,
9108 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9109 0,
9110 "setTxPower"},
9111
9112 {WE_SET_MC_RATE,
9113 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9114 0,
9115 "setMcRate"},
9116
9117 {WE_SET_MAX_TX_POWER_2_4,
9118 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9119 0,
9120 "setTxMaxPower2G"},
9121
9122 {WE_SET_MAX_TX_POWER_5_0,
9123 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9124 0,
9125 "setTxMaxPower5G"},
9126
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309127#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009128 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05309129 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009130 0,
9131 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309132#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009133
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009134 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
9135 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -08009136 * will support both
9137 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009138 {WE_SET_MAX_TX_POWER,
9139 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9140 0,
9141 "setTxMaxPower"},
9142
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009143 {WE_SET_TM_LEVEL,
9144 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9145 0,
9146 "setTmLevel"},
9147
9148 {WE_SET_PHYMODE,
9149 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9150 0,
9151 "setphymode"},
9152
9153 {WE_SET_NSS,
9154 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9155 0,
9156 "nss"},
9157
9158 {WE_SET_LDPC,
9159 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9160 0,
9161 "ldpc"},
9162
9163 {WE_SET_TX_STBC,
9164 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9165 0,
9166 "tx_stbc"},
9167
9168 {WE_SET_RX_STBC,
9169 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9170 0,
9171 "rx_stbc"},
9172
9173 {WE_SET_SHORT_GI,
9174 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9175 0,
9176 "shortgi"},
9177
9178 {WE_SET_RTSCTS,
9179 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9180 0,
9181 "enablertscts"},
9182
9183 {WE_SET_CHWIDTH,
9184 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9185 0,
9186 "chwidth"},
9187
9188 {WE_SET_ANI_EN_DIS,
9189 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9190 0,
9191 "anienable"},
9192
9193 {WE_SET_ANI_POLL_PERIOD,
9194 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9195 0,
9196 "aniplen"},
9197
9198 {WE_SET_ANI_LISTEN_PERIOD,
9199 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9200 0,
9201 "anilislen"},
9202
9203 {WE_SET_ANI_OFDM_LEVEL,
9204 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9205 0,
9206 "aniofdmlvl"},
9207
9208 {WE_SET_ANI_CCK_LEVEL,
9209 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9210 0,
9211 "aniccklvl"},
9212
9213 {WE_SET_DYNAMIC_BW,
9214 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9215 0,
9216 "cwmenable"},
9217
9218 {WE_SET_CTS_CBW,
9219 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9220 0,
9221 "cts_cbw" },
9222
9223 {WE_SET_GTX_HT_MCS,
9224 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9225 0,
9226 "gtxHTMcs"},
9227
9228 {WE_SET_GTX_VHT_MCS,
9229 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9230 0,
9231 "gtxVHTMcs"},
9232
9233 {WE_SET_GTX_USRCFG,
9234 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9235 0,
9236 "gtxUsrCfg"},
9237
9238 {WE_SET_GTX_THRE,
9239 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9240 0,
9241 "gtxThre"},
9242
9243 {WE_SET_GTX_MARGIN,
9244 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9245 0,
9246 "gtxMargin"},
9247
9248 {WE_SET_GTX_STEP,
9249 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9250 0,
9251 "gtxStep"},
9252
9253 {WE_SET_GTX_MINTPC,
9254 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9255 0,
9256 "gtxMinTpc"},
9257
9258 {WE_SET_GTX_BWMASK,
9259 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9260 0,
9261 "gtxBWMask"},
9262
9263 {WE_SET_TX_CHAINMASK,
9264 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9265 0,
9266 "txchainmask"},
9267
9268 {WE_SET_RX_CHAINMASK,
9269 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9270 0,
9271 "rxchainmask"},
9272
9273 {WE_SET_11N_RATE,
9274 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9275 0,
9276 "set11NRates"},
9277
9278 {WE_SET_VHT_RATE,
9279 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9280 0,
9281 "set11ACRates"},
9282
9283 {WE_SET_AMPDU,
9284 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9285 0,
9286 "ampdu"},
9287
9288 {WE_SET_AMSDU,
9289 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9290 0,
9291 "amsdu"},
9292
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009293 {WE_SET_TXPOW_2G,
9294 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9295 0,
9296 "txpow2g"},
9297
9298 {WE_SET_TXPOW_5G,
9299 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9300 0,
9301 "txpow5g"},
9302
Wen Gong99768902018-04-25 12:07:49 +08009303#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009304 /* Sub-cmds DBGLOG specific commands */
9305 {WE_DBGLOG_LOG_LEVEL,
9306 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9307 0,
9308 "dl_loglevel"},
9309
9310 {WE_DBGLOG_VAP_ENABLE,
9311 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9312 0,
9313 "dl_vapon"},
9314
9315 {WE_DBGLOG_VAP_DISABLE,
9316 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9317 0,
9318 "dl_vapoff"},
9319
9320 {WE_DBGLOG_MODULE_ENABLE,
9321 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9322 0,
9323 "dl_modon"},
9324
9325 {WE_DBGLOG_MODULE_DISABLE,
9326 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9327 0,
9328 "dl_modoff"},
9329
9330 {WE_DBGLOG_MOD_LOG_LEVEL,
9331 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9332 0,
9333 "dl_mod_loglevel"},
9334
9335 {WE_DBGLOG_TYPE,
9336 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9337 0,
9338 "dl_type"},
9339 {WE_DBGLOG_REPORT_ENABLE,
9340 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9341 0,
9342 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +08009343#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009344
9345 {WE_SET_TXRX_FWSTATS,
9346 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9347 0,
9348 "txrx_fw_stats"},
9349
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009350 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +08009351 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009352 0,
9353 "txrx_stats"},
9354
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009355 {WE_TXRX_FWSTATS_RESET,
9356 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9357 0,
9358 "txrx_fw_st_rst"},
9359
9360 {WE_PPS_PAID_MATCH,
9361 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9362 0, "paid_match"},
9363
9364 {WE_PPS_GID_MATCH,
9365 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9366 0, "gid_match"},
9367
9368 {WE_PPS_EARLY_TIM_CLEAR,
9369 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9370 0, "tim_clear"},
9371
9372 {WE_PPS_EARLY_DTIM_CLEAR,
9373 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9374 0, "dtim_clear"},
9375
9376 {WE_PPS_EOF_PAD_DELIM,
9377 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9378 0, "eof_delim"},
9379
9380 {WE_PPS_MACADDR_MISMATCH,
9381 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9382 0, "mac_match"},
9383
9384 {WE_PPS_DELIM_CRC_FAIL,
9385 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9386 0, "delim_fail"},
9387
9388 {WE_PPS_GID_NSTS_ZERO,
9389 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9390 0, "nsts_zero"},
9391
9392 {WE_PPS_RSSI_CHECK,
9393 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9394 0, "rssi_chk"},
9395
9396 {WE_PPS_5G_EBT,
9397 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9398 0, "5g_ebt"},
9399
9400 {WE_SET_HTSMPS,
9401 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9402 0, "htsmps"},
9403
9404 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
9405 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9406 0, "set_qpspollcnt"},
9407
9408 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
9409 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9410 0, "set_qtxwake"},
9411
9412 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
9413 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9414 0, "set_qwakeintv"},
9415
9416 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
9417 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9418 0, "set_qnodatapoll"},
9419
9420 /* handlers for MCC time quota and latency sub ioctls */
9421 {WE_MCC_CONFIG_LATENCY,
9422 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9423 0, "setMccLatency"},
9424
9425 {WE_MCC_CONFIG_QUOTA,
9426 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9427 0, "setMccQuota"},
9428
9429 {WE_SET_DEBUG_LOG,
9430 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9431 0, "setDbgLvl"},
9432
9433 /* handlers for early_rx power save */
9434 {WE_SET_EARLY_RX_ADJUST_ENABLE,
9435 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9436 0, "erx_enable"},
9437
9438 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
9439 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9440 0, "erx_bmiss_val"},
9441
9442 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
9443 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9444 0, "erx_bmiss_smpl"},
9445
9446 {WE_SET_EARLY_RX_SLOP_STEP,
9447 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9448 0, "erx_slop_step"},
9449
9450 {WE_SET_EARLY_RX_INIT_SLOP,
9451 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9452 0, "erx_init_slop"},
9453
9454 {WE_SET_EARLY_RX_ADJUST_PAUSE,
9455 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9456 0, "erx_adj_pause"},
9457
9458 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
9459 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9460 0, "erx_dri_sample"},
9461
9462 {WE_DUMP_STATS,
9463 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9464 0, "dumpStats"},
9465
9466 {WE_CLEAR_STATS,
9467 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9468 0, "clearStats"},
9469
Govind Singha471e5e2015-10-12 17:11:14 +05309470 {WE_START_FW_PROFILE,
9471 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9472 0, "startProfile"},
9473
Abhishek Singh1bdb1572015-10-16 16:24:19 +05309474 {WE_SET_CHANNEL,
9475 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9476 0, "setChanChange" },
9477
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05309478 {WE_SET_CONC_SYSTEM_PREF,
9479 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9480 0, "setConcSysPref" },
9481
Jeff Johnson011c4502017-10-05 15:25:56 -07009482 {WE_SET_PDEV_RESET,
9483 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9484 0, "pdev_reset" },
9485
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05309486 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -08009487 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9488 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05309489
Kiran Kumar Lokere05e9a652018-04-10 20:27:38 -07009490 {WE_SET_PPDU_DUR,
9491 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9492 0, "set_ppdu_dur" },
9493
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009494 {WLAN_PRIV_SET_NONE_GET_INT,
9495 0,
9496 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9497 ""},
9498
9499 /* handlers for sub-ioctl */
9500 {WE_GET_11D_STATE,
9501 0,
9502 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9503 "get11Dstate"},
9504
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009505 {WE_GET_WLAN_DBG,
9506 0,
9507 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9508 "getwlandbg"},
9509
9510 {WE_GET_MAX_ASSOC,
9511 0,
9512 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9513 "getMaxAssoc"},
9514
9515 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
9516 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9517 "getAutoChannel" },
9518
9519 {WE_GET_CONCURRENCY_MODE,
9520 0,
9521 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9522 "getconcurrency"},
9523
9524 {WE_GET_NSS,
9525 0,
9526 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9527 "get_nss"},
9528
9529 {WE_GET_LDPC,
9530 0,
9531 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9532 "get_ldpc"},
9533
9534 {WE_GET_TX_STBC,
9535 0,
9536 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9537 "get_tx_stbc"},
9538
9539 {WE_GET_RX_STBC,
9540 0,
9541 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9542 "get_rx_stbc"},
9543
9544 {WE_GET_SHORT_GI,
9545 0,
9546 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9547 "get_shortgi"},
9548
9549 {WE_GET_RTSCTS,
9550 0,
9551 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9552 "get_rtscts"},
9553
9554 {WE_GET_CHWIDTH,
9555 0,
9556 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9557 "get_chwidth"},
9558
9559 {WE_GET_ANI_EN_DIS,
9560 0,
9561 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9562 "get_anienable"},
9563
9564 {WE_GET_ANI_POLL_PERIOD,
9565 0,
9566 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9567 "get_aniplen"},
9568
9569 {WE_GET_ANI_LISTEN_PERIOD,
9570 0,
9571 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9572 "get_anilislen"},
9573
9574 {WE_GET_ANI_OFDM_LEVEL,
9575 0,
9576 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9577 "get_aniofdmlvl"},
9578
9579 {WE_GET_ANI_CCK_LEVEL,
9580 0,
9581 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9582 "get_aniccklvl"},
9583
9584 {WE_GET_DYNAMIC_BW,
9585 0,
9586 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9587 "get_cwmenable"},
9588
9589 {WE_GET_GTX_HT_MCS,
9590 0,
9591 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9592 "get_gtxHTMcs"},
9593
9594 {WE_GET_GTX_VHT_MCS,
9595 0,
9596 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9597 "get_gtxVHTMcs"},
9598
9599 {WE_GET_GTX_USRCFG,
9600 0,
9601 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9602 "get_gtxUsrCfg"},
9603
9604 {WE_GET_GTX_THRE,
9605 0,
9606 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9607 "get_gtxThre"},
9608
9609 {WE_GET_GTX_MARGIN,
9610 0,
9611 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9612 "get_gtxMargin"},
9613
9614 {WE_GET_GTX_STEP,
9615 0,
9616 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9617 "get_gtxStep"},
9618
9619 {WE_GET_GTX_MINTPC,
9620 0,
9621 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9622 "get_gtxMinTpc"},
9623
9624 {WE_GET_GTX_BWMASK,
9625 0,
9626 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9627 "get_gtxBWMask"},
9628
9629 {WE_GET_TX_CHAINMASK,
9630 0,
9631 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9632 "get_txchainmask"},
9633
9634 {WE_GET_RX_CHAINMASK,
9635 0,
9636 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9637 "get_rxchainmask"},
9638
9639 {WE_GET_11N_RATE,
9640 0,
9641 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9642 "get_11nrate"},
9643
9644 {WE_GET_AMPDU,
9645 0,
9646 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9647 "get_ampdu"},
9648
9649 {WE_GET_AMSDU,
9650 0,
9651 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9652 "get_amsdu"},
9653
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009654 {WE_GET_TXPOW_2G,
9655 0,
9656 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9657 "get_txpow2g"},
9658
9659 {WE_GET_TXPOW_5G,
9660 0,
9661 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9662 "get_txpow5g"},
9663
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009664 {WE_GET_PPS_PAID_MATCH,
9665 0,
9666 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9667 "get_paid_match"},
9668
9669 {WE_GET_PPS_GID_MATCH,
9670 0,
9671 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9672 "get_gid_match"},
9673
9674 {WE_GET_PPS_EARLY_TIM_CLEAR,
9675 0,
9676 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9677 "get_tim_clear"},
9678
9679 {WE_GET_PPS_EARLY_DTIM_CLEAR,
9680 0,
9681 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9682 "get_dtim_clear"},
9683
9684 {WE_GET_PPS_EOF_PAD_DELIM,
9685 0,
9686 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9687 "get_eof_delim"},
9688
9689 {WE_GET_PPS_MACADDR_MISMATCH,
9690 0,
9691 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9692 "get_mac_match"},
9693
9694 {WE_GET_PPS_DELIM_CRC_FAIL,
9695 0,
9696 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9697 "get_delim_fail"},
9698
9699 {WE_GET_PPS_GID_NSTS_ZERO,
9700 0,
9701 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9702 "get_nsts_zero"},
9703
9704 {WE_GET_PPS_RSSI_CHECK,
9705 0,
9706 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9707 "get_rssi_chk"},
9708
9709 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
9710 0,
9711 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9712 "get_qpspollcnt"},
9713
9714 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
9715 0,
9716 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9717 "get_qtxwake"},
9718
9719 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
9720 0,
9721 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9722 "get_qwakeintv"},
9723
9724 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
9725 0,
9726 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9727 "get_qnodatapoll"},
9728
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009729 {WE_CAP_TSF,
9730 0,
9731 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9732 "cap_tsf"},
9733
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009734 {WE_GET_TEMPERATURE,
9735 0,
9736 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9737 "get_temp"},
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07009738 {WE_GET_DCM,
9739 0,
9740 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9741 "get_dcm"},
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07009742 {WE_GET_RANGE_EXT,
9743 0,
9744 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9745 "get_range_ext"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009746 /* handlers for main ioctl */
9747 {WLAN_PRIV_SET_CHAR_GET_NONE,
9748 IW_PRIV_TYPE_CHAR | 512,
9749 0,
9750 ""},
9751
9752 /* handlers for sub-ioctl */
9753 {WE_WOWL_ADD_PTRN,
9754 IW_PRIV_TYPE_CHAR | 512,
9755 0,
9756 "wowlAddPtrn"},
9757
9758 {WE_WOWL_DEL_PTRN,
9759 IW_PRIV_TYPE_CHAR | 512,
9760 0,
9761 "wowlDelPtrn"},
9762
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009763 /* handlers for sub-ioctl */
9764 {WE_NEIGHBOR_REPORT_REQUEST,
9765 IW_PRIV_TYPE_CHAR | 512,
9766 0,
9767 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -08009768
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009769 {WE_SET_AP_WPS_IE,
9770 IW_PRIV_TYPE_CHAR | 512,
9771 0,
9772 "set_ap_wps_ie"},
9773
9774 {WE_SET_CONFIG,
9775 IW_PRIV_TYPE_CHAR | 512,
9776 0,
9777 "setConfig"},
9778
9779 /* handlers for main ioctl */
9780 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
9781 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9782 0,
9783 ""},
9784
9785 /* handlers for sub-ioctl */
9786 {WE_SET_WLAN_DBG,
9787 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9788 0,
9789 "setwlandbg"},
9790
Nirav Shahd21a2e32018-04-20 16:34:43 +05309791#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009792 /* handlers for sub-ioctl */
9793 {WE_SET_DP_TRACE,
9794 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9795 0,
9796 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +05309797#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009798
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05309799 {WE_SET_FW_TEST,
9800 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9801 0, "fw_test"},
9802
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009803 /* handlers for main ioctl */
9804 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
9805 0,
9806 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9807 "" },
9808 {WE_GET_TSF,
9809 0,
9810 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9811 "get_tsf" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009812
9813 {WE_SET_DUAL_MAC_SCAN_CONFIG,
9814 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
9815 0,
9816 "set_scan_cfg"},
9817
9818 /* handlers for main ioctl */
9819 {WLAN_PRIV_GET_CHAR_SET_NONE,
9820 0,
9821 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9822 ""},
9823
9824 /* handlers for sub-ioctl */
9825 {WE_WLAN_VERSION,
9826 0,
9827 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9828 "version"},
9829 {WE_GET_STATS,
9830 0,
9831 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9832 "getStats"},
Dustin Brownd9322482017-01-09 12:46:03 -08009833 {WE_GET_SUSPEND_RESUME_STATS,
9834 0,
9835 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9836 "getSuspendStats"},
Govind Singha471e5e2015-10-12 17:11:14 +05309837 {WE_LIST_FW_PROFILE,
9838 0,
9839 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9840 "listProfile"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009841 {WE_GET_STATES,
9842 0,
9843 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9844 "getHostStates"},
9845 {WE_GET_CFG,
9846 0,
9847 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9848 "getConfig"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009849 {WE_GET_RSSI,
9850 0,
9851 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9852 "getRSSI"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009853 {WE_GET_WMM_STATUS,
9854 0,
9855 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9856 "getWmmStatus"},
9857 {
9858 WE_GET_CHANNEL_LIST,
9859 0,
9860 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9861 "getChannelList"
9862 },
9863#ifdef FEATURE_WLAN_TDLS
9864 {
9865 WE_GET_TDLS_PEERS,
9866 0,
9867 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9868 "getTdlsPeers"
9869 },
9870#endif
9871#ifdef WLAN_FEATURE_11W
9872 {
9873 WE_GET_11W_INFO,
9874 0,
9875 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9876 "getPMFInfo"
9877 },
9878#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009879 {
9880 WE_GET_IBSS_STA_INFO,
9881 0,
9882 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9883 "getIbssSTAs"
9884 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009885 {WE_GET_PHYMODE,
9886 0,
9887 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9888 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -08009889#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009890 {WE_GET_OEM_DATA_CAP,
9891 0,
9892 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9893 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -08009894#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009895 {WE_GET_SNR,
9896 0,
9897 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
9898 "getSNR"},
9899
9900 /* handlers for main ioctl */
9901 {WLAN_PRIV_SET_NONE_GET_NONE,
9902 0,
9903 0,
9904 ""},
9905
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009906 /* handlers for sub-ioctl */
9907 {
9908 WE_IBSS_GET_PEER_INFO_ALL,
9909 0,
9910 0,
9911 "ibssPeerInfoAll"
9912 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009913 {WE_GET_RECOVERY_STAT,
9914 0,
9915 0,
9916 "getRecoverStat"},
Govind Singha471e5e2015-10-12 17:11:14 +05309917
9918 {WE_GET_FW_PROFILE_DATA,
9919 0,
9920 0,
9921 "getProfileData"},
9922
9923 {WE_SET_REASSOC_TRIGGER,
9924 0,
9925 0,
9926 "reassoc"},
9927
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009928 {WE_STOP_OBSS_SCAN,
9929 0,
9930 0,
9931 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009932 /* handlers for main ioctl */
9933 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
9934 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9935 0,
9936 ""},
9937
9938 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009939 {WE_IBSS_GET_PEER_INFO,
9940 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9941 0,
9942 "ibssPeerInfo"},
9943
Rachit Kankane0baf6e72018-01-19 15:01:50 +05309944#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009945 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009946 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
9947 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9948 0,
9949 "setdumplog"},
9950
9951 {WE_MTRACE_DUMP_CMD,
9952 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9953 0,
9954 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +05309955#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -08009956
9957 {WE_POLICY_MANAGER_CINFO_CMD,
9958 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9959 0,
9960 "pm_cinfo"},
9961
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009962#ifdef MPC_UT_FRAMEWORK
9963 {WE_POLICY_MANAGER_CLIST_CMD,
9964 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9965 0,
9966 "pm_clist"},
9967
9968 {WE_POLICY_MANAGER_DLIST_CMD,
9969 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9970 0,
9971 "pm_dlist"},
9972
9973 {WE_POLICY_MANAGER_DBS_CMD,
9974 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9975 0,
9976 "pm_dbs"},
9977
9978 {WE_POLICY_MANAGER_PCL_CMD,
9979 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9980 0,
9981 "pm_pcl"},
9982
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009983 {WE_POLICY_MANAGER_ULIST_CMD,
9984 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9985 0,
9986 "pm_ulist"},
9987
9988 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
9989 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9990 0,
9991 "pm_query_action"},
9992
9993 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
9994 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9995 0,
9996 "pm_query_allow"},
9997
9998 {WE_POLICY_MANAGER_SCENARIO_CMD,
9999 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10000 0,
10001 "pm_run_scenario"},
10002
10003 {WE_POLICY_SET_HW_MODE_CMD,
10004 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10005 0,
10006 "pm_set_hw_mode"},
10007#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010008 {
10009 WE_UNIT_TEST_CMD,
10010 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10011 0,
10012 "setUnitTestCmd"
10013 },
Manjeet Singhf82ed072016-07-08 11:40:00 +053010014 {
10015 WE_MAC_PWR_DEBUG_CMD,
10016 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10017 0,
10018 "halPwrDebug"
10019 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010020
10021#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10022 {WE_LED_FLASHING_PARAM,
10023 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10024 0,
10025 "gpio_control"},
10026#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010027#ifdef WLAN_DEBUG
10028 {WE_SET_CHAN_AVOID,
10029 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10030 0,
10031 "ch_avoid"},
10032#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010033 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010034 {WLAN_PRIV_FIPS_TEST,
10035 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10036 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10037 "fips_test"},
10038
10039 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010040 {WLAN_PRIV_ADD_TSPEC,
10041 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10042 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10043 "addTspec"},
10044
10045 /* handlers for main ioctl */
10046 {WLAN_PRIV_DEL_TSPEC,
10047 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10048 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10049 "delTspec"},
10050
10051 /* handlers for main ioctl */
10052 {WLAN_PRIV_GET_TSPEC,
10053 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10054 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10055 "getTspec"},
10056
10057 /* handlers for main ioctl - host offload */
10058 {
10059 WLAN_PRIV_SET_HOST_OFFLOAD,
Srinivas Girigowda077143e2017-03-25 10:47:27 -070010060 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010061 0,
10062 "setHostOffload"
10063 }
10064 ,
10065
10066 {
10067 WLAN_GET_WLAN_STATISTICS,
10068 0,
10069 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10070 "getWlanStats"
10071 }
10072 ,
10073
10074 {
10075 WLAN_SET_KEEPALIVE_PARAMS,
Mahesh A Saptasagar72d2e4b2016-04-20 12:44:17 +053010076 IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) |
10077 IW_PRIV_SIZE_FIXED,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010078 0,
10079 "setKeepAlive"
10080 }
10081 ,
10082#ifdef WLAN_FEATURE_PACKET_FILTERING
10083 {
10084 WLAN_SET_PACKET_FILTER_PARAMS,
Hanumanth Reddy Pothulab3ef4162016-10-25 15:13:26 +053010085 IW_PRIV_TYPE_BYTE |
10086 sizeof(struct pkt_filter_cfg),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010087 0,
10088 "setPktFilter"
10089 }
10090 ,
10091#endif
10092#ifdef FEATURE_WLAN_SCAN_PNO
10093 {
10094 WLAN_SET_PNO,
10095 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10096 0,
10097 "setpno"
10098 }
10099 ,
10100#endif
10101 {
10102 WLAN_SET_BAND_CONFIG,
10103 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10104 0,
10105 "SETBAND"
10106 }
10107 ,
10108 {
Dustin Brown0cbc7572016-12-16 13:54:40 -080010109 WLAN_PRIV_SET_MCBC_FILTER,
Dustin Brown860566f2017-01-31 15:24:43 -080010110 0,
Dustin Brown0cbc7572016-12-16 13:54:40 -080010111 0,
10112 "setMCBCFilter"
10113 }
10114 ,
Dustin Brown0cbc7572016-12-16 13:54:40 -080010115
10116 {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010117 WLAN_GET_LINK_SPEED,
10118 IW_PRIV_TYPE_CHAR | 18,
10119 IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed"
10120 }
10121 ,
10122
10123 /* handlers for main ioctl */
10124 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
10125 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10126 0,
10127 ""}
10128 ,
10129 {WE_SET_SMPS_PARAM,
10130 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10131 0, "set_smps_param"}
10132 ,
10133 {WLAN_SET_DOT11P_CHANNEL_SCHED,
10134 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
10135 0, "set_dot11p" }
10136 ,
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010137#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010138 {WE_SET_FW_CRASH_INJECT,
10139 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10140 0, "crash_inject"}
10141 ,
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010142#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053010143#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070010144 {WE_LOG_BUFFER,
10145 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10146 0, "log_buffer"}
10147 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010148#endif
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010149#ifdef WLAN_SUSPEND_RESUME_TEST
10150 {WE_SET_WLAN_SUSPEND,
10151 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10152 0, "wlan_suspend"}
10153 ,
10154 {WE_SET_WLAN_RESUME,
10155 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10156 0, "wlan_resume"}
10157 ,
10158#endif
Govind Singha471e5e2015-10-12 17:11:14 +053010159 {WE_ENABLE_FW_PROFILE,
10160 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10161 0, "enableProfile"}
10162 ,
10163 {WE_SET_FW_PROFILE_HIST_INTVL,
10164 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10165 0, "set_hist_intvl"}
10166 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010167 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
10168 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10169 0, "set_fw_mode_cfg"}
10170 ,
Nirav Shahd21a2e32018-04-20 16:34:43 +053010171#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010172 {WE_DUMP_DP_TRACE_LEVEL,
10173 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10174 0, "dump_dp_trace"}
10175 ,
Nirav Shahd21a2e32018-04-20 16:34:43 +053010176#endif
Nirav Shah73713f72018-05-17 14:50:41 +053010177#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070010178 {WE_SET_MON_MODE_CHAN,
10179 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10180 0, "setMonChan"}
10181 ,
Nirav Shah73713f72018-05-17 14:50:41 +053010182#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070010183 {WE_GET_ROAM_SYNCH_DELAY,
10184 0,
10185 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10186 "hostroamdelay"}
10187 ,
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080010188 {WE_SET_11AX_RATE,
10189 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10190 0,
10191 "set_11ax_rate"}
10192 ,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010193 {WE_SET_DCM,
10194 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10195 0,
10196 "enable_dcm"}
10197 ,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010198 {WE_SET_RANGE_EXT,
10199 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10200 0,
Naveen Rawat53448ea2017-11-27 11:43:18 -080010201 "range_ext"}
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010202 ,
Naveen Rawatc921c7b2017-06-13 17:29:51 -070010203
10204 {WLAN_PRIV_SET_FTIES,
10205 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
10206 0,
10207 "set_ft_ies"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010208};
10209
10210const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010211 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053010212 .num_private = QDF_ARRAY_SIZE(we_private),
10213 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010214
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010215 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010216 .private = (iw_handler *) we_private,
10217 .private_args = we_private_args,
10218 .get_wireless_stats = NULL,
10219};
10220
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010221void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010222{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010223 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010224
Dustin Browne7e71d32018-05-11 16:00:08 -070010225 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010226
Dustin Browne74003f2018-03-14 12:51:58 -070010227 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010228}
10229
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010230void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010231{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010232 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010233
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010234 rtnl_lock();
10235 dev->wireless_handlers = NULL;
10236 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010237
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010238 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010239}