blob: b99268a95f7281730d9605f7182d97b89e51124a [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05302 * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019/**
20 * DOC: wlan_hdd_wext.c
21 *
22 * Linux Wireless Extensions Implementation
23 */
24
25#include <linux/version.h>
26#include <linux/module.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29#include <linux/wireless.h>
30#include <mac_trace.h>
31#include <wlan_hdd_includes.h>
32#include <cds_api.h>
Rajeev Kumarea95edd2017-01-11 20:49:36 -080033#include "scheduler_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080034#include <net/arp.h>
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080035#include <cdp_txrx_cmn.h>
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070036#include <cdp_txrx_stats.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080037#include "sir_params.h"
38#include "csr_api.h"
39#include "csr_inside_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080040#include "sme_rrm_internal.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080041#include <ani_global.h>
42#include "dot11f.h"
43#include <wlan_hdd_wowl.h>
44#include <wlan_hdd_cfg.h>
45#include <wlan_hdd_wmm.h>
46#include "utils_api.h"
47#include "wlan_hdd_p2p.h"
48#ifdef FEATURE_WLAN_TDLS
49#include "wlan_hdd_tdls.h"
50#endif
51
52#include "cds_ieee80211_common.h"
53#include "ol_if_athvar.h"
54#include "dbglog_host.h"
55#include "wma.h"
56
57#include "wlan_hdd_power.h"
58#include "qwlan_version.h"
59#include "wlan_hdd_host_offload.h"
60
61#include <linux/wireless.h>
62#include <net/cfg80211.h>
63
64#include "wlan_hdd_misc.h"
65
66#include "qc_sap_ioctl.h"
67#include "sme_api.h"
68#include "wma_types.h"
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070069#include "qdf_str.h"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053070#include "qdf_trace.h"
Dustin Brownebb16d12018-11-29 17:52:07 -080071#include "qdf_types_test.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072#include "wlan_hdd_assoc.h"
73#include "wlan_hdd_ioctl.h"
74#include "wlan_hdd_scan.h"
75#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080076#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080077#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070078#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070079#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080080#include "wlan_hdd_ocb.h"
81#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080082#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070083#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053084#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070085#ifdef WLAN_SUSPEND_RESUME_TEST
86#include "wlan_hdd_driver_ops.h"
87#include "hif.h"
Rajeev Kumar9bb2e852016-09-24 12:29:25 -070088#include "pld_common.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070089#endif
Dhanashri Atree7d442a2016-07-14 18:20:29 -070090#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053091#include "cds_utils.h"
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -070092#include "wlan_osif_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080093#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080094#include <cdp_txrx_stats.h>
95#include <cds_api.h>
Dustin Brown6099ddc2018-07-06 14:32:53 -070096#include "wlan_dsc_test.h"
Abhishek Singh0481d662017-04-11 18:20:11 +053097#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070098#include "wlan_hdd_regulatory.h"
99#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +0530100#include "wlan_hdd_packet_filter_api.h"
Naveen Rawat3ff5cff2018-01-29 14:31:16 -0800101#include "wlan_cp_stats_mc_ucfg_api.h"
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +0530102#include "wlan_mlme_ucfg_api.h"
Wu Gao93816212018-08-31 16:49:54 +0800103#include "cfg_mlme_sta.h"
Arif Hussain43e09712018-09-18 19:31:57 -0700104#include "wlan_mlme_public_struct.h"
Wu Gao93816212018-08-31 16:49:54 +0800105#include "cfg_ucfg_api.h"
Krunal Sonie71838d2018-09-27 10:45:05 -0700106#include "wlan_policy_mgr_ucfg.h"
Harprit Chhabadabec6de42018-09-10 10:21:15 -0700107#include "wlan_mlme_public_struct.h"
108#include "cfg_ucfg_api.h"
109#include "cfg_mlme_threshold.h"
Wu Gao66454f12018-09-26 19:55:41 +0800110#include "wlan_pmo_cfg.h"
111#include "wlan_pmo_ucfg_api.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530112
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800113/* Private ioctls and their sub-ioctls */
114#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
115#define WE_SET_11D_STATE 1
116#define WE_WOWL 2
117#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530118/*
119 * <ioctl>
120 * setMaxAssoc - Sets the maximum number of associated stations
121 *
122 * @INPUT: 1 to 32
123 *
124 * @OUTPUT: None
125 *
126 * This IOTCL sets the maximum number of associated stations
127 *
128 * @E.g: iwpriv wlan0 setMaxAssoc <value>
129 *
130 * Supported Feature: STA
131 *
132 * Usage: Internal/External
133 *
134 * </ioctl>
135 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800136#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530137/*
138 * <ioctl>
Jeff Johnsonf2cf6592018-05-06 16:27:44 -0700139 * scan_disable - Disable scan
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530140 *
141 * @INPUT: set_value
142 *
143 * @OUTPUT: None
144 *
145 * This IOCTL is used to set disable scan
146 *
147 * @E.g: iwpriv wlan0 scan_disable 1
148 *
149 * Supported Feature: Scan
150 *
151 * Usage: Internal/External
152 *
153 * </ioctl>
154 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800155#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530156/*
157 * <ioctl>
158 * inactivityTO - sets the timeout value for inactivity data while
159 * in power save mode
160 *
161 * @INPUT: int1…..int255
162 *
163 * @OUTPUT: None
164 *
165 * This IOCTL set the timeout value for inactivity data in power save mode
166 *
167 * @E.g: iwpriv wlan0 inactivityTO 20
168 *
169 * Supported Feature: STA
170 *
171 * Usage: Internal/External
172 *
173 * </ioctl>
174 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800175#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530176/*
177 * <ioctl>
178 * setMaxTxPower - Dynamically sets the maximum transmission power
179 *
180 * @INPUT: Transmission power in dBm
181 *
182 * @OUTPUT: None
183 *
184 * This IOCTL dynamically sets the maximum transmission power
185 * This setting does not persist over reboots
186 *
187 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
188 *
189 * Supported Feature: STA
190 *
191 * Usage: Internal/External
192 *
193 * </ioctl>
194 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800195#define WE_SET_MAX_TX_POWER 7
Jeff Johnsonfab9b252017-10-28 15:44:34 -0700196/* 8 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800197#define WE_SET_TM_LEVEL 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530198/*
199 * <ioctl>
200 * setphymode - Set the phymode dynamically
201 *
202 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
203 *
204 * @OUTPUT: None
205 *
206 * This IOCTL sets the phymode dynamically
207 *
208 * @E.g: iwpriv wlan0 setphymode 10
209 *
210 * Supported Feature: STA
211 *
212 * Usage: Internal/External
213 *
214 * </ioctl>
215 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800216#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530217/*
218 * <ioctl>
219 * nss - Set the number of spatial streams
220 *
221 * @INPUT: int1…..int3
222 *
223 * @OUTPUT: None
224 *
225 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
226 *
227 * @E.g: iwpriv wlan0 nss 2
228 *
229 * Supported Feature: STA
230 *
231 * Usage: Internal/External
232 *
233 * </ioctl>
234 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800235#define WE_SET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530236/*
237 * <ioctl>
238 * ldpc - Enables or disables LDPC
239 *
240 * @INPUT: 0 – Disable, 1 - Enable
241 *
242 * @OUTPUT: None
243 *
244 * This IOCTL enables or disables LDPC
245 *
246 * @E.g: iwpriv wlan0 ldpc 1
247 *
248 * Supported Feature: STA
249 *
250 * Usage: Internal/External
251 *
252 * </ioctl>
253 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800254#define WE_SET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530255/*
256 * <ioctl>
257 * tx_stbc - Enables or disables tx_stbc
258 *
259 * @INPUT: Int 0 – Disable, 1 - Enable
260 *
261 * @OUTPUT: None
262 *
263 * This IOTCL used to enables or disables tx_stbc
264 *
265 * @E.g: iwpriv wlan0 tx_stbc <value>
266 *
267 * Supported Feature: STA
268 *
269 * Usage: Internal/External
270 *
271 * </ioctl>
272 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800273#define WE_SET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530274/*
275 * <ioctl>
276 * rx_stbc - Set the rx_stbc parameter
277 *
278 * @INPUT: Int 0 – Disable, 1 - Enable
279 *
280 * @OUTPUT: None
281 *
282 * This IOTCL used to set rx_stbc parameter
283 *
284 * @E.g: iwpriv wlan0 rx_stbc <value>
285 *
286 * Supported Feature: STA
287 *
288 * Usage: Internal/External
289 *
290 * </ioctl>
291 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800292#define WE_SET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530293/*
294 * <ioctl>
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800295 * shortgi - Sets the short-guard interval
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530296 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800297 * @INPUT: Fixed Rate: 0 - 400ns, 1 - 800ns, 2 - 1600ns, 3 - 3200us
298 * Auto Rate: 8 - 400ns, 9 - 800ns, 10 - 1600ns, 11 - 3200us
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530299 *
300 * @OUTPUT: None
301 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800302 * This IOCTL sets the short-guard interval.
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530303 *
304 * @E.g: iwpriv wlan0 shortgi <value>
305 *
306 * Supported Feature: STA
307 *
308 * Usage: Internal/External
309 *
310 * </ioctl>
311 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800312#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530313/*
314 * <ioctl>
315 * enablertscts - enables or disables rts/cts.
316 *
317 * @INPUT: 1-Enable , 0-Disable
318 *
319 * @OUTPUT: None
320 *
321 * This IOCTL enables or disables rts/cts.
322 *
323 * @E.g: iwpriv wlan0 enablertscts <value>
324 *
325 * Supported Feature: STA
326 *
327 * Usage: Internal/External
328 *
329 * </ioctl>
330 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800331#define WE_SET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530332/*
333 * <ioctl>
334 * chwidth - Set the channel bandwidth
335 *
336 * @INPUT: 0-20mhz to 3-160mhz
337 *
338 * @OUTPUT: None
339 *
340 * This IOTCL used to set the channel bandwidth
341 *
342 * @E.g: iwpriv wlan0 chwidth 1
343 *
344 * Supported Feature: STA
345 *
346 * Usage: Internal/External
347 *
348 * </ioctl>
349 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800350#define WE_SET_CHWIDTH 17
351#define WE_SET_ANI_EN_DIS 18
352#define WE_SET_ANI_POLL_PERIOD 19
353#define WE_SET_ANI_LISTEN_PERIOD 20
354#define WE_SET_ANI_OFDM_LEVEL 21
355#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530356/*
357 * <ioctl>
358 * cwmenable - Enables or disables the dynamic channel bandwidth
359 *
360 * @INPUT: 0-Disable, 1-Enable
361 *
362 * @OUTPUT: None
363 *
364 * This IOTCL used to enables or disables the dynamic channel bandwidth
365 *
366 * @E.g: iwpriv wlan0 cwmenable <value>
367 *
368 * Supported Feature: STA
369 *
370 * Usage: Internal/External
371 *
372 * </ioctl>
373 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800374#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530375/*
376 * <ioctl>
377 * txchainmask - This IOCTL sets the current Tx chain mask
378 *
379 * @INPUT: Mask Value
380 *
381 * @OUTPUT: None
382 *
383 * This IOCTL sets the current Tx chain mask
384 *
385 * @E.g: iwpriv wlan0 txchainmask 1
386 *
387 * Supported Feature: STA
388 *
389 * Usage: Internal/External
390 *
391 * </ioctl>
392 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800393#define WE_SET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530394/*
395 * <ioctl>
396 * rxchainmask - Sets the current Rx chain mask
397 *
398 * @INPUT: Mask Value
399 *
400 * @OUTPUT: None
401 *
402 * This IOCTL sets the current Rx chain mask. This command is the
403 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
404 *
405 * @E.g: iwpriv wlan0 rxchainmask <value>
406 *
407 * Supported Feature: STA
408 *
409 * Usage: Internal/External
410 *
411 * </ioctl>
412 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800413#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530414/*
415 * <ioctl>
416 * set11NRates - Fixes the Tx data rate of the 11N mode.
417 *
418 * @INPUT: 0x1b to 0x8f
419 *
420 * @OUTPUT: None
421 *
422 * This IOCTL fixes the Tx data rate of the 11N mode.
423 *
424 * @E.g: iwpriv wlan0 set11NRates 0x85
425 *
426 * Supported Feature: STA
427 *
428 * Usage: Internal/External
429 *
430 * </ioctl>
431 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800432#define WE_SET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530433/*
434 * <ioctl>
435 * ampdu - Set the the maximum subframe of ampdu
436 *
437 * @INPUT: int 1 to int 63
438 *
439 * @OUTPUT: None
440 *
441 * This IOCTL sets the maximum subframe of ampdu.
442 *
443 * @E.g: iwpriv wlan0 ampdu 9
444 *
445 * Supported Feature: STA
446 *
447 * Usage: Internal/External
448 *
449 * </ioctl>
450 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800451#define WE_SET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530452/*
453 * <ioctl>
454 * amsdu - Sets the maximum subframe of amsdu.
455 *
456 * @INPUT: int 1 to int 31
457 *
458 * @OUTPUT: None
459 *
460 * This IOCTL sets the maximum subframe of amsdu.
461 *
462 * @E.g: iwpriv wlan0 amsdu 9
463 *
464 * Supported Feature: STA
465 *
466 * Usage: Internal/External
467 *
468 * </ioctl>
469 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800470#define WE_SET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530471/*
472 * <ioctl>
473 * txpow2g - current 2 GHz Tx power setting
474 *
475 * @INPUT: Tx power in dBm
476 *
477 * @OUTPUT: None
478 *
479 * This IOTCL used to set 2 ghz tx power
480 *
481 * @E.g: iwpriv wlan0 txpow2g
482 *
483 * Supported Feature: STA
484 *
485 * Usage: Internal/External
486 *
487 * </ioctl>
488 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800489#define WE_SET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530490/*
491 * <ioctl>
492 * txpow5g - Current 5 GHz tx power setting
493 *
494 * @INPUT: Tx power in dBm
495 *
496 * @OUTPUT: None
497 *
498 * This IOTCL used to set the 5 ghz txpower
499 *
500 * @E.g: iwpriv wlan0 txpow5g
501 *
502 * Supported Feature: STA
503 *
504 * Usage: Internal/External
505 *
506 * </ioctl>
507 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800508#define WE_SET_TXPOW_5G 30
509/* Private ioctl for firmware debug log */
510#define WE_DBGLOG_LOG_LEVEL 31
511#define WE_DBGLOG_VAP_ENABLE 32
512#define WE_DBGLOG_VAP_DISABLE 33
513#define WE_DBGLOG_MODULE_ENABLE 34
514#define WE_DBGLOG_MODULE_DISABLE 35
515#define WE_DBGLOG_MOD_LOG_LEVEL 36
516#define WE_DBGLOG_TYPE 37
517#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530518/*
519 * <ioctl>
520 * set11ACRates - Fixes the Tx data rate of 11AC
521 *
522 * @INPUT: 0x1 to 0x9
523 *
524 * @OUTPUT: None
525 *
526 * This IOCTL fixes the Tx data rate of 11AC.
527 *
528 * @E.g: iwpriv wlan0 set11ACRates 0x9
529 *
530 * Supported Feature: STA
531 *
532 * Usage: Internal/External
533 *
534 * </ioctl>
535 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800536#define WE_SET_VHT_RATE 39
537#define WE_DBGLOG_REPORT_ENABLE 40
538#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530539/*
540 * <ioctl>
541 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
542 *
543 * @INPUT: Transmission power in dBm
544 *
545 * @OUTPUT: None
546 *
547 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
548 * This setting does not persist over reboots
549 *
550 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
551 *
552 * Supported Feature: STA
553 *
554 * Usage: Internal/External
555 *
556 * </ioctl>
557 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800558#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530559/*
560 * <ioctl>
561 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
562 *
563 * @INPUT: Transmission power in dBm
564 *
565 * @OUTPUT: None
566 *
567 * This IOCTL sets the maximum transmit power for the 5-GHz band
568 * This setting does not persist over reboots
569 *
570 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
571 *
572 * Supported Feature: STA
573 *
574 * Usage: Internal/External
575 *
576 * </ioctl>
577 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800578#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800579#define WE_SET_PKTLOG 44
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530580/* Private ioctl for packet power save */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800581#define WE_PPS_PAID_MATCH 45
582#define WE_PPS_GID_MATCH 46
583#define WE_PPS_EARLY_TIM_CLEAR 47
584#define WE_PPS_EARLY_DTIM_CLEAR 48
585#define WE_PPS_EOF_PAD_DELIM 49
586#define WE_PPS_MACADDR_MISMATCH 50
587#define WE_PPS_DELIM_CRC_FAIL 51
588#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530589/*
590 * <ioctl>
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530591 * rssi_chk - Check the rssi
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530592 *
593 * @INPUT: One argument as input
594 *
595 * @OUTPUT: rssi
596 * wlan0 rssi_chk:56
597 *
598 * This IOTCL used to chek rssi
599 *
600 * @E.g: iwpriv wlan0 rssi_chk <value>
601 *
602 * Supported Feature: STA
603 *
604 * Usage: Internal/External
605 *
606 * </ioctl>
607 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800608#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530609/*
610 * <ioctl>
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530611 * htsmps - Sets the htsmps
612 *
613 * @INPUT: Atleast one int argument
614 *
615 * @OUTPUT: None
616 *
617 * This IOTCL used to set htsmps
618 *
619 * @E.g: iwpriv wlan0 htsmps <value>
620 *
621 * Supported Feature: STA
622 *
623 * Usage: Internal/External
624 *
625 * </ioctl>
626 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800627#define WE_SET_HTSMPS 55
628/* Private ioctl for QPower */
629#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
630#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
631#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
632#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800633/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530634/*
635 * <ioctl>
636 * gtxHTMcs - Set the tx HTM value
637 *
638 * @INPUT: Atleast one int orgument
639 *
640 * @OUTPUT: None
641 *
642 * This IOTCL sets htm tx value
643 *
644 * @E.g: iwpriv wlan0 gtxHTMcs <value>
645 *
646 * Supported Feature: STA
647 *
648 * Usage: Internal/External
649 *
650 * </ioctl>
651 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800652#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530653/*
654 * <ioctl>
655 * gtxVHTMcs - Set gtxVHTMcs value
656 *
657 * @INPUT: Atleast one int argument
658 *
659 * @OUTPUT: None
660 *
661 * This IOTCL used to set gtxVHTMcs value
662 *
663 * @E.g: iwpriv wlan0 gtxVHTMcs <value>
664 *
665 * Supported Feature: STA
666 *
667 * Usage: Internal/External
668 *
669 * </ioctl>
670 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800671#define WE_SET_GTX_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530672/*
673 * <ioctl>
674 * gtxUsrCfg - Host request for GTX mask
675 *
676 * @INPUT: Atleast one int orgument
677 *
678 * @OUTPUT: None
679 *
680 * This IOTCL used send the host request for GTX mask
681 *
682 * @E.g: iwpriv wlan0 gtxUsrCfg <value>
683 *
684 * Supported Feature: STA
685 *
686 * Usage: Internal/External
687 *
688 * </ioctl>
689 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800690#define WE_SET_GTX_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530691/*
692 * <ioctl>
693 * gtxThre - Set the tx threshold
694 *
695 * @INPUT: Atleast one int argument
696 *
697 * @OUTPUT: None
698 *
699 * This IOTCL used to set tx threshold
700 *
701 * @E.g: iwpriv wlan0 gtxThre <value>
702 *
703 * Supported Feature: STA
704 *
705 * Usage: Internal/External
706 *
707 * </ioctl>
708 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800709#define WE_SET_GTX_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530710/*
711 * <ioctl>
712 * gtxMargin - Set the gtxMargin
713 *
714 * @INPUT: 1 to 32
715 *
716 * @OUTPUT: None
717 *
718 * This IOTCL use dto set gtxMargin
719 *
720 * @E.g: iwpriv wlan0 gtxMargini <value>
721 *
722 * Supported Feature: STA
723 *
724 * Usage: Internal/External
725 *
726 * </ioctl>
727 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800728#define WE_SET_GTX_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530729/*
730 * <ioctl>
731 * gtxStep - Set the gtxStep
732 *
733 * @INPUT: None
734 *
735 * @OUTPUT: None
736 *
737 * This IOTCL used to sets gtxStep
738 *
739 * @E.g: iwpriv wlan0 gtxStep <value>
740 *
741 * Supported Feature: STA
742 *
743 * Usage: Internal/External
744 *
745 * </ioctl>
746 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800747#define WE_SET_GTX_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530748/*
749 * <ioctl>
750 * gtxMinTpc - Sets the gtxMinTpc
751 *
752 * @INPUT: Atleast one int argument
753 *
754 * @OUTPUT: None
755 *
756 * This IOTCL sets the tx MinTpc
757 *
758 * @E.g: iwpriv wlan0 gtxMinTpc <value>
759 *
760 * Supported Feature: STA
761 *
762 * Usage: Internal/External
763 *
764 * </ioctl>
765 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800766#define WE_SET_GTX_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530767/*
768 * <ioctl>
769 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
770 *
771 * @INPUT: Mask value
772 *
773 * @OUTPUT: None
774 *
775 * This IOTCL used to set gtxBWMask
776 *
777 * @E.g: iwpriv wlan0 gtxBWMask <value>
778 *
779 * Supported Feature: STA
780 *
781 * Usage: Internal/External
782 *
783 * </ioctl>
784 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530785
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530786#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530787/*
788 * <ioctl>
789 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
790 *
791 * @INPUT: set_value
792 *
793 * @OUTPUT: None
794 *
795 * This IOCTL is used to set the MCC latency value in milliseconds
796 * during STA-P2P concurrency.
797 *
798 * If 0ms latency is provided, then FW will set to a default.
799 * Otherwise, latency must be at least 30ms.
800 *
801 * @E.g: iwpriv wlan0 setMccLatency 40
802 *
803 *
804 * Supported Feature: Concurrency
805 *
806 * Usage: Internal/External
807 *
808 * </ioctl>
809 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800810#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530811
812/*
813 * <ioctl>
814 * setMccQuota- Set the quota for P2P cases
815 *
816 * @INPUT: set_value [0,100]
817 *
818 * @OUTPUT: None
819 *
820 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
821 *
822 * Currently used to set time quota for 2 MCC vdevs/adapters using
823 * (operating channel, quota) for each mode.
824 * The info is provided run time using iwpriv command:
825 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
826 * Note: the quota provided in command is for the same mode in cmd.
827 * HDD checks if MCC mode is active, gets the second mode and its
828 * operating chan.
829 * Quota for the 2nd role is calculated as 100 - quota of first mode.
830 *
831 * @E.g: iwpriv wlan0 setMccQuota 50
832 * iwpriv p2p0 setMccQuota 50
833 *
834 * Supported Feature: Concurrency
835 *
836 * Usage: Internal/External
837 *
838 * </ioctl>
839 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800840#define WE_MCC_CONFIG_QUOTA 71
841/* Private IOCTL for debug connection issues */
842#define WE_SET_DEBUG_LOG 72
843#ifdef WE_SET_TX_POWER
844#undef WE_SET_TX_POWER
845#endif
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -0800846
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530847/*
848 * <ioctl>
849 * setTxPower - Set the current transmit power
850 *
851 * @INPUT: Transmission power in dBm
852 *
853 * @OUTPUT: None
854 *
855 * This IOCTL sets the current transmit power.
856 * This setting does not persist over reboots.
857 *
858 * @E.g: iwpriv wlan0 setTxPower 10
859 *
860 * Supported Feature: STA
861 *
862 * Usage: Internal/External
863 *
864 * </ioctl>
865 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800866#define WE_SET_TX_POWER 74
867/* Private ioctl for earlyrx power save feature */
868#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
869#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
870#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
871#define WE_SET_EARLY_RX_SLOP_STEP 78
872#define WE_SET_EARLY_RX_INIT_SLOP 79
873#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530874/*
875 * <ioctl>
876 * setMcRate - Set the data rate for multicast data
877 *
878 * @INPUT: 1 to 32
879 *
880 * @OUTPUT: None
881 *
882 * This IOCTL sets the data rate for multicast data. Note that this command
883 * is allowed only in STA, IBSS, or QCMobileAP mode
884 *
885 * @E.g: iwpriv wlan0 setMcRate <value>
886 *
887 * Supported Feature: STA
888 *
889 * Usage: Internal/External
890 *
891 * </ioctl>
892 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800893#define WE_SET_MC_RATE 81
894#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
895/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530896/*
897 * <ioctl>
898 * 5g_ebt - Sets the 5g_ebt
899 *
900 * @INPUT: <value>
901 *
902 * @OUTPUT: None
903 *
904 * This IOTCL used to set 5g_ebt
905 *
906 * @E.g: iwpriv wlan0 5g_ebt <value>
907 *
908 * Supported Feature: STA
909 *
910 * Usage: Internal/External
911 *
912 * </ioctl>
913 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800914#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530915/*
916 * <ioctl>
917 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
918 *
919 * @INPUT: 20 t0 160
920 *
921 * @OUTPUT: None
922 *
923 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
924 *
925 * @E.g: iwpriv wlan0 cts_cbw <value>
926 *
927 * Supported Feature: STA
928 *
929 * Usage: Internal/External
930 *
931 * </ioctl>
932 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800933#define WE_SET_CTS_CBW 84
934#define WE_DUMP_STATS 85
935#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +0530936/* Private sub ioctl for starting/stopping the profiling */
937#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +0530938
Abhishek Singh3c507012016-12-01 11:15:42 +0530939/*
940 * <ioctl>
941 * setChanChange - Initiate channel change
942 *
943 * @INPUT: channel number to switch to.
944 *
945 * @OUTPUT: None
946 *
947 * This IOCTL is used to initiate a channel change.
948 * If called on STA/CLI interface it will send the
949 * ECSA action frame to the connected SAP/GO asking to
950 * initiate the ECSA, if supported.
951 * If called on SAP/GO interface it will initiate
952 * ECSA and ask connected peers to move to new channel.
953 *
954 * @E.g: iwpriv wlan0 setChanChange <channel>
955 * iwpriv wlan0 setChanChange 1
956 *
957 * Supported Feature: ECSA
958 *
959 * Usage: Internal/External
960 *
961 * </ioctl>
962 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +0530963#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +0530964#define WE_SET_CONC_SYSTEM_PREF 89
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800965
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800966/*
967 * <ioctl>
968 * set_11ax_rate - set 11ax rates to FW
969 *
970 * @INPUT: rate code
971 *
972 * @OUTPUT: None
973 *
974 * This IOCTL fixes the Tx data rate of 11AX.
975 *
976 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
977 *
978 * Supported Feature: STA/SAP
979 *
980 * Usage: Internal
981 *
982 * </ioctl>
983 */
984#define WE_SET_11AX_RATE 91
985
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -0700986/*
987 * <ioctl>
988 * enable_dcm - enable Dual Carrier Modulation(DCM)
989 *
990 * @INPUT: 0/1
991 *
992 * @OUTPUT: None
993 *
994 * This IOCTL enables/disables DCM.
995 *
996 * @E.g: iwpriv wlan0 enable_dcm <0/1>
997 *
998 * Supported Feature: STA/SAP
999 *
1000 * Usage: Internal
1001 *
1002 * </ioctl>
1003 */
1004#define WE_SET_DCM 92
1005
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001006/*
1007 * <ioctl>
Naveen Rawat53448ea2017-11-27 11:43:18 -08001008 * range_ext - enable Range extension
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001009 *
1010 * @INPUT: 0/1
1011 *
1012 * @OUTPUT: None
1013 *
1014 * This IOCTL enables/disables Range extension.
1015 *
Naveen Rawat53448ea2017-11-27 11:43:18 -08001016 * @E.g: iwpriv wlan0 range_ext <1/0>
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001017 *
1018 * Supported Feature: STA/SAP
1019 *
1020 * Usage: Internal
1021 *
1022 * </ioctl>
1023 */
1024#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001025
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301026/*
1027 * <ioctl>
1028 * wow_ito - sets the timeout value for inactivity data while
1029 * in power save mode during wow
1030 *
1031 * @INPUT: int
1032 *
1033 * @OUTPUT: None
1034 *
1035 * This IOCTL set the timeout value for inactivity data in power save mode
1036 *
1037 * @E.g: iwpriv wlan0 wow_ito 20
1038 *
1039 * Supported Feature: STA
1040 *
1041 * Usage: External
1042 *
1043 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001044 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301045#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1046
Jeff Johnson011c4502017-10-05 15:25:56 -07001047/*
1048 * <ioctl>
1049 * pdev_reset - reset the pdev
1050 *
1051 * @INPUT: Reset command to initiate:
1052 * TX_FLUSH = 1
1053 * WARM_RESET = 2
1054 * COLD_RESET = 3
1055 * WARM_RESET_RESTORE_CAL = 4
1056 * COLD_RESET_RESTORE_CAL = 5
1057 *
1058 * @OUTPUT: None
1059 *
1060 * This IOCTL is used to reset the pdev. The primary use is
1061 * for internal testing. It is not expected that this will
1062 * be used on a production device.
1063 *
1064 * @E.g: iwpriv wlan0 pdev_reset <command>
1065 * iwpriv wlan0 pdev_reset 1
1066 *
1067 * Supported Feature: None
1068 *
1069 * Usage: Internal
1070 *
1071 * </ioctl>
1072 */
1073#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301074
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301075/*
1076 * setModDTIM - Change Modulated DTIM
1077 *
1078 * @INPUT: set_value.
1079 *
1080 * @OUTPUT: None
1081 *
1082 * This IOCTL is used to change modulated DTIM
1083 * value without WIFI OFF/ON.
1084 *
1085 * @E.g: iwpriv wlan0 setModDTIM <value>
1086 * iwpriv wlan0 setModDTIM 2
1087 *
1088 * Supported Feature: N/A
1089 *
1090 * Usage: Internal/External
1091 *
1092 * </ioctl>
1093 */
1094#define WE_SET_MODULATED_DTIM 96
1095
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001096/* Private ioctls and their sub-ioctls */
1097#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1098#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001099#define WE_GET_WLAN_DBG 4
1100#define WE_GET_MAX_ASSOC 6
1101/* 7 is unused */
1102#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301103
1104/*
1105 * <ioctl>
1106 * getconcurrency - Get concurrency mode
1107 *
1108 * @INPUT: None
1109 *
1110 * @OUTPUT: It shows concurrency value
1111 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1112 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1113 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1114 *
1115 * This IOCTL is used to retrieve concurrency mode.
1116 *
1117 * @E.g: iwpriv wlan0 getconcurrency
1118 * wlan0 getconcurrency:5
1119 * Above value shows STA+P2P_Client
1120 *
1121 * Supported Feature: Concurrency
1122 *
1123 * Usage: Internal/External
1124 *
1125 * </ioctl>
1126 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001127#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301128/*
1129 * <ioctl>
1130 * get_nss - Get the number of spatial STBC streams (NSS)
1131 *
1132 * @INPUT: None
1133 *
1134 * @OUTPUT: NSS
1135 * wlan0 get_nss:2
1136 *
1137 * This IOTCL used to get the number of spatial STBC streams
1138 *
1139 * @E.g: iwpriv wlan0 get_nss
1140 *
1141 * Supported Feature: STA
1142 *
1143 * Usage: Internal/External
1144 *
1145 * </ioctl>
1146 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001147#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301148/*
1149 * <ioctl>
1150 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1151 *
1152 * @INPUT: None
1153 *
1154 * @OUTPUT: ldpc
1155 * wlan0 get_ldpc:1
1156 *
1157 * This IOTCL used to gets the low density parity check (LDPC)
1158 *
1159 * @E.g: iwpriv wlan0 get_ldpc
1160 *
1161 * Supported Feature: STA
1162 *
1163 * Usage: Internal/External
1164 *
1165 * </ioctl>
1166 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001167#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301168/*
1169 * <ioctl>
1170 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1171 *
1172 * @INPUT: None
1173 *
1174 * @OUTPUT: TXSTBC
1175 * wlan0 get_tx_stbc:1
1176 *
1177 * This IOTCL get the value of the current Tx space time block code (STBC)
1178 *
1179 * @E.g: iwpriv wlan0 get_tx_stbc
1180 *
1181 * Supported Feature: STA
1182 *
1183 * Usage: Internal/External
1184 *
1185 * </ioctl>
1186 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001187#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301188/*
1189 * <ioctl>
1190 * get_rx_stbc - Gets the value of the current Rx STBC
1191 *
1192 * @INPUT: None
1193 *
1194 * @OUTPUT: Rx STBC
1195 * wlan0 get_rx_stbc:1
1196 *
1197 * This IOTCL used to get the value of the current Rx STBC
1198 *
1199 * @E.g: iwpriv wlan0 get_rx_stbc
1200 *
1201 * Supported Feature: STA
1202 *
1203 * Usage: Internal/External
1204 *
1205 * </ioctl>
1206 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001207#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301208/*
1209 * <ioctl>
1210 * get_shortgi - Get the value of the current short GI setting
1211 *
1212 * @INPUT: None
1213 *
1214 * @OUTPUT: Enable/disable of shortgi
1215 * wlan0 get_shortgi:1
1216 *
1217 * This IOCTL gets the value of the current short GI setting
1218 *
1219 * @E.g: iwpriv wlan0 get_shortgi
1220 *
1221 * Supported Feature: STA
1222 *
1223 * Usage: Internal/External
1224 *
1225 * </ioctl>
1226 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001227#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301228/*
1229 * <ioctl>
1230 * get_rtscts - Get the value of the current RTS/CTS setting.
1231 *
1232 * @INPUT: None
1233 *
1234 * @OUTPUT: Enable/disable of RTS/CTS
1235 * wlan0 get_rtscts:33
1236 *
1237 * This IOTCL get the value of the current RTS/CTS setting.
1238 *
1239 * @E.g: iwpriv wlan0 get_rtscts
1240 *
1241 * Supported Feature: STA
1242 *
1243 * Usage: Internal/External
1244 *
1245 * </ioctl>
1246 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001247#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301248/*
1249 * <ioctl>
1250 * get_chwidth - Get the current channel width setting
1251 *
1252 * @INPUT: None
1253 *
1254 * @OUTPUT: channel width
1255 * wlan0 get_chwidth:0
1256 *
1257 * This IOTCL get the current channel width setting.
1258 *
1259 * @E.g: iwpriv wlan0 get_chwidth
1260 *
1261 * Supported Feature: STA
1262 *
1263 * Usage: Internal/External
1264 *
1265 * </ioctl>
1266 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001267#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301268/*
1269 * <ioctl>
1270 * get_anienable - Get the anienable
1271 *
1272 * @INPUT: None
1273 *
1274 * @OUTPUT:
1275 * wlan0 get_anienable:0
1276 *
1277 * This IOTCL get the anienable
1278 *
1279 * @E.g: iwpriv wlan0 get_anienable
1280 *
1281 * Supported Feature: STA
1282 *
1283 * Usage: Internal/External
1284 *
1285 * </ioctl>
1286 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001287#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301288/*
1289 * <ioctl>
1290 * get_aniplen - Get the aniplen
1291 *
1292 * @INPUT: None
1293 *
1294 * @OUTPUT:
1295 * wlan0 get_aniplen:0
1296 *
1297 * This IOTCL get the aniplen
1298 *
1299 * @E.g: iwpriv wlan0 get_aniplen
1300 *
1301 * Supported Feature: STA
1302 *
1303 * Usage: Internal/External
1304 *
1305 * </ioctl>
1306 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001307#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301308/*
1309 * <ioctl>
1310 * get_anilislen- Get the anilislen
1311 *
1312 * @INPUT: None
1313 *
1314 * @OUTPUT:
1315 * wlan0 get_anilislen:0
1316 *
1317 * This IOTCL used to get anilislen
1318 *
1319 * @E.g: iwpriv wlan0 get_anilislen
1320 *
1321 * Supported Feature: STA
1322 *
1323 * Usage: Internal/External
1324 *
1325 * </ioctl>
1326 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001327#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301328/*
1329 * <ioctl>
1330 * get_aniofdmlvl - Get the OFDM level
1331 *
1332 * @INPUT: None
1333 *
1334 * @OUTPUT: OFDM
1335 * wlan0 get_aniofdmlvl:0
1336 *
1337 * This IOTCL used to get ofdm level
1338 *
1339 * @E.g: iwpriv wlan0 get_aniofdmlvl
1340 *
1341 * Supported Feature: STA
1342 *
1343 * Usage: Internal/External
1344 *
1345 * </ioctl>
1346 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001347#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301348/*
1349 * <ioctl>
1350 * get_aniccklvl - Get the cck level
1351 *
1352 * @INPUT: None
1353 *
1354 * @OUTPUT:
1355 * wlan0 get_aniccklvl:0
1356 *
1357 * This IOTCL used to get cck level
1358 *
1359 * @E.g: iwpriv wlan0 get_aniccklvl
1360 *
1361 * Supported Feature: STA
1362 *
1363 * Usage: Internal/External
1364 *
1365 * </ioctl>
1366 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001367#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301368/*
1369 * <ioctl>
1370 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1371 *
1372 * @INPUT: None
1373 *
1374 * @OUTPUT: Enable/disable dynamic channel bandwidth
1375 * wlan0 get_cwmenable:0
1376 *
1377 * This IOTCL get the value of the dynamic channel bandwidth setting
1378 *
1379 * @E.g: iwpriv wlan0 get_cwmenable
1380 *
1381 * Supported Feature: STA
1382 *
1383 * Usage: Internal/External
1384 *
1385 * </ioctl>
1386 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001387#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301388/*
1389 * <ioctl>
1390 * get_txchainmask - Get the txchainmask that was set
1391 *
1392 * @INPUT: None
1393 *
1394 * @OUTPUT: txchainmask
1395 * wlan0 get_txchainmask:1
1396 *
1397 * This IOCTL gets the txchainmask that was set
1398 * This command is useful if it was previously set
1399 *
1400 * @E.g: iwpriv wlan0 get_txchainmask
1401 *
1402 * Supported Feature: STA
1403 *
1404 * Usage: Internal/External
1405 *
1406 * </ioctl>
1407 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001408#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301409/*
1410 * <ioctl>
1411 * get_rxchainmask - Get the rxchainmask that was set
1412 *
1413 * @INPUT: None
1414 *
1415 * @OUTPUT: rxchainmask
1416 * wlan0 get_rxchainmask:1
1417 *
1418 * This IOCTL gets the rxchainmask that was set
1419 * This command is useful only if it was previously set.
1420 *
1421 * @E.g: iwpriv wlan0 get_rxchainmask
1422 *
1423 * Supported Feature: STA
1424 *
1425 * Usage: Internal/External
1426 *
1427 * </ioctl>
1428 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001429#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301430/*
1431 * <ioctl>
1432 * get_11nrate - Get the fixed Tx data rate
1433 *
1434 * @INPUT: None
1435 *
1436 * @OUTPUT: Using this command does not return the same value as set
1437 * wlan0 get_11nrate:0
1438 *
1439 * This IOCTL gets the fixed Tx data rate
1440 * This command is useful only if setting the fixed Tx rate.
1441 *
1442 * @E.g: iwpriv wlan0 get_11nrate
1443 *
1444 * Supported Feature: STA
1445 *
1446 * Usage: Internal/External
1447 *
1448 * </ioctl>
1449 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001450#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301451/*
1452 * <ioctl>
1453 * get_ampdu - Get the maximum subframe of ampdu
1454 *
1455 * @INPUT: None
1456 *
1457 * @OUTPUT: Maximum subframe of ampdu
1458 * wlan0 get_ampdu:1
1459 *
1460 * This IOCTL gets the maximum subframe of ampdu
1461 * This command is useful only if setting ampdu.
1462 *
1463 * @E.g: iwpriv wlan0 get_ampdu
1464 *
1465 * Supported Feature: STA
1466 *
1467 * Usage: Internal/External
1468 *
1469 * </ioctl>
1470 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001471#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301472/*
1473 * <ioctl>
1474 * get_amsdu - Get the maximum subframe of amsdu
1475 *
1476 * @INPUT: None
1477 *
1478 * @OUTPUT: Maximum subframe of amsdu
1479 * wlan0 get_amsdu:1
1480 *
1481 * This IOCTL gets the maximum subframe of amsdu.
1482 * This command is useful only if setting amsdu
1483 *
1484 * @E.g: iwpriv wlan0 get_amsdu
1485 *
1486 * Supported Feature: STA
1487 *
1488 * Usage: Internal/External
1489 *
1490 * </ioctl>
1491 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001492#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301493/*
1494 * <ioctl>
1495 * get_txpow2g - Get the current 2 GHz Tx power setting
1496 *
1497 * @INPUT: None
1498 *
1499 * @OUTPUT: Tx Power in dbm
1500 * wlan0 get_txpow2g:0
1501 *
1502 * This IOCTL gets the current 2 GHz Tx power setting
1503 * This command is useful if setting Tx power
1504 *
1505 * @E.g: iwpriv wlan0 get_txpow2g
1506 *
1507 * Supported Feature: STA
1508 *
1509 * Usage: Internal/External
1510 *
1511 * </ioctl>
1512 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001513#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301514/*
1515 * <ioctl>
1516 * get_txpow5g - Get the current 5 GHz Tx power setting
1517 *
1518 * @INPUT: None
1519 *
1520 * @OUTPUT: Tx Power in dbm
1521 * wlan0 get_txpow5g:0
1522 *
1523 * This IOCTL gets the current 5 GHz Tx power setting
1524 * This command is useful if setting Tx power
1525 *
1526 * @E.g: iwpriv wlan0 get_txpow5g
1527 *
1528 * Supported Feature: STA
1529 *
1530 * Usage: Internal/External
1531 *
1532 * </ioctl>
1533 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001534#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001535/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001536#define WE_GET_PPS_PAID_MATCH 32
1537#define WE_GET_PPS_GID_MATCH 33
1538#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1539#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1540#define WE_GET_PPS_EOF_PAD_DELIM 36
1541#define WE_GET_PPS_MACADDR_MISMATCH 37
1542#define WE_GET_PPS_DELIM_CRC_FAIL 38
1543#define WE_GET_PPS_GID_NSTS_ZERO 39
1544#define WE_GET_PPS_RSSI_CHECK 40
1545/* Private ioctl for QPower */
1546#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1547#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1548#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1549#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001550/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301551/*
1552 * <ioctl>
1553 * get_gtxHTMcs - Get the tx HTM
1554 *
1555 * @INPUT: None
1556 *
1557 * @OUTPUT: HTM
1558 * wlan0 get_gtxHTMcs:32896
1559 *
1560 * This IOTCL used to get HTM
1561 *
1562 * @E.g: iwpriv wlan0 get_gtxHTMcs
1563 *
1564 * Supported Feature: STA
1565 *
1566 * Usage: Internal/External
1567 *
1568 * </ioctl>
1569 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001570#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301571/*
1572 * <ioctl>
1573 * get_gtxVHTMcs - Get the VHTM
1574 *
1575 * @INPUT: None
1576 *
1577 * @OUTPUT: VHTM
1578 * wlan0 get_gtxVHTMcs:524800
1579 *
1580 * This IOTCL used to get the VHTM
1581 *
1582 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1583 *
1584 * Supported Feature: STA
1585 *
1586 * Usage: Internal/External
1587 *
1588 * </ioctl>
1589 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001590#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301591/*
1592 * <ioctl>
1593 * get_gtxUsrCfg - Get the tx cfg
1594 *
1595 * @INPUT: None
1596 *
1597 * @OUTPUT: TXCFG
1598 * wlan0 get_gtxUsrCfg:32
1599 *
1600 * This IOTCL used to get the tx cfg
1601 *
1602 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1603 *
1604 * Supported Feature: STA
1605 *
1606 * Usage: Internal/External
1607 *
1608 * </ioctl>
1609 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001610#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301611/*
1612 * <ioctl>
1613 * get_gtxThre - Get the tx threshold
1614 *
1615 * @INPUT: None
1616 *
1617 * @OUTPUT: Threshold
1618 * wlan0 get_gtxThre:3
1619 *
1620 * This IOCTL is used to get tx threshold
1621 *
1622 * @E.g: iwpriv wlan0 get_gtxThre
1623 *
1624 * Supported Feature: STA
1625 *
1626 * Usage: Internal/External
1627 *
1628 * </ioctl>
1629 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001630#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301631/*
1632 * <ioctl>
1633 * get_gtxMargin - Get the tx margin
1634 *
1635 * @INPUT: None
1636 *
1637 * @OUTPUT: GTXMARGIN
1638 * wlan0 get_gtxMargin:2
1639 *
1640 * This IOCTL is used to set tx margin
1641 *
1642 * @E.g: iwpriv wlan0 get_gtxMargin
1643 *
1644 * Supported Feature: STA
1645 *
1646 * Usage: Internal/External
1647 *
1648 * </ioctl>
1649 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001650#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301651/*
1652 * <ioctl>
1653 * get_gtxStep - Get the tx step
1654 *
1655 * @INPUT: None
1656 *
1657 * @OUTPUT: GTXSTEP
1658 * wlan0 get_gtxStep:0
1659 *
1660 * This IOCTL is used to get the gtx step
1661 *
1662 * @E.g: iwpriv wlan0 get_gtxStep
1663 *
1664 * Supported Feature: STA
1665 *
1666 * Usage: Internal/External
1667 *
1668 * </ioctl>
1669 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001670#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301671/*
1672 * <ioctl>
1673 * get_gtxMinTpc - Get the tx miminum tpc
1674 *
1675 * @INPUT: None
1676 *
1677 * @OUTPUT: TPC
1678 * wlan0 get_gtxMinTpc:0
1679 *
1680 * This IOCTL is used to get tx miminum tpc
1681 *
1682 * @E.g: iwpriv wlan0 get_gtxMinTpc
1683 *
1684 * Supported Feature: STA
1685 *
1686 * Usage: Internal/External
1687 *
1688 * </ioctl>
1689 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001690#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301691/*
1692 * <ioctl>
1693 * get_gtxBWMask - Get the tx BW MASK
1694 *
1695 * @INPUT: None
1696 *
1697 * @OUTPUT: MASK
1698 * wlan0 get_gtxBWMask:15
1699 *
1700 * This IOCTL is used get gtx bw mask
1701 *
1702 * @E.g: iwpriv wlan0 get_gtxBWMask
1703 *
1704 * Supported Feature: STA
1705 *
1706 * Usage: Internal/External
1707 *
1708 * </ioctl>
1709 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001710#define WE_GET_GTX_BWMASK 54
1711#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001712#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001713#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001714
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001715/*
1716 * <ioctl>
1717 * get_dcm - Get dcm enablement value
1718 *
1719 * @INPUT: None
1720 *
1721 * @OUTPUT: 0/1
1722 * wlan0 get_dcm
1723 *
1724 * This IOCTL is used get dcm value
1725 *
1726 * Supported Feature: STA/SAP
1727 *
1728 * Usage: Internal
1729 *
1730 * </ioctl>
1731 */
1732#define WE_GET_DCM 60
1733
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001734/*
1735 * <ioctl>
1736 * get_dcm - Get range extension enablement value
1737 *
1738 * @INPUT: None
1739 *
1740 * @OUTPUT: 0/1
1741 * wlan0 get_range_ext
1742 *
1743 * This IOCTL is used get range_extension value
1744 *
1745 * Supported Feature: STA/SAP
1746 *
1747 * Usage: Internal
1748 *
1749 * </ioctl>
1750 */
1751#define WE_GET_RANGE_EXT 61
1752
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001753/* Private ioctls and their sub-ioctls */
1754#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1755
1756/* Private ioctls and their sub-ioctls */
1757#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1758#define WE_WOWL_ADD_PTRN 1
1759#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301760/*
1761 * <ioctl>
1762 * neighbor - Send neighbor report request
1763 *
1764 * @INPUT: string
1765 *
1766 * @OUTPUT: None
1767 *
1768 * This IOCTL create a Neighbor report request and send it to peer
1769 *
1770 * @E.g: iwpriv wlan0 neighbor "SSID"
1771 *
1772 * Supported Feature: 11k
1773 *
1774 * Usage: Internal/External
1775 *
1776 * </ioctl>
1777 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001778#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301779/*
1780 * <ioctl>
1781 * set_ap_wps_ie - Set the P2P IE of the probe response
1782 *
1783 * @INPUT: string
1784 *
1785 * @OUTPUT: None
1786 *
1787 * This IOCTL sets the P2P IE of the probe response
1788 *
1789 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1790 *
1791 * Supported Feature: STA
1792 *
1793 * Usage: Internal/External
1794 *
1795 * </ioctl>
1796 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001797#define WE_SET_AP_WPS_IE 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001798#define WE_SET_CONFIG 5
1799
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07001800/*
1801 * <ioctl>
1802 * unit_test - execute component-level unit tests
1803 *
1804 * @INPUT: string - the name of the component to test.
1805 * All tests are executed if unspecified
1806 * @OUTPUT: None
1807 *
1808 * Usage: Internal only
1809 * </ioctl>
1810 */
1811#define WE_UNIT_TEST 6
1812
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001813/* Private ioctls and their sub-ioctls */
1814#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1815#define WE_SET_WLAN_DBG 1
1816#define WE_SET_DP_TRACE 2
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301817#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001818
1819/* Private ioctls and their sub-ioctls */
1820#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1821#define WE_WLAN_VERSION 1
1822#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301823/*
1824 * <ioctl>
1825 * getConfig - gets the values of all configurations listed in WCNSS
1826 *
1827 * @INPUT: None
1828 *
1829 * @OUTPUT: Current configuration to the sys log
1830 * wlan0 getConfig: WLAN configuration written to system log
1831 *
1832 * This IOCTL gets the values of all configurations listed in WCNSS
1833 *
1834 * @E.g: iwpriv wlan0 getConfig
1835 *
1836 * Supported Feature: STA
1837 *
1838 * Usage: Internal/External
1839 *
1840 * </ioctl>
1841 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001842#define WE_GET_CFG 3
1843#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301844/*
1845 * <ioctl>
1846 * getChannelList - Get the available channel list while in QCMobileAP
1847 *
1848 * @INPUT: None
1849 *
1850 * @OUTPUT: Channel list
1851 * wlan0 getChannelList:36 US 1..165
1852 *
1853 * This IOCTL gets the available channel list while in QCMobileAP
1854 *
1855 * @E.g: iwpriv wlan0 getChannelList
1856 *
1857 * Supported Feature: STA
1858 *
1859 * Usage: Internal/External
1860 *
1861 * </ioctl>
1862 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001863#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301864/*
1865 * <ioctl>
1866 * getRSSI - Get the Received Signal Strength Indicator
1867 *
1868 * @INPUT: None
1869 *
1870 * @OUTPUT: RSSI
1871 * wlan0 getRSSI:rsssi=-32
1872 *
1873 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1874 *
1875 * @E.g: iwpriv wlan0 getRSSI
1876 *
1877 * Supported Feature: STA
1878 *
1879 * Usage: Internal/External
1880 *
1881 * </ioctl>
1882 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001883#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001884
1885/*
1886 * <ioctl>
1887 * getSuspendStats - Get suspend/resume stats
1888 *
1889 * @INPUT: None
1890 *
1891 * @OUTPUT: character string containing formatted suspend/resume stats
1892 *
1893 * This ioctl is used to get suspend/resume stats formatted for display.
1894 * Currently it includes suspend/resume counts, wow wake up reasons, and
1895 * suspend fail reasons.
1896 *
1897 * @E.g: iwpriv wlan0 getSuspendStats
1898 * iwpriv wlan0 getSuspendStats
1899 *
1900 * Supported Feature: suspend/resume
1901 *
1902 * Usage: Internal
1903 *
1904 * </ioctl>
1905 */
1906#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001907#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05301908/*
1909 * <ioctl>
1910 * getTdlsPeers - Get all TDLS peers.
1911 *
1912 * @INPUT: None
1913 *
1914 * @OUTPUT: Returns the MAC address of all the TDLS peers
1915 * wlan0 getTdlsPeers:
1916 * MAC Id cap up RSSI
1917 * ---------------------------------
1918 * 00:0a:f5:0e:bd:18 2 Y Y -44
1919 * 00:0a:f5:bf:0e:12 0 N N 0
1920 *
1921 * This IOCTL is used to get all TDLS peers.
1922 *
1923 * @E.g: iwpriv wlan0 getTdlsPeers
1924 *
1925 * Supported Feature: TDLS
1926 *
1927 * Usage: Internal/External
1928 *
1929 * </ioctl>
1930 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001931#define WE_GET_TDLS_PEERS 8
1932#endif
1933#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05301934/*
1935 * <ioctl>
1936 * getPMFInfo - get the PMF info of the connected session
1937 *
1938 * @INPUT: None
1939 *
1940 * @OUTPUT:
1941 * wlan0 getPMFInfo:
1942 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
1943 * Number of Unprotected Disassocs 0
1944 * Number of Unprotected Deauths 0
1945 *
1946 * This IOCTL is used to get the PMF stats/status of the current
1947 * connection.
1948 *
1949 * @e.g:iwpriv wlan0 getPMFInfo
1950 *
1951 * Supported Feature: PMF
1952 *
1953 * Usage: Internal/External
1954 *
1955 * </ioctl>
1956 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001957#define WE_GET_11W_INFO 9
1958#endif
1959#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05301960/*
1961 * <ioctl>
1962 * getIbssSTAs - get ibss sta info
1963 *
1964 * @INPUT: None
1965 *
1966 * @OUTPUT: Give the MAC of the IBSS STA
1967 * wlan0 getIbssSTAs:
1968 * 1 .8c:fd:f0:01:9c:bf
1969 *
1970 * This IOCTL is used to get ibss sta info
1971 *
1972 * @E.g: iwpriv wlan0 getIbssSTAs
1973 *
1974 * Supported Feature: IBSS
1975 *
1976 * Usage: Internal/External
1977 *
1978 * </ioctl>
1979 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001980#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301981/*
1982 * <ioctl>
1983 * getphymode - Get the current phymode.
1984 *
1985 * @INPUT: None
1986 *
1987 * @OUTPUT: In phymode
1988 * wlan0 getphymode:AUTO MODE
1989 *
1990 * This IOCTL used to gets the current phymode.
1991 *
1992 * @E.g: iwpriv wlan0 getphymode
1993 *
1994 * Supported Feature: STA
1995 *
1996 * Usage: Internal/External
1997 *
1998 * </ioctl>
1999 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002000#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002001
2002/*
2003 * <ioctl>
2004 * getOemDataCap - Get the oem data caps.
2005 *
2006 * @INPUT: None
2007 *
2008 * @OUTPUT: oem data capability
2009 *
2010 * This IOCTL used to gets the current oem data cap.
2011 *
2012 * @E.g: iwpriv wlan0 getOemDataCap
2013 *
2014 * Usage: Internal/External
2015 *
2016 * </ioctl>
2017 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002018#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002019
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302020/*
2021 * <ioctl>
2022 * getSNR - Enable SNR Monitoring
2023 *
2024 * @INPUT: None
2025 *
2026 * @OUTPUT: Signal strength/ratio
2027 * wlan0 getSNR:1
2028 *
2029 * This IOCTL is used to get ibss sta info
2030 *
2031 * @E.g: iwpriv wlan0 getSNR
2032 *
2033 * Supported Feature: STA
2034 *
2035 * Usage: Internal/External
2036 *
2037 * </ioctl>
2038 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002039
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002040#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302041#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002042
Krunal Soni6c3859f2018-06-01 19:57:40 -07002043/*
2044 * <ioctl>
2045 *
2046 * get_ba_timeout - to get timeout for each AC
2047 *
2048 * @INPUT: None
2049 *
2050 * @OUTPUT: displays timeout value for each access class
2051 *
2052 * @E.g.: iwpriv wlan0 get_ba_timeout
2053 *
2054 * Usage: Internal
2055 *
2056 * </ioctl>
2057 */
2058#define WE_GET_BA_AGEING_TIMEOUT 16
2059
Krunal Soni5e483782018-10-25 15:42:44 -07002060/*
2061 * <ioctl>
2062 *
2063 * sta_cxn_info - STA connection information
2064 *
2065 * @INPUT: none
2066 *
2067 * @OUTPUT: STA's connection information
2068 *
2069 * This IOCTL is used to get connection's information.
2070 *
2071 * @E.g: iwpriv wlan0 get_cxn_info
2072 *
2073 * Usage: Internal
2074 *
2075 * </ioctl>
2076 */
2077#define WE_GET_STA_CXN_INFO 17
2078
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002079/* Private ioctls and their sub-ioctls */
2080#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302081
2082/*
2083 * <ioctl>
2084 * reassoc - Trigger STA re-association to the connected AP
2085 *
2086 * @INPUT: None
2087 *
2088 * @OUTPUT: None
2089 *
2090 * This IOCTL is used to trigger STA reassociation to the connected AP.
2091 *
2092 * @E.g: iwpriv wlan0 reassoc
2093 *
2094 * Supported Feature: Roaming
2095 *
2096 * Usage: Internal
2097 *
2098 * </ioctl>
2099 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002100#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302101/*
2102 * <ioctl>
2103 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2104 *
2105 * @INPUT: None
2106 *
2107 * @OUTPUT: print ibss peer in info logs
2108 * pPeerInfo->numIBSSPeers = 1
2109 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2110 *
2111 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2112 * in info logs
2113 *
2114 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2115 *
2116 * Supported Feature: IBSS
2117 *
2118 * Usage: Internal/External
2119 *
2120 * </ioctl>
2121 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002122#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002123/* Sub ioctls 11 to 16 are not used */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002124#define WE_GET_RECOVERY_STAT 17
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002125#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302126/*
2127 * <ioctl>
2128 * stop_obss_scan - Stop obss scan
2129 *
2130 * @INPUT: None
2131 *
2132 * @OUTPUT: None
2133 *
2134 * This IOCTL is used to stop obss scan
2135 *
2136 * @E.g: iwpriv wlan0 stop_obss_scan
2137 *
2138 * Supported Feature: Scan
2139 *
2140 * Usage: Internal/External
2141 *
2142 * </ioctl>
2143 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002144#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002145
2146/* Private ioctls and their sub-ioctls */
2147#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2148
2149#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302150/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002151
Manjeet Singhf82ed072016-07-08 11:40:00 +05302152#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002153
Kabilan Kannan6894e6a2017-11-09 14:37:55 -08002154/* subcommand 5 is unused */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302155
Abhishek Singh49b654e2016-12-01 16:11:17 +05302156/*
2157 * <ioctl>
2158 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2159 *
2160 * @INPUT: staid
2161 *
2162 * @OUTPUT: print ibss peer corresponding to staid in info logs
2163 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2164 *
2165 * This IOCTL is used to print the specific ibss peers's MAC,
2166 * rate and RSSI in info logs
2167 *
2168 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2169 * iwpriv wlan0 ibssPeerInfo 0
2170 *
2171 * Supported Feature: IBSS
2172 *
2173 * Usage: Internal/External
2174 *
2175 * </ioctl>
2176 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002177#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002178#define WE_UNIT_TEST_CMD 7
2179
2180#define WE_MTRACE_DUMP_CMD 8
2181#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2182
2183
2184#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2185#define WE_LED_FLASHING_PARAM 10
2186#endif
2187
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302188/*
2189 * <ioctl>
2190 * pm_clist - Increments the index value of the concurrent connection list
2191 * and update with the input parameters provided.
2192 *
2193 * @INPUT: Following 8 arguments:
2194 * @vdev_id: vdev id
2195 * @tx_streams: TX streams
2196 * @rx_streams: RX streams
2197 * @chain_mask: Chain mask
2198 * @type: vdev_type
2199 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2200 * @sub_type: vdev_subtype
2201 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2202 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2203 * @channel: Channel
2204 * @mac: Mac id
2205 *
2206 * @OUTPUT: None
2207 *
2208 * This IOCTL is used to increments the index value of the concurrent connection
2209 * list and update with the input parameters provided.
2210 *
2211 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2212 * sub_type channel mac
2213 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2214 *
2215 * Supported Feature: DBS
2216 *
2217 * Usage: Internal/External
2218 *
2219 * </ioctl>
2220 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002221#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302222
2223/*
2224 * <ioctl>
2225 * pm_dlist - Delete the index from the concurrent connection list that is
2226 * present in the given vdev_id.
2227 *
2228 * @INPUT: delete_all, vdev_id
2229 * @delete_all: delete all indices
2230 * @vdev_id: vdev id
2231 *
2232 * @OUTPUT: None
2233 *
2234 * This IOCTL is used to delete the index from the concurrent connection list
2235 * that is present in the given vdev_id.
2236 *
2237 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2238 * iwpriv wlan0 pm_dlist 0 1
2239 *
2240 * Supported Feature: DBS
2241 *
2242 * Usage: Internal/External
2243 *
2244 * </ioctl>
2245 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002246#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302247
2248/*
2249 * <ioctl>
2250 * pm_dbs - Set dbs capability and system preference
2251 *
2252 * @INPUT: dbs, system_pref
2253 * @dbs: Value of DBS capability to be set
2254 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002255 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302256 *
2257 * @OUTPUT: None
2258 *
2259 * This IOCTL is used to set dbs capability and system preference.
2260 *
2261 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2262 * iwpriv wlan0 pm_dbs 1 0
2263 *
2264 * Supported Feature: DBS
2265 *
2266 * Usage: Internal/External
2267 *
2268 * </ioctl>
2269 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002270#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302271
2272/*
2273 * <ioctl>
2274 * pm_pcl - Set pcl for concurrency mode.
2275 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002276 * @INPUT: policy_mgr_con_mode
2277 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302278 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2279 *
2280 * @OUTPUT: None
2281 *
2282 * This IOCTL is used to set pcl for concurrency mode.
2283 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002284 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302285 * iwpriv wlan0 pm_pcl 0
2286 *
2287 * Supported Feature: DBS
2288 *
2289 * Usage: Internal/External
2290 *
2291 * </ioctl>
2292 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002293#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302294
2295/*
2296 * <ioctl>
2297 * pm_cinfo - Shows the concurrent connection list.
2298 *
2299 * @INPUT: None
2300 *
2301 * @OUTPUT: None
2302 *
2303 * This IOCTL is used to show the concurrent connection list.
2304 *
2305 * @E.g: iwpriv wlan0 pm_cinfo
2306 *
2307 * Supported Feature: DBS
2308 *
2309 * Usage: Internal/External
2310 *
2311 * </ioctl>
2312 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002313#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302314
2315/*
2316 * <ioctl>
2317 * pm_ulist - Updates the index value of the concurrent connection list
2318 * with the input parameters provided.
2319 *
2320 * @INPUT: Following 8 arguments:
2321 * @vdev_id: vdev id
2322 * @tx_streams: TX streams
2323 * @rx_streams: RX streams
2324 * @chain_mask: Chain mask
2325 * @type: vdev_type
2326 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2327 * @sub_type: vdev_subtype
2328 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2329 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2330 * @channel: Channel
2331 * @mac: Mac id
2332 *
2333 * @OUTPUT: None
2334 *
2335 * This IOCTL is used to updates the index value of the concurrent
2336 * connection list with the input parameters provided.
2337 *
2338 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2339 * sub_type channel mac
2340 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2341 *
2342 * Supported Feature: DBS
2343 *
2344 * Usage: Internal/External
2345 *
2346 * </ioctl>
2347 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002348#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302349
2350/*
2351 * <ioctl>
2352 * pm_query_action - Initiate actions needed on current connections as
2353 * per the channel provided.
2354 *
2355 * @INPUT: channel
2356 * @channel: Channel on which new connection will be.
2357 *
2358 * @OUTPUT: None
2359 *
2360 * This IOCTL is used to initiate actions needed on current connections
2361 * as per the channel provided.
2362 *
2363 * @E.g: iwpriv wlan0 pm_query_action channel
2364 * iwpriv wlan0 pm_query_action 6
2365 *
2366 * Supported Feature: DBS
2367 *
2368 * Usage: Internal/External
2369 *
2370 * </ioctl>
2371 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002372#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302373
2374/*
2375 * <ioctl>
2376 * pm_query_allow - Checks for allowed concurrency combination
2377 *
2378 * @INPUT: mode, channel, bandwidth
2379 * @mode: new connection mode
2380 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2381 * @channel: channel on which new connection is coming up
2382 * @bandwidth: Bandwidth requested by the connection
2383 * 0:None 1:5MHz 2:10MHz 3:20MHz
2384 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2385 *
2386 * @OUTPUT: None
2387 *
2388 * This IOCTL is used to checks for allowed concurrency combination.
2389 *
2390 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2391 * iwpriv wlan0 pm_query_allow 0 6 4
2392 *
2393 * Supported Feature: DBS
2394 *
2395 * Usage: Internal/External
2396 *
2397 * </ioctl>
2398 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002399#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302400
2401/*
2402 * <ioctl>
2403 * pm_run_scenario - Create scenario with number of connections provided.
2404 *
2405 * @INPUT: num_of_conn
2406 * @num_of_conn: the number of connections (values: 1~3)
2407 *
2408 * @OUTPUT: None
2409 *
2410 * This IOCTL is used to create scenario with the number of connections
2411 * provided.
2412 *
2413 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2414 * iwpriv wlan0 pm_run_scenario 1
2415 *
2416 * Supported Feature: DBS
2417 *
2418 * Usage: Internal/External
2419 *
2420 * </ioctl>
2421 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002422#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302423
2424/*
2425 * <ioctl>
2426 * pm_set_hw_mode - Set hardware for single/dual mac.
2427 *
2428 * @INPUT: hw_mode
2429 * 0:single mac 1:dual mac
Liangwei Dong509c3472018-05-30 07:05:59 -04002430 * 2: 2x2 5g + 1x1 2g dbs mode
2431 * 3: 2x2 2g + 1x1 5g dbs mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302432 *
2433 * @OUTPUT: None
2434 *
2435 * This IOCTL is used to set hardware for single/dual mac.
2436 *
2437 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2438 * iwpriv wlan0 pm_set_hw_mode 1
2439 *
2440 * Supported Feature: DBS
2441 *
2442 * Usage: Internal/External
2443 *
2444 * </ioctl>
2445 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002446#define WE_POLICY_SET_HW_MODE_CMD 20
2447
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302448/*
2449 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002450 * ch_avoid - unit test SAP channel avoidance
2451 *
2452 * @INPUT: chan avoid ranges
2453 *
2454 * @OUTPUT: none
2455 *
2456 * This IOCTL is used to fake a channel avoidance event.
2457 * To test SAP/GO chan switch during chan avoid event process.
2458 *
2459 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2460 *
2461 * Supported Feature: SAP chan avoidance.
2462 *
2463 * Usage: Internal
2464 *
2465 * </ioctl>
2466 */
2467#define WE_SET_CHAN_AVOID 21
2468
2469/*
2470 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302471 * set_scan_cfg - Set dual MAC scan config parameters.
2472 *
2473 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2474 * @dbs: Value of DBS bit
2475 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2476 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2477 *
2478 * @OUTPUT: None
2479 *
2480 * This IOCTL is used to set the dual MAC scan config.
2481 *
2482 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2483 * single_mac_scan_with_dbs
2484 * iwpriv wlan0 set_scan_cfg 1 0 1
2485 *
2486 * Supported Feature: DBS
2487 *
2488 * Usage: Internal/External
2489 *
2490 * </ioctl>
2491 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002492#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302493
2494/*
2495 * <ioctl>
2496 * set_fw_mode_cfg - Sets the dual mac FW mode config
2497 *
2498 * @INPUT: dbs, dfs
2499 * @dbs: DBS bit
2500 * @dfs: Agile DFS bit
2501 *
2502 * @OUTPUT: None
2503 *
2504 * This IOCTL is used to set the dual mac FW mode config.
2505 *
2506 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2507 * iwpriv wlan0 set_fw_mode_cfg 1 1
2508 *
2509 * Supported Feature: DBS
2510 *
2511 * Usage: Internal/External
2512 *
2513 * </ioctl>
2514 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002515#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002516#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002517/*
2518 * <ioctl>
2519 * txrx_stats - TXRX statistics query
2520 *
2521 * @INPUT: query category, mac id (default mac id is 0)
2522 *
2523 * @OUTPUT: TXRX statistics result
2524 *
2525 * This IOCTL is used to get TXRX statistics counters.
2526 *
2527 * @E.g: iwpriv wlan0 txrx_stats 21 0
2528 * iwpriv wlan0 txrx_stats 21 1
2529 *
2530 * Usage: Internal
2531 *
2532 * </ioctl>
2533 */
2534#define WE_SET_TXRX_STATS 24
2535
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002536
2537#ifdef FEATURE_WLAN_TDLS
2538#undef MAX_VAR_ARGS
2539#define MAX_VAR_ARGS 11
2540#else
2541#undef MAX_VAR_ARGS
2542#define MAX_VAR_ARGS 9
2543#endif
2544
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002545/*
2546 * <ioctl>
2547 * fips_test - Perform a FIPS test
2548 *
2549 * @INPUT: Binary representation of the following packed structure
2550 *
2551 * @OUTPUT: Binary representation of the following packed structure
2552 *
2553 * This IOCTL is used to perform FIPS certification testing
2554 *
2555 * @E.g: iwpriv wlan0 fips_test <test vector>
2556 *
2557 * iwpriv wlan0 fips_test <tbd>
2558 *
2559 * Supported Feature: FIPS
2560 *
2561 * Usage: Internal
2562 *
2563 * </ioctl>
2564 */
2565#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2566
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002567/* Private ioctls (with no sub-ioctls) */
2568/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302569/*
2570 * <ioctl>
2571 * addTspec - Add TSPEC for each AC
2572 *
2573 * @INPUT: 19 TSPEC params
2574 * @[arg0]: handle
2575 * @[arg1]: tid
2576 * @[arg2]: dir
2577 * @[arg3]: psb
2578 * @[arg4]: up
2579 * @[arg5]: nomMsduSize
2580 * @[arg6]: maxMsduSize
2581 * @[arg7]: minDataRate
2582 * @[arg8]: meanDataRate
2583 * @[arg9]: peakDataRate
2584 * @[arg10]: maxBurstSize
2585 * @[arg11]: minPhyRate
2586 * @[arg12]: sba
2587 * @[arg13]: minServiceIntv
2588 * @[arg14]: suspendIntv
2589 * @[arg15]: burstSizeDefn
2590 * @[arg16]: ackPolicy
2591 * @[arg17]: inactivityPeriod
2592 * @[arg18]: maxServiceIntv
2593 *
2594 * @OUTPUT: Success/Failure
2595 *
2596 * This IOCTL is used to add TSPEC for each AC.
2597 *
2598 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2599 * <maxMsduSize> <minDataRate> <meanDataRate>
2600 * <peakDataRate> <maxBurstSize> <minPhyRate>
2601 * <sba> <minServiceIntv> <suspendIntv>
2602 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2603 * <maxServiceIntv>
2604 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2605 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2606 * wlan0 addTspec:3
2607 *
2608 * Supported Feature: WMM
2609 *
2610 * Usage: Internal/External
2611 *
2612 * </ioctl>
2613 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002614#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302615/*
2616 * <ioctl>
2617 * delTspec - Delete TSPEC entry for each AC
2618 *
2619 * @INPUT: 1 TSPEC param
2620 * @[arg0]: handle
2621 *
2622 * @OUTPUT: Success/Failure
2623 *
2624 * This IOCTL is used to delete TSPEC entry for each AC.
2625 *
2626 * @E.g: iwpriv wlan0 delTspec <handle>
2627 * iwpriv wlan0 delTspec 7001
2628 * wlan0 delTspec:16
2629 *
2630 * Supported Feature: WMM
2631 *
2632 * Usage: Internal/External
2633 *
2634 * </ioctl>
2635 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002636#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302637/*
2638 * <ioctl>
2639 * getTspec - Get TSPEC entry for each AC
2640 *
2641 * @INPUT: 1 TSPEC param
2642 * @[arg0]: handle
2643 *
2644 * @OUTPUT: Success/Failure
2645 *
2646 * This IOCTL is used to get TSPEC entry for each AC.
2647 *
2648 * @E.g: iwpriv wlan0 getTspec <handle>
2649 * iwpriv wlan0 getTspec 7001
2650 * wlan0 delTspec:18
2651 *
2652 * Supported Feature: WMM
2653 *
2654 * Usage: Internal/External
2655 *
2656 * </ioctl>
2657 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002658#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2659
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002660/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2661/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2662/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002663#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2664#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002665/* (SIOCIWFIRSTPRIV + 16) is currently unused */
2666/* (SIOCIWFIRSTPRIV + 17) is currently unused */
2667/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2668
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002669#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002670
2671/* Private ioctl for setting the host offload feature */
2672#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2673
2674/* Private ioctl to get the statistics */
2675#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2676
2677/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302678/*
2679 * <ioctl>
2680 * setKeepAlive - Set the keep alive feature
2681 *
2682 * @INPUT: 28 bytes of information in the order of packet type, time period
2683 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2684 *
2685 * @OUTPUT: None
2686 *
2687 * This IOCTL sets the keep alive feature to send either NULL
2688 * or unsolicited ARP response packets
2689 *
2690 * @E.g: iwpriv wlan0 setKeepAlive
2691 *
2692 * Supported Feature: STA
2693 *
2694 * Usage: Internal/External
2695 *
2696 * </ioctl>
2697 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002698#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2699
2700#ifdef WLAN_FEATURE_PACKET_FILTERING
2701/* Private ioctl to set the packet filtering params */
2702#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2703#endif
2704
2705
2706#ifdef FEATURE_WLAN_SCAN_PNO
2707/* Private ioctl to get the statistics */
2708#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2709#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302710/*
2711 * <ioctl>
2712 * SETBAND - Set the operational band
2713 *
2714 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2715 *
2716 * @OUTPUT: None
2717 *
2718 * This IOCTL Set the operational band If the new band is different from the
2719 * current operational band, it aborts the pending scan requests, flushes
2720 * the existing scan results, and then change * the band capability
2721 *
2722 * @E.g: iwpriv wlan0 SETBAND <value>
2723 *
2724 * Supported Feature: STA
2725 *
2726 * Usage: Internal/External
2727 *
2728 * </ioctl>
2729 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002730#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2731
Dustin Brown0cbc7572016-12-16 13:54:40 -08002732#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002733/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002734
2735/* Private ioctls and their sub-ioctls */
2736#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2737#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002738#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002739#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302740/* Private sub ioctl for enabling and setting histogram interval of profiling */
2741#define WE_ENABLE_FW_PROFILE 4
2742#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002743
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002744/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002745#define WE_SET_WLAN_SUSPEND 6
2746#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002747
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002748/*
2749 * <ioctl>
2750 * log_buffer - prints host/target related communication logs via dmesg
2751 *
2752 * @INPUT: Log Id, Count
2753 *
2754 * Log Id:
2755 * 0) HTC_CREDIT_HISTORY_LOG
2756 * 1) COMMAND_LOG,
2757 * 2) COMMAND_TX_CMP_LOG,
2758 * 3) MGMT_COMMAND_LOG,
2759 * 4) MGMT_COMMAND_TX_CMP_LOG,
2760 * 5) EVENT_LOG,
2761 * 6) RX_EVENT_LOG,
2762 * 7) MGMT_EVENT_LOG
2763 *
2764 * @OUTPUT: None
2765 *
2766 * @E.g:
2767 * # print up to 10 of the most recent records from HTC Credit History
2768 * iwpriv wlan0 log_buffer 0 10
2769 * # print up to 3 of the most recent records from Event Log
2770 * iwpriv wlan0 log_buffer 5 3
2771 *
2772 * Supported Feature: WLAN Trace
2773 *
2774 * Usage: Internal/External
2775 *
2776 * </ioctl>
2777 */
2778#define WE_LOG_BUFFER 8
2779
Krunal Soni6c3859f2018-06-01 19:57:40 -07002780/*
2781 * <ioctl>
2782 * set_ba_timeout - sets Block ACK aging timeout value for each Access class
2783 *
2784 * @INPUT: Access Class [0:BK, 1:BE, 2:VI, 3:VO], Timeout value
2785 *
2786 * @OUTPUT: None
2787 *
2788 * @E.g.:
2789 * # to set duration of 2 seconds for BE
2790 * iwpriv wlan0 set_ba_timeout 1 2
2791 * # to set duration of 3 seconds for VO
2792 * iwpriv wlan0 set_ba_timeout 3 3
2793 *
2794 * Usage: Internal
2795 *
2796 * </ioctl>
2797 */
2798#define WE_SET_BA_AGEING_TIMEOUT 9
2799
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002800enum host_target_comm_log {
2801 HTC_CREDIT_HISTORY_LOG = 0,
2802 COMMAND_LOG,
2803 COMMAND_TX_CMP_LOG,
2804 MGMT_COMMAND_LOG,
2805 MGMT_COMMAND_TX_CMP_LOG,
2806 EVENT_LOG,
2807 RX_EVENT_LOG,
2808 MGMT_EVENT_LOG
2809};
2810
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002811/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2812
2813/* 802.11p IOCTL */
2814#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2815
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302816/*
2817 * <ioctl>
2818 * getLinkSpeed - Gets the current link speed in Mbps
2819 *
2820 * @INPUT: None
2821 *
2822 * @OUTPUT: linkspeed in mbps
2823 * wlan0 getLinkSpeed:7
2824 *
2825 * This IOCTL is used get the current link speed in Mbps
2826 *
2827 * @E.g: iwpriv wlan0 getLinkSpeed
2828 *
2829 * Supported Feature: STA
2830 *
2831 * Usage: Internal/External
2832 *
2833 * </ioctl>
2834 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002835#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2836
2837#define WLAN_STATS_INVALID 0
2838#define WLAN_STATS_RETRY_CNT 1
2839#define WLAN_STATS_MUL_RETRY_CNT 2
2840#define WLAN_STATS_TX_FRM_CNT 3
2841#define WLAN_STATS_RX_FRM_CNT 4
2842#define WLAN_STATS_FRM_DUP_CNT 5
2843#define WLAN_STATS_FAIL_CNT 6
2844#define WLAN_STATS_RTS_FAIL_CNT 7
2845#define WLAN_STATS_ACK_FAIL_CNT 8
2846#define WLAN_STATS_RTS_SUC_CNT 9
2847#define WLAN_STATS_RX_DISCARD_CNT 10
2848#define WLAN_STATS_RX_ERROR_CNT 11
2849#define WLAN_STATS_TX_BYTE_CNT 12
2850
2851#define WLAN_STATS_RX_BYTE_CNT 13
2852#define WLAN_STATS_RX_RATE 14
2853#define WLAN_STATS_TX_RATE 15
2854
2855#define WLAN_STATS_RX_UC_BYTE_CNT 16
2856#define WLAN_STATS_RX_MC_BYTE_CNT 17
2857#define WLAN_STATS_RX_BC_BYTE_CNT 18
2858#define WLAN_STATS_TX_UC_BYTE_CNT 19
2859#define WLAN_STATS_TX_MC_BYTE_CNT 20
2860#define WLAN_STATS_TX_BC_BYTE_CNT 21
2861
2862#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2863 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2864 *__p++ = __type; \
2865 *__p++ = __size; \
2866 memcpy(__p, __val, __size); \
2867 __p += __size; \
2868 __tlen += __size + 2; \
2869 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002870 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002871 } \
2872 } while (0)
2873
2874#define VERSION_VALUE_MAX_LEN 32
2875
2876#define TX_PER_TRACKING_DEFAULT_RATIO 5
2877#define TX_PER_TRACKING_MAX_RATIO 10
2878#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2879
2880#define WLAN_ADAPTER 0
2881#define P2P_ADAPTER 1
2882
2883/**
2884 * mem_alloc_copy_from_user_helper - copy from user helper
2885 * @wrqu_data: wireless extensions request data
2886 * @len: length of @wrqu_data
2887 *
2888 * Helper function to allocate buffer and copy user data.
2889 *
2890 * Return: On success return a pointer to a kernel buffer containing a
2891 * copy of the userspace data (with an additional NUL character
2892 * appended for safety). On failure return %NULL.
2893 */
2894void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2895{
2896 u8 *ptr = NULL;
2897
2898 /* in order to protect the code, an extra byte is post
2899 * appended to the buffer and the null termination is added.
2900 * However, when allocating (len+1) byte of memory, we need to
2901 * make sure that there is no uint overflow when doing
2902 * addition. In theory check len < UINT_MAX protects the uint
2903 * overflow. For wlan private ioctl, the buffer size is much
2904 * less than UINT_MAX, as a good guess, now, it is assumed
2905 * that the private command buffer size is no greater than 4K
2906 * (4096 bytes). So we use 4096 as the upper boundary for now.
2907 */
2908 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002909 hdd_err("Invalid length: %zu max: %u",
2910 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002911 return NULL;
2912 }
2913
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002914 ptr = qdf_mem_malloc(len + 1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002915 if (NULL == ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002916 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002917 return NULL;
2918 }
2919
2920 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002921 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002922 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002923 return NULL;
2924 }
2925 ptr[len] = '\0';
2926 return ptr;
2927}
2928
2929/**
2930 * hdd_priv_get_data() - Get pointer to ioctl private data
2931 * @p_priv_data: pointer to iw_point struct to be filled
2932 * @wrqu: Pointer to IOCTL Data received from userspace
2933 *
2934 * Helper function to get compatible struct iw_point passed to ioctl
2935 *
2936 * Return - 0 if p_priv_data successfully filled, error otherwise
2937 */
2938int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
2939{
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002940 if ((NULL == p_priv_data) || (NULL == wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002941 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002942
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002943#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07002944 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002945 struct compat_iw_point *p_compat_priv_data;
2946
2947 /* Compat task:
2948 * typecast to compat structure and copy the members.
2949 */
2950 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
2951
2952 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
2953 p_priv_data->length = p_compat_priv_data->length;
2954 p_priv_data->flags = p_compat_priv_data->flags;
2955 } else {
2956#endif /* #ifdef CONFIG_COMPAT */
2957
2958 /* Non compat task: directly copy the structure. */
2959 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
2960
2961#ifdef CONFIG_COMPAT
2962 }
2963#endif /* #ifdef CONFIG_COMPAT */
2964
2965 return 0;
2966}
2967
Jeff Johnson441e1f72017-02-07 08:50:49 -08002968static int hdd_check_wext_control(enum hdd_wext_control wext_control,
2969 struct iw_request_info *info)
2970{
2971 switch (wext_control) {
2972 default:
2973 case hdd_wext_disabled:
Jeff Johnsonb135c662018-10-12 12:24:07 -07002974 hdd_err_rl("Rejecting disabled ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08002975 return -ENOTSUPP;
2976 case hdd_wext_deprecated:
Jeff Johnsonb135c662018-10-12 12:24:07 -07002977 hdd_warn_rl("Using deprecated ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08002978 return 0;
2979 case hdd_wext_enabled:
2980 return 0;
2981 }
2982}
2983
Jeff Johnson82797b62017-08-11 15:31:27 -07002984int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08002985 struct iw_request_info *info)
2986{
2987 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
2988 info);
2989}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002990
2991/**
2992 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07002993 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002994 * @length: Size of the data copied
2995 * @buffer: Pointer to char buffer.
2996 * @buf_len: Length of the char buffer.
2997 *
2998 * This function called when the "iwpriv wlan0 get_stats" command is given.
2999 * It used to collect the txrx stats when the device is configured in SAP mode.
3000 *
3001 * Return - none
3002 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003003void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003004 char *buffer, uint16_t buf_len)
3005{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003006 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003007 uint32_t len = 0;
3008 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
3009 uint32_t total_rx_delv = 0, total_rx_refused = 0;
3010 int i = 0;
3011
3012 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003013 total_rx_pkt += stats->rx_packets[i];
3014 total_rx_dropped += stats->rx_dropped[i];
3015 total_rx_delv += stats->rx_delivered[i];
3016 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003017 }
3018
3019 len = scnprintf(buffer, buf_len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003020 "\nTransmit[%lu] - "
Mohit Khannad0b63f52017-02-18 18:05:52 -08003021 "called %u, dropped %u orphan %u,"
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003022 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
3023 "\n[classified] BK %u, BE %u, VI %u, VO %u"
3024 "\n\nReceive[%lu] - "
3025 "packets %u, dropped %u, delivered %u, refused %u"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003026 "\n",
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003027 qdf_system_ticks(),
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003028 stats->tx_called,
3029 stats->tx_dropped,
3030 stats->tx_orphaned,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003031
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003032 stats->tx_dropped_ac[SME_AC_BK],
3033 stats->tx_dropped_ac[SME_AC_BE],
3034 stats->tx_dropped_ac[SME_AC_VI],
3035 stats->tx_dropped_ac[SME_AC_VO],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003036
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003037 stats->tx_classified_ac[SME_AC_BK],
3038 stats->tx_classified_ac[SME_AC_BE],
3039 stats->tx_classified_ac[SME_AC_VI],
3040 stats->tx_classified_ac[SME_AC_VO],
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003041 qdf_system_ticks(),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003042 total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused
3043 );
3044
3045 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003046 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003047 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003048 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003049 "Rx CPU[%d]:"
3050 "packets %u, dropped %u, delivered %u, refused %u\n",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003051 i, stats->rx_packets[i], stats->rx_dropped[i],
3052 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003053 }
3054
3055 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003056 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003057 "\nCurrent status: %s"
3058 "\ntx-flow timer start count %u"
3059 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003060 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3061 stats->txflow_timer_cnt,
3062 stats->txflow_pause_cnt,
3063 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003064
Leo Changfdb45c32016-10-28 11:09:23 -07003065 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnson1b780e42017-10-31 14:11:45 -07003066 adapter->session_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003067 *length = len + 1;
3068}
3069
3070/**
Dustin Brownd9322482017-01-09 12:46:03 -08003071 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3072 * @hdd_ctx: The Hdd context owning the stats to be written
3073 * @buffer: The char buffer to write to
3074 * @max_len: The maximum number of chars to write
3075 *
3076 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3077 *
3078 * Return - length of written content, negative number on error
3079 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003080#ifdef QCA_SUPPORT_CP_STATS
3081static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
3082 char *buffer, uint16_t max_len)
3083{
3084 int ret;
3085 QDF_STATUS status;
3086 struct suspend_resume_stats *sr_stats;
3087
3088 sr_stats = &hdd_ctx->suspend_resume_stats;
3089 ret = scnprintf(buffer, max_len,
3090 "\n"
3091 "Suspends: %u\n"
3092 "Resumes: %u\n"
3093 "\n"
3094 "Suspend Fail Reasons\n"
3095 "\tIPA: %u\n"
3096 "\tRadar: %u\n"
3097 "\tRoam: %u\n"
3098 "\tScan: %u\n"
3099 "\tInitial Wakeup: %u\n"
3100 "\n",
3101 sr_stats->suspends, sr_stats->resumes,
3102 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3103 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3104 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3105 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3106 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]);
3107
Dustin Brown05d81302018-09-11 16:49:22 -07003108 status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->psoc,
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003109 &buffer[ret], max_len - ret,
3110 &ret);
3111 if (QDF_IS_STATUS_ERROR(status)) {
3112 hdd_err("Failed to get WoW stats");
3113 return qdf_status_to_os_return(status);
3114 }
3115
3116 return ret;
3117}
3118#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003119static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
Dustin Brownd9322482017-01-09 12:46:03 -08003120 char *buffer, uint16_t max_len)
3121{
3122 QDF_STATUS status;
3123 struct suspend_resume_stats *sr_stats;
3124 struct sir_wake_lock_stats wow_stats;
3125
3126 sr_stats = &hdd_ctx->suspend_resume_stats;
3127
3128 status = wma_get_wakelock_stats(&wow_stats);
3129 if (QDF_IS_STATUS_ERROR(status)) {
3130 hdd_err("Failed to get WoW stats");
3131 return qdf_status_to_os_return(status);
3132 }
3133
3134 return scnprintf(buffer, max_len,
3135 "\n"
3136 "Suspends: %u\n"
3137 "Resumes: %u\n"
3138 "\n"
3139 "Suspend Fail Reasons\n"
3140 "\tIPA: %u\n"
3141 "\tRadar: %u\n"
3142 "\tRoam: %u\n"
3143 "\tScan: %u\n"
3144 "\tInitial Wakeup: %u\n"
3145 "\n"
3146 "WoW Wake Reasons\n"
3147 "\tunicast: %u\n"
3148 "\tbroadcast: %u\n"
3149 "\tIPv4 multicast: %u\n"
3150 "\tIPv6 multicast: %u\n"
3151 "\tIPv6 multicast RA: %u\n"
3152 "\tIPv6 multicast NS: %u\n"
3153 "\tIPv6 multicast NA: %u\n"
3154 "\tICMPv4: %u\n"
3155 "\tICMPv6: %u\n"
3156 "\tRSSI Breach: %u\n"
3157 "\tLow RSSI: %u\n"
3158 "\tG-Scan: %u\n"
3159 "\tPNO Complete: %u\n"
3160 "\tPNO Match: %u\n",
3161 sr_stats->suspends,
3162 sr_stats->resumes,
3163 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3164 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3165 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3166 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3167 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP],
3168 wow_stats.wow_ucast_wake_up_count,
3169 wow_stats.wow_bcast_wake_up_count,
3170 wow_stats.wow_ipv4_mcast_wake_up_count,
3171 wow_stats.wow_ipv6_mcast_wake_up_count,
3172 wow_stats.wow_ipv6_mcast_ra_stats,
3173 wow_stats.wow_ipv6_mcast_ns_stats,
3174 wow_stats.wow_ipv6_mcast_na_stats,
3175 wow_stats.wow_icmpv4_count,
3176 wow_stats.wow_icmpv6_count,
3177 wow_stats.wow_rssi_breach_wake_up_count,
3178 wow_stats.wow_low_rssi_wake_up_count,
3179 wow_stats.wow_gscan_wake_up_count,
3180 wow_stats.wow_pno_complete_wake_up_count,
3181 wow_stats.wow_pno_match_wake_up_count);
3182}
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003183#endif
Dustin Brownd9322482017-01-09 12:46:03 -08003184/**
Govind Singha471e5e2015-10-12 17:11:14 +05303185 * hdd_wlan_list_fw_profile() - Get fw profiling points
3186 * @length: Size of the data copied
3187 * @buffer: Pointer to char buffer.
3188 * @buf_len: Length of the char buffer.
3189 *
3190 * This function called when the "iwpriv wlan0 listProfile" command is given.
3191 * It is used to get the supported profiling points in FW.
3192 *
3193 * Return - none
3194 */
3195void hdd_wlan_list_fw_profile(uint16_t *length,
3196 char *buffer, uint16_t buf_len)
3197{
3198 uint32_t len = 0;
3199
3200 len = scnprintf(buffer, buf_len,
3201 "PROF_CPU_IDLE: %u\n"
3202 "PROF_PPDU_PROC: %u\n"
3203 "PROF_PPDU_POST: %u\n"
3204 "PROF_HTT_TX_INPUT: %u\n"
3205 "PROF_MSDU_ENQ: %u\n"
3206 "PROF_PPDU_POST_HAL: %u\n"
3207 "PROF_COMPUTE_TX_TIME: %u\n",
3208 PROF_CPU_IDLE,
3209 PROF_PPDU_PROC,
3210 PROF_PPDU_POST,
3211 PROF_HTT_TX_INPUT,
3212 PROF_MSDU_ENQ,
3213 PROF_PPDU_POST_HAL,
3214 PROF_COMPUTE_TX_TIME);
3215
3216 *length = len + 1;
3217}
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003218/**
3219 * hdd_display_stats_help() - print statistics help
3220 *
3221 * Return: none
3222 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003223static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003224{
Nirav Shahe6194ac2018-07-13 11:04:41 +05303225 hdd_nofl_info("iwpriv wlan0 dumpStats [option] - dump statistics");
3226 hdd_nofl_info("iwpriv wlan0 clearStats [option] - clear statistics");
3227 hdd_nofl_info("options:");
3228 hdd_nofl_info(" 1 -- TXRX PATH statistics");
3229 hdd_nofl_info(" 2 -- TXRX HIST statistics");
3230 hdd_nofl_info(" 3 -- TSO statistics");
3231 hdd_nofl_info(" 4 -- Network queue statistics");
3232 hdd_nofl_info(" 5 -- Flow control statistics");
3233 hdd_nofl_info(" 6 -- Per Layer statistics");
3234 hdd_nofl_info(" 7 -- Copy engine interrupt statistics");
3235 hdd_nofl_info(" 9 -- NAPI statistics");
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003236}
Govind Singha471e5e2015-10-12 17:11:14 +05303237
3238/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003239 * hdd_wlan_dump_stats() - display dump Stats
3240 * @adapter: adapter handle
3241 * @value: value from user
3242 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003243 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003244 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003245int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003246{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003247 int ret = 0;
3248 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003249 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003250
Jeff Johnson0e07ca12018-11-12 21:04:45 -08003251 hdd_debug("%d", value);
3252
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003253 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003254 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003255 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3256 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003257
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003258 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003259 wlan_hdd_display_netif_queue_history
3260 (hdd_ctx,
3261 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003262 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003263
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003264 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303265 hdd_display_hif_stats();
3266 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003267
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003268 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003269 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303270 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003271
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003272 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003273 if (hdd_display_napi_stats()) {
3274 hdd_err("error displaying napi stats");
3275 ret = EFAULT;
3276 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003277 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003278
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303279 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003280 sme_display_disconnect_stats(hdd_ctx->mac_handle,
3281 adapter->session_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303282 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003283
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003284 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003285 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003286 value,
3287 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003288 if (status == QDF_STATUS_E_INVAL) {
3289 hdd_display_stats_help();
3290 ret = EINVAL;
3291 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003292 break;
3293 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003294 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003295}
3296
3297/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003298 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003299 * @adapter: Adapter upon which the IBSS client is active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003300 * @staIdx: Station index of the IBSS peer
3301 *
3302 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3303 * otherwise an appropriate QDF_STATUS_E_* failure code.
3304 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003305static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnsonaf2a0932016-10-05 14:52:57 -07003306 uint8_t staIdx)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003307{
3308 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003309 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003310 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003311 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003312
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003313 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003314 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003315 hdd_get_ibss_peer_info_cb,
3316 false, staIdx);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003317
3318 if (QDF_STATUS_SUCCESS == status) {
3319 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003320
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003321 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003322 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003323 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3324 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003325 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003326 return QDF_STATUS_E_FAILURE;
3327 }
3328
3329 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003330 hdd_debug("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003331 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003332 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3333 uint32_t tx_rate = pPeerInfo->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003334
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003335 qdf_mem_copy(mac_addr, pPeerInfo->peerInfoParams[0].
3336 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003337 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003338 mac_addr, (int)tx_rate,
3339 (int)pPeerInfo->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003340 }
3341 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003342 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003343 }
3344
3345 return status;
3346}
3347
3348/**
3349 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003350 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003351 *
3352 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3353 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3354 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003355static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003356{
3357 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003358 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003359 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003360 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003361 int i;
3362
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003363 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003364 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003365 hdd_get_ibss_peer_info_cb,
3366 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003367
3368 if (QDF_STATUS_SUCCESS == status) {
3369 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003370
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003371 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003372 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003373 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3374 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003375 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003376 return QDF_STATUS_E_FAILURE;
3377 }
3378
3379 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003380 hdd_debug("pPeerInfo->numIBSSPeers = %d ",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003381 (int)pPeerInfo->numPeers);
3382 for (i = 0; i < pPeerInfo->numPeers; i++) {
3383 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3384 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003385
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003386 tx_rate = pPeerInfo->peerInfoParams[i].txRate;
3387 qdf_mem_copy(mac_addr,
3388 pPeerInfo->peerInfoParams[i].mac_addr,
3389 sizeof(mac_addr));
3390
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003391 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003392 mac_addr, (int)tx_rate,
3393 (int)pPeerInfo->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003394 }
3395 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003396 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003397 }
3398
3399 return status;
3400}
3401
3402/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303403 * hdd_get_ldpc() - Get adapter LDPC
3404 * @adapter: adapter being queried
3405 * @value: where to store the value
3406 *
3407 * Return: 0 on success, negative errno on failure
3408 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003409int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303410{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003411 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303412 int ret;
3413
Dustin Brown491d54b2018-03-14 12:39:11 -07003414 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003415 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303416 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3417 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003418 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303419 } else {
3420 *value = ret;
3421 ret = 0;
3422 }
3423 return ret;
3424}
3425
Jeff Johnson3d278b02017-08-29 14:17:47 -07003426int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303427{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003428 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303429 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003430 QDF_STATUS status;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003431 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303432 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303433
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003434 hdd_debug("%d", value);
Jeff Johnson1ca04762018-10-25 10:24:39 -07003435
3436 if (!mac_handle) {
3437 hdd_err("NULL Mac handle");
3438 return -EINVAL;
3439 }
3440
Dustin Brown05d81302018-09-11 16:49:22 -07003441 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003442 if (QDF_STATUS_SUCCESS != status) {
3443 hdd_err("Failed to get HT capability info");
3444 return -EIO;
3445 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003446
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303447 ht_cap_info.adv_coding_cap = value;
Dustin Brown05d81302018-09-11 16:49:22 -07003448 status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003449 if (QDF_STATUS_SUCCESS != status) {
3450 hdd_err("Failed to set HT capability info");
3451 return -EIO;
3452 }
Vignesh Viswanathanecd4de72018-11-22 13:02:20 +05303453 status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303454 if (QDF_IS_STATUS_ERROR(status)) {
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003455 hdd_err("Failed to set VHT LDPC capability info");
3456 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303457 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003458 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303459 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
3460 value);
3461 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003462 hdd_err("Failed to set LDPC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003463 ret = sme_update_he_ldpc_supp(mac_handle, adapter->session_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003464 if (ret)
3465 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303466
3467 return ret;
3468}
3469
3470/**
3471 * hdd_get_tx_stbc() - Get adapter TX STBC
3472 * @adapter: adapter being queried
3473 * @value: where to store the value
3474 *
3475 * Return: 0 on success, negative errno on failure
3476 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003477int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303478{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003479 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303480 int ret;
3481
Dustin Brown491d54b2018-03-14 12:39:11 -07003482 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003483 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303484 WNI_CFG_HT_CAP_INFO_TX_STBC);
3485 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003486 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303487 } else {
3488 *value = ret;
3489 ret = 0;
3490 }
3491
3492 return ret;
3493}
3494
Jeff Johnson3d278b02017-08-29 14:17:47 -07003495int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303496{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003497 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303498 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303499 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303500 QDF_STATUS status;
3501 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303502
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003503 hdd_debug("%d", value);
Jeff Johnson57ff4fa2018-10-25 10:29:47 -07003504
3505 if (!mac_handle) {
3506 hdd_err("NULL Mac handle");
3507 return -EINVAL;
3508 }
3509
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303510 if (value) {
3511 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003512 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303513 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303514 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003515 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303516 return -EIO;
3517 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303518 if (!ht_cap_info.tx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003519 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303520 return -EINVAL;
3521 }
3522 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003523 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303524 WNI_CFG_HT_CAP_INFO_TX_STBC,
3525 value);
3526 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003527 hdd_err("Failed to set TX STBC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003528 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003529 if (ret)
3530 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303531
3532 return ret;
3533}
3534
3535/**
3536 * hdd_get_rx_stbc() - Get adapter RX STBC
3537 * @adapter: adapter being queried
3538 * @value: where to store the value
3539 *
3540 * Return: 0 on success, negative errno on failure
3541 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003542int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303543{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003544 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303545 int ret;
3546
Dustin Brown491d54b2018-03-14 12:39:11 -07003547 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003548 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303549 WNI_CFG_HT_CAP_INFO_RX_STBC);
3550 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003551 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303552 } else {
3553 *value = ret;
3554 ret = 0;
3555 }
3556
3557 return ret;
3558}
3559
Jeff Johnson3d278b02017-08-29 14:17:47 -07003560int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303561{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003562 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303563 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303564 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303565 QDF_STATUS status;
3566 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303567
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003568 hdd_debug("%d", value);
Jeff Johnsonb6645852018-10-25 10:35:41 -07003569
3570 if (!mac_handle) {
3571 hdd_err("NULL Mac handle");
3572 return -EINVAL;
3573 }
3574
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303575 if (value) {
3576 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003577 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303578 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303579 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003580 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303581 return -EIO;
3582 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303583 if (!ht_cap_info.rx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003584 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303585 return -EINVAL;
3586 }
3587 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003588 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303589 WNI_CFG_HT_CAP_INFO_RX_STBC,
3590 value);
3591 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003592 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303593
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003594 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003595 if (ret)
3596 hdd_err("Failed to set HE RX STBC value");
3597
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303598 return ret;
3599}
3600
3601/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003602 * iw_get_linkspeed() - Get current link speed ioctl
3603 * @dev: device upon which the ioctl was received
3604 * @info: ioctl request information
3605 * @wrqu: ioctl request data
3606 * @extra: extra ioctl buffer
3607 *
3608 * Return: 0 on success, non-zero on error
3609 */
3610static int __iw_get_linkspeed(struct net_device *dev,
3611 struct iw_request_info *info,
3612 union iwreq_data *wrqu, char *extra)
3613{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003614 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003615 char *pLinkSpeed = (char *)extra;
3616 int len = sizeof(uint32_t) + 1;
3617 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003618 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003619 int ret;
3620 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003621
Dustin Brownfdf17c12018-03-14 12:55:34 -07003622 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303623
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003624 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003625 ret = wlan_hdd_validate_context(hdd_ctx);
3626 if (0 != ret)
3627 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003628
Jeff Johnson441e1f72017-02-07 08:50:49 -08003629 ret = hdd_check_private_wext_control(hdd_ctx, info);
3630 if (0 != ret)
3631 return ret;
3632
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003633 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003634 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003635 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003636
3637 wrqu->data.length = len;
3638 /* return the linkspeed as a string */
3639 rc = snprintf(pLinkSpeed, len, "%u", link_speed);
3640 if ((rc < 0) || (rc >= len)) {
3641 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003642 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003643 return -EIO;
3644 }
3645
Dustin Browne74003f2018-03-14 12:51:58 -07003646 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003647 /* a value is being successfully returned */
3648 return 0;
3649}
3650
3651static int iw_get_linkspeed(struct net_device *dev,
3652 struct iw_request_info *info,
3653 union iwreq_data *wrqu, char *extra)
3654{
3655 int ret;
3656
3657 cds_ssr_protect(__func__);
3658 ret = __iw_get_linkspeed(dev, info, wrqu, extra);
3659 cds_ssr_unprotect(__func__);
3660
3661 return ret;
3662}
3663
Jeff Johnsonc1713242018-10-23 13:45:42 -07003664int wlan_hdd_update_phymode(struct hdd_adapter *adapter, int new_phymode)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003665{
Jeff Johnsonc1713242018-10-23 13:45:42 -07003666 struct net_device *net = adapter->dev;
3667 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
3668 mac_handle_t mac_handle = phddctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003669 bool band_24 = false, band_5g = false;
3670 bool ch_bond24 = false, ch_bond5g = false;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303671 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003672 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303673 uint8_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003674 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07003675 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003676 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303677 int retval = 0;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303678 uint8_t band_capability;
3679 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003680
Jeff Johnsonc1713242018-10-23 13:45:42 -07003681 if (!mac_handle)
3682 return -EINVAL;
3683
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003684 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003685
3686 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
3687 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
3688 nChannelBondingMode24GHz))
3689 ch_bond24 = true;
3690
3691 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
3692 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
3693 nChannelBondingMode5GHz))
3694 ch_bond5g = true;
3695
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303696 status = wlan_mlme_get_band_capability(phddctx->psoc, &band_capability);
3697 if (QDF_IS_STATUS_ERROR(status)) {
3698 hdd_err("Failed to get MLME Band capability");
3699 return -EIO;
3700 }
3701
3702 if (band_capability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003703 band_24 = band_5g = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303704 else if (band_capability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003705 band_24 = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303706 else if (band_capability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003707 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003708
Jeff Johnsonc1713242018-10-23 13:45:42 -07003709 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc, &vhtchanwidth);
3710 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003711 hdd_err("Failed to get channel_width");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303712
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003713 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 -08003714 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3715
3716 switch (new_phymode) {
3717 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003718 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003719 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003720 phymode = eCSR_DOT11_MODE_AUTO;
3721 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3722 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003723 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003724 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3725 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003726 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003727 return -EIO;
3728 }
3729 break;
3730 case IEEE80211_MODE_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003731 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003732 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003733 phymode = eCSR_DOT11_MODE_11a;
3734 hdd_dot11mode = eHDD_DOT11_MODE_11a;
3735 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003736 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003737 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003738 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003739 return -EIO;
3740 }
3741 break;
3742 case IEEE80211_MODE_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003743 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003744 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003745 phymode = eCSR_DOT11_MODE_11b;
3746 hdd_dot11mode = eHDD_DOT11_MODE_11b;
3747 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003748 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003749 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003750 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003751 return -EIO;
3752 }
3753 break;
3754 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003755 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003756 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003757 phymode = eCSR_DOT11_MODE_11g;
3758 hdd_dot11mode = eHDD_DOT11_MODE_11g;
3759 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003760 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003761 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003762 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003763 return -EIO;
3764 }
3765 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07003766 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003767 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
3768 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
3769 */
3770 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003771 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003772 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003773 phymode = eCSR_DOT11_MODE_11n;
3774 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3775 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003776 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003777 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003778 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003779 return -EIO;
3780 }
3781 break;
3782 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003783 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003784 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003785 phymode = eCSR_DOT11_MODE_11n;
3786 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3787 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003788 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003789 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003790 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003791 return -EIO;
3792 }
3793 break;
3794 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003795 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003796 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003797 phymode = eCSR_DOT11_MODE_11n;
3798 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3799 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003800 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003801 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003802 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003803 return -EIO;
3804 }
3805 break;
3806 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003807 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003808 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003809 phymode = eCSR_DOT11_MODE_11n;
3810 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3811 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003812 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003813 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003814 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003815 return -EIO;
3816 }
3817 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003818 case IEEE80211_MODE_11AC_VHT20:
3819 case IEEE80211_MODE_11AC_VHT40:
3820 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003821 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003822 phymode = eCSR_DOT11_MODE_11ac;
3823 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
3824 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3825 if (band_5g && band_24) {
3826 curr_band = BAND_ALL;
3827 break;
3828 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003829 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003830 break;
3831 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
3832 curr_band = BAND_2G;
3833 break;
3834 }
3835 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
3836 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003837 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003838 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003839 return -EIO;
3840 }
3841 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003842 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003843 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003844 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003845 phymode = eCSR_DOT11_MODE_AUTO;
3846 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3847 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003848 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003849 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003850 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003851 return -EIO;
3852 }
3853 break;
3854 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003855 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003856 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003857 phymode = eCSR_DOT11_MODE_AUTO;
3858 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3859 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3860 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003861 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003862 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003863 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003864 return -EIO;
3865 }
3866 break;
3867 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003868 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003869 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003870 phymode = eCSR_DOT11_MODE_11n;
3871 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3872 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003873 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003874 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003875 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003876 return -EIO;
3877 }
3878 break;
3879 default:
3880 return -EIO;
3881 }
3882
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003883 switch (new_phymode) {
3884 case IEEE80211_MODE_11AC_VHT20:
3885 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3886 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
3887 break;
3888 case IEEE80211_MODE_11AC_VHT40:
3889 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
3890 break;
3891 case IEEE80211_MODE_11AC_VHT80:
3892 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3893 break;
3894 default:
Jeff Johnsonc1713242018-10-23 13:45:42 -07003895 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc,
3896 &vhtchanwidth);
3897 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003898 hdd_err("Failed to get channel_width");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003899 break;
3900 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003901
3902 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303903 sme_config = qdf_mem_malloc(sizeof(*sme_config));
3904 if (!sme_config) {
3905 hdd_err("Failed to allocate memory for sme_config");
3906 return -ENOMEM;
3907 }
3908 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003909 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303910 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003911#ifdef QCA_HT_2040_COEX
3912 if (phymode == eCSR_DOT11_MODE_11n &&
3913 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303914 sme_config->csrConfig.obssEnabled = false;
Jeff Johnsonc1713242018-10-23 13:45:42 -07003915 status = sme_set_ht2040_mode(mac_handle,
3916 adapter->session_id,
3917 eHT_CHAN_HT20, false);
3918 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003919 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303920 retval = -EIO;
3921 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003922 }
3923 } else if (phymode == eCSR_DOT11_MODE_11n &&
3924 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303925 sme_config->csrConfig.obssEnabled = true;
Jeff Johnsonc1713242018-10-23 13:45:42 -07003926 status = sme_set_ht2040_mode(mac_handle,
3927 adapter->session_id,
3928 eHT_CHAN_HT20, true);
3929 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003930 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303931 retval = -EIO;
3932 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003933 }
3934 }
3935#endif
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303936 status = ucfg_mlme_set_band_capability(phddctx->psoc,
3937 curr_band);
3938 if (QDF_IS_STATUS_ERROR(status)) {
3939 hdd_err("failed to set MLME band capability");
3940 goto free;
3941 }
3942
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05303943 if (curr_band == BAND_2G) {
3944 status = ucfg_mlme_set_11h_enabled(phddctx->psoc, 0);
3945 if (!QDF_IS_STATUS_SUCCESS(status)) {
3946 hdd_err("Failed to set 11h_enable flag");
3947 goto free;
3948 }
3949 }
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003950 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303951 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07003952 else if (curr_band == BAND_5G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303953 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003954 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303955 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
3956 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003957 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003958 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003959
3960 phddctx->config->dot11Mode = hdd_dot11mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003961 phddctx->config->nChannelBondingMode24GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303962 sme_config->csrConfig.channelBondingMode24GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003963 phddctx->config->nChannelBondingMode5GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303964 sme_config->csrConfig.channelBondingMode5GHz;
Krunal Sonidf0f8742016-09-26 14:56:31 -07003965 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003966 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303967 retval = -EIO;
3968 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003969 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05303970
3971 if (band_5g) {
3972 struct ieee80211_supported_band *band;
3973
3974 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
3975 if (phddctx->config->nChannelBondingMode5GHz)
3976 band->ht_cap.cap |=
3977 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3978 else
3979 band->ht_cap.cap &=
3980 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3981 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003982
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003983 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003984 phymode, chwidth, curr_band, vhtchanwidth);
3985 }
3986
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303987free:
3988 if (sme_config)
3989 qdf_mem_free(sme_config);
3990 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003991}
3992
Jeff Johnson011c4502017-10-05 15:25:56 -07003993static int hdd_validate_pdev_reset(int value)
3994{
3995 if ((value < 1) || (value > 5)) {
3996 hdd_warn(" Invalid value %d: Use any one of the below values\n"
3997 " TX_FLUSH = 1\n"
3998 " WARM_RESET = 2\n"
3999 " COLD_RESET = 3\n"
4000 " WARM_RESET_RESTORE_CAL = 4\n"
4001 " COLD_RESET_RESTORE_CAL = 5", value);
4002
4003 return -EINVAL;
4004 }
4005
4006 return 0;
4007}
4008
4009static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
4010{
4011 int ret;
4012
4013 hdd_debug("%d", value);
4014
4015 ret = hdd_validate_pdev_reset(value);
4016 if (ret)
4017 return ret;
4018
Jeff Johnson1b780e42017-10-31 14:11:45 -07004019 ret = wma_cli_set_command(adapter->session_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07004020 WMI_PDEV_PARAM_PDEV_RESET,
4021 value, PDEV_CMD);
4022
4023 return ret;
4024}
4025
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004026static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
4027{
4028 int errno;
4029 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4030 ePhyChanBondState bonding_state;
4031 uint32_t bonding_mode;
4032 tSmeConfigParams *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004033 mac_handle_t mac_handle;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004034
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004035 mac_handle = hdd_ctx->mac_handle;
4036 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004037 return -EINVAL;
4038
4039 /* updating channel bonding only on 5Ghz */
4040 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4041
4042 switch (ch_width) {
4043 case eHT_CHANNEL_WIDTH_20MHZ:
4044 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4045 break;
4046
4047 case eHT_CHANNEL_WIDTH_40MHZ:
4048 case eHT_CHANNEL_WIDTH_80MHZ:
4049 bonding_state = csr_convert_cb_ini_value_to_phy_cb_state(
4050 hdd_ctx->config->nChannelBondingMode5GHz);
4051
4052 if (bonding_state == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE)
4053 return -EINVAL;
4054
4055 bonding_mode = hdd_ctx->config->nChannelBondingMode5GHz;
4056 break;
4057
4058 default:
4059 hdd_err("Invalid channel width 0->20 1->40 2->80");
4060 return -EINVAL;
4061 }
4062
4063 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4064 if (!sme_config) {
4065 hdd_err("failed to allocate memory for sme_config");
4066 return -ENOMEM;
4067 }
4068
4069 errno = wma_cli_set_command(adapter->session_id, WMI_VDEV_PARAM_CHWIDTH,
4070 ch_width, VDEV_CMD);
4071 if (errno)
4072 goto free_config;
4073
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004074 sme_get_config_param(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004075 sme_config->csrConfig.channelBondingMode5GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004076 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004077
4078free_config:
4079 qdf_mem_free(sme_config);
4080
4081 return errno;
4082}
4083
Jeff Johnsondeab8572018-11-13 15:29:53 -08004084static int hdd_we_set_11d_state(struct hdd_adapter *adapter, int state_11d)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004085{
Jeff Johnsondeab8572018-11-13 15:29:53 -08004086 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004087 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004088 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304089 QDF_STATUS status;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004090
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004091 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004092 return -EINVAL;
4093
4094 switch (state_11d) {
4095 case ENABLE_11D:
4096 enable_11d = true;
4097 break;
4098 case DISABLE_11D:
4099 enable_11d = false;
4100 break;
4101 default:
4102 return -EINVAL;
4103 }
4104
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304105 status = ucfg_mlme_set_11d_enabled(hdd_ctx->psoc, enable_11d);
4106 if (!QDF_IS_STATUS_SUCCESS(status))
4107 hdd_err("Invalid 11d_enable flag");
Dustin Brownd90f61a2018-04-26 12:25:58 -07004108
Dustin Brownea82d562018-05-23 12:07:16 -07004109 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004110
4111 return 0;
4112}
4113
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004114static int hdd_we_set_power(struct hdd_adapter *adapter, int value)
4115{
4116 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4117 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4118
4119 if (!mac_handle)
4120 return -EINVAL;
4121
4122 switch (value) {
4123 case 1:
4124 /* Enable PowerSave */
4125 sme_ps_enable_disable(mac_handle, adapter->session_id,
4126 SME_PS_ENABLE);
4127 return 0;
4128 case 2:
4129 /* Disable PowerSave */
4130 sme_ps_enable_disable(mac_handle, adapter->session_id,
4131 SME_PS_DISABLE);
4132 return 0;
4133 case 3:
4134 /* Enable UASPD */
4135 sme_ps_uapsd_enable(mac_handle, adapter->session_id);
4136 return 0;
4137 case 4:
4138 /* Disable UASPD */
4139 sme_ps_uapsd_disable(mac_handle, adapter->session_id);
4140 return 0;
4141 default:
4142 hdd_err("Invalid value %d", value);
4143 return -EINVAL;
4144 }
4145}
4146
Jeff Johnsoneb4368a2018-10-19 13:02:52 -07004147static int hdd_we_set_max_assoc(struct hdd_adapter *adapter, int value)
4148{
4149 struct hdd_context *hdd_ctx;
4150 QDF_STATUS status;
4151
4152 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4153 status = ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, value);
4154 if (QDF_IS_STATUS_ERROR(status))
4155 hdd_err("cfg set failed, value %d status %d", value, status);
4156
4157 return qdf_status_to_os_return(status);
4158}
4159
Jeff Johnson693722c2018-10-19 13:11:16 -07004160static int hdd_we_set_data_inactivity_timeout(struct hdd_adapter *adapter,
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004161 int inactivity_timeout)
Jeff Johnson693722c2018-10-19 13:11:16 -07004162{
4163 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004164 QDF_STATUS status;
Jeff Johnson693722c2018-10-19 13:11:16 -07004165
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004166 status = ucfg_mlme_set_ps_data_inactivity_timeout(hdd_ctx->psoc,
4167 inactivity_timeout);
Jeff Johnson693722c2018-10-19 13:11:16 -07004168
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004169 return qdf_status_to_os_return(status);
Jeff Johnson693722c2018-10-19 13:11:16 -07004170}
4171
Jeff Johnson94511942018-10-19 13:15:22 -07004172static int hdd_we_set_wow_data_inactivity_timeout(struct hdd_adapter *adapter,
4173 int value)
4174{
4175 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4176 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4177 QDF_STATUS status;
4178
4179 if (!mac_handle)
4180 return -EINVAL;
4181
4182 if ((value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) ||
4183 (value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX)) {
4184 hdd_err_rl("Invalid value %d", value);
4185 return -EINVAL;
4186 }
4187
4188 status = sme_cfg_set_int(mac_handle,
4189 WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT,
4190 value);
4191
4192 if (QDF_IS_STATUS_ERROR(status))
4193 hdd_err("cfg set failed, value %d status %d", value, status);
4194
4195 return qdf_status_to_os_return(status);
4196}
4197
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004198static int hdd_we_set_tx_power(struct hdd_adapter *adapter, int value)
4199{
4200 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4201 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4202 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4203 QDF_STATUS status;
4204
4205 if (!mac_handle)
4206 return -EINVAL;
4207
4208 status = sme_set_tx_power(mac_handle, adapter->session_id,
4209 sta_ctx->conn_info.bssId,
4210 adapter->device_mode, value);
4211
4212 if (QDF_IS_STATUS_ERROR(status))
4213 hdd_err("cfg set failed, value %d status %d", value, status);
4214
4215 return qdf_status_to_os_return(status);
4216}
4217
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004218static int hdd_we_set_max_tx_power(struct hdd_adapter *adapter, int value)
4219{
4220 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4221 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4222 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4223 QDF_STATUS status;
4224
4225 if (!mac_handle)
4226 return -EINVAL;
4227
4228 status = sme_set_max_tx_power(mac_handle,
4229 sta_ctx->conn_info.bssId,
4230 sta_ctx->conn_info.bssId,
4231 value);
4232
4233 if (QDF_IS_STATUS_ERROR(status))
4234 hdd_err("cfg set failed, value %d status %d", value, status);
4235
4236 return qdf_status_to_os_return(status);
4237}
4238
Jeff Johnsonf3892b52018-10-23 11:32:04 -07004239static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power)
4240{
4241 QDF_STATUS status;
4242
4243 hdd_debug("power %d dBm", power);
4244 status = sme_set_max_tx_power_per_band(BAND_2G, power);
4245 if (QDF_IS_STATUS_ERROR(status))
4246 hdd_err("cfg set failed, value %d status %d", power, status);
4247
4248 return qdf_status_to_os_return(status);
4249}
4250
Jeff Johnson175004c2018-10-23 12:03:16 -07004251static int hdd_we_set_max_tx_power_5_0(struct hdd_adapter *adapter, int power)
4252{
4253 QDF_STATUS status;
4254
4255 hdd_debug("power %d dBm", power);
4256 status = sme_set_max_tx_power_per_band(BAND_5G, power);
4257 if (QDF_IS_STATUS_ERROR(status))
4258 hdd_err("cfg set failed, value %d status %d", power, status);
4259
4260 return qdf_status_to_os_return(status);
4261}
4262
Jeff Johnson5bee39b2018-10-23 12:34:38 -07004263static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level)
4264{
4265 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4266 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4267 QDF_STATUS status;
4268
4269 if (!mac_handle)
4270 return -EINVAL;
4271
4272 hdd_debug("Thermal Mitigation Level %d", level);
4273 status = sme_set_thermal_level(mac_handle, level);
4274 if (QDF_IS_STATUS_ERROR(status))
4275 hdd_err("cfg set failed, value %d status %d", level, status);
4276
4277 return qdf_status_to_os_return(status);
4278}
4279
Jeff Johnson38912642018-10-24 15:01:40 -07004280static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss)
4281{
4282 QDF_STATUS status;
4283
4284 hdd_debug("NSS %d", nss);
4285
4286 if ((nss > 2) || (nss <= 0)) {
4287 hdd_err("Invalid NSS: %d", nss);
4288 return -EINVAL;
4289 }
4290
4291 status = hdd_update_nss(adapter, nss);
4292 if (QDF_IS_STATUS_ERROR(status))
4293 hdd_err("cfg set failed, value %d status %d", nss, status);
4294
4295 return qdf_status_to_os_return(status);
4296}
4297
Jeff Johnsonce996b32018-10-25 10:52:40 -07004298static int hdd_we_set_short_gi(struct hdd_adapter *adapter, int sgi)
4299{
4300 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
4301 int errno;
4302
4303 hdd_debug("Short GI %d", sgi);
4304
4305 if (!mac_handle) {
4306 hdd_err("NULL Mac handle");
4307 return -EINVAL;
4308 }
4309
4310 if (sgi & HDD_AUTO_RATE_SGI)
4311 errno = sme_set_auto_rate_he_sgi(mac_handle,
4312 adapter->session_id,
4313 sgi);
4314 else
4315 errno = sme_update_ht_config(mac_handle,
4316 adapter->session_id,
4317 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4318 sgi);
4319 if (errno)
4320 hdd_err("cfg set failed, value %d status %d", sgi, errno);
4321
4322 return errno;
4323}
4324
Jeff Johnson71d80382018-10-25 15:45:01 -07004325static int hdd_we_set_rtscts(struct hdd_adapter *adapter, int rtscts)
4326{
4327 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4328 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4329 uint32_t value;
4330 uint32_t rts_threshold_val;
4331 QDF_STATUS status;
4332 int errno;
4333
4334 hdd_debug("RTSCTS %d", rtscts);
4335
4336 if (!mac_handle) {
4337 hdd_err("NULL Mac handle");
4338 return -EINVAL;
4339 }
4340
4341 status = ucfg_mlme_get_rts_threshold(hdd_ctx->psoc,
4342 &rts_threshold_val);
4343 if (QDF_IS_STATUS_ERROR(status)) {
4344 hdd_err("Get rts threshold failed, status %d", status);
4345 return -EINVAL;
4346 }
4347
4348 if ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_RTSCTS_ENABLE) {
4349 value = rts_threshold_val;
4350 } else if (((rtscts & HDD_RTSCTS_EN_MASK) == 0) ||
4351 ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_CTS_ENABLE)) {
4352 value = cfg_max(CFG_RTS_THRESHOLD);
4353 } else {
4354 hdd_err_rl("Invalid value %d", rtscts);
4355 return -EINVAL;
4356 }
4357
4358 errno = wma_cli_set_command(adapter->session_id,
4359 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4360 rtscts, VDEV_CMD);
4361 if (errno) {
4362 hdd_err("Failed to set firmware, errno %d", errno);
4363 return errno;
4364 }
4365
4366 status = ucfg_mlme_set_rts_threshold(hdd_ctx->psoc, value);
4367 if (QDF_IS_STATUS_ERROR(status)) {
4368 hdd_err("Set rts threshold failed, status %d", status);
4369 return -EINVAL;
4370 }
4371
4372 return 0;
4373}
4374
Jeff Johnson50b15882018-10-26 10:27:37 -07004375static int hdd_we_set_11n_rate(struct hdd_adapter *adapter, int rate_code)
4376{
4377 uint8_t preamble = 0, nss = 0, rix = 0;
4378 int errno;
4379
4380 hdd_debug("Rate code %d", rate_code);
4381
4382 if (rate_code != 0xff) {
4383 rix = RC_2_RATE_IDX(rate_code);
4384 if (rate_code & 0x80) {
4385 preamble = WMI_RATE_PREAMBLE_HT;
4386 nss = HT_RC_2_STREAMS(rate_code) - 1;
4387 } else {
4388 nss = 0;
4389 rix = RC_2_RATE_IDX(rate_code);
4390 if (rate_code & 0x10) {
4391 preamble = WMI_RATE_PREAMBLE_CCK;
4392 if (rix != 0x3)
4393 /* Enable Short preamble
4394 * always for CCK except 1mbps
4395 */
4396 rix |= 0x4;
4397 } else {
4398 preamble = WMI_RATE_PREAMBLE_OFDM;
4399 }
4400 }
4401 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4402 }
4403
4404 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4405 rate_code, rix, preamble, nss);
4406
4407 errno = wma_cli_set_command(adapter->session_id,
4408 WMI_VDEV_PARAM_FIXED_RATE,
4409 rate_code, VDEV_CMD);
4410 if (errno)
4411 hdd_err("Failed to set firmware, errno %d", errno);
4412
4413 return errno;
4414}
4415
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004416static int hdd_we_set_vht_rate(struct hdd_adapter *adapter, int rate_code)
4417{
4418 uint8_t preamble = 0, nss = 0, rix = 0;
4419 int errno;
4420
4421 hdd_debug("Rate code %d", rate_code);
4422
4423 if (rate_code != 0xff) {
4424 rix = RC_2_RATE_IDX_11AC(rate_code);
4425 preamble = WMI_RATE_PREAMBLE_VHT;
4426 nss = HT_RC_2_STREAMS_11AC(rate_code) - 1;
4427 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4428 }
4429
4430 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4431 rate_code, rix, preamble, nss);
4432
4433 errno = wma_cli_set_command(adapter->session_id,
4434 WMI_VDEV_PARAM_FIXED_RATE,
4435 rate_code, VDEV_CMD);
4436 if (errno)
4437 hdd_err("Failed to set firmware, errno %d", errno);
4438
4439 return errno;
4440}
4441
Jeff Johnson7c433502018-11-12 15:00:52 -08004442static int hdd_we_set_ampdu(struct hdd_adapter *adapter, int ampdu)
4443{
4444 hdd_debug("AMPDU %d", ampdu);
4445
4446 return wma_cli_set_command(adapter->session_id,
4447 GEN_VDEV_PARAM_AMPDU,
4448 ampdu, GEN_CMD);
4449}
4450
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004451static int hdd_we_set_amsdu(struct hdd_adapter *adapter, int amsdu)
4452{
4453 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4454 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4455 int errno;
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304456 QDF_STATUS status;
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004457
4458 hdd_debug("AMSDU %d", amsdu);
4459
4460 if (!mac_handle) {
4461 hdd_err("NULL Mac handle");
4462 return -EINVAL;
4463 }
4464
4465 if (amsdu > 1)
4466 sme_set_amsdu(mac_handle, true);
4467 else
4468 sme_set_amsdu(mac_handle, false);
4469
4470 errno = wma_cli_set_command(adapter->session_id,
4471 GEN_VDEV_PARAM_AMSDU,
4472 amsdu, GEN_CMD);
4473 if (errno) {
4474 hdd_err("Failed to set firmware, errno %d", errno);
4475 return errno;
4476 }
4477
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304478 status = ucfg_mlme_set_max_amsdu_num(hdd_ctx->psoc,
4479 amsdu);
4480 if (QDF_IS_STATUS_ERROR(status))
4481 hdd_err("Failed to set Max AMSDU Num to cfg");
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004482
4483 return 0;
4484}
4485
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004486static int hdd_we_clear_stats(struct hdd_adapter *adapter, int option)
4487{
4488 hdd_debug("option %d", option);
4489
4490 switch (option) {
4491 case CDP_HDD_STATS:
4492 memset(&adapter->stats, 0, sizeof(adapter->stats));
4493 memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
4494 break;
4495 case CDP_TXRX_HIST_STATS:
4496 wlan_hdd_clear_tx_rx_histogram(adapter->hdd_ctx);
4497 break;
4498 case CDP_HDD_NETIF_OPER_HISTORY:
4499 wlan_hdd_clear_netif_queue_history(adapter->hdd_ctx);
4500 break;
4501 case CDP_HIF_STATS:
4502 hdd_clear_hif_stats();
4503 break;
4504 case CDP_NAPI_STATS:
4505 hdd_clear_napi_stats();
4506 break;
4507 default:
4508 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4509 option);
4510 }
4511
4512 return 0;
4513}
4514
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004515static int hdd_we_set_green_tx_param(struct hdd_adapter *adapter,
4516 green_tx_param id,
4517 const char *id_string,
4518 int value)
4519{
4520 int errno;
4521
4522 hdd_debug("%s %d", id_string, value);
4523 errno = wma_cli_set_command(adapter->session_id, id, value, GTX_CMD);
4524 if (errno)
4525 hdd_err("Failed to set firmware, errno %d", errno);
4526
4527 return errno;
4528}
4529
4530#define hdd_we_set_green_tx_param(adapter, id, value) \
4531 hdd_we_set_green_tx_param(adapter, id, #id, value)
4532
4533static int hdd_we_set_gtx_ht_mcs(struct hdd_adapter *adapter, int value)
4534{
4535 return hdd_we_set_green_tx_param(adapter,
4536 WMI_VDEV_PARAM_GTX_HT_MCS,
4537 value);
4538}
4539
4540static int hdd_we_set_gtx_vht_mcs(struct hdd_adapter *adapter, int value)
4541{
4542 return hdd_we_set_green_tx_param(adapter,
4543 WMI_VDEV_PARAM_GTX_VHT_MCS,
4544 value);
4545}
4546
4547static int hdd_we_set_gtx_usrcfg(struct hdd_adapter *adapter, int value)
4548{
4549 return hdd_we_set_green_tx_param(adapter,
4550 WMI_VDEV_PARAM_GTX_USR_CFG,
4551 value);
4552}
4553
4554static int hdd_we_set_gtx_thre(struct hdd_adapter *adapter, int value)
4555{
4556 return hdd_we_set_green_tx_param(adapter,
4557 WMI_VDEV_PARAM_GTX_THRE,
4558 value);
4559}
4560
4561static int hdd_we_set_gtx_margin(struct hdd_adapter *adapter, int value)
4562{
4563 return hdd_we_set_green_tx_param(adapter,
4564 WMI_VDEV_PARAM_GTX_MARGIN,
4565 value);
4566}
4567
4568static int hdd_we_set_gtx_step(struct hdd_adapter *adapter, int value)
4569{
4570 return hdd_we_set_green_tx_param(adapter,
4571 WMI_VDEV_PARAM_GTX_STEP,
4572 value);
4573}
4574
4575static int hdd_we_set_gtx_mintpc(struct hdd_adapter *adapter, int value)
4576{
4577 return hdd_we_set_green_tx_param(adapter,
4578 WMI_VDEV_PARAM_GTX_MINTPC,
4579 value);
4580}
4581
4582static int hdd_we_set_gtx_bwmask(struct hdd_adapter *adapter, int value)
4583{
4584 return hdd_we_set_green_tx_param(adapter,
4585 WMI_VDEV_PARAM_GTX_BW_MASK,
4586 value);
4587}
4588
Jeff Johnsond0477f22018-10-29 12:26:25 -07004589static int hdd_we_packet_power_save(struct hdd_adapter *adapter,
4590 packet_power_save id,
4591 const char *id_string,
4592 int value)
4593{
4594 int errno;
4595
4596 if (adapter->device_mode != QDF_STA_MODE) {
4597 hdd_err_rl("Not supported in mode %d", adapter->device_mode);
4598 return -EINVAL;
4599 }
4600
4601 hdd_debug("%s %d", id_string, value);
4602 errno = wma_cli_set_command(adapter->session_id, id, value, PPS_CMD);
4603 if (errno)
4604 hdd_err("Failed to set firmware, errno %d", errno);
4605
4606 return errno;
4607}
4608
4609#define hdd_we_packet_power_save(adapter, id, value) \
4610 hdd_we_packet_power_save(adapter, id, #id, value)
4611
4612static int hdd_we_pps_paid_match(struct hdd_adapter *adapter, int value)
4613{
4614 return hdd_we_packet_power_save(adapter,
4615 WMI_VDEV_PPS_PAID_MATCH,
4616 value);
4617}
4618
4619static int hdd_we_pps_gid_match(struct hdd_adapter *adapter, int value)
4620{
4621 return hdd_we_packet_power_save(adapter,
4622 WMI_VDEV_PPS_GID_MATCH,
4623 value);
4624}
4625
4626static int hdd_we_pps_early_tim_clear(struct hdd_adapter *adapter, int value)
4627{
4628 return hdd_we_packet_power_save(adapter,
4629 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4630 value);
4631}
4632
4633static int hdd_we_pps_early_dtim_clear(struct hdd_adapter *adapter, int value)
4634{
4635 return hdd_we_packet_power_save(adapter,
4636 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4637 value);
4638}
4639
4640static int hdd_we_pps_eof_pad_delim(struct hdd_adapter *adapter, int value)
4641{
4642 return hdd_we_packet_power_save(adapter,
4643 WMI_VDEV_PPS_EOF_PAD_DELIM,
4644 value);
4645}
4646
4647static int hdd_we_pps_macaddr_mismatch(struct hdd_adapter *adapter, int value)
4648{
4649 return hdd_we_packet_power_save(adapter,
4650 WMI_VDEV_PPS_MACADDR_MISMATCH,
4651 value);
4652}
4653
4654static int hdd_we_pps_delim_crc_fail(struct hdd_adapter *adapter, int value)
4655{
4656 return hdd_we_packet_power_save(adapter,
4657 WMI_VDEV_PPS_DELIM_CRC_FAIL,
4658 value);
4659}
4660
4661static int hdd_we_pps_gid_nsts_zero(struct hdd_adapter *adapter, int value)
4662{
4663 return hdd_we_packet_power_save(adapter,
4664 WMI_VDEV_PPS_GID_NSTS_ZERO,
4665 value);
4666}
4667
4668static int hdd_we_pps_rssi_check(struct hdd_adapter *adapter, int value)
4669{
4670 return hdd_we_packet_power_save(adapter,
4671 WMI_VDEV_PPS_RSSI_CHECK,
4672 value);
4673}
4674
4675static int hdd_we_pps_5g_ebt(struct hdd_adapter *adapter, int value)
4676{
4677 return hdd_we_packet_power_save(adapter,
4678 WMI_VDEV_PPS_5G_EBT,
4679 value);
4680}
4681
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07004682static int hdd_we_set_qpower(struct hdd_adapter *adapter,
4683 enum wmi_sta_powersave_param id,
4684 const char *id_string,
4685 int value)
4686{
4687 int errno;
4688
4689 hdd_debug("%s %d", id_string, value);
4690 errno = wma_cli_set_command(adapter->session_id, id, value, QPOWER_CMD);
4691 if (errno)
4692 hdd_err("Failed to set firmware, errno %d", errno);
4693
4694 return errno;
4695}
4696
4697#define hdd_we_set_qpower(adapter, id, value) \
4698 hdd_we_set_qpower(adapter, id, #id, value)
4699
4700static int
4701hdd_we_set_qpower_max_pspoll_count(struct hdd_adapter *adapter, int value)
4702{
4703 enum wmi_sta_powersave_param id =
4704 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT;
4705
4706 return hdd_we_set_qpower(adapter, id, value);
4707}
4708
4709static int
4710hdd_we_set_qpower_max_tx_before_wake(struct hdd_adapter *adapter, int value)
4711{
4712 enum wmi_sta_powersave_param id =
4713 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE;
4714
4715 return hdd_we_set_qpower(adapter, id, value);
4716}
4717
4718static int
4719hdd_we_set_qpower_spec_pspoll_wake_interval(struct hdd_adapter *adapter,
4720 int value)
4721{
4722 enum wmi_sta_powersave_param id =
4723 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL;
4724
4725 return hdd_we_set_qpower(adapter, id, value);
4726}
4727
4728static int
4729hdd_we_set_qpower_spec_max_spec_nodata_pspoll(struct hdd_adapter *adapter,
4730 int value)
4731{
4732 enum wmi_sta_powersave_param id =
4733 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL;
4734
4735 return hdd_we_set_qpower(adapter, id, value);
4736}
4737
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08004738static int hdd_we_set_pdev(struct hdd_adapter *adapter,
4739 WMI_PDEV_PARAM id,
4740 const char *id_string,
4741 int value)
4742{
4743 int errno;
4744
4745 hdd_debug("%s %d", id_string, value);
4746 errno = wma_cli_set_command(adapter->session_id, id, value, PDEV_CMD);
4747 if (errno)
4748 hdd_err("Failed to set firmware, errno %d", errno);
4749
4750 return errno;
4751}
4752
4753#define hdd_we_set_pdev(adapter, id, value) \
4754 hdd_we_set_pdev(adapter, id, #id, value)
4755
4756static int hdd_we_set_ani_en_dis(struct hdd_adapter *adapter, int value)
4757{
4758 return hdd_we_set_pdev(adapter,
4759 WMI_PDEV_PARAM_ANI_ENABLE,
4760 value);
4761}
4762
4763static int hdd_we_set_ani_poll_period(struct hdd_adapter *adapter, int value)
4764{
4765 return hdd_we_set_pdev(adapter,
4766 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
4767 value);
4768}
4769
4770static int hdd_we_set_ani_listen_period(struct hdd_adapter *adapter, int value)
4771{
4772 return hdd_we_set_pdev(adapter,
4773 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
4774 value);
4775}
4776
4777static int hdd_we_set_ani_ofdm_level(struct hdd_adapter *adapter, int value)
4778{
4779 return hdd_we_set_pdev(adapter,
4780 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
4781 value);
4782}
4783
4784static int hdd_we_set_ani_cck_level(struct hdd_adapter *adapter, int value)
4785{
4786 return hdd_we_set_pdev(adapter,
4787 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
4788 value);
4789}
4790
4791static int hdd_we_set_dynamic_bw(struct hdd_adapter *adapter, int value)
4792{
4793 return hdd_we_set_pdev(adapter,
4794 WMI_PDEV_PARAM_DYNAMIC_BW,
4795 value);
4796}
4797
4798static int hdd_we_set_cts_cbw(struct hdd_adapter *adapter, int value)
4799{
4800 return hdd_we_set_pdev(adapter,
4801 WMI_PDEV_PARAM_CTS_CBW,
4802 value);
4803}
4804
4805static int hdd_we_set_tx_chainmask(struct hdd_adapter *adapter, int value)
4806{
4807 int errno;
4808
4809 errno = hdd_we_set_pdev(adapter,
4810 WMI_PDEV_PARAM_TX_CHAIN_MASK,
4811 value);
4812 if (errno)
4813 return errno;
4814
4815 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
4816}
4817
4818static int hdd_we_set_rx_chainmask(struct hdd_adapter *adapter, int value)
4819{
4820 int errno;
4821
4822 errno = hdd_we_set_pdev(adapter,
4823 WMI_PDEV_PARAM_RX_CHAIN_MASK,
4824 value);
4825 if (errno)
4826 return errno;
4827
4828 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
4829}
4830
4831static int hdd_we_set_txpow_2g(struct hdd_adapter *adapter, int value)
4832{
4833 return hdd_we_set_pdev(adapter,
4834 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
4835 value);
4836}
4837
4838static int hdd_we_set_txpow_5g(struct hdd_adapter *adapter, int value)
4839{
4840 return hdd_we_set_pdev(adapter,
4841 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
4842 value);
4843}
4844
Jeff Johnson2e381272018-11-10 09:33:39 -08004845static int hdd_we_set_vdev(struct hdd_adapter *adapter,
4846 int id,
4847 const char *id_string,
4848 int value)
4849{
4850 int errno;
4851
4852 hdd_debug("%s %d", id_string, value);
4853 errno = wma_cli_set_command(adapter->session_id, id, value, VDEV_CMD);
4854 if (errno)
4855 hdd_err("Failed to set firmware, errno %d", errno);
4856
4857 return errno;
4858}
4859
4860#define hdd_we_set_vdev(adapter, id, value) \
4861 hdd_we_set_vdev(adapter, id, #id, value)
4862
4863static int hdd_we_set_txrx_fwstats(struct hdd_adapter *adapter, int value)
4864{
4865 return hdd_we_set_vdev(adapter,
4866 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
4867 value);
4868}
4869
4870static int hdd_we_txrx_fwstats_reset(struct hdd_adapter *adapter, int value)
4871{
4872 return hdd_we_set_vdev(adapter,
4873 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
4874 value);
4875}
4876
4877static int hdd_we_set_htsmps(struct hdd_adapter *adapter, int value)
4878{
4879 return hdd_we_set_vdev(adapter,
4880 WMI_STA_SMPS_FORCE_MODE_CMDID,
4881 value);
4882}
4883
4884static int hdd_we_set_early_rx_adjust_enable(struct hdd_adapter *adapter,
4885 int value)
4886{
4887 if ((value != 0) && (value != 1))
4888 return -EINVAL;
4889
4890 return hdd_we_set_vdev(adapter,
4891 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
4892 value);
4893}
4894
4895static int hdd_we_set_early_rx_tgt_bmiss_num(struct hdd_adapter *adapter,
4896 int value)
4897{
4898 return hdd_we_set_vdev(adapter,
4899 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
4900 value);
4901}
4902
4903static int hdd_we_set_early_rx_bmiss_sample_cycle(struct hdd_adapter *adapter,
4904 int value)
4905{
4906 return hdd_we_set_vdev(adapter,
4907 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
4908 value);
4909}
4910
4911static int hdd_we_set_early_rx_slop_step(struct hdd_adapter *adapter, int value)
4912{
4913 return hdd_we_set_vdev(adapter,
4914 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
4915 value);
4916}
4917
4918static int hdd_we_set_early_rx_init_slop(struct hdd_adapter *adapter, int value)
4919{
4920 return hdd_we_set_vdev(adapter,
4921 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
4922 value);
4923}
4924
4925static int hdd_we_set_early_rx_adjust_pause(struct hdd_adapter *adapter,
4926 int value)
4927{
4928 if ((value != 0) && (value != 1))
4929 return -EINVAL;
4930
4931 return hdd_we_set_vdev(adapter,
4932 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
4933 value);
4934}
4935
4936static int hdd_we_set_early_rx_drift_sample(struct hdd_adapter *adapter,
4937 int value)
4938{
4939 return hdd_we_set_vdev(adapter,
4940 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
4941 value);
4942}
4943
4944static int hdd_we_set_dcm(struct hdd_adapter *adapter, int value)
4945{
4946 return hdd_we_set_vdev(adapter,
4947 WMI_VDEV_PARAM_HE_DCM,
4948 value);
4949}
4950
4951static int hdd_we_set_range_ext(struct hdd_adapter *adapter, int value)
4952{
4953 return hdd_we_set_vdev(adapter,
4954 WMI_VDEV_PARAM_HE_RANGE_EXT,
4955 value);
4956}
4957
Jeff Johnson22e57f12018-11-10 16:02:00 -08004958static int hdd_we_set_dbg(struct hdd_adapter *adapter,
4959 int id,
4960 const char *id_string,
4961 int value)
4962{
4963 int errno;
4964
4965 hdd_debug("%s %d", id_string, value);
4966 errno = wma_cli_set_command(adapter->session_id, id, value, DBG_CMD);
4967 if (errno)
4968 hdd_err("Failed to set firmware, errno %d", errno);
4969
4970 return errno;
4971}
4972
4973#define hdd_we_set_dbg(adapter, id, value) \
4974 hdd_we_set_dbg(adapter, id, #id, value)
4975
4976static int hdd_we_dbglog_log_level(struct hdd_adapter *adapter, int value)
4977{
4978 return hdd_we_set_dbg(adapter,
4979 WMI_DBGLOG_LOG_LEVEL,
4980 value);
4981}
4982
4983static int hdd_we_dbglog_vap_enable(struct hdd_adapter *adapter, int value)
4984{
4985 return hdd_we_set_dbg(adapter,
4986 WMI_DBGLOG_VAP_ENABLE,
4987 value);
4988}
4989
4990static int hdd_we_dbglog_vap_disable(struct hdd_adapter *adapter, int value)
4991{
4992 return hdd_we_set_dbg(adapter,
4993 WMI_DBGLOG_VAP_DISABLE,
4994 value);
4995}
4996
4997static int hdd_we_dbglog_module_enable(struct hdd_adapter *adapter, int value)
4998{
4999 return hdd_we_set_dbg(adapter,
5000 WMI_DBGLOG_MODULE_ENABLE,
5001 value);
5002}
5003
5004static int hdd_we_dbglog_module_disable(struct hdd_adapter *adapter, int value)
5005{
5006 return hdd_we_set_dbg(adapter,
5007 WMI_DBGLOG_MODULE_DISABLE,
5008 value);
5009}
5010
5011static int hdd_we_dbglog_mod_log_level(struct hdd_adapter *adapter, int value)
5012{
5013 return hdd_we_set_dbg(adapter,
5014 WMI_DBGLOG_MOD_LOG_LEVEL,
5015 value);
5016}
5017
5018static int hdd_we_dbglog_type(struct hdd_adapter *adapter, int value)
5019{
5020 return hdd_we_set_dbg(adapter,
5021 WMI_DBGLOG_TYPE,
5022 value);
5023}
5024
5025static int hdd_we_dbglog_report_enable(struct hdd_adapter *adapter, int value)
5026{
5027 return hdd_we_set_dbg(adapter,
5028 WMI_DBGLOG_REPORT_ENABLE,
5029 value);
5030}
5031
5032static int hdd_we_start_fw_profile(struct hdd_adapter *adapter, int value)
5033{
5034 return hdd_we_set_dbg(adapter,
5035 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5036 value);
5037}
5038
Jeff Johnson274a1d62018-11-12 20:31:51 -08005039static int hdd_we_set_channel(struct hdd_adapter *adapter, int channel)
5040{
5041 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5042 QDF_STATUS status;
5043
5044 hdd_debug("Set Channel %d Session ID %d mode %d", channel,
5045 adapter->session_id, adapter->device_mode);
5046
5047 if (!hdd_ctx->mac_handle)
5048 return -EINVAL;
5049
5050 switch (adapter->device_mode) {
5051 case QDF_STA_MODE:
5052 case QDF_P2P_CLIENT_MODE:
5053 /* supported */
5054 break;
5055 default:
5056 hdd_err("change channel not supported for device mode %d",
5057 adapter->device_mode);
5058 return -EINVAL;
5059 }
5060
5061 status = sme_ext_change_channel(hdd_ctx->mac_handle, channel,
5062 adapter->session_id);
5063 if (status != QDF_STATUS_SUCCESS)
5064 hdd_err("Error in change channel status %d", status);
5065
5066 return qdf_status_to_os_return(status);
5067}
5068
Jeff Johnson0e07ca12018-11-12 21:04:45 -08005069static int hdd_we_mcc_config_latency(struct hdd_adapter *adapter, int latency)
5070{
5071 hdd_debug("MCC latency %d", latency);
5072
5073 wlan_hdd_set_mcc_latency(adapter, latency);
5074
5075 return 0;
5076}
5077
5078static int hdd_we_mcc_config_quota(struct hdd_adapter *adapter, int quota)
5079{
5080 hdd_debug("MCC quota %dms", quota);
5081
5082 return wlan_hdd_set_mcc_p2p_quota(adapter, quota);
5083}
5084
Jeff Johnson33ec1982018-11-12 21:40:33 -08005085static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value)
5086{
5087 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5088
5089 if (!hdd_ctx->mac_handle)
5090 return -EINVAL;
5091
5092 sme_update_connect_debug(hdd_ctx->mac_handle, value);
5093
5094 return 0;
5095}
5096
Jeff Johnsone50951c2018-11-13 12:20:23 -08005097static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value)
5098{
5099 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5100
5101 hdd_debug("%d", value);
5102
Abhishek Singh935e4772018-11-21 14:14:10 +05305103 if (!hdd_ctx->psoc)
Jeff Johnsone50951c2018-11-13 12:20:23 -08005104 return -EINVAL;
5105
Abhishek Singh935e4772018-11-21 14:14:10 +05305106 if (value)
5107 ucfg_scan_psoc_set_disable(hdd_ctx->psoc, REASON_USER_SPACE);
5108 else
5109 ucfg_scan_psoc_set_enable(hdd_ctx->psoc, REASON_USER_SPACE);
Jeff Johnsone50951c2018-11-13 12:20:23 -08005110
5111 return 0;
5112}
5113
Jeff Johnsond3f1efd2018-11-13 13:26:19 -08005114static int hdd_we_set_conc_system_pref(struct hdd_adapter *adapter,
5115 int preference)
5116{
5117 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5118
5119 hdd_debug("%d", preference);
5120
5121 if (!hdd_ctx->psoc)
5122 return -EINVAL;
5123
5124 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, preference);
5125
5126 return 0;
5127}
5128
Jeff Johnson74696bb2018-11-13 13:30:36 -08005129static int hdd_we_set_11ax_rate(struct hdd_adapter *adapter, int rate)
5130{
5131 return hdd_set_11ax_rate(adapter, rate, NULL);
5132}
5133
Jeff Johnsonb43ec122018-11-13 14:17:08 -08005134static int hdd_we_set_modulated_dtim(struct hdd_adapter *adapter, int value)
5135{
5136 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5137
5138 hdd_debug("%d", value);
5139
5140 if (!hdd_ctx->psoc)
5141 return -EINVAL;
5142
5143 if ((value < cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM)) ||
5144 (value > cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM))) {
5145 hdd_err("Invalid value %d", value);
5146 return -EINVAL;
5147 }
5148
5149 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, value);
5150
5151 return 0;
5152}
5153
Jeff Johnson3ba27322018-11-13 17:58:28 -08005154typedef int (*setint_getnone_fn)(struct hdd_adapter *adapter, int value);
5155static const setint_getnone_fn setint_getnone_cb[] = {
5156 [WE_SET_11D_STATE] = hdd_we_set_11d_state,
5157 [WE_SET_POWER] = hdd_we_set_power,
5158 [WE_SET_MAX_ASSOC] = hdd_we_set_max_assoc,
5159 [WE_SET_DATA_INACTIVITY_TO] = hdd_we_set_data_inactivity_timeout,
5160 [WE_SET_WOW_DATA_INACTIVITY_TO] =
5161 hdd_we_set_wow_data_inactivity_timeout,
5162 [WE_SET_MC_RATE] = wlan_hdd_set_mc_rate,
5163 [WE_SET_TX_POWER] = hdd_we_set_tx_power,
5164 [WE_SET_MAX_TX_POWER] = hdd_we_set_max_tx_power,
5165 [WE_SET_MAX_TX_POWER_2_4] = hdd_we_set_max_tx_power_2_4,
5166 [WE_SET_MAX_TX_POWER_5_0] = hdd_we_set_max_tx_power_5_0,
5167 [WE_SET_TM_LEVEL] = hdd_we_set_tm_level,
5168 [WE_SET_PHYMODE] = wlan_hdd_update_phymode,
5169 [WE_SET_NSS] = hdd_we_set_nss,
5170 [WE_SET_GTX_HT_MCS] = hdd_we_set_gtx_ht_mcs,
5171 [WE_SET_GTX_VHT_MCS] = hdd_we_set_gtx_vht_mcs,
5172 [WE_SET_GTX_USRCFG] = hdd_we_set_gtx_usrcfg,
5173 [WE_SET_GTX_THRE] = hdd_we_set_gtx_thre,
5174 [WE_SET_GTX_MARGIN] = hdd_we_set_gtx_margin,
5175 [WE_SET_GTX_STEP] = hdd_we_set_gtx_step,
5176 [WE_SET_GTX_MINTPC] = hdd_we_set_gtx_mintpc,
5177 [WE_SET_GTX_BWMASK] = hdd_we_set_gtx_bwmask,
5178 [WE_SET_LDPC] = hdd_set_ldpc,
5179 [WE_SET_TX_STBC] = hdd_set_tx_stbc,
5180 [WE_SET_RX_STBC] = hdd_set_rx_stbc,
5181 [WE_SET_SHORT_GI] = hdd_we_set_short_gi,
5182 [WE_SET_RTSCTS] = hdd_we_set_rtscts,
5183 [WE_SET_CHWIDTH] = hdd_we_set_ch_width,
5184 [WE_SET_ANI_EN_DIS] = hdd_we_set_ani_en_dis,
5185 [WE_SET_ANI_POLL_PERIOD] = hdd_we_set_ani_poll_period,
5186 [WE_SET_ANI_LISTEN_PERIOD] = hdd_we_set_ani_listen_period,
5187 [WE_SET_ANI_OFDM_LEVEL] = hdd_we_set_ani_ofdm_level,
5188 [WE_SET_ANI_CCK_LEVEL] = hdd_we_set_ani_cck_level,
5189 [WE_SET_DYNAMIC_BW] = hdd_we_set_dynamic_bw,
5190 [WE_SET_CTS_CBW] = hdd_we_set_cts_cbw,
5191 [WE_SET_11N_RATE] = hdd_we_set_11n_rate,
5192 [WE_SET_VHT_RATE] = hdd_we_set_vht_rate,
5193 [WE_SET_AMPDU] = hdd_we_set_ampdu,
5194 [WE_SET_AMSDU] = hdd_we_set_amsdu,
5195 [WE_SET_TX_CHAINMASK] = hdd_we_set_tx_chainmask,
5196 [WE_SET_RX_CHAINMASK] = hdd_we_set_rx_chainmask,
5197 [WE_SET_TXPOW_2G] = hdd_we_set_txpow_2g,
5198 [WE_SET_TXPOW_5G] = hdd_we_set_txpow_5g,
5199 [WE_DBGLOG_LOG_LEVEL] = hdd_we_dbglog_log_level,
5200 [WE_DBGLOG_VAP_ENABLE] = hdd_we_dbglog_vap_enable,
5201 [WE_DBGLOG_VAP_DISABLE] = hdd_we_dbglog_vap_disable,
5202 [WE_DBGLOG_MODULE_ENABLE] = hdd_we_dbglog_module_enable,
5203 [WE_DBGLOG_MODULE_DISABLE] = hdd_we_dbglog_module_disable,
5204 [WE_DBGLOG_MOD_LOG_LEVEL] = hdd_we_dbglog_mod_log_level,
5205 [WE_DBGLOG_TYPE] = hdd_we_dbglog_type,
5206 [WE_DBGLOG_REPORT_ENABLE] = hdd_we_dbglog_report_enable,
5207 [WE_SET_TXRX_FWSTATS] = hdd_we_set_txrx_fwstats,
5208 [WE_TXRX_FWSTATS_RESET] = hdd_we_txrx_fwstats_reset,
5209 [WE_DUMP_STATS] = hdd_wlan_dump_stats,
5210 [WE_CLEAR_STATS] = hdd_we_clear_stats,
5211 [WE_PPS_PAID_MATCH] = hdd_we_pps_paid_match,
5212 [WE_PPS_GID_MATCH] = hdd_we_pps_gid_match,
5213 [WE_PPS_EARLY_TIM_CLEAR] = hdd_we_pps_early_tim_clear,
5214 [WE_PPS_EARLY_DTIM_CLEAR] = hdd_we_pps_early_dtim_clear,
5215 [WE_PPS_EOF_PAD_DELIM] = hdd_we_pps_eof_pad_delim,
5216 [WE_PPS_MACADDR_MISMATCH] = hdd_we_pps_macaddr_mismatch,
5217 [WE_PPS_DELIM_CRC_FAIL] = hdd_we_pps_delim_crc_fail,
5218 [WE_PPS_GID_NSTS_ZERO] = hdd_we_pps_gid_nsts_zero,
5219 [WE_PPS_RSSI_CHECK] = hdd_we_pps_rssi_check,
5220 [WE_PPS_5G_EBT] = hdd_we_pps_5g_ebt,
5221 [WE_SET_HTSMPS] = hdd_we_set_htsmps,
5222 [WE_SET_QPOWER_MAX_PSPOLL_COUNT] = hdd_we_set_qpower_max_pspoll_count,
5223 [WE_SET_QPOWER_MAX_TX_BEFORE_WAKE] =
5224 hdd_we_set_qpower_max_tx_before_wake,
5225 [WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL] =
5226 hdd_we_set_qpower_spec_pspoll_wake_interval,
5227 [WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL] =
5228 hdd_we_set_qpower_spec_max_spec_nodata_pspoll,
5229 [WE_MCC_CONFIG_LATENCY] = hdd_we_mcc_config_latency,
5230 [WE_MCC_CONFIG_QUOTA] = hdd_we_mcc_config_quota,
5231 [WE_SET_DEBUG_LOG] = hdd_we_set_debug_log,
5232 [WE_SET_EARLY_RX_ADJUST_ENABLE] = hdd_we_set_early_rx_adjust_enable,
5233 [WE_SET_EARLY_RX_TGT_BMISS_NUM] = hdd_we_set_early_rx_tgt_bmiss_num,
5234 [WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE] =
5235 hdd_we_set_early_rx_bmiss_sample_cycle,
5236 [WE_SET_EARLY_RX_SLOP_STEP] = hdd_we_set_early_rx_slop_step,
5237 [WE_SET_EARLY_RX_INIT_SLOP] = hdd_we_set_early_rx_init_slop,
5238 [WE_SET_EARLY_RX_ADJUST_PAUSE] = hdd_we_set_early_rx_adjust_pause,
5239 [WE_SET_EARLY_RX_DRIFT_SAMPLE] = hdd_we_set_early_rx_drift_sample,
5240 [WE_SET_SCAN_DISABLE] = hdd_we_set_scan_disable,
5241 [WE_START_FW_PROFILE] = hdd_we_start_fw_profile,
5242 [WE_SET_CHANNEL] = hdd_we_set_channel,
5243 [WE_SET_CONC_SYSTEM_PREF] = hdd_we_set_conc_system_pref,
5244 [WE_SET_11AX_RATE] = hdd_we_set_11ax_rate,
5245 [WE_SET_DCM] = hdd_we_set_dcm,
5246 [WE_SET_RANGE_EXT] = hdd_we_set_range_ext,
5247 [WE_SET_PDEV_RESET] = hdd_handle_pdev_reset,
5248 [WE_SET_MODULATED_DTIM] = hdd_we_set_modulated_dtim,
5249};
5250
5251static setint_getnone_fn hdd_get_setint_getnone_cb(int param)
5252{
5253 if (param < 0)
5254 return NULL;
5255
5256 if (param >= QDF_ARRAY_SIZE(setint_getnone_cb))
5257 return NULL;
5258
5259 return setint_getnone_cb[param];
5260}
5261
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005262/**
5263 * iw_setint_getnone() - Generic "set integer" private ioctl handler
5264 * @dev: device upon which the ioctl was received
5265 * @info: ioctl request information
5266 * @wrqu: ioctl request data
5267 * @extra: ioctl extra data
5268 *
5269 * Return: 0 on success, non-zero on error
5270 */
5271static int __iw_setint_getnone(struct net_device *dev,
5272 struct iw_request_info *info,
5273 union iwreq_data *wrqu, char *extra)
5274{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005275 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005276 struct hdd_context *hdd_ctx;
Jeff Johnson3ba27322018-11-13 17:58:28 -08005277 setint_getnone_fn cb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005278 int *value = (int *)extra;
5279 int sub_cmd = value[0];
5280 int set_value = value[1];
5281 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005282
Dustin Brownfdf17c12018-03-14 12:55:34 -07005283 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305284
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005285 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005286 ret = wlan_hdd_validate_context(hdd_ctx);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005287 if (ret)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005288 return ret;
5289
Jeff Johnson441e1f72017-02-07 08:50:49 -08005290 ret = hdd_check_private_wext_control(hdd_ctx, info);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005291 if (ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08005292 return ret;
5293
Jeff Johnson3ba27322018-11-13 17:58:28 -08005294 cb = hdd_get_setint_getnone_cb(sub_cmd);
5295 if (!cb) {
Rajeev Kumard0565362018-03-01 12:02:01 -08005296 hdd_debug("Invalid sub command %d", sub_cmd);
Jeff Johnson3ba27322018-11-13 17:58:28 -08005297 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005298 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005299
Jeff Johnson3ba27322018-11-13 17:58:28 -08005300 ret = cb(adapter, set_value);
5301
Dustin Browne74003f2018-03-14 12:51:58 -07005302 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005303
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005304 return ret;
5305}
5306
5307static int iw_setint_getnone(struct net_device *dev,
5308 struct iw_request_info *info,
5309 union iwreq_data *wrqu,
5310 char *extra)
5311{
5312 int ret;
5313
5314 cds_ssr_protect(__func__);
5315 ret = __iw_setint_getnone(dev, info, wrqu, extra);
5316 cds_ssr_unprotect(__func__);
5317
5318 return ret;
5319}
5320
5321/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005322 * __iw_setnone_get_threeint() - return three value to up layer.
5323 *
5324 * @dev: pointer of net_device of this wireless card
5325 * @info: meta data about Request sent
5326 * @wrqu: include request info
5327 * @extra: buf used for in/Output
5328 *
5329 * Return: execute result
5330 */
5331static int __iw_setnone_get_threeint(struct net_device *dev,
5332 struct iw_request_info *info,
5333 union iwreq_data *wrqu, char *extra)
5334{
5335 int ret = 0; /* success */
5336 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005337 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005338 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005339
Dustin Brownfdf17c12018-03-14 12:55:34 -07005340 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005341 ret = wlan_hdd_validate_context(hdd_ctx);
5342 if (0 != ret)
5343 return ret;
5344
Jeff Johnson441e1f72017-02-07 08:50:49 -08005345 ret = hdd_check_private_wext_control(hdd_ctx, info);
5346 if (0 != ret)
5347 return ret;
5348
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005349 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005350 switch (value[0]) {
5351 case WE_GET_TSF:
5352 ret = hdd_indicate_tsf(adapter, value, 3);
5353 break;
5354 default:
5355 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5356 break;
5357 }
5358 return ret;
5359}
5360
5361/**
5362 * iw_setnone_get_threeint() - return three value to up layer.
5363 *
5364 * @dev: pointer of net_device of this wireless card
5365 * @info: meta data about Request sent
5366 * @wrqu: include request info
5367 * @extra: buf used for in/Output
5368 *
5369 * Return: execute result
5370 */
5371static int iw_setnone_get_threeint(struct net_device *dev,
5372 struct iw_request_info *info,
5373 union iwreq_data *wrqu, char *extra)
5374{
5375 int ret;
5376
5377 cds_ssr_protect(__func__);
5378 ret = __iw_setnone_get_threeint(dev, info, wrqu, extra);
5379 cds_ssr_unprotect(__func__);
5380
5381 return ret;
5382}
5383
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005384#ifdef WLAN_UNIT_TEST
Dustin Brown7d038e52018-11-29 14:28:13 -08005385typedef uint32_t (*hdd_ut_callback)(void);
5386
5387struct hdd_ut_entry {
5388 const hdd_ut_callback callback;
5389 const char *name;
5390};
5391
5392struct hdd_ut_entry hdd_ut_entries[] = {
5393 { .name = "dsc", .callback = dsc_unit_test },
Dustin Brownebb16d12018-11-29 17:52:07 -08005394 { .name = "types", .callback = qdf_types_unit_test },
Dustin Brown7d038e52018-11-29 14:28:13 -08005395};
5396
5397#define hdd_for_each_ut_entry(cursor) \
5398 for (cursor = hdd_ut_entries; \
5399 cursor < hdd_ut_entries + ARRAY_SIZE(hdd_ut_entries); \
5400 cursor++)
5401
5402static struct hdd_ut_entry *hdd_ut_lookup(const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005403{
Dustin Brown7d038e52018-11-29 14:28:13 -08005404 struct hdd_ut_entry *entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005405
Dustin Brown7d038e52018-11-29 14:28:13 -08005406 hdd_for_each_ut_entry(entry) {
5407 if (qdf_str_eq(entry->name, name))
5408 return entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005409 }
5410
Dustin Brown7d038e52018-11-29 14:28:13 -08005411 return NULL;
5412}
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005413
Dustin Brown7d038e52018-11-29 14:28:13 -08005414static uint32_t hdd_ut_single(const struct hdd_ut_entry *entry)
5415{
5416 uint32_t errors;
5417
5418 hdd_nofl_info("START: '%s'", entry->name);
5419
5420 errors = entry->callback();
5421 if (errors)
5422 hdd_nofl_err("FAIL: '%s' with %u errors", entry->name, errors);
5423 else
5424 hdd_nofl_info("PASS: '%s'", entry->name);
5425
5426 return errors;
5427}
5428
5429static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
5430{
5431 struct hdd_ut_entry *entry;
5432 uint32_t errors = 0;
5433
5434 hdd_nofl_info("Unit tests begin");
5435
5436 if (!name || !name[0] || qdf_str_eq(name, "all")) {
5437 hdd_for_each_ut_entry(entry)
5438 errors += hdd_ut_single(entry);
5439 } else {
5440 entry = hdd_ut_lookup(name);
5441 if (entry)
5442 errors += hdd_ut_single(entry);
5443 else
5444 hdd_nofl_err("Unit test '%s' not found", name);
5445 }
5446
5447 hdd_nofl_info("Unit tests complete");
5448
5449 return errors ? -EPERM : 0;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005450}
5451#else
Dustin Brown7d038e52018-11-29 14:28:13 -08005452static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005453{
5454 return -EOPNOTSUPP;
5455}
5456#endif /* WLAN_UNIT_TEST */
5457
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005458/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005459 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5460 * @dev: device upon which the ioctl was received
5461 * @info: ioctl request information
5462 * @wrqu: ioctl request data
5463 * @extra: ioctl extra data
5464 *
5465 * Return: 0 on success, non-zero on error
5466 */
5467static int __iw_setchar_getnone(struct net_device *dev,
5468 struct iw_request_info *info,
5469 union iwreq_data *wrqu, char *extra)
5470{
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005471 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005472 int sub_cmd;
5473 int ret;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005474 char *str_arg = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005475 struct hdd_adapter *adapter = (netdev_priv(dev));
5476 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005477 struct iw_point s_priv_data;
5478
Dustin Brownfdf17c12018-03-14 12:55:34 -07005479 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005480
Mukul Sharma34777c62015-11-02 20:22:30 +05305481 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005482 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305483 return -EPERM;
5484 }
5485
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005486 ret = wlan_hdd_validate_context(hdd_ctx);
5487 if (0 != ret)
5488 return ret;
5489
Jeff Johnson441e1f72017-02-07 08:50:49 -08005490 ret = hdd_check_private_wext_control(hdd_ctx, info);
5491 if (0 != ret)
5492 return ret;
5493
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005494 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005495 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005496 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005497
5498 /* make sure all params are correctly passed to function */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005499 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005500 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005501
5502 sub_cmd = s_priv_data.flags;
5503
5504 /* ODD number is used for set, copy data using copy_from_user */
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005505 str_arg = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005506 s_priv_data.length);
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005507 if (!str_arg) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005508 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005509 return -ENOMEM;
5510 }
5511
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005512 hdd_debug("Received length: %d data: %s",
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005513 s_priv_data.length, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005514
5515 switch (sub_cmd) {
5516 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005517 hdd_debug("ADD_PTRN");
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005518 hdd_add_wowl_ptrn(adapter, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005519 break;
5520 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005521 hdd_debug("DEL_PTRN");
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005522 hdd_del_wowl_ptrn(adapter, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005523 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005524 case WE_NEIGHBOR_REPORT_REQUEST:
5525 {
5526 tRrmNeighborReq neighborReq;
5527 tRrmNeighborRspCallbackInfo callbackInfo;
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305528 bool rrm_enabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005529
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305530 ucfg_wlan_mlme_get_rrm_enabled(hdd_ctx->psoc,
5531 &rrm_enabled);
5532
5533 if (rrm_enabled) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305534 neighborReq.neighbor_report_offload = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005535 neighborReq.no_ssid =
5536 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305537 hdd_debug("Neighbor Request ssid present %d",
5538 neighborReq.no_ssid);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005539 if (!neighborReq.no_ssid) {
5540 neighborReq.ssid.length =
5541 (s_priv_data.length - 1) >
5542 32 ? 32 : (s_priv_data.length - 1);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305543 qdf_mem_copy(neighborReq.ssid.ssId,
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005544 str_arg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005545 neighborReq.ssid.length);
5546 }
5547
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305548 /*
5549 * If 11k offload is supported by FW and enabled
5550 * in the ini, set the offload to true
5551 */
5552 if (hdd_ctx->config->is_11k_offload_supported &&
5553 (hdd_ctx->config->offload_11k_enable_bitmask &
5554 OFFLOAD_11K_BITMASK_NEIGHBOR_REPORT_REQUEST)) {
5555 hdd_debug("Neighbor report offloaded to FW");
5556 neighborReq.neighbor_report_offload = true;
5557 }
5558
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005559 callbackInfo.neighborRspCallback = NULL;
5560 callbackInfo.neighborRspCallbackContext = NULL;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305561 callbackInfo.timeout = 5000; /* 5 seconds */
5562 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005563 hdd_ctx->mac_handle,
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305564 adapter->session_id,
5565 &neighborReq,
5566 &callbackInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005567 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005568 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005569 ret = -EINVAL;
5570 }
5571 }
5572 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005573 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08005574 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005575 break;
5576 case WE_SET_CONFIG:
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005577 status = hdd_execute_global_config_command(hdd_ctx, str_arg);
5578 if (QDF_IS_STATUS_ERROR(status))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005579 ret = -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005580
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005581 break;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005582 case WE_UNIT_TEST:
5583 ret = hdd_we_unit_test(hdd_ctx, str_arg);
5584 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005585 default:
5586 {
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005587 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005588 ret = -EINVAL;
5589 break;
5590 }
5591 }
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005592
5593 qdf_mem_free(str_arg);
Dustin Browne74003f2018-03-14 12:51:58 -07005594 hdd_exit();
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005595
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005596 return ret;
5597}
5598
5599static int iw_setchar_getnone(struct net_device *dev,
5600 struct iw_request_info *info,
5601 union iwreq_data *wrqu, char *extra)
5602{
5603 int ret;
5604
5605 cds_ssr_protect(__func__);
5606 ret = __iw_setchar_getnone(dev, info, wrqu, extra);
5607 cds_ssr_unprotect(__func__);
5608
5609 return ret;
5610}
5611
5612/**
5613 * iw_setnone_getint() - Generic "get integer" private ioctl handler
5614 * @dev: device upon which the ioctl was received
5615 * @info: ioctl request information
5616 * @wrqu: ioctl request data
5617 * @extra: ioctl extra data
5618 *
5619 * Return: 0 on success, non-zero on error
5620 */
5621static int __iw_setnone_getint(struct net_device *dev,
5622 struct iw_request_info *info,
5623 union iwreq_data *wrqu, char *extra)
5624{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005625 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005626 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005627 int *value = (int *)extra;
5628 int ret;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305629 tSmeConfigParams *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005630 struct hdd_context *hdd_ctx;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05305631 QDF_STATUS status;
5632 bool bval = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005633
Dustin Brownfdf17c12018-03-14 12:55:34 -07005634 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305635
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005636 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005637 ret = wlan_hdd_validate_context(hdd_ctx);
5638 if (0 != ret)
5639 return ret;
5640
Jeff Johnson441e1f72017-02-07 08:50:49 -08005641 ret = hdd_check_private_wext_control(hdd_ctx, info);
5642 if (0 != ret)
5643 return ret;
5644
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08005645 sme_config = qdf_mem_malloc(sizeof(*sme_config));
5646 if (!sme_config) {
5647 hdd_err("failed to allocate memory for sme_config");
5648 return -ENOMEM;
5649 }
5650
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005651 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005652 switch (value[0]) {
5653 case WE_GET_11D_STATE:
5654 {
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05305655 status = ucfg_mlme_is_11d_enabled(hdd_ctx->psoc, &bval);
5656 if (!QDF_IS_STATUS_SUCCESS(status))
5657 hdd_err("Invalid 11d_enable flag");
5658 *value = bval;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005659 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005660
5661 break;
5662 }
5663
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005664 case WE_GET_WLAN_DBG:
5665 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05305666 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005667 *value = 0;
5668 break;
5669 }
5670 case WE_GET_MAX_ASSOC:
5671 {
Dustin Brown05d81302018-09-11 16:49:22 -07005672 if (ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, *value) !=
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05305673 QDF_STATUS_SUCCESS) {
5674 hdd_err("CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005675 ret = -EIO;
5676 }
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05305677
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005678 break;
5679 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005680
5681 case WE_GET_CONCURRENCY_MODE:
5682 {
Dustin Brown05d81302018-09-11 16:49:22 -07005683 *value = policy_mgr_get_concurrency_mode(hdd_ctx->psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005684
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005685 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005686 break;
5687 }
5688
5689 case WE_GET_NSS:
5690 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005691 sme_get_config_param(mac_handle, sme_config);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05305692 status = ucfg_mlme_get_vht_enable2x2(hdd_ctx->psoc, &bval);
5693 if (!QDF_IS_STATUS_SUCCESS(status))
5694 hdd_err("unable to get vht_enable2x2");
5695 *value = (bval == 0) ? 1 : 2;
Dustin Brown05d81302018-09-11 16:49:22 -07005696 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc))
Srinivas Girigowda576b2352017-08-25 14:44:26 -07005697 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005698 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005699 break;
5700 }
5701
5702 case WE_GET_GTX_HT_MCS:
5703 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005704 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005705 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005706 WMI_VDEV_PARAM_GTX_HT_MCS,
5707 GTX_CMD);
5708 break;
5709 }
5710
5711 case WE_GET_GTX_VHT_MCS:
5712 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005713 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005714 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005715 WMI_VDEV_PARAM_GTX_VHT_MCS,
5716 GTX_CMD);
5717 break;
5718 }
5719
5720 case WE_GET_GTX_USRCFG:
5721 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005722 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005723 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005724 WMI_VDEV_PARAM_GTX_USR_CFG,
5725 GTX_CMD);
5726 break;
5727 }
5728
5729 case WE_GET_GTX_THRE:
5730 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005731 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005732 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005733 WMI_VDEV_PARAM_GTX_THRE,
5734 GTX_CMD);
5735 break;
5736 }
5737
5738 case WE_GET_GTX_MARGIN:
5739 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005740 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005741 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005742 WMI_VDEV_PARAM_GTX_MARGIN,
5743 GTX_CMD);
5744 break;
5745 }
5746
5747 case WE_GET_GTX_STEP:
5748 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005749 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005750 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005751 WMI_VDEV_PARAM_GTX_STEP,
5752 GTX_CMD);
5753 break;
5754 }
5755
5756 case WE_GET_GTX_MINTPC:
5757 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005758 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005759 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005760 WMI_VDEV_PARAM_GTX_MINTPC,
5761 GTX_CMD);
5762 break;
5763 }
5764
5765 case WE_GET_GTX_BWMASK:
5766 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005767 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005768 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005769 WMI_VDEV_PARAM_GTX_BW_MASK,
5770 GTX_CMD);
5771 break;
5772 }
5773
5774 case WE_GET_LDPC:
5775 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005776 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005777 break;
5778 }
5779
5780 case WE_GET_TX_STBC:
5781 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005782 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005783 break;
5784 }
5785
5786 case WE_GET_RX_STBC:
5787 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005788 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005789 break;
5790 }
5791
5792 case WE_GET_SHORT_GI:
5793 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005794 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005795 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08005796 WMI_VDEV_PARAM_SGI,
5797 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005798 break;
5799 }
5800
5801 case WE_GET_RTSCTS:
5802 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005803 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005804 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005805 WMI_VDEV_PARAM_ENABLE_RTSCTS,
5806 VDEV_CMD);
5807 break;
5808 }
5809
5810 case WE_GET_CHWIDTH:
5811 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005812 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005813 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005814 WMI_VDEV_PARAM_CHWIDTH,
5815 VDEV_CMD);
5816 break;
5817 }
5818
5819 case WE_GET_ANI_EN_DIS:
5820 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005821 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005822 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005823 WMI_PDEV_PARAM_ANI_ENABLE,
5824 PDEV_CMD);
5825 break;
5826 }
5827
5828 case WE_GET_ANI_POLL_PERIOD:
5829 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005830 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005831 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005832 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
5833 PDEV_CMD);
5834 break;
5835 }
5836
5837 case WE_GET_ANI_LISTEN_PERIOD:
5838 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005839 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005840 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005841 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
5842 PDEV_CMD);
5843 break;
5844 }
5845
5846 case WE_GET_ANI_OFDM_LEVEL:
5847 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005848 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005849 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005850 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
5851 PDEV_CMD);
5852 break;
5853 }
5854
5855 case WE_GET_ANI_CCK_LEVEL:
5856 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005857 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005858 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005859 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
5860 PDEV_CMD);
5861 break;
5862 }
5863
5864 case WE_GET_DYNAMIC_BW:
5865 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005866 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005867 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005868 WMI_PDEV_PARAM_DYNAMIC_BW,
5869 PDEV_CMD);
5870 break;
5871 }
5872
5873 case WE_GET_11N_RATE:
5874 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005875 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005876 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005877 WMI_VDEV_PARAM_FIXED_RATE,
5878 VDEV_CMD);
5879 break;
5880 }
5881
5882 case WE_GET_AMPDU:
5883 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005884 hdd_debug("GET AMPDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005885 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005886 GEN_VDEV_PARAM_AMPDU,
5887 GEN_CMD);
5888 break;
5889 }
5890
5891 case WE_GET_AMSDU:
5892 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005893 hdd_debug("GET AMSDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005894 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005895 GEN_VDEV_PARAM_AMSDU,
5896 GEN_CMD);
5897 break;
5898 }
5899
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07005900 case WE_GET_ROAM_SYNCH_DELAY:
5901 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005902 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005903 *value = wma_cli_get_command(adapter->session_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07005904 GEN_VDEV_ROAM_SYNCH_DELAY,
5905 GEN_CMD);
5906 break;
5907 }
5908
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005909 case WE_GET_TX_CHAINMASK:
5910 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005911 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005912 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005913 WMI_PDEV_PARAM_TX_CHAIN_MASK,
5914 PDEV_CMD);
5915 break;
5916 }
5917
5918 case WE_GET_RX_CHAINMASK:
5919 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005920 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005921 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005922 WMI_PDEV_PARAM_RX_CHAIN_MASK,
5923 PDEV_CMD);
5924 break;
5925 }
5926
5927 case WE_GET_TXPOW_2G:
5928 {
5929 uint32_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005930
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005931 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
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_PDEV_PARAM_TXPOWER_LIMIT2G,
5934 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305935 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005936 sme_cfg_get_int(mac_handle, WNI_CFG_CURRENT_TX_POWER_LEVEL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005937 &txpow2g)) {
5938 return -EIO;
5939 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005940 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005941 break;
5942 }
5943
5944 case WE_GET_TXPOW_5G:
5945 {
5946 uint32_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005947
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005948 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005949 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005950 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
5951 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305952 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005953 sme_cfg_get_int(mac_handle, WNI_CFG_CURRENT_TX_POWER_LEVEL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005954 &txpow5g)) {
5955 return -EIO;
5956 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005957 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005958 break;
5959 }
5960
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005961 case WE_GET_PPS_PAID_MATCH:
5962 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005963 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005964 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005965 WMI_VDEV_PPS_PAID_MATCH,
5966 PPS_CMD);
5967 break;
5968 }
5969
5970 case WE_GET_PPS_GID_MATCH:
5971 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005972 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005973 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005974 WMI_VDEV_PPS_GID_MATCH,
5975 PPS_CMD);
5976 break;
5977 }
5978
5979 case WE_GET_PPS_EARLY_TIM_CLEAR:
5980 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005981 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005982 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005983 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
5984 PPS_CMD);
5985 break;
5986 }
5987
5988 case WE_GET_PPS_EARLY_DTIM_CLEAR:
5989 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005990 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005991 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005992 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
5993 PPS_CMD);
5994 break;
5995 }
5996
5997 case WE_GET_PPS_EOF_PAD_DELIM:
5998 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005999 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006000 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006001 WMI_VDEV_PPS_EOF_PAD_DELIM,
6002 PPS_CMD);
6003 break;
6004 }
6005
6006 case WE_GET_PPS_MACADDR_MISMATCH:
6007 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006008 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006009 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006010 WMI_VDEV_PPS_MACADDR_MISMATCH,
6011 PPS_CMD);
6012 break;
6013 }
6014
6015 case WE_GET_PPS_DELIM_CRC_FAIL:
6016 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006017 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006018 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006019 WMI_VDEV_PPS_DELIM_CRC_FAIL,
6020 PPS_CMD);
6021 break;
6022 }
6023
6024 case WE_GET_PPS_GID_NSTS_ZERO:
6025 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006026 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006027 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006028 WMI_VDEV_PPS_GID_NSTS_ZERO,
6029 PPS_CMD);
6030 break;
6031 }
6032
6033 case WE_GET_PPS_RSSI_CHECK:
6034 {
6035
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006036 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006037 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006038 WMI_VDEV_PPS_RSSI_CHECK,
6039 PPS_CMD);
6040 break;
6041 }
6042
6043 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
6044 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006045 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006046 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006047 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
6048 QPOWER_CMD);
6049 break;
6050 }
6051
6052 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
6053 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006054 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006055 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006056 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
6057 QPOWER_CMD);
6058 break;
6059 }
6060
6061 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
6062 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006063 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006064 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006065 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
6066 QPOWER_CMD);
6067 break;
6068 }
6069
6070 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
6071 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006072 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006073 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006074 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
6075 QPOWER_CMD);
6076 break;
6077 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006078 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006079 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006080 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006081 case WE_GET_TEMPERATURE:
6082 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006083 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006084 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006085 break;
6086 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006087 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006088 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006089 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006090 WMI_VDEV_PARAM_HE_DCM,
6091 VDEV_CMD);
6092 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006093 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006094 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006095 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006096 WMI_VDEV_PARAM_HE_RANGE_EXT,
6097 VDEV_CMD);
6098 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006099 default:
6100 {
Jeff Johnson99bac312016-06-28 10:38:18 -07006101 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006102 value[0]);
6103 break;
6104 }
6105 }
Dustin Browne74003f2018-03-14 12:51:58 -07006106 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306107 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006108 return ret;
6109}
6110
6111static int iw_setnone_getint(struct net_device *dev,
6112 struct iw_request_info *info,
6113 union iwreq_data *wrqu, char *extra)
6114{
6115 int ret;
6116
6117 cds_ssr_protect(__func__);
6118 ret = __iw_setnone_getint(dev, info, wrqu, extra);
6119 cds_ssr_unprotect(__func__);
6120
6121 return ret;
6122}
6123
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306124static int hdd_set_fwtest(int argc, int cmd, int value)
6125{
6126 struct set_fwtest_params *fw_test;
6127
6128 /* check for max number of arguments */
6129 if (argc > (WMA_MAX_NUM_ARGS) ||
6130 argc != HDD_FWTEST_PARAMS) {
6131 hdd_err("Too Many args %d", argc);
6132 return -EINVAL;
6133 }
6134 /*
6135 * check if number of arguments are 3 then, check
6136 * then set the default value for sounding interval.
6137 */
6138 if (HDD_FWTEST_PARAMS == argc) {
6139 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
6140 value = HDD_FWTEST_SU_DEFAULT_VALUE;
6141 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6142 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6143 }
6144 /* check sounding interval value should not exceed to max */
6145 if (value > HDD_FWTEST_MAX_VALUE) {
6146 hdd_err("Invalid arguments value should not exceed max: %d",
6147 value);
6148 return -EINVAL;
6149 }
6150 fw_test = qdf_mem_malloc(sizeof(*fw_test));
6151 if (NULL == fw_test) {
6152 hdd_err("qdf_mem_malloc failed for fw_test");
6153 return -ENOMEM;
6154 }
6155 fw_test->arg = cmd;
6156 fw_test->value = value;
6157 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6158 qdf_mem_free(fw_test);
6159 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6160 return -EINVAL;
6161 }
6162 return 0;
6163}
6164
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006165/**
6166 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6167 * @dev: device upon which the ioctl was received
6168 * @info: ioctl request information
6169 * @wrqu: ioctl request data
6170 * @extra: ioctl extra data
6171 *
6172 * Return: 0 on success, non-zero on error
6173 */
6174static int __iw_set_three_ints_getnone(struct net_device *dev,
6175 struct iw_request_info *info,
6176 union iwreq_data *wrqu, char *extra)
6177{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006178 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006179 int *value = (int *)extra;
6180 int sub_cmd = value[0];
6181 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08006182 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006183 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08006184 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006185
Dustin Brownfdf17c12018-03-14 12:55:34 -07006186 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306187
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006188 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006189 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006190 return -EPERM;
6191 }
6192
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006193 ret = wlan_hdd_validate_context(hdd_ctx);
6194 if (0 != ret)
6195 return ret;
6196
Jeff Johnson441e1f72017-02-07 08:50:49 -08006197 ret = hdd_check_private_wext_control(hdd_ctx, info);
6198 if (0 != ret)
6199 return ret;
6200
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006201 switch (sub_cmd) {
6202
6203 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006204 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6205 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006206 break;
6207 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306208 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006209 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306210
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006211 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6212 hdd_debug("Ioctl to set dual mac scan config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08006213 status =
6214 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
6215 &dual_mac_feature);
6216 if (status != QDF_STATUS_SUCCESS)
6217 hdd_err("can't get dual mac feature val, use def");
6218 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006219 hdd_err("Dual mac feature is disabled from INI");
6220 return -EPERM;
6221 }
6222 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Dustin Brown05d81302018-09-11 16:49:22 -07006223 policy_mgr_set_dual_mac_scan_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006224 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006225 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306226 case WE_SET_FW_TEST:
6227 {
6228 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6229 if (ret) {
6230 hdd_err("Not able to set fwtest %d", ret);
6231 return ret;
6232 }
6233 }
6234 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006235 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006236 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006237 break;
6238
6239 }
Dustin Browne74003f2018-03-14 12:51:58 -07006240 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006241 return ret;
6242}
6243
6244int iw_set_three_ints_getnone(struct net_device *dev,
6245 struct iw_request_info *info,
6246 union iwreq_data *wrqu, char *extra)
6247{
6248 int ret;
6249
6250 cds_ssr_protect(__func__);
6251 ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
6252 cds_ssr_unprotect(__func__);
6253
6254 return ret;
6255}
6256
6257/**
6258 * hdd_connection_state_string() - Get connection state string
6259 * @connection_state: enum to be converted to a string
6260 *
6261 * Return: the string equivalent of @connection_state
6262 */
6263static const char *
6264hdd_connection_state_string(eConnectionState connection_state)
6265{
6266 switch (connection_state) {
6267 CASE_RETURN_STRING(eConnectionState_NotConnected);
6268 CASE_RETURN_STRING(eConnectionState_Connecting);
6269 CASE_RETURN_STRING(eConnectionState_Associated);
6270 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6271 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6272 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6273 default:
6274 return "UNKNOWN";
6275 }
6276}
6277
Naveen Rawat910726a2017-03-06 11:42:51 -08006278#if defined(FEATURE_OEM_DATA_SUPPORT)
6279/**
6280 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6281 * wifi_pos api to get oem data caps
6282 * @dev: net device upon which the request was received
6283 * @info: ioctl request information
6284 * @wrqu: ioctl request data
6285 * @extra: ioctl data payload
6286 *
6287 * Return: 0 for success, negative errno value on failure
6288 */
6289static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6290 struct iw_request_info *info,
6291 union iwreq_data *wrqu, char *extra)
6292{
6293 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6294}
6295#elif defined(WIFI_POS_CONVERGED)
6296static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6297 struct iw_request_info *info,
6298 union iwreq_data *wrqu, char *extra)
6299{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006300 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006301 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006302
Dustin Brown05d81302018-09-11 16:49:22 -07006303 return os_if_wifi_pos_populate_caps(hdd_ctx->psoc,
Naveen Rawat910726a2017-03-06 11:42:51 -08006304 (struct wifi_pos_driver_caps *)extra);
6305}
6306#else
6307static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6308 struct iw_request_info *info,
6309 union iwreq_data *wrqu, char *extra)
6310{
6311 return -ENOTSUPP;
6312}
6313#endif
6314
Krunal Soni5e483782018-10-25 15:42:44 -07006315#ifdef WLAN_UNIT_TEST
6316static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6317 struct hdd_adapter *adapter,
6318 char *extra)
6319{
6320 QDF_STATUS status;
6321
6322 status = sme_get_sta_cxn_info(hdd_ctx->mac_handle, adapter->session_id,
6323 extra, WE_MAX_STR_LEN);
6324 if (status != QDF_STATUS_SUCCESS)
6325 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6326 "\nNo active connection");
6327
6328 return 0;
6329}
6330#else
6331static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6332 struct hdd_adapter *adapter,
6333 char *extra)
6334{
6335 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6336 "\nNot supported");
6337 return -ENOTSUPP;
6338}
6339#endif
6340
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006341/**
6342 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6343 * @dev: device upon which the ioctl was received
6344 * @info: ioctl request information
6345 * @wrqu: ioctl request data
6346 * @extra: ioctl extra data
6347 *
6348 * Return: 0 on success, non-zero on error
6349 */
6350static int __iw_get_char_setnone(struct net_device *dev,
6351 struct iw_request_info *info,
6352 union iwreq_data *wrqu, char *extra)
6353{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006354 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006355 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006356 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006357 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006358 int ret;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306359 QDF_STATUS status;
6360 uint8_t value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006361
Dustin Brownfdf17c12018-03-14 12:55:34 -07006362 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306363
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006364 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006365 ret = wlan_hdd_validate_context(hdd_ctx);
6366 if (0 != ret)
6367 return ret;
6368
Jeff Johnson441e1f72017-02-07 08:50:49 -08006369 ret = hdd_check_private_wext_control(hdd_ctx, info);
6370 if (0 != ret)
6371 return ret;
6372
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006373 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006374 switch (sub_cmd) {
6375 case WE_WLAN_VERSION:
6376 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006377 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6378 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006379 break;
6380 }
6381
6382 case WE_GET_STATS:
6383 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006384 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006385 extra, WE_MAX_STR_LEN);
6386 break;
6387 }
6388
Dustin Brownd9322482017-01-09 12:46:03 -08006389 case WE_GET_SUSPEND_RESUME_STATS:
6390 {
6391 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6392 WE_MAX_STR_LEN);
6393 if (ret >= 0) {
6394 wrqu->data.length = ret;
6395 ret = 0;
6396 }
6397
6398 break;
6399 }
6400
Govind Singha471e5e2015-10-12 17:11:14 +05306401 case WE_LIST_FW_PROFILE:
6402 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6403 extra, WE_MAX_STR_LEN);
6404 break;
6405
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006406 /* The case prints the current state of the HDD, SME, CSR, PE,
6407 * TL it can be extended for WDI Global State as well. And
6408 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6409 * and P2P_GO have not been added as of now.
6410 */
6411 case WE_GET_STATES:
6412 {
6413 int buf = 0, len = 0;
6414 int adapter_num = 0;
6415 int count = 0, check = 1;
6416
Jeff Johnsond377dce2017-10-04 10:32:42 -07006417 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006418
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006419 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson3d278b02017-08-29 14:17:47 -07006420 struct hdd_adapter *useAdapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006421
6422 /* Print wlan0 or p2p0 states based on the adapter_num
6423 * by using the correct adapter
6424 */
6425 while (adapter_num < 2) {
6426 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006427 useAdapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006428 buf =
6429 scnprintf(extra + len,
6430 WE_MAX_STR_LEN - len,
6431 "\n\n wlan0 States:-");
6432 len += buf;
6433 } else if (P2P_ADAPTER == adapter_num) {
6434 buf =
6435 scnprintf(extra + len,
6436 WE_MAX_STR_LEN - len,
6437 "\n\n p2p0 States:-");
6438 len += buf;
6439
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006440 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006441 buf =
6442 scnprintf(extra + len,
6443 WE_MAX_STR_LEN -
6444 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006445 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006446 len += buf;
6447 break;
6448 }
6449
6450 /* Printing p2p0 states only in the
6451 * case when the device is configured
6452 * as a p2p_client
6453 */
6454 useAdapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006455 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006456 QDF_P2P_CLIENT_MODE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006457 if (!useAdapter) {
6458 buf =
6459 scnprintf(extra + len,
6460 WE_MAX_STR_LEN -
6461 len,
6462 "\n Device not configured as P2P_CLIENT.");
6463 len += buf;
6464 break;
6465 }
6466 }
6467
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006468 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006469 buf = scnprintf(extra + len,
6470 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006471 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006472 len += buf;
6473 break;
6474 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006475 sta_ctx =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006476 WLAN_HDD_GET_STATION_CTX_PTR(useAdapter);
6477
6478
6479 buf =
6480 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6481 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006482 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006483 "\n Neighbour Roam State - %s"
6484 "\n CSR State - %s"
6485 "\n CSR Substate - %s",
6486 hdd_connection_state_string
Jeff Johnsond377dce2017-10-04 10:32:42 -07006487 (sta_ctx->conn_info.connState),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006488 mac_trace_get_neighbour_roam_state
6489 (sme_get_neighbor_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006490 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006491 mac_trace_getcsr_roam_state
6492 (sme_get_current_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006493 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006494 mac_trace_getcsr_roam_sub_state
6495 (sme_get_current_roam_sub_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006496 (mac_handle, useAdapter->session_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006497 );
6498 len += buf;
6499 adapter_num++;
6500 }
6501
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006502 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006503 /* Printing Lim State starting with global lim states */
6504 buf =
6505 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006506 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006507 "\n Global Sme State - %s "
6508 "\n Global mlm State - %s " "\n",
6509 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006510 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006511 mac_trace_get_lim_mlm_state
Jeff Johnson71d465a2018-12-05 11:13:30 -08006512 (sme_get_lim_mlm_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006513 );
6514 len += buf;
6515
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006516 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006517 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006518 buf =
6519 scnprintf(extra + len,
6520 WE_MAX_STR_LEN -
6521 len,
6522 "\n Lim Valid Session %d:-"
6523 "\n PE Sme State - %s "
6524 "\n PE Mlm State - %s "
6525 "\n", check,
6526 mac_trace_get_lim_sme_state
6527 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006528 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006529 mac_trace_get_lim_mlm_state
6530 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006531 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006532 );
6533
6534 len += buf;
6535 check++;
6536 }
6537 count++;
6538 }
6539 }
6540
6541 wrqu->data.length = strlen(extra) + 1;
6542 break;
6543 }
6544
6545 case WE_GET_CFG:
6546 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006547 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006548 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006549 extra,
6550 QCSAP_IOCTL_MAX_STR_LEN);
6551 wrqu->data.length = strlen(extra) + 1;
6552 break;
6553 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006554 case WE_GET_RSSI:
6555 {
6556 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006557
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006558 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006559 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
6560 wrqu->data.length = strlen(extra) + 1;
6561 break;
6562 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006563
6564 case WE_GET_WMM_STATUS:
6565 {
6566 snprintf(extra, WE_MAX_STR_LEN,
6567 "\nDir: 0=up, 1=down, 3=both\n"
6568 "|------------------------|\n"
6569 "|AC | ACM |Admitted| Dir |\n"
6570 "|------------------------|\n"
6571 "|VO | %d | %3s | %d |\n"
6572 "|VI | %d | %3s | %d |\n"
6573 "|BE | %d | %3s | %d |\n"
6574 "|BK | %d | %3s | %d |\n"
6575 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006576 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006577 wmmAcStatus[SME_AC_VO].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006578 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006579 wmmAcStatus[SME_AC_VO].
6580 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006581 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006582 wmmAcStatus[SME_AC_VO].wmmAcTspecInfo.
6583 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006584 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006585 wmmAcStatus[SME_AC_VI].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006586 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006587 wmmAcStatus[SME_AC_VI].
6588 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006589 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006590 wmmAcStatus[SME_AC_VI].wmmAcTspecInfo.
6591 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006592 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006593 wmmAcStatus[SME_AC_BE].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006594 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006595 wmmAcStatus[SME_AC_BE].
6596 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006597 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006598 wmmAcStatus[SME_AC_BE].wmmAcTspecInfo.
6599 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006600 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006601 wmmAcStatus[SME_AC_BK].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006602 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006603 wmmAcStatus[SME_AC_BK].
6604 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006605 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006606 wmmAcStatus[SME_AC_BK].wmmAcTspecInfo.
6607 ts_info.direction);
6608
6609 wrqu->data.length = strlen(extra) + 1;
6610 break;
6611 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07006612
6613 case WE_GET_BA_AGEING_TIMEOUT:
6614 {
6615 uint8_t ac_cat = 4;
6616 uint32_t duration[ac_cat], i;
6617 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
6618
6619 if (!soc) {
6620 hdd_err("Invalid SOC handle");
6621 break;
6622 }
6623
6624 for (i = 0; i < ac_cat; i++)
6625 cdp_get_ba_timeout(soc, i, &duration[i]);
6626
6627 snprintf(extra, WE_MAX_STR_LEN,
6628 "\n|------------------------------|\n"
6629 "|AC | BA aging timeout duration |\n"
6630 "|--------------------------------|\n"
6631 "|VO | %d |\n"
6632 "|VI | %d |\n"
6633 "|BE | %d |\n"
6634 "|BK | %d |\n"
6635 "|--------------------------------|\n",
6636 duration[3], duration[2], duration[1], duration[0]);
6637
6638 wrqu->data.length = strlen(extra) + 1;
6639 break;
6640 }
6641
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006642 case WE_GET_CHANNEL_LIST:
6643 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306644 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006645 uint8_t i, len;
6646 char *buf;
6647 uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN];
6648 uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN;
Srinivas Girigowdac231df62017-03-24 18:27:57 -07006649 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006650
6651 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05306652 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006653 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306654 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006655 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006656 return -EINVAL;
6657 }
6658 buf = extra;
6659 /*
6660 * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN.
6661 * Maximum buffer needed = 5 * number of channels.
6662 * Check ifsufficient buffer is available and then
6663 * proceed to fill the buffer.
6664 */
6665 if (WE_MAX_STR_LEN <
6666 (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006667 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006668 return -EINVAL;
6669 }
6670 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
6671 channel_list.num_channels);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006672 if (QDF_STATUS_SUCCESS == sme_get_country_code(mac_handle,
6673 ubuf,
6674 &ubuf_len)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006675 /* Printing Country code in getChannelList */
6676 for (i = 0; i < (ubuf_len - 1); i++)
6677 len += scnprintf(buf + len,
6678 WE_MAX_STR_LEN - len,
6679 "%c", ubuf[i]);
6680 }
6681 for (i = 0; i < channel_list.num_channels; i++) {
6682 len +=
6683 scnprintf(buf + len, WE_MAX_STR_LEN - len,
6684 " %u", channel_list.channels[i]);
6685 }
6686 wrqu->data.length = strlen(extra) + 1;
6687
6688 break;
6689 }
6690#ifdef FEATURE_WLAN_TDLS
6691 case WE_GET_TDLS_PEERS:
6692 {
6693 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006694 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006695 WE_MAX_STR_LEN) + 1;
6696 break;
6697 }
6698#endif
6699#ifdef WLAN_FEATURE_11W
6700 case WE_GET_11W_INFO:
6701 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006702 struct csr_roam_profile *roam_profile =
6703 hdd_roam_profile(adapter);
6704
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006705 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006706 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006707
6708 snprintf(extra, WE_MAX_STR_LEN,
6709 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
6710 "\n Number of Unprotected Disassocs %d"
6711 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006712 roam_profile->BSSIDs.bssid->bytes[0],
6713 roam_profile->BSSIDs.bssid->bytes[1],
6714 roam_profile->BSSIDs.bssid->bytes[2],
6715 roam_profile->BSSIDs.bssid->bytes[3],
6716 roam_profile->BSSIDs.bssid->bytes[4],
6717 roam_profile->BSSIDs.bssid->bytes[5],
6718 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07006719 adapter->hdd_stats.hdd_pmf_stats.
6720 num_unprot_disassoc_rx,
6721 adapter->hdd_stats.hdd_pmf_stats.
6722 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006723
6724 wrqu->data.length = strlen(extra) + 1;
6725 break;
6726 }
6727#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006728 case WE_GET_IBSS_STA_INFO:
6729 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07006730 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006731 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006732 int idx = 0;
6733 int length = 0, buf = 0;
6734
Naveen Rawatc45d1622016-07-05 12:20:09 -07006735 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07006736 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07006737 sta_ctx->conn_info.staId[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006738 buf = snprintf
6739 ((extra + length),
6740 WE_MAX_STR_LEN - length,
6741 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnsond377dce2017-10-04 10:32:42 -07006742 sta_ctx->conn_info.staId[idx],
6743 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006744 peerMacAddress[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006745 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006746 peerMacAddress[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006747 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006748 peerMacAddress[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006749 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006750 peerMacAddress[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006751 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006752 peerMacAddress[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006753 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006754 peerMacAddress[idx].bytes[5]
6755 );
6756 length += buf;
6757 }
6758 }
6759 wrqu->data.length = strlen(extra) + 1;
6760 break;
6761 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006762 case WE_GET_PHYMODE:
6763 {
6764 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006765 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006766 eCsrPhyMode phymode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006767 enum band_info currBand;
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006768 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006769
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006770 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6771 if (!sme_config) {
6772 hdd_err("Out of memory");
6773 ret = -ENOMEM;
6774 break;
6775 }
6776
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006777 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006778 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006779 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006780 ch_bond24 = true;
6781
6782 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006783 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006784 ch_bond5g = true;
6785
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006786 qdf_mem_free(sme_config);
6787
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006788 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306789 if ((QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006790 sme_get_freq_band(mac_handle, &currBand))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006791 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006792 return -EIO;
6793 }
6794
6795 switch (phymode) {
6796 case eCSR_DOT11_MODE_AUTO:
6797 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
6798 break;
6799 case eCSR_DOT11_MODE_11n:
6800 case eCSR_DOT11_MODE_11n_ONLY:
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006801 if (currBand == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006802 if (ch_bond24)
6803 snprintf(extra, WE_MAX_STR_LEN,
6804 "11NGHT40");
6805 else
6806 snprintf(extra, WE_MAX_STR_LEN,
6807 "11NGHT20");
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006808 } else if (currBand == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006809 if (ch_bond5g)
6810 snprintf(extra, WE_MAX_STR_LEN,
6811 "11NAHT40");
6812 else
6813 snprintf(extra, WE_MAX_STR_LEN,
6814 "11NAHT20");
6815 } else {
6816 snprintf(extra, WE_MAX_STR_LEN, "11N");
6817 }
6818 break;
6819 case eCSR_DOT11_MODE_abg:
6820 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
6821 break;
6822 case eCSR_DOT11_MODE_11a:
6823 snprintf(extra, WE_MAX_STR_LEN, "11A");
6824 break;
6825 case eCSR_DOT11_MODE_11b:
6826 case eCSR_DOT11_MODE_11b_ONLY:
6827 snprintf(extra, WE_MAX_STR_LEN, "11B");
6828 break;
6829 case eCSR_DOT11_MODE_11g:
6830 case eCSR_DOT11_MODE_11g_ONLY:
6831 snprintf(extra, WE_MAX_STR_LEN, "11G");
6832 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006833 case eCSR_DOT11_MODE_11ac:
6834 case eCSR_DOT11_MODE_11ac_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306835 status =
6836 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
6837 &value);
6838 if (!QDF_IS_STATUS_SUCCESS(status))
6839 hdd_err("Failed to set channel_width");
6840 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006841 snprintf(extra, WE_MAX_STR_LEN,
6842 "11ACVHT20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306843 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006844 snprintf(extra, WE_MAX_STR_LEN,
6845 "11ACVHT40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306846 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006847 snprintf(extra, WE_MAX_STR_LEN,
6848 "11ACVHT80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306849 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006850 snprintf(extra, WE_MAX_STR_LEN,
6851 "11ACVHT160");
6852 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006853 case eCSR_DOT11_MODE_11ax:
6854 case eCSR_DOT11_MODE_11ax_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306855 status =
6856 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
6857 &value);
6858 if (!QDF_IS_STATUS_SUCCESS(status))
6859 hdd_err("Failed to set channel_width");
6860
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006861 /* currently using vhtChannelWidth */
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306862 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006863 snprintf(extra, WE_MAX_STR_LEN,
6864 "11AX_HE_20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306865 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006866 snprintf(extra, WE_MAX_STR_LEN,
6867 "11AX_HE_40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306868 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006869 snprintf(extra, WE_MAX_STR_LEN,
6870 "11AX_HE_80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306871 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006872 snprintf(extra, WE_MAX_STR_LEN,
6873 "11AX_HE_160");
6874 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006875 }
6876
6877 wrqu->data.length = strlen(extra) + 1;
6878 break;
6879 }
6880
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006881 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08006882 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006883 case WE_GET_SNR:
6884 {
6885 int8_t s7snr = 0;
6886 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006887 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07006888 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006889
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006890 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006891 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05306892 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006893 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05306894
Jeff Johnsond377dce2017-10-04 10:32:42 -07006895 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006896 if (0 == hdd_ctx->config->fEnableSNRMonitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006897 eConnectionState_Associated !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07006898 sta_ctx->conn_info.connState) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006899 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006900 hdd_ctx->config->fEnableSNRMonitoring,
Jeff Johnsond377dce2017-10-04 10:32:42 -07006901 sta_ctx->conn_info.connState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006902 return -ENONET;
6903 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006904 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006905 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
6906 wrqu->data.length = strlen(extra) + 1;
6907 break;
6908 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006909
Krunal Soni5e483782018-10-25 15:42:44 -07006910 case WE_GET_STA_CXN_INFO:
6911 ret = hdd_get_sta_cxn_info(hdd_ctx, adapter, extra);
6912 wrqu->data.length = strlen(extra) + 1;
6913 break;
6914
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006915 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006916 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006917 break;
6918 }
Dustin Brownd9322482017-01-09 12:46:03 -08006919
Dustin Browne74003f2018-03-14 12:51:58 -07006920 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08006921 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006922}
6923
6924static int iw_get_char_setnone(struct net_device *dev,
6925 struct iw_request_info *info,
6926 union iwreq_data *wrqu, char *extra)
6927{
6928 int ret;
6929
6930 cds_ssr_protect(__func__);
6931 ret = __iw_get_char_setnone(dev, info, wrqu, extra);
6932 cds_ssr_unprotect(__func__);
6933
6934 return ret;
6935}
6936
6937/**
6938 * iw_setnone_getnone() - Generic "action" private ioctl handler
6939 * @dev: device upon which the ioctl was received
6940 * @info: ioctl request information
6941 * @wrqu: ioctl request data
6942 * @extra: ioctl extra data
6943 *
6944 * Return: 0 on success, non-zero on error
6945 */
6946static int __iw_setnone_getnone(struct net_device *dev,
6947 struct iw_request_info *info,
6948 union iwreq_data *wrqu, char *extra)
6949{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006950 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006951 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006952 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006953 int ret;
6954 int sub_cmd;
6955
Dustin Brownfdf17c12018-03-14 12:55:34 -07006956 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306957
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006958 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006959 ret = wlan_hdd_validate_context(hdd_ctx);
6960 if (0 != ret)
6961 return ret;
6962
Jeff Johnson441e1f72017-02-07 08:50:49 -08006963 ret = hdd_check_private_wext_control(hdd_ctx, info);
6964 if (0 != ret)
6965 return ret;
6966
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006967#ifdef CONFIG_COMPAT
6968 /* this ioctl is a special case where a sub-ioctl is used and both
6969 * the number of get and set args is 0. in this specific case the
6970 * logic in iwpriv places the sub_cmd in the data.flags portion of
6971 * the iwreq. unfortunately the location of this field will be
6972 * different between 32-bit and 64-bit userspace, and the standard
6973 * compat support in the kernel does not handle this case. so we
6974 * need to explicitly handle it here.
6975 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07006976 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006977 struct compat_iw_point *compat_iw_point =
6978 (struct compat_iw_point *)&wrqu->data;
6979 sub_cmd = compat_iw_point->flags;
6980 } else {
6981 sub_cmd = wrqu->data.flags;
6982 }
6983#else
6984 sub_cmd = wrqu->data.flags;
6985#endif
6986
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006987 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006988 switch (sub_cmd) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006989
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006990 case WE_GET_RECOVERY_STAT:
6991 sme_get_recovery_stats(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006992 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006993
Govind Singha471e5e2015-10-12 17:11:14 +05306994 case WE_GET_FW_PROFILE_DATA:
Jeff Johnson1b780e42017-10-31 14:11:45 -07006995 ret = wma_cli_set_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05306996 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
6997 0, DBG_CMD);
6998 break;
6999
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007000 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007001 hdd_wlan_get_ibss_peer_info_all(adapter);
7002 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007003
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007004 case WE_SET_REASSOC_TRIGGER:
7005 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07007006 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307007 tSirMacAddr bssid;
Krunal Sonibfd05492017-10-03 15:48:37 -07007008 uint32_t roamId = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307009 uint8_t operating_ch =
Jeff Johnsonb9424862017-10-30 08:49:35 -07007010 adapter->session.station.conn_info.operationChannel;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007011 tCsrRoamModifyProfileFields modProfileFields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007012
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007013 sme_get_modify_profile_fields(mac_handle, adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007014 &modProfileFields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307015 if (roaming_offload_enabled(hdd_ctx)) {
7016 qdf_mem_copy(bssid,
Jeff Johnsonb9424862017-10-30 08:49:35 -07007017 &adapter->session.station.conn_info.bssId,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307018 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08007019 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307020 bssid, operating_ch);
7021 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007022 sme_roam_reassoc(mac_handle, adapter->session_id,
7023 NULL, modProfileFields, &roamId, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307024 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007025 return 0;
7026 }
7027
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007028 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007029 /*
7030 * 1.OBSS Scan is mandatory while operating in 2.4GHz
7031 * 2.OBSS scan is stopped by Firmware during the disassociation
7032 * 3.OBSS stop comamnd is added for debugging purpose
7033 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007034 if (!mac_handle) {
7035 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007036 return -EINVAL;
7037 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007038 sme_ht40_stop_obss_scan(mac_handle, adapter->session_id);
7039 break;
7040
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007041 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007042 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007043 break;
7044 }
Dustin Browne74003f2018-03-14 12:51:58 -07007045 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007046 return ret;
7047}
7048
7049static int iw_setnone_getnone(struct net_device *dev,
7050 struct iw_request_info *info,
7051 union iwreq_data *wrqu, char *extra)
7052{
7053 int ret;
7054
7055 cds_ssr_protect(__func__);
7056 ret = __iw_setnone_getnone(dev, info, wrqu, extra);
7057 cds_ssr_unprotect(__func__);
7058
7059 return ret;
7060}
7061
Krunal Sonia6e505b2017-01-12 12:25:18 -08007062#ifdef MPC_UT_FRAMEWORK
Liangwei Dong509c3472018-05-30 07:05:59 -04007063static void
7064hdd_policy_mgr_set_hw_mode_ut(struct hdd_context *hdd_ctx,
7065 struct hdd_adapter *adapter, int cmd)
7066{
7067 enum hw_mode_ss_config mac0_ss;
7068 enum hw_mode_bandwidth mac0_bw;
7069 enum hw_mode_ss_config mac1_ss;
7070 enum hw_mode_bandwidth mac1_bw;
7071 enum hw_mode_mac_band_cap mac0_band_cap;
7072 enum hw_mode_dbs_capab dbs;
7073
7074 switch (cmd) {
7075 case 0:
7076 hdd_debug("set hw mode for single mac");
7077 mac0_ss = HW_MODE_SS_2x2;
7078 mac0_bw = HW_MODE_80_MHZ;
7079 mac1_ss = HW_MODE_SS_0x0;
7080 mac1_bw = HW_MODE_BW_NONE;
7081 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7082 dbs = HW_MODE_DBS_NONE;
7083 break;
7084 case 1:
7085 hdd_debug("set hw mode for dual mac");
7086 mac0_ss = HW_MODE_SS_1x1;
7087 mac0_bw = HW_MODE_80_MHZ;
7088 mac1_ss = HW_MODE_SS_1x1;
7089 mac1_bw = HW_MODE_40_MHZ;
7090 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7091 dbs = HW_MODE_DBS;
7092 break;
7093 case 2:
7094 hdd_debug("set hw mode for 2x2 5g + 1x1 2g");
7095 mac0_ss = HW_MODE_SS_2x2;
7096 mac0_bw = HW_MODE_80_MHZ;
7097 mac1_ss = HW_MODE_SS_1x1;
7098 mac1_bw = HW_MODE_40_MHZ;
7099 mac0_band_cap = HW_MODE_MAC_BAND_5G;
7100 dbs = HW_MODE_DBS;
7101 break;
7102 case 3:
7103 hdd_debug("set hw mode for 2x2 2g + 1x1 5g");
7104 mac0_ss = HW_MODE_SS_2x2;
7105 mac0_bw = HW_MODE_40_MHZ;
7106 mac1_ss = HW_MODE_SS_1x1;
7107 mac1_bw = HW_MODE_40_MHZ;
7108 mac0_band_cap = HW_MODE_MAC_BAND_2G;
7109 dbs = HW_MODE_DBS;
7110 break;
7111 default:
7112 hdd_err("unknown cmd %d", cmd);
7113 return;
7114 }
7115 policy_mgr_pdev_set_hw_mode(hdd_ctx->psoc, adapter->session_id,
7116 mac0_ss, mac0_bw, mac1_ss, mac1_bw,
7117 mac0_band_cap, dbs, HW_MODE_AGILE_DFS_NONE,
7118 HW_MODE_SBS_NONE,
7119 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
7120}
7121
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007122static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007123 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007124{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08007125 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08007126 case WE_POLICY_MANAGER_CLIST_CMD:
7127 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007128 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307129 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307130 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7131 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7132 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7133 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307134 return 0;
7135 }
Dustin Brown05d81302018-09-11 16:49:22 -07007136 policy_mgr_incr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007137 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7138 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007139 }
7140 break;
7141
7142 case WE_POLICY_MANAGER_DLIST_CMD:
7143 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007144 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307145 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307146 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307147 return 0;
7148 }
Dustin Brown05d81302018-09-11 16:49:22 -07007149 policy_mgr_decr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007150 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007151 }
7152 break;
7153
7154 case WE_POLICY_MANAGER_ULIST_CMD:
7155 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007156 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307157 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307158 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7159 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7160 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7161 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307162 return 0;
7163 }
Dustin Brown05d81302018-09-11 16:49:22 -07007164 policy_mgr_update_connection_info_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007165 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7166 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007167 }
7168 break;
7169
7170 case WE_POLICY_MANAGER_DBS_CMD:
7171 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007172 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007173 if (apps_args[0] == 0)
7174 wma_set_dbs_capability_ut(0);
7175 else
7176 wma_set_dbs_capability_ut(1);
7177
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007178 if (apps_args[1] >= PM_THROUGHPUT &&
7179 apps_args[1] <= PM_LATENCY) {
Liangwei Dong509c3472018-05-30 07:05:59 -04007180 hdd_debug("setting system pref to [%d]\n",
7181 apps_args[1]);
Krunal Sonie71838d2018-09-27 10:45:05 -07007182 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc,
7183 apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007184 }
7185 }
7186 break;
7187
7188 case WE_POLICY_MANAGER_PCL_CMD:
7189 {
7190 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
7191 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
7192 uint32_t pcl_len = 0, i = 0;
7193
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007194 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007195
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307196 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307197 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307198 return 0;
7199 }
Dustin Brown05d81302018-09-11 16:49:22 -07007200 policy_mgr_get_pcl(hdd_ctx->psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08007201 pcl, &pcl_len,
7202 weight_list, QDF_ARRAY_SIZE(weight_list));
Liangwei Dong509c3472018-05-30 07:05:59 -04007203 hdd_debug("PCL list for role[%d] is {", apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007204 for (i = 0 ; i < pcl_len; i++)
Liangwei Dong509c3472018-05-30 07:05:59 -04007205 hdd_debug(" %d, ", pcl[i]);
7206 hdd_debug("}--------->\n");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007207 }
7208 break;
7209
7210 case WE_POLICY_SET_HW_MODE_CMD:
7211 {
Liangwei Dong509c3472018-05-30 07:05:59 -04007212 hdd_debug("pm_set_hw_mode cmd %d", apps_args[0]);
7213 hdd_policy_mgr_set_hw_mode_ut(hdd_ctx, adapter, apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007214 }
7215 break;
7216
7217 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7218 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007219 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307220 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307221 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307222 return 0;
7223 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07007224 policy_mgr_current_connections_update(
Dustin Brown05d81302018-09-11 16:49:22 -07007225 hdd_ctx->psoc,
Jeff Johnson1b780e42017-10-31 14:11:45 -07007226 adapter->session_id, apps_args[0],
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07007227 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007228 }
7229 break;
7230
7231 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7232 {
7233 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007234
Dustin Brown5e89ef82018-03-14 11:50:23 -07007235 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307236 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307237 (apps_args[2] < 0)) {
7238 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307239 return 0;
7240 }
Dustin Brown05d81302018-09-11 16:49:22 -07007241 allow = policy_mgr_allow_concurrency(hdd_ctx->psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08007242 apps_args[0], apps_args[1], apps_args[2]);
Liangwei Dong509c3472018-05-30 07:05:59 -04007243 hdd_debug("allow %d {0 = don't allow, 1 = allow}", allow);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007244 }
7245 break;
7246
7247 case WE_POLICY_MANAGER_SCENARIO_CMD:
7248 {
7249 clean_report(hdd_ctx);
7250 if (apps_args[0] == 1) {
7251 wlan_hdd_one_connection_scenario(hdd_ctx);
7252 } else if (apps_args[0] == 2) {
7253 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007254 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007255 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007256 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007257 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007258 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007259 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007260 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007261 } else if (apps_args[0] == 3) {
7262 /* MCC on same band with 2x2 same mac*/
7263 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007264 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007265 /* MCC on diff band with 2x2 same mac*/
7266 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007267 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007268 /* MCC on diff band with 1x1 diff mac */
7269 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007270 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007271 /* MCC on diff band with 1x1 same mac */
7272 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007273 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007274 /* SCC on same band with 2x2 same mac */
7275 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007276 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007277 /* SCC on same band with 1x1 same mac */
7278 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007279 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007280 /* MCC on same band with 2x2 same mac */
7281 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007282 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007283 /* MCC on same band with 1x1 same mac */
7284 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007285 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007286 }
7287 print_report(hdd_ctx);
7288 }
7289 break;
7290 }
7291 return 0;
7292}
7293#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007294static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007295 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007296{
7297 return 0;
7298}
7299#endif
7300
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007301/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007302 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7303 * @hdd_ctx: hdd_context
7304 * @num_args: input args number
7305 * @apps_args: args data ptr
7306 *
7307 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7308 *
7309 * Return: void
7310 */
7311#if WLAN_DEBUG
7312static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7313 int num_args, int *apps_args)
7314{
7315 struct ch_avoid_ind_type ch_avoid;
7316 int cnt = 0, i;
7317
7318 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7319 num_args % 2 != 0)
7320 return;
7321 hdd_info("simulate ch avoid num_args %d", num_args);
7322 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7323 ch_avoid.avoid_freq_range[cnt].start_freq =
7324 apps_args[i];
7325 ch_avoid.avoid_freq_range[cnt].end_freq =
7326 apps_args[++i];
7327
7328 hdd_info("simulate ch avoid [%d %d]",
7329 ch_avoid.avoid_freq_range[cnt].start_freq,
7330 ch_avoid.avoid_freq_range[cnt].end_freq);
7331 cnt++;
7332 }
7333 ch_avoid.ch_avoid_range_cnt = cnt;
Dustin Brown05d81302018-09-11 16:49:22 -07007334 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->psoc, &ch_avoid);
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007335}
7336#else
7337static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7338 int num_args, int *apps_args)
7339{
7340}
7341#endif
7342/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007343 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7344 * @dev: device upon which the ioctl was received
7345 * @info: ioctl request information
7346 * @wrqu: ioctl request data
7347 * @extra: ioctl extra data
7348 *
7349 * This is an SSR-protected generic handler for private ioctls which
7350 * take multiple arguments. Note that this implementation is also
7351 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7352 * interfaces.
7353 *
7354 * Return: 0 on success, non-zero on error
7355 */
7356static int __iw_set_var_ints_getnone(struct net_device *dev,
7357 struct iw_request_info *info,
7358 union iwreq_data *wrqu, char *extra)
7359{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007360 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007361 mac_handle_t mac_handle;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007362 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007363 int sub_cmd;
7364 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007365 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007366 int ret, num_args;
chenguoaa7c90c2018-05-24 17:08:47 +08007367 void *soc = NULL;
7368 struct cdp_pdev *pdev = NULL;
7369 struct cdp_vdev *vdev = NULL;
7370 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007371
Dustin Brownfdf17c12018-03-14 12:55:34 -07007372 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307373
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007374 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007375 ret = wlan_hdd_validate_context(hdd_ctx);
7376 if (0 != ret)
7377 return ret;
7378
Jeff Johnson441e1f72017-02-07 08:50:49 -08007379 ret = hdd_check_private_wext_control(hdd_ctx, info);
7380 if (0 != ret)
7381 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007382
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007383 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007384 sub_cmd = wrqu->data.flags;
7385 num_args = wrqu->data.length;
7386
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007387 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007388
7389 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007390 case WE_IBSS_GET_PEER_INFO:
7391 {
7392 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007393 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007394 }
7395 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007396
7397 case WE_P2P_NOA_CMD:
7398 {
Srinivas Girigowda5d5fdc52017-03-24 22:30:57 -07007399 struct p2p_app_set_ps p2pNoA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007400
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007401 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007402 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
Dustin Brown458027c2018-10-19 12:26:27 -07007403 qdf_opmode_str(adapter->device_mode),
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007404 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007405 return -EINVAL;
7406 }
7407
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007408 p2pNoA.opp_ps = apps_args[0];
7409 p2pNoA.ctWindow = apps_args[1];
7410 p2pNoA.duration = apps_args[2];
7411 p2pNoA.interval = apps_args[3];
7412 p2pNoA.count = apps_args[4];
7413 p2pNoA.single_noa_duration = apps_args[5];
7414 p2pNoA.psSelection = apps_args[6];
7415
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007416 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 -07007417 apps_args[0], apps_args[1], apps_args[2],
7418 apps_args[3], apps_args[4],
7419 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007420
7421 hdd_set_p2p_ps(dev, &p2pNoA);
7422
7423 }
7424 break;
7425
7426 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7427 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007428 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007429 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307430 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007431 }
7432 break;
7433
7434 case WE_MTRACE_DUMP_CMD:
7435 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007436 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007437 apps_args[0], apps_args[1],
7438 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007439 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007440 apps_args[1], apps_args[2],
7441 apps_args[3]);
7442
7443 }
7444 break;
7445
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007446 case WE_POLICY_MANAGER_CINFO_CMD:
7447 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007448 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007449 uint32_t i = 0, len = 0;
7450
Krunal Sonia6e505b2017-01-12 12:25:18 -08007451 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007452 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007453 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007454 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007455 pr_info("|table_index[%d]\t\t\n", i);
7456 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
7457 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
7458 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7459 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7460 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7461 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7462 pr_info("+--------------------------+\n");
7463 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007464 }
7465 }
7466 break;
7467
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007468 case WE_UNIT_TEST_CMD:
7469 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007470 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007471
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007472 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7473 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007474 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007475 return -EINVAL;
7476 }
Sourav Mohapatraea7210b2018-11-16 16:58:52 +05307477 if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307478 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007479 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007480 return -EINVAL;
7481 }
Jeff Johnson1b780e42017-10-31 14:11:45 -07007482 status = sme_send_unit_test_cmd(adapter->session_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007483 apps_args[0],
7484 apps_args[1],
7485 &apps_args[2]);
7486 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007487 hdd_err("sme_send_unit_test_cmd returned %d", status);
7488 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007489 }
7490 }
7491 break;
7492#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7493 case WE_LED_FLASHING_PARAM:
7494 {
7495 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007496
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007497 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007498 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007499 return -EINVAL;
7500 }
7501 for (i = 0; i < num_args; i++) {
7502 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007503 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007504 return -EINVAL;
7505 }
7506 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007507 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007508 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007509 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007510 1, apps_args[2], apps_args[3]);
7511 }
7512 break;
7513#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05307514 case WE_SET_PKTLOG:
7515 {
7516 int ret;
7517
7518 if (num_args < 1 || num_args > 2) {
7519 hdd_err("pktlog: either 1 or 2 parameters are required");
7520 return -EINVAL;
7521 }
7522
7523 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
7524 apps_args[1]);
7525 if (ret)
7526 return ret;
7527 break;
7528 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05307529 case WE_MAC_PWR_DEBUG_CMD:
7530 {
7531 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05307532 int i, j;
7533
7534 if (num_args < 3) {
7535 hdd_err("number of arguments can't be null %d",
7536 num_args);
7537 return -EINVAL;
7538 }
7539 if (num_args - 3 != apps_args[2]) {
7540 hdd_err("arg list of size %d doesn't match num_args %d",
7541 num_args-3, apps_args[2]);
7542 return -EINVAL;
7543 }
7544 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
7545 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
7546 hdd_err("Invalid MODULE ID %d", apps_args[1]);
7547 return -EINVAL;
7548 }
7549 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
7550 hdd_err("Too Many args %d", apps_args[2]);
7551 return -EINVAL;
7552 }
7553 mac_pwr_dbg_args.pdev_id = apps_args[0];
7554 mac_pwr_dbg_args.module_id = apps_args[1];
7555 mac_pwr_dbg_args.num_args = apps_args[2];
7556
7557 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
7558 mac_pwr_dbg_args.args[i] = apps_args[j];
7559
7560 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007561 sme_process_mac_pwr_dbg_cmd(mac_handle,
7562 adapter->session_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05307563 &mac_pwr_dbg_args)) {
7564 return -EINVAL;
7565 }
7566 }
7567 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08007568 case WE_POLICY_MANAGER_CLIST_CMD:
7569 case WE_POLICY_MANAGER_DLIST_CMD:
7570 case WE_POLICY_MANAGER_ULIST_CMD:
7571 case WE_POLICY_MANAGER_DBS_CMD:
7572 case WE_POLICY_MANAGER_PCL_CMD:
7573 case WE_POLICY_SET_HW_MODE_CMD:
7574 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7575 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7576 case WE_POLICY_MANAGER_SCENARIO_CMD:
7577 {
Krunal Soni3de68532018-09-05 12:16:58 -07007578 if (!hdd_ctx->config->is_unit_test_framework_enabled) {
7579 hdd_warn_rl("UT framework is disabled");
7580 return -EINVAL;
7581 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007582 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Soni3de68532018-09-05 12:16:58 -07007583 sub_cmd, apps_args);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007584 }
7585 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007586 case WE_SET_CHAN_AVOID:
7587 {
7588 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
7589 }
7590 break;
chenguoaa7c90c2018-05-24 17:08:47 +08007591 case WE_SET_TXRX_STATS:
7592 {
7593 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
7594 adapter->session_id);
7595
7596 if (ret != 0) {
7597 hdd_err("Invalid handles");
7598 break;
7599 }
7600
7601 req.stats = apps_args[0];
7602 /* default value of secondary parameter is 0(mac_id) */
7603 req.mac_id = apps_args[1];
7604
7605 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
7606 req.stats, req.mac_id);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007607 if (apps_args[0] == CDP_TXRX_STATS_28) {
7608 if (sta_ctx->conn_info.uIsAuthenticated) {
7609 hdd_debug("ap mac addr: %pM",
7610 (void *)&sta_ctx->conn_info.bssId);
7611 req.peer_addr =
7612 (char *)&sta_ctx->conn_info.bssId;
7613 }
7614 }
chenguoaa7c90c2018-05-24 17:08:47 +08007615 ret = cdp_txrx_stats_request(soc, vdev, &req);
7616 break;
7617 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007618 default:
7619 {
Jeff Johnson99bac312016-06-28 10:38:18 -07007620 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007621 }
7622 break;
7623 }
Dustin Browne74003f2018-03-14 12:51:58 -07007624 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007625 return 0;
7626}
7627
7628/**
7629 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
7630 * @dev: pointer to net_device structure
7631 * @info: pointer to iw_request_info structure
7632 * @wrqu: pointer to iwreq_data
7633 * @extra; extra
7634 *
7635 * Return: 0 on success, error number otherwise
7636 *
7637 */
7638static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
7639 struct iw_request_info *info,
7640 union iwreq_data *wrqu, char *extra)
7641{
7642 union iwreq_data u_priv_wrqu;
7643 int apps_args[MAX_VAR_ARGS] = {0};
7644 int ret, num_args;
7645
Mukul Sharma64a70e82015-11-02 20:05:09 +05307646 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007647 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05307648 return -EPERM;
7649 }
7650
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007651 /* Helper function to get iwreq_data with compat handling. */
7652 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
7653 return -EINVAL;
7654
7655 if (NULL == u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007656 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007657 return -EINVAL;
7658 }
7659
7660 num_args = u_priv_wrqu.data.length;
7661 if (num_args > MAX_VAR_ARGS)
7662 num_args = MAX_VAR_ARGS;
7663
7664 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
7665 (sizeof(int)) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007666 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007667 return -EFAULT;
7668 }
7669
7670 cds_ssr_protect(__func__);
7671 ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
7672 (char *)&apps_args);
7673 cds_ssr_unprotect(__func__);
7674 return ret;
7675}
7676
7677/**
7678 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7679 * @dev: device upon which the ioctl was received
7680 * @info: ioctl request information
7681 * @wrqu: ioctl request data
7682 * @extra: ioctl extra data
7683 *
7684 * This is a generic handler for private ioctls which take multiple
7685 * arguments. Note that this implementation is also somewhat unique
7686 * in that it is shared by both STA-mode and SAP-mode interfaces.
7687 *
7688 * Return: 0 on success, non-zero on error
7689 */
7690int iw_set_var_ints_getnone(struct net_device *dev,
7691 struct iw_request_info *info,
7692 union iwreq_data *wrqu, char *extra)
7693{
7694 int ret;
7695
7696 cds_ssr_protect(__func__);
7697 ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
7698 cds_ssr_unprotect(__func__);
7699 return ret;
7700}
7701
7702/**
7703 * iw_add_tspec - Add TSpec private ioctl handler
7704 * @dev: device upon which the ioctl was received
7705 * @info: ioctl request information
7706 * @wrqu: ioctl request data
7707 * @extra: ioctl extra data
7708 *
7709 * Return: 0 on success, non-zero on error
7710 */
7711static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
7712 union iwreq_data *wrqu, char *extra)
7713{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007714 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07007715 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007716 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7717 int params[HDD_WLAN_WMM_PARAM_COUNT];
Abhishek Singh12be60f2017-08-11 13:52:42 +05307718 struct sme_qos_wmmtspecinfo tSpec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007719 uint32_t handle;
7720 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007721 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007722 int ret;
7723
Dustin Brownfdf17c12018-03-14 12:55:34 -07007724 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307725
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007726 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007727 ret = wlan_hdd_validate_context(hdd_ctx);
7728 if (0 != ret)
7729 return ret;
7730
Jeff Johnson441e1f72017-02-07 08:50:49 -08007731 ret = hdd_check_private_wext_control(hdd_ctx, info);
7732 if (0 != ret)
7733 return ret;
7734
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007735 /* make sure the application is sufficiently priviledged */
7736 /* note that the kernel will do this for "set" ioctls, but since */
7737 /* this ioctl wants to return status to user space it must be */
7738 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007739 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007740 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007741
7742 /* we must be associated in order to add a tspec */
Jeff Johnsond377dce2017-10-04 10:32:42 -07007743 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007744 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7745 return 0;
7746 }
7747 /* since we are defined to be a "get" ioctl, and since the number */
7748 /* of params exceeds the number of params that wireless extensions */
7749 /* will pass down in the iwreq_data, we must copy the "set" params. */
7750 /* We must handle the compat for iwreq_data in 32U/64K environment. */
7751
7752 /* helper function to get iwreq_data with compat handling. */
7753 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
7754 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7755 return 0;
7756 }
7757 /* make sure all params are correctly passed to function */
7758 if ((NULL == s_priv_data.pointer) ||
7759 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
7760 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7761 return 0;
7762 }
7763 /* from user space ourselves */
7764 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
7765 /* hmmm, can't get them */
7766 return -EIO;
7767 }
7768 /* clear the tspec */
7769 memset(&tSpec, 0, sizeof(tSpec));
7770
7771 /* validate the handle */
7772 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7773 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7774 /* that one is reserved */
7775 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7776 return 0;
7777 }
7778 /* validate the TID */
7779 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
7780 /* out of range */
7781 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7782 return 0;
7783 }
7784 tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
7785
7786 /* validate the direction */
7787 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
7788 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
7789 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
7790 break;
7791
7792 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
7793 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
7794 break;
7795
7796 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
7797 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
7798 break;
7799
7800 default:
7801 /* unknown */
7802 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7803 return 0;
7804 }
7805
7806 tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
7807
7808 /* validate the user priority */
7809 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
7810 /* out of range */
7811 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7812 return 0;
7813 }
7814 tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
7815 if (0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007816 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007817 return 0;
7818 }
7819
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007820 hdd_debug("TS_INFO PSB %d UP %d !!!",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007821 tSpec.ts_info.psb, tSpec.ts_info.up);
7822
7823 tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
7824 tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
7825 tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
7826 tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
7827 tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
7828 tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
7829 tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
7830 tSpec.surplus_bw_allowance =
7831 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
7832 tSpec.min_service_interval =
7833 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
7834 tSpec.max_service_interval =
7835 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
7836 tSpec.suspension_interval =
7837 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
7838 tSpec.inactivity_interval =
7839 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
7840
7841 tSpec.ts_info.burst_size_defn =
7842 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
7843
7844 /* validate the ts info ack policy */
7845 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
Abhinav Kumarab576712018-11-05 14:32:49 +05307846 case TS_INFO_ACK_POLICY_NORMAL_ACK:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007847 tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
7848 break;
7849
Abhinav Kumarab576712018-11-05 14:32:49 +05307850 case TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007851 tSpec.ts_info.ack_policy =
7852 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
7853 break;
7854
7855 default:
7856 /* unknown */
7857 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7858 return 0;
7859 }
7860
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007861 *pStatus = hdd_wmm_addts(adapter, handle, &tSpec);
Dustin Browne74003f2018-03-14 12:51:58 -07007862 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007863 return 0;
7864}
7865
7866static int iw_add_tspec(struct net_device *dev,
7867 struct iw_request_info *info,
7868 union iwreq_data *wrqu, char *extra)
7869{
7870 int ret;
7871
7872 cds_ssr_protect(__func__);
7873 ret = __iw_add_tspec(dev, info, wrqu, extra);
7874 cds_ssr_unprotect(__func__);
7875
7876 return ret;
7877}
7878
7879/**
7880 * iw_del_tspec - Delete TSpec private ioctl handler
7881 * @dev: device upon which the ioctl was received
7882 * @info: ioctl request information
7883 * @wrqu: ioctl request data
7884 * @extra: ioctl extra data
7885 *
7886 * Return: 0 on success, non-zero on error
7887 */
7888static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
7889 union iwreq_data *wrqu, char *extra)
7890{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007891 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007892 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007893 int *params = (int *)extra;
7894 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7895 uint32_t handle;
7896 int ret;
7897
Dustin Brownfdf17c12018-03-14 12:55:34 -07007898 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307899
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007900 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007901 ret = wlan_hdd_validate_context(hdd_ctx);
7902 if (0 != ret)
7903 return ret;
7904
Jeff Johnson441e1f72017-02-07 08:50:49 -08007905 ret = hdd_check_private_wext_control(hdd_ctx, info);
7906 if (0 != ret)
7907 return ret;
7908
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007909 /* make sure the application is sufficiently priviledged */
7910 /* note that the kernel will do this for "set" ioctls, but since */
7911 /* this ioctl wants to return status to user space it must be */
7912 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007913 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007914 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007915
7916 /* although we are defined to be a "get" ioctl, the params we require */
7917 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
7918 /* is no need to copy the params from user space */
7919
7920 /* validate the handle */
7921 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7922 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7923 /* that one is reserved */
7924 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7925 return 0;
7926 }
7927
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007928 *pStatus = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07007929 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007930 return 0;
7931}
7932
7933static int iw_del_tspec(struct net_device *dev,
7934 struct iw_request_info *info,
7935 union iwreq_data *wrqu, char *extra)
7936{
7937 int ret;
7938
7939 cds_ssr_protect(__func__);
7940 ret = __iw_del_tspec(dev, info, wrqu, extra);
7941 cds_ssr_unprotect(__func__);
7942
7943 return ret;
7944}
7945
7946/**
7947 * iw_get_tspec - Get TSpec private ioctl handler
7948 * @dev: device upon which the ioctl was received
7949 * @info: ioctl request information
7950 * @wrqu: ioctl request data
7951 * @extra: ioctl extra data
7952 *
7953 * Return: 0 on success, non-zero on error
7954 */
7955static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
7956 union iwreq_data *wrqu, char *extra)
7957{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007958 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007959 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007960 int *params = (int *)extra;
7961 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7962 uint32_t handle;
7963 int ret;
7964
Dustin Brownfdf17c12018-03-14 12:55:34 -07007965 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307966
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007967 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007968 ret = wlan_hdd_validate_context(hdd_ctx);
7969 if (0 != ret)
7970 return ret;
7971
Jeff Johnson441e1f72017-02-07 08:50:49 -08007972 ret = hdd_check_private_wext_control(hdd_ctx, info);
7973 if (0 != ret)
7974 return ret;
7975
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007976 /* although we are defined to be a "get" ioctl, the params we require */
7977 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
7978 /* is no need to copy the params from user space */
7979
7980 /* validate the handle */
7981 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7982 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7983 /* that one is reserved */
7984 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7985 return 0;
7986 }
7987
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007988 *pStatus = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07007989 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007990 return 0;
7991}
7992
7993static int iw_get_tspec(struct net_device *dev,
7994 struct iw_request_info *info,
7995 union iwreq_data *wrqu, char *extra)
7996{
7997 int ret;
7998
7999 cds_ssr_protect(__func__);
8000 ret = __iw_get_tspec(dev, info, wrqu, extra);
8001 cds_ssr_unprotect(__func__);
8002
8003 return ret;
8004}
8005
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008006/**
8007 * iw_set_fties - Set FT IEs private ioctl handler
8008 * @dev: device upon which the ioctl was received
8009 * @info: ioctl request information
8010 * @wrqu: ioctl request data
8011 * @extra: ioctl extra data
8012 *
8013 * Each time the supplicant has the auth_request or reassoc request
8014 * IEs ready they are pushed to the driver. The driver will in turn
8015 * use it to send out the auth req and reassoc req for 11r FT Assoc.
8016 *
8017 * Return: 0 on success, non-zero on error
8018 */
8019static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
8020 union iwreq_data *wrqu, char *extra)
8021{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008022 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008023 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008024 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008025 int ret;
8026
Dustin Brownfdf17c12018-03-14 12:55:34 -07008027 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308028
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008029 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008030 ret = wlan_hdd_validate_context(hdd_ctx);
8031 if (0 != ret)
8032 return ret;
8033
Jeff Johnson441e1f72017-02-07 08:50:49 -08008034 ret = hdd_check_private_wext_control(hdd_ctx, info);
8035 if (0 != ret)
8036 return ret;
8037
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008038 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008039 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008040 return -EINVAL;
8041 }
8042 if (wrqu->data.pointer == NULL) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008043 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008044 return -EINVAL;
8045 }
8046 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsond377dce2017-10-04 10:32:42 -07008047 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008048 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008049 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008050 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008051 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008052 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008053
8054 /* Pass the received FT IEs to SME */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008055 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->session_id,
8056 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07008057 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008058 return 0;
8059}
8060
8061static int iw_set_fties(struct net_device *dev,
8062 struct iw_request_info *info,
8063 union iwreq_data *wrqu, char *extra)
8064{
8065 int ret;
8066
8067 cds_ssr_protect(__func__);
8068 ret = __iw_set_fties(dev, info, wrqu, extra);
8069 cds_ssr_unprotect(__func__);
8070
8071 return ret;
8072}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008073
Dustin Brown0cbc7572016-12-16 13:54:40 -08008074/**
8075 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
8076 * @dev: device upon which the ioctl was received
8077 * @info: ioctl request information
8078 * @wrqu: ioctl request data
8079 * @extra: ioctl extra data
8080 *
Dustin Brown860566f2017-01-31 15:24:43 -08008081 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
8082 * time being to provide guidance in migrating to standard APIs.
8083 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08008084 * Return: 0 on success, non-zero on error
8085 */
8086static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
8087 struct iw_request_info *info,
8088 union iwreq_data *wrqu,
8089 char *extra)
8090{
Dustin Brown860566f2017-01-31 15:24:43 -08008091 hdd_err("\n"
8092 "setMCBCFilter is obsolete. Use the following instead:\n"
8093 "Configure multicast filtering via the ‘ip’ command.\n"
8094 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
8095 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
8096 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
8097 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
8098 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07008099 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08008100}
8101
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008102/**
8103 * iw_set_host_offload - Set host offload ioctl handler
8104 * @dev: device upon which the ioctl was received
8105 * @info: ioctl request information
8106 * @wrqu: ioctl request data
8107 * @extra: ioctl extra data
8108 *
8109 * Return: 0 on success, non-zero on error
8110 */
8111static int __iw_set_host_offload(struct net_device *dev,
8112 struct iw_request_info *info,
8113 union iwreq_data *wrqu, char *extra)
8114{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008115 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Srinivas Girigowda077143e2017-03-25 10:47:27 -07008116 struct host_offload_req *pRequest = (struct host_offload_req *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008117 tSirHostOffloadReq offloadRequest;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008118 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008119 int ret;
8120
Dustin Brownfdf17c12018-03-14 12:55:34 -07008121 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308122
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008123 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008124 ret = wlan_hdd_validate_context(hdd_ctx);
8125 if (0 != ret)
8126 return ret;
8127
Jeff Johnson441e1f72017-02-07 08:50:49 -08008128 ret = hdd_check_private_wext_control(hdd_ctx, info);
8129 if (0 != ret)
8130 return ret;
8131
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008132 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008133 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008134 return -EINVAL;
8135 }
8136
8137 /* Debug display of request components. */
8138 switch (pRequest->offloadType) {
8139 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008140 hdd_debug("Host offload request: ARP reply");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008141 switch (pRequest->enableOrDisable) {
8142 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008143 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008144 break;
8145 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008146 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07008147 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008148 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008149 hdd_debug(" ARP offload enable");
8150 hdd_debug(" IP address: %d.%d.%d.%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008151 pRequest->params.hostIpv4Addr[0],
8152 pRequest->params.hostIpv4Addr[1],
8153 pRequest->params.hostIpv4Addr[2],
8154 pRequest->params.hostIpv4Addr[3]);
8155 }
8156 break;
8157
8158 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008159 hdd_debug("Host offload request: neighbor discovery");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008160 switch (pRequest->enableOrDisable) {
8161 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008162 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008163 break;
8164 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008165 hdd_debug(" enable");
8166 hdd_debug(" IP address: %x:%x:%x:%x:%x:%x:%x:%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008167 *(uint16_t *) (pRequest->params.hostIpv6Addr),
8168 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8169 2),
8170 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8171 4),
8172 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8173 6),
8174 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8175 8),
8176 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8177 10),
8178 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8179 12),
8180 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8181 14));
8182 }
8183 }
8184
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05308185 qdf_mem_zero(&offloadRequest, sizeof(offloadRequest));
8186 offloadRequest.offloadType = pRequest->offloadType;
8187 offloadRequest.enableOrDisable = pRequest->enableOrDisable;
8188 qdf_mem_copy(&offloadRequest.params, &pRequest->params,
8189 sizeof(pRequest->params));
8190 qdf_mem_copy(&offloadRequest.bssid, &pRequest->bssId.bytes,
8191 QDF_MAC_ADDR_SIZE);
8192
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308193 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008194 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnson1b780e42017-10-31 14:11:45 -07008195 adapter->session_id, &offloadRequest)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008196 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008197 return -EINVAL;
8198 }
Dustin Browne74003f2018-03-14 12:51:58 -07008199 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008200 return 0;
8201}
8202
8203static int iw_set_host_offload(struct net_device *dev,
8204 struct iw_request_info *info,
8205 union iwreq_data *wrqu, char *extra)
8206{
8207 int ret;
8208
8209 cds_ssr_protect(__func__);
8210 ret = __iw_set_host_offload(dev, info, wrqu, extra);
8211 cds_ssr_unprotect(__func__);
8212
8213 return ret;
8214}
8215
8216/**
8217 * iw_set_keepalive_params - Set keepalive params ioctl handler
8218 * @dev: device upon which the ioctl was received
8219 * @info: ioctl request information
8220 * @wrqu: ioctl request data
8221 * @extra: ioctl extra data
8222 *
8223 * Return: 0 on success, non-zero on error
8224 */
8225static int __iw_set_keepalive_params(struct net_device *dev,
8226 struct iw_request_info *info,
8227 union iwreq_data *wrqu, char *extra)
8228{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008229 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008230 tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008231 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008232 int ret;
8233
Dustin Brownfdf17c12018-03-14 12:55:34 -07008234 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308235
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008236 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008237 ret = wlan_hdd_validate_context(hdd_ctx);
8238 if (0 != ret)
8239 return ret;
8240
Jeff Johnson441e1f72017-02-07 08:50:49 -08008241 ret = hdd_check_private_wext_control(hdd_ctx, info);
8242 if (0 != ret)
8243 return ret;
8244
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008245 if (wrqu->data.length != sizeof(*request)) {
8246 hdd_err("Invalid length %d", wrqu->data.length);
8247 return -EINVAL;
8248 }
8249
Wu Gao93816212018-08-31 16:49:54 +08008250 if (request->timePeriod > cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008251 hdd_err("Value of timePeriod %d exceed Max limit %d",
8252 request->timePeriod,
Wu Gao93816212018-08-31 16:49:54 +08008253 cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008254 return -EINVAL;
8255 }
8256
8257 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008258 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008259 request->timePeriod, sizeof(tSirKeepAliveReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008260
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008261 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008262 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008263 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008264 break;
8265
8266 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008267 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008268
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008269 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008270 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8271 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008272
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008273 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008274 request->destIpv4Addr[0], request->destIpv4Addr[1],
8275 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008276
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008277 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -08008278 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008279 break;
8280 }
8281
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008282 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008283
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308284 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008285 sme_set_keep_alive(hdd_ctx->mac_handle,
8286 adapter->session_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008287 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008288 return -EINVAL;
8289 }
Dustin Browne74003f2018-03-14 12:51:58 -07008290 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008291 return 0;
8292}
8293
8294static int iw_set_keepalive_params(struct net_device *dev,
8295 struct iw_request_info *info,
8296 union iwreq_data *wrqu,
8297 char *extra)
8298{
8299 int ret;
8300
8301 cds_ssr_protect(__func__);
8302 ret = __iw_set_keepalive_params(dev, info, wrqu, extra);
8303 cds_ssr_unprotect(__func__);
8304
8305 return ret;
8306}
8307
8308#ifdef WLAN_FEATURE_PACKET_FILTERING
8309/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308310 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8311 * @priv_data: Pointer to the priv data from user space
8312 * @request: Pointer to the struct containing the copied data from user space
8313 *
8314 * Return: False on invalid length, true otherwise
8315 */
8316static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8317 uint16_t length)
8318{
8319 int max_params_size, rcvd_params_size;
8320
8321 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8322 sizeof(struct pkt_filter_param_cfg);
8323
8324 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8325 hdd_err("Less than minimum number of arguments needed");
8326 return false;
8327 }
8328
8329 rcvd_params_size = request->num_params *
8330 sizeof(struct pkt_filter_param_cfg);
8331
8332 if (length != sizeof(struct pkt_filter_cfg) -
8333 max_params_size + rcvd_params_size) {
8334 hdd_err("Arguments do not match the number of params provided");
8335 return false;
8336 }
8337
8338 return true;
8339}
8340
8341/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008342 * __iw_set_packet_filter_params() - set packet filter parameters in target
8343 * @dev: Pointer to netdev
8344 * @info: Pointer to iw request info
8345 * @wrqu: Pointer to data
8346 * @extra: Pointer to extra data
8347 *
8348 * Return: 0 on success, non-zero on error
8349 */
8350static int __iw_set_packet_filter_params(struct net_device *dev,
8351 struct iw_request_info *info,
8352 union iwreq_data *wrqu, char *extra)
8353{
8354 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008355 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008356 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008357 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008358 struct pkt_filter_cfg *request = NULL;
8359
Mukul Sharma472382f2015-11-02 20:16:31 +05308360 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008361 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308362 return -EPERM;
8363 }
8364
Dustin Brownfdf17c12018-03-14 12:55:34 -07008365 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308366
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008367 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8368 ret = wlan_hdd_validate_context(hdd_ctx);
8369 if (0 != ret)
8370 return ret;
8371
Jeff Johnson441e1f72017-02-07 08:50:49 -08008372 ret = hdd_check_private_wext_control(hdd_ctx, info);
8373 if (0 != ret)
8374 return ret;
8375
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008376 if (hdd_priv_get_data(&priv_data, wrqu)) {
8377 hdd_err("failed to get priv data");
8378 return -EINVAL;
8379 }
8380
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308381 if ((NULL == priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008382 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008383 priv_data.pointer, priv_data.length);
8384 return -EINVAL;
8385 }
8386
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308387 if (adapter->device_mode != QDF_STA_MODE) {
8388 hdd_err("Packet filter not supported for this mode :%d",
8389 adapter->device_mode);
8390 return -ENOTSUPP;
8391 }
8392
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308393 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8394 hdd_err("Packet filter not supported in disconnected state");
8395 return -ENOTSUPP;
8396 }
8397
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008398 /* copy data using copy_from_user */
8399 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
8400 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308401
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008402 if (NULL == request) {
8403 hdd_err("mem_alloc_copy_from_user_helper fail");
8404 return -ENOMEM;
8405 }
8406
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308407 if (!validate_packet_filter_params_size(request, priv_data.length)) {
8408 hdd_err("Invalid priv data length %d", priv_data.length);
8409 qdf_mem_free(request);
8410 return -EINVAL;
8411 }
8412
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05308413 if (request->filter_action == HDD_RCV_FILTER_SET)
8414 hdd_ctx->user_configured_pkt_filter_rules |=
8415 1 << request->filter_id;
8416 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
8417 hdd_ctx->user_configured_pkt_filter_rules &=
8418 ~(1 << request->filter_id);
8419
Jeff Johnson1b780e42017-10-31 14:11:45 -07008420 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008421
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07008422 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07008423 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008424 return ret;
8425}
8426
8427/**
8428 * iw_set_packet_filter_params() - set packet filter parameters in target
8429 * @dev: Pointer to netdev
8430 * @info: Pointer to iw request info
8431 * @wrqu: Pointer to data
8432 * @extra: Pointer to extra data
8433 *
8434 * Return: 0 on success, non-zero on error
8435 */
8436static int iw_set_packet_filter_params(struct net_device *dev,
8437 struct iw_request_info *info,
8438 union iwreq_data *wrqu, char *extra)
8439{
8440 int ret;
8441
8442 cds_ssr_protect(__func__);
8443 ret = __iw_set_packet_filter_params(dev, info, wrqu, extra);
8444 cds_ssr_unprotect(__func__);
8445
8446 return ret;
8447}
8448#endif
8449
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008450#ifdef QCA_SUPPORT_CP_STATS
8451static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
8452{
8453 return wlan_hdd_get_station_stats(adapter);
8454}
8455#else /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008456struct hdd_statistics_priv {
8457 tCsrSummaryStatsInfo summary_stats;
8458 tCsrGlobalClassAStatsInfo class_a_stats;
8459 tCsrGlobalClassDStatsInfo class_d_stats;
8460};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008461
Jeff Johnsond37833f2018-03-07 14:22:44 -08008462/**
8463 * hdd_statistics_cb() - "Get statistics" callback function
Jeff Johnsonced658b2018-03-08 09:54:01 -08008464 * @stats: statistics payload
8465 * @context: opaque context originally passed to SME. HDD always passes
8466 * a cookie for the request context
Jeff Johnsond37833f2018-03-07 14:22:44 -08008467 *
8468 * Return: None
8469 */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008470static void hdd_statistics_cb(void *stats, void *context)
Jeff Johnsond37833f2018-03-07 14:22:44 -08008471{
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008472 struct osif_request *request;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008473 struct hdd_statistics_priv *priv;
8474 tCsrSummaryStatsInfo *summary_stats;
8475 tCsrGlobalClassAStatsInfo *class_a_stats;
8476 tCsrGlobalClassDStatsInfo *class_d_stats;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008477
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008478 request = osif_request_get(context);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008479 if (!request) {
8480 hdd_err("Obsolete request");
8481 return;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008482 }
8483
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008484 priv = osif_request_priv(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008485
8486 summary_stats = (tCsrSummaryStatsInfo *)stats;
8487 priv->summary_stats = *summary_stats;
8488
8489 class_a_stats = (tCsrGlobalClassAStatsInfo *)(summary_stats + 1);
8490 priv->class_a_stats = *class_a_stats;
8491
8492 class_d_stats = (tCsrGlobalClassDStatsInfo *)(class_a_stats + 1);
8493 priv->class_d_stats = *class_d_stats;
8494
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008495 osif_request_complete(request);
8496 osif_request_put(request);
Jeff Johnsond37833f2018-03-07 14:22:44 -08008497}
8498
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008499static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008500{
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008501 int ret = 0;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008502 void *cookie;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008503 QDF_STATUS status;
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008504 struct osif_request *request;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008505 struct hdd_station_ctx *sta_ctx;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008506 struct hdd_statistics_priv *priv;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008507 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008508 static const struct osif_request_params params = {
Jeff Johnsonced658b2018-03-08 09:54:01 -08008509 .priv_size = sizeof(*priv),
8510 .timeout_ms = WLAN_WAIT_TIME_STATS,
8511 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008512
Jeff Johnsonced658b2018-03-08 09:54:01 -08008513 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008514 request = osif_request_alloc(&params);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008515 if (!request) {
8516 hdd_warn("request allocation failed");
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008517 return -EINVAL;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008518 }
8519
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008520 cookie = osif_request_cookie(request);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008521 status = sme_get_statistics(hdd_ctx->mac_handle, eCSR_HDD,
Jeff Johnsonced658b2018-03-08 09:54:01 -08008522 SME_SUMMARY_STATS |
8523 SME_GLOBAL_CLASSA_STATS |
8524 SME_GLOBAL_CLASSD_STATS,
8525 hdd_statistics_cb,
8526 sta_ctx->conn_info.staId[0],
8527 cookie, adapter->session_id);
8528
8529 if (QDF_STATUS_SUCCESS != status) {
8530 hdd_warn("Unable to retrieve SME statistics");
8531 goto put_request;
8532 }
8533
8534 /* request was sent -- wait for the response */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008535 ret = osif_request_wait_for_response(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008536 if (ret) {
8537 hdd_err("Failed to wait for statistics, errno %d", ret);
8538 goto put_request;
8539 }
8540
8541 /* update the adapter cache with the fresh results */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008542 priv = osif_request_priv(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008543 adapter->hdd_stats.summary_stat = priv->summary_stats;
8544 adapter->hdd_stats.class_a_stat = priv->class_a_stats;
8545 adapter->hdd_stats.class_d_stat = priv->class_d_stats;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008546
8547put_request:
8548 /*
8549 * either we never sent a request, we sent a request and
8550 * received a response or we sent a request and timed out.
8551 * regardless we are done with the request.
8552 */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008553 osif_request_put(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008554 return ret;
8555}
8556#endif /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008557
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008558static int __iw_get_statistics(struct net_device *dev,
8559 struct iw_request_info *info,
8560 union iwreq_data *wrqu, char *extra)
8561{
8562 int ret;
8563 char *p;
8564 int tlen;
8565 struct hdd_station_ctx *sta_ctx;
8566 tCsrSummaryStatsInfo *summary_stats;
8567 tCsrGlobalClassAStatsInfo *class_a_stats;
8568 tCsrGlobalClassDStatsInfo *class_d_stats;
8569 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
8570 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8571
8572 hdd_enter_dev(dev);
8573
8574 ret = wlan_hdd_validate_context(hdd_ctx);
8575 if (0 != ret)
8576 return ret;
8577
8578 ret = hdd_check_private_wext_control(hdd_ctx, info);
8579 if (0 != ret)
8580 return ret;
8581
8582 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
8583 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
8584 wrqu->data.length = 0;
8585 return 0;
8586 }
8587
8588 hdd_get_wlan_stats(adapter);
8589
8590 summary_stats = &(adapter->hdd_stats.summary_stat);
8591 class_a_stats = &(adapter->hdd_stats.class_a_stat);
8592 class_d_stats = &(adapter->hdd_stats.class_d_stat);
8593
Jeff Johnsonced658b2018-03-08 09:54:01 -08008594 p = extra;
8595 tlen = 0;
8596
8597 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
8598 sizeof(summary_stats->retry_cnt),
8599 &(summary_stats->retry_cnt[0]), tlen);
8600
8601 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
8602 sizeof(summary_stats->multiple_retry_cnt),
8603 &(summary_stats->multiple_retry_cnt[0]), tlen);
8604
8605 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
8606 sizeof(summary_stats->tx_frm_cnt),
8607 &(summary_stats->tx_frm_cnt[0]), tlen);
8608
8609 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
8610 sizeof(summary_stats->rx_frm_cnt),
8611 &(summary_stats->rx_frm_cnt), tlen);
8612
8613 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
8614 sizeof(summary_stats->frm_dup_cnt),
8615 &(summary_stats->frm_dup_cnt), tlen);
8616
8617 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
8618 sizeof(summary_stats->fail_cnt),
8619 &(summary_stats->fail_cnt[0]), tlen);
8620
8621 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
8622 sizeof(summary_stats->rts_fail_cnt),
8623 &(summary_stats->rts_fail_cnt), tlen);
8624
8625 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
8626 sizeof(summary_stats->ack_fail_cnt),
8627 &(summary_stats->ack_fail_cnt), tlen);
8628
8629 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
8630 sizeof(summary_stats->rts_succ_cnt),
8631 &(summary_stats->rts_succ_cnt), tlen);
8632
8633 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
8634 sizeof(summary_stats->rx_discard_cnt),
8635 &(summary_stats->rx_discard_cnt), tlen);
8636
8637 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
8638 sizeof(summary_stats->rx_error_cnt),
8639 &(summary_stats->rx_error_cnt), tlen);
8640
8641 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
8642 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8643 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8644
8645 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
8646 sizeof(class_d_stats->rx_byte_cnt),
8647 &(class_d_stats->rx_byte_cnt), tlen);
8648
8649 FILL_TLV(p, WLAN_STATS_RX_RATE,
8650 sizeof(class_d_stats->rx_rate),
8651 &(class_d_stats->rx_rate), tlen);
8652
8653 /* Transmit rate, in units of 500 kbit/sec */
8654 FILL_TLV(p, WLAN_STATS_TX_RATE,
8655 sizeof(class_a_stats->tx_rate),
8656 &(class_a_stats->tx_rate), tlen);
8657
8658 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
8659 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
8660 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
8661 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
8662 sizeof(class_d_stats->rx_mc_byte_cnt),
8663 &(class_d_stats->rx_mc_byte_cnt), tlen);
8664 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
8665 sizeof(class_d_stats->rx_bc_byte_cnt),
8666 &(class_d_stats->rx_bc_byte_cnt), tlen);
8667 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
8668 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8669 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8670 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
8671 sizeof(class_d_stats->tx_mc_byte_cnt),
8672 &(class_d_stats->tx_mc_byte_cnt), tlen);
8673 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
8674 sizeof(class_d_stats->tx_bc_byte_cnt),
8675 &(class_d_stats->tx_bc_byte_cnt), tlen);
8676
8677 wrqu->data.length = tlen;
8678
Dustin Browne74003f2018-03-14 12:51:58 -07008679 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008680
8681 return 0;
8682}
8683
8684static int iw_get_statistics(struct net_device *dev,
8685 struct iw_request_info *info,
8686 union iwreq_data *wrqu, char *extra)
8687{
8688 int ret;
8689
8690 cds_ssr_protect(__func__);
8691 ret = __iw_get_statistics(dev, info, wrqu, extra);
8692 cds_ssr_unprotect(__func__);
8693
8694 return ret;
8695}
8696
8697#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008698/*Max Len for PNO notification*/
8699#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05308700static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
8701 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008702{
Abhishek Singh0481d662017-04-11 18:20:11 +05308703 struct vdev_osif_priv *osif_priv;
8704 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008705 union iwreq_data wrqu;
8706 char buf[MAX_PNO_NOTIFY_LEN + 1];
8707
Abhishek Singh0481d662017-04-11 18:20:11 +05308708 wlan_vdev_obj_lock(vdev);
8709 osif_priv = wlan_vdev_get_ospriv(vdev);
8710 wlan_vdev_obj_unlock(vdev);
8711 if (!osif_priv) {
8712 hdd_err("osif_priv is null");
8713 return;
8714 }
8715
8716 wdev = osif_priv->wdev;
8717 if (!wdev) {
8718 hdd_err("wdev is null");
8719 return;
8720 }
8721
8722 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008723
8724 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05308725 qdf_mem_zero(&wrqu, sizeof(wrqu));
8726 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008727
8728 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05308729 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008730
8731 wrqu.data.pointer = buf;
8732 wrqu.data.length = strlen(buf);
8733
8734 /* send the event */
8735
Abhishek Singh0481d662017-04-11 18:20:11 +05308736 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008737}
8738
8739/**
8740 * __iw_set_pno() - Preferred Network Offload ioctl handler
8741 * @dev: device upon which the ioctl was received
8742 * @info: ioctl request information
8743 * @wrqu: ioctl request data
8744 * @extra: ioctl extra data
8745 *
8746 * This function parses a Preferred Network Offload command
8747 * Input is string based and expected to be of the form:
8748 *
8749 * <enable(1) | disable(0)>
8750 * when enabling:
8751 * <number of networks>
8752 * for each network:
8753 * <ssid_len> <ssid> <authentication> <encryption>
8754 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07008755 * <scan_time (seconds)>
8756 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008757 * <suspend mode>
8758 *
8759 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07008760 * 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 -08008761 *
8762 * this translates into:
8763 * -----------------------------
8764 * enable PNO
8765 * 2 networks
8766 * Network 1:
8767 * test - with authentication type 0 and encryption type 0,
8768 * search on 3 channels: 1 6 and 11,
8769 * SSID bcast type is unknown (directed probe will be sent if
8770 * AP not found) and must meet -40dBm RSSI
8771 * Network 2:
8772 * test2 - with authentication type 4 and encryption type 4,
8773 * search on 6 channels 1, 2, 3, 4, 5 and 6
8774 * bcast type is non-bcast (directed probe will be sent)
8775 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008776 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07008777 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008778 */
8779static int __iw_set_pno(struct net_device *dev,
8780 struct iw_request_info *info,
8781 union iwreq_data *wrqu, char *extra)
8782{
Jeff Johnson3d278b02017-08-29 14:17:47 -07008783 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008784 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05308785 uint8_t value;
8786 struct wlan_objmgr_vdev *vdev;
8787 struct wlan_objmgr_psoc *psoc;
8788 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008789 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308790 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05308791 uint8_t i, j, params;
8792 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308793 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008794
8795 /* request is a large struct, so we make it static to avoid
8796 * stack overflow. This API is only invoked via ioctl, so it
8797 * is serialized by the kernel rtnl_lock and hence does not
8798 * need to be reentrant
8799 */
Abhishek Singh0481d662017-04-11 18:20:11 +05308800 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008801
Dustin Brownfdf17c12018-03-14 12:55:34 -07008802 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008803
8804 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8805 ret = wlan_hdd_validate_context(hdd_ctx);
8806 if (ret)
8807 return ret;
8808
Jeff Johnson441e1f72017-02-07 08:50:49 -08008809 ret = hdd_check_private_wext_control(hdd_ctx, info);
8810 if (0 != ret)
8811 return ret;
8812
Dustin Brown07901ec2018-09-07 11:02:41 -07008813 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->pdev,
8814 dev->dev_addr,
8815 WLAN_LEGACY_MAC_ID);
Abhishek Singh0481d662017-04-11 18:20:11 +05308816 if (!vdev) {
8817 hdd_err("vdev object is NULL");
8818 return -EIO;
8819 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008820
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308821 /* making sure argument string ends with '\0' */
8822 len = (wrqu->data.length + 1);
8823 data = qdf_mem_malloc(len);
8824 if (!data) {
8825 hdd_err("fail to allocate memory %zu", len);
8826 return -EINVAL;
8827 }
8828 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308829 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008830
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05308831 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
8832
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308833 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008834 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308835 ret = -EINVAL;
8836 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008837 }
8838
Abhishek Singh0481d662017-04-11 18:20:11 +05308839 if (!value) {
8840 status = ucfg_scan_pno_stop(vdev);
8841 if (QDF_IS_STATUS_ERROR(status)) {
8842 hdd_err("Failed to disabled PNO");
8843 ret = -EINVAL;
8844 } else {
8845 hdd_debug("PNO scan disabled");
8846 }
8847 goto exit;
8848 }
8849
8850 if (ucfg_scan_get_pno_in_progress(vdev)) {
8851 hdd_debug("pno is already in progress");
8852 ret = -EBUSY;
8853 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008854 }
8855
8856 ptr += offset;
8857
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308858 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008859 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308860 ret = -EINVAL;
8861 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008862 }
Abhishek Singh0481d662017-04-11 18:20:11 +05308863 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008864
Abhishek Singh0481d662017-04-11 18:20:11 +05308865 hdd_debug("PNO enable networks count %d offset %d",
8866 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008867
Abhishek Singh0481d662017-04-11 18:20:11 +05308868 if ((0 == req.networks_cnt) ||
8869 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008870 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05308871 req.networks_cnt);
8872 ret = -EINVAL;
8873 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008874 }
8875
8876 ptr += offset;
8877
Abhishek Singh0481d662017-04-11 18:20:11 +05308878 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008879
Abhishek Singh0481d662017-04-11 18:20:11 +05308880 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008881
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308882 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308883 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008884 &offset);
8885
8886 if (1 != params) {
8887 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308888 ret = -EINVAL;
8889 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008890 }
8891
Abhishek Singh0481d662017-04-11 18:20:11 +05308892 if ((0 == req.networks_list[i].ssid.length) ||
8893 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008894 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308895 req.networks_list[i].ssid.length, i);
8896 ret = -EINVAL;
8897 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008898 }
8899
8900 /* Advance to SSID */
8901 ptr += offset;
8902
Abhishek Singh0481d662017-04-11 18:20:11 +05308903 memcpy(req.networks_list[i].ssid.ssid, ptr,
8904 req.networks_list[i].ssid.length);
8905 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008906
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308907 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308908 &(req.networks_list[i].authentication),
8909 &(req.networks_list[i].encryption),
8910 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008911 &offset);
8912
8913 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008914 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308915 ret = -EINVAL;
8916 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008917 }
8918
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008919 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308920 req.networks_list[i].ssid.length,
8921 req.networks_list[i].ssid.length,
8922 req.networks_list[i].ssid.ssid,
8923 req.networks_list[i].authentication,
8924 req.networks_list[i].encryption,
8925 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008926
8927 /* Advance to channel list */
8928 ptr += offset;
8929
Abhishek Singh0481d662017-04-11 18:20:11 +05308930 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
8931 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008932 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05308933 ret = -EINVAL;
8934 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008935 }
8936
Abhishek Singh0481d662017-04-11 18:20:11 +05308937 if (0 != req.networks_list[i].channel_cnt) {
8938 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008939 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308940 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05308941 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008942 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008943 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308944 ret = -EINVAL;
8945 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008946 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308947 if (!IS_CHANNEL_VALID(value)) {
8948 hdd_err("invalid channel: %hhu", value);
8949 ret = -EINVAL;
8950 goto exit;
8951 }
Abhishek Singh0481d662017-04-11 18:20:11 +05308952 req.networks_list[i].channels[j] =
8953 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008954 /* Advance to next channel number */
8955 ptr += offset;
8956 }
8957 }
8958
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308959 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308960 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008961 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008962 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008963 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308964 ret = -EINVAL;
8965 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008966 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308967 if (req.networks_list[i].bc_new_type > 2) {
8968 hdd_err("invalid bcast nw type: %u",
8969 req.networks_list[i].bc_new_type);
8970 ret = -EINVAL;
8971 goto exit;
8972 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008973
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008974 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308975 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008976
8977 /* Advance to rssi Threshold */
8978 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308979 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308980 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008981 &offset)) {
8982 hdd_err("PNO rssi threshold input is not valid %s",
8983 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308984 ret = -EINVAL;
8985 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008986 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008987 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308988 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008989 /* Advance to next network */
8990 ptr += offset;
8991 } /* For ucNetworkCount */
8992
Abhishek Singh0481d662017-04-11 18:20:11 +05308993 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308994 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05308995 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07008996 ptr += offset;
8997 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308998 if (req.fast_scan_period == 0) {
8999 hdd_err("invalid fast scan period %u",
9000 req.fast_scan_period);
9001 ret = -EINVAL;
9002 goto exit;
9003 }
Dustin Brown43e87292016-10-10 10:38:25 -07009004
Abhishek Singh0481d662017-04-11 18:20:11 +05309005 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309006 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07009007 &offset) > 0)
9008 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05309009 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07009010
Dustin Brown07901ec2018-09-07 11:02:41 -07009011 wlan_pdev_obj_lock(hdd_ctx->pdev);
9012 psoc = wlan_pdev_get_psoc(hdd_ctx->pdev);
9013 wlan_pdev_obj_unlock(hdd_ctx->pdev);
Abhishek Singh0481d662017-04-11 18:20:11 +05309014 ucfg_scan_register_pno_cb(psoc,
9015 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009016
Abhishek Singh0481d662017-04-11 18:20:11 +05309017 ucfg_scan_get_pno_def_params(vdev, &req);
9018 status = ucfg_scan_pno_start(vdev, &req);
9019 if (QDF_IS_STATUS_ERROR(status)) {
9020 hdd_err("Failed to enable PNO");
9021 ret = -EINVAL;
9022 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009023
Abhishek Singh0481d662017-04-11 18:20:11 +05309024exit:
9025 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009026
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309027 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05309028 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009029}
9030
9031static int iw_set_pno(struct net_device *dev,
9032 struct iw_request_info *info,
9033 union iwreq_data *wrqu, char *extra)
9034{
9035 int ret;
9036
9037 cds_ssr_protect(__func__);
9038 ret = __iw_set_pno(dev, info, wrqu, extra);
9039 cds_ssr_unprotect(__func__);
9040
9041 return ret;
9042}
9043#endif /* FEATURE_WLAN_SCAN_PNO */
9044
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009045static int __iw_set_band_config(struct net_device *dev,
9046 struct iw_request_info *info,
9047 union iwreq_data *wrqu, char *extra)
9048{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009049 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009050 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08009051 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009052 int *value = (int *)extra;
9053
Dustin Brownfdf17c12018-03-14 12:55:34 -07009054 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009055
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309056 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009057 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309058 return -EPERM;
9059 }
9060
Jeff Johnson441e1f72017-02-07 08:50:49 -08009061 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9062 ret = hdd_check_private_wext_control(hdd_ctx, info);
9063 if (0 != ret)
9064 return ret;
9065
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07009066 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009067}
9068
9069static int iw_set_band_config(struct net_device *dev,
9070 struct iw_request_info *info,
9071 union iwreq_data *wrqu, char *extra)
9072{
9073 int ret;
9074
9075 cds_ssr_protect(__func__);
9076 ret = __iw_set_band_config(dev, info, wrqu, extra);
9077 cds_ssr_unprotect(__func__);
9078
9079 return ret;
9080}
9081
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009082static int printk_adapter(void *priv, const char *fmt, ...)
9083{
9084 int ret;
9085 va_list args;
9086
9087 va_start(args, fmt);
9088 ret = vprintk(fmt, args);
9089 ret += printk("\n");
9090 va_end(args);
9091
9092 return ret;
9093}
9094
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009095static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
9096{
9097 qdf_abstract_print *print = &printk_adapter;
9098
9099 switch (log_id) {
9100 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009101 cds_print_htc_credit_history(count, print, NULL);
9102 break;
9103 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009104 wma_print_wmi_cmd_log(count, print, NULL);
9105 break;
9106 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009107 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
9108 break;
9109 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009110 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
9111 break;
9112 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009113 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
9114 break;
9115 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009116 wma_print_wmi_event_log(count, print, NULL);
9117 break;
9118 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009119 wma_print_wmi_rx_event_log(count, print, NULL);
9120 break;
9121 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009122 wma_print_wmi_mgmt_event_log(count, print, NULL);
9123 break;
9124 default:
9125 print(NULL, "Invalid Log Id %d", log_id);
9126 break;
9127 }
9128}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009129
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009130#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
9131int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
9132{
9133 struct hdd_context *hdd_ctx;
9134 int ret;
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309135 bool crash_inject;
9136 QDF_STATUS status;
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009137
9138 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
9139 v1, v2);
9140 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
9141 v1, v2);
9142 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309143
Vignesh Viswanathana1f3a1a2018-10-04 13:10:46 +05309144 status = ucfg_mlme_get_crash_inject(hdd_ctx->psoc, &crash_inject);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309145 if (QDF_IS_STATUS_ERROR(status)) {
9146 hdd_err("Failed to get crash inject ini config");
9147 return 0;
9148 }
9149
9150 if (!crash_inject) {
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009151 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
9152 return 0;
9153 }
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309154
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009155 if (v1 == 3) {
9156 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
9157 return 0;
9158 }
9159 ret = wma_cli_set2_command(adapter->session_id,
9160 GEN_PARAM_CRASH_INJECT,
9161 v1, v2, GEN_CMD);
9162 return ret;
9163}
9164#endif
9165
Nirav Shahd21a2e32018-04-20 16:34:43 +05309166#ifdef CONFIG_DP_TRACE
9167void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
9168{
9169 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
9170 cmd_type, count);
9171 if (cmd_type == DUMP_DP_TRACE)
9172 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
9173 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
9174 qdf_dp_trace_enable_live_mode();
9175 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
9176 qdf_dp_trace_clear_buffer();
9177 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
9178 qdf_dp_trace_disable_live_mode();
9179}
9180#endif
9181
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009182static int __iw_set_two_ints_getnone(struct net_device *dev,
9183 struct iw_request_info *info,
9184 union iwreq_data *wrqu, char *extra)
9185{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009186 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009187 int *value = (int *)extra;
9188 int sub_cmd = value[0];
9189 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08009190 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009191 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08009192 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009193
Dustin Brownfdf17c12018-03-14 12:55:34 -07009194 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009195
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009196 ret = wlan_hdd_validate_context(hdd_ctx);
9197 if (0 != ret)
9198 return ret;
9199
Jeff Johnson441e1f72017-02-07 08:50:49 -08009200 ret = hdd_check_private_wext_control(hdd_ctx, info);
9201 if (0 != ret)
9202 return ret;
9203
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009204 switch (sub_cmd) {
9205 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009206 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07009207 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009208 WMI_STA_SMPS_PARAM_CMDID,
9209 value[1] << WMA_SMPS_PARAM_VALUE_S
9210 | value[2],
9211 VDEV_CMD);
9212 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009213 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009214 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009215 break;
Govind Singha471e5e2015-10-12 17:11:14 +05309216 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07009217 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309218 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07009219 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309220 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
9221 value[1], value[2], DBG_CMD);
9222 break;
9223 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07009224 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309225 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07009226 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309227 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
9228 value[1], value[2], DBG_CMD);
9229 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009230 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
9231 hdd_debug("Ioctl to set dual fw mode config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08009232 status =
9233 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
9234 &dual_mac_feature);
9235 if (status != QDF_STATUS_SUCCESS)
9236 hdd_err("can't get dual mac feature val, use def");
9237 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009238 hdd_err("Dual mac feature is disabled from INI");
9239 return -EPERM;
9240 }
9241 hdd_debug("%d %d", value[1], value[2]);
Dustin Brown05d81302018-09-11 16:49:22 -07009242 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009243 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009244 break;
9245 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05309246 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009247 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009248 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009249 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009250 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07009251 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08009252 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
9253 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009254 break;
9255 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07009256 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009257 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009258 case WE_LOG_BUFFER: {
9259 int log_id = value[1];
9260 uint32_t count = value[2] < 0 ? 0 : value[2];
9261
9262 hdd_ioctl_log_buffer(log_id, count);
9263
9264 break;
9265 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07009266 case WE_SET_BA_AGEING_TIMEOUT:
9267 {
9268 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
9269
9270 if (!soc) {
9271 hdd_err("Invalid handles");
9272 break;
9273 }
9274 cdp_set_ba_timeout(soc, value[1], value[2]);
9275 break;
9276 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009277 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07009278 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009279 break;
9280 }
9281
9282 return ret;
9283}
9284
9285static int iw_set_two_ints_getnone(struct net_device *dev,
9286 struct iw_request_info *info,
9287 union iwreq_data *wrqu, char *extra)
9288{
9289 int ret;
9290
9291 cds_ssr_protect(__func__);
9292 ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
9293 cds_ssr_unprotect(__func__);
9294
9295 return ret;
9296}
9297
9298/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009299
9300static const iw_handler we_private[] = {
9301
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009302 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9303 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9304 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009305 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9306 iw_set_three_ints_getnone,
9307 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009308 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009309 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9310 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009311 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9312 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309313#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009314 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309315#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009316 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9317 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9318 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009319 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009320 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9321 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9322 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9323 iw_set_keepalive_params,
9324#ifdef WLAN_FEATURE_PACKET_FILTERING
9325 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9326 iw_set_packet_filter_params,
9327#endif
9328#ifdef FEATURE_WLAN_SCAN_PNO
9329 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9330#endif
9331 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009332 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9333 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009334 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
9335 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9336 iw_set_two_ints_getnone,
9337 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9338 iw_set_dot11p_channel_sched,
9339};
9340
9341/*Maximum command length can be only 15 */
9342static const struct iw_priv_args we_private_args[] = {
9343
9344 /* handlers for main ioctl */
9345 {WLAN_PRIV_SET_INT_GET_NONE,
9346 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9347 0,
9348 ""},
9349
9350 /* handlers for sub-ioctl */
9351 {WE_SET_11D_STATE,
9352 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9353 0,
9354 "set11Dstate"},
9355
9356 {WE_WOWL,
9357 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9358 0,
9359 "wowl"},
9360
9361 {WE_SET_POWER,
9362 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9363 0,
9364 "setPower"},
9365
9366 {WE_SET_MAX_ASSOC,
9367 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9368 0,
9369 "setMaxAssoc"},
9370
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009371 {WE_SET_SCAN_DISABLE,
9372 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9373 0,
9374 "scan_disable"},
9375
9376 {WE_SET_DATA_INACTIVITY_TO,
9377 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9378 0,
9379 "inactivityTO"},
9380
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05309381 {WE_SET_WOW_DATA_INACTIVITY_TO,
9382 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9383 0,
9384 "wow_ito"},
9385
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009386 {WE_SET_MAX_TX_POWER,
9387 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9388 0,
9389 "setMaxTxPower"},
9390
9391 {WE_SET_TX_POWER,
9392 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9393 0,
9394 "setTxPower"},
9395
9396 {WE_SET_MC_RATE,
9397 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9398 0,
9399 "setMcRate"},
9400
9401 {WE_SET_MAX_TX_POWER_2_4,
9402 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9403 0,
9404 "setTxMaxPower2G"},
9405
9406 {WE_SET_MAX_TX_POWER_5_0,
9407 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9408 0,
9409 "setTxMaxPower5G"},
9410
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309411#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009412 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05309413 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009414 0,
9415 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309416#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009417
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009418 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
9419 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -08009420 * will support both
9421 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009422 {WE_SET_MAX_TX_POWER,
9423 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9424 0,
9425 "setTxMaxPower"},
9426
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009427 {WE_SET_TM_LEVEL,
9428 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9429 0,
9430 "setTmLevel"},
9431
9432 {WE_SET_PHYMODE,
9433 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9434 0,
9435 "setphymode"},
9436
9437 {WE_SET_NSS,
9438 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9439 0,
9440 "nss"},
9441
9442 {WE_SET_LDPC,
9443 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9444 0,
9445 "ldpc"},
9446
9447 {WE_SET_TX_STBC,
9448 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9449 0,
9450 "tx_stbc"},
9451
9452 {WE_SET_RX_STBC,
9453 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9454 0,
9455 "rx_stbc"},
9456
9457 {WE_SET_SHORT_GI,
9458 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9459 0,
9460 "shortgi"},
9461
9462 {WE_SET_RTSCTS,
9463 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9464 0,
9465 "enablertscts"},
9466
9467 {WE_SET_CHWIDTH,
9468 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9469 0,
9470 "chwidth"},
9471
9472 {WE_SET_ANI_EN_DIS,
9473 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9474 0,
9475 "anienable"},
9476
9477 {WE_SET_ANI_POLL_PERIOD,
9478 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9479 0,
9480 "aniplen"},
9481
9482 {WE_SET_ANI_LISTEN_PERIOD,
9483 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9484 0,
9485 "anilislen"},
9486
9487 {WE_SET_ANI_OFDM_LEVEL,
9488 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9489 0,
9490 "aniofdmlvl"},
9491
9492 {WE_SET_ANI_CCK_LEVEL,
9493 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9494 0,
9495 "aniccklvl"},
9496
9497 {WE_SET_DYNAMIC_BW,
9498 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9499 0,
9500 "cwmenable"},
9501
9502 {WE_SET_CTS_CBW,
9503 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9504 0,
9505 "cts_cbw" },
9506
9507 {WE_SET_GTX_HT_MCS,
9508 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9509 0,
9510 "gtxHTMcs"},
9511
9512 {WE_SET_GTX_VHT_MCS,
9513 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9514 0,
9515 "gtxVHTMcs"},
9516
9517 {WE_SET_GTX_USRCFG,
9518 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9519 0,
9520 "gtxUsrCfg"},
9521
9522 {WE_SET_GTX_THRE,
9523 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9524 0,
9525 "gtxThre"},
9526
9527 {WE_SET_GTX_MARGIN,
9528 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9529 0,
9530 "gtxMargin"},
9531
9532 {WE_SET_GTX_STEP,
9533 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9534 0,
9535 "gtxStep"},
9536
9537 {WE_SET_GTX_MINTPC,
9538 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9539 0,
9540 "gtxMinTpc"},
9541
9542 {WE_SET_GTX_BWMASK,
9543 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9544 0,
9545 "gtxBWMask"},
9546
9547 {WE_SET_TX_CHAINMASK,
9548 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9549 0,
9550 "txchainmask"},
9551
9552 {WE_SET_RX_CHAINMASK,
9553 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9554 0,
9555 "rxchainmask"},
9556
9557 {WE_SET_11N_RATE,
9558 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9559 0,
9560 "set11NRates"},
9561
9562 {WE_SET_VHT_RATE,
9563 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9564 0,
9565 "set11ACRates"},
9566
9567 {WE_SET_AMPDU,
9568 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9569 0,
9570 "ampdu"},
9571
9572 {WE_SET_AMSDU,
9573 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9574 0,
9575 "amsdu"},
9576
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009577 {WE_SET_TXPOW_2G,
9578 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9579 0,
9580 "txpow2g"},
9581
9582 {WE_SET_TXPOW_5G,
9583 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9584 0,
9585 "txpow5g"},
9586
Wen Gong99768902018-04-25 12:07:49 +08009587#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009588 /* Sub-cmds DBGLOG specific commands */
9589 {WE_DBGLOG_LOG_LEVEL,
9590 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9591 0,
9592 "dl_loglevel"},
9593
9594 {WE_DBGLOG_VAP_ENABLE,
9595 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9596 0,
9597 "dl_vapon"},
9598
9599 {WE_DBGLOG_VAP_DISABLE,
9600 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9601 0,
9602 "dl_vapoff"},
9603
9604 {WE_DBGLOG_MODULE_ENABLE,
9605 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9606 0,
9607 "dl_modon"},
9608
9609 {WE_DBGLOG_MODULE_DISABLE,
9610 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9611 0,
9612 "dl_modoff"},
9613
9614 {WE_DBGLOG_MOD_LOG_LEVEL,
9615 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9616 0,
9617 "dl_mod_loglevel"},
9618
9619 {WE_DBGLOG_TYPE,
9620 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9621 0,
9622 "dl_type"},
9623 {WE_DBGLOG_REPORT_ENABLE,
9624 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9625 0,
9626 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +08009627#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009628
9629 {WE_SET_TXRX_FWSTATS,
9630 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9631 0,
9632 "txrx_fw_stats"},
9633
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009634 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +08009635 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009636 0,
9637 "txrx_stats"},
9638
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009639 {WE_TXRX_FWSTATS_RESET,
9640 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9641 0,
9642 "txrx_fw_st_rst"},
9643
9644 {WE_PPS_PAID_MATCH,
9645 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9646 0, "paid_match"},
9647
9648 {WE_PPS_GID_MATCH,
9649 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9650 0, "gid_match"},
9651
9652 {WE_PPS_EARLY_TIM_CLEAR,
9653 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9654 0, "tim_clear"},
9655
9656 {WE_PPS_EARLY_DTIM_CLEAR,
9657 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9658 0, "dtim_clear"},
9659
9660 {WE_PPS_EOF_PAD_DELIM,
9661 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9662 0, "eof_delim"},
9663
9664 {WE_PPS_MACADDR_MISMATCH,
9665 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9666 0, "mac_match"},
9667
9668 {WE_PPS_DELIM_CRC_FAIL,
9669 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9670 0, "delim_fail"},
9671
9672 {WE_PPS_GID_NSTS_ZERO,
9673 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9674 0, "nsts_zero"},
9675
9676 {WE_PPS_RSSI_CHECK,
9677 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9678 0, "rssi_chk"},
9679
9680 {WE_PPS_5G_EBT,
9681 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9682 0, "5g_ebt"},
9683
9684 {WE_SET_HTSMPS,
9685 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9686 0, "htsmps"},
9687
9688 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
9689 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9690 0, "set_qpspollcnt"},
9691
9692 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
9693 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9694 0, "set_qtxwake"},
9695
9696 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
9697 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9698 0, "set_qwakeintv"},
9699
9700 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
9701 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9702 0, "set_qnodatapoll"},
9703
9704 /* handlers for MCC time quota and latency sub ioctls */
9705 {WE_MCC_CONFIG_LATENCY,
9706 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9707 0, "setMccLatency"},
9708
9709 {WE_MCC_CONFIG_QUOTA,
9710 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9711 0, "setMccQuota"},
9712
9713 {WE_SET_DEBUG_LOG,
9714 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9715 0, "setDbgLvl"},
9716
9717 /* handlers for early_rx power save */
9718 {WE_SET_EARLY_RX_ADJUST_ENABLE,
9719 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9720 0, "erx_enable"},
9721
9722 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
9723 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9724 0, "erx_bmiss_val"},
9725
9726 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
9727 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9728 0, "erx_bmiss_smpl"},
9729
9730 {WE_SET_EARLY_RX_SLOP_STEP,
9731 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9732 0, "erx_slop_step"},
9733
9734 {WE_SET_EARLY_RX_INIT_SLOP,
9735 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9736 0, "erx_init_slop"},
9737
9738 {WE_SET_EARLY_RX_ADJUST_PAUSE,
9739 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9740 0, "erx_adj_pause"},
9741
9742 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
9743 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9744 0, "erx_dri_sample"},
9745
9746 {WE_DUMP_STATS,
9747 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9748 0, "dumpStats"},
9749
9750 {WE_CLEAR_STATS,
9751 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9752 0, "clearStats"},
9753
Govind Singha471e5e2015-10-12 17:11:14 +05309754 {WE_START_FW_PROFILE,
9755 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9756 0, "startProfile"},
9757
Abhishek Singh1bdb1572015-10-16 16:24:19 +05309758 {WE_SET_CHANNEL,
9759 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9760 0, "setChanChange" },
9761
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05309762 {WE_SET_CONC_SYSTEM_PREF,
9763 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9764 0, "setConcSysPref" },
9765
Jeff Johnson011c4502017-10-05 15:25:56 -07009766 {WE_SET_PDEV_RESET,
9767 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9768 0, "pdev_reset" },
9769
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05309770 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -08009771 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9772 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05309773
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009774 {WLAN_PRIV_SET_NONE_GET_INT,
9775 0,
9776 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9777 ""},
9778
9779 /* handlers for sub-ioctl */
9780 {WE_GET_11D_STATE,
9781 0,
9782 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9783 "get11Dstate"},
9784
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009785 {WE_GET_WLAN_DBG,
9786 0,
9787 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9788 "getwlandbg"},
9789
9790 {WE_GET_MAX_ASSOC,
9791 0,
9792 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9793 "getMaxAssoc"},
9794
9795 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
9796 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9797 "getAutoChannel" },
9798
9799 {WE_GET_CONCURRENCY_MODE,
9800 0,
9801 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9802 "getconcurrency"},
9803
9804 {WE_GET_NSS,
9805 0,
9806 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9807 "get_nss"},
9808
9809 {WE_GET_LDPC,
9810 0,
9811 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9812 "get_ldpc"},
9813
9814 {WE_GET_TX_STBC,
9815 0,
9816 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9817 "get_tx_stbc"},
9818
9819 {WE_GET_RX_STBC,
9820 0,
9821 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9822 "get_rx_stbc"},
9823
9824 {WE_GET_SHORT_GI,
9825 0,
9826 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9827 "get_shortgi"},
9828
9829 {WE_GET_RTSCTS,
9830 0,
9831 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9832 "get_rtscts"},
9833
9834 {WE_GET_CHWIDTH,
9835 0,
9836 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9837 "get_chwidth"},
9838
9839 {WE_GET_ANI_EN_DIS,
9840 0,
9841 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9842 "get_anienable"},
9843
9844 {WE_GET_ANI_POLL_PERIOD,
9845 0,
9846 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9847 "get_aniplen"},
9848
9849 {WE_GET_ANI_LISTEN_PERIOD,
9850 0,
9851 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9852 "get_anilislen"},
9853
9854 {WE_GET_ANI_OFDM_LEVEL,
9855 0,
9856 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9857 "get_aniofdmlvl"},
9858
9859 {WE_GET_ANI_CCK_LEVEL,
9860 0,
9861 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9862 "get_aniccklvl"},
9863
9864 {WE_GET_DYNAMIC_BW,
9865 0,
9866 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9867 "get_cwmenable"},
9868
9869 {WE_GET_GTX_HT_MCS,
9870 0,
9871 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9872 "get_gtxHTMcs"},
9873
9874 {WE_GET_GTX_VHT_MCS,
9875 0,
9876 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9877 "get_gtxVHTMcs"},
9878
9879 {WE_GET_GTX_USRCFG,
9880 0,
9881 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9882 "get_gtxUsrCfg"},
9883
9884 {WE_GET_GTX_THRE,
9885 0,
9886 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9887 "get_gtxThre"},
9888
9889 {WE_GET_GTX_MARGIN,
9890 0,
9891 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9892 "get_gtxMargin"},
9893
9894 {WE_GET_GTX_STEP,
9895 0,
9896 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9897 "get_gtxStep"},
9898
9899 {WE_GET_GTX_MINTPC,
9900 0,
9901 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9902 "get_gtxMinTpc"},
9903
9904 {WE_GET_GTX_BWMASK,
9905 0,
9906 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9907 "get_gtxBWMask"},
9908
9909 {WE_GET_TX_CHAINMASK,
9910 0,
9911 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9912 "get_txchainmask"},
9913
9914 {WE_GET_RX_CHAINMASK,
9915 0,
9916 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9917 "get_rxchainmask"},
9918
9919 {WE_GET_11N_RATE,
9920 0,
9921 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9922 "get_11nrate"},
9923
9924 {WE_GET_AMPDU,
9925 0,
9926 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9927 "get_ampdu"},
9928
9929 {WE_GET_AMSDU,
9930 0,
9931 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9932 "get_amsdu"},
9933
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009934 {WE_GET_TXPOW_2G,
9935 0,
9936 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9937 "get_txpow2g"},
9938
9939 {WE_GET_TXPOW_5G,
9940 0,
9941 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9942 "get_txpow5g"},
9943
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009944 {WE_GET_PPS_PAID_MATCH,
9945 0,
9946 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9947 "get_paid_match"},
9948
9949 {WE_GET_PPS_GID_MATCH,
9950 0,
9951 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9952 "get_gid_match"},
9953
9954 {WE_GET_PPS_EARLY_TIM_CLEAR,
9955 0,
9956 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9957 "get_tim_clear"},
9958
9959 {WE_GET_PPS_EARLY_DTIM_CLEAR,
9960 0,
9961 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9962 "get_dtim_clear"},
9963
9964 {WE_GET_PPS_EOF_PAD_DELIM,
9965 0,
9966 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9967 "get_eof_delim"},
9968
9969 {WE_GET_PPS_MACADDR_MISMATCH,
9970 0,
9971 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9972 "get_mac_match"},
9973
9974 {WE_GET_PPS_DELIM_CRC_FAIL,
9975 0,
9976 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9977 "get_delim_fail"},
9978
9979 {WE_GET_PPS_GID_NSTS_ZERO,
9980 0,
9981 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9982 "get_nsts_zero"},
9983
9984 {WE_GET_PPS_RSSI_CHECK,
9985 0,
9986 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9987 "get_rssi_chk"},
9988
9989 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
9990 0,
9991 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9992 "get_qpspollcnt"},
9993
9994 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
9995 0,
9996 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9997 "get_qtxwake"},
9998
9999 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10000 0,
10001 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10002 "get_qwakeintv"},
10003
10004 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10005 0,
10006 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10007 "get_qnodatapoll"},
10008
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010009 {WE_CAP_TSF,
10010 0,
10011 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10012 "cap_tsf"},
10013
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010014 {WE_GET_TEMPERATURE,
10015 0,
10016 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10017 "get_temp"},
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010018 {WE_GET_DCM,
10019 0,
10020 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10021 "get_dcm"},
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010022 {WE_GET_RANGE_EXT,
10023 0,
10024 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10025 "get_range_ext"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010026 /* handlers for main ioctl */
10027 {WLAN_PRIV_SET_CHAR_GET_NONE,
10028 IW_PRIV_TYPE_CHAR | 512,
10029 0,
10030 ""},
10031
10032 /* handlers for sub-ioctl */
10033 {WE_WOWL_ADD_PTRN,
10034 IW_PRIV_TYPE_CHAR | 512,
10035 0,
10036 "wowlAddPtrn"},
10037
10038 {WE_WOWL_DEL_PTRN,
10039 IW_PRIV_TYPE_CHAR | 512,
10040 0,
10041 "wowlDelPtrn"},
10042
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010043 /* handlers for sub-ioctl */
10044 {WE_NEIGHBOR_REPORT_REQUEST,
10045 IW_PRIV_TYPE_CHAR | 512,
10046 0,
10047 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080010048
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010049 {WE_SET_AP_WPS_IE,
10050 IW_PRIV_TYPE_CHAR | 512,
10051 0,
10052 "set_ap_wps_ie"},
10053
10054 {WE_SET_CONFIG,
10055 IW_PRIV_TYPE_CHAR | 512,
10056 0,
10057 "setConfig"},
10058
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070010059#ifdef WLAN_UNIT_TEST
10060 {WE_UNIT_TEST,
10061 IW_PRIV_TYPE_CHAR | 512,
10062 0,
10063 "unit_test"},
10064#endif
10065
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010066 /* handlers for main ioctl */
10067 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
10068 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10069 0,
10070 ""},
10071
10072 /* handlers for sub-ioctl */
10073 {WE_SET_WLAN_DBG,
10074 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10075 0,
10076 "setwlandbg"},
10077
Nirav Shahd21a2e32018-04-20 16:34:43 +053010078#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010079 /* handlers for sub-ioctl */
10080 {WE_SET_DP_TRACE,
10081 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10082 0,
10083 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010084#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010085
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053010086 {WE_SET_FW_TEST,
10087 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10088 0, "fw_test"},
10089
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010090 /* handlers for main ioctl */
10091 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
10092 0,
10093 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10094 "" },
10095 {WE_GET_TSF,
10096 0,
10097 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10098 "get_tsf" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010099
10100 {WE_SET_DUAL_MAC_SCAN_CONFIG,
10101 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10102 0,
10103 "set_scan_cfg"},
10104
10105 /* handlers for main ioctl */
10106 {WLAN_PRIV_GET_CHAR_SET_NONE,
10107 0,
10108 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10109 ""},
10110
10111 /* handlers for sub-ioctl */
10112 {WE_WLAN_VERSION,
10113 0,
10114 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10115 "version"},
10116 {WE_GET_STATS,
10117 0,
10118 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10119 "getStats"},
Dustin Brownd9322482017-01-09 12:46:03 -080010120 {WE_GET_SUSPEND_RESUME_STATS,
10121 0,
10122 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10123 "getSuspendStats"},
Govind Singha471e5e2015-10-12 17:11:14 +053010124 {WE_LIST_FW_PROFILE,
10125 0,
10126 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10127 "listProfile"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010128 {WE_GET_STATES,
10129 0,
10130 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10131 "getHostStates"},
10132 {WE_GET_CFG,
10133 0,
10134 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10135 "getConfig"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010136 {WE_GET_RSSI,
10137 0,
10138 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10139 "getRSSI"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010140 {WE_GET_WMM_STATUS,
10141 0,
10142 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10143 "getWmmStatus"},
10144 {
10145 WE_GET_CHANNEL_LIST,
10146 0,
10147 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10148 "getChannelList"
10149 },
10150#ifdef FEATURE_WLAN_TDLS
10151 {
10152 WE_GET_TDLS_PEERS,
10153 0,
10154 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10155 "getTdlsPeers"
10156 },
10157#endif
10158#ifdef WLAN_FEATURE_11W
10159 {
10160 WE_GET_11W_INFO,
10161 0,
10162 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10163 "getPMFInfo"
10164 },
10165#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010166 {
Krunal Soni5e483782018-10-25 15:42:44 -070010167 WE_GET_STA_CXN_INFO,
10168 0,
10169 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10170 "get_cxn_info"
10171 },
10172
10173 {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010174 WE_GET_IBSS_STA_INFO,
10175 0,
10176 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10177 "getIbssSTAs"
10178 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010179 {WE_GET_PHYMODE,
10180 0,
10181 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10182 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010183#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010184 {WE_GET_OEM_DATA_CAP,
10185 0,
10186 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10187 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010188#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010189 {WE_GET_SNR,
10190 0,
10191 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10192 "getSNR"},
10193
Krunal Soni6c3859f2018-06-01 19:57:40 -070010194 {WE_GET_BA_AGEING_TIMEOUT,
10195 0,
10196 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10197 "get_ba_timeout"},
10198
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010199 /* handlers for main ioctl */
10200 {WLAN_PRIV_SET_NONE_GET_NONE,
10201 0,
10202 0,
10203 ""},
10204
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010205 /* handlers for sub-ioctl */
10206 {
10207 WE_IBSS_GET_PEER_INFO_ALL,
10208 0,
10209 0,
10210 "ibssPeerInfoAll"
10211 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010212 {WE_GET_RECOVERY_STAT,
10213 0,
10214 0,
10215 "getRecoverStat"},
Govind Singha471e5e2015-10-12 17:11:14 +053010216
10217 {WE_GET_FW_PROFILE_DATA,
10218 0,
10219 0,
10220 "getProfileData"},
10221
10222 {WE_SET_REASSOC_TRIGGER,
10223 0,
10224 0,
10225 "reassoc"},
10226
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010227 {WE_STOP_OBSS_SCAN,
10228 0,
10229 0,
10230 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010231 /* handlers for main ioctl */
10232 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
10233 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10234 0,
10235 ""},
10236
10237 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010238 {WE_IBSS_GET_PEER_INFO,
10239 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10240 0,
10241 "ibssPeerInfo"},
10242
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010243#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010244 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010245 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
10246 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10247 0,
10248 "setdumplog"},
10249
10250 {WE_MTRACE_DUMP_CMD,
10251 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10252 0,
10253 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010254#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -080010255
10256 {WE_POLICY_MANAGER_CINFO_CMD,
10257 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10258 0,
10259 "pm_cinfo"},
10260
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010261#ifdef MPC_UT_FRAMEWORK
10262 {WE_POLICY_MANAGER_CLIST_CMD,
10263 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10264 0,
10265 "pm_clist"},
10266
10267 {WE_POLICY_MANAGER_DLIST_CMD,
10268 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10269 0,
10270 "pm_dlist"},
10271
10272 {WE_POLICY_MANAGER_DBS_CMD,
10273 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10274 0,
10275 "pm_dbs"},
10276
10277 {WE_POLICY_MANAGER_PCL_CMD,
10278 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10279 0,
10280 "pm_pcl"},
10281
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010282 {WE_POLICY_MANAGER_ULIST_CMD,
10283 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10284 0,
10285 "pm_ulist"},
10286
10287 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
10288 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10289 0,
10290 "pm_query_action"},
10291
10292 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
10293 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10294 0,
10295 "pm_query_allow"},
10296
10297 {WE_POLICY_MANAGER_SCENARIO_CMD,
10298 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10299 0,
10300 "pm_run_scenario"},
10301
10302 {WE_POLICY_SET_HW_MODE_CMD,
10303 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10304 0,
10305 "pm_set_hw_mode"},
10306#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010307 {
10308 WE_UNIT_TEST_CMD,
10309 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10310 0,
10311 "setUnitTestCmd"
10312 },
Manjeet Singhf82ed072016-07-08 11:40:00 +053010313 {
10314 WE_MAC_PWR_DEBUG_CMD,
10315 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10316 0,
10317 "halPwrDebug"
10318 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010319
10320#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10321 {WE_LED_FLASHING_PARAM,
10322 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10323 0,
10324 "gpio_control"},
10325#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010326#ifdef WLAN_DEBUG
10327 {WE_SET_CHAN_AVOID,
10328 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10329 0,
10330 "ch_avoid"},
10331#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010332 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010333 {WLAN_PRIV_FIPS_TEST,
10334 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10335 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10336 "fips_test"},
10337
10338 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010339 {WLAN_PRIV_ADD_TSPEC,
10340 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10341 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10342 "addTspec"},
10343
10344 /* handlers for main ioctl */
10345 {WLAN_PRIV_DEL_TSPEC,
10346 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10347 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10348 "delTspec"},
10349
10350 /* handlers for main ioctl */
10351 {WLAN_PRIV_GET_TSPEC,
10352 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10353 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10354 "getTspec"},
10355
10356 /* handlers for main ioctl - host offload */
10357 {
10358 WLAN_PRIV_SET_HOST_OFFLOAD,
Srinivas Girigowda077143e2017-03-25 10:47:27 -070010359 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010360 0,
10361 "setHostOffload"
10362 }
10363 ,
10364
10365 {
10366 WLAN_GET_WLAN_STATISTICS,
10367 0,
10368 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10369 "getWlanStats"
10370 }
10371 ,
10372
10373 {
10374 WLAN_SET_KEEPALIVE_PARAMS,
Mahesh A Saptasagar72d2e4b2016-04-20 12:44:17 +053010375 IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) |
10376 IW_PRIV_SIZE_FIXED,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010377 0,
10378 "setKeepAlive"
10379 }
10380 ,
10381#ifdef WLAN_FEATURE_PACKET_FILTERING
10382 {
10383 WLAN_SET_PACKET_FILTER_PARAMS,
Hanumanth Reddy Pothulab3ef4162016-10-25 15:13:26 +053010384 IW_PRIV_TYPE_BYTE |
10385 sizeof(struct pkt_filter_cfg),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010386 0,
10387 "setPktFilter"
10388 }
10389 ,
10390#endif
10391#ifdef FEATURE_WLAN_SCAN_PNO
10392 {
10393 WLAN_SET_PNO,
10394 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10395 0,
10396 "setpno"
10397 }
10398 ,
10399#endif
10400 {
10401 WLAN_SET_BAND_CONFIG,
10402 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10403 0,
10404 "SETBAND"
10405 }
10406 ,
10407 {
Dustin Brown0cbc7572016-12-16 13:54:40 -080010408 WLAN_PRIV_SET_MCBC_FILTER,
Dustin Brown860566f2017-01-31 15:24:43 -080010409 0,
Dustin Brown0cbc7572016-12-16 13:54:40 -080010410 0,
10411 "setMCBCFilter"
10412 }
10413 ,
Dustin Brown0cbc7572016-12-16 13:54:40 -080010414
10415 {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010416 WLAN_GET_LINK_SPEED,
10417 IW_PRIV_TYPE_CHAR | 18,
10418 IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed"
10419 }
10420 ,
10421
10422 /* handlers for main ioctl */
10423 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
10424 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10425 0,
10426 ""}
10427 ,
10428 {WE_SET_SMPS_PARAM,
10429 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10430 0, "set_smps_param"}
10431 ,
10432 {WLAN_SET_DOT11P_CHANNEL_SCHED,
10433 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
10434 0, "set_dot11p" }
10435 ,
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010436#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010437 {WE_SET_FW_CRASH_INJECT,
10438 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10439 0, "crash_inject"}
10440 ,
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010441#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053010442#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070010443 {WE_LOG_BUFFER,
10444 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10445 0, "log_buffer"}
10446 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010447#endif
Krunal Soni6c3859f2018-06-01 19:57:40 -070010448 {WE_SET_BA_AGEING_TIMEOUT,
10449 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10450 0, "set_ba_timeout"}
10451 ,
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010452#ifdef WLAN_SUSPEND_RESUME_TEST
10453 {WE_SET_WLAN_SUSPEND,
10454 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10455 0, "wlan_suspend"}
10456 ,
10457 {WE_SET_WLAN_RESUME,
10458 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10459 0, "wlan_resume"}
10460 ,
10461#endif
Govind Singha471e5e2015-10-12 17:11:14 +053010462 {WE_ENABLE_FW_PROFILE,
10463 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10464 0, "enableProfile"}
10465 ,
10466 {WE_SET_FW_PROFILE_HIST_INTVL,
10467 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10468 0, "set_hist_intvl"}
10469 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010470 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
10471 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10472 0, "set_fw_mode_cfg"}
10473 ,
Nirav Shahd21a2e32018-04-20 16:34:43 +053010474#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010475 {WE_DUMP_DP_TRACE_LEVEL,
10476 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10477 0, "dump_dp_trace"}
10478 ,
Nirav Shahd21a2e32018-04-20 16:34:43 +053010479#endif
Nirav Shah73713f72018-05-17 14:50:41 +053010480#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070010481 {WE_SET_MON_MODE_CHAN,
10482 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10483 0, "setMonChan"}
10484 ,
Nirav Shah73713f72018-05-17 14:50:41 +053010485#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070010486 {WE_GET_ROAM_SYNCH_DELAY,
10487 0,
10488 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10489 "hostroamdelay"}
10490 ,
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080010491 {WE_SET_11AX_RATE,
10492 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10493 0,
10494 "set_11ax_rate"}
10495 ,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010496 {WE_SET_DCM,
10497 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10498 0,
10499 "enable_dcm"}
10500 ,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010501 {WE_SET_RANGE_EXT,
10502 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10503 0,
Naveen Rawat53448ea2017-11-27 11:43:18 -080010504 "range_ext"}
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010505 ,
Naveen Rawatc921c7b2017-06-13 17:29:51 -070010506
10507 {WLAN_PRIV_SET_FTIES,
10508 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
10509 0,
10510 "set_ft_ies"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010511};
10512
10513const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010514 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053010515 .num_private = QDF_ARRAY_SIZE(we_private),
10516 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010517
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010518 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010519 .private = (iw_handler *) we_private,
10520 .private_args = we_private_args,
10521 .get_wireless_stats = NULL,
10522};
10523
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010524void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010525{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010526 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010527
Dustin Browne7e71d32018-05-11 16:00:08 -070010528 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010529
Dustin Browne74003f2018-03-14 12:51:58 -070010530 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010531}
10532
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010533void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010534{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010535 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010536
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010537 rtnl_lock();
10538 dev->wireless_handlers = NULL;
10539 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010540
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010541 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010542}