blob: 8216ce621248a6770964728ffa380a5b5f629a40 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05302 * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019/**
20 * DOC: wlan_hdd_wext.c
21 *
22 * Linux Wireless Extensions Implementation
23 */
24
25#include <linux/version.h>
26#include <linux/module.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29#include <linux/wireless.h>
30#include <mac_trace.h>
31#include <wlan_hdd_includes.h>
32#include <cds_api.h>
Rajeev Kumarea95edd2017-01-11 20:49:36 -080033#include "scheduler_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080034#include <net/arp.h>
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080035#include <cdp_txrx_cmn.h>
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070036#include <cdp_txrx_stats.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080037#include "sir_params.h"
38#include "csr_api.h"
39#include "csr_inside_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080040#include "sme_rrm_internal.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080041#include <ani_global.h>
42#include "dot11f.h"
43#include <wlan_hdd_wowl.h>
44#include <wlan_hdd_cfg.h>
45#include <wlan_hdd_wmm.h>
46#include "utils_api.h"
47#include "wlan_hdd_p2p.h"
48#ifdef FEATURE_WLAN_TDLS
49#include "wlan_hdd_tdls.h"
50#endif
51
52#include "cds_ieee80211_common.h"
53#include "ol_if_athvar.h"
54#include "dbglog_host.h"
55#include "wma.h"
56
57#include "wlan_hdd_power.h"
58#include "qwlan_version.h"
59#include "wlan_hdd_host_offload.h"
60
61#include <linux/wireless.h>
62#include <net/cfg80211.h>
63
64#include "wlan_hdd_misc.h"
65
66#include "qc_sap_ioctl.h"
67#include "sme_api.h"
68#include "wma_types.h"
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070069#include "qdf_str.h"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053070#include "qdf_trace.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080071#include "wlan_hdd_assoc.h"
72#include "wlan_hdd_ioctl.h"
73#include "wlan_hdd_scan.h"
74#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080075#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080076#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070077#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070078#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079#include "wlan_hdd_ocb.h"
80#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080081#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070082#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053083#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070084#ifdef WLAN_SUSPEND_RESUME_TEST
85#include "wlan_hdd_driver_ops.h"
86#include "hif.h"
Rajeev Kumar9bb2e852016-09-24 12:29:25 -070087#include "pld_common.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070088#endif
Dhanashri Atree7d442a2016-07-14 18:20:29 -070089#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053090#include "cds_utils.h"
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -070091#include "wlan_osif_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080092#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080093#include <cdp_txrx_stats.h>
94#include <cds_api.h>
Dustin Brown6099ddc2018-07-06 14:32:53 -070095#include "wlan_dsc_test.h"
Abhishek Singh0481d662017-04-11 18:20:11 +053096#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070097#include "wlan_hdd_regulatory.h"
98#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +053099#include "wlan_hdd_packet_filter_api.h"
Naveen Rawat3ff5cff2018-01-29 14:31:16 -0800100#include "wlan_cp_stats_mc_ucfg_api.h"
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +0530101#include "wlan_mlme_ucfg_api.h"
Wu Gao93816212018-08-31 16:49:54 +0800102#include "cfg_mlme_sta.h"
Arif Hussain43e09712018-09-18 19:31:57 -0700103#include "wlan_mlme_public_struct.h"
Wu Gao93816212018-08-31 16:49:54 +0800104#include "cfg_ucfg_api.h"
Krunal Sonie71838d2018-09-27 10:45:05 -0700105#include "wlan_policy_mgr_ucfg.h"
Harprit Chhabadabec6de42018-09-10 10:21:15 -0700106#include "wlan_mlme_public_struct.h"
107#include "cfg_ucfg_api.h"
108#include "cfg_mlme_threshold.h"
Wu Gao66454f12018-09-26 19:55:41 +0800109#include "wlan_pmo_cfg.h"
110#include "wlan_pmo_ucfg_api.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530111
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800112/* Private ioctls and their sub-ioctls */
113#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
114#define WE_SET_11D_STATE 1
115#define WE_WOWL 2
116#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530117/*
118 * <ioctl>
119 * setMaxAssoc - Sets the maximum number of associated stations
120 *
121 * @INPUT: 1 to 32
122 *
123 * @OUTPUT: None
124 *
125 * This IOTCL sets the maximum number of associated stations
126 *
127 * @E.g: iwpriv wlan0 setMaxAssoc <value>
128 *
129 * Supported Feature: STA
130 *
131 * Usage: Internal/External
132 *
133 * </ioctl>
134 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800135#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530136/*
137 * <ioctl>
Jeff Johnsonf2cf6592018-05-06 16:27:44 -0700138 * scan_disable - Disable scan
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530139 *
140 * @INPUT: set_value
141 *
142 * @OUTPUT: None
143 *
144 * This IOCTL is used to set disable scan
145 *
146 * @E.g: iwpriv wlan0 scan_disable 1
147 *
148 * Supported Feature: Scan
149 *
150 * Usage: Internal/External
151 *
152 * </ioctl>
153 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800154#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530155/*
156 * <ioctl>
157 * inactivityTO - sets the timeout value for inactivity data while
158 * in power save mode
159 *
160 * @INPUT: int1…..int255
161 *
162 * @OUTPUT: None
163 *
164 * This IOCTL set the timeout value for inactivity data in power save mode
165 *
166 * @E.g: iwpriv wlan0 inactivityTO 20
167 *
168 * Supported Feature: STA
169 *
170 * Usage: Internal/External
171 *
172 * </ioctl>
173 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800174#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530175/*
176 * <ioctl>
177 * setMaxTxPower - Dynamically sets the maximum transmission power
178 *
179 * @INPUT: Transmission power in dBm
180 *
181 * @OUTPUT: None
182 *
183 * This IOCTL dynamically sets the maximum transmission power
184 * This setting does not persist over reboots
185 *
186 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
187 *
188 * Supported Feature: STA
189 *
190 * Usage: Internal/External
191 *
192 * </ioctl>
193 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800194#define WE_SET_MAX_TX_POWER 7
Jeff Johnsonfab9b252017-10-28 15:44:34 -0700195/* 8 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800196#define WE_SET_TM_LEVEL 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530197/*
198 * <ioctl>
199 * setphymode - Set the phymode dynamically
200 *
201 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
202 *
203 * @OUTPUT: None
204 *
205 * This IOCTL sets the phymode dynamically
206 *
207 * @E.g: iwpriv wlan0 setphymode 10
208 *
209 * Supported Feature: STA
210 *
211 * Usage: Internal/External
212 *
213 * </ioctl>
214 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800215#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530216/*
217 * <ioctl>
218 * nss - Set the number of spatial streams
219 *
220 * @INPUT: int1…..int3
221 *
222 * @OUTPUT: None
223 *
224 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
225 *
226 * @E.g: iwpriv wlan0 nss 2
227 *
228 * Supported Feature: STA
229 *
230 * Usage: Internal/External
231 *
232 * </ioctl>
233 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800234#define WE_SET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530235/*
236 * <ioctl>
237 * ldpc - Enables or disables LDPC
238 *
239 * @INPUT: 0 – Disable, 1 - Enable
240 *
241 * @OUTPUT: None
242 *
243 * This IOCTL enables or disables LDPC
244 *
245 * @E.g: iwpriv wlan0 ldpc 1
246 *
247 * Supported Feature: STA
248 *
249 * Usage: Internal/External
250 *
251 * </ioctl>
252 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800253#define WE_SET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530254/*
255 * <ioctl>
256 * tx_stbc - Enables or disables tx_stbc
257 *
258 * @INPUT: Int 0 – Disable, 1 - Enable
259 *
260 * @OUTPUT: None
261 *
262 * This IOTCL used to enables or disables tx_stbc
263 *
264 * @E.g: iwpriv wlan0 tx_stbc <value>
265 *
266 * Supported Feature: STA
267 *
268 * Usage: Internal/External
269 *
270 * </ioctl>
271 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800272#define WE_SET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530273/*
274 * <ioctl>
275 * rx_stbc - Set the rx_stbc parameter
276 *
277 * @INPUT: Int 0 – Disable, 1 - Enable
278 *
279 * @OUTPUT: None
280 *
281 * This IOTCL used to set rx_stbc parameter
282 *
283 * @E.g: iwpriv wlan0 rx_stbc <value>
284 *
285 * Supported Feature: STA
286 *
287 * Usage: Internal/External
288 *
289 * </ioctl>
290 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800291#define WE_SET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530292/*
293 * <ioctl>
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800294 * shortgi - Sets the short-guard interval
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530295 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800296 * @INPUT: Fixed Rate: 0 - 400ns, 1 - 800ns, 2 - 1600ns, 3 - 3200us
297 * Auto Rate: 8 - 400ns, 9 - 800ns, 10 - 1600ns, 11 - 3200us
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530298 *
299 * @OUTPUT: None
300 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800301 * This IOCTL sets the short-guard interval.
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530302 *
303 * @E.g: iwpriv wlan0 shortgi <value>
304 *
305 * Supported Feature: STA
306 *
307 * Usage: Internal/External
308 *
309 * </ioctl>
310 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800311#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530312/*
313 * <ioctl>
314 * enablertscts - enables or disables rts/cts.
315 *
316 * @INPUT: 1-Enable , 0-Disable
317 *
318 * @OUTPUT: None
319 *
320 * This IOCTL enables or disables rts/cts.
321 *
322 * @E.g: iwpriv wlan0 enablertscts <value>
323 *
324 * Supported Feature: STA
325 *
326 * Usage: Internal/External
327 *
328 * </ioctl>
329 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800330#define WE_SET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530331/*
332 * <ioctl>
333 * chwidth - Set the channel bandwidth
334 *
335 * @INPUT: 0-20mhz to 3-160mhz
336 *
337 * @OUTPUT: None
338 *
339 * This IOTCL used to set the channel bandwidth
340 *
341 * @E.g: iwpriv wlan0 chwidth 1
342 *
343 * Supported Feature: STA
344 *
345 * Usage: Internal/External
346 *
347 * </ioctl>
348 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800349#define WE_SET_CHWIDTH 17
350#define WE_SET_ANI_EN_DIS 18
351#define WE_SET_ANI_POLL_PERIOD 19
352#define WE_SET_ANI_LISTEN_PERIOD 20
353#define WE_SET_ANI_OFDM_LEVEL 21
354#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530355/*
356 * <ioctl>
357 * cwmenable - Enables or disables the dynamic channel bandwidth
358 *
359 * @INPUT: 0-Disable, 1-Enable
360 *
361 * @OUTPUT: None
362 *
363 * This IOTCL used to enables or disables the dynamic channel bandwidth
364 *
365 * @E.g: iwpriv wlan0 cwmenable <value>
366 *
367 * Supported Feature: STA
368 *
369 * Usage: Internal/External
370 *
371 * </ioctl>
372 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800373#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530374/*
375 * <ioctl>
376 * txchainmask - This IOCTL sets the current Tx chain mask
377 *
378 * @INPUT: Mask Value
379 *
380 * @OUTPUT: None
381 *
382 * This IOCTL sets the current Tx chain mask
383 *
384 * @E.g: iwpriv wlan0 txchainmask 1
385 *
386 * Supported Feature: STA
387 *
388 * Usage: Internal/External
389 *
390 * </ioctl>
391 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800392#define WE_SET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530393/*
394 * <ioctl>
395 * rxchainmask - Sets the current Rx chain mask
396 *
397 * @INPUT: Mask Value
398 *
399 * @OUTPUT: None
400 *
401 * This IOCTL sets the current Rx chain mask. This command is the
402 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
403 *
404 * @E.g: iwpriv wlan0 rxchainmask <value>
405 *
406 * Supported Feature: STA
407 *
408 * Usage: Internal/External
409 *
410 * </ioctl>
411 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800412#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530413/*
414 * <ioctl>
415 * set11NRates - Fixes the Tx data rate of the 11N mode.
416 *
417 * @INPUT: 0x1b to 0x8f
418 *
419 * @OUTPUT: None
420 *
421 * This IOCTL fixes the Tx data rate of the 11N mode.
422 *
423 * @E.g: iwpriv wlan0 set11NRates 0x85
424 *
425 * Supported Feature: STA
426 *
427 * Usage: Internal/External
428 *
429 * </ioctl>
430 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800431#define WE_SET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530432/*
433 * <ioctl>
434 * ampdu - Set the the maximum subframe of ampdu
435 *
436 * @INPUT: int 1 to int 63
437 *
438 * @OUTPUT: None
439 *
440 * This IOCTL sets the maximum subframe of ampdu.
441 *
442 * @E.g: iwpriv wlan0 ampdu 9
443 *
444 * Supported Feature: STA
445 *
446 * Usage: Internal/External
447 *
448 * </ioctl>
449 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800450#define WE_SET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530451/*
452 * <ioctl>
453 * amsdu - Sets the maximum subframe of amsdu.
454 *
455 * @INPUT: int 1 to int 31
456 *
457 * @OUTPUT: None
458 *
459 * This IOCTL sets the maximum subframe of amsdu.
460 *
461 * @E.g: iwpriv wlan0 amsdu 9
462 *
463 * Supported Feature: STA
464 *
465 * Usage: Internal/External
466 *
467 * </ioctl>
468 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800469#define WE_SET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530470/*
471 * <ioctl>
472 * txpow2g - current 2 GHz Tx power setting
473 *
474 * @INPUT: Tx power in dBm
475 *
476 * @OUTPUT: None
477 *
478 * This IOTCL used to set 2 ghz tx power
479 *
480 * @E.g: iwpriv wlan0 txpow2g
481 *
482 * Supported Feature: STA
483 *
484 * Usage: Internal/External
485 *
486 * </ioctl>
487 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800488#define WE_SET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530489/*
490 * <ioctl>
491 * txpow5g - Current 5 GHz tx power setting
492 *
493 * @INPUT: Tx power in dBm
494 *
495 * @OUTPUT: None
496 *
497 * This IOTCL used to set the 5 ghz txpower
498 *
499 * @E.g: iwpriv wlan0 txpow5g
500 *
501 * Supported Feature: STA
502 *
503 * Usage: Internal/External
504 *
505 * </ioctl>
506 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800507#define WE_SET_TXPOW_5G 30
508/* Private ioctl for firmware debug log */
509#define WE_DBGLOG_LOG_LEVEL 31
510#define WE_DBGLOG_VAP_ENABLE 32
511#define WE_DBGLOG_VAP_DISABLE 33
512#define WE_DBGLOG_MODULE_ENABLE 34
513#define WE_DBGLOG_MODULE_DISABLE 35
514#define WE_DBGLOG_MOD_LOG_LEVEL 36
515#define WE_DBGLOG_TYPE 37
516#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530517/*
518 * <ioctl>
519 * set11ACRates - Fixes the Tx data rate of 11AC
520 *
521 * @INPUT: 0x1 to 0x9
522 *
523 * @OUTPUT: None
524 *
525 * This IOCTL fixes the Tx data rate of 11AC.
526 *
527 * @E.g: iwpriv wlan0 set11ACRates 0x9
528 *
529 * Supported Feature: STA
530 *
531 * Usage: Internal/External
532 *
533 * </ioctl>
534 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800535#define WE_SET_VHT_RATE 39
536#define WE_DBGLOG_REPORT_ENABLE 40
537#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530538/*
539 * <ioctl>
540 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
541 *
542 * @INPUT: Transmission power in dBm
543 *
544 * @OUTPUT: None
545 *
546 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
547 * This setting does not persist over reboots
548 *
549 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
550 *
551 * Supported Feature: STA
552 *
553 * Usage: Internal/External
554 *
555 * </ioctl>
556 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800557#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530558/*
559 * <ioctl>
560 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
561 *
562 * @INPUT: Transmission power in dBm
563 *
564 * @OUTPUT: None
565 *
566 * This IOCTL sets the maximum transmit power for the 5-GHz band
567 * This setting does not persist over reboots
568 *
569 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
570 *
571 * Supported Feature: STA
572 *
573 * Usage: Internal/External
574 *
575 * </ioctl>
576 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800577#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800578#define WE_SET_PKTLOG 44
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530579/* Private ioctl for packet power save */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800580#define WE_PPS_PAID_MATCH 45
581#define WE_PPS_GID_MATCH 46
582#define WE_PPS_EARLY_TIM_CLEAR 47
583#define WE_PPS_EARLY_DTIM_CLEAR 48
584#define WE_PPS_EOF_PAD_DELIM 49
585#define WE_PPS_MACADDR_MISMATCH 50
586#define WE_PPS_DELIM_CRC_FAIL 51
587#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530588/*
589 * <ioctl>
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530590 * rssi_chk - Check the rssi
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530591 *
592 * @INPUT: One argument as input
593 *
594 * @OUTPUT: rssi
595 * wlan0 rssi_chk:56
596 *
597 * This IOTCL used to chek rssi
598 *
599 * @E.g: iwpriv wlan0 rssi_chk <value>
600 *
601 * Supported Feature: STA
602 *
603 * Usage: Internal/External
604 *
605 * </ioctl>
606 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800607#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530608/*
609 * <ioctl>
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530610 * htsmps - Sets the htsmps
611 *
612 * @INPUT: Atleast one int argument
613 *
614 * @OUTPUT: None
615 *
616 * This IOTCL used to set htsmps
617 *
618 * @E.g: iwpriv wlan0 htsmps <value>
619 *
620 * Supported Feature: STA
621 *
622 * Usage: Internal/External
623 *
624 * </ioctl>
625 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800626#define WE_SET_HTSMPS 55
627/* Private ioctl for QPower */
628#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
629#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
630#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
631#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800632/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530633/*
634 * <ioctl>
635 * gtxHTMcs - Set the tx HTM value
636 *
637 * @INPUT: Atleast one int orgument
638 *
639 * @OUTPUT: None
640 *
641 * This IOTCL sets htm tx value
642 *
643 * @E.g: iwpriv wlan0 gtxHTMcs <value>
644 *
645 * Supported Feature: STA
646 *
647 * Usage: Internal/External
648 *
649 * </ioctl>
650 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800651#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530652/*
653 * <ioctl>
654 * gtxVHTMcs - Set gtxVHTMcs value
655 *
656 * @INPUT: Atleast one int argument
657 *
658 * @OUTPUT: None
659 *
660 * This IOTCL used to set gtxVHTMcs value
661 *
662 * @E.g: iwpriv wlan0 gtxVHTMcs <value>
663 *
664 * Supported Feature: STA
665 *
666 * Usage: Internal/External
667 *
668 * </ioctl>
669 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800670#define WE_SET_GTX_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530671/*
672 * <ioctl>
673 * gtxUsrCfg - Host request for GTX mask
674 *
675 * @INPUT: Atleast one int orgument
676 *
677 * @OUTPUT: None
678 *
679 * This IOTCL used send the host request for GTX mask
680 *
681 * @E.g: iwpriv wlan0 gtxUsrCfg <value>
682 *
683 * Supported Feature: STA
684 *
685 * Usage: Internal/External
686 *
687 * </ioctl>
688 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800689#define WE_SET_GTX_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530690/*
691 * <ioctl>
692 * gtxThre - Set the tx threshold
693 *
694 * @INPUT: Atleast one int argument
695 *
696 * @OUTPUT: None
697 *
698 * This IOTCL used to set tx threshold
699 *
700 * @E.g: iwpriv wlan0 gtxThre <value>
701 *
702 * Supported Feature: STA
703 *
704 * Usage: Internal/External
705 *
706 * </ioctl>
707 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800708#define WE_SET_GTX_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530709/*
710 * <ioctl>
711 * gtxMargin - Set the gtxMargin
712 *
713 * @INPUT: 1 to 32
714 *
715 * @OUTPUT: None
716 *
717 * This IOTCL use dto set gtxMargin
718 *
719 * @E.g: iwpriv wlan0 gtxMargini <value>
720 *
721 * Supported Feature: STA
722 *
723 * Usage: Internal/External
724 *
725 * </ioctl>
726 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800727#define WE_SET_GTX_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530728/*
729 * <ioctl>
730 * gtxStep - Set the gtxStep
731 *
732 * @INPUT: None
733 *
734 * @OUTPUT: None
735 *
736 * This IOTCL used to sets gtxStep
737 *
738 * @E.g: iwpriv wlan0 gtxStep <value>
739 *
740 * Supported Feature: STA
741 *
742 * Usage: Internal/External
743 *
744 * </ioctl>
745 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800746#define WE_SET_GTX_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530747/*
748 * <ioctl>
749 * gtxMinTpc - Sets the gtxMinTpc
750 *
751 * @INPUT: Atleast one int argument
752 *
753 * @OUTPUT: None
754 *
755 * This IOTCL sets the tx MinTpc
756 *
757 * @E.g: iwpriv wlan0 gtxMinTpc <value>
758 *
759 * Supported Feature: STA
760 *
761 * Usage: Internal/External
762 *
763 * </ioctl>
764 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800765#define WE_SET_GTX_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530766/*
767 * <ioctl>
768 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
769 *
770 * @INPUT: Mask value
771 *
772 * @OUTPUT: None
773 *
774 * This IOTCL used to set gtxBWMask
775 *
776 * @E.g: iwpriv wlan0 gtxBWMask <value>
777 *
778 * Supported Feature: STA
779 *
780 * Usage: Internal/External
781 *
782 * </ioctl>
783 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530784
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530785#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530786/*
787 * <ioctl>
788 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
789 *
790 * @INPUT: set_value
791 *
792 * @OUTPUT: None
793 *
794 * This IOCTL is used to set the MCC latency value in milliseconds
795 * during STA-P2P concurrency.
796 *
797 * If 0ms latency is provided, then FW will set to a default.
798 * Otherwise, latency must be at least 30ms.
799 *
800 * @E.g: iwpriv wlan0 setMccLatency 40
801 *
802 *
803 * Supported Feature: Concurrency
804 *
805 * Usage: Internal/External
806 *
807 * </ioctl>
808 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800809#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530810
811/*
812 * <ioctl>
813 * setMccQuota- Set the quota for P2P cases
814 *
815 * @INPUT: set_value [0,100]
816 *
817 * @OUTPUT: None
818 *
819 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
820 *
821 * Currently used to set time quota for 2 MCC vdevs/adapters using
822 * (operating channel, quota) for each mode.
823 * The info is provided run time using iwpriv command:
824 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
825 * Note: the quota provided in command is for the same mode in cmd.
826 * HDD checks if MCC mode is active, gets the second mode and its
827 * operating chan.
828 * Quota for the 2nd role is calculated as 100 - quota of first mode.
829 *
830 * @E.g: iwpriv wlan0 setMccQuota 50
831 * iwpriv p2p0 setMccQuota 50
832 *
833 * Supported Feature: Concurrency
834 *
835 * Usage: Internal/External
836 *
837 * </ioctl>
838 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800839#define WE_MCC_CONFIG_QUOTA 71
840/* Private IOCTL for debug connection issues */
841#define WE_SET_DEBUG_LOG 72
842#ifdef WE_SET_TX_POWER
843#undef WE_SET_TX_POWER
844#endif
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -0800845
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530846/*
847 * <ioctl>
848 * setTxPower - Set the current transmit power
849 *
850 * @INPUT: Transmission power in dBm
851 *
852 * @OUTPUT: None
853 *
854 * This IOCTL sets the current transmit power.
855 * This setting does not persist over reboots.
856 *
857 * @E.g: iwpriv wlan0 setTxPower 10
858 *
859 * Supported Feature: STA
860 *
861 * Usage: Internal/External
862 *
863 * </ioctl>
864 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800865#define WE_SET_TX_POWER 74
866/* Private ioctl for earlyrx power save feature */
867#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
868#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
869#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
870#define WE_SET_EARLY_RX_SLOP_STEP 78
871#define WE_SET_EARLY_RX_INIT_SLOP 79
872#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530873/*
874 * <ioctl>
875 * setMcRate - Set the data rate for multicast data
876 *
877 * @INPUT: 1 to 32
878 *
879 * @OUTPUT: None
880 *
881 * This IOCTL sets the data rate for multicast data. Note that this command
882 * is allowed only in STA, IBSS, or QCMobileAP mode
883 *
884 * @E.g: iwpriv wlan0 setMcRate <value>
885 *
886 * Supported Feature: STA
887 *
888 * Usage: Internal/External
889 *
890 * </ioctl>
891 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800892#define WE_SET_MC_RATE 81
893#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
894/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530895/*
896 * <ioctl>
897 * 5g_ebt - Sets the 5g_ebt
898 *
899 * @INPUT: <value>
900 *
901 * @OUTPUT: None
902 *
903 * This IOTCL used to set 5g_ebt
904 *
905 * @E.g: iwpriv wlan0 5g_ebt <value>
906 *
907 * Supported Feature: STA
908 *
909 * Usage: Internal/External
910 *
911 * </ioctl>
912 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800913#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530914/*
915 * <ioctl>
916 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
917 *
918 * @INPUT: 20 t0 160
919 *
920 * @OUTPUT: None
921 *
922 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
923 *
924 * @E.g: iwpriv wlan0 cts_cbw <value>
925 *
926 * Supported Feature: STA
927 *
928 * Usage: Internal/External
929 *
930 * </ioctl>
931 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800932#define WE_SET_CTS_CBW 84
933#define WE_DUMP_STATS 85
934#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +0530935/* Private sub ioctl for starting/stopping the profiling */
936#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +0530937
Abhishek Singh3c507012016-12-01 11:15:42 +0530938/*
939 * <ioctl>
940 * setChanChange - Initiate channel change
941 *
942 * @INPUT: channel number to switch to.
943 *
944 * @OUTPUT: None
945 *
946 * This IOCTL is used to initiate a channel change.
947 * If called on STA/CLI interface it will send the
948 * ECSA action frame to the connected SAP/GO asking to
949 * initiate the ECSA, if supported.
950 * If called on SAP/GO interface it will initiate
951 * ECSA and ask connected peers to move to new channel.
952 *
953 * @E.g: iwpriv wlan0 setChanChange <channel>
954 * iwpriv wlan0 setChanChange 1
955 *
956 * Supported Feature: ECSA
957 *
958 * Usage: Internal/External
959 *
960 * </ioctl>
961 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +0530962#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +0530963#define WE_SET_CONC_SYSTEM_PREF 89
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800964
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800965/*
966 * <ioctl>
967 * set_11ax_rate - set 11ax rates to FW
968 *
969 * @INPUT: rate code
970 *
971 * @OUTPUT: None
972 *
973 * This IOCTL fixes the Tx data rate of 11AX.
974 *
975 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
976 *
977 * Supported Feature: STA/SAP
978 *
979 * Usage: Internal
980 *
981 * </ioctl>
982 */
983#define WE_SET_11AX_RATE 91
984
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -0700985/*
986 * <ioctl>
987 * enable_dcm - enable Dual Carrier Modulation(DCM)
988 *
989 * @INPUT: 0/1
990 *
991 * @OUTPUT: None
992 *
993 * This IOCTL enables/disables DCM.
994 *
995 * @E.g: iwpriv wlan0 enable_dcm <0/1>
996 *
997 * Supported Feature: STA/SAP
998 *
999 * Usage: Internal
1000 *
1001 * </ioctl>
1002 */
1003#define WE_SET_DCM 92
1004
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001005/*
1006 * <ioctl>
Naveen Rawat53448ea2017-11-27 11:43:18 -08001007 * range_ext - enable Range extension
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001008 *
1009 * @INPUT: 0/1
1010 *
1011 * @OUTPUT: None
1012 *
1013 * This IOCTL enables/disables Range extension.
1014 *
Naveen Rawat53448ea2017-11-27 11:43:18 -08001015 * @E.g: iwpriv wlan0 range_ext <1/0>
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001016 *
1017 * Supported Feature: STA/SAP
1018 *
1019 * Usage: Internal
1020 *
1021 * </ioctl>
1022 */
1023#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001024
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301025/*
1026 * <ioctl>
1027 * wow_ito - sets the timeout value for inactivity data while
1028 * in power save mode during wow
1029 *
1030 * @INPUT: int
1031 *
1032 * @OUTPUT: None
1033 *
1034 * This IOCTL set the timeout value for inactivity data in power save mode
1035 *
1036 * @E.g: iwpriv wlan0 wow_ito 20
1037 *
1038 * Supported Feature: STA
1039 *
1040 * Usage: External
1041 *
1042 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001043 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301044#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1045
Jeff Johnson011c4502017-10-05 15:25:56 -07001046/*
1047 * <ioctl>
1048 * pdev_reset - reset the pdev
1049 *
1050 * @INPUT: Reset command to initiate:
1051 * TX_FLUSH = 1
1052 * WARM_RESET = 2
1053 * COLD_RESET = 3
1054 * WARM_RESET_RESTORE_CAL = 4
1055 * COLD_RESET_RESTORE_CAL = 5
1056 *
1057 * @OUTPUT: None
1058 *
1059 * This IOCTL is used to reset the pdev. The primary use is
1060 * for internal testing. It is not expected that this will
1061 * be used on a production device.
1062 *
1063 * @E.g: iwpriv wlan0 pdev_reset <command>
1064 * iwpriv wlan0 pdev_reset 1
1065 *
1066 * Supported Feature: None
1067 *
1068 * Usage: Internal
1069 *
1070 * </ioctl>
1071 */
1072#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301073
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301074/*
1075 * setModDTIM - Change Modulated DTIM
1076 *
1077 * @INPUT: set_value.
1078 *
1079 * @OUTPUT: None
1080 *
1081 * This IOCTL is used to change modulated DTIM
1082 * value without WIFI OFF/ON.
1083 *
1084 * @E.g: iwpriv wlan0 setModDTIM <value>
1085 * iwpriv wlan0 setModDTIM 2
1086 *
1087 * Supported Feature: N/A
1088 *
1089 * Usage: Internal/External
1090 *
1091 * </ioctl>
1092 */
1093#define WE_SET_MODULATED_DTIM 96
1094
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001095/* Private ioctls and their sub-ioctls */
1096#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1097#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001098#define WE_GET_WLAN_DBG 4
1099#define WE_GET_MAX_ASSOC 6
1100/* 7 is unused */
1101#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301102
1103/*
1104 * <ioctl>
1105 * getconcurrency - Get concurrency mode
1106 *
1107 * @INPUT: None
1108 *
1109 * @OUTPUT: It shows concurrency value
1110 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1111 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1112 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1113 *
1114 * This IOCTL is used to retrieve concurrency mode.
1115 *
1116 * @E.g: iwpriv wlan0 getconcurrency
1117 * wlan0 getconcurrency:5
1118 * Above value shows STA+P2P_Client
1119 *
1120 * Supported Feature: Concurrency
1121 *
1122 * Usage: Internal/External
1123 *
1124 * </ioctl>
1125 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001126#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301127/*
1128 * <ioctl>
1129 * get_nss - Get the number of spatial STBC streams (NSS)
1130 *
1131 * @INPUT: None
1132 *
1133 * @OUTPUT: NSS
1134 * wlan0 get_nss:2
1135 *
1136 * This IOTCL used to get the number of spatial STBC streams
1137 *
1138 * @E.g: iwpriv wlan0 get_nss
1139 *
1140 * Supported Feature: STA
1141 *
1142 * Usage: Internal/External
1143 *
1144 * </ioctl>
1145 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001146#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301147/*
1148 * <ioctl>
1149 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1150 *
1151 * @INPUT: None
1152 *
1153 * @OUTPUT: ldpc
1154 * wlan0 get_ldpc:1
1155 *
1156 * This IOTCL used to gets the low density parity check (LDPC)
1157 *
1158 * @E.g: iwpriv wlan0 get_ldpc
1159 *
1160 * Supported Feature: STA
1161 *
1162 * Usage: Internal/External
1163 *
1164 * </ioctl>
1165 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001166#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301167/*
1168 * <ioctl>
1169 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1170 *
1171 * @INPUT: None
1172 *
1173 * @OUTPUT: TXSTBC
1174 * wlan0 get_tx_stbc:1
1175 *
1176 * This IOTCL get the value of the current Tx space time block code (STBC)
1177 *
1178 * @E.g: iwpriv wlan0 get_tx_stbc
1179 *
1180 * Supported Feature: STA
1181 *
1182 * Usage: Internal/External
1183 *
1184 * </ioctl>
1185 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001186#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301187/*
1188 * <ioctl>
1189 * get_rx_stbc - Gets the value of the current Rx STBC
1190 *
1191 * @INPUT: None
1192 *
1193 * @OUTPUT: Rx STBC
1194 * wlan0 get_rx_stbc:1
1195 *
1196 * This IOTCL used to get the value of the current Rx STBC
1197 *
1198 * @E.g: iwpriv wlan0 get_rx_stbc
1199 *
1200 * Supported Feature: STA
1201 *
1202 * Usage: Internal/External
1203 *
1204 * </ioctl>
1205 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001206#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301207/*
1208 * <ioctl>
1209 * get_shortgi - Get the value of the current short GI setting
1210 *
1211 * @INPUT: None
1212 *
1213 * @OUTPUT: Enable/disable of shortgi
1214 * wlan0 get_shortgi:1
1215 *
1216 * This IOCTL gets the value of the current short GI setting
1217 *
1218 * @E.g: iwpriv wlan0 get_shortgi
1219 *
1220 * Supported Feature: STA
1221 *
1222 * Usage: Internal/External
1223 *
1224 * </ioctl>
1225 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001226#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301227/*
1228 * <ioctl>
1229 * get_rtscts - Get the value of the current RTS/CTS setting.
1230 *
1231 * @INPUT: None
1232 *
1233 * @OUTPUT: Enable/disable of RTS/CTS
1234 * wlan0 get_rtscts:33
1235 *
1236 * This IOTCL get the value of the current RTS/CTS setting.
1237 *
1238 * @E.g: iwpriv wlan0 get_rtscts
1239 *
1240 * Supported Feature: STA
1241 *
1242 * Usage: Internal/External
1243 *
1244 * </ioctl>
1245 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001246#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301247/*
1248 * <ioctl>
1249 * get_chwidth - Get the current channel width setting
1250 *
1251 * @INPUT: None
1252 *
1253 * @OUTPUT: channel width
1254 * wlan0 get_chwidth:0
1255 *
1256 * This IOTCL get the current channel width setting.
1257 *
1258 * @E.g: iwpriv wlan0 get_chwidth
1259 *
1260 * Supported Feature: STA
1261 *
1262 * Usage: Internal/External
1263 *
1264 * </ioctl>
1265 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001266#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301267/*
1268 * <ioctl>
1269 * get_anienable - Get the anienable
1270 *
1271 * @INPUT: None
1272 *
1273 * @OUTPUT:
1274 * wlan0 get_anienable:0
1275 *
1276 * This IOTCL get the anienable
1277 *
1278 * @E.g: iwpriv wlan0 get_anienable
1279 *
1280 * Supported Feature: STA
1281 *
1282 * Usage: Internal/External
1283 *
1284 * </ioctl>
1285 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001286#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301287/*
1288 * <ioctl>
1289 * get_aniplen - Get the aniplen
1290 *
1291 * @INPUT: None
1292 *
1293 * @OUTPUT:
1294 * wlan0 get_aniplen:0
1295 *
1296 * This IOTCL get the aniplen
1297 *
1298 * @E.g: iwpriv wlan0 get_aniplen
1299 *
1300 * Supported Feature: STA
1301 *
1302 * Usage: Internal/External
1303 *
1304 * </ioctl>
1305 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001306#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301307/*
1308 * <ioctl>
1309 * get_anilislen- Get the anilislen
1310 *
1311 * @INPUT: None
1312 *
1313 * @OUTPUT:
1314 * wlan0 get_anilislen:0
1315 *
1316 * This IOTCL used to get anilislen
1317 *
1318 * @E.g: iwpriv wlan0 get_anilislen
1319 *
1320 * Supported Feature: STA
1321 *
1322 * Usage: Internal/External
1323 *
1324 * </ioctl>
1325 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001326#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301327/*
1328 * <ioctl>
1329 * get_aniofdmlvl - Get the OFDM level
1330 *
1331 * @INPUT: None
1332 *
1333 * @OUTPUT: OFDM
1334 * wlan0 get_aniofdmlvl:0
1335 *
1336 * This IOTCL used to get ofdm level
1337 *
1338 * @E.g: iwpriv wlan0 get_aniofdmlvl
1339 *
1340 * Supported Feature: STA
1341 *
1342 * Usage: Internal/External
1343 *
1344 * </ioctl>
1345 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001346#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301347/*
1348 * <ioctl>
1349 * get_aniccklvl - Get the cck level
1350 *
1351 * @INPUT: None
1352 *
1353 * @OUTPUT:
1354 * wlan0 get_aniccklvl:0
1355 *
1356 * This IOTCL used to get cck level
1357 *
1358 * @E.g: iwpriv wlan0 get_aniccklvl
1359 *
1360 * Supported Feature: STA
1361 *
1362 * Usage: Internal/External
1363 *
1364 * </ioctl>
1365 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001366#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301367/*
1368 * <ioctl>
1369 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1370 *
1371 * @INPUT: None
1372 *
1373 * @OUTPUT: Enable/disable dynamic channel bandwidth
1374 * wlan0 get_cwmenable:0
1375 *
1376 * This IOTCL get the value of the dynamic channel bandwidth setting
1377 *
1378 * @E.g: iwpriv wlan0 get_cwmenable
1379 *
1380 * Supported Feature: STA
1381 *
1382 * Usage: Internal/External
1383 *
1384 * </ioctl>
1385 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001386#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301387/*
1388 * <ioctl>
1389 * get_txchainmask - Get the txchainmask that was set
1390 *
1391 * @INPUT: None
1392 *
1393 * @OUTPUT: txchainmask
1394 * wlan0 get_txchainmask:1
1395 *
1396 * This IOCTL gets the txchainmask that was set
1397 * This command is useful if it was previously set
1398 *
1399 * @E.g: iwpriv wlan0 get_txchainmask
1400 *
1401 * Supported Feature: STA
1402 *
1403 * Usage: Internal/External
1404 *
1405 * </ioctl>
1406 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001407#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301408/*
1409 * <ioctl>
1410 * get_rxchainmask - Get the rxchainmask that was set
1411 *
1412 * @INPUT: None
1413 *
1414 * @OUTPUT: rxchainmask
1415 * wlan0 get_rxchainmask:1
1416 *
1417 * This IOCTL gets the rxchainmask that was set
1418 * This command is useful only if it was previously set.
1419 *
1420 * @E.g: iwpriv wlan0 get_rxchainmask
1421 *
1422 * Supported Feature: STA
1423 *
1424 * Usage: Internal/External
1425 *
1426 * </ioctl>
1427 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001428#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301429/*
1430 * <ioctl>
1431 * get_11nrate - Get the fixed Tx data rate
1432 *
1433 * @INPUT: None
1434 *
1435 * @OUTPUT: Using this command does not return the same value as set
1436 * wlan0 get_11nrate:0
1437 *
1438 * This IOCTL gets the fixed Tx data rate
1439 * This command is useful only if setting the fixed Tx rate.
1440 *
1441 * @E.g: iwpriv wlan0 get_11nrate
1442 *
1443 * Supported Feature: STA
1444 *
1445 * Usage: Internal/External
1446 *
1447 * </ioctl>
1448 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001449#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301450/*
1451 * <ioctl>
1452 * get_ampdu - Get the maximum subframe of ampdu
1453 *
1454 * @INPUT: None
1455 *
1456 * @OUTPUT: Maximum subframe of ampdu
1457 * wlan0 get_ampdu:1
1458 *
1459 * This IOCTL gets the maximum subframe of ampdu
1460 * This command is useful only if setting ampdu.
1461 *
1462 * @E.g: iwpriv wlan0 get_ampdu
1463 *
1464 * Supported Feature: STA
1465 *
1466 * Usage: Internal/External
1467 *
1468 * </ioctl>
1469 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001470#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301471/*
1472 * <ioctl>
1473 * get_amsdu - Get the maximum subframe of amsdu
1474 *
1475 * @INPUT: None
1476 *
1477 * @OUTPUT: Maximum subframe of amsdu
1478 * wlan0 get_amsdu:1
1479 *
1480 * This IOCTL gets the maximum subframe of amsdu.
1481 * This command is useful only if setting amsdu
1482 *
1483 * @E.g: iwpriv wlan0 get_amsdu
1484 *
1485 * Supported Feature: STA
1486 *
1487 * Usage: Internal/External
1488 *
1489 * </ioctl>
1490 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001491#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301492/*
1493 * <ioctl>
1494 * get_txpow2g - Get the current 2 GHz Tx power setting
1495 *
1496 * @INPUT: None
1497 *
1498 * @OUTPUT: Tx Power in dbm
1499 * wlan0 get_txpow2g:0
1500 *
1501 * This IOCTL gets the current 2 GHz Tx power setting
1502 * This command is useful if setting Tx power
1503 *
1504 * @E.g: iwpriv wlan0 get_txpow2g
1505 *
1506 * Supported Feature: STA
1507 *
1508 * Usage: Internal/External
1509 *
1510 * </ioctl>
1511 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001512#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301513/*
1514 * <ioctl>
1515 * get_txpow5g - Get the current 5 GHz Tx power setting
1516 *
1517 * @INPUT: None
1518 *
1519 * @OUTPUT: Tx Power in dbm
1520 * wlan0 get_txpow5g:0
1521 *
1522 * This IOCTL gets the current 5 GHz Tx power setting
1523 * This command is useful if setting Tx power
1524 *
1525 * @E.g: iwpriv wlan0 get_txpow5g
1526 *
1527 * Supported Feature: STA
1528 *
1529 * Usage: Internal/External
1530 *
1531 * </ioctl>
1532 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001533#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001534/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001535#define WE_GET_PPS_PAID_MATCH 32
1536#define WE_GET_PPS_GID_MATCH 33
1537#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1538#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1539#define WE_GET_PPS_EOF_PAD_DELIM 36
1540#define WE_GET_PPS_MACADDR_MISMATCH 37
1541#define WE_GET_PPS_DELIM_CRC_FAIL 38
1542#define WE_GET_PPS_GID_NSTS_ZERO 39
1543#define WE_GET_PPS_RSSI_CHECK 40
1544/* Private ioctl for QPower */
1545#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1546#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1547#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1548#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001549/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301550/*
1551 * <ioctl>
1552 * get_gtxHTMcs - Get the tx HTM
1553 *
1554 * @INPUT: None
1555 *
1556 * @OUTPUT: HTM
1557 * wlan0 get_gtxHTMcs:32896
1558 *
1559 * This IOTCL used to get HTM
1560 *
1561 * @E.g: iwpriv wlan0 get_gtxHTMcs
1562 *
1563 * Supported Feature: STA
1564 *
1565 * Usage: Internal/External
1566 *
1567 * </ioctl>
1568 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001569#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301570/*
1571 * <ioctl>
1572 * get_gtxVHTMcs - Get the VHTM
1573 *
1574 * @INPUT: None
1575 *
1576 * @OUTPUT: VHTM
1577 * wlan0 get_gtxVHTMcs:524800
1578 *
1579 * This IOTCL used to get the VHTM
1580 *
1581 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1582 *
1583 * Supported Feature: STA
1584 *
1585 * Usage: Internal/External
1586 *
1587 * </ioctl>
1588 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001589#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301590/*
1591 * <ioctl>
1592 * get_gtxUsrCfg - Get the tx cfg
1593 *
1594 * @INPUT: None
1595 *
1596 * @OUTPUT: TXCFG
1597 * wlan0 get_gtxUsrCfg:32
1598 *
1599 * This IOTCL used to get the tx cfg
1600 *
1601 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1602 *
1603 * Supported Feature: STA
1604 *
1605 * Usage: Internal/External
1606 *
1607 * </ioctl>
1608 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001609#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301610/*
1611 * <ioctl>
1612 * get_gtxThre - Get the tx threshold
1613 *
1614 * @INPUT: None
1615 *
1616 * @OUTPUT: Threshold
1617 * wlan0 get_gtxThre:3
1618 *
1619 * This IOCTL is used to get tx threshold
1620 *
1621 * @E.g: iwpriv wlan0 get_gtxThre
1622 *
1623 * Supported Feature: STA
1624 *
1625 * Usage: Internal/External
1626 *
1627 * </ioctl>
1628 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001629#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301630/*
1631 * <ioctl>
1632 * get_gtxMargin - Get the tx margin
1633 *
1634 * @INPUT: None
1635 *
1636 * @OUTPUT: GTXMARGIN
1637 * wlan0 get_gtxMargin:2
1638 *
1639 * This IOCTL is used to set tx margin
1640 *
1641 * @E.g: iwpriv wlan0 get_gtxMargin
1642 *
1643 * Supported Feature: STA
1644 *
1645 * Usage: Internal/External
1646 *
1647 * </ioctl>
1648 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001649#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301650/*
1651 * <ioctl>
1652 * get_gtxStep - Get the tx step
1653 *
1654 * @INPUT: None
1655 *
1656 * @OUTPUT: GTXSTEP
1657 * wlan0 get_gtxStep:0
1658 *
1659 * This IOCTL is used to get the gtx step
1660 *
1661 * @E.g: iwpriv wlan0 get_gtxStep
1662 *
1663 * Supported Feature: STA
1664 *
1665 * Usage: Internal/External
1666 *
1667 * </ioctl>
1668 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001669#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301670/*
1671 * <ioctl>
1672 * get_gtxMinTpc - Get the tx miminum tpc
1673 *
1674 * @INPUT: None
1675 *
1676 * @OUTPUT: TPC
1677 * wlan0 get_gtxMinTpc:0
1678 *
1679 * This IOCTL is used to get tx miminum tpc
1680 *
1681 * @E.g: iwpriv wlan0 get_gtxMinTpc
1682 *
1683 * Supported Feature: STA
1684 *
1685 * Usage: Internal/External
1686 *
1687 * </ioctl>
1688 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001689#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301690/*
1691 * <ioctl>
1692 * get_gtxBWMask - Get the tx BW MASK
1693 *
1694 * @INPUT: None
1695 *
1696 * @OUTPUT: MASK
1697 * wlan0 get_gtxBWMask:15
1698 *
1699 * This IOCTL is used get gtx bw mask
1700 *
1701 * @E.g: iwpriv wlan0 get_gtxBWMask
1702 *
1703 * Supported Feature: STA
1704 *
1705 * Usage: Internal/External
1706 *
1707 * </ioctl>
1708 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001709#define WE_GET_GTX_BWMASK 54
1710#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001711#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001712#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001713
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001714/*
1715 * <ioctl>
1716 * get_dcm - Get dcm enablement value
1717 *
1718 * @INPUT: None
1719 *
1720 * @OUTPUT: 0/1
1721 * wlan0 get_dcm
1722 *
1723 * This IOCTL is used get dcm value
1724 *
1725 * Supported Feature: STA/SAP
1726 *
1727 * Usage: Internal
1728 *
1729 * </ioctl>
1730 */
1731#define WE_GET_DCM 60
1732
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001733/*
1734 * <ioctl>
1735 * get_dcm - Get range extension enablement value
1736 *
1737 * @INPUT: None
1738 *
1739 * @OUTPUT: 0/1
1740 * wlan0 get_range_ext
1741 *
1742 * This IOCTL is used get range_extension value
1743 *
1744 * Supported Feature: STA/SAP
1745 *
1746 * Usage: Internal
1747 *
1748 * </ioctl>
1749 */
1750#define WE_GET_RANGE_EXT 61
1751
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001752/* Private ioctls and their sub-ioctls */
1753#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1754
1755/* Private ioctls and their sub-ioctls */
1756#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1757#define WE_WOWL_ADD_PTRN 1
1758#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301759/*
1760 * <ioctl>
1761 * neighbor - Send neighbor report request
1762 *
1763 * @INPUT: string
1764 *
1765 * @OUTPUT: None
1766 *
1767 * This IOCTL create a Neighbor report request and send it to peer
1768 *
1769 * @E.g: iwpriv wlan0 neighbor "SSID"
1770 *
1771 * Supported Feature: 11k
1772 *
1773 * Usage: Internal/External
1774 *
1775 * </ioctl>
1776 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001777#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301778/*
1779 * <ioctl>
1780 * set_ap_wps_ie - Set the P2P IE of the probe response
1781 *
1782 * @INPUT: string
1783 *
1784 * @OUTPUT: None
1785 *
1786 * This IOCTL sets the P2P IE of the probe response
1787 *
1788 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1789 *
1790 * Supported Feature: STA
1791 *
1792 * Usage: Internal/External
1793 *
1794 * </ioctl>
1795 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001796#define WE_SET_AP_WPS_IE 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001797#define WE_SET_CONFIG 5
1798
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07001799/*
1800 * <ioctl>
1801 * unit_test - execute component-level unit tests
1802 *
1803 * @INPUT: string - the name of the component to test.
1804 * All tests are executed if unspecified
1805 * @OUTPUT: None
1806 *
1807 * Usage: Internal only
1808 * </ioctl>
1809 */
1810#define WE_UNIT_TEST 6
1811
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001812/* Private ioctls and their sub-ioctls */
1813#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1814#define WE_SET_WLAN_DBG 1
1815#define WE_SET_DP_TRACE 2
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301816#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001817
1818/* Private ioctls and their sub-ioctls */
1819#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1820#define WE_WLAN_VERSION 1
1821#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301822/*
1823 * <ioctl>
1824 * getConfig - gets the values of all configurations listed in WCNSS
1825 *
1826 * @INPUT: None
1827 *
1828 * @OUTPUT: Current configuration to the sys log
1829 * wlan0 getConfig: WLAN configuration written to system log
1830 *
1831 * This IOCTL gets the values of all configurations listed in WCNSS
1832 *
1833 * @E.g: iwpriv wlan0 getConfig
1834 *
1835 * Supported Feature: STA
1836 *
1837 * Usage: Internal/External
1838 *
1839 * </ioctl>
1840 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001841#define WE_GET_CFG 3
1842#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301843/*
1844 * <ioctl>
1845 * getChannelList - Get the available channel list while in QCMobileAP
1846 *
1847 * @INPUT: None
1848 *
1849 * @OUTPUT: Channel list
1850 * wlan0 getChannelList:36 US 1..165
1851 *
1852 * This IOCTL gets the available channel list while in QCMobileAP
1853 *
1854 * @E.g: iwpriv wlan0 getChannelList
1855 *
1856 * Supported Feature: STA
1857 *
1858 * Usage: Internal/External
1859 *
1860 * </ioctl>
1861 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001862#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301863/*
1864 * <ioctl>
1865 * getRSSI - Get the Received Signal Strength Indicator
1866 *
1867 * @INPUT: None
1868 *
1869 * @OUTPUT: RSSI
1870 * wlan0 getRSSI:rsssi=-32
1871 *
1872 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1873 *
1874 * @E.g: iwpriv wlan0 getRSSI
1875 *
1876 * Supported Feature: STA
1877 *
1878 * Usage: Internal/External
1879 *
1880 * </ioctl>
1881 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001882#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001883
1884/*
1885 * <ioctl>
1886 * getSuspendStats - Get suspend/resume stats
1887 *
1888 * @INPUT: None
1889 *
1890 * @OUTPUT: character string containing formatted suspend/resume stats
1891 *
1892 * This ioctl is used to get suspend/resume stats formatted for display.
1893 * Currently it includes suspend/resume counts, wow wake up reasons, and
1894 * suspend fail reasons.
1895 *
1896 * @E.g: iwpriv wlan0 getSuspendStats
1897 * iwpriv wlan0 getSuspendStats
1898 *
1899 * Supported Feature: suspend/resume
1900 *
1901 * Usage: Internal
1902 *
1903 * </ioctl>
1904 */
1905#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001906#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05301907/*
1908 * <ioctl>
1909 * getTdlsPeers - Get all TDLS peers.
1910 *
1911 * @INPUT: None
1912 *
1913 * @OUTPUT: Returns the MAC address of all the TDLS peers
1914 * wlan0 getTdlsPeers:
1915 * MAC Id cap up RSSI
1916 * ---------------------------------
1917 * 00:0a:f5:0e:bd:18 2 Y Y -44
1918 * 00:0a:f5:bf:0e:12 0 N N 0
1919 *
1920 * This IOCTL is used to get all TDLS peers.
1921 *
1922 * @E.g: iwpriv wlan0 getTdlsPeers
1923 *
1924 * Supported Feature: TDLS
1925 *
1926 * Usage: Internal/External
1927 *
1928 * </ioctl>
1929 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001930#define WE_GET_TDLS_PEERS 8
1931#endif
1932#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05301933/*
1934 * <ioctl>
1935 * getPMFInfo - get the PMF info of the connected session
1936 *
1937 * @INPUT: None
1938 *
1939 * @OUTPUT:
1940 * wlan0 getPMFInfo:
1941 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
1942 * Number of Unprotected Disassocs 0
1943 * Number of Unprotected Deauths 0
1944 *
1945 * This IOCTL is used to get the PMF stats/status of the current
1946 * connection.
1947 *
1948 * @e.g:iwpriv wlan0 getPMFInfo
1949 *
1950 * Supported Feature: PMF
1951 *
1952 * Usage: Internal/External
1953 *
1954 * </ioctl>
1955 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001956#define WE_GET_11W_INFO 9
1957#endif
1958#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05301959/*
1960 * <ioctl>
1961 * getIbssSTAs - get ibss sta info
1962 *
1963 * @INPUT: None
1964 *
1965 * @OUTPUT: Give the MAC of the IBSS STA
1966 * wlan0 getIbssSTAs:
1967 * 1 .8c:fd:f0:01:9c:bf
1968 *
1969 * This IOCTL is used to get ibss sta info
1970 *
1971 * @E.g: iwpriv wlan0 getIbssSTAs
1972 *
1973 * Supported Feature: IBSS
1974 *
1975 * Usage: Internal/External
1976 *
1977 * </ioctl>
1978 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001979#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301980/*
1981 * <ioctl>
1982 * getphymode - Get the current phymode.
1983 *
1984 * @INPUT: None
1985 *
1986 * @OUTPUT: In phymode
1987 * wlan0 getphymode:AUTO MODE
1988 *
1989 * This IOCTL used to gets the current phymode.
1990 *
1991 * @E.g: iwpriv wlan0 getphymode
1992 *
1993 * Supported Feature: STA
1994 *
1995 * Usage: Internal/External
1996 *
1997 * </ioctl>
1998 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001999#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002000
2001/*
2002 * <ioctl>
2003 * getOemDataCap - Get the oem data caps.
2004 *
2005 * @INPUT: None
2006 *
2007 * @OUTPUT: oem data capability
2008 *
2009 * This IOCTL used to gets the current oem data cap.
2010 *
2011 * @E.g: iwpriv wlan0 getOemDataCap
2012 *
2013 * Usage: Internal/External
2014 *
2015 * </ioctl>
2016 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002017#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002018
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302019/*
2020 * <ioctl>
2021 * getSNR - Enable SNR Monitoring
2022 *
2023 * @INPUT: None
2024 *
2025 * @OUTPUT: Signal strength/ratio
2026 * wlan0 getSNR:1
2027 *
2028 * This IOCTL is used to get ibss sta info
2029 *
2030 * @E.g: iwpriv wlan0 getSNR
2031 *
2032 * Supported Feature: STA
2033 *
2034 * Usage: Internal/External
2035 *
2036 * </ioctl>
2037 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002038
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002039#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302040#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002041
Krunal Soni6c3859f2018-06-01 19:57:40 -07002042/*
2043 * <ioctl>
2044 *
2045 * get_ba_timeout - to get timeout for each AC
2046 *
2047 * @INPUT: None
2048 *
2049 * @OUTPUT: displays timeout value for each access class
2050 *
2051 * @E.g.: iwpriv wlan0 get_ba_timeout
2052 *
2053 * Usage: Internal
2054 *
2055 * </ioctl>
2056 */
2057#define WE_GET_BA_AGEING_TIMEOUT 16
2058
Krunal Soni5e483782018-10-25 15:42:44 -07002059/*
2060 * <ioctl>
2061 *
2062 * sta_cxn_info - STA connection information
2063 *
2064 * @INPUT: none
2065 *
2066 * @OUTPUT: STA's connection information
2067 *
2068 * This IOCTL is used to get connection's information.
2069 *
2070 * @E.g: iwpriv wlan0 get_cxn_info
2071 *
2072 * Usage: Internal
2073 *
2074 * </ioctl>
2075 */
2076#define WE_GET_STA_CXN_INFO 17
2077
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002078/* Private ioctls and their sub-ioctls */
2079#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302080
2081/*
2082 * <ioctl>
2083 * reassoc - Trigger STA re-association to the connected AP
2084 *
2085 * @INPUT: None
2086 *
2087 * @OUTPUT: None
2088 *
2089 * This IOCTL is used to trigger STA reassociation to the connected AP.
2090 *
2091 * @E.g: iwpriv wlan0 reassoc
2092 *
2093 * Supported Feature: Roaming
2094 *
2095 * Usage: Internal
2096 *
2097 * </ioctl>
2098 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002099#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302100/*
2101 * <ioctl>
2102 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2103 *
2104 * @INPUT: None
2105 *
2106 * @OUTPUT: print ibss peer in info logs
2107 * pPeerInfo->numIBSSPeers = 1
2108 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2109 *
2110 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2111 * in info logs
2112 *
2113 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2114 *
2115 * Supported Feature: IBSS
2116 *
2117 * Usage: Internal/External
2118 *
2119 * </ioctl>
2120 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002121#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002122/* Sub ioctls 11 to 16 are not used */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002123#define WE_GET_RECOVERY_STAT 17
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002124#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302125/*
2126 * <ioctl>
2127 * stop_obss_scan - Stop obss scan
2128 *
2129 * @INPUT: None
2130 *
2131 * @OUTPUT: None
2132 *
2133 * This IOCTL is used to stop obss scan
2134 *
2135 * @E.g: iwpriv wlan0 stop_obss_scan
2136 *
2137 * Supported Feature: Scan
2138 *
2139 * Usage: Internal/External
2140 *
2141 * </ioctl>
2142 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002143#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002144
2145/* Private ioctls and their sub-ioctls */
2146#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2147
2148#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302149/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002150
Manjeet Singhf82ed072016-07-08 11:40:00 +05302151#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002152
Kabilan Kannan6894e6a2017-11-09 14:37:55 -08002153/* subcommand 5 is unused */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302154
Abhishek Singh49b654e2016-12-01 16:11:17 +05302155/*
2156 * <ioctl>
2157 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2158 *
2159 * @INPUT: staid
2160 *
2161 * @OUTPUT: print ibss peer corresponding to staid in info logs
2162 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2163 *
2164 * This IOCTL is used to print the specific ibss peers's MAC,
2165 * rate and RSSI in info logs
2166 *
2167 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2168 * iwpriv wlan0 ibssPeerInfo 0
2169 *
2170 * Supported Feature: IBSS
2171 *
2172 * Usage: Internal/External
2173 *
2174 * </ioctl>
2175 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002176#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002177#define WE_UNIT_TEST_CMD 7
2178
2179#define WE_MTRACE_DUMP_CMD 8
2180#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2181
2182
2183#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2184#define WE_LED_FLASHING_PARAM 10
2185#endif
2186
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302187/*
2188 * <ioctl>
2189 * pm_clist - Increments the index value of the concurrent connection list
2190 * and update with the input parameters provided.
2191 *
2192 * @INPUT: Following 8 arguments:
2193 * @vdev_id: vdev id
2194 * @tx_streams: TX streams
2195 * @rx_streams: RX streams
2196 * @chain_mask: Chain mask
2197 * @type: vdev_type
2198 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2199 * @sub_type: vdev_subtype
2200 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2201 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2202 * @channel: Channel
2203 * @mac: Mac id
2204 *
2205 * @OUTPUT: None
2206 *
2207 * This IOCTL is used to increments the index value of the concurrent connection
2208 * list and update with the input parameters provided.
2209 *
2210 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2211 * sub_type channel mac
2212 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2213 *
2214 * Supported Feature: DBS
2215 *
2216 * Usage: Internal/External
2217 *
2218 * </ioctl>
2219 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002220#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302221
2222/*
2223 * <ioctl>
2224 * pm_dlist - Delete the index from the concurrent connection list that is
2225 * present in the given vdev_id.
2226 *
2227 * @INPUT: delete_all, vdev_id
2228 * @delete_all: delete all indices
2229 * @vdev_id: vdev id
2230 *
2231 * @OUTPUT: None
2232 *
2233 * This IOCTL is used to delete the index from the concurrent connection list
2234 * that is present in the given vdev_id.
2235 *
2236 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2237 * iwpriv wlan0 pm_dlist 0 1
2238 *
2239 * Supported Feature: DBS
2240 *
2241 * Usage: Internal/External
2242 *
2243 * </ioctl>
2244 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002245#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302246
2247/*
2248 * <ioctl>
2249 * pm_dbs - Set dbs capability and system preference
2250 *
2251 * @INPUT: dbs, system_pref
2252 * @dbs: Value of DBS capability to be set
2253 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002254 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302255 *
2256 * @OUTPUT: None
2257 *
2258 * This IOCTL is used to set dbs capability and system preference.
2259 *
2260 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2261 * iwpriv wlan0 pm_dbs 1 0
2262 *
2263 * Supported Feature: DBS
2264 *
2265 * Usage: Internal/External
2266 *
2267 * </ioctl>
2268 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002269#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302270
2271/*
2272 * <ioctl>
2273 * pm_pcl - Set pcl for concurrency mode.
2274 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002275 * @INPUT: policy_mgr_con_mode
2276 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302277 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2278 *
2279 * @OUTPUT: None
2280 *
2281 * This IOCTL is used to set pcl for concurrency mode.
2282 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002283 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302284 * iwpriv wlan0 pm_pcl 0
2285 *
2286 * Supported Feature: DBS
2287 *
2288 * Usage: Internal/External
2289 *
2290 * </ioctl>
2291 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002292#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302293
2294/*
2295 * <ioctl>
2296 * pm_cinfo - Shows the concurrent connection list.
2297 *
2298 * @INPUT: None
2299 *
2300 * @OUTPUT: None
2301 *
2302 * This IOCTL is used to show the concurrent connection list.
2303 *
2304 * @E.g: iwpriv wlan0 pm_cinfo
2305 *
2306 * Supported Feature: DBS
2307 *
2308 * Usage: Internal/External
2309 *
2310 * </ioctl>
2311 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002312#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302313
2314/*
2315 * <ioctl>
2316 * pm_ulist - Updates the index value of the concurrent connection list
2317 * with the input parameters provided.
2318 *
2319 * @INPUT: Following 8 arguments:
2320 * @vdev_id: vdev id
2321 * @tx_streams: TX streams
2322 * @rx_streams: RX streams
2323 * @chain_mask: Chain mask
2324 * @type: vdev_type
2325 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2326 * @sub_type: vdev_subtype
2327 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2328 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2329 * @channel: Channel
2330 * @mac: Mac id
2331 *
2332 * @OUTPUT: None
2333 *
2334 * This IOCTL is used to updates the index value of the concurrent
2335 * connection list with the input parameters provided.
2336 *
2337 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2338 * sub_type channel mac
2339 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2340 *
2341 * Supported Feature: DBS
2342 *
2343 * Usage: Internal/External
2344 *
2345 * </ioctl>
2346 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002347#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302348
2349/*
2350 * <ioctl>
2351 * pm_query_action - Initiate actions needed on current connections as
2352 * per the channel provided.
2353 *
2354 * @INPUT: channel
2355 * @channel: Channel on which new connection will be.
2356 *
2357 * @OUTPUT: None
2358 *
2359 * This IOCTL is used to initiate actions needed on current connections
2360 * as per the channel provided.
2361 *
2362 * @E.g: iwpriv wlan0 pm_query_action channel
2363 * iwpriv wlan0 pm_query_action 6
2364 *
2365 * Supported Feature: DBS
2366 *
2367 * Usage: Internal/External
2368 *
2369 * </ioctl>
2370 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002371#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302372
2373/*
2374 * <ioctl>
2375 * pm_query_allow - Checks for allowed concurrency combination
2376 *
2377 * @INPUT: mode, channel, bandwidth
2378 * @mode: new connection mode
2379 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2380 * @channel: channel on which new connection is coming up
2381 * @bandwidth: Bandwidth requested by the connection
2382 * 0:None 1:5MHz 2:10MHz 3:20MHz
2383 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2384 *
2385 * @OUTPUT: None
2386 *
2387 * This IOCTL is used to checks for allowed concurrency combination.
2388 *
2389 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2390 * iwpriv wlan0 pm_query_allow 0 6 4
2391 *
2392 * Supported Feature: DBS
2393 *
2394 * Usage: Internal/External
2395 *
2396 * </ioctl>
2397 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002398#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302399
2400/*
2401 * <ioctl>
2402 * pm_run_scenario - Create scenario with number of connections provided.
2403 *
2404 * @INPUT: num_of_conn
2405 * @num_of_conn: the number of connections (values: 1~3)
2406 *
2407 * @OUTPUT: None
2408 *
2409 * This IOCTL is used to create scenario with the number of connections
2410 * provided.
2411 *
2412 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2413 * iwpriv wlan0 pm_run_scenario 1
2414 *
2415 * Supported Feature: DBS
2416 *
2417 * Usage: Internal/External
2418 *
2419 * </ioctl>
2420 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002421#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302422
2423/*
2424 * <ioctl>
2425 * pm_set_hw_mode - Set hardware for single/dual mac.
2426 *
2427 * @INPUT: hw_mode
2428 * 0:single mac 1:dual mac
Liangwei Dong509c3472018-05-30 07:05:59 -04002429 * 2: 2x2 5g + 1x1 2g dbs mode
2430 * 3: 2x2 2g + 1x1 5g dbs mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302431 *
2432 * @OUTPUT: None
2433 *
2434 * This IOCTL is used to set hardware for single/dual mac.
2435 *
2436 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2437 * iwpriv wlan0 pm_set_hw_mode 1
2438 *
2439 * Supported Feature: DBS
2440 *
2441 * Usage: Internal/External
2442 *
2443 * </ioctl>
2444 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002445#define WE_POLICY_SET_HW_MODE_CMD 20
2446
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302447/*
2448 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002449 * ch_avoid - unit test SAP channel avoidance
2450 *
2451 * @INPUT: chan avoid ranges
2452 *
2453 * @OUTPUT: none
2454 *
2455 * This IOCTL is used to fake a channel avoidance event.
2456 * To test SAP/GO chan switch during chan avoid event process.
2457 *
2458 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2459 *
2460 * Supported Feature: SAP chan avoidance.
2461 *
2462 * Usage: Internal
2463 *
2464 * </ioctl>
2465 */
2466#define WE_SET_CHAN_AVOID 21
2467
2468/*
2469 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302470 * set_scan_cfg - Set dual MAC scan config parameters.
2471 *
2472 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2473 * @dbs: Value of DBS bit
2474 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2475 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2476 *
2477 * @OUTPUT: None
2478 *
2479 * This IOCTL is used to set the dual MAC scan config.
2480 *
2481 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2482 * single_mac_scan_with_dbs
2483 * iwpriv wlan0 set_scan_cfg 1 0 1
2484 *
2485 * Supported Feature: DBS
2486 *
2487 * Usage: Internal/External
2488 *
2489 * </ioctl>
2490 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002491#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302492
2493/*
2494 * <ioctl>
2495 * set_fw_mode_cfg - Sets the dual mac FW mode config
2496 *
2497 * @INPUT: dbs, dfs
2498 * @dbs: DBS bit
2499 * @dfs: Agile DFS bit
2500 *
2501 * @OUTPUT: None
2502 *
2503 * This IOCTL is used to set the dual mac FW mode config.
2504 *
2505 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2506 * iwpriv wlan0 set_fw_mode_cfg 1 1
2507 *
2508 * Supported Feature: DBS
2509 *
2510 * Usage: Internal/External
2511 *
2512 * </ioctl>
2513 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002514#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002515#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002516/*
2517 * <ioctl>
2518 * txrx_stats - TXRX statistics query
2519 *
2520 * @INPUT: query category, mac id (default mac id is 0)
2521 *
2522 * @OUTPUT: TXRX statistics result
2523 *
2524 * This IOCTL is used to get TXRX statistics counters.
2525 *
2526 * @E.g: iwpriv wlan0 txrx_stats 21 0
2527 * iwpriv wlan0 txrx_stats 21 1
2528 *
2529 * Usage: Internal
2530 *
2531 * </ioctl>
2532 */
2533#define WE_SET_TXRX_STATS 24
2534
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002535
2536#ifdef FEATURE_WLAN_TDLS
2537#undef MAX_VAR_ARGS
2538#define MAX_VAR_ARGS 11
2539#else
2540#undef MAX_VAR_ARGS
2541#define MAX_VAR_ARGS 9
2542#endif
2543
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002544/*
2545 * <ioctl>
2546 * fips_test - Perform a FIPS test
2547 *
2548 * @INPUT: Binary representation of the following packed structure
2549 *
2550 * @OUTPUT: Binary representation of the following packed structure
2551 *
2552 * This IOCTL is used to perform FIPS certification testing
2553 *
2554 * @E.g: iwpriv wlan0 fips_test <test vector>
2555 *
2556 * iwpriv wlan0 fips_test <tbd>
2557 *
2558 * Supported Feature: FIPS
2559 *
2560 * Usage: Internal
2561 *
2562 * </ioctl>
2563 */
2564#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2565
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002566/* Private ioctls (with no sub-ioctls) */
2567/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302568/*
2569 * <ioctl>
2570 * addTspec - Add TSPEC for each AC
2571 *
2572 * @INPUT: 19 TSPEC params
2573 * @[arg0]: handle
2574 * @[arg1]: tid
2575 * @[arg2]: dir
2576 * @[arg3]: psb
2577 * @[arg4]: up
2578 * @[arg5]: nomMsduSize
2579 * @[arg6]: maxMsduSize
2580 * @[arg7]: minDataRate
2581 * @[arg8]: meanDataRate
2582 * @[arg9]: peakDataRate
2583 * @[arg10]: maxBurstSize
2584 * @[arg11]: minPhyRate
2585 * @[arg12]: sba
2586 * @[arg13]: minServiceIntv
2587 * @[arg14]: suspendIntv
2588 * @[arg15]: burstSizeDefn
2589 * @[arg16]: ackPolicy
2590 * @[arg17]: inactivityPeriod
2591 * @[arg18]: maxServiceIntv
2592 *
2593 * @OUTPUT: Success/Failure
2594 *
2595 * This IOCTL is used to add TSPEC for each AC.
2596 *
2597 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2598 * <maxMsduSize> <minDataRate> <meanDataRate>
2599 * <peakDataRate> <maxBurstSize> <minPhyRate>
2600 * <sba> <minServiceIntv> <suspendIntv>
2601 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2602 * <maxServiceIntv>
2603 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2604 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2605 * wlan0 addTspec:3
2606 *
2607 * Supported Feature: WMM
2608 *
2609 * Usage: Internal/External
2610 *
2611 * </ioctl>
2612 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002613#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302614/*
2615 * <ioctl>
2616 * delTspec - Delete TSPEC entry for each AC
2617 *
2618 * @INPUT: 1 TSPEC param
2619 * @[arg0]: handle
2620 *
2621 * @OUTPUT: Success/Failure
2622 *
2623 * This IOCTL is used to delete TSPEC entry for each AC.
2624 *
2625 * @E.g: iwpriv wlan0 delTspec <handle>
2626 * iwpriv wlan0 delTspec 7001
2627 * wlan0 delTspec:16
2628 *
2629 * Supported Feature: WMM
2630 *
2631 * Usage: Internal/External
2632 *
2633 * </ioctl>
2634 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002635#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302636/*
2637 * <ioctl>
2638 * getTspec - Get TSPEC entry for each AC
2639 *
2640 * @INPUT: 1 TSPEC param
2641 * @[arg0]: handle
2642 *
2643 * @OUTPUT: Success/Failure
2644 *
2645 * This IOCTL is used to get TSPEC entry for each AC.
2646 *
2647 * @E.g: iwpriv wlan0 getTspec <handle>
2648 * iwpriv wlan0 getTspec 7001
2649 * wlan0 delTspec:18
2650 *
2651 * Supported Feature: WMM
2652 *
2653 * Usage: Internal/External
2654 *
2655 * </ioctl>
2656 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002657#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2658
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002659/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2660/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2661/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002662#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2663#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002664/* (SIOCIWFIRSTPRIV + 16) is currently unused */
2665/* (SIOCIWFIRSTPRIV + 17) is currently unused */
2666/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2667
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002668#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002669
2670/* Private ioctl for setting the host offload feature */
2671#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2672
2673/* Private ioctl to get the statistics */
2674#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2675
2676/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302677/*
2678 * <ioctl>
2679 * setKeepAlive - Set the keep alive feature
2680 *
2681 * @INPUT: 28 bytes of information in the order of packet type, time period
2682 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2683 *
2684 * @OUTPUT: None
2685 *
2686 * This IOCTL sets the keep alive feature to send either NULL
2687 * or unsolicited ARP response packets
2688 *
2689 * @E.g: iwpriv wlan0 setKeepAlive
2690 *
2691 * Supported Feature: STA
2692 *
2693 * Usage: Internal/External
2694 *
2695 * </ioctl>
2696 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002697#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2698
2699#ifdef WLAN_FEATURE_PACKET_FILTERING
2700/* Private ioctl to set the packet filtering params */
2701#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2702#endif
2703
2704
2705#ifdef FEATURE_WLAN_SCAN_PNO
2706/* Private ioctl to get the statistics */
2707#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2708#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302709/*
2710 * <ioctl>
2711 * SETBAND - Set the operational band
2712 *
2713 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2714 *
2715 * @OUTPUT: None
2716 *
2717 * This IOCTL Set the operational band If the new band is different from the
2718 * current operational band, it aborts the pending scan requests, flushes
2719 * the existing scan results, and then change * the band capability
2720 *
2721 * @E.g: iwpriv wlan0 SETBAND <value>
2722 *
2723 * Supported Feature: STA
2724 *
2725 * Usage: Internal/External
2726 *
2727 * </ioctl>
2728 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002729#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2730
Dustin Brown0cbc7572016-12-16 13:54:40 -08002731#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002732/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002733
2734/* Private ioctls and their sub-ioctls */
2735#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2736#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002737#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002738#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302739/* Private sub ioctl for enabling and setting histogram interval of profiling */
2740#define WE_ENABLE_FW_PROFILE 4
2741#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002742
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002743/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002744#define WE_SET_WLAN_SUSPEND 6
2745#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002746
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002747/*
2748 * <ioctl>
2749 * log_buffer - prints host/target related communication logs via dmesg
2750 *
2751 * @INPUT: Log Id, Count
2752 *
2753 * Log Id:
2754 * 0) HTC_CREDIT_HISTORY_LOG
2755 * 1) COMMAND_LOG,
2756 * 2) COMMAND_TX_CMP_LOG,
2757 * 3) MGMT_COMMAND_LOG,
2758 * 4) MGMT_COMMAND_TX_CMP_LOG,
2759 * 5) EVENT_LOG,
2760 * 6) RX_EVENT_LOG,
2761 * 7) MGMT_EVENT_LOG
2762 *
2763 * @OUTPUT: None
2764 *
2765 * @E.g:
2766 * # print up to 10 of the most recent records from HTC Credit History
2767 * iwpriv wlan0 log_buffer 0 10
2768 * # print up to 3 of the most recent records from Event Log
2769 * iwpriv wlan0 log_buffer 5 3
2770 *
2771 * Supported Feature: WLAN Trace
2772 *
2773 * Usage: Internal/External
2774 *
2775 * </ioctl>
2776 */
2777#define WE_LOG_BUFFER 8
2778
Krunal Soni6c3859f2018-06-01 19:57:40 -07002779/*
2780 * <ioctl>
2781 * set_ba_timeout - sets Block ACK aging timeout value for each Access class
2782 *
2783 * @INPUT: Access Class [0:BK, 1:BE, 2:VI, 3:VO], Timeout value
2784 *
2785 * @OUTPUT: None
2786 *
2787 * @E.g.:
2788 * # to set duration of 2 seconds for BE
2789 * iwpriv wlan0 set_ba_timeout 1 2
2790 * # to set duration of 3 seconds for VO
2791 * iwpriv wlan0 set_ba_timeout 3 3
2792 *
2793 * Usage: Internal
2794 *
2795 * </ioctl>
2796 */
2797#define WE_SET_BA_AGEING_TIMEOUT 9
2798
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002799enum host_target_comm_log {
2800 HTC_CREDIT_HISTORY_LOG = 0,
2801 COMMAND_LOG,
2802 COMMAND_TX_CMP_LOG,
2803 MGMT_COMMAND_LOG,
2804 MGMT_COMMAND_TX_CMP_LOG,
2805 EVENT_LOG,
2806 RX_EVENT_LOG,
2807 MGMT_EVENT_LOG
2808};
2809
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002810/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2811
2812/* 802.11p IOCTL */
2813#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2814
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302815/*
2816 * <ioctl>
2817 * getLinkSpeed - Gets the current link speed in Mbps
2818 *
2819 * @INPUT: None
2820 *
2821 * @OUTPUT: linkspeed in mbps
2822 * wlan0 getLinkSpeed:7
2823 *
2824 * This IOCTL is used get the current link speed in Mbps
2825 *
2826 * @E.g: iwpriv wlan0 getLinkSpeed
2827 *
2828 * Supported Feature: STA
2829 *
2830 * Usage: Internal/External
2831 *
2832 * </ioctl>
2833 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002834#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2835
2836#define WLAN_STATS_INVALID 0
2837#define WLAN_STATS_RETRY_CNT 1
2838#define WLAN_STATS_MUL_RETRY_CNT 2
2839#define WLAN_STATS_TX_FRM_CNT 3
2840#define WLAN_STATS_RX_FRM_CNT 4
2841#define WLAN_STATS_FRM_DUP_CNT 5
2842#define WLAN_STATS_FAIL_CNT 6
2843#define WLAN_STATS_RTS_FAIL_CNT 7
2844#define WLAN_STATS_ACK_FAIL_CNT 8
2845#define WLAN_STATS_RTS_SUC_CNT 9
2846#define WLAN_STATS_RX_DISCARD_CNT 10
2847#define WLAN_STATS_RX_ERROR_CNT 11
2848#define WLAN_STATS_TX_BYTE_CNT 12
2849
2850#define WLAN_STATS_RX_BYTE_CNT 13
2851#define WLAN_STATS_RX_RATE 14
2852#define WLAN_STATS_TX_RATE 15
2853
2854#define WLAN_STATS_RX_UC_BYTE_CNT 16
2855#define WLAN_STATS_RX_MC_BYTE_CNT 17
2856#define WLAN_STATS_RX_BC_BYTE_CNT 18
2857#define WLAN_STATS_TX_UC_BYTE_CNT 19
2858#define WLAN_STATS_TX_MC_BYTE_CNT 20
2859#define WLAN_STATS_TX_BC_BYTE_CNT 21
2860
2861#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2862 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2863 *__p++ = __type; \
2864 *__p++ = __size; \
2865 memcpy(__p, __val, __size); \
2866 __p += __size; \
2867 __tlen += __size + 2; \
2868 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002869 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002870 } \
2871 } while (0)
2872
2873#define VERSION_VALUE_MAX_LEN 32
2874
2875#define TX_PER_TRACKING_DEFAULT_RATIO 5
2876#define TX_PER_TRACKING_MAX_RATIO 10
2877#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2878
2879#define WLAN_ADAPTER 0
2880#define P2P_ADAPTER 1
2881
2882/**
2883 * mem_alloc_copy_from_user_helper - copy from user helper
2884 * @wrqu_data: wireless extensions request data
2885 * @len: length of @wrqu_data
2886 *
2887 * Helper function to allocate buffer and copy user data.
2888 *
2889 * Return: On success return a pointer to a kernel buffer containing a
2890 * copy of the userspace data (with an additional NUL character
2891 * appended for safety). On failure return %NULL.
2892 */
2893void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2894{
2895 u8 *ptr = NULL;
2896
2897 /* in order to protect the code, an extra byte is post
2898 * appended to the buffer and the null termination is added.
2899 * However, when allocating (len+1) byte of memory, we need to
2900 * make sure that there is no uint overflow when doing
2901 * addition. In theory check len < UINT_MAX protects the uint
2902 * overflow. For wlan private ioctl, the buffer size is much
2903 * less than UINT_MAX, as a good guess, now, it is assumed
2904 * that the private command buffer size is no greater than 4K
2905 * (4096 bytes). So we use 4096 as the upper boundary for now.
2906 */
2907 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002908 hdd_err("Invalid length: %zu max: %u",
2909 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002910 return NULL;
2911 }
2912
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002913 ptr = qdf_mem_malloc(len + 1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002914 if (NULL == ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002915 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002916 return NULL;
2917 }
2918
2919 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002920 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002921 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002922 return NULL;
2923 }
2924 ptr[len] = '\0';
2925 return ptr;
2926}
2927
2928/**
2929 * hdd_priv_get_data() - Get pointer to ioctl private data
2930 * @p_priv_data: pointer to iw_point struct to be filled
2931 * @wrqu: Pointer to IOCTL Data received from userspace
2932 *
2933 * Helper function to get compatible struct iw_point passed to ioctl
2934 *
2935 * Return - 0 if p_priv_data successfully filled, error otherwise
2936 */
2937int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
2938{
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002939 if ((NULL == p_priv_data) || (NULL == wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002940 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002941
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002942#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07002943 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002944 struct compat_iw_point *p_compat_priv_data;
2945
2946 /* Compat task:
2947 * typecast to compat structure and copy the members.
2948 */
2949 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
2950
2951 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
2952 p_priv_data->length = p_compat_priv_data->length;
2953 p_priv_data->flags = p_compat_priv_data->flags;
2954 } else {
2955#endif /* #ifdef CONFIG_COMPAT */
2956
2957 /* Non compat task: directly copy the structure. */
2958 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
2959
2960#ifdef CONFIG_COMPAT
2961 }
2962#endif /* #ifdef CONFIG_COMPAT */
2963
2964 return 0;
2965}
2966
Jeff Johnson441e1f72017-02-07 08:50:49 -08002967static int hdd_check_wext_control(enum hdd_wext_control wext_control,
2968 struct iw_request_info *info)
2969{
2970 switch (wext_control) {
2971 default:
2972 case hdd_wext_disabled:
Jeff Johnsonb135c662018-10-12 12:24:07 -07002973 hdd_err_rl("Rejecting disabled ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08002974 return -ENOTSUPP;
2975 case hdd_wext_deprecated:
Jeff Johnsonb135c662018-10-12 12:24:07 -07002976 hdd_warn_rl("Using deprecated ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08002977 return 0;
2978 case hdd_wext_enabled:
2979 return 0;
2980 }
2981}
2982
Jeff Johnson82797b62017-08-11 15:31:27 -07002983int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08002984 struct iw_request_info *info)
2985{
2986 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
2987 info);
2988}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002989
2990/**
2991 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07002992 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002993 * @length: Size of the data copied
2994 * @buffer: Pointer to char buffer.
2995 * @buf_len: Length of the char buffer.
2996 *
2997 * This function called when the "iwpriv wlan0 get_stats" command is given.
2998 * It used to collect the txrx stats when the device is configured in SAP mode.
2999 *
3000 * Return - none
3001 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003002void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003003 char *buffer, uint16_t buf_len)
3004{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003005 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003006 uint32_t len = 0;
3007 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
3008 uint32_t total_rx_delv = 0, total_rx_refused = 0;
3009 int i = 0;
3010
3011 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003012 total_rx_pkt += stats->rx_packets[i];
3013 total_rx_dropped += stats->rx_dropped[i];
3014 total_rx_delv += stats->rx_delivered[i];
3015 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003016 }
3017
3018 len = scnprintf(buffer, buf_len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003019 "\nTransmit[%lu] - "
Mohit Khannad0b63f52017-02-18 18:05:52 -08003020 "called %u, dropped %u orphan %u,"
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003021 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
3022 "\n[classified] BK %u, BE %u, VI %u, VO %u"
3023 "\n\nReceive[%lu] - "
3024 "packets %u, dropped %u, delivered %u, refused %u"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003025 "\n",
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003026 qdf_system_ticks(),
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003027 stats->tx_called,
3028 stats->tx_dropped,
3029 stats->tx_orphaned,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003030
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003031 stats->tx_dropped_ac[SME_AC_BK],
3032 stats->tx_dropped_ac[SME_AC_BE],
3033 stats->tx_dropped_ac[SME_AC_VI],
3034 stats->tx_dropped_ac[SME_AC_VO],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003035
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003036 stats->tx_classified_ac[SME_AC_BK],
3037 stats->tx_classified_ac[SME_AC_BE],
3038 stats->tx_classified_ac[SME_AC_VI],
3039 stats->tx_classified_ac[SME_AC_VO],
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003040 qdf_system_ticks(),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003041 total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused
3042 );
3043
3044 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003045 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003046 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003047 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003048 "Rx CPU[%d]:"
3049 "packets %u, dropped %u, delivered %u, refused %u\n",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003050 i, stats->rx_packets[i], stats->rx_dropped[i],
3051 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003052 }
3053
3054 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003055 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003056 "\nCurrent status: %s"
3057 "\ntx-flow timer start count %u"
3058 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003059 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3060 stats->txflow_timer_cnt,
3061 stats->txflow_pause_cnt,
3062 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003063
Leo Changfdb45c32016-10-28 11:09:23 -07003064 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnson1b780e42017-10-31 14:11:45 -07003065 adapter->session_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003066 *length = len + 1;
3067}
3068
3069/**
Dustin Brownd9322482017-01-09 12:46:03 -08003070 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3071 * @hdd_ctx: The Hdd context owning the stats to be written
3072 * @buffer: The char buffer to write to
3073 * @max_len: The maximum number of chars to write
3074 *
3075 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3076 *
3077 * Return - length of written content, negative number on error
3078 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003079#ifdef QCA_SUPPORT_CP_STATS
3080static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
3081 char *buffer, uint16_t max_len)
3082{
3083 int ret;
3084 QDF_STATUS status;
3085 struct suspend_resume_stats *sr_stats;
3086
3087 sr_stats = &hdd_ctx->suspend_resume_stats;
3088 ret = scnprintf(buffer, max_len,
3089 "\n"
3090 "Suspends: %u\n"
3091 "Resumes: %u\n"
3092 "\n"
3093 "Suspend Fail Reasons\n"
3094 "\tIPA: %u\n"
3095 "\tRadar: %u\n"
3096 "\tRoam: %u\n"
3097 "\tScan: %u\n"
3098 "\tInitial Wakeup: %u\n"
3099 "\n",
3100 sr_stats->suspends, sr_stats->resumes,
3101 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3102 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3103 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3104 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3105 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]);
3106
Dustin Brown05d81302018-09-11 16:49:22 -07003107 status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->psoc,
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003108 &buffer[ret], max_len - ret,
3109 &ret);
3110 if (QDF_IS_STATUS_ERROR(status)) {
3111 hdd_err("Failed to get WoW stats");
3112 return qdf_status_to_os_return(status);
3113 }
3114
3115 return ret;
3116}
3117#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003118static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
Dustin Brownd9322482017-01-09 12:46:03 -08003119 char *buffer, uint16_t max_len)
3120{
3121 QDF_STATUS status;
3122 struct suspend_resume_stats *sr_stats;
3123 struct sir_wake_lock_stats wow_stats;
3124
3125 sr_stats = &hdd_ctx->suspend_resume_stats;
3126
3127 status = wma_get_wakelock_stats(&wow_stats);
3128 if (QDF_IS_STATUS_ERROR(status)) {
3129 hdd_err("Failed to get WoW stats");
3130 return qdf_status_to_os_return(status);
3131 }
3132
3133 return scnprintf(buffer, max_len,
3134 "\n"
3135 "Suspends: %u\n"
3136 "Resumes: %u\n"
3137 "\n"
3138 "Suspend Fail Reasons\n"
3139 "\tIPA: %u\n"
3140 "\tRadar: %u\n"
3141 "\tRoam: %u\n"
3142 "\tScan: %u\n"
3143 "\tInitial Wakeup: %u\n"
3144 "\n"
3145 "WoW Wake Reasons\n"
3146 "\tunicast: %u\n"
3147 "\tbroadcast: %u\n"
3148 "\tIPv4 multicast: %u\n"
3149 "\tIPv6 multicast: %u\n"
3150 "\tIPv6 multicast RA: %u\n"
3151 "\tIPv6 multicast NS: %u\n"
3152 "\tIPv6 multicast NA: %u\n"
3153 "\tICMPv4: %u\n"
3154 "\tICMPv6: %u\n"
3155 "\tRSSI Breach: %u\n"
3156 "\tLow RSSI: %u\n"
3157 "\tG-Scan: %u\n"
3158 "\tPNO Complete: %u\n"
3159 "\tPNO Match: %u\n",
3160 sr_stats->suspends,
3161 sr_stats->resumes,
3162 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3163 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3164 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3165 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3166 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP],
3167 wow_stats.wow_ucast_wake_up_count,
3168 wow_stats.wow_bcast_wake_up_count,
3169 wow_stats.wow_ipv4_mcast_wake_up_count,
3170 wow_stats.wow_ipv6_mcast_wake_up_count,
3171 wow_stats.wow_ipv6_mcast_ra_stats,
3172 wow_stats.wow_ipv6_mcast_ns_stats,
3173 wow_stats.wow_ipv6_mcast_na_stats,
3174 wow_stats.wow_icmpv4_count,
3175 wow_stats.wow_icmpv6_count,
3176 wow_stats.wow_rssi_breach_wake_up_count,
3177 wow_stats.wow_low_rssi_wake_up_count,
3178 wow_stats.wow_gscan_wake_up_count,
3179 wow_stats.wow_pno_complete_wake_up_count,
3180 wow_stats.wow_pno_match_wake_up_count);
3181}
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003182#endif
Dustin Brownd9322482017-01-09 12:46:03 -08003183/**
Govind Singha471e5e2015-10-12 17:11:14 +05303184 * hdd_wlan_list_fw_profile() - Get fw profiling points
3185 * @length: Size of the data copied
3186 * @buffer: Pointer to char buffer.
3187 * @buf_len: Length of the char buffer.
3188 *
3189 * This function called when the "iwpriv wlan0 listProfile" command is given.
3190 * It is used to get the supported profiling points in FW.
3191 *
3192 * Return - none
3193 */
3194void hdd_wlan_list_fw_profile(uint16_t *length,
3195 char *buffer, uint16_t buf_len)
3196{
3197 uint32_t len = 0;
3198
3199 len = scnprintf(buffer, buf_len,
3200 "PROF_CPU_IDLE: %u\n"
3201 "PROF_PPDU_PROC: %u\n"
3202 "PROF_PPDU_POST: %u\n"
3203 "PROF_HTT_TX_INPUT: %u\n"
3204 "PROF_MSDU_ENQ: %u\n"
3205 "PROF_PPDU_POST_HAL: %u\n"
3206 "PROF_COMPUTE_TX_TIME: %u\n",
3207 PROF_CPU_IDLE,
3208 PROF_PPDU_PROC,
3209 PROF_PPDU_POST,
3210 PROF_HTT_TX_INPUT,
3211 PROF_MSDU_ENQ,
3212 PROF_PPDU_POST_HAL,
3213 PROF_COMPUTE_TX_TIME);
3214
3215 *length = len + 1;
3216}
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003217/**
3218 * hdd_display_stats_help() - print statistics help
3219 *
3220 * Return: none
3221 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003222static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003223{
Nirav Shahe6194ac2018-07-13 11:04:41 +05303224 hdd_nofl_info("iwpriv wlan0 dumpStats [option] - dump statistics");
3225 hdd_nofl_info("iwpriv wlan0 clearStats [option] - clear statistics");
3226 hdd_nofl_info("options:");
3227 hdd_nofl_info(" 1 -- TXRX PATH statistics");
3228 hdd_nofl_info(" 2 -- TXRX HIST statistics");
3229 hdd_nofl_info(" 3 -- TSO statistics");
3230 hdd_nofl_info(" 4 -- Network queue statistics");
3231 hdd_nofl_info(" 5 -- Flow control statistics");
3232 hdd_nofl_info(" 6 -- Per Layer statistics");
3233 hdd_nofl_info(" 7 -- Copy engine interrupt statistics");
3234 hdd_nofl_info(" 9 -- NAPI statistics");
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003235}
Govind Singha471e5e2015-10-12 17:11:14 +05303236
3237/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003238 * hdd_wlan_dump_stats() - display dump Stats
3239 * @adapter: adapter handle
3240 * @value: value from user
3241 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003242 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003243 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003244int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003245{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003246 int ret = 0;
3247 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003248 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003249
Jeff Johnson0e07ca12018-11-12 21:04:45 -08003250 hdd_debug("%d", value);
3251
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003252 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003253 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003254 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3255 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003256
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003257 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003258 wlan_hdd_display_netif_queue_history
3259 (hdd_ctx,
3260 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003261 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003262
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003263 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303264 hdd_display_hif_stats();
3265 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003266
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003267 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003268 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303269 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003270
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003271 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003272 if (hdd_display_napi_stats()) {
3273 hdd_err("error displaying napi stats");
3274 ret = EFAULT;
3275 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003276 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003277
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303278 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003279 sme_display_disconnect_stats(hdd_ctx->mac_handle,
3280 adapter->session_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303281 break;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07003282
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003283 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003284 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003285 value,
3286 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003287 if (status == QDF_STATUS_E_INVAL) {
3288 hdd_display_stats_help();
3289 ret = EINVAL;
3290 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003291 break;
3292 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003293 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003294}
3295
3296/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003297 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003298 * @adapter: Adapter upon which the IBSS client is active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003299 * @staIdx: Station index of the IBSS peer
3300 *
3301 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3302 * otherwise an appropriate QDF_STATUS_E_* failure code.
3303 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003304static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnsonaf2a0932016-10-05 14:52:57 -07003305 uint8_t staIdx)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003306{
3307 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003308 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003309 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003310 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003311
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003312 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003313 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003314 hdd_get_ibss_peer_info_cb,
3315 false, staIdx);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003316
3317 if (QDF_STATUS_SUCCESS == status) {
3318 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003319
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003320 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003321 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003322 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3323 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003324 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003325 return QDF_STATUS_E_FAILURE;
3326 }
3327
3328 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003329 hdd_debug("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003330 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003331 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3332 uint32_t tx_rate = pPeerInfo->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003333
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003334 qdf_mem_copy(mac_addr, pPeerInfo->peerInfoParams[0].
3335 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003336 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003337 mac_addr, (int)tx_rate,
3338 (int)pPeerInfo->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003339 }
3340 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003341 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003342 }
3343
3344 return status;
3345}
3346
3347/**
3348 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003349 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003350 *
3351 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3352 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3353 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003354static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003355{
3356 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003357 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003358 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003359 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003360 int i;
3361
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003362 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003363 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003364 hdd_get_ibss_peer_info_cb,
3365 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003366
3367 if (QDF_STATUS_SUCCESS == status) {
3368 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003369
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003370 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003371 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003372 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3373 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003374 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003375 return QDF_STATUS_E_FAILURE;
3376 }
3377
3378 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003379 hdd_debug("pPeerInfo->numIBSSPeers = %d ",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003380 (int)pPeerInfo->numPeers);
3381 for (i = 0; i < pPeerInfo->numPeers; i++) {
3382 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3383 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003384
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003385 tx_rate = pPeerInfo->peerInfoParams[i].txRate;
3386 qdf_mem_copy(mac_addr,
3387 pPeerInfo->peerInfoParams[i].mac_addr,
3388 sizeof(mac_addr));
3389
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003390 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003391 mac_addr, (int)tx_rate,
3392 (int)pPeerInfo->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003393 }
3394 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003395 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003396 }
3397
3398 return status;
3399}
3400
3401/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303402 * hdd_get_ldpc() - Get adapter LDPC
3403 * @adapter: adapter being queried
3404 * @value: where to store the value
3405 *
3406 * Return: 0 on success, negative errno on failure
3407 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003408int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303409{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003410 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303411 int ret;
3412
Dustin Brown491d54b2018-03-14 12:39:11 -07003413 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003414 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303415 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3416 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003417 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303418 } else {
3419 *value = ret;
3420 ret = 0;
3421 }
3422 return ret;
3423}
3424
Jeff Johnson3d278b02017-08-29 14:17:47 -07003425int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303426{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003427 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303428 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003429 QDF_STATUS status;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003430 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303431 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303432
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003433 hdd_debug("%d", value);
Jeff Johnson1ca04762018-10-25 10:24:39 -07003434
3435 if (!mac_handle) {
3436 hdd_err("NULL Mac handle");
3437 return -EINVAL;
3438 }
3439
Dustin Brown05d81302018-09-11 16:49:22 -07003440 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003441 if (QDF_STATUS_SUCCESS != status) {
3442 hdd_err("Failed to get HT capability info");
3443 return -EIO;
3444 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003445
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303446 ht_cap_info.adv_coding_cap = value;
Dustin Brown05d81302018-09-11 16:49:22 -07003447 status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003448 if (QDF_STATUS_SUCCESS != status) {
3449 hdd_err("Failed to set HT capability info");
3450 return -EIO;
3451 }
Vignesh Viswanathanecd4de72018-11-22 13:02:20 +05303452 status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303453 if (QDF_IS_STATUS_ERROR(status)) {
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003454 hdd_err("Failed to set VHT LDPC capability info");
3455 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303456 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003457 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303458 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
3459 value);
3460 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003461 hdd_err("Failed to set LDPC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003462 ret = sme_update_he_ldpc_supp(mac_handle, adapter->session_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003463 if (ret)
3464 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303465
3466 return ret;
3467}
3468
3469/**
3470 * hdd_get_tx_stbc() - Get adapter TX STBC
3471 * @adapter: adapter being queried
3472 * @value: where to store the value
3473 *
3474 * Return: 0 on success, negative errno on failure
3475 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003476int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303477{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003478 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303479 int ret;
3480
Dustin Brown491d54b2018-03-14 12:39:11 -07003481 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003482 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303483 WNI_CFG_HT_CAP_INFO_TX_STBC);
3484 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003485 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303486 } else {
3487 *value = ret;
3488 ret = 0;
3489 }
3490
3491 return ret;
3492}
3493
Jeff Johnson3d278b02017-08-29 14:17:47 -07003494int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303495{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003496 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303497 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303498 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303499 QDF_STATUS status;
3500 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303501
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003502 hdd_debug("%d", value);
Jeff Johnson57ff4fa2018-10-25 10:29:47 -07003503
3504 if (!mac_handle) {
3505 hdd_err("NULL Mac handle");
3506 return -EINVAL;
3507 }
3508
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303509 if (value) {
3510 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003511 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303512 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303513 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003514 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303515 return -EIO;
3516 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303517 if (!ht_cap_info.tx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003518 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303519 return -EINVAL;
3520 }
3521 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003522 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303523 WNI_CFG_HT_CAP_INFO_TX_STBC,
3524 value);
3525 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003526 hdd_err("Failed to set TX STBC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003527 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003528 if (ret)
3529 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303530
3531 return ret;
3532}
3533
3534/**
3535 * hdd_get_rx_stbc() - Get adapter RX STBC
3536 * @adapter: adapter being queried
3537 * @value: where to store the value
3538 *
3539 * Return: 0 on success, negative errno on failure
3540 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003541int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303542{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003543 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303544 int ret;
3545
Dustin Brown491d54b2018-03-14 12:39:11 -07003546 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003547 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303548 WNI_CFG_HT_CAP_INFO_RX_STBC);
3549 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003550 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303551 } else {
3552 *value = ret;
3553 ret = 0;
3554 }
3555
3556 return ret;
3557}
3558
Jeff Johnson3d278b02017-08-29 14:17:47 -07003559int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303560{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003561 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303562 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303563 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303564 QDF_STATUS status;
3565 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303566
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003567 hdd_debug("%d", value);
Jeff Johnsonb6645852018-10-25 10:35:41 -07003568
3569 if (!mac_handle) {
3570 hdd_err("NULL Mac handle");
3571 return -EINVAL;
3572 }
3573
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303574 if (value) {
3575 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003576 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303577 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303578 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003579 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303580 return -EIO;
3581 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303582 if (!ht_cap_info.rx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003583 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303584 return -EINVAL;
3585 }
3586 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003587 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303588 WNI_CFG_HT_CAP_INFO_RX_STBC,
3589 value);
3590 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003591 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303592
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003593 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003594 if (ret)
3595 hdd_err("Failed to set HE RX STBC value");
3596
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303597 return ret;
3598}
3599
3600/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003601 * iw_get_linkspeed() - Get current link speed ioctl
3602 * @dev: device upon which the ioctl was received
3603 * @info: ioctl request information
3604 * @wrqu: ioctl request data
3605 * @extra: extra ioctl buffer
3606 *
3607 * Return: 0 on success, non-zero on error
3608 */
3609static int __iw_get_linkspeed(struct net_device *dev,
3610 struct iw_request_info *info,
3611 union iwreq_data *wrqu, char *extra)
3612{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003613 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003614 char *pLinkSpeed = (char *)extra;
3615 int len = sizeof(uint32_t) + 1;
3616 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003617 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003618 int ret;
3619 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003620
Dustin Brownfdf17c12018-03-14 12:55:34 -07003621 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303622
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003623 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003624 ret = wlan_hdd_validate_context(hdd_ctx);
3625 if (0 != ret)
3626 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003627
Jeff Johnson441e1f72017-02-07 08:50:49 -08003628 ret = hdd_check_private_wext_control(hdd_ctx, info);
3629 if (0 != ret)
3630 return ret;
3631
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003632 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003633 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003634 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003635
3636 wrqu->data.length = len;
3637 /* return the linkspeed as a string */
3638 rc = snprintf(pLinkSpeed, len, "%u", link_speed);
3639 if ((rc < 0) || (rc >= len)) {
3640 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003641 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003642 return -EIO;
3643 }
3644
Dustin Browne74003f2018-03-14 12:51:58 -07003645 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003646 /* a value is being successfully returned */
3647 return 0;
3648}
3649
3650static int iw_get_linkspeed(struct net_device *dev,
3651 struct iw_request_info *info,
3652 union iwreq_data *wrqu, char *extra)
3653{
3654 int ret;
3655
3656 cds_ssr_protect(__func__);
3657 ret = __iw_get_linkspeed(dev, info, wrqu, extra);
3658 cds_ssr_unprotect(__func__);
3659
3660 return ret;
3661}
3662
Jeff Johnsonc1713242018-10-23 13:45:42 -07003663int wlan_hdd_update_phymode(struct hdd_adapter *adapter, int new_phymode)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003664{
Jeff Johnsonc1713242018-10-23 13:45:42 -07003665 struct net_device *net = adapter->dev;
3666 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
3667 mac_handle_t mac_handle = phddctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003668 bool band_24 = false, band_5g = false;
3669 bool ch_bond24 = false, ch_bond5g = false;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303670 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003671 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303672 uint8_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003673 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07003674 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003675 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303676 int retval = 0;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303677 uint8_t band_capability;
3678 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003679
Jeff Johnsonc1713242018-10-23 13:45:42 -07003680 if (!mac_handle)
3681 return -EINVAL;
3682
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003683 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003684
3685 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
3686 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
3687 nChannelBondingMode24GHz))
3688 ch_bond24 = true;
3689
3690 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
3691 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
3692 nChannelBondingMode5GHz))
3693 ch_bond5g = true;
3694
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303695 status = wlan_mlme_get_band_capability(phddctx->psoc, &band_capability);
3696 if (QDF_IS_STATUS_ERROR(status)) {
3697 hdd_err("Failed to get MLME Band capability");
3698 return -EIO;
3699 }
3700
3701 if (band_capability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003702 band_24 = band_5g = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303703 else if (band_capability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003704 band_24 = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303705 else if (band_capability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003706 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003707
Jeff Johnsonc1713242018-10-23 13:45:42 -07003708 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc, &vhtchanwidth);
3709 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003710 hdd_err("Failed to get channel_width");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303711
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003712 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 -08003713 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3714
3715 switch (new_phymode) {
3716 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003717 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003718 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003719 phymode = eCSR_DOT11_MODE_AUTO;
3720 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3721 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003722 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003723 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3724 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003725 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003726 return -EIO;
3727 }
3728 break;
3729 case IEEE80211_MODE_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003730 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003731 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003732 phymode = eCSR_DOT11_MODE_11a;
3733 hdd_dot11mode = eHDD_DOT11_MODE_11a;
3734 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003735 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003736 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003737 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003738 return -EIO;
3739 }
3740 break;
3741 case IEEE80211_MODE_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003742 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003743 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003744 phymode = eCSR_DOT11_MODE_11b;
3745 hdd_dot11mode = eHDD_DOT11_MODE_11b;
3746 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003747 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003748 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003749 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003750 return -EIO;
3751 }
3752 break;
3753 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003754 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003755 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003756 phymode = eCSR_DOT11_MODE_11g;
3757 hdd_dot11mode = eHDD_DOT11_MODE_11g;
3758 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003759 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003760 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003761 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003762 return -EIO;
3763 }
3764 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07003765 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003766 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
3767 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
3768 */
3769 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003770 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003771 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003772 phymode = eCSR_DOT11_MODE_11n;
3773 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3774 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003775 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003776 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003777 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003778 return -EIO;
3779 }
3780 break;
3781 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003782 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003783 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003784 phymode = eCSR_DOT11_MODE_11n;
3785 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3786 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003787 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003788 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003789 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003790 return -EIO;
3791 }
3792 break;
3793 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003794 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003795 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003796 phymode = eCSR_DOT11_MODE_11n;
3797 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3798 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003799 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003800 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003801 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003802 return -EIO;
3803 }
3804 break;
3805 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003806 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003807 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003808 phymode = eCSR_DOT11_MODE_11n;
3809 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3810 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003811 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003812 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003813 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003814 return -EIO;
3815 }
3816 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003817 case IEEE80211_MODE_11AC_VHT20:
3818 case IEEE80211_MODE_11AC_VHT40:
3819 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003820 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003821 phymode = eCSR_DOT11_MODE_11ac;
3822 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
3823 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3824 if (band_5g && band_24) {
3825 curr_band = BAND_ALL;
3826 break;
3827 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003828 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003829 break;
3830 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
3831 curr_band = BAND_2G;
3832 break;
3833 }
3834 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
3835 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003836 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003837 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003838 return -EIO;
3839 }
3840 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003841 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003842 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003843 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003844 phymode = eCSR_DOT11_MODE_AUTO;
3845 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3846 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003847 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003848 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003849 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003850 return -EIO;
3851 }
3852 break;
3853 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003854 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003855 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003856 phymode = eCSR_DOT11_MODE_AUTO;
3857 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3858 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3859 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003860 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003861 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003862 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003863 return -EIO;
3864 }
3865 break;
3866 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003867 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003868 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003869 phymode = eCSR_DOT11_MODE_11n;
3870 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3871 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003872 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003873 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003874 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003875 return -EIO;
3876 }
3877 break;
3878 default:
3879 return -EIO;
3880 }
3881
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003882 switch (new_phymode) {
3883 case IEEE80211_MODE_11AC_VHT20:
3884 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3885 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
3886 break;
3887 case IEEE80211_MODE_11AC_VHT40:
3888 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
3889 break;
3890 case IEEE80211_MODE_11AC_VHT80:
3891 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3892 break;
3893 default:
Jeff Johnsonc1713242018-10-23 13:45:42 -07003894 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc,
3895 &vhtchanwidth);
3896 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003897 hdd_err("Failed to get channel_width");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003898 break;
3899 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003900
3901 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303902 sme_config = qdf_mem_malloc(sizeof(*sme_config));
3903 if (!sme_config) {
3904 hdd_err("Failed to allocate memory for sme_config");
3905 return -ENOMEM;
3906 }
3907 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003908 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303909 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003910#ifdef QCA_HT_2040_COEX
3911 if (phymode == eCSR_DOT11_MODE_11n &&
3912 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303913 sme_config->csrConfig.obssEnabled = false;
Jeff Johnsonc1713242018-10-23 13:45:42 -07003914 status = sme_set_ht2040_mode(mac_handle,
3915 adapter->session_id,
3916 eHT_CHAN_HT20, false);
3917 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003918 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303919 retval = -EIO;
3920 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003921 }
3922 } else if (phymode == eCSR_DOT11_MODE_11n &&
3923 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303924 sme_config->csrConfig.obssEnabled = true;
Jeff Johnsonc1713242018-10-23 13:45:42 -07003925 status = sme_set_ht2040_mode(mac_handle,
3926 adapter->session_id,
3927 eHT_CHAN_HT20, true);
3928 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003929 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303930 retval = -EIO;
3931 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003932 }
3933 }
3934#endif
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303935 status = ucfg_mlme_set_band_capability(phddctx->psoc,
3936 curr_band);
3937 if (QDF_IS_STATUS_ERROR(status)) {
3938 hdd_err("failed to set MLME band capability");
3939 goto free;
3940 }
3941
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05303942 if (curr_band == BAND_2G) {
3943 status = ucfg_mlme_set_11h_enabled(phddctx->psoc, 0);
3944 if (!QDF_IS_STATUS_SUCCESS(status)) {
3945 hdd_err("Failed to set 11h_enable flag");
3946 goto free;
3947 }
3948 }
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003949 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303950 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07003951 else if (curr_band == BAND_5G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303952 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003953 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303954 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
3955 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003956 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003957 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003958
3959 phddctx->config->dot11Mode = hdd_dot11mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003960 phddctx->config->nChannelBondingMode24GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303961 sme_config->csrConfig.channelBondingMode24GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003962 phddctx->config->nChannelBondingMode5GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303963 sme_config->csrConfig.channelBondingMode5GHz;
Krunal Sonidf0f8742016-09-26 14:56:31 -07003964 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003965 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303966 retval = -EIO;
3967 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003968 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05303969
3970 if (band_5g) {
3971 struct ieee80211_supported_band *band;
3972
3973 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
3974 if (phddctx->config->nChannelBondingMode5GHz)
3975 band->ht_cap.cap |=
3976 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3977 else
3978 band->ht_cap.cap &=
3979 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
3980 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003981
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003982 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003983 phymode, chwidth, curr_band, vhtchanwidth);
3984 }
3985
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303986free:
3987 if (sme_config)
3988 qdf_mem_free(sme_config);
3989 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003990}
3991
Jeff Johnson011c4502017-10-05 15:25:56 -07003992static int hdd_validate_pdev_reset(int value)
3993{
3994 if ((value < 1) || (value > 5)) {
3995 hdd_warn(" Invalid value %d: Use any one of the below values\n"
3996 " TX_FLUSH = 1\n"
3997 " WARM_RESET = 2\n"
3998 " COLD_RESET = 3\n"
3999 " WARM_RESET_RESTORE_CAL = 4\n"
4000 " COLD_RESET_RESTORE_CAL = 5", value);
4001
4002 return -EINVAL;
4003 }
4004
4005 return 0;
4006}
4007
4008static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
4009{
4010 int ret;
4011
4012 hdd_debug("%d", value);
4013
4014 ret = hdd_validate_pdev_reset(value);
4015 if (ret)
4016 return ret;
4017
Jeff Johnson1b780e42017-10-31 14:11:45 -07004018 ret = wma_cli_set_command(adapter->session_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07004019 WMI_PDEV_PARAM_PDEV_RESET,
4020 value, PDEV_CMD);
4021
4022 return ret;
4023}
4024
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004025static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
4026{
4027 int errno;
4028 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4029 ePhyChanBondState bonding_state;
4030 uint32_t bonding_mode;
4031 tSmeConfigParams *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004032 mac_handle_t mac_handle;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004033
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004034 mac_handle = hdd_ctx->mac_handle;
4035 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004036 return -EINVAL;
4037
4038 /* updating channel bonding only on 5Ghz */
4039 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4040
4041 switch (ch_width) {
4042 case eHT_CHANNEL_WIDTH_20MHZ:
4043 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4044 break;
4045
4046 case eHT_CHANNEL_WIDTH_40MHZ:
4047 case eHT_CHANNEL_WIDTH_80MHZ:
4048 bonding_state = csr_convert_cb_ini_value_to_phy_cb_state(
4049 hdd_ctx->config->nChannelBondingMode5GHz);
4050
4051 if (bonding_state == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE)
4052 return -EINVAL;
4053
4054 bonding_mode = hdd_ctx->config->nChannelBondingMode5GHz;
4055 break;
4056
4057 default:
4058 hdd_err("Invalid channel width 0->20 1->40 2->80");
4059 return -EINVAL;
4060 }
4061
4062 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4063 if (!sme_config) {
4064 hdd_err("failed to allocate memory for sme_config");
4065 return -ENOMEM;
4066 }
4067
4068 errno = wma_cli_set_command(adapter->session_id, WMI_VDEV_PARAM_CHWIDTH,
4069 ch_width, VDEV_CMD);
4070 if (errno)
4071 goto free_config;
4072
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004073 sme_get_config_param(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004074 sme_config->csrConfig.channelBondingMode5GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004075 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004076
4077free_config:
4078 qdf_mem_free(sme_config);
4079
4080 return errno;
4081}
4082
Jeff Johnsondeab8572018-11-13 15:29:53 -08004083static int hdd_we_set_11d_state(struct hdd_adapter *adapter, int state_11d)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004084{
Jeff Johnsondeab8572018-11-13 15:29:53 -08004085 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004086 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004087 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304088 QDF_STATUS status;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004089
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004090 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004091 return -EINVAL;
4092
4093 switch (state_11d) {
4094 case ENABLE_11D:
4095 enable_11d = true;
4096 break;
4097 case DISABLE_11D:
4098 enable_11d = false;
4099 break;
4100 default:
4101 return -EINVAL;
4102 }
4103
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304104 status = ucfg_mlme_set_11d_enabled(hdd_ctx->psoc, enable_11d);
4105 if (!QDF_IS_STATUS_SUCCESS(status))
4106 hdd_err("Invalid 11d_enable flag");
Dustin Brownd90f61a2018-04-26 12:25:58 -07004107
Dustin Brownea82d562018-05-23 12:07:16 -07004108 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004109
4110 return 0;
4111}
4112
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004113static int hdd_we_set_power(struct hdd_adapter *adapter, int value)
4114{
4115 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4116 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4117
4118 if (!mac_handle)
4119 return -EINVAL;
4120
4121 switch (value) {
4122 case 1:
4123 /* Enable PowerSave */
4124 sme_ps_enable_disable(mac_handle, adapter->session_id,
4125 SME_PS_ENABLE);
4126 return 0;
4127 case 2:
4128 /* Disable PowerSave */
4129 sme_ps_enable_disable(mac_handle, adapter->session_id,
4130 SME_PS_DISABLE);
4131 return 0;
4132 case 3:
4133 /* Enable UASPD */
4134 sme_ps_uapsd_enable(mac_handle, adapter->session_id);
4135 return 0;
4136 case 4:
4137 /* Disable UASPD */
4138 sme_ps_uapsd_disable(mac_handle, adapter->session_id);
4139 return 0;
4140 default:
4141 hdd_err("Invalid value %d", value);
4142 return -EINVAL;
4143 }
4144}
4145
Jeff Johnsoneb4368a2018-10-19 13:02:52 -07004146static int hdd_we_set_max_assoc(struct hdd_adapter *adapter, int value)
4147{
4148 struct hdd_context *hdd_ctx;
4149 QDF_STATUS status;
4150
4151 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4152 status = ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, value);
4153 if (QDF_IS_STATUS_ERROR(status))
4154 hdd_err("cfg set failed, value %d status %d", value, status);
4155
4156 return qdf_status_to_os_return(status);
4157}
4158
Jeff Johnson693722c2018-10-19 13:11:16 -07004159static int hdd_we_set_data_inactivity_timeout(struct hdd_adapter *adapter,
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004160 int inactivity_timeout)
Jeff Johnson693722c2018-10-19 13:11:16 -07004161{
4162 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004163 QDF_STATUS status;
Jeff Johnson693722c2018-10-19 13:11:16 -07004164
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004165 status = ucfg_mlme_set_ps_data_inactivity_timeout(hdd_ctx->psoc,
4166 inactivity_timeout);
Jeff Johnson693722c2018-10-19 13:11:16 -07004167
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004168 return qdf_status_to_os_return(status);
Jeff Johnson693722c2018-10-19 13:11:16 -07004169}
4170
Jeff Johnson94511942018-10-19 13:15:22 -07004171static int hdd_we_set_wow_data_inactivity_timeout(struct hdd_adapter *adapter,
4172 int value)
4173{
4174 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4175 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4176 QDF_STATUS status;
4177
4178 if (!mac_handle)
4179 return -EINVAL;
4180
4181 if ((value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) ||
4182 (value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX)) {
4183 hdd_err_rl("Invalid value %d", value);
4184 return -EINVAL;
4185 }
4186
4187 status = sme_cfg_set_int(mac_handle,
4188 WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT,
4189 value);
4190
4191 if (QDF_IS_STATUS_ERROR(status))
4192 hdd_err("cfg set failed, value %d status %d", value, status);
4193
4194 return qdf_status_to_os_return(status);
4195}
4196
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004197static int hdd_we_set_tx_power(struct hdd_adapter *adapter, int value)
4198{
4199 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4200 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4201 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4202 QDF_STATUS status;
4203
4204 if (!mac_handle)
4205 return -EINVAL;
4206
4207 status = sme_set_tx_power(mac_handle, adapter->session_id,
4208 sta_ctx->conn_info.bssId,
4209 adapter->device_mode, value);
4210
4211 if (QDF_IS_STATUS_ERROR(status))
4212 hdd_err("cfg set failed, value %d status %d", value, status);
4213
4214 return qdf_status_to_os_return(status);
4215}
4216
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004217static int hdd_we_set_max_tx_power(struct hdd_adapter *adapter, int value)
4218{
4219 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4220 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4221 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4222 QDF_STATUS status;
4223
4224 if (!mac_handle)
4225 return -EINVAL;
4226
4227 status = sme_set_max_tx_power(mac_handle,
4228 sta_ctx->conn_info.bssId,
4229 sta_ctx->conn_info.bssId,
4230 value);
4231
4232 if (QDF_IS_STATUS_ERROR(status))
4233 hdd_err("cfg set failed, value %d status %d", value, status);
4234
4235 return qdf_status_to_os_return(status);
4236}
4237
Jeff Johnsonf3892b52018-10-23 11:32:04 -07004238static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power)
4239{
4240 QDF_STATUS status;
4241
4242 hdd_debug("power %d dBm", power);
4243 status = sme_set_max_tx_power_per_band(BAND_2G, power);
4244 if (QDF_IS_STATUS_ERROR(status))
4245 hdd_err("cfg set failed, value %d status %d", power, status);
4246
4247 return qdf_status_to_os_return(status);
4248}
4249
Jeff Johnson175004c2018-10-23 12:03:16 -07004250static int hdd_we_set_max_tx_power_5_0(struct hdd_adapter *adapter, int power)
4251{
4252 QDF_STATUS status;
4253
4254 hdd_debug("power %d dBm", power);
4255 status = sme_set_max_tx_power_per_band(BAND_5G, power);
4256 if (QDF_IS_STATUS_ERROR(status))
4257 hdd_err("cfg set failed, value %d status %d", power, status);
4258
4259 return qdf_status_to_os_return(status);
4260}
4261
Jeff Johnson5bee39b2018-10-23 12:34:38 -07004262static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level)
4263{
4264 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4265 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4266 QDF_STATUS status;
4267
4268 if (!mac_handle)
4269 return -EINVAL;
4270
4271 hdd_debug("Thermal Mitigation Level %d", level);
4272 status = sme_set_thermal_level(mac_handle, level);
4273 if (QDF_IS_STATUS_ERROR(status))
4274 hdd_err("cfg set failed, value %d status %d", level, status);
4275
4276 return qdf_status_to_os_return(status);
4277}
4278
Jeff Johnson38912642018-10-24 15:01:40 -07004279static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss)
4280{
4281 QDF_STATUS status;
4282
4283 hdd_debug("NSS %d", nss);
4284
4285 if ((nss > 2) || (nss <= 0)) {
4286 hdd_err("Invalid NSS: %d", nss);
4287 return -EINVAL;
4288 }
4289
4290 status = hdd_update_nss(adapter, nss);
4291 if (QDF_IS_STATUS_ERROR(status))
4292 hdd_err("cfg set failed, value %d status %d", nss, status);
4293
4294 return qdf_status_to_os_return(status);
4295}
4296
Jeff Johnsonce996b32018-10-25 10:52:40 -07004297static int hdd_we_set_short_gi(struct hdd_adapter *adapter, int sgi)
4298{
4299 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
4300 int errno;
4301
4302 hdd_debug("Short GI %d", sgi);
4303
4304 if (!mac_handle) {
4305 hdd_err("NULL Mac handle");
4306 return -EINVAL;
4307 }
4308
4309 if (sgi & HDD_AUTO_RATE_SGI)
4310 errno = sme_set_auto_rate_he_sgi(mac_handle,
4311 adapter->session_id,
4312 sgi);
4313 else
4314 errno = sme_update_ht_config(mac_handle,
4315 adapter->session_id,
4316 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4317 sgi);
4318 if (errno)
4319 hdd_err("cfg set failed, value %d status %d", sgi, errno);
4320
4321 return errno;
4322}
4323
Jeff Johnson71d80382018-10-25 15:45:01 -07004324static int hdd_we_set_rtscts(struct hdd_adapter *adapter, int rtscts)
4325{
4326 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4327 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4328 uint32_t value;
4329 uint32_t rts_threshold_val;
4330 QDF_STATUS status;
4331 int errno;
4332
4333 hdd_debug("RTSCTS %d", rtscts);
4334
4335 if (!mac_handle) {
4336 hdd_err("NULL Mac handle");
4337 return -EINVAL;
4338 }
4339
4340 status = ucfg_mlme_get_rts_threshold(hdd_ctx->psoc,
4341 &rts_threshold_val);
4342 if (QDF_IS_STATUS_ERROR(status)) {
4343 hdd_err("Get rts threshold failed, status %d", status);
4344 return -EINVAL;
4345 }
4346
4347 if ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_RTSCTS_ENABLE) {
4348 value = rts_threshold_val;
4349 } else if (((rtscts & HDD_RTSCTS_EN_MASK) == 0) ||
4350 ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_CTS_ENABLE)) {
4351 value = cfg_max(CFG_RTS_THRESHOLD);
4352 } else {
4353 hdd_err_rl("Invalid value %d", rtscts);
4354 return -EINVAL;
4355 }
4356
4357 errno = wma_cli_set_command(adapter->session_id,
4358 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4359 rtscts, VDEV_CMD);
4360 if (errno) {
4361 hdd_err("Failed to set firmware, errno %d", errno);
4362 return errno;
4363 }
4364
4365 status = ucfg_mlme_set_rts_threshold(hdd_ctx->psoc, value);
4366 if (QDF_IS_STATUS_ERROR(status)) {
4367 hdd_err("Set rts threshold failed, status %d", status);
4368 return -EINVAL;
4369 }
4370
4371 return 0;
4372}
4373
Jeff Johnson50b15882018-10-26 10:27:37 -07004374static int hdd_we_set_11n_rate(struct hdd_adapter *adapter, int rate_code)
4375{
4376 uint8_t preamble = 0, nss = 0, rix = 0;
4377 int errno;
4378
4379 hdd_debug("Rate code %d", rate_code);
4380
4381 if (rate_code != 0xff) {
4382 rix = RC_2_RATE_IDX(rate_code);
4383 if (rate_code & 0x80) {
4384 preamble = WMI_RATE_PREAMBLE_HT;
4385 nss = HT_RC_2_STREAMS(rate_code) - 1;
4386 } else {
4387 nss = 0;
4388 rix = RC_2_RATE_IDX(rate_code);
4389 if (rate_code & 0x10) {
4390 preamble = WMI_RATE_PREAMBLE_CCK;
4391 if (rix != 0x3)
4392 /* Enable Short preamble
4393 * always for CCK except 1mbps
4394 */
4395 rix |= 0x4;
4396 } else {
4397 preamble = WMI_RATE_PREAMBLE_OFDM;
4398 }
4399 }
4400 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4401 }
4402
4403 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4404 rate_code, rix, preamble, nss);
4405
4406 errno = wma_cli_set_command(adapter->session_id,
4407 WMI_VDEV_PARAM_FIXED_RATE,
4408 rate_code, VDEV_CMD);
4409 if (errno)
4410 hdd_err("Failed to set firmware, errno %d", errno);
4411
4412 return errno;
4413}
4414
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004415static int hdd_we_set_vht_rate(struct hdd_adapter *adapter, int rate_code)
4416{
4417 uint8_t preamble = 0, nss = 0, rix = 0;
4418 int errno;
4419
4420 hdd_debug("Rate code %d", rate_code);
4421
4422 if (rate_code != 0xff) {
4423 rix = RC_2_RATE_IDX_11AC(rate_code);
4424 preamble = WMI_RATE_PREAMBLE_VHT;
4425 nss = HT_RC_2_STREAMS_11AC(rate_code) - 1;
4426 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4427 }
4428
4429 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4430 rate_code, rix, preamble, nss);
4431
4432 errno = wma_cli_set_command(adapter->session_id,
4433 WMI_VDEV_PARAM_FIXED_RATE,
4434 rate_code, VDEV_CMD);
4435 if (errno)
4436 hdd_err("Failed to set firmware, errno %d", errno);
4437
4438 return errno;
4439}
4440
Jeff Johnson7c433502018-11-12 15:00:52 -08004441static int hdd_we_set_ampdu(struct hdd_adapter *adapter, int ampdu)
4442{
4443 hdd_debug("AMPDU %d", ampdu);
4444
4445 return wma_cli_set_command(adapter->session_id,
4446 GEN_VDEV_PARAM_AMPDU,
4447 ampdu, GEN_CMD);
4448}
4449
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004450static int hdd_we_set_amsdu(struct hdd_adapter *adapter, int amsdu)
4451{
4452 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4453 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4454 int errno;
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304455 QDF_STATUS status;
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004456
4457 hdd_debug("AMSDU %d", amsdu);
4458
4459 if (!mac_handle) {
4460 hdd_err("NULL Mac handle");
4461 return -EINVAL;
4462 }
4463
4464 if (amsdu > 1)
4465 sme_set_amsdu(mac_handle, true);
4466 else
4467 sme_set_amsdu(mac_handle, false);
4468
4469 errno = wma_cli_set_command(adapter->session_id,
4470 GEN_VDEV_PARAM_AMSDU,
4471 amsdu, GEN_CMD);
4472 if (errno) {
4473 hdd_err("Failed to set firmware, errno %d", errno);
4474 return errno;
4475 }
4476
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304477 status = ucfg_mlme_set_max_amsdu_num(hdd_ctx->psoc,
4478 amsdu);
4479 if (QDF_IS_STATUS_ERROR(status))
4480 hdd_err("Failed to set Max AMSDU Num to cfg");
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004481
4482 return 0;
4483}
4484
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004485static int hdd_we_clear_stats(struct hdd_adapter *adapter, int option)
4486{
4487 hdd_debug("option %d", option);
4488
4489 switch (option) {
4490 case CDP_HDD_STATS:
4491 memset(&adapter->stats, 0, sizeof(adapter->stats));
4492 memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
4493 break;
4494 case CDP_TXRX_HIST_STATS:
4495 wlan_hdd_clear_tx_rx_histogram(adapter->hdd_ctx);
4496 break;
4497 case CDP_HDD_NETIF_OPER_HISTORY:
4498 wlan_hdd_clear_netif_queue_history(adapter->hdd_ctx);
4499 break;
4500 case CDP_HIF_STATS:
4501 hdd_clear_hif_stats();
4502 break;
4503 case CDP_NAPI_STATS:
4504 hdd_clear_napi_stats();
4505 break;
4506 default:
4507 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4508 option);
4509 }
4510
4511 return 0;
4512}
4513
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004514static int hdd_we_set_green_tx_param(struct hdd_adapter *adapter,
4515 green_tx_param id,
4516 const char *id_string,
4517 int value)
4518{
4519 int errno;
4520
4521 hdd_debug("%s %d", id_string, value);
4522 errno = wma_cli_set_command(adapter->session_id, id, value, GTX_CMD);
4523 if (errno)
4524 hdd_err("Failed to set firmware, errno %d", errno);
4525
4526 return errno;
4527}
4528
4529#define hdd_we_set_green_tx_param(adapter, id, value) \
4530 hdd_we_set_green_tx_param(adapter, id, #id, value)
4531
4532static int hdd_we_set_gtx_ht_mcs(struct hdd_adapter *adapter, int value)
4533{
4534 return hdd_we_set_green_tx_param(adapter,
4535 WMI_VDEV_PARAM_GTX_HT_MCS,
4536 value);
4537}
4538
4539static int hdd_we_set_gtx_vht_mcs(struct hdd_adapter *adapter, int value)
4540{
4541 return hdd_we_set_green_tx_param(adapter,
4542 WMI_VDEV_PARAM_GTX_VHT_MCS,
4543 value);
4544}
4545
4546static int hdd_we_set_gtx_usrcfg(struct hdd_adapter *adapter, int value)
4547{
4548 return hdd_we_set_green_tx_param(adapter,
4549 WMI_VDEV_PARAM_GTX_USR_CFG,
4550 value);
4551}
4552
4553static int hdd_we_set_gtx_thre(struct hdd_adapter *adapter, int value)
4554{
4555 return hdd_we_set_green_tx_param(adapter,
4556 WMI_VDEV_PARAM_GTX_THRE,
4557 value);
4558}
4559
4560static int hdd_we_set_gtx_margin(struct hdd_adapter *adapter, int value)
4561{
4562 return hdd_we_set_green_tx_param(adapter,
4563 WMI_VDEV_PARAM_GTX_MARGIN,
4564 value);
4565}
4566
4567static int hdd_we_set_gtx_step(struct hdd_adapter *adapter, int value)
4568{
4569 return hdd_we_set_green_tx_param(adapter,
4570 WMI_VDEV_PARAM_GTX_STEP,
4571 value);
4572}
4573
4574static int hdd_we_set_gtx_mintpc(struct hdd_adapter *adapter, int value)
4575{
4576 return hdd_we_set_green_tx_param(adapter,
4577 WMI_VDEV_PARAM_GTX_MINTPC,
4578 value);
4579}
4580
4581static int hdd_we_set_gtx_bwmask(struct hdd_adapter *adapter, int value)
4582{
4583 return hdd_we_set_green_tx_param(adapter,
4584 WMI_VDEV_PARAM_GTX_BW_MASK,
4585 value);
4586}
4587
Jeff Johnsond0477f22018-10-29 12:26:25 -07004588static int hdd_we_packet_power_save(struct hdd_adapter *adapter,
4589 packet_power_save id,
4590 const char *id_string,
4591 int value)
4592{
4593 int errno;
4594
4595 if (adapter->device_mode != QDF_STA_MODE) {
4596 hdd_err_rl("Not supported in mode %d", adapter->device_mode);
4597 return -EINVAL;
4598 }
4599
4600 hdd_debug("%s %d", id_string, value);
4601 errno = wma_cli_set_command(adapter->session_id, id, value, PPS_CMD);
4602 if (errno)
4603 hdd_err("Failed to set firmware, errno %d", errno);
4604
4605 return errno;
4606}
4607
4608#define hdd_we_packet_power_save(adapter, id, value) \
4609 hdd_we_packet_power_save(adapter, id, #id, value)
4610
4611static int hdd_we_pps_paid_match(struct hdd_adapter *adapter, int value)
4612{
4613 return hdd_we_packet_power_save(adapter,
4614 WMI_VDEV_PPS_PAID_MATCH,
4615 value);
4616}
4617
4618static int hdd_we_pps_gid_match(struct hdd_adapter *adapter, int value)
4619{
4620 return hdd_we_packet_power_save(adapter,
4621 WMI_VDEV_PPS_GID_MATCH,
4622 value);
4623}
4624
4625static int hdd_we_pps_early_tim_clear(struct hdd_adapter *adapter, int value)
4626{
4627 return hdd_we_packet_power_save(adapter,
4628 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4629 value);
4630}
4631
4632static int hdd_we_pps_early_dtim_clear(struct hdd_adapter *adapter, int value)
4633{
4634 return hdd_we_packet_power_save(adapter,
4635 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4636 value);
4637}
4638
4639static int hdd_we_pps_eof_pad_delim(struct hdd_adapter *adapter, int value)
4640{
4641 return hdd_we_packet_power_save(adapter,
4642 WMI_VDEV_PPS_EOF_PAD_DELIM,
4643 value);
4644}
4645
4646static int hdd_we_pps_macaddr_mismatch(struct hdd_adapter *adapter, int value)
4647{
4648 return hdd_we_packet_power_save(adapter,
4649 WMI_VDEV_PPS_MACADDR_MISMATCH,
4650 value);
4651}
4652
4653static int hdd_we_pps_delim_crc_fail(struct hdd_adapter *adapter, int value)
4654{
4655 return hdd_we_packet_power_save(adapter,
4656 WMI_VDEV_PPS_DELIM_CRC_FAIL,
4657 value);
4658}
4659
4660static int hdd_we_pps_gid_nsts_zero(struct hdd_adapter *adapter, int value)
4661{
4662 return hdd_we_packet_power_save(adapter,
4663 WMI_VDEV_PPS_GID_NSTS_ZERO,
4664 value);
4665}
4666
4667static int hdd_we_pps_rssi_check(struct hdd_adapter *adapter, int value)
4668{
4669 return hdd_we_packet_power_save(adapter,
4670 WMI_VDEV_PPS_RSSI_CHECK,
4671 value);
4672}
4673
4674static int hdd_we_pps_5g_ebt(struct hdd_adapter *adapter, int value)
4675{
4676 return hdd_we_packet_power_save(adapter,
4677 WMI_VDEV_PPS_5G_EBT,
4678 value);
4679}
4680
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07004681static int hdd_we_set_qpower(struct hdd_adapter *adapter,
4682 enum wmi_sta_powersave_param id,
4683 const char *id_string,
4684 int value)
4685{
4686 int errno;
4687
4688 hdd_debug("%s %d", id_string, value);
4689 errno = wma_cli_set_command(adapter->session_id, id, value, QPOWER_CMD);
4690 if (errno)
4691 hdd_err("Failed to set firmware, errno %d", errno);
4692
4693 return errno;
4694}
4695
4696#define hdd_we_set_qpower(adapter, id, value) \
4697 hdd_we_set_qpower(adapter, id, #id, value)
4698
4699static int
4700hdd_we_set_qpower_max_pspoll_count(struct hdd_adapter *adapter, int value)
4701{
4702 enum wmi_sta_powersave_param id =
4703 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT;
4704
4705 return hdd_we_set_qpower(adapter, id, value);
4706}
4707
4708static int
4709hdd_we_set_qpower_max_tx_before_wake(struct hdd_adapter *adapter, int value)
4710{
4711 enum wmi_sta_powersave_param id =
4712 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE;
4713
4714 return hdd_we_set_qpower(adapter, id, value);
4715}
4716
4717static int
4718hdd_we_set_qpower_spec_pspoll_wake_interval(struct hdd_adapter *adapter,
4719 int value)
4720{
4721 enum wmi_sta_powersave_param id =
4722 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL;
4723
4724 return hdd_we_set_qpower(adapter, id, value);
4725}
4726
4727static int
4728hdd_we_set_qpower_spec_max_spec_nodata_pspoll(struct hdd_adapter *adapter,
4729 int value)
4730{
4731 enum wmi_sta_powersave_param id =
4732 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL;
4733
4734 return hdd_we_set_qpower(adapter, id, value);
4735}
4736
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08004737static int hdd_we_set_pdev(struct hdd_adapter *adapter,
4738 WMI_PDEV_PARAM id,
4739 const char *id_string,
4740 int value)
4741{
4742 int errno;
4743
4744 hdd_debug("%s %d", id_string, value);
4745 errno = wma_cli_set_command(adapter->session_id, id, value, PDEV_CMD);
4746 if (errno)
4747 hdd_err("Failed to set firmware, errno %d", errno);
4748
4749 return errno;
4750}
4751
4752#define hdd_we_set_pdev(adapter, id, value) \
4753 hdd_we_set_pdev(adapter, id, #id, value)
4754
4755static int hdd_we_set_ani_en_dis(struct hdd_adapter *adapter, int value)
4756{
4757 return hdd_we_set_pdev(adapter,
4758 WMI_PDEV_PARAM_ANI_ENABLE,
4759 value);
4760}
4761
4762static int hdd_we_set_ani_poll_period(struct hdd_adapter *adapter, int value)
4763{
4764 return hdd_we_set_pdev(adapter,
4765 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
4766 value);
4767}
4768
4769static int hdd_we_set_ani_listen_period(struct hdd_adapter *adapter, int value)
4770{
4771 return hdd_we_set_pdev(adapter,
4772 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
4773 value);
4774}
4775
4776static int hdd_we_set_ani_ofdm_level(struct hdd_adapter *adapter, int value)
4777{
4778 return hdd_we_set_pdev(adapter,
4779 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
4780 value);
4781}
4782
4783static int hdd_we_set_ani_cck_level(struct hdd_adapter *adapter, int value)
4784{
4785 return hdd_we_set_pdev(adapter,
4786 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
4787 value);
4788}
4789
4790static int hdd_we_set_dynamic_bw(struct hdd_adapter *adapter, int value)
4791{
4792 return hdd_we_set_pdev(adapter,
4793 WMI_PDEV_PARAM_DYNAMIC_BW,
4794 value);
4795}
4796
4797static int hdd_we_set_cts_cbw(struct hdd_adapter *adapter, int value)
4798{
4799 return hdd_we_set_pdev(adapter,
4800 WMI_PDEV_PARAM_CTS_CBW,
4801 value);
4802}
4803
4804static int hdd_we_set_tx_chainmask(struct hdd_adapter *adapter, int value)
4805{
4806 int errno;
4807
4808 errno = hdd_we_set_pdev(adapter,
4809 WMI_PDEV_PARAM_TX_CHAIN_MASK,
4810 value);
4811 if (errno)
4812 return errno;
4813
4814 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
4815}
4816
4817static int hdd_we_set_rx_chainmask(struct hdd_adapter *adapter, int value)
4818{
4819 int errno;
4820
4821 errno = hdd_we_set_pdev(adapter,
4822 WMI_PDEV_PARAM_RX_CHAIN_MASK,
4823 value);
4824 if (errno)
4825 return errno;
4826
4827 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
4828}
4829
4830static int hdd_we_set_txpow_2g(struct hdd_adapter *adapter, int value)
4831{
4832 return hdd_we_set_pdev(adapter,
4833 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
4834 value);
4835}
4836
4837static int hdd_we_set_txpow_5g(struct hdd_adapter *adapter, int value)
4838{
4839 return hdd_we_set_pdev(adapter,
4840 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
4841 value);
4842}
4843
Jeff Johnson2e381272018-11-10 09:33:39 -08004844static int hdd_we_set_vdev(struct hdd_adapter *adapter,
4845 int id,
4846 const char *id_string,
4847 int value)
4848{
4849 int errno;
4850
4851 hdd_debug("%s %d", id_string, value);
4852 errno = wma_cli_set_command(adapter->session_id, id, value, VDEV_CMD);
4853 if (errno)
4854 hdd_err("Failed to set firmware, errno %d", errno);
4855
4856 return errno;
4857}
4858
4859#define hdd_we_set_vdev(adapter, id, value) \
4860 hdd_we_set_vdev(adapter, id, #id, value)
4861
4862static int hdd_we_set_txrx_fwstats(struct hdd_adapter *adapter, int value)
4863{
4864 return hdd_we_set_vdev(adapter,
4865 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
4866 value);
4867}
4868
4869static int hdd_we_txrx_fwstats_reset(struct hdd_adapter *adapter, int value)
4870{
4871 return hdd_we_set_vdev(adapter,
4872 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
4873 value);
4874}
4875
4876static int hdd_we_set_htsmps(struct hdd_adapter *adapter, int value)
4877{
4878 return hdd_we_set_vdev(adapter,
4879 WMI_STA_SMPS_FORCE_MODE_CMDID,
4880 value);
4881}
4882
4883static int hdd_we_set_early_rx_adjust_enable(struct hdd_adapter *adapter,
4884 int value)
4885{
4886 if ((value != 0) && (value != 1))
4887 return -EINVAL;
4888
4889 return hdd_we_set_vdev(adapter,
4890 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
4891 value);
4892}
4893
4894static int hdd_we_set_early_rx_tgt_bmiss_num(struct hdd_adapter *adapter,
4895 int value)
4896{
4897 return hdd_we_set_vdev(adapter,
4898 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
4899 value);
4900}
4901
4902static int hdd_we_set_early_rx_bmiss_sample_cycle(struct hdd_adapter *adapter,
4903 int value)
4904{
4905 return hdd_we_set_vdev(adapter,
4906 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
4907 value);
4908}
4909
4910static int hdd_we_set_early_rx_slop_step(struct hdd_adapter *adapter, int value)
4911{
4912 return hdd_we_set_vdev(adapter,
4913 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
4914 value);
4915}
4916
4917static int hdd_we_set_early_rx_init_slop(struct hdd_adapter *adapter, int value)
4918{
4919 return hdd_we_set_vdev(adapter,
4920 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
4921 value);
4922}
4923
4924static int hdd_we_set_early_rx_adjust_pause(struct hdd_adapter *adapter,
4925 int value)
4926{
4927 if ((value != 0) && (value != 1))
4928 return -EINVAL;
4929
4930 return hdd_we_set_vdev(adapter,
4931 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
4932 value);
4933}
4934
4935static int hdd_we_set_early_rx_drift_sample(struct hdd_adapter *adapter,
4936 int value)
4937{
4938 return hdd_we_set_vdev(adapter,
4939 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
4940 value);
4941}
4942
4943static int hdd_we_set_dcm(struct hdd_adapter *adapter, int value)
4944{
4945 return hdd_we_set_vdev(adapter,
4946 WMI_VDEV_PARAM_HE_DCM,
4947 value);
4948}
4949
4950static int hdd_we_set_range_ext(struct hdd_adapter *adapter, int value)
4951{
4952 return hdd_we_set_vdev(adapter,
4953 WMI_VDEV_PARAM_HE_RANGE_EXT,
4954 value);
4955}
4956
Jeff Johnson22e57f12018-11-10 16:02:00 -08004957static int hdd_we_set_dbg(struct hdd_adapter *adapter,
4958 int id,
4959 const char *id_string,
4960 int value)
4961{
4962 int errno;
4963
4964 hdd_debug("%s %d", id_string, value);
4965 errno = wma_cli_set_command(adapter->session_id, id, value, DBG_CMD);
4966 if (errno)
4967 hdd_err("Failed to set firmware, errno %d", errno);
4968
4969 return errno;
4970}
4971
4972#define hdd_we_set_dbg(adapter, id, value) \
4973 hdd_we_set_dbg(adapter, id, #id, value)
4974
4975static int hdd_we_dbglog_log_level(struct hdd_adapter *adapter, int value)
4976{
4977 return hdd_we_set_dbg(adapter,
4978 WMI_DBGLOG_LOG_LEVEL,
4979 value);
4980}
4981
4982static int hdd_we_dbglog_vap_enable(struct hdd_adapter *adapter, int value)
4983{
4984 return hdd_we_set_dbg(adapter,
4985 WMI_DBGLOG_VAP_ENABLE,
4986 value);
4987}
4988
4989static int hdd_we_dbglog_vap_disable(struct hdd_adapter *adapter, int value)
4990{
4991 return hdd_we_set_dbg(adapter,
4992 WMI_DBGLOG_VAP_DISABLE,
4993 value);
4994}
4995
4996static int hdd_we_dbglog_module_enable(struct hdd_adapter *adapter, int value)
4997{
4998 return hdd_we_set_dbg(adapter,
4999 WMI_DBGLOG_MODULE_ENABLE,
5000 value);
5001}
5002
5003static int hdd_we_dbglog_module_disable(struct hdd_adapter *adapter, int value)
5004{
5005 return hdd_we_set_dbg(adapter,
5006 WMI_DBGLOG_MODULE_DISABLE,
5007 value);
5008}
5009
5010static int hdd_we_dbglog_mod_log_level(struct hdd_adapter *adapter, int value)
5011{
5012 return hdd_we_set_dbg(adapter,
5013 WMI_DBGLOG_MOD_LOG_LEVEL,
5014 value);
5015}
5016
5017static int hdd_we_dbglog_type(struct hdd_adapter *adapter, int value)
5018{
5019 return hdd_we_set_dbg(adapter,
5020 WMI_DBGLOG_TYPE,
5021 value);
5022}
5023
5024static int hdd_we_dbglog_report_enable(struct hdd_adapter *adapter, int value)
5025{
5026 return hdd_we_set_dbg(adapter,
5027 WMI_DBGLOG_REPORT_ENABLE,
5028 value);
5029}
5030
5031static int hdd_we_start_fw_profile(struct hdd_adapter *adapter, int value)
5032{
5033 return hdd_we_set_dbg(adapter,
5034 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5035 value);
5036}
5037
Jeff Johnson274a1d62018-11-12 20:31:51 -08005038static int hdd_we_set_channel(struct hdd_adapter *adapter, int channel)
5039{
5040 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5041 QDF_STATUS status;
5042
5043 hdd_debug("Set Channel %d Session ID %d mode %d", channel,
5044 adapter->session_id, adapter->device_mode);
5045
5046 if (!hdd_ctx->mac_handle)
5047 return -EINVAL;
5048
5049 switch (adapter->device_mode) {
5050 case QDF_STA_MODE:
5051 case QDF_P2P_CLIENT_MODE:
5052 /* supported */
5053 break;
5054 default:
5055 hdd_err("change channel not supported for device mode %d",
5056 adapter->device_mode);
5057 return -EINVAL;
5058 }
5059
5060 status = sme_ext_change_channel(hdd_ctx->mac_handle, channel,
5061 adapter->session_id);
5062 if (status != QDF_STATUS_SUCCESS)
5063 hdd_err("Error in change channel status %d", status);
5064
5065 return qdf_status_to_os_return(status);
5066}
5067
Jeff Johnson0e07ca12018-11-12 21:04:45 -08005068static int hdd_we_mcc_config_latency(struct hdd_adapter *adapter, int latency)
5069{
5070 hdd_debug("MCC latency %d", latency);
5071
5072 wlan_hdd_set_mcc_latency(adapter, latency);
5073
5074 return 0;
5075}
5076
5077static int hdd_we_mcc_config_quota(struct hdd_adapter *adapter, int quota)
5078{
5079 hdd_debug("MCC quota %dms", quota);
5080
5081 return wlan_hdd_set_mcc_p2p_quota(adapter, quota);
5082}
5083
Jeff Johnson33ec1982018-11-12 21:40:33 -08005084static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value)
5085{
5086 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5087
5088 if (!hdd_ctx->mac_handle)
5089 return -EINVAL;
5090
5091 sme_update_connect_debug(hdd_ctx->mac_handle, value);
5092
5093 return 0;
5094}
5095
Jeff Johnsone50951c2018-11-13 12:20:23 -08005096static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value)
5097{
5098 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5099
5100 hdd_debug("%d", value);
5101
5102 if (!hdd_ctx->mac_handle)
5103 return -EINVAL;
5104
5105 sme_set_scan_disable(hdd_ctx->mac_handle, value);
5106
5107 return 0;
5108}
5109
Jeff Johnsond3f1efd2018-11-13 13:26:19 -08005110static int hdd_we_set_conc_system_pref(struct hdd_adapter *adapter,
5111 int preference)
5112{
5113 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5114
5115 hdd_debug("%d", preference);
5116
5117 if (!hdd_ctx->psoc)
5118 return -EINVAL;
5119
5120 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, preference);
5121
5122 return 0;
5123}
5124
Jeff Johnson74696bb2018-11-13 13:30:36 -08005125static int hdd_we_set_11ax_rate(struct hdd_adapter *adapter, int rate)
5126{
5127 return hdd_set_11ax_rate(adapter, rate, NULL);
5128}
5129
Jeff Johnsonb43ec122018-11-13 14:17:08 -08005130static int hdd_we_set_modulated_dtim(struct hdd_adapter *adapter, int value)
5131{
5132 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5133
5134 hdd_debug("%d", value);
5135
5136 if (!hdd_ctx->psoc)
5137 return -EINVAL;
5138
5139 if ((value < cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM)) ||
5140 (value > cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM))) {
5141 hdd_err("Invalid value %d", value);
5142 return -EINVAL;
5143 }
5144
5145 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, value);
5146
5147 return 0;
5148}
5149
Jeff Johnson3ba27322018-11-13 17:58:28 -08005150typedef int (*setint_getnone_fn)(struct hdd_adapter *adapter, int value);
5151static const setint_getnone_fn setint_getnone_cb[] = {
5152 [WE_SET_11D_STATE] = hdd_we_set_11d_state,
5153 [WE_SET_POWER] = hdd_we_set_power,
5154 [WE_SET_MAX_ASSOC] = hdd_we_set_max_assoc,
5155 [WE_SET_DATA_INACTIVITY_TO] = hdd_we_set_data_inactivity_timeout,
5156 [WE_SET_WOW_DATA_INACTIVITY_TO] =
5157 hdd_we_set_wow_data_inactivity_timeout,
5158 [WE_SET_MC_RATE] = wlan_hdd_set_mc_rate,
5159 [WE_SET_TX_POWER] = hdd_we_set_tx_power,
5160 [WE_SET_MAX_TX_POWER] = hdd_we_set_max_tx_power,
5161 [WE_SET_MAX_TX_POWER_2_4] = hdd_we_set_max_tx_power_2_4,
5162 [WE_SET_MAX_TX_POWER_5_0] = hdd_we_set_max_tx_power_5_0,
5163 [WE_SET_TM_LEVEL] = hdd_we_set_tm_level,
5164 [WE_SET_PHYMODE] = wlan_hdd_update_phymode,
5165 [WE_SET_NSS] = hdd_we_set_nss,
5166 [WE_SET_GTX_HT_MCS] = hdd_we_set_gtx_ht_mcs,
5167 [WE_SET_GTX_VHT_MCS] = hdd_we_set_gtx_vht_mcs,
5168 [WE_SET_GTX_USRCFG] = hdd_we_set_gtx_usrcfg,
5169 [WE_SET_GTX_THRE] = hdd_we_set_gtx_thre,
5170 [WE_SET_GTX_MARGIN] = hdd_we_set_gtx_margin,
5171 [WE_SET_GTX_STEP] = hdd_we_set_gtx_step,
5172 [WE_SET_GTX_MINTPC] = hdd_we_set_gtx_mintpc,
5173 [WE_SET_GTX_BWMASK] = hdd_we_set_gtx_bwmask,
5174 [WE_SET_LDPC] = hdd_set_ldpc,
5175 [WE_SET_TX_STBC] = hdd_set_tx_stbc,
5176 [WE_SET_RX_STBC] = hdd_set_rx_stbc,
5177 [WE_SET_SHORT_GI] = hdd_we_set_short_gi,
5178 [WE_SET_RTSCTS] = hdd_we_set_rtscts,
5179 [WE_SET_CHWIDTH] = hdd_we_set_ch_width,
5180 [WE_SET_ANI_EN_DIS] = hdd_we_set_ani_en_dis,
5181 [WE_SET_ANI_POLL_PERIOD] = hdd_we_set_ani_poll_period,
5182 [WE_SET_ANI_LISTEN_PERIOD] = hdd_we_set_ani_listen_period,
5183 [WE_SET_ANI_OFDM_LEVEL] = hdd_we_set_ani_ofdm_level,
5184 [WE_SET_ANI_CCK_LEVEL] = hdd_we_set_ani_cck_level,
5185 [WE_SET_DYNAMIC_BW] = hdd_we_set_dynamic_bw,
5186 [WE_SET_CTS_CBW] = hdd_we_set_cts_cbw,
5187 [WE_SET_11N_RATE] = hdd_we_set_11n_rate,
5188 [WE_SET_VHT_RATE] = hdd_we_set_vht_rate,
5189 [WE_SET_AMPDU] = hdd_we_set_ampdu,
5190 [WE_SET_AMSDU] = hdd_we_set_amsdu,
5191 [WE_SET_TX_CHAINMASK] = hdd_we_set_tx_chainmask,
5192 [WE_SET_RX_CHAINMASK] = hdd_we_set_rx_chainmask,
5193 [WE_SET_TXPOW_2G] = hdd_we_set_txpow_2g,
5194 [WE_SET_TXPOW_5G] = hdd_we_set_txpow_5g,
5195 [WE_DBGLOG_LOG_LEVEL] = hdd_we_dbglog_log_level,
5196 [WE_DBGLOG_VAP_ENABLE] = hdd_we_dbglog_vap_enable,
5197 [WE_DBGLOG_VAP_DISABLE] = hdd_we_dbglog_vap_disable,
5198 [WE_DBGLOG_MODULE_ENABLE] = hdd_we_dbglog_module_enable,
5199 [WE_DBGLOG_MODULE_DISABLE] = hdd_we_dbglog_module_disable,
5200 [WE_DBGLOG_MOD_LOG_LEVEL] = hdd_we_dbglog_mod_log_level,
5201 [WE_DBGLOG_TYPE] = hdd_we_dbglog_type,
5202 [WE_DBGLOG_REPORT_ENABLE] = hdd_we_dbglog_report_enable,
5203 [WE_SET_TXRX_FWSTATS] = hdd_we_set_txrx_fwstats,
5204 [WE_TXRX_FWSTATS_RESET] = hdd_we_txrx_fwstats_reset,
5205 [WE_DUMP_STATS] = hdd_wlan_dump_stats,
5206 [WE_CLEAR_STATS] = hdd_we_clear_stats,
5207 [WE_PPS_PAID_MATCH] = hdd_we_pps_paid_match,
5208 [WE_PPS_GID_MATCH] = hdd_we_pps_gid_match,
5209 [WE_PPS_EARLY_TIM_CLEAR] = hdd_we_pps_early_tim_clear,
5210 [WE_PPS_EARLY_DTIM_CLEAR] = hdd_we_pps_early_dtim_clear,
5211 [WE_PPS_EOF_PAD_DELIM] = hdd_we_pps_eof_pad_delim,
5212 [WE_PPS_MACADDR_MISMATCH] = hdd_we_pps_macaddr_mismatch,
5213 [WE_PPS_DELIM_CRC_FAIL] = hdd_we_pps_delim_crc_fail,
5214 [WE_PPS_GID_NSTS_ZERO] = hdd_we_pps_gid_nsts_zero,
5215 [WE_PPS_RSSI_CHECK] = hdd_we_pps_rssi_check,
5216 [WE_PPS_5G_EBT] = hdd_we_pps_5g_ebt,
5217 [WE_SET_HTSMPS] = hdd_we_set_htsmps,
5218 [WE_SET_QPOWER_MAX_PSPOLL_COUNT] = hdd_we_set_qpower_max_pspoll_count,
5219 [WE_SET_QPOWER_MAX_TX_BEFORE_WAKE] =
5220 hdd_we_set_qpower_max_tx_before_wake,
5221 [WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL] =
5222 hdd_we_set_qpower_spec_pspoll_wake_interval,
5223 [WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL] =
5224 hdd_we_set_qpower_spec_max_spec_nodata_pspoll,
5225 [WE_MCC_CONFIG_LATENCY] = hdd_we_mcc_config_latency,
5226 [WE_MCC_CONFIG_QUOTA] = hdd_we_mcc_config_quota,
5227 [WE_SET_DEBUG_LOG] = hdd_we_set_debug_log,
5228 [WE_SET_EARLY_RX_ADJUST_ENABLE] = hdd_we_set_early_rx_adjust_enable,
5229 [WE_SET_EARLY_RX_TGT_BMISS_NUM] = hdd_we_set_early_rx_tgt_bmiss_num,
5230 [WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE] =
5231 hdd_we_set_early_rx_bmiss_sample_cycle,
5232 [WE_SET_EARLY_RX_SLOP_STEP] = hdd_we_set_early_rx_slop_step,
5233 [WE_SET_EARLY_RX_INIT_SLOP] = hdd_we_set_early_rx_init_slop,
5234 [WE_SET_EARLY_RX_ADJUST_PAUSE] = hdd_we_set_early_rx_adjust_pause,
5235 [WE_SET_EARLY_RX_DRIFT_SAMPLE] = hdd_we_set_early_rx_drift_sample,
5236 [WE_SET_SCAN_DISABLE] = hdd_we_set_scan_disable,
5237 [WE_START_FW_PROFILE] = hdd_we_start_fw_profile,
5238 [WE_SET_CHANNEL] = hdd_we_set_channel,
5239 [WE_SET_CONC_SYSTEM_PREF] = hdd_we_set_conc_system_pref,
5240 [WE_SET_11AX_RATE] = hdd_we_set_11ax_rate,
5241 [WE_SET_DCM] = hdd_we_set_dcm,
5242 [WE_SET_RANGE_EXT] = hdd_we_set_range_ext,
5243 [WE_SET_PDEV_RESET] = hdd_handle_pdev_reset,
5244 [WE_SET_MODULATED_DTIM] = hdd_we_set_modulated_dtim,
5245};
5246
5247static setint_getnone_fn hdd_get_setint_getnone_cb(int param)
5248{
5249 if (param < 0)
5250 return NULL;
5251
5252 if (param >= QDF_ARRAY_SIZE(setint_getnone_cb))
5253 return NULL;
5254
5255 return setint_getnone_cb[param];
5256}
5257
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005258/**
5259 * iw_setint_getnone() - Generic "set integer" private ioctl handler
5260 * @dev: device upon which the ioctl was received
5261 * @info: ioctl request information
5262 * @wrqu: ioctl request data
5263 * @extra: ioctl extra data
5264 *
5265 * Return: 0 on success, non-zero on error
5266 */
5267static int __iw_setint_getnone(struct net_device *dev,
5268 struct iw_request_info *info,
5269 union iwreq_data *wrqu, char *extra)
5270{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005271 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005272 struct hdd_context *hdd_ctx;
Jeff Johnson3ba27322018-11-13 17:58:28 -08005273 setint_getnone_fn cb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005274 int *value = (int *)extra;
5275 int sub_cmd = value[0];
5276 int set_value = value[1];
5277 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005278
Dustin Brownfdf17c12018-03-14 12:55:34 -07005279 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305280
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005281 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005282 ret = wlan_hdd_validate_context(hdd_ctx);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005283 if (ret)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005284 return ret;
5285
Jeff Johnson441e1f72017-02-07 08:50:49 -08005286 ret = hdd_check_private_wext_control(hdd_ctx, info);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005287 if (ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08005288 return ret;
5289
Jeff Johnson3ba27322018-11-13 17:58:28 -08005290 cb = hdd_get_setint_getnone_cb(sub_cmd);
5291 if (!cb) {
Rajeev Kumard0565362018-03-01 12:02:01 -08005292 hdd_debug("Invalid sub command %d", sub_cmd);
Jeff Johnson3ba27322018-11-13 17:58:28 -08005293 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005294 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005295
Jeff Johnson3ba27322018-11-13 17:58:28 -08005296 ret = cb(adapter, set_value);
5297
Dustin Browne74003f2018-03-14 12:51:58 -07005298 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005299
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005300 return ret;
5301}
5302
5303static int iw_setint_getnone(struct net_device *dev,
5304 struct iw_request_info *info,
5305 union iwreq_data *wrqu,
5306 char *extra)
5307{
5308 int ret;
5309
5310 cds_ssr_protect(__func__);
5311 ret = __iw_setint_getnone(dev, info, wrqu, extra);
5312 cds_ssr_unprotect(__func__);
5313
5314 return ret;
5315}
5316
5317/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005318 * __iw_setnone_get_threeint() - return three value to up layer.
5319 *
5320 * @dev: pointer of net_device of this wireless card
5321 * @info: meta data about Request sent
5322 * @wrqu: include request info
5323 * @extra: buf used for in/Output
5324 *
5325 * Return: execute result
5326 */
5327static int __iw_setnone_get_threeint(struct net_device *dev,
5328 struct iw_request_info *info,
5329 union iwreq_data *wrqu, char *extra)
5330{
5331 int ret = 0; /* success */
5332 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005333 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005334 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005335
Dustin Brownfdf17c12018-03-14 12:55:34 -07005336 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005337 ret = wlan_hdd_validate_context(hdd_ctx);
5338 if (0 != ret)
5339 return ret;
5340
Jeff Johnson441e1f72017-02-07 08:50:49 -08005341 ret = hdd_check_private_wext_control(hdd_ctx, info);
5342 if (0 != ret)
5343 return ret;
5344
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005345 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005346 switch (value[0]) {
5347 case WE_GET_TSF:
5348 ret = hdd_indicate_tsf(adapter, value, 3);
5349 break;
5350 default:
5351 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5352 break;
5353 }
5354 return ret;
5355}
5356
5357/**
5358 * iw_setnone_get_threeint() - return three value to up layer.
5359 *
5360 * @dev: pointer of net_device of this wireless card
5361 * @info: meta data about Request sent
5362 * @wrqu: include request info
5363 * @extra: buf used for in/Output
5364 *
5365 * Return: execute result
5366 */
5367static int iw_setnone_get_threeint(struct net_device *dev,
5368 struct iw_request_info *info,
5369 union iwreq_data *wrqu, char *extra)
5370{
5371 int ret;
5372
5373 cds_ssr_protect(__func__);
5374 ret = __iw_setnone_get_threeint(dev, info, wrqu, extra);
5375 cds_ssr_unprotect(__func__);
5376
5377 return ret;
5378}
5379
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005380#ifdef WLAN_UNIT_TEST
Dustin Brown7d038e52018-11-29 14:28:13 -08005381typedef uint32_t (*hdd_ut_callback)(void);
5382
5383struct hdd_ut_entry {
5384 const hdd_ut_callback callback;
5385 const char *name;
5386};
5387
5388struct hdd_ut_entry hdd_ut_entries[] = {
5389 { .name = "dsc", .callback = dsc_unit_test },
5390};
5391
5392#define hdd_for_each_ut_entry(cursor) \
5393 for (cursor = hdd_ut_entries; \
5394 cursor < hdd_ut_entries + ARRAY_SIZE(hdd_ut_entries); \
5395 cursor++)
5396
5397static struct hdd_ut_entry *hdd_ut_lookup(const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005398{
Dustin Brown7d038e52018-11-29 14:28:13 -08005399 struct hdd_ut_entry *entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005400
Dustin Brown7d038e52018-11-29 14:28:13 -08005401 hdd_for_each_ut_entry(entry) {
5402 if (qdf_str_eq(entry->name, name))
5403 return entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005404 }
5405
Dustin Brown7d038e52018-11-29 14:28:13 -08005406 return NULL;
5407}
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005408
Dustin Brown7d038e52018-11-29 14:28:13 -08005409static uint32_t hdd_ut_single(const struct hdd_ut_entry *entry)
5410{
5411 uint32_t errors;
5412
5413 hdd_nofl_info("START: '%s'", entry->name);
5414
5415 errors = entry->callback();
5416 if (errors)
5417 hdd_nofl_err("FAIL: '%s' with %u errors", entry->name, errors);
5418 else
5419 hdd_nofl_info("PASS: '%s'", entry->name);
5420
5421 return errors;
5422}
5423
5424static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
5425{
5426 struct hdd_ut_entry *entry;
5427 uint32_t errors = 0;
5428
5429 hdd_nofl_info("Unit tests begin");
5430
5431 if (!name || !name[0] || qdf_str_eq(name, "all")) {
5432 hdd_for_each_ut_entry(entry)
5433 errors += hdd_ut_single(entry);
5434 } else {
5435 entry = hdd_ut_lookup(name);
5436 if (entry)
5437 errors += hdd_ut_single(entry);
5438 else
5439 hdd_nofl_err("Unit test '%s' not found", name);
5440 }
5441
5442 hdd_nofl_info("Unit tests complete");
5443
5444 return errors ? -EPERM : 0;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005445}
5446#else
Dustin Brown7d038e52018-11-29 14:28:13 -08005447static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005448{
5449 return -EOPNOTSUPP;
5450}
5451#endif /* WLAN_UNIT_TEST */
5452
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005453/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005454 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5455 * @dev: device upon which the ioctl was received
5456 * @info: ioctl request information
5457 * @wrqu: ioctl request data
5458 * @extra: ioctl extra data
5459 *
5460 * Return: 0 on success, non-zero on error
5461 */
5462static int __iw_setchar_getnone(struct net_device *dev,
5463 struct iw_request_info *info,
5464 union iwreq_data *wrqu, char *extra)
5465{
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005466 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005467 int sub_cmd;
5468 int ret;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005469 char *str_arg = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005470 struct hdd_adapter *adapter = (netdev_priv(dev));
5471 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005472 struct iw_point s_priv_data;
5473
Dustin Brownfdf17c12018-03-14 12:55:34 -07005474 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005475
Mukul Sharma34777c62015-11-02 20:22:30 +05305476 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005477 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305478 return -EPERM;
5479 }
5480
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005481 ret = wlan_hdd_validate_context(hdd_ctx);
5482 if (0 != ret)
5483 return ret;
5484
Jeff Johnson441e1f72017-02-07 08:50:49 -08005485 ret = hdd_check_private_wext_control(hdd_ctx, info);
5486 if (0 != ret)
5487 return ret;
5488
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005489 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005490 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005491 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005492
5493 /* make sure all params are correctly passed to function */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005494 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005495 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005496
5497 sub_cmd = s_priv_data.flags;
5498
5499 /* ODD number is used for set, copy data using copy_from_user */
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005500 str_arg = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005501 s_priv_data.length);
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005502 if (!str_arg) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005503 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005504 return -ENOMEM;
5505 }
5506
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005507 hdd_debug("Received length: %d data: %s",
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005508 s_priv_data.length, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005509
5510 switch (sub_cmd) {
5511 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005512 hdd_debug("ADD_PTRN");
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005513 hdd_add_wowl_ptrn(adapter, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005514 break;
5515 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005516 hdd_debug("DEL_PTRN");
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005517 hdd_del_wowl_ptrn(adapter, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005518 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005519 case WE_NEIGHBOR_REPORT_REQUEST:
5520 {
5521 tRrmNeighborReq neighborReq;
5522 tRrmNeighborRspCallbackInfo callbackInfo;
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305523 bool rrm_enabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005524
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305525 ucfg_wlan_mlme_get_rrm_enabled(hdd_ctx->psoc,
5526 &rrm_enabled);
5527
5528 if (rrm_enabled) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305529 neighborReq.neighbor_report_offload = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005530 neighborReq.no_ssid =
5531 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305532 hdd_debug("Neighbor Request ssid present %d",
5533 neighborReq.no_ssid);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005534 if (!neighborReq.no_ssid) {
5535 neighborReq.ssid.length =
5536 (s_priv_data.length - 1) >
5537 32 ? 32 : (s_priv_data.length - 1);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305538 qdf_mem_copy(neighborReq.ssid.ssId,
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005539 str_arg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005540 neighborReq.ssid.length);
5541 }
5542
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305543 /*
5544 * If 11k offload is supported by FW and enabled
5545 * in the ini, set the offload to true
5546 */
5547 if (hdd_ctx->config->is_11k_offload_supported &&
5548 (hdd_ctx->config->offload_11k_enable_bitmask &
5549 OFFLOAD_11K_BITMASK_NEIGHBOR_REPORT_REQUEST)) {
5550 hdd_debug("Neighbor report offloaded to FW");
5551 neighborReq.neighbor_report_offload = true;
5552 }
5553
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005554 callbackInfo.neighborRspCallback = NULL;
5555 callbackInfo.neighborRspCallbackContext = NULL;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305556 callbackInfo.timeout = 5000; /* 5 seconds */
5557 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005558 hdd_ctx->mac_handle,
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305559 adapter->session_id,
5560 &neighborReq,
5561 &callbackInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005562 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005563 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005564 ret = -EINVAL;
5565 }
5566 }
5567 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005568 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08005569 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005570 break;
5571 case WE_SET_CONFIG:
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005572 status = hdd_execute_global_config_command(hdd_ctx, str_arg);
5573 if (QDF_IS_STATUS_ERROR(status))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005574 ret = -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005575
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005576 break;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005577 case WE_UNIT_TEST:
5578 ret = hdd_we_unit_test(hdd_ctx, str_arg);
5579 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005580 default:
5581 {
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005582 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005583 ret = -EINVAL;
5584 break;
5585 }
5586 }
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005587
5588 qdf_mem_free(str_arg);
Dustin Browne74003f2018-03-14 12:51:58 -07005589 hdd_exit();
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005590
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005591 return ret;
5592}
5593
5594static int iw_setchar_getnone(struct net_device *dev,
5595 struct iw_request_info *info,
5596 union iwreq_data *wrqu, char *extra)
5597{
5598 int ret;
5599
5600 cds_ssr_protect(__func__);
5601 ret = __iw_setchar_getnone(dev, info, wrqu, extra);
5602 cds_ssr_unprotect(__func__);
5603
5604 return ret;
5605}
5606
5607/**
5608 * iw_setnone_getint() - Generic "get integer" private ioctl handler
5609 * @dev: device upon which the ioctl was received
5610 * @info: ioctl request information
5611 * @wrqu: ioctl request data
5612 * @extra: ioctl extra data
5613 *
5614 * Return: 0 on success, non-zero on error
5615 */
5616static int __iw_setnone_getint(struct net_device *dev,
5617 struct iw_request_info *info,
5618 union iwreq_data *wrqu, char *extra)
5619{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005620 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005621 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005622 int *value = (int *)extra;
5623 int ret;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305624 tSmeConfigParams *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005625 struct hdd_context *hdd_ctx;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05305626 QDF_STATUS status;
5627 bool bval = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005628
Dustin Brownfdf17c12018-03-14 12:55:34 -07005629 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305630
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005631 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005632 ret = wlan_hdd_validate_context(hdd_ctx);
5633 if (0 != ret)
5634 return ret;
5635
Jeff Johnson441e1f72017-02-07 08:50:49 -08005636 ret = hdd_check_private_wext_control(hdd_ctx, info);
5637 if (0 != ret)
5638 return ret;
5639
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08005640 sme_config = qdf_mem_malloc(sizeof(*sme_config));
5641 if (!sme_config) {
5642 hdd_err("failed to allocate memory for sme_config");
5643 return -ENOMEM;
5644 }
5645
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005646 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005647 switch (value[0]) {
5648 case WE_GET_11D_STATE:
5649 {
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05305650 status = ucfg_mlme_is_11d_enabled(hdd_ctx->psoc, &bval);
5651 if (!QDF_IS_STATUS_SUCCESS(status))
5652 hdd_err("Invalid 11d_enable flag");
5653 *value = bval;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005654 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005655
5656 break;
5657 }
5658
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005659 case WE_GET_WLAN_DBG:
5660 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05305661 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005662 *value = 0;
5663 break;
5664 }
5665 case WE_GET_MAX_ASSOC:
5666 {
Dustin Brown05d81302018-09-11 16:49:22 -07005667 if (ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, *value) !=
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05305668 QDF_STATUS_SUCCESS) {
5669 hdd_err("CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005670 ret = -EIO;
5671 }
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05305672
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005673 break;
5674 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005675
5676 case WE_GET_CONCURRENCY_MODE:
5677 {
Dustin Brown05d81302018-09-11 16:49:22 -07005678 *value = policy_mgr_get_concurrency_mode(hdd_ctx->psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005679
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005680 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005681 break;
5682 }
5683
5684 case WE_GET_NSS:
5685 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005686 sme_get_config_param(mac_handle, sme_config);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05305687 status = ucfg_mlme_get_vht_enable2x2(hdd_ctx->psoc, &bval);
5688 if (!QDF_IS_STATUS_SUCCESS(status))
5689 hdd_err("unable to get vht_enable2x2");
5690 *value = (bval == 0) ? 1 : 2;
Dustin Brown05d81302018-09-11 16:49:22 -07005691 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc))
Srinivas Girigowda576b2352017-08-25 14:44:26 -07005692 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005693 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005694 break;
5695 }
5696
5697 case WE_GET_GTX_HT_MCS:
5698 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005699 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005700 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005701 WMI_VDEV_PARAM_GTX_HT_MCS,
5702 GTX_CMD);
5703 break;
5704 }
5705
5706 case WE_GET_GTX_VHT_MCS:
5707 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005708 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005709 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005710 WMI_VDEV_PARAM_GTX_VHT_MCS,
5711 GTX_CMD);
5712 break;
5713 }
5714
5715 case WE_GET_GTX_USRCFG:
5716 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005717 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005718 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005719 WMI_VDEV_PARAM_GTX_USR_CFG,
5720 GTX_CMD);
5721 break;
5722 }
5723
5724 case WE_GET_GTX_THRE:
5725 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005726 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005727 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005728 WMI_VDEV_PARAM_GTX_THRE,
5729 GTX_CMD);
5730 break;
5731 }
5732
5733 case WE_GET_GTX_MARGIN:
5734 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005735 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005736 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005737 WMI_VDEV_PARAM_GTX_MARGIN,
5738 GTX_CMD);
5739 break;
5740 }
5741
5742 case WE_GET_GTX_STEP:
5743 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005744 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005745 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005746 WMI_VDEV_PARAM_GTX_STEP,
5747 GTX_CMD);
5748 break;
5749 }
5750
5751 case WE_GET_GTX_MINTPC:
5752 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005753 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005754 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005755 WMI_VDEV_PARAM_GTX_MINTPC,
5756 GTX_CMD);
5757 break;
5758 }
5759
5760 case WE_GET_GTX_BWMASK:
5761 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005762 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005763 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005764 WMI_VDEV_PARAM_GTX_BW_MASK,
5765 GTX_CMD);
5766 break;
5767 }
5768
5769 case WE_GET_LDPC:
5770 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005771 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005772 break;
5773 }
5774
5775 case WE_GET_TX_STBC:
5776 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005777 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005778 break;
5779 }
5780
5781 case WE_GET_RX_STBC:
5782 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005783 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005784 break;
5785 }
5786
5787 case WE_GET_SHORT_GI:
5788 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005789 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005790 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08005791 WMI_VDEV_PARAM_SGI,
5792 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005793 break;
5794 }
5795
5796 case WE_GET_RTSCTS:
5797 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005798 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005799 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005800 WMI_VDEV_PARAM_ENABLE_RTSCTS,
5801 VDEV_CMD);
5802 break;
5803 }
5804
5805 case WE_GET_CHWIDTH:
5806 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005807 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005808 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005809 WMI_VDEV_PARAM_CHWIDTH,
5810 VDEV_CMD);
5811 break;
5812 }
5813
5814 case WE_GET_ANI_EN_DIS:
5815 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005816 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005817 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005818 WMI_PDEV_PARAM_ANI_ENABLE,
5819 PDEV_CMD);
5820 break;
5821 }
5822
5823 case WE_GET_ANI_POLL_PERIOD:
5824 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005825 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005826 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005827 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
5828 PDEV_CMD);
5829 break;
5830 }
5831
5832 case WE_GET_ANI_LISTEN_PERIOD:
5833 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005834 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005835 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005836 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
5837 PDEV_CMD);
5838 break;
5839 }
5840
5841 case WE_GET_ANI_OFDM_LEVEL:
5842 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005843 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005844 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005845 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
5846 PDEV_CMD);
5847 break;
5848 }
5849
5850 case WE_GET_ANI_CCK_LEVEL:
5851 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005852 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005853 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005854 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
5855 PDEV_CMD);
5856 break;
5857 }
5858
5859 case WE_GET_DYNAMIC_BW:
5860 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005861 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005862 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005863 WMI_PDEV_PARAM_DYNAMIC_BW,
5864 PDEV_CMD);
5865 break;
5866 }
5867
5868 case WE_GET_11N_RATE:
5869 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005870 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005871 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005872 WMI_VDEV_PARAM_FIXED_RATE,
5873 VDEV_CMD);
5874 break;
5875 }
5876
5877 case WE_GET_AMPDU:
5878 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005879 hdd_debug("GET AMPDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005880 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005881 GEN_VDEV_PARAM_AMPDU,
5882 GEN_CMD);
5883 break;
5884 }
5885
5886 case WE_GET_AMSDU:
5887 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005888 hdd_debug("GET AMSDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005889 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005890 GEN_VDEV_PARAM_AMSDU,
5891 GEN_CMD);
5892 break;
5893 }
5894
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07005895 case WE_GET_ROAM_SYNCH_DELAY:
5896 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005897 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005898 *value = wma_cli_get_command(adapter->session_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07005899 GEN_VDEV_ROAM_SYNCH_DELAY,
5900 GEN_CMD);
5901 break;
5902 }
5903
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005904 case WE_GET_TX_CHAINMASK:
5905 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005906 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005907 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005908 WMI_PDEV_PARAM_TX_CHAIN_MASK,
5909 PDEV_CMD);
5910 break;
5911 }
5912
5913 case WE_GET_RX_CHAINMASK:
5914 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005915 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005916 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005917 WMI_PDEV_PARAM_RX_CHAIN_MASK,
5918 PDEV_CMD);
5919 break;
5920 }
5921
5922 case WE_GET_TXPOW_2G:
5923 {
5924 uint32_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005925
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005926 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005927 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005928 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
5929 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305930 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005931 sme_cfg_get_int(mac_handle, WNI_CFG_CURRENT_TX_POWER_LEVEL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005932 &txpow2g)) {
5933 return -EIO;
5934 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005935 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005936 break;
5937 }
5938
5939 case WE_GET_TXPOW_5G:
5940 {
5941 uint32_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005942
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005943 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005944 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005945 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
5946 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305947 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005948 sme_cfg_get_int(mac_handle, WNI_CFG_CURRENT_TX_POWER_LEVEL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005949 &txpow5g)) {
5950 return -EIO;
5951 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005952 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005953 break;
5954 }
5955
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005956 case WE_GET_PPS_PAID_MATCH:
5957 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005958 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005959 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005960 WMI_VDEV_PPS_PAID_MATCH,
5961 PPS_CMD);
5962 break;
5963 }
5964
5965 case WE_GET_PPS_GID_MATCH:
5966 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005967 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005968 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005969 WMI_VDEV_PPS_GID_MATCH,
5970 PPS_CMD);
5971 break;
5972 }
5973
5974 case WE_GET_PPS_EARLY_TIM_CLEAR:
5975 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005976 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005977 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005978 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
5979 PPS_CMD);
5980 break;
5981 }
5982
5983 case WE_GET_PPS_EARLY_DTIM_CLEAR:
5984 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005985 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005986 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005987 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
5988 PPS_CMD);
5989 break;
5990 }
5991
5992 case WE_GET_PPS_EOF_PAD_DELIM:
5993 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005994 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005995 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005996 WMI_VDEV_PPS_EOF_PAD_DELIM,
5997 PPS_CMD);
5998 break;
5999 }
6000
6001 case WE_GET_PPS_MACADDR_MISMATCH:
6002 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006003 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006004 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006005 WMI_VDEV_PPS_MACADDR_MISMATCH,
6006 PPS_CMD);
6007 break;
6008 }
6009
6010 case WE_GET_PPS_DELIM_CRC_FAIL:
6011 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006012 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006013 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006014 WMI_VDEV_PPS_DELIM_CRC_FAIL,
6015 PPS_CMD);
6016 break;
6017 }
6018
6019 case WE_GET_PPS_GID_NSTS_ZERO:
6020 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006021 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006022 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006023 WMI_VDEV_PPS_GID_NSTS_ZERO,
6024 PPS_CMD);
6025 break;
6026 }
6027
6028 case WE_GET_PPS_RSSI_CHECK:
6029 {
6030
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006031 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006032 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006033 WMI_VDEV_PPS_RSSI_CHECK,
6034 PPS_CMD);
6035 break;
6036 }
6037
6038 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
6039 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006040 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006041 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006042 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
6043 QPOWER_CMD);
6044 break;
6045 }
6046
6047 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
6048 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006049 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006050 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006051 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
6052 QPOWER_CMD);
6053 break;
6054 }
6055
6056 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
6057 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006058 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006059 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006060 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
6061 QPOWER_CMD);
6062 break;
6063 }
6064
6065 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
6066 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006067 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006068 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006069 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
6070 QPOWER_CMD);
6071 break;
6072 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006073 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006074 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006075 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006076 case WE_GET_TEMPERATURE:
6077 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006078 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006079 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006080 break;
6081 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006082 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006083 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006084 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006085 WMI_VDEV_PARAM_HE_DCM,
6086 VDEV_CMD);
6087 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006088 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006089 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006090 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006091 WMI_VDEV_PARAM_HE_RANGE_EXT,
6092 VDEV_CMD);
6093 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006094 default:
6095 {
Jeff Johnson99bac312016-06-28 10:38:18 -07006096 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006097 value[0]);
6098 break;
6099 }
6100 }
Dustin Browne74003f2018-03-14 12:51:58 -07006101 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306102 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006103 return ret;
6104}
6105
6106static int iw_setnone_getint(struct net_device *dev,
6107 struct iw_request_info *info,
6108 union iwreq_data *wrqu, char *extra)
6109{
6110 int ret;
6111
6112 cds_ssr_protect(__func__);
6113 ret = __iw_setnone_getint(dev, info, wrqu, extra);
6114 cds_ssr_unprotect(__func__);
6115
6116 return ret;
6117}
6118
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306119static int hdd_set_fwtest(int argc, int cmd, int value)
6120{
6121 struct set_fwtest_params *fw_test;
6122
6123 /* check for max number of arguments */
6124 if (argc > (WMA_MAX_NUM_ARGS) ||
6125 argc != HDD_FWTEST_PARAMS) {
6126 hdd_err("Too Many args %d", argc);
6127 return -EINVAL;
6128 }
6129 /*
6130 * check if number of arguments are 3 then, check
6131 * then set the default value for sounding interval.
6132 */
6133 if (HDD_FWTEST_PARAMS == argc) {
6134 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
6135 value = HDD_FWTEST_SU_DEFAULT_VALUE;
6136 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6137 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6138 }
6139 /* check sounding interval value should not exceed to max */
6140 if (value > HDD_FWTEST_MAX_VALUE) {
6141 hdd_err("Invalid arguments value should not exceed max: %d",
6142 value);
6143 return -EINVAL;
6144 }
6145 fw_test = qdf_mem_malloc(sizeof(*fw_test));
6146 if (NULL == fw_test) {
6147 hdd_err("qdf_mem_malloc failed for fw_test");
6148 return -ENOMEM;
6149 }
6150 fw_test->arg = cmd;
6151 fw_test->value = value;
6152 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6153 qdf_mem_free(fw_test);
6154 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6155 return -EINVAL;
6156 }
6157 return 0;
6158}
6159
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006160/**
6161 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6162 * @dev: device upon which the ioctl was received
6163 * @info: ioctl request information
6164 * @wrqu: ioctl request data
6165 * @extra: ioctl extra data
6166 *
6167 * Return: 0 on success, non-zero on error
6168 */
6169static int __iw_set_three_ints_getnone(struct net_device *dev,
6170 struct iw_request_info *info,
6171 union iwreq_data *wrqu, char *extra)
6172{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006173 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006174 int *value = (int *)extra;
6175 int sub_cmd = value[0];
6176 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08006177 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006178 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08006179 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006180
Dustin Brownfdf17c12018-03-14 12:55:34 -07006181 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306182
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006183 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006184 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006185 return -EPERM;
6186 }
6187
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006188 ret = wlan_hdd_validate_context(hdd_ctx);
6189 if (0 != ret)
6190 return ret;
6191
Jeff Johnson441e1f72017-02-07 08:50:49 -08006192 ret = hdd_check_private_wext_control(hdd_ctx, info);
6193 if (0 != ret)
6194 return ret;
6195
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006196 switch (sub_cmd) {
6197
6198 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006199 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6200 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006201 break;
6202 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306203 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006204 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306205
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006206 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6207 hdd_debug("Ioctl to set dual mac scan config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08006208 status =
6209 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
6210 &dual_mac_feature);
6211 if (status != QDF_STATUS_SUCCESS)
6212 hdd_err("can't get dual mac feature val, use def");
6213 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006214 hdd_err("Dual mac feature is disabled from INI");
6215 return -EPERM;
6216 }
6217 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Dustin Brown05d81302018-09-11 16:49:22 -07006218 policy_mgr_set_dual_mac_scan_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006219 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006220 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306221 case WE_SET_FW_TEST:
6222 {
6223 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6224 if (ret) {
6225 hdd_err("Not able to set fwtest %d", ret);
6226 return ret;
6227 }
6228 }
6229 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006230 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006231 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006232 break;
6233
6234 }
Dustin Browne74003f2018-03-14 12:51:58 -07006235 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006236 return ret;
6237}
6238
6239int iw_set_three_ints_getnone(struct net_device *dev,
6240 struct iw_request_info *info,
6241 union iwreq_data *wrqu, char *extra)
6242{
6243 int ret;
6244
6245 cds_ssr_protect(__func__);
6246 ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
6247 cds_ssr_unprotect(__func__);
6248
6249 return ret;
6250}
6251
6252/**
6253 * hdd_connection_state_string() - Get connection state string
6254 * @connection_state: enum to be converted to a string
6255 *
6256 * Return: the string equivalent of @connection_state
6257 */
6258static const char *
6259hdd_connection_state_string(eConnectionState connection_state)
6260{
6261 switch (connection_state) {
6262 CASE_RETURN_STRING(eConnectionState_NotConnected);
6263 CASE_RETURN_STRING(eConnectionState_Connecting);
6264 CASE_RETURN_STRING(eConnectionState_Associated);
6265 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6266 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6267 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6268 default:
6269 return "UNKNOWN";
6270 }
6271}
6272
Naveen Rawat910726a2017-03-06 11:42:51 -08006273#if defined(FEATURE_OEM_DATA_SUPPORT)
6274/**
6275 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6276 * wifi_pos api to get oem data caps
6277 * @dev: net device upon which the request was received
6278 * @info: ioctl request information
6279 * @wrqu: ioctl request data
6280 * @extra: ioctl data payload
6281 *
6282 * Return: 0 for success, negative errno value on failure
6283 */
6284static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6285 struct iw_request_info *info,
6286 union iwreq_data *wrqu, char *extra)
6287{
6288 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6289}
6290#elif defined(WIFI_POS_CONVERGED)
6291static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6292 struct iw_request_info *info,
6293 union iwreq_data *wrqu, char *extra)
6294{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006295 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006296 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006297
Dustin Brown05d81302018-09-11 16:49:22 -07006298 return os_if_wifi_pos_populate_caps(hdd_ctx->psoc,
Naveen Rawat910726a2017-03-06 11:42:51 -08006299 (struct wifi_pos_driver_caps *)extra);
6300}
6301#else
6302static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6303 struct iw_request_info *info,
6304 union iwreq_data *wrqu, char *extra)
6305{
6306 return -ENOTSUPP;
6307}
6308#endif
6309
Krunal Soni5e483782018-10-25 15:42:44 -07006310#ifdef WLAN_UNIT_TEST
6311static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6312 struct hdd_adapter *adapter,
6313 char *extra)
6314{
6315 QDF_STATUS status;
6316
6317 status = sme_get_sta_cxn_info(hdd_ctx->mac_handle, adapter->session_id,
6318 extra, WE_MAX_STR_LEN);
6319 if (status != QDF_STATUS_SUCCESS)
6320 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6321 "\nNo active connection");
6322
6323 return 0;
6324}
6325#else
6326static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6327 struct hdd_adapter *adapter,
6328 char *extra)
6329{
6330 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6331 "\nNot supported");
6332 return -ENOTSUPP;
6333}
6334#endif
6335
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006336/**
6337 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6338 * @dev: device upon which the ioctl was received
6339 * @info: ioctl request information
6340 * @wrqu: ioctl request data
6341 * @extra: ioctl extra data
6342 *
6343 * Return: 0 on success, non-zero on error
6344 */
6345static int __iw_get_char_setnone(struct net_device *dev,
6346 struct iw_request_info *info,
6347 union iwreq_data *wrqu, char *extra)
6348{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006349 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006350 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006351 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006352 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006353 int ret;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306354 QDF_STATUS status;
6355 uint8_t value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006356
Dustin Brownfdf17c12018-03-14 12:55:34 -07006357 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306358
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006359 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006360 ret = wlan_hdd_validate_context(hdd_ctx);
6361 if (0 != ret)
6362 return ret;
6363
Jeff Johnson441e1f72017-02-07 08:50:49 -08006364 ret = hdd_check_private_wext_control(hdd_ctx, info);
6365 if (0 != ret)
6366 return ret;
6367
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006368 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006369 switch (sub_cmd) {
6370 case WE_WLAN_VERSION:
6371 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006372 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6373 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006374 break;
6375 }
6376
6377 case WE_GET_STATS:
6378 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006379 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006380 extra, WE_MAX_STR_LEN);
6381 break;
6382 }
6383
Dustin Brownd9322482017-01-09 12:46:03 -08006384 case WE_GET_SUSPEND_RESUME_STATS:
6385 {
6386 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6387 WE_MAX_STR_LEN);
6388 if (ret >= 0) {
6389 wrqu->data.length = ret;
6390 ret = 0;
6391 }
6392
6393 break;
6394 }
6395
Govind Singha471e5e2015-10-12 17:11:14 +05306396 case WE_LIST_FW_PROFILE:
6397 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6398 extra, WE_MAX_STR_LEN);
6399 break;
6400
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006401 /* The case prints the current state of the HDD, SME, CSR, PE,
6402 * TL it can be extended for WDI Global State as well. And
6403 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6404 * and P2P_GO have not been added as of now.
6405 */
6406 case WE_GET_STATES:
6407 {
6408 int buf = 0, len = 0;
6409 int adapter_num = 0;
6410 int count = 0, check = 1;
6411
Jeff Johnsond377dce2017-10-04 10:32:42 -07006412 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006413
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006414 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson3d278b02017-08-29 14:17:47 -07006415 struct hdd_adapter *useAdapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006416
6417 /* Print wlan0 or p2p0 states based on the adapter_num
6418 * by using the correct adapter
6419 */
6420 while (adapter_num < 2) {
6421 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006422 useAdapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006423 buf =
6424 scnprintf(extra + len,
6425 WE_MAX_STR_LEN - len,
6426 "\n\n wlan0 States:-");
6427 len += buf;
6428 } else if (P2P_ADAPTER == adapter_num) {
6429 buf =
6430 scnprintf(extra + len,
6431 WE_MAX_STR_LEN - len,
6432 "\n\n p2p0 States:-");
6433 len += buf;
6434
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006435 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006436 buf =
6437 scnprintf(extra + len,
6438 WE_MAX_STR_LEN -
6439 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006440 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006441 len += buf;
6442 break;
6443 }
6444
6445 /* Printing p2p0 states only in the
6446 * case when the device is configured
6447 * as a p2p_client
6448 */
6449 useAdapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006450 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006451 QDF_P2P_CLIENT_MODE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006452 if (!useAdapter) {
6453 buf =
6454 scnprintf(extra + len,
6455 WE_MAX_STR_LEN -
6456 len,
6457 "\n Device not configured as P2P_CLIENT.");
6458 len += buf;
6459 break;
6460 }
6461 }
6462
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006463 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006464 buf = scnprintf(extra + len,
6465 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006466 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006467 len += buf;
6468 break;
6469 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006470 sta_ctx =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006471 WLAN_HDD_GET_STATION_CTX_PTR(useAdapter);
6472
6473
6474 buf =
6475 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6476 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006477 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006478 "\n Neighbour Roam State - %s"
6479 "\n CSR State - %s"
6480 "\n CSR Substate - %s",
6481 hdd_connection_state_string
Jeff Johnsond377dce2017-10-04 10:32:42 -07006482 (sta_ctx->conn_info.connState),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006483 mac_trace_get_neighbour_roam_state
6484 (sme_get_neighbor_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006485 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006486 mac_trace_getcsr_roam_state
6487 (sme_get_current_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006488 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006489 mac_trace_getcsr_roam_sub_state
6490 (sme_get_current_roam_sub_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006491 (mac_handle, useAdapter->session_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006492 );
6493 len += buf;
6494 adapter_num++;
6495 }
6496
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006497 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006498 /* Printing Lim State starting with global lim states */
6499 buf =
6500 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006501 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006502 "\n Global Sme State - %s "
6503 "\n Global mlm State - %s " "\n",
6504 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006505 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006506 mac_trace_get_lim_mlm_state
Jeff Johnson71d465a2018-12-05 11:13:30 -08006507 (sme_get_lim_mlm_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006508 );
6509 len += buf;
6510
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006511 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006512 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006513 buf =
6514 scnprintf(extra + len,
6515 WE_MAX_STR_LEN -
6516 len,
6517 "\n Lim Valid Session %d:-"
6518 "\n PE Sme State - %s "
6519 "\n PE Mlm State - %s "
6520 "\n", check,
6521 mac_trace_get_lim_sme_state
6522 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006523 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006524 mac_trace_get_lim_mlm_state
6525 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006526 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006527 );
6528
6529 len += buf;
6530 check++;
6531 }
6532 count++;
6533 }
6534 }
6535
6536 wrqu->data.length = strlen(extra) + 1;
6537 break;
6538 }
6539
6540 case WE_GET_CFG:
6541 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006542 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006543 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006544 extra,
6545 QCSAP_IOCTL_MAX_STR_LEN);
6546 wrqu->data.length = strlen(extra) + 1;
6547 break;
6548 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006549 case WE_GET_RSSI:
6550 {
6551 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006552
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006553 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006554 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
6555 wrqu->data.length = strlen(extra) + 1;
6556 break;
6557 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006558
6559 case WE_GET_WMM_STATUS:
6560 {
6561 snprintf(extra, WE_MAX_STR_LEN,
6562 "\nDir: 0=up, 1=down, 3=both\n"
6563 "|------------------------|\n"
6564 "|AC | ACM |Admitted| Dir |\n"
6565 "|------------------------|\n"
6566 "|VO | %d | %3s | %d |\n"
6567 "|VI | %d | %3s | %d |\n"
6568 "|BE | %d | %3s | %d |\n"
6569 "|BK | %d | %3s | %d |\n"
6570 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006571 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006572 wmmAcStatus[SME_AC_VO].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006573 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006574 wmmAcStatus[SME_AC_VO].
6575 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006576 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006577 wmmAcStatus[SME_AC_VO].wmmAcTspecInfo.
6578 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006579 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006580 wmmAcStatus[SME_AC_VI].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006581 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006582 wmmAcStatus[SME_AC_VI].
6583 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006584 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006585 wmmAcStatus[SME_AC_VI].wmmAcTspecInfo.
6586 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006587 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006588 wmmAcStatus[SME_AC_BE].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006589 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006590 wmmAcStatus[SME_AC_BE].
6591 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006592 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006593 wmmAcStatus[SME_AC_BE].wmmAcTspecInfo.
6594 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006595 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006596 wmmAcStatus[SME_AC_BK].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006597 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006598 wmmAcStatus[SME_AC_BK].
6599 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006600 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006601 wmmAcStatus[SME_AC_BK].wmmAcTspecInfo.
6602 ts_info.direction);
6603
6604 wrqu->data.length = strlen(extra) + 1;
6605 break;
6606 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07006607
6608 case WE_GET_BA_AGEING_TIMEOUT:
6609 {
6610 uint8_t ac_cat = 4;
6611 uint32_t duration[ac_cat], i;
6612 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
6613
6614 if (!soc) {
6615 hdd_err("Invalid SOC handle");
6616 break;
6617 }
6618
6619 for (i = 0; i < ac_cat; i++)
6620 cdp_get_ba_timeout(soc, i, &duration[i]);
6621
6622 snprintf(extra, WE_MAX_STR_LEN,
6623 "\n|------------------------------|\n"
6624 "|AC | BA aging timeout duration |\n"
6625 "|--------------------------------|\n"
6626 "|VO | %d |\n"
6627 "|VI | %d |\n"
6628 "|BE | %d |\n"
6629 "|BK | %d |\n"
6630 "|--------------------------------|\n",
6631 duration[3], duration[2], duration[1], duration[0]);
6632
6633 wrqu->data.length = strlen(extra) + 1;
6634 break;
6635 }
6636
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006637 case WE_GET_CHANNEL_LIST:
6638 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306639 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006640 uint8_t i, len;
6641 char *buf;
6642 uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN];
6643 uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN;
Srinivas Girigowdac231df62017-03-24 18:27:57 -07006644 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006645
6646 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05306647 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006648 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306649 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006650 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006651 return -EINVAL;
6652 }
6653 buf = extra;
6654 /*
6655 * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN.
6656 * Maximum buffer needed = 5 * number of channels.
6657 * Check ifsufficient buffer is available and then
6658 * proceed to fill the buffer.
6659 */
6660 if (WE_MAX_STR_LEN <
6661 (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006662 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006663 return -EINVAL;
6664 }
6665 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
6666 channel_list.num_channels);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006667 if (QDF_STATUS_SUCCESS == sme_get_country_code(mac_handle,
6668 ubuf,
6669 &ubuf_len)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006670 /* Printing Country code in getChannelList */
6671 for (i = 0; i < (ubuf_len - 1); i++)
6672 len += scnprintf(buf + len,
6673 WE_MAX_STR_LEN - len,
6674 "%c", ubuf[i]);
6675 }
6676 for (i = 0; i < channel_list.num_channels; i++) {
6677 len +=
6678 scnprintf(buf + len, WE_MAX_STR_LEN - len,
6679 " %u", channel_list.channels[i]);
6680 }
6681 wrqu->data.length = strlen(extra) + 1;
6682
6683 break;
6684 }
6685#ifdef FEATURE_WLAN_TDLS
6686 case WE_GET_TDLS_PEERS:
6687 {
6688 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006689 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006690 WE_MAX_STR_LEN) + 1;
6691 break;
6692 }
6693#endif
6694#ifdef WLAN_FEATURE_11W
6695 case WE_GET_11W_INFO:
6696 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006697 struct csr_roam_profile *roam_profile =
6698 hdd_roam_profile(adapter);
6699
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006700 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006701 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006702
6703 snprintf(extra, WE_MAX_STR_LEN,
6704 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
6705 "\n Number of Unprotected Disassocs %d"
6706 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006707 roam_profile->BSSIDs.bssid->bytes[0],
6708 roam_profile->BSSIDs.bssid->bytes[1],
6709 roam_profile->BSSIDs.bssid->bytes[2],
6710 roam_profile->BSSIDs.bssid->bytes[3],
6711 roam_profile->BSSIDs.bssid->bytes[4],
6712 roam_profile->BSSIDs.bssid->bytes[5],
6713 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07006714 adapter->hdd_stats.hdd_pmf_stats.
6715 num_unprot_disassoc_rx,
6716 adapter->hdd_stats.hdd_pmf_stats.
6717 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006718
6719 wrqu->data.length = strlen(extra) + 1;
6720 break;
6721 }
6722#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006723 case WE_GET_IBSS_STA_INFO:
6724 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07006725 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006726 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006727 int idx = 0;
6728 int length = 0, buf = 0;
6729
Naveen Rawatc45d1622016-07-05 12:20:09 -07006730 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07006731 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07006732 sta_ctx->conn_info.staId[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006733 buf = snprintf
6734 ((extra + length),
6735 WE_MAX_STR_LEN - length,
6736 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnsond377dce2017-10-04 10:32:42 -07006737 sta_ctx->conn_info.staId[idx],
6738 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006739 peerMacAddress[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006740 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006741 peerMacAddress[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006742 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006743 peerMacAddress[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006744 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006745 peerMacAddress[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006746 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006747 peerMacAddress[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006748 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006749 peerMacAddress[idx].bytes[5]
6750 );
6751 length += buf;
6752 }
6753 }
6754 wrqu->data.length = strlen(extra) + 1;
6755 break;
6756 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006757 case WE_GET_PHYMODE:
6758 {
6759 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006760 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006761 eCsrPhyMode phymode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006762 enum band_info currBand;
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006763 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006764
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006765 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6766 if (!sme_config) {
6767 hdd_err("Out of memory");
6768 ret = -ENOMEM;
6769 break;
6770 }
6771
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006772 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006773 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006774 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006775 ch_bond24 = true;
6776
6777 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006778 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006779 ch_bond5g = true;
6780
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006781 qdf_mem_free(sme_config);
6782
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006783 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306784 if ((QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006785 sme_get_freq_band(mac_handle, &currBand))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006786 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006787 return -EIO;
6788 }
6789
6790 switch (phymode) {
6791 case eCSR_DOT11_MODE_AUTO:
6792 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
6793 break;
6794 case eCSR_DOT11_MODE_11n:
6795 case eCSR_DOT11_MODE_11n_ONLY:
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006796 if (currBand == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006797 if (ch_bond24)
6798 snprintf(extra, WE_MAX_STR_LEN,
6799 "11NGHT40");
6800 else
6801 snprintf(extra, WE_MAX_STR_LEN,
6802 "11NGHT20");
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006803 } else if (currBand == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006804 if (ch_bond5g)
6805 snprintf(extra, WE_MAX_STR_LEN,
6806 "11NAHT40");
6807 else
6808 snprintf(extra, WE_MAX_STR_LEN,
6809 "11NAHT20");
6810 } else {
6811 snprintf(extra, WE_MAX_STR_LEN, "11N");
6812 }
6813 break;
6814 case eCSR_DOT11_MODE_abg:
6815 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
6816 break;
6817 case eCSR_DOT11_MODE_11a:
6818 snprintf(extra, WE_MAX_STR_LEN, "11A");
6819 break;
6820 case eCSR_DOT11_MODE_11b:
6821 case eCSR_DOT11_MODE_11b_ONLY:
6822 snprintf(extra, WE_MAX_STR_LEN, "11B");
6823 break;
6824 case eCSR_DOT11_MODE_11g:
6825 case eCSR_DOT11_MODE_11g_ONLY:
6826 snprintf(extra, WE_MAX_STR_LEN, "11G");
6827 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006828 case eCSR_DOT11_MODE_11ac:
6829 case eCSR_DOT11_MODE_11ac_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306830 status =
6831 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
6832 &value);
6833 if (!QDF_IS_STATUS_SUCCESS(status))
6834 hdd_err("Failed to set channel_width");
6835 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006836 snprintf(extra, WE_MAX_STR_LEN,
6837 "11ACVHT20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306838 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006839 snprintf(extra, WE_MAX_STR_LEN,
6840 "11ACVHT40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306841 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006842 snprintf(extra, WE_MAX_STR_LEN,
6843 "11ACVHT80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306844 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006845 snprintf(extra, WE_MAX_STR_LEN,
6846 "11ACVHT160");
6847 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006848 case eCSR_DOT11_MODE_11ax:
6849 case eCSR_DOT11_MODE_11ax_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306850 status =
6851 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
6852 &value);
6853 if (!QDF_IS_STATUS_SUCCESS(status))
6854 hdd_err("Failed to set channel_width");
6855
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006856 /* currently using vhtChannelWidth */
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306857 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006858 snprintf(extra, WE_MAX_STR_LEN,
6859 "11AX_HE_20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306860 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006861 snprintf(extra, WE_MAX_STR_LEN,
6862 "11AX_HE_40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306863 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006864 snprintf(extra, WE_MAX_STR_LEN,
6865 "11AX_HE_80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306866 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08006867 snprintf(extra, WE_MAX_STR_LEN,
6868 "11AX_HE_160");
6869 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006870 }
6871
6872 wrqu->data.length = strlen(extra) + 1;
6873 break;
6874 }
6875
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006876 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08006877 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006878 case WE_GET_SNR:
6879 {
6880 int8_t s7snr = 0;
6881 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006882 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07006883 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006884
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006885 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006886 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05306887 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006888 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05306889
Jeff Johnsond377dce2017-10-04 10:32:42 -07006890 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006891 if (0 == hdd_ctx->config->fEnableSNRMonitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006892 eConnectionState_Associated !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07006893 sta_ctx->conn_info.connState) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006894 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006895 hdd_ctx->config->fEnableSNRMonitoring,
Jeff Johnsond377dce2017-10-04 10:32:42 -07006896 sta_ctx->conn_info.connState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006897 return -ENONET;
6898 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006899 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006900 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
6901 wrqu->data.length = strlen(extra) + 1;
6902 break;
6903 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006904
Krunal Soni5e483782018-10-25 15:42:44 -07006905 case WE_GET_STA_CXN_INFO:
6906 ret = hdd_get_sta_cxn_info(hdd_ctx, adapter, extra);
6907 wrqu->data.length = strlen(extra) + 1;
6908 break;
6909
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006910 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006911 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006912 break;
6913 }
Dustin Brownd9322482017-01-09 12:46:03 -08006914
Dustin Browne74003f2018-03-14 12:51:58 -07006915 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08006916 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006917}
6918
6919static int iw_get_char_setnone(struct net_device *dev,
6920 struct iw_request_info *info,
6921 union iwreq_data *wrqu, char *extra)
6922{
6923 int ret;
6924
6925 cds_ssr_protect(__func__);
6926 ret = __iw_get_char_setnone(dev, info, wrqu, extra);
6927 cds_ssr_unprotect(__func__);
6928
6929 return ret;
6930}
6931
6932/**
6933 * iw_setnone_getnone() - Generic "action" private ioctl handler
6934 * @dev: device upon which the ioctl was received
6935 * @info: ioctl request information
6936 * @wrqu: ioctl request data
6937 * @extra: ioctl extra data
6938 *
6939 * Return: 0 on success, non-zero on error
6940 */
6941static int __iw_setnone_getnone(struct net_device *dev,
6942 struct iw_request_info *info,
6943 union iwreq_data *wrqu, char *extra)
6944{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006945 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006946 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006947 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006948 int ret;
6949 int sub_cmd;
6950
Dustin Brownfdf17c12018-03-14 12:55:34 -07006951 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306952
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08006953 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006954 ret = wlan_hdd_validate_context(hdd_ctx);
6955 if (0 != ret)
6956 return ret;
6957
Jeff Johnson441e1f72017-02-07 08:50:49 -08006958 ret = hdd_check_private_wext_control(hdd_ctx, info);
6959 if (0 != ret)
6960 return ret;
6961
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006962#ifdef CONFIG_COMPAT
6963 /* this ioctl is a special case where a sub-ioctl is used and both
6964 * the number of get and set args is 0. in this specific case the
6965 * logic in iwpriv places the sub_cmd in the data.flags portion of
6966 * the iwreq. unfortunately the location of this field will be
6967 * different between 32-bit and 64-bit userspace, and the standard
6968 * compat support in the kernel does not handle this case. so we
6969 * need to explicitly handle it here.
6970 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07006971 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006972 struct compat_iw_point *compat_iw_point =
6973 (struct compat_iw_point *)&wrqu->data;
6974 sub_cmd = compat_iw_point->flags;
6975 } else {
6976 sub_cmd = wrqu->data.flags;
6977 }
6978#else
6979 sub_cmd = wrqu->data.flags;
6980#endif
6981
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006982 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006983 switch (sub_cmd) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006984
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006985 case WE_GET_RECOVERY_STAT:
6986 sme_get_recovery_stats(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006987 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006988
Govind Singha471e5e2015-10-12 17:11:14 +05306989 case WE_GET_FW_PROFILE_DATA:
Jeff Johnson1b780e42017-10-31 14:11:45 -07006990 ret = wma_cli_set_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05306991 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
6992 0, DBG_CMD);
6993 break;
6994
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006995 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006996 hdd_wlan_get_ibss_peer_info_all(adapter);
6997 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006998
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006999 case WE_SET_REASSOC_TRIGGER:
7000 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07007001 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307002 tSirMacAddr bssid;
Krunal Sonibfd05492017-10-03 15:48:37 -07007003 uint32_t roamId = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307004 uint8_t operating_ch =
Jeff Johnsonb9424862017-10-30 08:49:35 -07007005 adapter->session.station.conn_info.operationChannel;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007006 tCsrRoamModifyProfileFields modProfileFields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007007
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007008 sme_get_modify_profile_fields(mac_handle, adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007009 &modProfileFields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307010 if (roaming_offload_enabled(hdd_ctx)) {
7011 qdf_mem_copy(bssid,
Jeff Johnsonb9424862017-10-30 08:49:35 -07007012 &adapter->session.station.conn_info.bssId,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307013 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08007014 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307015 bssid, operating_ch);
7016 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007017 sme_roam_reassoc(mac_handle, adapter->session_id,
7018 NULL, modProfileFields, &roamId, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307019 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007020 return 0;
7021 }
7022
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007023 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007024 /*
7025 * 1.OBSS Scan is mandatory while operating in 2.4GHz
7026 * 2.OBSS scan is stopped by Firmware during the disassociation
7027 * 3.OBSS stop comamnd is added for debugging purpose
7028 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007029 if (!mac_handle) {
7030 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007031 return -EINVAL;
7032 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007033 sme_ht40_stop_obss_scan(mac_handle, adapter->session_id);
7034 break;
7035
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007036 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007037 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007038 break;
7039 }
Dustin Browne74003f2018-03-14 12:51:58 -07007040 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007041 return ret;
7042}
7043
7044static int iw_setnone_getnone(struct net_device *dev,
7045 struct iw_request_info *info,
7046 union iwreq_data *wrqu, char *extra)
7047{
7048 int ret;
7049
7050 cds_ssr_protect(__func__);
7051 ret = __iw_setnone_getnone(dev, info, wrqu, extra);
7052 cds_ssr_unprotect(__func__);
7053
7054 return ret;
7055}
7056
Krunal Sonia6e505b2017-01-12 12:25:18 -08007057#ifdef MPC_UT_FRAMEWORK
Liangwei Dong509c3472018-05-30 07:05:59 -04007058static void
7059hdd_policy_mgr_set_hw_mode_ut(struct hdd_context *hdd_ctx,
7060 struct hdd_adapter *adapter, int cmd)
7061{
7062 enum hw_mode_ss_config mac0_ss;
7063 enum hw_mode_bandwidth mac0_bw;
7064 enum hw_mode_ss_config mac1_ss;
7065 enum hw_mode_bandwidth mac1_bw;
7066 enum hw_mode_mac_band_cap mac0_band_cap;
7067 enum hw_mode_dbs_capab dbs;
7068
7069 switch (cmd) {
7070 case 0:
7071 hdd_debug("set hw mode for single mac");
7072 mac0_ss = HW_MODE_SS_2x2;
7073 mac0_bw = HW_MODE_80_MHZ;
7074 mac1_ss = HW_MODE_SS_0x0;
7075 mac1_bw = HW_MODE_BW_NONE;
7076 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7077 dbs = HW_MODE_DBS_NONE;
7078 break;
7079 case 1:
7080 hdd_debug("set hw mode for dual mac");
7081 mac0_ss = HW_MODE_SS_1x1;
7082 mac0_bw = HW_MODE_80_MHZ;
7083 mac1_ss = HW_MODE_SS_1x1;
7084 mac1_bw = HW_MODE_40_MHZ;
7085 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7086 dbs = HW_MODE_DBS;
7087 break;
7088 case 2:
7089 hdd_debug("set hw mode for 2x2 5g + 1x1 2g");
7090 mac0_ss = HW_MODE_SS_2x2;
7091 mac0_bw = HW_MODE_80_MHZ;
7092 mac1_ss = HW_MODE_SS_1x1;
7093 mac1_bw = HW_MODE_40_MHZ;
7094 mac0_band_cap = HW_MODE_MAC_BAND_5G;
7095 dbs = HW_MODE_DBS;
7096 break;
7097 case 3:
7098 hdd_debug("set hw mode for 2x2 2g + 1x1 5g");
7099 mac0_ss = HW_MODE_SS_2x2;
7100 mac0_bw = HW_MODE_40_MHZ;
7101 mac1_ss = HW_MODE_SS_1x1;
7102 mac1_bw = HW_MODE_40_MHZ;
7103 mac0_band_cap = HW_MODE_MAC_BAND_2G;
7104 dbs = HW_MODE_DBS;
7105 break;
7106 default:
7107 hdd_err("unknown cmd %d", cmd);
7108 return;
7109 }
7110 policy_mgr_pdev_set_hw_mode(hdd_ctx->psoc, adapter->session_id,
7111 mac0_ss, mac0_bw, mac1_ss, mac1_bw,
7112 mac0_band_cap, dbs, HW_MODE_AGILE_DFS_NONE,
7113 HW_MODE_SBS_NONE,
7114 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
7115}
7116
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007117static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007118 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007119{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08007120 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08007121 case WE_POLICY_MANAGER_CLIST_CMD:
7122 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007123 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307124 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307125 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7126 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7127 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7128 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307129 return 0;
7130 }
Dustin Brown05d81302018-09-11 16:49:22 -07007131 policy_mgr_incr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007132 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7133 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007134 }
7135 break;
7136
7137 case WE_POLICY_MANAGER_DLIST_CMD:
7138 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007139 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307140 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307141 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307142 return 0;
7143 }
Dustin Brown05d81302018-09-11 16:49:22 -07007144 policy_mgr_decr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007145 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007146 }
7147 break;
7148
7149 case WE_POLICY_MANAGER_ULIST_CMD:
7150 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007151 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307152 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307153 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7154 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7155 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7156 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307157 return 0;
7158 }
Dustin Brown05d81302018-09-11 16:49:22 -07007159 policy_mgr_update_connection_info_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007160 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7161 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007162 }
7163 break;
7164
7165 case WE_POLICY_MANAGER_DBS_CMD:
7166 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007167 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007168 if (apps_args[0] == 0)
7169 wma_set_dbs_capability_ut(0);
7170 else
7171 wma_set_dbs_capability_ut(1);
7172
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007173 if (apps_args[1] >= PM_THROUGHPUT &&
7174 apps_args[1] <= PM_LATENCY) {
Liangwei Dong509c3472018-05-30 07:05:59 -04007175 hdd_debug("setting system pref to [%d]\n",
7176 apps_args[1]);
Krunal Sonie71838d2018-09-27 10:45:05 -07007177 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc,
7178 apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007179 }
7180 }
7181 break;
7182
7183 case WE_POLICY_MANAGER_PCL_CMD:
7184 {
7185 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
7186 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
7187 uint32_t pcl_len = 0, i = 0;
7188
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007189 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007190
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307191 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307192 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307193 return 0;
7194 }
Dustin Brown05d81302018-09-11 16:49:22 -07007195 policy_mgr_get_pcl(hdd_ctx->psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08007196 pcl, &pcl_len,
7197 weight_list, QDF_ARRAY_SIZE(weight_list));
Liangwei Dong509c3472018-05-30 07:05:59 -04007198 hdd_debug("PCL list for role[%d] is {", apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007199 for (i = 0 ; i < pcl_len; i++)
Liangwei Dong509c3472018-05-30 07:05:59 -04007200 hdd_debug(" %d, ", pcl[i]);
7201 hdd_debug("}--------->\n");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007202 }
7203 break;
7204
7205 case WE_POLICY_SET_HW_MODE_CMD:
7206 {
Liangwei Dong509c3472018-05-30 07:05:59 -04007207 hdd_debug("pm_set_hw_mode cmd %d", apps_args[0]);
7208 hdd_policy_mgr_set_hw_mode_ut(hdd_ctx, adapter, apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007209 }
7210 break;
7211
7212 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7213 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007214 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307215 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307216 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307217 return 0;
7218 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07007219 policy_mgr_current_connections_update(
Dustin Brown05d81302018-09-11 16:49:22 -07007220 hdd_ctx->psoc,
Jeff Johnson1b780e42017-10-31 14:11:45 -07007221 adapter->session_id, apps_args[0],
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07007222 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007223 }
7224 break;
7225
7226 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7227 {
7228 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007229
Dustin Brown5e89ef82018-03-14 11:50:23 -07007230 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307231 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307232 (apps_args[2] < 0)) {
7233 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307234 return 0;
7235 }
Dustin Brown05d81302018-09-11 16:49:22 -07007236 allow = policy_mgr_allow_concurrency(hdd_ctx->psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08007237 apps_args[0], apps_args[1], apps_args[2]);
Liangwei Dong509c3472018-05-30 07:05:59 -04007238 hdd_debug("allow %d {0 = don't allow, 1 = allow}", allow);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007239 }
7240 break;
7241
7242 case WE_POLICY_MANAGER_SCENARIO_CMD:
7243 {
7244 clean_report(hdd_ctx);
7245 if (apps_args[0] == 1) {
7246 wlan_hdd_one_connection_scenario(hdd_ctx);
7247 } else if (apps_args[0] == 2) {
7248 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007249 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007250 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007251 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007252 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007253 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007254 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007255 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007256 } else if (apps_args[0] == 3) {
7257 /* MCC on same band with 2x2 same mac*/
7258 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007259 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007260 /* MCC on diff band with 2x2 same mac*/
7261 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007262 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007263 /* MCC on diff band with 1x1 diff mac */
7264 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007265 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007266 /* MCC on diff band with 1x1 same mac */
7267 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007268 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007269 /* SCC on same band with 2x2 same mac */
7270 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007271 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007272 /* SCC on same band with 1x1 same mac */
7273 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007274 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007275 /* MCC on same band with 2x2 same mac */
7276 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007277 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007278 /* MCC on same band with 1x1 same mac */
7279 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007280 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007281 }
7282 print_report(hdd_ctx);
7283 }
7284 break;
7285 }
7286 return 0;
7287}
7288#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007289static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007290 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007291{
7292 return 0;
7293}
7294#endif
7295
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007296/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007297 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7298 * @hdd_ctx: hdd_context
7299 * @num_args: input args number
7300 * @apps_args: args data ptr
7301 *
7302 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7303 *
7304 * Return: void
7305 */
7306#if WLAN_DEBUG
7307static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7308 int num_args, int *apps_args)
7309{
7310 struct ch_avoid_ind_type ch_avoid;
7311 int cnt = 0, i;
7312
7313 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7314 num_args % 2 != 0)
7315 return;
7316 hdd_info("simulate ch avoid num_args %d", num_args);
7317 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7318 ch_avoid.avoid_freq_range[cnt].start_freq =
7319 apps_args[i];
7320 ch_avoid.avoid_freq_range[cnt].end_freq =
7321 apps_args[++i];
7322
7323 hdd_info("simulate ch avoid [%d %d]",
7324 ch_avoid.avoid_freq_range[cnt].start_freq,
7325 ch_avoid.avoid_freq_range[cnt].end_freq);
7326 cnt++;
7327 }
7328 ch_avoid.ch_avoid_range_cnt = cnt;
Dustin Brown05d81302018-09-11 16:49:22 -07007329 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->psoc, &ch_avoid);
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007330}
7331#else
7332static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7333 int num_args, int *apps_args)
7334{
7335}
7336#endif
7337/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007338 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7339 * @dev: device upon which the ioctl was received
7340 * @info: ioctl request information
7341 * @wrqu: ioctl request data
7342 * @extra: ioctl extra data
7343 *
7344 * This is an SSR-protected generic handler for private ioctls which
7345 * take multiple arguments. Note that this implementation is also
7346 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7347 * interfaces.
7348 *
7349 * Return: 0 on success, non-zero on error
7350 */
7351static int __iw_set_var_ints_getnone(struct net_device *dev,
7352 struct iw_request_info *info,
7353 union iwreq_data *wrqu, char *extra)
7354{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007355 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007356 mac_handle_t mac_handle;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007357 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007358 int sub_cmd;
7359 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007360 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007361 int ret, num_args;
chenguoaa7c90c2018-05-24 17:08:47 +08007362 void *soc = NULL;
7363 struct cdp_pdev *pdev = NULL;
7364 struct cdp_vdev *vdev = NULL;
7365 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007366
Dustin Brownfdf17c12018-03-14 12:55:34 -07007367 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307368
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007369 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007370 ret = wlan_hdd_validate_context(hdd_ctx);
7371 if (0 != ret)
7372 return ret;
7373
Jeff Johnson441e1f72017-02-07 08:50:49 -08007374 ret = hdd_check_private_wext_control(hdd_ctx, info);
7375 if (0 != ret)
7376 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007377
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007378 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007379 sub_cmd = wrqu->data.flags;
7380 num_args = wrqu->data.length;
7381
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007382 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007383
7384 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007385 case WE_IBSS_GET_PEER_INFO:
7386 {
7387 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007388 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007389 }
7390 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007391
7392 case WE_P2P_NOA_CMD:
7393 {
Srinivas Girigowda5d5fdc52017-03-24 22:30:57 -07007394 struct p2p_app_set_ps p2pNoA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007395
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007396 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007397 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
Dustin Brown458027c2018-10-19 12:26:27 -07007398 qdf_opmode_str(adapter->device_mode),
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007399 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007400 return -EINVAL;
7401 }
7402
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007403 p2pNoA.opp_ps = apps_args[0];
7404 p2pNoA.ctWindow = apps_args[1];
7405 p2pNoA.duration = apps_args[2];
7406 p2pNoA.interval = apps_args[3];
7407 p2pNoA.count = apps_args[4];
7408 p2pNoA.single_noa_duration = apps_args[5];
7409 p2pNoA.psSelection = apps_args[6];
7410
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007411 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 -07007412 apps_args[0], apps_args[1], apps_args[2],
7413 apps_args[3], apps_args[4],
7414 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007415
7416 hdd_set_p2p_ps(dev, &p2pNoA);
7417
7418 }
7419 break;
7420
7421 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7422 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007423 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007424 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307425 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007426 }
7427 break;
7428
7429 case WE_MTRACE_DUMP_CMD:
7430 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007431 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007432 apps_args[0], apps_args[1],
7433 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007434 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007435 apps_args[1], apps_args[2],
7436 apps_args[3]);
7437
7438 }
7439 break;
7440
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007441 case WE_POLICY_MANAGER_CINFO_CMD:
7442 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007443 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007444 uint32_t i = 0, len = 0;
7445
Krunal Sonia6e505b2017-01-12 12:25:18 -08007446 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007447 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007448 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007449 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007450 pr_info("|table_index[%d]\t\t\n", i);
7451 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
7452 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
7453 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7454 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7455 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7456 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7457 pr_info("+--------------------------+\n");
7458 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007459 }
7460 }
7461 break;
7462
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007463 case WE_UNIT_TEST_CMD:
7464 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007465 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007466
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007467 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7468 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007469 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007470 return -EINVAL;
7471 }
Sourav Mohapatraea7210b2018-11-16 16:58:52 +05307472 if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307473 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007474 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007475 return -EINVAL;
7476 }
Jeff Johnson1b780e42017-10-31 14:11:45 -07007477 status = sme_send_unit_test_cmd(adapter->session_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007478 apps_args[0],
7479 apps_args[1],
7480 &apps_args[2]);
7481 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007482 hdd_err("sme_send_unit_test_cmd returned %d", status);
7483 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007484 }
7485 }
7486 break;
7487#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7488 case WE_LED_FLASHING_PARAM:
7489 {
7490 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007491
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007492 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007493 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007494 return -EINVAL;
7495 }
7496 for (i = 0; i < num_args; i++) {
7497 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007498 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007499 return -EINVAL;
7500 }
7501 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007502 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007503 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007504 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007505 1, apps_args[2], apps_args[3]);
7506 }
7507 break;
7508#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05307509 case WE_SET_PKTLOG:
7510 {
7511 int ret;
7512
7513 if (num_args < 1 || num_args > 2) {
7514 hdd_err("pktlog: either 1 or 2 parameters are required");
7515 return -EINVAL;
7516 }
7517
7518 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
7519 apps_args[1]);
7520 if (ret)
7521 return ret;
7522 break;
7523 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05307524 case WE_MAC_PWR_DEBUG_CMD:
7525 {
7526 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05307527 int i, j;
7528
7529 if (num_args < 3) {
7530 hdd_err("number of arguments can't be null %d",
7531 num_args);
7532 return -EINVAL;
7533 }
7534 if (num_args - 3 != apps_args[2]) {
7535 hdd_err("arg list of size %d doesn't match num_args %d",
7536 num_args-3, apps_args[2]);
7537 return -EINVAL;
7538 }
7539 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
7540 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
7541 hdd_err("Invalid MODULE ID %d", apps_args[1]);
7542 return -EINVAL;
7543 }
7544 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
7545 hdd_err("Too Many args %d", apps_args[2]);
7546 return -EINVAL;
7547 }
7548 mac_pwr_dbg_args.pdev_id = apps_args[0];
7549 mac_pwr_dbg_args.module_id = apps_args[1];
7550 mac_pwr_dbg_args.num_args = apps_args[2];
7551
7552 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
7553 mac_pwr_dbg_args.args[i] = apps_args[j];
7554
7555 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007556 sme_process_mac_pwr_dbg_cmd(mac_handle,
7557 adapter->session_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05307558 &mac_pwr_dbg_args)) {
7559 return -EINVAL;
7560 }
7561 }
7562 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08007563 case WE_POLICY_MANAGER_CLIST_CMD:
7564 case WE_POLICY_MANAGER_DLIST_CMD:
7565 case WE_POLICY_MANAGER_ULIST_CMD:
7566 case WE_POLICY_MANAGER_DBS_CMD:
7567 case WE_POLICY_MANAGER_PCL_CMD:
7568 case WE_POLICY_SET_HW_MODE_CMD:
7569 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7570 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7571 case WE_POLICY_MANAGER_SCENARIO_CMD:
7572 {
Krunal Soni3de68532018-09-05 12:16:58 -07007573 if (!hdd_ctx->config->is_unit_test_framework_enabled) {
7574 hdd_warn_rl("UT framework is disabled");
7575 return -EINVAL;
7576 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007577 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Soni3de68532018-09-05 12:16:58 -07007578 sub_cmd, apps_args);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007579 }
7580 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007581 case WE_SET_CHAN_AVOID:
7582 {
7583 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
7584 }
7585 break;
chenguoaa7c90c2018-05-24 17:08:47 +08007586 case WE_SET_TXRX_STATS:
7587 {
7588 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
7589 adapter->session_id);
7590
7591 if (ret != 0) {
7592 hdd_err("Invalid handles");
7593 break;
7594 }
7595
7596 req.stats = apps_args[0];
7597 /* default value of secondary parameter is 0(mac_id) */
7598 req.mac_id = apps_args[1];
7599
7600 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
7601 req.stats, req.mac_id);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007602 if (apps_args[0] == CDP_TXRX_STATS_28) {
7603 if (sta_ctx->conn_info.uIsAuthenticated) {
7604 hdd_debug("ap mac addr: %pM",
7605 (void *)&sta_ctx->conn_info.bssId);
7606 req.peer_addr =
7607 (char *)&sta_ctx->conn_info.bssId;
7608 }
7609 }
chenguoaa7c90c2018-05-24 17:08:47 +08007610 ret = cdp_txrx_stats_request(soc, vdev, &req);
7611 break;
7612 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007613 default:
7614 {
Jeff Johnson99bac312016-06-28 10:38:18 -07007615 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007616 }
7617 break;
7618 }
Dustin Browne74003f2018-03-14 12:51:58 -07007619 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007620 return 0;
7621}
7622
7623/**
7624 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
7625 * @dev: pointer to net_device structure
7626 * @info: pointer to iw_request_info structure
7627 * @wrqu: pointer to iwreq_data
7628 * @extra; extra
7629 *
7630 * Return: 0 on success, error number otherwise
7631 *
7632 */
7633static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
7634 struct iw_request_info *info,
7635 union iwreq_data *wrqu, char *extra)
7636{
7637 union iwreq_data u_priv_wrqu;
7638 int apps_args[MAX_VAR_ARGS] = {0};
7639 int ret, num_args;
7640
Mukul Sharma64a70e82015-11-02 20:05:09 +05307641 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007642 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05307643 return -EPERM;
7644 }
7645
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007646 /* Helper function to get iwreq_data with compat handling. */
7647 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
7648 return -EINVAL;
7649
7650 if (NULL == u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007651 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007652 return -EINVAL;
7653 }
7654
7655 num_args = u_priv_wrqu.data.length;
7656 if (num_args > MAX_VAR_ARGS)
7657 num_args = MAX_VAR_ARGS;
7658
7659 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
7660 (sizeof(int)) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007661 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007662 return -EFAULT;
7663 }
7664
7665 cds_ssr_protect(__func__);
7666 ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
7667 (char *)&apps_args);
7668 cds_ssr_unprotect(__func__);
7669 return ret;
7670}
7671
7672/**
7673 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7674 * @dev: device upon which the ioctl was received
7675 * @info: ioctl request information
7676 * @wrqu: ioctl request data
7677 * @extra: ioctl extra data
7678 *
7679 * This is a generic handler for private ioctls which take multiple
7680 * arguments. Note that this implementation is also somewhat unique
7681 * in that it is shared by both STA-mode and SAP-mode interfaces.
7682 *
7683 * Return: 0 on success, non-zero on error
7684 */
7685int iw_set_var_ints_getnone(struct net_device *dev,
7686 struct iw_request_info *info,
7687 union iwreq_data *wrqu, char *extra)
7688{
7689 int ret;
7690
7691 cds_ssr_protect(__func__);
7692 ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
7693 cds_ssr_unprotect(__func__);
7694 return ret;
7695}
7696
7697/**
7698 * iw_add_tspec - Add TSpec private ioctl handler
7699 * @dev: device upon which the ioctl was received
7700 * @info: ioctl request information
7701 * @wrqu: ioctl request data
7702 * @extra: ioctl extra data
7703 *
7704 * Return: 0 on success, non-zero on error
7705 */
7706static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
7707 union iwreq_data *wrqu, char *extra)
7708{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007709 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07007710 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007711 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7712 int params[HDD_WLAN_WMM_PARAM_COUNT];
Abhishek Singh12be60f2017-08-11 13:52:42 +05307713 struct sme_qos_wmmtspecinfo tSpec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007714 uint32_t handle;
7715 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007716 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007717 int ret;
7718
Dustin Brownfdf17c12018-03-14 12:55:34 -07007719 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307720
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007721 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007722 ret = wlan_hdd_validate_context(hdd_ctx);
7723 if (0 != ret)
7724 return ret;
7725
Jeff Johnson441e1f72017-02-07 08:50:49 -08007726 ret = hdd_check_private_wext_control(hdd_ctx, info);
7727 if (0 != ret)
7728 return ret;
7729
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007730 /* make sure the application is sufficiently priviledged */
7731 /* note that the kernel will do this for "set" ioctls, but since */
7732 /* this ioctl wants to return status to user space it must be */
7733 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007734 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007735 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007736
7737 /* we must be associated in order to add a tspec */
Jeff Johnsond377dce2017-10-04 10:32:42 -07007738 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007739 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7740 return 0;
7741 }
7742 /* since we are defined to be a "get" ioctl, and since the number */
7743 /* of params exceeds the number of params that wireless extensions */
7744 /* will pass down in the iwreq_data, we must copy the "set" params. */
7745 /* We must handle the compat for iwreq_data in 32U/64K environment. */
7746
7747 /* helper function to get iwreq_data with compat handling. */
7748 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
7749 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7750 return 0;
7751 }
7752 /* make sure all params are correctly passed to function */
7753 if ((NULL == s_priv_data.pointer) ||
7754 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
7755 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7756 return 0;
7757 }
7758 /* from user space ourselves */
7759 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
7760 /* hmmm, can't get them */
7761 return -EIO;
7762 }
7763 /* clear the tspec */
7764 memset(&tSpec, 0, sizeof(tSpec));
7765
7766 /* validate the handle */
7767 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7768 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7769 /* that one is reserved */
7770 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7771 return 0;
7772 }
7773 /* validate the TID */
7774 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
7775 /* out of range */
7776 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7777 return 0;
7778 }
7779 tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
7780
7781 /* validate the direction */
7782 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
7783 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
7784 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
7785 break;
7786
7787 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
7788 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
7789 break;
7790
7791 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
7792 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
7793 break;
7794
7795 default:
7796 /* unknown */
7797 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7798 return 0;
7799 }
7800
7801 tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
7802
7803 /* validate the user priority */
7804 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
7805 /* out of range */
7806 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7807 return 0;
7808 }
7809 tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
7810 if (0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007811 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007812 return 0;
7813 }
7814
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007815 hdd_debug("TS_INFO PSB %d UP %d !!!",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007816 tSpec.ts_info.psb, tSpec.ts_info.up);
7817
7818 tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
7819 tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
7820 tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
7821 tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
7822 tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
7823 tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
7824 tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
7825 tSpec.surplus_bw_allowance =
7826 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
7827 tSpec.min_service_interval =
7828 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
7829 tSpec.max_service_interval =
7830 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
7831 tSpec.suspension_interval =
7832 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
7833 tSpec.inactivity_interval =
7834 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
7835
7836 tSpec.ts_info.burst_size_defn =
7837 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
7838
7839 /* validate the ts info ack policy */
7840 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
Abhinav Kumarab576712018-11-05 14:32:49 +05307841 case TS_INFO_ACK_POLICY_NORMAL_ACK:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007842 tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
7843 break;
7844
Abhinav Kumarab576712018-11-05 14:32:49 +05307845 case TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007846 tSpec.ts_info.ack_policy =
7847 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
7848 break;
7849
7850 default:
7851 /* unknown */
7852 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7853 return 0;
7854 }
7855
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007856 *pStatus = hdd_wmm_addts(adapter, handle, &tSpec);
Dustin Browne74003f2018-03-14 12:51:58 -07007857 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007858 return 0;
7859}
7860
7861static int iw_add_tspec(struct net_device *dev,
7862 struct iw_request_info *info,
7863 union iwreq_data *wrqu, char *extra)
7864{
7865 int ret;
7866
7867 cds_ssr_protect(__func__);
7868 ret = __iw_add_tspec(dev, info, wrqu, extra);
7869 cds_ssr_unprotect(__func__);
7870
7871 return ret;
7872}
7873
7874/**
7875 * iw_del_tspec - Delete TSpec private ioctl handler
7876 * @dev: device upon which the ioctl was received
7877 * @info: ioctl request information
7878 * @wrqu: ioctl request data
7879 * @extra: ioctl extra data
7880 *
7881 * Return: 0 on success, non-zero on error
7882 */
7883static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
7884 union iwreq_data *wrqu, char *extra)
7885{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007886 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007887 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007888 int *params = (int *)extra;
7889 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7890 uint32_t handle;
7891 int ret;
7892
Dustin Brownfdf17c12018-03-14 12:55:34 -07007893 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307894
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007895 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007896 ret = wlan_hdd_validate_context(hdd_ctx);
7897 if (0 != ret)
7898 return ret;
7899
Jeff Johnson441e1f72017-02-07 08:50:49 -08007900 ret = hdd_check_private_wext_control(hdd_ctx, info);
7901 if (0 != ret)
7902 return ret;
7903
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007904 /* make sure the application is sufficiently priviledged */
7905 /* note that the kernel will do this for "set" ioctls, but since */
7906 /* this ioctl wants to return status to user space it must be */
7907 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007908 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007909 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007910
7911 /* although we are defined to be a "get" ioctl, the params we require */
7912 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
7913 /* is no need to copy the params from user space */
7914
7915 /* validate the handle */
7916 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7917 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7918 /* that one is reserved */
7919 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7920 return 0;
7921 }
7922
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007923 *pStatus = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07007924 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007925 return 0;
7926}
7927
7928static int iw_del_tspec(struct net_device *dev,
7929 struct iw_request_info *info,
7930 union iwreq_data *wrqu, char *extra)
7931{
7932 int ret;
7933
7934 cds_ssr_protect(__func__);
7935 ret = __iw_del_tspec(dev, info, wrqu, extra);
7936 cds_ssr_unprotect(__func__);
7937
7938 return ret;
7939}
7940
7941/**
7942 * iw_get_tspec - Get TSpec private ioctl handler
7943 * @dev: device upon which the ioctl was received
7944 * @info: ioctl request information
7945 * @wrqu: ioctl request data
7946 * @extra: ioctl extra data
7947 *
7948 * Return: 0 on success, non-zero on error
7949 */
7950static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
7951 union iwreq_data *wrqu, char *extra)
7952{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007953 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007954 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007955 int *params = (int *)extra;
7956 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7957 uint32_t handle;
7958 int ret;
7959
Dustin Brownfdf17c12018-03-14 12:55:34 -07007960 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307961
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007962 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007963 ret = wlan_hdd_validate_context(hdd_ctx);
7964 if (0 != ret)
7965 return ret;
7966
Jeff Johnson441e1f72017-02-07 08:50:49 -08007967 ret = hdd_check_private_wext_control(hdd_ctx, info);
7968 if (0 != ret)
7969 return ret;
7970
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007971 /* although we are defined to be a "get" ioctl, the params we require */
7972 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
7973 /* is no need to copy the params from user space */
7974
7975 /* validate the handle */
7976 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
7977 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
7978 /* that one is reserved */
7979 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
7980 return 0;
7981 }
7982
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007983 *pStatus = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07007984 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007985 return 0;
7986}
7987
7988static int iw_get_tspec(struct net_device *dev,
7989 struct iw_request_info *info,
7990 union iwreq_data *wrqu, char *extra)
7991{
7992 int ret;
7993
7994 cds_ssr_protect(__func__);
7995 ret = __iw_get_tspec(dev, info, wrqu, extra);
7996 cds_ssr_unprotect(__func__);
7997
7998 return ret;
7999}
8000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008001/**
8002 * iw_set_fties - Set FT IEs private ioctl handler
8003 * @dev: device upon which the ioctl was received
8004 * @info: ioctl request information
8005 * @wrqu: ioctl request data
8006 * @extra: ioctl extra data
8007 *
8008 * Each time the supplicant has the auth_request or reassoc request
8009 * IEs ready they are pushed to the driver. The driver will in turn
8010 * use it to send out the auth req and reassoc req for 11r FT Assoc.
8011 *
8012 * Return: 0 on success, non-zero on error
8013 */
8014static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
8015 union iwreq_data *wrqu, char *extra)
8016{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008017 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008018 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008019 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008020 int ret;
8021
Dustin Brownfdf17c12018-03-14 12:55:34 -07008022 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308023
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008024 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008025 ret = wlan_hdd_validate_context(hdd_ctx);
8026 if (0 != ret)
8027 return ret;
8028
Jeff Johnson441e1f72017-02-07 08:50:49 -08008029 ret = hdd_check_private_wext_control(hdd_ctx, info);
8030 if (0 != ret)
8031 return ret;
8032
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008033 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008034 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008035 return -EINVAL;
8036 }
8037 if (wrqu->data.pointer == NULL) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008038 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008039 return -EINVAL;
8040 }
8041 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsond377dce2017-10-04 10:32:42 -07008042 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008043 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008044 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008045 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008046 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008047 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008048
8049 /* Pass the received FT IEs to SME */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008050 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->session_id,
8051 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07008052 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008053 return 0;
8054}
8055
8056static int iw_set_fties(struct net_device *dev,
8057 struct iw_request_info *info,
8058 union iwreq_data *wrqu, char *extra)
8059{
8060 int ret;
8061
8062 cds_ssr_protect(__func__);
8063 ret = __iw_set_fties(dev, info, wrqu, extra);
8064 cds_ssr_unprotect(__func__);
8065
8066 return ret;
8067}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008068
Dustin Brown0cbc7572016-12-16 13:54:40 -08008069/**
8070 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
8071 * @dev: device upon which the ioctl was received
8072 * @info: ioctl request information
8073 * @wrqu: ioctl request data
8074 * @extra: ioctl extra data
8075 *
Dustin Brown860566f2017-01-31 15:24:43 -08008076 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
8077 * time being to provide guidance in migrating to standard APIs.
8078 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08008079 * Return: 0 on success, non-zero on error
8080 */
8081static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
8082 struct iw_request_info *info,
8083 union iwreq_data *wrqu,
8084 char *extra)
8085{
Dustin Brown860566f2017-01-31 15:24:43 -08008086 hdd_err("\n"
8087 "setMCBCFilter is obsolete. Use the following instead:\n"
8088 "Configure multicast filtering via the ‘ip’ command.\n"
8089 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
8090 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
8091 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
8092 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
8093 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07008094 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08008095}
8096
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008097/**
8098 * iw_set_host_offload - Set host offload ioctl handler
8099 * @dev: device upon which the ioctl was received
8100 * @info: ioctl request information
8101 * @wrqu: ioctl request data
8102 * @extra: ioctl extra data
8103 *
8104 * Return: 0 on success, non-zero on error
8105 */
8106static int __iw_set_host_offload(struct net_device *dev,
8107 struct iw_request_info *info,
8108 union iwreq_data *wrqu, char *extra)
8109{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008110 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Srinivas Girigowda077143e2017-03-25 10:47:27 -07008111 struct host_offload_req *pRequest = (struct host_offload_req *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008112 tSirHostOffloadReq offloadRequest;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008113 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008114 int ret;
8115
Dustin Brownfdf17c12018-03-14 12:55:34 -07008116 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308117
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008118 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008119 ret = wlan_hdd_validate_context(hdd_ctx);
8120 if (0 != ret)
8121 return ret;
8122
Jeff Johnson441e1f72017-02-07 08:50:49 -08008123 ret = hdd_check_private_wext_control(hdd_ctx, info);
8124 if (0 != ret)
8125 return ret;
8126
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008127 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008128 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008129 return -EINVAL;
8130 }
8131
8132 /* Debug display of request components. */
8133 switch (pRequest->offloadType) {
8134 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008135 hdd_debug("Host offload request: ARP reply");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008136 switch (pRequest->enableOrDisable) {
8137 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008138 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008139 break;
8140 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008141 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07008142 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008143 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008144 hdd_debug(" ARP offload enable");
8145 hdd_debug(" IP address: %d.%d.%d.%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008146 pRequest->params.hostIpv4Addr[0],
8147 pRequest->params.hostIpv4Addr[1],
8148 pRequest->params.hostIpv4Addr[2],
8149 pRequest->params.hostIpv4Addr[3]);
8150 }
8151 break;
8152
8153 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008154 hdd_debug("Host offload request: neighbor discovery");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008155 switch (pRequest->enableOrDisable) {
8156 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008157 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008158 break;
8159 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008160 hdd_debug(" enable");
8161 hdd_debug(" IP address: %x:%x:%x:%x:%x:%x:%x:%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008162 *(uint16_t *) (pRequest->params.hostIpv6Addr),
8163 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8164 2),
8165 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8166 4),
8167 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8168 6),
8169 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8170 8),
8171 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8172 10),
8173 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8174 12),
8175 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8176 14));
8177 }
8178 }
8179
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05308180 qdf_mem_zero(&offloadRequest, sizeof(offloadRequest));
8181 offloadRequest.offloadType = pRequest->offloadType;
8182 offloadRequest.enableOrDisable = pRequest->enableOrDisable;
8183 qdf_mem_copy(&offloadRequest.params, &pRequest->params,
8184 sizeof(pRequest->params));
8185 qdf_mem_copy(&offloadRequest.bssid, &pRequest->bssId.bytes,
8186 QDF_MAC_ADDR_SIZE);
8187
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308188 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008189 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnson1b780e42017-10-31 14:11:45 -07008190 adapter->session_id, &offloadRequest)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008191 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008192 return -EINVAL;
8193 }
Dustin Browne74003f2018-03-14 12:51:58 -07008194 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008195 return 0;
8196}
8197
8198static int iw_set_host_offload(struct net_device *dev,
8199 struct iw_request_info *info,
8200 union iwreq_data *wrqu, char *extra)
8201{
8202 int ret;
8203
8204 cds_ssr_protect(__func__);
8205 ret = __iw_set_host_offload(dev, info, wrqu, extra);
8206 cds_ssr_unprotect(__func__);
8207
8208 return ret;
8209}
8210
8211/**
8212 * iw_set_keepalive_params - Set keepalive params ioctl handler
8213 * @dev: device upon which the ioctl was received
8214 * @info: ioctl request information
8215 * @wrqu: ioctl request data
8216 * @extra: ioctl extra data
8217 *
8218 * Return: 0 on success, non-zero on error
8219 */
8220static int __iw_set_keepalive_params(struct net_device *dev,
8221 struct iw_request_info *info,
8222 union iwreq_data *wrqu, char *extra)
8223{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008224 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008225 tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008226 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008227 int ret;
8228
Dustin Brownfdf17c12018-03-14 12:55:34 -07008229 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308230
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008231 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008232 ret = wlan_hdd_validate_context(hdd_ctx);
8233 if (0 != ret)
8234 return ret;
8235
Jeff Johnson441e1f72017-02-07 08:50:49 -08008236 ret = hdd_check_private_wext_control(hdd_ctx, info);
8237 if (0 != ret)
8238 return ret;
8239
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008240 if (wrqu->data.length != sizeof(*request)) {
8241 hdd_err("Invalid length %d", wrqu->data.length);
8242 return -EINVAL;
8243 }
8244
Wu Gao93816212018-08-31 16:49:54 +08008245 if (request->timePeriod > cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008246 hdd_err("Value of timePeriod %d exceed Max limit %d",
8247 request->timePeriod,
Wu Gao93816212018-08-31 16:49:54 +08008248 cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008249 return -EINVAL;
8250 }
8251
8252 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008253 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008254 request->timePeriod, sizeof(tSirKeepAliveReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008255
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008256 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008257 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008258 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008259 break;
8260
8261 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008262 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008263
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008264 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008265 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8266 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008267
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008268 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008269 request->destIpv4Addr[0], request->destIpv4Addr[1],
8270 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008271
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008272 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -08008273 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008274 break;
8275 }
8276
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008277 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008278
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308279 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008280 sme_set_keep_alive(hdd_ctx->mac_handle,
8281 adapter->session_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008282 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008283 return -EINVAL;
8284 }
Dustin Browne74003f2018-03-14 12:51:58 -07008285 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008286 return 0;
8287}
8288
8289static int iw_set_keepalive_params(struct net_device *dev,
8290 struct iw_request_info *info,
8291 union iwreq_data *wrqu,
8292 char *extra)
8293{
8294 int ret;
8295
8296 cds_ssr_protect(__func__);
8297 ret = __iw_set_keepalive_params(dev, info, wrqu, extra);
8298 cds_ssr_unprotect(__func__);
8299
8300 return ret;
8301}
8302
8303#ifdef WLAN_FEATURE_PACKET_FILTERING
8304/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308305 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8306 * @priv_data: Pointer to the priv data from user space
8307 * @request: Pointer to the struct containing the copied data from user space
8308 *
8309 * Return: False on invalid length, true otherwise
8310 */
8311static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8312 uint16_t length)
8313{
8314 int max_params_size, rcvd_params_size;
8315
8316 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8317 sizeof(struct pkt_filter_param_cfg);
8318
8319 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8320 hdd_err("Less than minimum number of arguments needed");
8321 return false;
8322 }
8323
8324 rcvd_params_size = request->num_params *
8325 sizeof(struct pkt_filter_param_cfg);
8326
8327 if (length != sizeof(struct pkt_filter_cfg) -
8328 max_params_size + rcvd_params_size) {
8329 hdd_err("Arguments do not match the number of params provided");
8330 return false;
8331 }
8332
8333 return true;
8334}
8335
8336/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008337 * __iw_set_packet_filter_params() - set packet filter parameters in target
8338 * @dev: Pointer to netdev
8339 * @info: Pointer to iw request info
8340 * @wrqu: Pointer to data
8341 * @extra: Pointer to extra data
8342 *
8343 * Return: 0 on success, non-zero on error
8344 */
8345static int __iw_set_packet_filter_params(struct net_device *dev,
8346 struct iw_request_info *info,
8347 union iwreq_data *wrqu, char *extra)
8348{
8349 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008350 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008351 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008352 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008353 struct pkt_filter_cfg *request = NULL;
8354
Mukul Sharma472382f2015-11-02 20:16:31 +05308355 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008356 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308357 return -EPERM;
8358 }
8359
Dustin Brownfdf17c12018-03-14 12:55:34 -07008360 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308361
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008362 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8363 ret = wlan_hdd_validate_context(hdd_ctx);
8364 if (0 != ret)
8365 return ret;
8366
Jeff Johnson441e1f72017-02-07 08:50:49 -08008367 ret = hdd_check_private_wext_control(hdd_ctx, info);
8368 if (0 != ret)
8369 return ret;
8370
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008371 if (hdd_priv_get_data(&priv_data, wrqu)) {
8372 hdd_err("failed to get priv data");
8373 return -EINVAL;
8374 }
8375
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308376 if ((NULL == priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008377 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008378 priv_data.pointer, priv_data.length);
8379 return -EINVAL;
8380 }
8381
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308382 if (adapter->device_mode != QDF_STA_MODE) {
8383 hdd_err("Packet filter not supported for this mode :%d",
8384 adapter->device_mode);
8385 return -ENOTSUPP;
8386 }
8387
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308388 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8389 hdd_err("Packet filter not supported in disconnected state");
8390 return -ENOTSUPP;
8391 }
8392
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008393 /* copy data using copy_from_user */
8394 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
8395 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308396
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008397 if (NULL == request) {
8398 hdd_err("mem_alloc_copy_from_user_helper fail");
8399 return -ENOMEM;
8400 }
8401
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308402 if (!validate_packet_filter_params_size(request, priv_data.length)) {
8403 hdd_err("Invalid priv data length %d", priv_data.length);
8404 qdf_mem_free(request);
8405 return -EINVAL;
8406 }
8407
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05308408 if (request->filter_action == HDD_RCV_FILTER_SET)
8409 hdd_ctx->user_configured_pkt_filter_rules |=
8410 1 << request->filter_id;
8411 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
8412 hdd_ctx->user_configured_pkt_filter_rules &=
8413 ~(1 << request->filter_id);
8414
Jeff Johnson1b780e42017-10-31 14:11:45 -07008415 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008416
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07008417 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07008418 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008419 return ret;
8420}
8421
8422/**
8423 * iw_set_packet_filter_params() - set packet filter parameters in target
8424 * @dev: Pointer to netdev
8425 * @info: Pointer to iw request info
8426 * @wrqu: Pointer to data
8427 * @extra: Pointer to extra data
8428 *
8429 * Return: 0 on success, non-zero on error
8430 */
8431static int iw_set_packet_filter_params(struct net_device *dev,
8432 struct iw_request_info *info,
8433 union iwreq_data *wrqu, char *extra)
8434{
8435 int ret;
8436
8437 cds_ssr_protect(__func__);
8438 ret = __iw_set_packet_filter_params(dev, info, wrqu, extra);
8439 cds_ssr_unprotect(__func__);
8440
8441 return ret;
8442}
8443#endif
8444
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008445#ifdef QCA_SUPPORT_CP_STATS
8446static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
8447{
8448 return wlan_hdd_get_station_stats(adapter);
8449}
8450#else /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008451struct hdd_statistics_priv {
8452 tCsrSummaryStatsInfo summary_stats;
8453 tCsrGlobalClassAStatsInfo class_a_stats;
8454 tCsrGlobalClassDStatsInfo class_d_stats;
8455};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008456
Jeff Johnsond37833f2018-03-07 14:22:44 -08008457/**
8458 * hdd_statistics_cb() - "Get statistics" callback function
Jeff Johnsonced658b2018-03-08 09:54:01 -08008459 * @stats: statistics payload
8460 * @context: opaque context originally passed to SME. HDD always passes
8461 * a cookie for the request context
Jeff Johnsond37833f2018-03-07 14:22:44 -08008462 *
8463 * Return: None
8464 */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008465static void hdd_statistics_cb(void *stats, void *context)
Jeff Johnsond37833f2018-03-07 14:22:44 -08008466{
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008467 struct osif_request *request;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008468 struct hdd_statistics_priv *priv;
8469 tCsrSummaryStatsInfo *summary_stats;
8470 tCsrGlobalClassAStatsInfo *class_a_stats;
8471 tCsrGlobalClassDStatsInfo *class_d_stats;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008472
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008473 request = osif_request_get(context);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008474 if (!request) {
8475 hdd_err("Obsolete request");
8476 return;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008477 }
8478
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008479 priv = osif_request_priv(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008480
8481 summary_stats = (tCsrSummaryStatsInfo *)stats;
8482 priv->summary_stats = *summary_stats;
8483
8484 class_a_stats = (tCsrGlobalClassAStatsInfo *)(summary_stats + 1);
8485 priv->class_a_stats = *class_a_stats;
8486
8487 class_d_stats = (tCsrGlobalClassDStatsInfo *)(class_a_stats + 1);
8488 priv->class_d_stats = *class_d_stats;
8489
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008490 osif_request_complete(request);
8491 osif_request_put(request);
Jeff Johnsond37833f2018-03-07 14:22:44 -08008492}
8493
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008494static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008495{
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008496 int ret = 0;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008497 void *cookie;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008498 QDF_STATUS status;
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008499 struct osif_request *request;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008500 struct hdd_station_ctx *sta_ctx;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008501 struct hdd_statistics_priv *priv;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008502 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008503 static const struct osif_request_params params = {
Jeff Johnsonced658b2018-03-08 09:54:01 -08008504 .priv_size = sizeof(*priv),
8505 .timeout_ms = WLAN_WAIT_TIME_STATS,
8506 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008507
Jeff Johnsonced658b2018-03-08 09:54:01 -08008508 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008509 request = osif_request_alloc(&params);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008510 if (!request) {
8511 hdd_warn("request allocation failed");
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008512 return -EINVAL;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008513 }
8514
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008515 cookie = osif_request_cookie(request);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008516 status = sme_get_statistics(hdd_ctx->mac_handle, eCSR_HDD,
Jeff Johnsonced658b2018-03-08 09:54:01 -08008517 SME_SUMMARY_STATS |
8518 SME_GLOBAL_CLASSA_STATS |
8519 SME_GLOBAL_CLASSD_STATS,
8520 hdd_statistics_cb,
8521 sta_ctx->conn_info.staId[0],
8522 cookie, adapter->session_id);
8523
8524 if (QDF_STATUS_SUCCESS != status) {
8525 hdd_warn("Unable to retrieve SME statistics");
8526 goto put_request;
8527 }
8528
8529 /* request was sent -- wait for the response */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008530 ret = osif_request_wait_for_response(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008531 if (ret) {
8532 hdd_err("Failed to wait for statistics, errno %d", ret);
8533 goto put_request;
8534 }
8535
8536 /* update the adapter cache with the fresh results */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008537 priv = osif_request_priv(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008538 adapter->hdd_stats.summary_stat = priv->summary_stats;
8539 adapter->hdd_stats.class_a_stat = priv->class_a_stats;
8540 adapter->hdd_stats.class_d_stat = priv->class_d_stats;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008541
8542put_request:
8543 /*
8544 * either we never sent a request, we sent a request and
8545 * received a response or we sent a request and timed out.
8546 * regardless we are done with the request.
8547 */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008548 osif_request_put(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008549 return ret;
8550}
8551#endif /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008552
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008553static int __iw_get_statistics(struct net_device *dev,
8554 struct iw_request_info *info,
8555 union iwreq_data *wrqu, char *extra)
8556{
8557 int ret;
8558 char *p;
8559 int tlen;
8560 struct hdd_station_ctx *sta_ctx;
8561 tCsrSummaryStatsInfo *summary_stats;
8562 tCsrGlobalClassAStatsInfo *class_a_stats;
8563 tCsrGlobalClassDStatsInfo *class_d_stats;
8564 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
8565 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8566
8567 hdd_enter_dev(dev);
8568
8569 ret = wlan_hdd_validate_context(hdd_ctx);
8570 if (0 != ret)
8571 return ret;
8572
8573 ret = hdd_check_private_wext_control(hdd_ctx, info);
8574 if (0 != ret)
8575 return ret;
8576
8577 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
8578 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
8579 wrqu->data.length = 0;
8580 return 0;
8581 }
8582
8583 hdd_get_wlan_stats(adapter);
8584
8585 summary_stats = &(adapter->hdd_stats.summary_stat);
8586 class_a_stats = &(adapter->hdd_stats.class_a_stat);
8587 class_d_stats = &(adapter->hdd_stats.class_d_stat);
8588
Jeff Johnsonced658b2018-03-08 09:54:01 -08008589 p = extra;
8590 tlen = 0;
8591
8592 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
8593 sizeof(summary_stats->retry_cnt),
8594 &(summary_stats->retry_cnt[0]), tlen);
8595
8596 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
8597 sizeof(summary_stats->multiple_retry_cnt),
8598 &(summary_stats->multiple_retry_cnt[0]), tlen);
8599
8600 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
8601 sizeof(summary_stats->tx_frm_cnt),
8602 &(summary_stats->tx_frm_cnt[0]), tlen);
8603
8604 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
8605 sizeof(summary_stats->rx_frm_cnt),
8606 &(summary_stats->rx_frm_cnt), tlen);
8607
8608 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
8609 sizeof(summary_stats->frm_dup_cnt),
8610 &(summary_stats->frm_dup_cnt), tlen);
8611
8612 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
8613 sizeof(summary_stats->fail_cnt),
8614 &(summary_stats->fail_cnt[0]), tlen);
8615
8616 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
8617 sizeof(summary_stats->rts_fail_cnt),
8618 &(summary_stats->rts_fail_cnt), tlen);
8619
8620 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
8621 sizeof(summary_stats->ack_fail_cnt),
8622 &(summary_stats->ack_fail_cnt), tlen);
8623
8624 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
8625 sizeof(summary_stats->rts_succ_cnt),
8626 &(summary_stats->rts_succ_cnt), tlen);
8627
8628 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
8629 sizeof(summary_stats->rx_discard_cnt),
8630 &(summary_stats->rx_discard_cnt), tlen);
8631
8632 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
8633 sizeof(summary_stats->rx_error_cnt),
8634 &(summary_stats->rx_error_cnt), tlen);
8635
8636 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
8637 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8638 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8639
8640 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
8641 sizeof(class_d_stats->rx_byte_cnt),
8642 &(class_d_stats->rx_byte_cnt), tlen);
8643
8644 FILL_TLV(p, WLAN_STATS_RX_RATE,
8645 sizeof(class_d_stats->rx_rate),
8646 &(class_d_stats->rx_rate), tlen);
8647
8648 /* Transmit rate, in units of 500 kbit/sec */
8649 FILL_TLV(p, WLAN_STATS_TX_RATE,
8650 sizeof(class_a_stats->tx_rate),
8651 &(class_a_stats->tx_rate), tlen);
8652
8653 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
8654 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
8655 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
8656 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
8657 sizeof(class_d_stats->rx_mc_byte_cnt),
8658 &(class_d_stats->rx_mc_byte_cnt), tlen);
8659 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
8660 sizeof(class_d_stats->rx_bc_byte_cnt),
8661 &(class_d_stats->rx_bc_byte_cnt), tlen);
8662 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
8663 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8664 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8665 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
8666 sizeof(class_d_stats->tx_mc_byte_cnt),
8667 &(class_d_stats->tx_mc_byte_cnt), tlen);
8668 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
8669 sizeof(class_d_stats->tx_bc_byte_cnt),
8670 &(class_d_stats->tx_bc_byte_cnt), tlen);
8671
8672 wrqu->data.length = tlen;
8673
Dustin Browne74003f2018-03-14 12:51:58 -07008674 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008675
8676 return 0;
8677}
8678
8679static int iw_get_statistics(struct net_device *dev,
8680 struct iw_request_info *info,
8681 union iwreq_data *wrqu, char *extra)
8682{
8683 int ret;
8684
8685 cds_ssr_protect(__func__);
8686 ret = __iw_get_statistics(dev, info, wrqu, extra);
8687 cds_ssr_unprotect(__func__);
8688
8689 return ret;
8690}
8691
8692#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008693/*Max Len for PNO notification*/
8694#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05308695static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
8696 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008697{
Abhishek Singh0481d662017-04-11 18:20:11 +05308698 struct vdev_osif_priv *osif_priv;
8699 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008700 union iwreq_data wrqu;
8701 char buf[MAX_PNO_NOTIFY_LEN + 1];
8702
Abhishek Singh0481d662017-04-11 18:20:11 +05308703 wlan_vdev_obj_lock(vdev);
8704 osif_priv = wlan_vdev_get_ospriv(vdev);
8705 wlan_vdev_obj_unlock(vdev);
8706 if (!osif_priv) {
8707 hdd_err("osif_priv is null");
8708 return;
8709 }
8710
8711 wdev = osif_priv->wdev;
8712 if (!wdev) {
8713 hdd_err("wdev is null");
8714 return;
8715 }
8716
8717 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008718
8719 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05308720 qdf_mem_zero(&wrqu, sizeof(wrqu));
8721 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008722
8723 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05308724 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008725
8726 wrqu.data.pointer = buf;
8727 wrqu.data.length = strlen(buf);
8728
8729 /* send the event */
8730
Abhishek Singh0481d662017-04-11 18:20:11 +05308731 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008732}
8733
8734/**
8735 * __iw_set_pno() - Preferred Network Offload ioctl handler
8736 * @dev: device upon which the ioctl was received
8737 * @info: ioctl request information
8738 * @wrqu: ioctl request data
8739 * @extra: ioctl extra data
8740 *
8741 * This function parses a Preferred Network Offload command
8742 * Input is string based and expected to be of the form:
8743 *
8744 * <enable(1) | disable(0)>
8745 * when enabling:
8746 * <number of networks>
8747 * for each network:
8748 * <ssid_len> <ssid> <authentication> <encryption>
8749 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07008750 * <scan_time (seconds)>
8751 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008752 * <suspend mode>
8753 *
8754 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07008755 * 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 -08008756 *
8757 * this translates into:
8758 * -----------------------------
8759 * enable PNO
8760 * 2 networks
8761 * Network 1:
8762 * test - with authentication type 0 and encryption type 0,
8763 * search on 3 channels: 1 6 and 11,
8764 * SSID bcast type is unknown (directed probe will be sent if
8765 * AP not found) and must meet -40dBm RSSI
8766 * Network 2:
8767 * test2 - with authentication type 4 and encryption type 4,
8768 * search on 6 channels 1, 2, 3, 4, 5 and 6
8769 * bcast type is non-bcast (directed probe will be sent)
8770 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008771 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07008772 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008773 */
8774static int __iw_set_pno(struct net_device *dev,
8775 struct iw_request_info *info,
8776 union iwreq_data *wrqu, char *extra)
8777{
Jeff Johnson3d278b02017-08-29 14:17:47 -07008778 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008779 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05308780 uint8_t value;
8781 struct wlan_objmgr_vdev *vdev;
8782 struct wlan_objmgr_psoc *psoc;
8783 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008784 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308785 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05308786 uint8_t i, j, params;
8787 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308788 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008789
8790 /* request is a large struct, so we make it static to avoid
8791 * stack overflow. This API is only invoked via ioctl, so it
8792 * is serialized by the kernel rtnl_lock and hence does not
8793 * need to be reentrant
8794 */
Abhishek Singh0481d662017-04-11 18:20:11 +05308795 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008796
Dustin Brownfdf17c12018-03-14 12:55:34 -07008797 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008798
8799 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8800 ret = wlan_hdd_validate_context(hdd_ctx);
8801 if (ret)
8802 return ret;
8803
Jeff Johnson441e1f72017-02-07 08:50:49 -08008804 ret = hdd_check_private_wext_control(hdd_ctx, info);
8805 if (0 != ret)
8806 return ret;
8807
Dustin Brown07901ec2018-09-07 11:02:41 -07008808 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->pdev,
8809 dev->dev_addr,
8810 WLAN_LEGACY_MAC_ID);
Abhishek Singh0481d662017-04-11 18:20:11 +05308811 if (!vdev) {
8812 hdd_err("vdev object is NULL");
8813 return -EIO;
8814 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008815
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308816 /* making sure argument string ends with '\0' */
8817 len = (wrqu->data.length + 1);
8818 data = qdf_mem_malloc(len);
8819 if (!data) {
8820 hdd_err("fail to allocate memory %zu", len);
8821 return -EINVAL;
8822 }
8823 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308824 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008825
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05308826 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
8827
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308828 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008829 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308830 ret = -EINVAL;
8831 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008832 }
8833
Abhishek Singh0481d662017-04-11 18:20:11 +05308834 if (!value) {
8835 status = ucfg_scan_pno_stop(vdev);
8836 if (QDF_IS_STATUS_ERROR(status)) {
8837 hdd_err("Failed to disabled PNO");
8838 ret = -EINVAL;
8839 } else {
8840 hdd_debug("PNO scan disabled");
8841 }
8842 goto exit;
8843 }
8844
8845 if (ucfg_scan_get_pno_in_progress(vdev)) {
8846 hdd_debug("pno is already in progress");
8847 ret = -EBUSY;
8848 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008849 }
8850
8851 ptr += offset;
8852
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308853 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008854 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308855 ret = -EINVAL;
8856 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008857 }
Abhishek Singh0481d662017-04-11 18:20:11 +05308858 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008859
Abhishek Singh0481d662017-04-11 18:20:11 +05308860 hdd_debug("PNO enable networks count %d offset %d",
8861 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008862
Abhishek Singh0481d662017-04-11 18:20:11 +05308863 if ((0 == req.networks_cnt) ||
8864 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008865 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05308866 req.networks_cnt);
8867 ret = -EINVAL;
8868 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008869 }
8870
8871 ptr += offset;
8872
Abhishek Singh0481d662017-04-11 18:20:11 +05308873 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008874
Abhishek Singh0481d662017-04-11 18:20:11 +05308875 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008876
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308877 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308878 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008879 &offset);
8880
8881 if (1 != params) {
8882 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308883 ret = -EINVAL;
8884 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008885 }
8886
Abhishek Singh0481d662017-04-11 18:20:11 +05308887 if ((0 == req.networks_list[i].ssid.length) ||
8888 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008889 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308890 req.networks_list[i].ssid.length, i);
8891 ret = -EINVAL;
8892 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008893 }
8894
8895 /* Advance to SSID */
8896 ptr += offset;
8897
Abhishek Singh0481d662017-04-11 18:20:11 +05308898 memcpy(req.networks_list[i].ssid.ssid, ptr,
8899 req.networks_list[i].ssid.length);
8900 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008901
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308902 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308903 &(req.networks_list[i].authentication),
8904 &(req.networks_list[i].encryption),
8905 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008906 &offset);
8907
8908 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008909 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308910 ret = -EINVAL;
8911 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008912 }
8913
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008914 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308915 req.networks_list[i].ssid.length,
8916 req.networks_list[i].ssid.length,
8917 req.networks_list[i].ssid.ssid,
8918 req.networks_list[i].authentication,
8919 req.networks_list[i].encryption,
8920 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008921
8922 /* Advance to channel list */
8923 ptr += offset;
8924
Abhishek Singh0481d662017-04-11 18:20:11 +05308925 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
8926 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008927 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05308928 ret = -EINVAL;
8929 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008930 }
8931
Abhishek Singh0481d662017-04-11 18:20:11 +05308932 if (0 != req.networks_list[i].channel_cnt) {
8933 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008934 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308935 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05308936 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008937 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008938 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308939 ret = -EINVAL;
8940 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008941 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308942 if (!IS_CHANNEL_VALID(value)) {
8943 hdd_err("invalid channel: %hhu", value);
8944 ret = -EINVAL;
8945 goto exit;
8946 }
Abhishek Singh0481d662017-04-11 18:20:11 +05308947 req.networks_list[i].channels[j] =
8948 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008949 /* Advance to next channel number */
8950 ptr += offset;
8951 }
8952 }
8953
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308954 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308955 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008956 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008957 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008958 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308959 ret = -EINVAL;
8960 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008961 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308962 if (req.networks_list[i].bc_new_type > 2) {
8963 hdd_err("invalid bcast nw type: %u",
8964 req.networks_list[i].bc_new_type);
8965 ret = -EINVAL;
8966 goto exit;
8967 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008968
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008969 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308970 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008971
8972 /* Advance to rssi Threshold */
8973 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308974 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05308975 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008976 &offset)) {
8977 hdd_err("PNO rssi threshold input is not valid %s",
8978 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05308979 ret = -EINVAL;
8980 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008981 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008982 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05308983 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008984 /* Advance to next network */
8985 ptr += offset;
8986 } /* For ucNetworkCount */
8987
Abhishek Singh0481d662017-04-11 18:20:11 +05308988 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308989 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05308990 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07008991 ptr += offset;
8992 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05308993 if (req.fast_scan_period == 0) {
8994 hdd_err("invalid fast scan period %u",
8995 req.fast_scan_period);
8996 ret = -EINVAL;
8997 goto exit;
8998 }
Dustin Brown43e87292016-10-10 10:38:25 -07008999
Abhishek Singh0481d662017-04-11 18:20:11 +05309000 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309001 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07009002 &offset) > 0)
9003 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05309004 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07009005
Dustin Brown07901ec2018-09-07 11:02:41 -07009006 wlan_pdev_obj_lock(hdd_ctx->pdev);
9007 psoc = wlan_pdev_get_psoc(hdd_ctx->pdev);
9008 wlan_pdev_obj_unlock(hdd_ctx->pdev);
Abhishek Singh0481d662017-04-11 18:20:11 +05309009 ucfg_scan_register_pno_cb(psoc,
9010 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009011
Abhishek Singh0481d662017-04-11 18:20:11 +05309012 ucfg_scan_get_pno_def_params(vdev, &req);
9013 status = ucfg_scan_pno_start(vdev, &req);
9014 if (QDF_IS_STATUS_ERROR(status)) {
9015 hdd_err("Failed to enable PNO");
9016 ret = -EINVAL;
9017 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009018
Abhishek Singh0481d662017-04-11 18:20:11 +05309019exit:
9020 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009021
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309022 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05309023 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009024}
9025
9026static int iw_set_pno(struct net_device *dev,
9027 struct iw_request_info *info,
9028 union iwreq_data *wrqu, char *extra)
9029{
9030 int ret;
9031
9032 cds_ssr_protect(__func__);
9033 ret = __iw_set_pno(dev, info, wrqu, extra);
9034 cds_ssr_unprotect(__func__);
9035
9036 return ret;
9037}
9038#endif /* FEATURE_WLAN_SCAN_PNO */
9039
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009040static int __iw_set_band_config(struct net_device *dev,
9041 struct iw_request_info *info,
9042 union iwreq_data *wrqu, char *extra)
9043{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009044 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009045 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08009046 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009047 int *value = (int *)extra;
9048
Dustin Brownfdf17c12018-03-14 12:55:34 -07009049 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009050
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309051 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009052 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309053 return -EPERM;
9054 }
9055
Jeff Johnson441e1f72017-02-07 08:50:49 -08009056 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9057 ret = hdd_check_private_wext_control(hdd_ctx, info);
9058 if (0 != ret)
9059 return ret;
9060
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07009061 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009062}
9063
9064static int iw_set_band_config(struct net_device *dev,
9065 struct iw_request_info *info,
9066 union iwreq_data *wrqu, char *extra)
9067{
9068 int ret;
9069
9070 cds_ssr_protect(__func__);
9071 ret = __iw_set_band_config(dev, info, wrqu, extra);
9072 cds_ssr_unprotect(__func__);
9073
9074 return ret;
9075}
9076
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009077static int printk_adapter(void *priv, const char *fmt, ...)
9078{
9079 int ret;
9080 va_list args;
9081
9082 va_start(args, fmt);
9083 ret = vprintk(fmt, args);
9084 ret += printk("\n");
9085 va_end(args);
9086
9087 return ret;
9088}
9089
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009090static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
9091{
9092 qdf_abstract_print *print = &printk_adapter;
9093
9094 switch (log_id) {
9095 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009096 cds_print_htc_credit_history(count, print, NULL);
9097 break;
9098 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009099 wma_print_wmi_cmd_log(count, print, NULL);
9100 break;
9101 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009102 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
9103 break;
9104 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009105 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
9106 break;
9107 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009108 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
9109 break;
9110 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009111 wma_print_wmi_event_log(count, print, NULL);
9112 break;
9113 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009114 wma_print_wmi_rx_event_log(count, print, NULL);
9115 break;
9116 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009117 wma_print_wmi_mgmt_event_log(count, print, NULL);
9118 break;
9119 default:
9120 print(NULL, "Invalid Log Id %d", log_id);
9121 break;
9122 }
9123}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009124
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009125#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
9126int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
9127{
9128 struct hdd_context *hdd_ctx;
9129 int ret;
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309130 bool crash_inject;
9131 QDF_STATUS status;
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009132
9133 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
9134 v1, v2);
9135 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
9136 v1, v2);
9137 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309138
Vignesh Viswanathana1f3a1a2018-10-04 13:10:46 +05309139 status = ucfg_mlme_get_crash_inject(hdd_ctx->psoc, &crash_inject);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309140 if (QDF_IS_STATUS_ERROR(status)) {
9141 hdd_err("Failed to get crash inject ini config");
9142 return 0;
9143 }
9144
9145 if (!crash_inject) {
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009146 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
9147 return 0;
9148 }
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309149
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009150 if (v1 == 3) {
9151 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
9152 return 0;
9153 }
9154 ret = wma_cli_set2_command(adapter->session_id,
9155 GEN_PARAM_CRASH_INJECT,
9156 v1, v2, GEN_CMD);
9157 return ret;
9158}
9159#endif
9160
Nirav Shahd21a2e32018-04-20 16:34:43 +05309161#ifdef CONFIG_DP_TRACE
9162void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
9163{
9164 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
9165 cmd_type, count);
9166 if (cmd_type == DUMP_DP_TRACE)
9167 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
9168 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
9169 qdf_dp_trace_enable_live_mode();
9170 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
9171 qdf_dp_trace_clear_buffer();
9172 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
9173 qdf_dp_trace_disable_live_mode();
9174}
9175#endif
9176
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009177static int __iw_set_two_ints_getnone(struct net_device *dev,
9178 struct iw_request_info *info,
9179 union iwreq_data *wrqu, char *extra)
9180{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009181 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009182 int *value = (int *)extra;
9183 int sub_cmd = value[0];
9184 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08009185 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009186 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08009187 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009188
Dustin Brownfdf17c12018-03-14 12:55:34 -07009189 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009190
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009191 ret = wlan_hdd_validate_context(hdd_ctx);
9192 if (0 != ret)
9193 return ret;
9194
Jeff Johnson441e1f72017-02-07 08:50:49 -08009195 ret = hdd_check_private_wext_control(hdd_ctx, info);
9196 if (0 != ret)
9197 return ret;
9198
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009199 switch (sub_cmd) {
9200 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009201 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07009202 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009203 WMI_STA_SMPS_PARAM_CMDID,
9204 value[1] << WMA_SMPS_PARAM_VALUE_S
9205 | value[2],
9206 VDEV_CMD);
9207 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009208 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009209 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009210 break;
Govind Singha471e5e2015-10-12 17:11:14 +05309211 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07009212 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309213 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07009214 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309215 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
9216 value[1], value[2], DBG_CMD);
9217 break;
9218 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07009219 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309220 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07009221 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309222 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
9223 value[1], value[2], DBG_CMD);
9224 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009225 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
9226 hdd_debug("Ioctl to set dual fw mode config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08009227 status =
9228 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
9229 &dual_mac_feature);
9230 if (status != QDF_STATUS_SUCCESS)
9231 hdd_err("can't get dual mac feature val, use def");
9232 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009233 hdd_err("Dual mac feature is disabled from INI");
9234 return -EPERM;
9235 }
9236 hdd_debug("%d %d", value[1], value[2]);
Dustin Brown05d81302018-09-11 16:49:22 -07009237 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009238 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009239 break;
9240 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05309241 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009242 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009243 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009244 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009245 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07009246 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08009247 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
9248 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009249 break;
9250 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07009251 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009252 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009253 case WE_LOG_BUFFER: {
9254 int log_id = value[1];
9255 uint32_t count = value[2] < 0 ? 0 : value[2];
9256
9257 hdd_ioctl_log_buffer(log_id, count);
9258
9259 break;
9260 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07009261 case WE_SET_BA_AGEING_TIMEOUT:
9262 {
9263 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
9264
9265 if (!soc) {
9266 hdd_err("Invalid handles");
9267 break;
9268 }
9269 cdp_set_ba_timeout(soc, value[1], value[2]);
9270 break;
9271 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009272 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07009273 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009274 break;
9275 }
9276
9277 return ret;
9278}
9279
9280static int iw_set_two_ints_getnone(struct net_device *dev,
9281 struct iw_request_info *info,
9282 union iwreq_data *wrqu, char *extra)
9283{
9284 int ret;
9285
9286 cds_ssr_protect(__func__);
9287 ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
9288 cds_ssr_unprotect(__func__);
9289
9290 return ret;
9291}
9292
9293/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009294
9295static const iw_handler we_private[] = {
9296
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009297 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9298 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9299 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009300 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9301 iw_set_three_ints_getnone,
9302 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009303 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009304 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9305 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009306 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9307 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309308#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009309 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309310#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009311 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9312 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9313 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009314 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009315 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9316 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9317 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9318 iw_set_keepalive_params,
9319#ifdef WLAN_FEATURE_PACKET_FILTERING
9320 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9321 iw_set_packet_filter_params,
9322#endif
9323#ifdef FEATURE_WLAN_SCAN_PNO
9324 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9325#endif
9326 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009327 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9328 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009329 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
9330 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9331 iw_set_two_ints_getnone,
9332 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9333 iw_set_dot11p_channel_sched,
9334};
9335
9336/*Maximum command length can be only 15 */
9337static const struct iw_priv_args we_private_args[] = {
9338
9339 /* handlers for main ioctl */
9340 {WLAN_PRIV_SET_INT_GET_NONE,
9341 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9342 0,
9343 ""},
9344
9345 /* handlers for sub-ioctl */
9346 {WE_SET_11D_STATE,
9347 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9348 0,
9349 "set11Dstate"},
9350
9351 {WE_WOWL,
9352 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9353 0,
9354 "wowl"},
9355
9356 {WE_SET_POWER,
9357 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9358 0,
9359 "setPower"},
9360
9361 {WE_SET_MAX_ASSOC,
9362 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9363 0,
9364 "setMaxAssoc"},
9365
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009366 {WE_SET_SCAN_DISABLE,
9367 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9368 0,
9369 "scan_disable"},
9370
9371 {WE_SET_DATA_INACTIVITY_TO,
9372 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9373 0,
9374 "inactivityTO"},
9375
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05309376 {WE_SET_WOW_DATA_INACTIVITY_TO,
9377 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9378 0,
9379 "wow_ito"},
9380
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009381 {WE_SET_MAX_TX_POWER,
9382 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9383 0,
9384 "setMaxTxPower"},
9385
9386 {WE_SET_TX_POWER,
9387 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9388 0,
9389 "setTxPower"},
9390
9391 {WE_SET_MC_RATE,
9392 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9393 0,
9394 "setMcRate"},
9395
9396 {WE_SET_MAX_TX_POWER_2_4,
9397 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9398 0,
9399 "setTxMaxPower2G"},
9400
9401 {WE_SET_MAX_TX_POWER_5_0,
9402 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9403 0,
9404 "setTxMaxPower5G"},
9405
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309406#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009407 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05309408 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009409 0,
9410 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309411#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009412
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009413 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
9414 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -08009415 * will support both
9416 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009417 {WE_SET_MAX_TX_POWER,
9418 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9419 0,
9420 "setTxMaxPower"},
9421
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009422 {WE_SET_TM_LEVEL,
9423 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9424 0,
9425 "setTmLevel"},
9426
9427 {WE_SET_PHYMODE,
9428 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9429 0,
9430 "setphymode"},
9431
9432 {WE_SET_NSS,
9433 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9434 0,
9435 "nss"},
9436
9437 {WE_SET_LDPC,
9438 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9439 0,
9440 "ldpc"},
9441
9442 {WE_SET_TX_STBC,
9443 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9444 0,
9445 "tx_stbc"},
9446
9447 {WE_SET_RX_STBC,
9448 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9449 0,
9450 "rx_stbc"},
9451
9452 {WE_SET_SHORT_GI,
9453 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9454 0,
9455 "shortgi"},
9456
9457 {WE_SET_RTSCTS,
9458 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9459 0,
9460 "enablertscts"},
9461
9462 {WE_SET_CHWIDTH,
9463 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9464 0,
9465 "chwidth"},
9466
9467 {WE_SET_ANI_EN_DIS,
9468 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9469 0,
9470 "anienable"},
9471
9472 {WE_SET_ANI_POLL_PERIOD,
9473 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9474 0,
9475 "aniplen"},
9476
9477 {WE_SET_ANI_LISTEN_PERIOD,
9478 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9479 0,
9480 "anilislen"},
9481
9482 {WE_SET_ANI_OFDM_LEVEL,
9483 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9484 0,
9485 "aniofdmlvl"},
9486
9487 {WE_SET_ANI_CCK_LEVEL,
9488 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9489 0,
9490 "aniccklvl"},
9491
9492 {WE_SET_DYNAMIC_BW,
9493 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9494 0,
9495 "cwmenable"},
9496
9497 {WE_SET_CTS_CBW,
9498 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9499 0,
9500 "cts_cbw" },
9501
9502 {WE_SET_GTX_HT_MCS,
9503 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9504 0,
9505 "gtxHTMcs"},
9506
9507 {WE_SET_GTX_VHT_MCS,
9508 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9509 0,
9510 "gtxVHTMcs"},
9511
9512 {WE_SET_GTX_USRCFG,
9513 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9514 0,
9515 "gtxUsrCfg"},
9516
9517 {WE_SET_GTX_THRE,
9518 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9519 0,
9520 "gtxThre"},
9521
9522 {WE_SET_GTX_MARGIN,
9523 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9524 0,
9525 "gtxMargin"},
9526
9527 {WE_SET_GTX_STEP,
9528 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9529 0,
9530 "gtxStep"},
9531
9532 {WE_SET_GTX_MINTPC,
9533 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9534 0,
9535 "gtxMinTpc"},
9536
9537 {WE_SET_GTX_BWMASK,
9538 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9539 0,
9540 "gtxBWMask"},
9541
9542 {WE_SET_TX_CHAINMASK,
9543 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9544 0,
9545 "txchainmask"},
9546
9547 {WE_SET_RX_CHAINMASK,
9548 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9549 0,
9550 "rxchainmask"},
9551
9552 {WE_SET_11N_RATE,
9553 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9554 0,
9555 "set11NRates"},
9556
9557 {WE_SET_VHT_RATE,
9558 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9559 0,
9560 "set11ACRates"},
9561
9562 {WE_SET_AMPDU,
9563 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9564 0,
9565 "ampdu"},
9566
9567 {WE_SET_AMSDU,
9568 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9569 0,
9570 "amsdu"},
9571
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009572 {WE_SET_TXPOW_2G,
9573 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9574 0,
9575 "txpow2g"},
9576
9577 {WE_SET_TXPOW_5G,
9578 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9579 0,
9580 "txpow5g"},
9581
Wen Gong99768902018-04-25 12:07:49 +08009582#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009583 /* Sub-cmds DBGLOG specific commands */
9584 {WE_DBGLOG_LOG_LEVEL,
9585 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9586 0,
9587 "dl_loglevel"},
9588
9589 {WE_DBGLOG_VAP_ENABLE,
9590 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9591 0,
9592 "dl_vapon"},
9593
9594 {WE_DBGLOG_VAP_DISABLE,
9595 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9596 0,
9597 "dl_vapoff"},
9598
9599 {WE_DBGLOG_MODULE_ENABLE,
9600 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9601 0,
9602 "dl_modon"},
9603
9604 {WE_DBGLOG_MODULE_DISABLE,
9605 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9606 0,
9607 "dl_modoff"},
9608
9609 {WE_DBGLOG_MOD_LOG_LEVEL,
9610 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9611 0,
9612 "dl_mod_loglevel"},
9613
9614 {WE_DBGLOG_TYPE,
9615 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9616 0,
9617 "dl_type"},
9618 {WE_DBGLOG_REPORT_ENABLE,
9619 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9620 0,
9621 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +08009622#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009623
9624 {WE_SET_TXRX_FWSTATS,
9625 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9626 0,
9627 "txrx_fw_stats"},
9628
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009629 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +08009630 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009631 0,
9632 "txrx_stats"},
9633
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009634 {WE_TXRX_FWSTATS_RESET,
9635 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9636 0,
9637 "txrx_fw_st_rst"},
9638
9639 {WE_PPS_PAID_MATCH,
9640 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9641 0, "paid_match"},
9642
9643 {WE_PPS_GID_MATCH,
9644 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9645 0, "gid_match"},
9646
9647 {WE_PPS_EARLY_TIM_CLEAR,
9648 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9649 0, "tim_clear"},
9650
9651 {WE_PPS_EARLY_DTIM_CLEAR,
9652 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9653 0, "dtim_clear"},
9654
9655 {WE_PPS_EOF_PAD_DELIM,
9656 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9657 0, "eof_delim"},
9658
9659 {WE_PPS_MACADDR_MISMATCH,
9660 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9661 0, "mac_match"},
9662
9663 {WE_PPS_DELIM_CRC_FAIL,
9664 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9665 0, "delim_fail"},
9666
9667 {WE_PPS_GID_NSTS_ZERO,
9668 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9669 0, "nsts_zero"},
9670
9671 {WE_PPS_RSSI_CHECK,
9672 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9673 0, "rssi_chk"},
9674
9675 {WE_PPS_5G_EBT,
9676 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9677 0, "5g_ebt"},
9678
9679 {WE_SET_HTSMPS,
9680 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9681 0, "htsmps"},
9682
9683 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
9684 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9685 0, "set_qpspollcnt"},
9686
9687 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
9688 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9689 0, "set_qtxwake"},
9690
9691 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
9692 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9693 0, "set_qwakeintv"},
9694
9695 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
9696 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9697 0, "set_qnodatapoll"},
9698
9699 /* handlers for MCC time quota and latency sub ioctls */
9700 {WE_MCC_CONFIG_LATENCY,
9701 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9702 0, "setMccLatency"},
9703
9704 {WE_MCC_CONFIG_QUOTA,
9705 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9706 0, "setMccQuota"},
9707
9708 {WE_SET_DEBUG_LOG,
9709 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9710 0, "setDbgLvl"},
9711
9712 /* handlers for early_rx power save */
9713 {WE_SET_EARLY_RX_ADJUST_ENABLE,
9714 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9715 0, "erx_enable"},
9716
9717 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
9718 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9719 0, "erx_bmiss_val"},
9720
9721 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
9722 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9723 0, "erx_bmiss_smpl"},
9724
9725 {WE_SET_EARLY_RX_SLOP_STEP,
9726 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9727 0, "erx_slop_step"},
9728
9729 {WE_SET_EARLY_RX_INIT_SLOP,
9730 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9731 0, "erx_init_slop"},
9732
9733 {WE_SET_EARLY_RX_ADJUST_PAUSE,
9734 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9735 0, "erx_adj_pause"},
9736
9737 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
9738 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9739 0, "erx_dri_sample"},
9740
9741 {WE_DUMP_STATS,
9742 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9743 0, "dumpStats"},
9744
9745 {WE_CLEAR_STATS,
9746 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9747 0, "clearStats"},
9748
Govind Singha471e5e2015-10-12 17:11:14 +05309749 {WE_START_FW_PROFILE,
9750 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9751 0, "startProfile"},
9752
Abhishek Singh1bdb1572015-10-16 16:24:19 +05309753 {WE_SET_CHANNEL,
9754 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9755 0, "setChanChange" },
9756
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05309757 {WE_SET_CONC_SYSTEM_PREF,
9758 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9759 0, "setConcSysPref" },
9760
Jeff Johnson011c4502017-10-05 15:25:56 -07009761 {WE_SET_PDEV_RESET,
9762 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9763 0, "pdev_reset" },
9764
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05309765 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -08009766 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9767 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05309768
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009769 {WLAN_PRIV_SET_NONE_GET_INT,
9770 0,
9771 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9772 ""},
9773
9774 /* handlers for sub-ioctl */
9775 {WE_GET_11D_STATE,
9776 0,
9777 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9778 "get11Dstate"},
9779
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009780 {WE_GET_WLAN_DBG,
9781 0,
9782 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9783 "getwlandbg"},
9784
9785 {WE_GET_MAX_ASSOC,
9786 0,
9787 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9788 "getMaxAssoc"},
9789
9790 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
9791 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9792 "getAutoChannel" },
9793
9794 {WE_GET_CONCURRENCY_MODE,
9795 0,
9796 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9797 "getconcurrency"},
9798
9799 {WE_GET_NSS,
9800 0,
9801 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9802 "get_nss"},
9803
9804 {WE_GET_LDPC,
9805 0,
9806 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9807 "get_ldpc"},
9808
9809 {WE_GET_TX_STBC,
9810 0,
9811 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9812 "get_tx_stbc"},
9813
9814 {WE_GET_RX_STBC,
9815 0,
9816 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9817 "get_rx_stbc"},
9818
9819 {WE_GET_SHORT_GI,
9820 0,
9821 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9822 "get_shortgi"},
9823
9824 {WE_GET_RTSCTS,
9825 0,
9826 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9827 "get_rtscts"},
9828
9829 {WE_GET_CHWIDTH,
9830 0,
9831 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9832 "get_chwidth"},
9833
9834 {WE_GET_ANI_EN_DIS,
9835 0,
9836 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9837 "get_anienable"},
9838
9839 {WE_GET_ANI_POLL_PERIOD,
9840 0,
9841 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9842 "get_aniplen"},
9843
9844 {WE_GET_ANI_LISTEN_PERIOD,
9845 0,
9846 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9847 "get_anilislen"},
9848
9849 {WE_GET_ANI_OFDM_LEVEL,
9850 0,
9851 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9852 "get_aniofdmlvl"},
9853
9854 {WE_GET_ANI_CCK_LEVEL,
9855 0,
9856 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9857 "get_aniccklvl"},
9858
9859 {WE_GET_DYNAMIC_BW,
9860 0,
9861 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9862 "get_cwmenable"},
9863
9864 {WE_GET_GTX_HT_MCS,
9865 0,
9866 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9867 "get_gtxHTMcs"},
9868
9869 {WE_GET_GTX_VHT_MCS,
9870 0,
9871 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9872 "get_gtxVHTMcs"},
9873
9874 {WE_GET_GTX_USRCFG,
9875 0,
9876 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9877 "get_gtxUsrCfg"},
9878
9879 {WE_GET_GTX_THRE,
9880 0,
9881 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9882 "get_gtxThre"},
9883
9884 {WE_GET_GTX_MARGIN,
9885 0,
9886 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9887 "get_gtxMargin"},
9888
9889 {WE_GET_GTX_STEP,
9890 0,
9891 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9892 "get_gtxStep"},
9893
9894 {WE_GET_GTX_MINTPC,
9895 0,
9896 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9897 "get_gtxMinTpc"},
9898
9899 {WE_GET_GTX_BWMASK,
9900 0,
9901 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9902 "get_gtxBWMask"},
9903
9904 {WE_GET_TX_CHAINMASK,
9905 0,
9906 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9907 "get_txchainmask"},
9908
9909 {WE_GET_RX_CHAINMASK,
9910 0,
9911 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9912 "get_rxchainmask"},
9913
9914 {WE_GET_11N_RATE,
9915 0,
9916 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9917 "get_11nrate"},
9918
9919 {WE_GET_AMPDU,
9920 0,
9921 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9922 "get_ampdu"},
9923
9924 {WE_GET_AMSDU,
9925 0,
9926 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9927 "get_amsdu"},
9928
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009929 {WE_GET_TXPOW_2G,
9930 0,
9931 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9932 "get_txpow2g"},
9933
9934 {WE_GET_TXPOW_5G,
9935 0,
9936 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9937 "get_txpow5g"},
9938
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009939 {WE_GET_PPS_PAID_MATCH,
9940 0,
9941 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9942 "get_paid_match"},
9943
9944 {WE_GET_PPS_GID_MATCH,
9945 0,
9946 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9947 "get_gid_match"},
9948
9949 {WE_GET_PPS_EARLY_TIM_CLEAR,
9950 0,
9951 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9952 "get_tim_clear"},
9953
9954 {WE_GET_PPS_EARLY_DTIM_CLEAR,
9955 0,
9956 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9957 "get_dtim_clear"},
9958
9959 {WE_GET_PPS_EOF_PAD_DELIM,
9960 0,
9961 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9962 "get_eof_delim"},
9963
9964 {WE_GET_PPS_MACADDR_MISMATCH,
9965 0,
9966 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9967 "get_mac_match"},
9968
9969 {WE_GET_PPS_DELIM_CRC_FAIL,
9970 0,
9971 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9972 "get_delim_fail"},
9973
9974 {WE_GET_PPS_GID_NSTS_ZERO,
9975 0,
9976 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9977 "get_nsts_zero"},
9978
9979 {WE_GET_PPS_RSSI_CHECK,
9980 0,
9981 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9982 "get_rssi_chk"},
9983
9984 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
9985 0,
9986 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9987 "get_qpspollcnt"},
9988
9989 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
9990 0,
9991 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9992 "get_qtxwake"},
9993
9994 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
9995 0,
9996 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9997 "get_qwakeintv"},
9998
9999 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10000 0,
10001 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10002 "get_qnodatapoll"},
10003
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010004 {WE_CAP_TSF,
10005 0,
10006 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10007 "cap_tsf"},
10008
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010009 {WE_GET_TEMPERATURE,
10010 0,
10011 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10012 "get_temp"},
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010013 {WE_GET_DCM,
10014 0,
10015 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10016 "get_dcm"},
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010017 {WE_GET_RANGE_EXT,
10018 0,
10019 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10020 "get_range_ext"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010021 /* handlers for main ioctl */
10022 {WLAN_PRIV_SET_CHAR_GET_NONE,
10023 IW_PRIV_TYPE_CHAR | 512,
10024 0,
10025 ""},
10026
10027 /* handlers for sub-ioctl */
10028 {WE_WOWL_ADD_PTRN,
10029 IW_PRIV_TYPE_CHAR | 512,
10030 0,
10031 "wowlAddPtrn"},
10032
10033 {WE_WOWL_DEL_PTRN,
10034 IW_PRIV_TYPE_CHAR | 512,
10035 0,
10036 "wowlDelPtrn"},
10037
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010038 /* handlers for sub-ioctl */
10039 {WE_NEIGHBOR_REPORT_REQUEST,
10040 IW_PRIV_TYPE_CHAR | 512,
10041 0,
10042 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080010043
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010044 {WE_SET_AP_WPS_IE,
10045 IW_PRIV_TYPE_CHAR | 512,
10046 0,
10047 "set_ap_wps_ie"},
10048
10049 {WE_SET_CONFIG,
10050 IW_PRIV_TYPE_CHAR | 512,
10051 0,
10052 "setConfig"},
10053
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070010054#ifdef WLAN_UNIT_TEST
10055 {WE_UNIT_TEST,
10056 IW_PRIV_TYPE_CHAR | 512,
10057 0,
10058 "unit_test"},
10059#endif
10060
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010061 /* handlers for main ioctl */
10062 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
10063 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10064 0,
10065 ""},
10066
10067 /* handlers for sub-ioctl */
10068 {WE_SET_WLAN_DBG,
10069 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10070 0,
10071 "setwlandbg"},
10072
Nirav Shahd21a2e32018-04-20 16:34:43 +053010073#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010074 /* handlers for sub-ioctl */
10075 {WE_SET_DP_TRACE,
10076 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10077 0,
10078 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010079#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010080
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053010081 {WE_SET_FW_TEST,
10082 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10083 0, "fw_test"},
10084
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010085 /* handlers for main ioctl */
10086 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
10087 0,
10088 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10089 "" },
10090 {WE_GET_TSF,
10091 0,
10092 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10093 "get_tsf" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010094
10095 {WE_SET_DUAL_MAC_SCAN_CONFIG,
10096 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10097 0,
10098 "set_scan_cfg"},
10099
10100 /* handlers for main ioctl */
10101 {WLAN_PRIV_GET_CHAR_SET_NONE,
10102 0,
10103 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10104 ""},
10105
10106 /* handlers for sub-ioctl */
10107 {WE_WLAN_VERSION,
10108 0,
10109 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10110 "version"},
10111 {WE_GET_STATS,
10112 0,
10113 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10114 "getStats"},
Dustin Brownd9322482017-01-09 12:46:03 -080010115 {WE_GET_SUSPEND_RESUME_STATS,
10116 0,
10117 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10118 "getSuspendStats"},
Govind Singha471e5e2015-10-12 17:11:14 +053010119 {WE_LIST_FW_PROFILE,
10120 0,
10121 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10122 "listProfile"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010123 {WE_GET_STATES,
10124 0,
10125 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10126 "getHostStates"},
10127 {WE_GET_CFG,
10128 0,
10129 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10130 "getConfig"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010131 {WE_GET_RSSI,
10132 0,
10133 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10134 "getRSSI"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010135 {WE_GET_WMM_STATUS,
10136 0,
10137 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10138 "getWmmStatus"},
10139 {
10140 WE_GET_CHANNEL_LIST,
10141 0,
10142 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10143 "getChannelList"
10144 },
10145#ifdef FEATURE_WLAN_TDLS
10146 {
10147 WE_GET_TDLS_PEERS,
10148 0,
10149 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10150 "getTdlsPeers"
10151 },
10152#endif
10153#ifdef WLAN_FEATURE_11W
10154 {
10155 WE_GET_11W_INFO,
10156 0,
10157 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10158 "getPMFInfo"
10159 },
10160#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010161 {
Krunal Soni5e483782018-10-25 15:42:44 -070010162 WE_GET_STA_CXN_INFO,
10163 0,
10164 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10165 "get_cxn_info"
10166 },
10167
10168 {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010169 WE_GET_IBSS_STA_INFO,
10170 0,
10171 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10172 "getIbssSTAs"
10173 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010174 {WE_GET_PHYMODE,
10175 0,
10176 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10177 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010178#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010179 {WE_GET_OEM_DATA_CAP,
10180 0,
10181 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10182 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010183#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010184 {WE_GET_SNR,
10185 0,
10186 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10187 "getSNR"},
10188
Krunal Soni6c3859f2018-06-01 19:57:40 -070010189 {WE_GET_BA_AGEING_TIMEOUT,
10190 0,
10191 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10192 "get_ba_timeout"},
10193
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010194 /* handlers for main ioctl */
10195 {WLAN_PRIV_SET_NONE_GET_NONE,
10196 0,
10197 0,
10198 ""},
10199
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010200 /* handlers for sub-ioctl */
10201 {
10202 WE_IBSS_GET_PEER_INFO_ALL,
10203 0,
10204 0,
10205 "ibssPeerInfoAll"
10206 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010207 {WE_GET_RECOVERY_STAT,
10208 0,
10209 0,
10210 "getRecoverStat"},
Govind Singha471e5e2015-10-12 17:11:14 +053010211
10212 {WE_GET_FW_PROFILE_DATA,
10213 0,
10214 0,
10215 "getProfileData"},
10216
10217 {WE_SET_REASSOC_TRIGGER,
10218 0,
10219 0,
10220 "reassoc"},
10221
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010222 {WE_STOP_OBSS_SCAN,
10223 0,
10224 0,
10225 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010226 /* handlers for main ioctl */
10227 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
10228 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10229 0,
10230 ""},
10231
10232 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010233 {WE_IBSS_GET_PEER_INFO,
10234 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10235 0,
10236 "ibssPeerInfo"},
10237
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010238#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010239 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010240 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
10241 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10242 0,
10243 "setdumplog"},
10244
10245 {WE_MTRACE_DUMP_CMD,
10246 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10247 0,
10248 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010249#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -080010250
10251 {WE_POLICY_MANAGER_CINFO_CMD,
10252 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10253 0,
10254 "pm_cinfo"},
10255
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010256#ifdef MPC_UT_FRAMEWORK
10257 {WE_POLICY_MANAGER_CLIST_CMD,
10258 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10259 0,
10260 "pm_clist"},
10261
10262 {WE_POLICY_MANAGER_DLIST_CMD,
10263 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10264 0,
10265 "pm_dlist"},
10266
10267 {WE_POLICY_MANAGER_DBS_CMD,
10268 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10269 0,
10270 "pm_dbs"},
10271
10272 {WE_POLICY_MANAGER_PCL_CMD,
10273 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10274 0,
10275 "pm_pcl"},
10276
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010277 {WE_POLICY_MANAGER_ULIST_CMD,
10278 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10279 0,
10280 "pm_ulist"},
10281
10282 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
10283 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10284 0,
10285 "pm_query_action"},
10286
10287 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
10288 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10289 0,
10290 "pm_query_allow"},
10291
10292 {WE_POLICY_MANAGER_SCENARIO_CMD,
10293 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10294 0,
10295 "pm_run_scenario"},
10296
10297 {WE_POLICY_SET_HW_MODE_CMD,
10298 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10299 0,
10300 "pm_set_hw_mode"},
10301#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010302 {
10303 WE_UNIT_TEST_CMD,
10304 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10305 0,
10306 "setUnitTestCmd"
10307 },
Manjeet Singhf82ed072016-07-08 11:40:00 +053010308 {
10309 WE_MAC_PWR_DEBUG_CMD,
10310 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10311 0,
10312 "halPwrDebug"
10313 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010314
10315#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10316 {WE_LED_FLASHING_PARAM,
10317 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10318 0,
10319 "gpio_control"},
10320#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010321#ifdef WLAN_DEBUG
10322 {WE_SET_CHAN_AVOID,
10323 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10324 0,
10325 "ch_avoid"},
10326#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010327 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010328 {WLAN_PRIV_FIPS_TEST,
10329 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10330 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10331 "fips_test"},
10332
10333 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010334 {WLAN_PRIV_ADD_TSPEC,
10335 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10336 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10337 "addTspec"},
10338
10339 /* handlers for main ioctl */
10340 {WLAN_PRIV_DEL_TSPEC,
10341 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10342 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10343 "delTspec"},
10344
10345 /* handlers for main ioctl */
10346 {WLAN_PRIV_GET_TSPEC,
10347 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10348 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10349 "getTspec"},
10350
10351 /* handlers for main ioctl - host offload */
10352 {
10353 WLAN_PRIV_SET_HOST_OFFLOAD,
Srinivas Girigowda077143e2017-03-25 10:47:27 -070010354 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010355 0,
10356 "setHostOffload"
10357 }
10358 ,
10359
10360 {
10361 WLAN_GET_WLAN_STATISTICS,
10362 0,
10363 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10364 "getWlanStats"
10365 }
10366 ,
10367
10368 {
10369 WLAN_SET_KEEPALIVE_PARAMS,
Mahesh A Saptasagar72d2e4b2016-04-20 12:44:17 +053010370 IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) |
10371 IW_PRIV_SIZE_FIXED,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010372 0,
10373 "setKeepAlive"
10374 }
10375 ,
10376#ifdef WLAN_FEATURE_PACKET_FILTERING
10377 {
10378 WLAN_SET_PACKET_FILTER_PARAMS,
Hanumanth Reddy Pothulab3ef4162016-10-25 15:13:26 +053010379 IW_PRIV_TYPE_BYTE |
10380 sizeof(struct pkt_filter_cfg),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010381 0,
10382 "setPktFilter"
10383 }
10384 ,
10385#endif
10386#ifdef FEATURE_WLAN_SCAN_PNO
10387 {
10388 WLAN_SET_PNO,
10389 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10390 0,
10391 "setpno"
10392 }
10393 ,
10394#endif
10395 {
10396 WLAN_SET_BAND_CONFIG,
10397 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10398 0,
10399 "SETBAND"
10400 }
10401 ,
10402 {
Dustin Brown0cbc7572016-12-16 13:54:40 -080010403 WLAN_PRIV_SET_MCBC_FILTER,
Dustin Brown860566f2017-01-31 15:24:43 -080010404 0,
Dustin Brown0cbc7572016-12-16 13:54:40 -080010405 0,
10406 "setMCBCFilter"
10407 }
10408 ,
Dustin Brown0cbc7572016-12-16 13:54:40 -080010409
10410 {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010411 WLAN_GET_LINK_SPEED,
10412 IW_PRIV_TYPE_CHAR | 18,
10413 IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed"
10414 }
10415 ,
10416
10417 /* handlers for main ioctl */
10418 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
10419 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10420 0,
10421 ""}
10422 ,
10423 {WE_SET_SMPS_PARAM,
10424 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10425 0, "set_smps_param"}
10426 ,
10427 {WLAN_SET_DOT11P_CHANNEL_SCHED,
10428 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
10429 0, "set_dot11p" }
10430 ,
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010431#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010432 {WE_SET_FW_CRASH_INJECT,
10433 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10434 0, "crash_inject"}
10435 ,
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010436#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053010437#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070010438 {WE_LOG_BUFFER,
10439 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10440 0, "log_buffer"}
10441 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010442#endif
Krunal Soni6c3859f2018-06-01 19:57:40 -070010443 {WE_SET_BA_AGEING_TIMEOUT,
10444 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10445 0, "set_ba_timeout"}
10446 ,
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010447#ifdef WLAN_SUSPEND_RESUME_TEST
10448 {WE_SET_WLAN_SUSPEND,
10449 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10450 0, "wlan_suspend"}
10451 ,
10452 {WE_SET_WLAN_RESUME,
10453 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10454 0, "wlan_resume"}
10455 ,
10456#endif
Govind Singha471e5e2015-10-12 17:11:14 +053010457 {WE_ENABLE_FW_PROFILE,
10458 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10459 0, "enableProfile"}
10460 ,
10461 {WE_SET_FW_PROFILE_HIST_INTVL,
10462 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10463 0, "set_hist_intvl"}
10464 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010465 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
10466 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10467 0, "set_fw_mode_cfg"}
10468 ,
Nirav Shahd21a2e32018-04-20 16:34:43 +053010469#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010470 {WE_DUMP_DP_TRACE_LEVEL,
10471 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10472 0, "dump_dp_trace"}
10473 ,
Nirav Shahd21a2e32018-04-20 16:34:43 +053010474#endif
Nirav Shah73713f72018-05-17 14:50:41 +053010475#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070010476 {WE_SET_MON_MODE_CHAN,
10477 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10478 0, "setMonChan"}
10479 ,
Nirav Shah73713f72018-05-17 14:50:41 +053010480#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070010481 {WE_GET_ROAM_SYNCH_DELAY,
10482 0,
10483 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10484 "hostroamdelay"}
10485 ,
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080010486 {WE_SET_11AX_RATE,
10487 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10488 0,
10489 "set_11ax_rate"}
10490 ,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010491 {WE_SET_DCM,
10492 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10493 0,
10494 "enable_dcm"}
10495 ,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010496 {WE_SET_RANGE_EXT,
10497 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10498 0,
Naveen Rawat53448ea2017-11-27 11:43:18 -080010499 "range_ext"}
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010500 ,
Naveen Rawatc921c7b2017-06-13 17:29:51 -070010501
10502 {WLAN_PRIV_SET_FTIES,
10503 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
10504 0,
10505 "set_ft_ies"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010506};
10507
10508const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010509 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053010510 .num_private = QDF_ARRAY_SIZE(we_private),
10511 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010512
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010513 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010514 .private = (iw_handler *) we_private,
10515 .private_args = we_private_args,
10516 .get_wireless_stats = NULL,
10517};
10518
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010519void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010520{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010521 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010522
Dustin Browne7e71d32018-05-11 16:00:08 -070010523 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010524
Dustin Browne74003f2018-03-14 12:51:58 -070010525 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010526}
10527
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010528void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010529{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010530 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010531
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010532 rtnl_lock();
10533 dev->wireless_handlers = NULL;
10534 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010535
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010536 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010537}