blob: 2a14910a75c49b2eaf6ce22c9be747bb0499e21a [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08002 * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019/**
20 * DOC: wlan_hdd_wext.c
21 *
22 * Linux Wireless Extensions Implementation
23 */
24
25#include <linux/version.h>
26#include <linux/module.h>
27#include <linux/kernel.h>
28#include <linux/init.h>
29#include <linux/wireless.h>
30#include <mac_trace.h>
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 Brown6fb7a752018-11-30 11:33:57 -080069#include "qdf_hashtable_test.h"
Dustin Brownd315c452018-11-27 11:28:48 -080070#include "qdf_talloc_test.h"
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070071#include "qdf_str.h"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053072#include "qdf_trace.h"
Dustin Brownebb16d12018-11-29 17:52:07 -080073#include "qdf_types_test.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080074#include "wlan_hdd_assoc.h"
75#include "wlan_hdd_ioctl.h"
76#include "wlan_hdd_scan.h"
77#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080078#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070080#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070081#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080082#include "wlan_hdd_ocb.h"
83#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080084#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070085#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053086#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070087#ifdef WLAN_SUSPEND_RESUME_TEST
88#include "wlan_hdd_driver_ops.h"
89#include "hif.h"
Rajeev Kumar9bb2e852016-09-24 12:29:25 -070090#include "pld_common.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070091#endif
Dhanashri Atree7d442a2016-07-14 18:20:29 -070092#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053093#include "cds_utils.h"
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -070094#include "wlan_osif_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080095#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080096#include <cdp_txrx_stats.h>
97#include <cds_api.h>
Dustin Brown6099ddc2018-07-06 14:32:53 -070098#include "wlan_dsc_test.h"
Abhishek Singh0481d662017-04-11 18:20:11 +053099#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -0700100#include "wlan_hdd_regulatory.h"
101#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +0530102#include "wlan_hdd_packet_filter_api.h"
Naveen Rawat3ff5cff2018-01-29 14:31:16 -0800103#include "wlan_cp_stats_mc_ucfg_api.h"
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +0530104#include "wlan_mlme_ucfg_api.h"
Wu Gao93816212018-08-31 16:49:54 +0800105#include "cfg_mlme_sta.h"
Arif Hussain43e09712018-09-18 19:31:57 -0700106#include "wlan_mlme_public_struct.h"
Wu Gao93816212018-08-31 16:49:54 +0800107#include "cfg_ucfg_api.h"
Krunal Sonie71838d2018-09-27 10:45:05 -0700108#include "wlan_policy_mgr_ucfg.h"
Harprit Chhabadabec6de42018-09-10 10:21:15 -0700109#include "wlan_mlme_public_struct.h"
110#include "cfg_ucfg_api.h"
111#include "cfg_mlme_threshold.h"
Wu Gao66454f12018-09-26 19:55:41 +0800112#include "wlan_pmo_cfg.h"
113#include "wlan_pmo_ucfg_api.h"
Mohit Khannac9649652018-11-28 18:10:28 -0800114#include "dp_txrx.h"
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800115#include "wlan_fwol_ucfg_api.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530116
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800117/* Private ioctls and their sub-ioctls */
118#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
119#define WE_SET_11D_STATE 1
120#define WE_WOWL 2
121#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530122/*
123 * <ioctl>
124 * setMaxAssoc - Sets the maximum number of associated stations
125 *
126 * @INPUT: 1 to 32
127 *
128 * @OUTPUT: None
129 *
130 * This IOTCL sets the maximum number of associated stations
131 *
132 * @E.g: iwpriv wlan0 setMaxAssoc <value>
133 *
134 * Supported Feature: STA
135 *
136 * Usage: Internal/External
137 *
138 * </ioctl>
139 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800140#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530141/*
142 * <ioctl>
Jeff Johnsonf2cf6592018-05-06 16:27:44 -0700143 * scan_disable - Disable scan
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530144 *
145 * @INPUT: set_value
146 *
147 * @OUTPUT: None
148 *
149 * This IOCTL is used to set disable scan
150 *
151 * @E.g: iwpriv wlan0 scan_disable 1
152 *
153 * Supported Feature: Scan
154 *
155 * Usage: Internal/External
156 *
157 * </ioctl>
158 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800159#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530160/*
161 * <ioctl>
162 * inactivityTO - sets the timeout value for inactivity data while
163 * in power save mode
164 *
165 * @INPUT: int1…..int255
166 *
167 * @OUTPUT: None
168 *
169 * This IOCTL set the timeout value for inactivity data in power save mode
170 *
171 * @E.g: iwpriv wlan0 inactivityTO 20
172 *
173 * Supported Feature: STA
174 *
175 * Usage: Internal/External
176 *
177 * </ioctl>
178 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800179#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530180/*
181 * <ioctl>
182 * setMaxTxPower - Dynamically sets the maximum transmission power
183 *
184 * @INPUT: Transmission power in dBm
185 *
186 * @OUTPUT: None
187 *
188 * This IOCTL dynamically sets the maximum transmission power
189 * This setting does not persist over reboots
190 *
191 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
192 *
193 * Supported Feature: STA
194 *
195 * Usage: Internal/External
196 *
197 * </ioctl>
198 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800199#define WE_SET_MAX_TX_POWER 7
Jeff Johnson0187c622019-01-04 06:39:44 -0800200
201#ifdef HASTINGS_BT_WAR
202/* Temporary WAR for Hastings 1.1 only */
203#define WE_SET_HASTINGS_BT_WAR 8
204#endif
205
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800206#define WE_SET_TM_LEVEL 9
Jeff Johnson0187c622019-01-04 06:39:44 -0800207
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530208/*
209 * <ioctl>
210 * setphymode - Set the phymode dynamically
211 *
212 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
213 *
214 * @OUTPUT: None
215 *
216 * This IOCTL sets the phymode dynamically
217 *
218 * @E.g: iwpriv wlan0 setphymode 10
219 *
220 * Supported Feature: STA
221 *
222 * Usage: Internal/External
223 *
224 * </ioctl>
225 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800226#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530227/*
228 * <ioctl>
229 * nss - Set the number of spatial streams
230 *
231 * @INPUT: int1…..int3
232 *
233 * @OUTPUT: None
234 *
235 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
236 *
237 * @E.g: iwpriv wlan0 nss 2
238 *
239 * Supported Feature: STA
240 *
241 * Usage: Internal/External
242 *
243 * </ioctl>
244 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800245#define WE_SET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530246/*
247 * <ioctl>
248 * ldpc - Enables or disables LDPC
249 *
250 * @INPUT: 0 – Disable, 1 - Enable
251 *
252 * @OUTPUT: None
253 *
254 * This IOCTL enables or disables LDPC
255 *
256 * @E.g: iwpriv wlan0 ldpc 1
257 *
258 * Supported Feature: STA
259 *
260 * Usage: Internal/External
261 *
262 * </ioctl>
263 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800264#define WE_SET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530265/*
266 * <ioctl>
267 * tx_stbc - Enables or disables tx_stbc
268 *
269 * @INPUT: Int 0 – Disable, 1 - Enable
270 *
271 * @OUTPUT: None
272 *
273 * This IOTCL used to enables or disables tx_stbc
274 *
275 * @E.g: iwpriv wlan0 tx_stbc <value>
276 *
277 * Supported Feature: STA
278 *
279 * Usage: Internal/External
280 *
281 * </ioctl>
282 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800283#define WE_SET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530284/*
285 * <ioctl>
286 * rx_stbc - Set the rx_stbc parameter
287 *
288 * @INPUT: Int 0 – Disable, 1 - Enable
289 *
290 * @OUTPUT: None
291 *
292 * This IOTCL used to set rx_stbc parameter
293 *
294 * @E.g: iwpriv wlan0 rx_stbc <value>
295 *
296 * Supported Feature: STA
297 *
298 * Usage: Internal/External
299 *
300 * </ioctl>
301 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800302#define WE_SET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530303/*
304 * <ioctl>
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800305 * shortgi - Sets the short-guard interval
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530306 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800307 * @INPUT: Fixed Rate: 0 - 400ns, 1 - 800ns, 2 - 1600ns, 3 - 3200us
308 * Auto Rate: 8 - 400ns, 9 - 800ns, 10 - 1600ns, 11 - 3200us
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530309 *
310 * @OUTPUT: None
311 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800312 * This IOCTL sets the short-guard interval.
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530313 *
314 * @E.g: iwpriv wlan0 shortgi <value>
315 *
316 * Supported Feature: STA
317 *
318 * Usage: Internal/External
319 *
320 * </ioctl>
321 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800322#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530323/*
324 * <ioctl>
325 * enablertscts - enables or disables rts/cts.
326 *
327 * @INPUT: 1-Enable , 0-Disable
328 *
329 * @OUTPUT: None
330 *
331 * This IOCTL enables or disables rts/cts.
332 *
333 * @E.g: iwpriv wlan0 enablertscts <value>
334 *
335 * Supported Feature: STA
336 *
337 * Usage: Internal/External
338 *
339 * </ioctl>
340 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800341#define WE_SET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530342/*
343 * <ioctl>
344 * chwidth - Set the channel bandwidth
345 *
346 * @INPUT: 0-20mhz to 3-160mhz
347 *
348 * @OUTPUT: None
349 *
350 * This IOTCL used to set the channel bandwidth
351 *
352 * @E.g: iwpriv wlan0 chwidth 1
353 *
354 * Supported Feature: STA
355 *
356 * Usage: Internal/External
357 *
358 * </ioctl>
359 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800360#define WE_SET_CHWIDTH 17
361#define WE_SET_ANI_EN_DIS 18
362#define WE_SET_ANI_POLL_PERIOD 19
363#define WE_SET_ANI_LISTEN_PERIOD 20
364#define WE_SET_ANI_OFDM_LEVEL 21
365#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530366/*
367 * <ioctl>
368 * cwmenable - Enables or disables the dynamic channel bandwidth
369 *
370 * @INPUT: 0-Disable, 1-Enable
371 *
372 * @OUTPUT: None
373 *
374 * This IOTCL used to enables or disables the dynamic channel bandwidth
375 *
376 * @E.g: iwpriv wlan0 cwmenable <value>
377 *
378 * Supported Feature: STA
379 *
380 * Usage: Internal/External
381 *
382 * </ioctl>
383 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800384#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530385/*
386 * <ioctl>
387 * txchainmask - This IOCTL sets the current Tx chain mask
388 *
389 * @INPUT: Mask Value
390 *
391 * @OUTPUT: None
392 *
393 * This IOCTL sets the current Tx chain mask
394 *
395 * @E.g: iwpriv wlan0 txchainmask 1
396 *
397 * Supported Feature: STA
398 *
399 * Usage: Internal/External
400 *
401 * </ioctl>
402 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800403#define WE_SET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530404/*
405 * <ioctl>
406 * rxchainmask - Sets the current Rx chain mask
407 *
408 * @INPUT: Mask Value
409 *
410 * @OUTPUT: None
411 *
412 * This IOCTL sets the current Rx chain mask. This command is the
413 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
414 *
415 * @E.g: iwpriv wlan0 rxchainmask <value>
416 *
417 * Supported Feature: STA
418 *
419 * Usage: Internal/External
420 *
421 * </ioctl>
422 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800423#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530424/*
425 * <ioctl>
426 * set11NRates - Fixes the Tx data rate of the 11N mode.
427 *
428 * @INPUT: 0x1b to 0x8f
429 *
430 * @OUTPUT: None
431 *
432 * This IOCTL fixes the Tx data rate of the 11N mode.
433 *
434 * @E.g: iwpriv wlan0 set11NRates 0x85
435 *
436 * Supported Feature: STA
437 *
438 * Usage: Internal/External
439 *
440 * </ioctl>
441 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800442#define WE_SET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530443/*
444 * <ioctl>
445 * ampdu - Set the the maximum subframe of ampdu
446 *
447 * @INPUT: int 1 to int 63
448 *
449 * @OUTPUT: None
450 *
451 * This IOCTL sets the maximum subframe of ampdu.
452 *
453 * @E.g: iwpriv wlan0 ampdu 9
454 *
455 * Supported Feature: STA
456 *
457 * Usage: Internal/External
458 *
459 * </ioctl>
460 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800461#define WE_SET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530462/*
463 * <ioctl>
464 * amsdu - Sets the maximum subframe of amsdu.
465 *
466 * @INPUT: int 1 to int 31
467 *
468 * @OUTPUT: None
469 *
470 * This IOCTL sets the maximum subframe of amsdu.
471 *
472 * @E.g: iwpriv wlan0 amsdu 9
473 *
474 * Supported Feature: STA
475 *
476 * Usage: Internal/External
477 *
478 * </ioctl>
479 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800480#define WE_SET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530481/*
482 * <ioctl>
483 * txpow2g - current 2 GHz Tx power setting
484 *
485 * @INPUT: Tx power in dBm
486 *
487 * @OUTPUT: None
488 *
489 * This IOTCL used to set 2 ghz tx power
490 *
491 * @E.g: iwpriv wlan0 txpow2g
492 *
493 * Supported Feature: STA
494 *
495 * Usage: Internal/External
496 *
497 * </ioctl>
498 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800499#define WE_SET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530500/*
501 * <ioctl>
502 * txpow5g - Current 5 GHz tx power setting
503 *
504 * @INPUT: Tx power in dBm
505 *
506 * @OUTPUT: None
507 *
508 * This IOTCL used to set the 5 ghz txpower
509 *
510 * @E.g: iwpriv wlan0 txpow5g
511 *
512 * Supported Feature: STA
513 *
514 * Usage: Internal/External
515 *
516 * </ioctl>
517 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800518#define WE_SET_TXPOW_5G 30
519/* Private ioctl for firmware debug log */
520#define WE_DBGLOG_LOG_LEVEL 31
521#define WE_DBGLOG_VAP_ENABLE 32
522#define WE_DBGLOG_VAP_DISABLE 33
523#define WE_DBGLOG_MODULE_ENABLE 34
524#define WE_DBGLOG_MODULE_DISABLE 35
525#define WE_DBGLOG_MOD_LOG_LEVEL 36
526#define WE_DBGLOG_TYPE 37
527#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530528/*
529 * <ioctl>
530 * set11ACRates - Fixes the Tx data rate of 11AC
531 *
532 * @INPUT: 0x1 to 0x9
533 *
534 * @OUTPUT: None
535 *
536 * This IOCTL fixes the Tx data rate of 11AC.
537 *
538 * @E.g: iwpriv wlan0 set11ACRates 0x9
539 *
540 * Supported Feature: STA
541 *
542 * Usage: Internal/External
543 *
544 * </ioctl>
545 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800546#define WE_SET_VHT_RATE 39
547#define WE_DBGLOG_REPORT_ENABLE 40
548#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530549/*
550 * <ioctl>
551 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
552 *
553 * @INPUT: Transmission power in dBm
554 *
555 * @OUTPUT: None
556 *
557 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
558 * This setting does not persist over reboots
559 *
560 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
561 *
562 * Supported Feature: STA
563 *
564 * Usage: Internal/External
565 *
566 * </ioctl>
567 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800568#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530569/*
570 * <ioctl>
571 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
572 *
573 * @INPUT: Transmission power in dBm
574 *
575 * @OUTPUT: None
576 *
577 * This IOCTL sets the maximum transmit power for the 5-GHz band
578 * This setting does not persist over reboots
579 *
580 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
581 *
582 * Supported Feature: STA
583 *
584 * Usage: Internal/External
585 *
586 * </ioctl>
587 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800588#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800589#define WE_SET_PKTLOG 44
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530590/* Private ioctl for packet power save */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800591#define WE_PPS_PAID_MATCH 45
592#define WE_PPS_GID_MATCH 46
593#define WE_PPS_EARLY_TIM_CLEAR 47
594#define WE_PPS_EARLY_DTIM_CLEAR 48
595#define WE_PPS_EOF_PAD_DELIM 49
596#define WE_PPS_MACADDR_MISMATCH 50
597#define WE_PPS_DELIM_CRC_FAIL 51
598#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530599/*
600 * <ioctl>
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530601 * rssi_chk - Check the rssi
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530602 *
603 * @INPUT: One argument as input
604 *
605 * @OUTPUT: rssi
606 * wlan0 rssi_chk:56
607 *
608 * This IOTCL used to chek rssi
609 *
610 * @E.g: iwpriv wlan0 rssi_chk <value>
611 *
612 * Supported Feature: STA
613 *
614 * Usage: Internal/External
615 *
616 * </ioctl>
617 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800618#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530619/*
620 * <ioctl>
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530621 * htsmps - Sets the htsmps
622 *
623 * @INPUT: Atleast one int argument
624 *
625 * @OUTPUT: None
626 *
627 * This IOTCL used to set htsmps
628 *
629 * @E.g: iwpriv wlan0 htsmps <value>
630 *
631 * Supported Feature: STA
632 *
633 * Usage: Internal/External
634 *
635 * </ioctl>
636 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800637#define WE_SET_HTSMPS 55
638/* Private ioctl for QPower */
639#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
640#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
641#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
642#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800643/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530644/*
645 * <ioctl>
646 * gtxHTMcs - Set the tx HTM value
647 *
648 * @INPUT: Atleast one int orgument
649 *
650 * @OUTPUT: None
651 *
652 * This IOTCL sets htm tx value
653 *
654 * @E.g: iwpriv wlan0 gtxHTMcs <value>
655 *
656 * Supported Feature: STA
657 *
658 * Usage: Internal/External
659 *
660 * </ioctl>
661 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800662#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530663/*
664 * <ioctl>
665 * gtxVHTMcs - Set gtxVHTMcs value
666 *
667 * @INPUT: Atleast one int argument
668 *
669 * @OUTPUT: None
670 *
671 * This IOTCL used to set gtxVHTMcs value
672 *
673 * @E.g: iwpriv wlan0 gtxVHTMcs <value>
674 *
675 * Supported Feature: STA
676 *
677 * Usage: Internal/External
678 *
679 * </ioctl>
680 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800681#define WE_SET_GTX_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530682/*
683 * <ioctl>
684 * gtxUsrCfg - Host request for GTX mask
685 *
686 * @INPUT: Atleast one int orgument
687 *
688 * @OUTPUT: None
689 *
690 * This IOTCL used send the host request for GTX mask
691 *
692 * @E.g: iwpriv wlan0 gtxUsrCfg <value>
693 *
694 * Supported Feature: STA
695 *
696 * Usage: Internal/External
697 *
698 * </ioctl>
699 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800700#define WE_SET_GTX_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530701/*
702 * <ioctl>
703 * gtxThre - Set the tx threshold
704 *
705 * @INPUT: Atleast one int argument
706 *
707 * @OUTPUT: None
708 *
709 * This IOTCL used to set tx threshold
710 *
711 * @E.g: iwpriv wlan0 gtxThre <value>
712 *
713 * Supported Feature: STA
714 *
715 * Usage: Internal/External
716 *
717 * </ioctl>
718 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800719#define WE_SET_GTX_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530720/*
721 * <ioctl>
722 * gtxMargin - Set the gtxMargin
723 *
724 * @INPUT: 1 to 32
725 *
726 * @OUTPUT: None
727 *
728 * This IOTCL use dto set gtxMargin
729 *
730 * @E.g: iwpriv wlan0 gtxMargini <value>
731 *
732 * Supported Feature: STA
733 *
734 * Usage: Internal/External
735 *
736 * </ioctl>
737 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800738#define WE_SET_GTX_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530739/*
740 * <ioctl>
741 * gtxStep - Set the gtxStep
742 *
743 * @INPUT: None
744 *
745 * @OUTPUT: None
746 *
747 * This IOTCL used to sets gtxStep
748 *
749 * @E.g: iwpriv wlan0 gtxStep <value>
750 *
751 * Supported Feature: STA
752 *
753 * Usage: Internal/External
754 *
755 * </ioctl>
756 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800757#define WE_SET_GTX_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530758/*
759 * <ioctl>
760 * gtxMinTpc - Sets the gtxMinTpc
761 *
762 * @INPUT: Atleast one int argument
763 *
764 * @OUTPUT: None
765 *
766 * This IOTCL sets the tx MinTpc
767 *
768 * @E.g: iwpriv wlan0 gtxMinTpc <value>
769 *
770 * Supported Feature: STA
771 *
772 * Usage: Internal/External
773 *
774 * </ioctl>
775 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800776#define WE_SET_GTX_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530777/*
778 * <ioctl>
779 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
780 *
781 * @INPUT: Mask value
782 *
783 * @OUTPUT: None
784 *
785 * This IOTCL used to set gtxBWMask
786 *
787 * @E.g: iwpriv wlan0 gtxBWMask <value>
788 *
789 * Supported Feature: STA
790 *
791 * Usage: Internal/External
792 *
793 * </ioctl>
794 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530795
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530796#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530797/*
798 * <ioctl>
799 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
800 *
801 * @INPUT: set_value
802 *
803 * @OUTPUT: None
804 *
805 * This IOCTL is used to set the MCC latency value in milliseconds
806 * during STA-P2P concurrency.
807 *
808 * If 0ms latency is provided, then FW will set to a default.
809 * Otherwise, latency must be at least 30ms.
810 *
811 * @E.g: iwpriv wlan0 setMccLatency 40
812 *
813 *
814 * Supported Feature: Concurrency
815 *
816 * Usage: Internal/External
817 *
818 * </ioctl>
819 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800820#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530821
822/*
823 * <ioctl>
824 * setMccQuota- Set the quota for P2P cases
825 *
826 * @INPUT: set_value [0,100]
827 *
828 * @OUTPUT: None
829 *
830 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
831 *
832 * Currently used to set time quota for 2 MCC vdevs/adapters using
833 * (operating channel, quota) for each mode.
834 * The info is provided run time using iwpriv command:
835 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
836 * Note: the quota provided in command is for the same mode in cmd.
837 * HDD checks if MCC mode is active, gets the second mode and its
838 * operating chan.
839 * Quota for the 2nd role is calculated as 100 - quota of first mode.
840 *
841 * @E.g: iwpriv wlan0 setMccQuota 50
842 * iwpriv p2p0 setMccQuota 50
843 *
844 * Supported Feature: Concurrency
845 *
846 * Usage: Internal/External
847 *
848 * </ioctl>
849 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800850#define WE_MCC_CONFIG_QUOTA 71
851/* Private IOCTL for debug connection issues */
852#define WE_SET_DEBUG_LOG 72
853#ifdef WE_SET_TX_POWER
854#undef WE_SET_TX_POWER
855#endif
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -0800856
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530857/*
858 * <ioctl>
859 * setTxPower - Set the current transmit power
860 *
861 * @INPUT: Transmission power in dBm
862 *
863 * @OUTPUT: None
864 *
865 * This IOCTL sets the current transmit power.
866 * This setting does not persist over reboots.
867 *
868 * @E.g: iwpriv wlan0 setTxPower 10
869 *
870 * Supported Feature: STA
871 *
872 * Usage: Internal/External
873 *
874 * </ioctl>
875 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800876#define WE_SET_TX_POWER 74
877/* Private ioctl for earlyrx power save feature */
878#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
879#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
880#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
881#define WE_SET_EARLY_RX_SLOP_STEP 78
882#define WE_SET_EARLY_RX_INIT_SLOP 79
883#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530884/*
885 * <ioctl>
886 * setMcRate - Set the data rate for multicast data
887 *
888 * @INPUT: 1 to 32
889 *
890 * @OUTPUT: None
891 *
892 * This IOCTL sets the data rate for multicast data. Note that this command
893 * is allowed only in STA, IBSS, or QCMobileAP mode
894 *
895 * @E.g: iwpriv wlan0 setMcRate <value>
896 *
897 * Supported Feature: STA
898 *
899 * Usage: Internal/External
900 *
901 * </ioctl>
902 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800903#define WE_SET_MC_RATE 81
904#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
905/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530906/*
907 * <ioctl>
908 * 5g_ebt - Sets the 5g_ebt
909 *
910 * @INPUT: <value>
911 *
912 * @OUTPUT: None
913 *
914 * This IOTCL used to set 5g_ebt
915 *
916 * @E.g: iwpriv wlan0 5g_ebt <value>
917 *
918 * Supported Feature: STA
919 *
920 * Usage: Internal/External
921 *
922 * </ioctl>
923 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800924#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530925/*
926 * <ioctl>
927 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
928 *
929 * @INPUT: 20 t0 160
930 *
931 * @OUTPUT: None
932 *
933 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
934 *
935 * @E.g: iwpriv wlan0 cts_cbw <value>
936 *
937 * Supported Feature: STA
938 *
939 * Usage: Internal/External
940 *
941 * </ioctl>
942 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800943#define WE_SET_CTS_CBW 84
944#define WE_DUMP_STATS 85
945#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +0530946/* Private sub ioctl for starting/stopping the profiling */
947#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +0530948
Abhishek Singh3c507012016-12-01 11:15:42 +0530949/*
950 * <ioctl>
951 * setChanChange - Initiate channel change
952 *
953 * @INPUT: channel number to switch to.
954 *
955 * @OUTPUT: None
956 *
957 * This IOCTL is used to initiate a channel change.
958 * If called on STA/CLI interface it will send the
959 * ECSA action frame to the connected SAP/GO asking to
960 * initiate the ECSA, if supported.
961 * If called on SAP/GO interface it will initiate
962 * ECSA and ask connected peers to move to new channel.
963 *
964 * @E.g: iwpriv wlan0 setChanChange <channel>
965 * iwpriv wlan0 setChanChange 1
966 *
967 * Supported Feature: ECSA
968 *
969 * Usage: Internal/External
970 *
971 * </ioctl>
972 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +0530973#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +0530974#define WE_SET_CONC_SYSTEM_PREF 89
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800975
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800976/*
977 * <ioctl>
978 * set_11ax_rate - set 11ax rates to FW
979 *
980 * @INPUT: rate code
981 *
982 * @OUTPUT: None
983 *
984 * This IOCTL fixes the Tx data rate of 11AX.
985 *
986 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
987 *
988 * Supported Feature: STA/SAP
989 *
990 * Usage: Internal
991 *
992 * </ioctl>
993 */
994#define WE_SET_11AX_RATE 91
995
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -0700996/*
997 * <ioctl>
998 * enable_dcm - enable Dual Carrier Modulation(DCM)
999 *
1000 * @INPUT: 0/1
1001 *
1002 * @OUTPUT: None
1003 *
1004 * This IOCTL enables/disables DCM.
1005 *
1006 * @E.g: iwpriv wlan0 enable_dcm <0/1>
1007 *
1008 * Supported Feature: STA/SAP
1009 *
1010 * Usage: Internal
1011 *
1012 * </ioctl>
1013 */
1014#define WE_SET_DCM 92
1015
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001016/*
1017 * <ioctl>
Naveen Rawat53448ea2017-11-27 11:43:18 -08001018 * range_ext - enable Range extension
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001019 *
1020 * @INPUT: 0/1
1021 *
1022 * @OUTPUT: None
1023 *
1024 * This IOCTL enables/disables Range extension.
1025 *
Naveen Rawat53448ea2017-11-27 11:43:18 -08001026 * @E.g: iwpriv wlan0 range_ext <1/0>
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001027 *
1028 * Supported Feature: STA/SAP
1029 *
1030 * Usage: Internal
1031 *
1032 * </ioctl>
1033 */
1034#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001035
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301036/*
1037 * <ioctl>
1038 * wow_ito - sets the timeout value for inactivity data while
1039 * in power save mode during wow
1040 *
1041 * @INPUT: int
1042 *
1043 * @OUTPUT: None
1044 *
1045 * This IOCTL set the timeout value for inactivity data in power save mode
1046 *
1047 * @E.g: iwpriv wlan0 wow_ito 20
1048 *
1049 * Supported Feature: STA
1050 *
1051 * Usage: External
1052 *
1053 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001054 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301055#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1056
Jeff Johnson011c4502017-10-05 15:25:56 -07001057/*
1058 * <ioctl>
1059 * pdev_reset - reset the pdev
1060 *
1061 * @INPUT: Reset command to initiate:
1062 * TX_FLUSH = 1
1063 * WARM_RESET = 2
1064 * COLD_RESET = 3
1065 * WARM_RESET_RESTORE_CAL = 4
1066 * COLD_RESET_RESTORE_CAL = 5
1067 *
1068 * @OUTPUT: None
1069 *
1070 * This IOCTL is used to reset the pdev. The primary use is
1071 * for internal testing. It is not expected that this will
1072 * be used on a production device.
1073 *
1074 * @E.g: iwpriv wlan0 pdev_reset <command>
1075 * iwpriv wlan0 pdev_reset 1
1076 *
1077 * Supported Feature: None
1078 *
1079 * Usage: Internal
1080 *
1081 * </ioctl>
1082 */
1083#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301084
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301085/*
1086 * setModDTIM - Change Modulated DTIM
1087 *
1088 * @INPUT: set_value.
1089 *
1090 * @OUTPUT: None
1091 *
1092 * This IOCTL is used to change modulated DTIM
1093 * value without WIFI OFF/ON.
1094 *
1095 * @E.g: iwpriv wlan0 setModDTIM <value>
1096 * iwpriv wlan0 setModDTIM 2
1097 *
1098 * Supported Feature: N/A
1099 *
1100 * Usage: Internal/External
1101 *
1102 * </ioctl>
1103 */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05301104#define WE_SET_MODULATED_DTIM 96
1105
1106#ifdef WLAN_FEATURE_MOTION_DETECTION
1107#define WE_MOTION_DET_START_STOP 97
1108#define WE_MOTION_DET_BASE_LINE_START_STOP 98
1109#endif /* WLAN_FEATURE_MOTION_DETECTION */
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301110
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001111/* Private ioctls and their sub-ioctls */
1112#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1113#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001114#define WE_GET_WLAN_DBG 4
1115#define WE_GET_MAX_ASSOC 6
1116/* 7 is unused */
1117#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301118
1119/*
1120 * <ioctl>
1121 * getconcurrency - Get concurrency mode
1122 *
1123 * @INPUT: None
1124 *
1125 * @OUTPUT: It shows concurrency value
1126 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1127 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1128 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1129 *
1130 * This IOCTL is used to retrieve concurrency mode.
1131 *
1132 * @E.g: iwpriv wlan0 getconcurrency
1133 * wlan0 getconcurrency:5
1134 * Above value shows STA+P2P_Client
1135 *
1136 * Supported Feature: Concurrency
1137 *
1138 * Usage: Internal/External
1139 *
1140 * </ioctl>
1141 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001142#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301143/*
1144 * <ioctl>
1145 * get_nss - Get the number of spatial STBC streams (NSS)
1146 *
1147 * @INPUT: None
1148 *
1149 * @OUTPUT: NSS
1150 * wlan0 get_nss:2
1151 *
1152 * This IOTCL used to get the number of spatial STBC streams
1153 *
1154 * @E.g: iwpriv wlan0 get_nss
1155 *
1156 * Supported Feature: STA
1157 *
1158 * Usage: Internal/External
1159 *
1160 * </ioctl>
1161 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001162#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301163/*
1164 * <ioctl>
1165 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1166 *
1167 * @INPUT: None
1168 *
1169 * @OUTPUT: ldpc
1170 * wlan0 get_ldpc:1
1171 *
1172 * This IOTCL used to gets the low density parity check (LDPC)
1173 *
1174 * @E.g: iwpriv wlan0 get_ldpc
1175 *
1176 * Supported Feature: STA
1177 *
1178 * Usage: Internal/External
1179 *
1180 * </ioctl>
1181 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001182#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301183/*
1184 * <ioctl>
1185 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1186 *
1187 * @INPUT: None
1188 *
1189 * @OUTPUT: TXSTBC
1190 * wlan0 get_tx_stbc:1
1191 *
1192 * This IOTCL get the value of the current Tx space time block code (STBC)
1193 *
1194 * @E.g: iwpriv wlan0 get_tx_stbc
1195 *
1196 * Supported Feature: STA
1197 *
1198 * Usage: Internal/External
1199 *
1200 * </ioctl>
1201 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001202#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301203/*
1204 * <ioctl>
1205 * get_rx_stbc - Gets the value of the current Rx STBC
1206 *
1207 * @INPUT: None
1208 *
1209 * @OUTPUT: Rx STBC
1210 * wlan0 get_rx_stbc:1
1211 *
1212 * This IOTCL used to get the value of the current Rx STBC
1213 *
1214 * @E.g: iwpriv wlan0 get_rx_stbc
1215 *
1216 * Supported Feature: STA
1217 *
1218 * Usage: Internal/External
1219 *
1220 * </ioctl>
1221 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001222#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301223/*
1224 * <ioctl>
1225 * get_shortgi - Get the value of the current short GI setting
1226 *
1227 * @INPUT: None
1228 *
1229 * @OUTPUT: Enable/disable of shortgi
1230 * wlan0 get_shortgi:1
1231 *
1232 * This IOCTL gets the value of the current short GI setting
1233 *
1234 * @E.g: iwpriv wlan0 get_shortgi
1235 *
1236 * Supported Feature: STA
1237 *
1238 * Usage: Internal/External
1239 *
1240 * </ioctl>
1241 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001242#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301243/*
1244 * <ioctl>
1245 * get_rtscts - Get the value of the current RTS/CTS setting.
1246 *
1247 * @INPUT: None
1248 *
1249 * @OUTPUT: Enable/disable of RTS/CTS
1250 * wlan0 get_rtscts:33
1251 *
1252 * This IOTCL get the value of the current RTS/CTS setting.
1253 *
1254 * @E.g: iwpriv wlan0 get_rtscts
1255 *
1256 * Supported Feature: STA
1257 *
1258 * Usage: Internal/External
1259 *
1260 * </ioctl>
1261 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001262#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301263/*
1264 * <ioctl>
1265 * get_chwidth - Get the current channel width setting
1266 *
1267 * @INPUT: None
1268 *
1269 * @OUTPUT: channel width
1270 * wlan0 get_chwidth:0
1271 *
1272 * This IOTCL get the current channel width setting.
1273 *
1274 * @E.g: iwpriv wlan0 get_chwidth
1275 *
1276 * Supported Feature: STA
1277 *
1278 * Usage: Internal/External
1279 *
1280 * </ioctl>
1281 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001282#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301283/*
1284 * <ioctl>
1285 * get_anienable - Get the anienable
1286 *
1287 * @INPUT: None
1288 *
1289 * @OUTPUT:
1290 * wlan0 get_anienable:0
1291 *
1292 * This IOTCL get the anienable
1293 *
1294 * @E.g: iwpriv wlan0 get_anienable
1295 *
1296 * Supported Feature: STA
1297 *
1298 * Usage: Internal/External
1299 *
1300 * </ioctl>
1301 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001302#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301303/*
1304 * <ioctl>
1305 * get_aniplen - Get the aniplen
1306 *
1307 * @INPUT: None
1308 *
1309 * @OUTPUT:
1310 * wlan0 get_aniplen:0
1311 *
1312 * This IOTCL get the aniplen
1313 *
1314 * @E.g: iwpriv wlan0 get_aniplen
1315 *
1316 * Supported Feature: STA
1317 *
1318 * Usage: Internal/External
1319 *
1320 * </ioctl>
1321 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001322#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301323/*
1324 * <ioctl>
1325 * get_anilislen- Get the anilislen
1326 *
1327 * @INPUT: None
1328 *
1329 * @OUTPUT:
1330 * wlan0 get_anilislen:0
1331 *
1332 * This IOTCL used to get anilislen
1333 *
1334 * @E.g: iwpriv wlan0 get_anilislen
1335 *
1336 * Supported Feature: STA
1337 *
1338 * Usage: Internal/External
1339 *
1340 * </ioctl>
1341 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001342#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301343/*
1344 * <ioctl>
1345 * get_aniofdmlvl - Get the OFDM level
1346 *
1347 * @INPUT: None
1348 *
1349 * @OUTPUT: OFDM
1350 * wlan0 get_aniofdmlvl:0
1351 *
1352 * This IOTCL used to get ofdm level
1353 *
1354 * @E.g: iwpriv wlan0 get_aniofdmlvl
1355 *
1356 * Supported Feature: STA
1357 *
1358 * Usage: Internal/External
1359 *
1360 * </ioctl>
1361 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001362#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301363/*
1364 * <ioctl>
1365 * get_aniccklvl - Get the cck level
1366 *
1367 * @INPUT: None
1368 *
1369 * @OUTPUT:
1370 * wlan0 get_aniccklvl:0
1371 *
1372 * This IOTCL used to get cck level
1373 *
1374 * @E.g: iwpriv wlan0 get_aniccklvl
1375 *
1376 * Supported Feature: STA
1377 *
1378 * Usage: Internal/External
1379 *
1380 * </ioctl>
1381 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001382#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301383/*
1384 * <ioctl>
1385 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1386 *
1387 * @INPUT: None
1388 *
1389 * @OUTPUT: Enable/disable dynamic channel bandwidth
1390 * wlan0 get_cwmenable:0
1391 *
1392 * This IOTCL get the value of the dynamic channel bandwidth setting
1393 *
1394 * @E.g: iwpriv wlan0 get_cwmenable
1395 *
1396 * Supported Feature: STA
1397 *
1398 * Usage: Internal/External
1399 *
1400 * </ioctl>
1401 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001402#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301403/*
1404 * <ioctl>
1405 * get_txchainmask - Get the txchainmask that was set
1406 *
1407 * @INPUT: None
1408 *
1409 * @OUTPUT: txchainmask
1410 * wlan0 get_txchainmask:1
1411 *
1412 * This IOCTL gets the txchainmask that was set
1413 * This command is useful if it was previously set
1414 *
1415 * @E.g: iwpriv wlan0 get_txchainmask
1416 *
1417 * Supported Feature: STA
1418 *
1419 * Usage: Internal/External
1420 *
1421 * </ioctl>
1422 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001423#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301424/*
1425 * <ioctl>
1426 * get_rxchainmask - Get the rxchainmask that was set
1427 *
1428 * @INPUT: None
1429 *
1430 * @OUTPUT: rxchainmask
1431 * wlan0 get_rxchainmask:1
1432 *
1433 * This IOCTL gets the rxchainmask that was set
1434 * This command is useful only if it was previously set.
1435 *
1436 * @E.g: iwpriv wlan0 get_rxchainmask
1437 *
1438 * Supported Feature: STA
1439 *
1440 * Usage: Internal/External
1441 *
1442 * </ioctl>
1443 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001444#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301445/*
1446 * <ioctl>
1447 * get_11nrate - Get the fixed Tx data rate
1448 *
1449 * @INPUT: None
1450 *
1451 * @OUTPUT: Using this command does not return the same value as set
1452 * wlan0 get_11nrate:0
1453 *
1454 * This IOCTL gets the fixed Tx data rate
1455 * This command is useful only if setting the fixed Tx rate.
1456 *
1457 * @E.g: iwpriv wlan0 get_11nrate
1458 *
1459 * Supported Feature: STA
1460 *
1461 * Usage: Internal/External
1462 *
1463 * </ioctl>
1464 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001465#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301466/*
1467 * <ioctl>
1468 * get_ampdu - Get the maximum subframe of ampdu
1469 *
1470 * @INPUT: None
1471 *
1472 * @OUTPUT: Maximum subframe of ampdu
1473 * wlan0 get_ampdu:1
1474 *
1475 * This IOCTL gets the maximum subframe of ampdu
1476 * This command is useful only if setting ampdu.
1477 *
1478 * @E.g: iwpriv wlan0 get_ampdu
1479 *
1480 * Supported Feature: STA
1481 *
1482 * Usage: Internal/External
1483 *
1484 * </ioctl>
1485 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001486#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301487/*
1488 * <ioctl>
1489 * get_amsdu - Get the maximum subframe of amsdu
1490 *
1491 * @INPUT: None
1492 *
1493 * @OUTPUT: Maximum subframe of amsdu
1494 * wlan0 get_amsdu:1
1495 *
1496 * This IOCTL gets the maximum subframe of amsdu.
1497 * This command is useful only if setting amsdu
1498 *
1499 * @E.g: iwpriv wlan0 get_amsdu
1500 *
1501 * Supported Feature: STA
1502 *
1503 * Usage: Internal/External
1504 *
1505 * </ioctl>
1506 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001507#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301508/*
1509 * <ioctl>
1510 * get_txpow2g - Get the current 2 GHz Tx power setting
1511 *
1512 * @INPUT: None
1513 *
1514 * @OUTPUT: Tx Power in dbm
1515 * wlan0 get_txpow2g:0
1516 *
1517 * This IOCTL gets the current 2 GHz Tx power setting
1518 * This command is useful if setting Tx power
1519 *
1520 * @E.g: iwpriv wlan0 get_txpow2g
1521 *
1522 * Supported Feature: STA
1523 *
1524 * Usage: Internal/External
1525 *
1526 * </ioctl>
1527 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001528#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301529/*
1530 * <ioctl>
1531 * get_txpow5g - Get the current 5 GHz Tx power setting
1532 *
1533 * @INPUT: None
1534 *
1535 * @OUTPUT: Tx Power in dbm
1536 * wlan0 get_txpow5g:0
1537 *
1538 * This IOCTL gets the current 5 GHz Tx power setting
1539 * This command is useful if setting Tx power
1540 *
1541 * @E.g: iwpriv wlan0 get_txpow5g
1542 *
1543 * Supported Feature: STA
1544 *
1545 * Usage: Internal/External
1546 *
1547 * </ioctl>
1548 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001549#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001550/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001551#define WE_GET_PPS_PAID_MATCH 32
1552#define WE_GET_PPS_GID_MATCH 33
1553#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1554#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1555#define WE_GET_PPS_EOF_PAD_DELIM 36
1556#define WE_GET_PPS_MACADDR_MISMATCH 37
1557#define WE_GET_PPS_DELIM_CRC_FAIL 38
1558#define WE_GET_PPS_GID_NSTS_ZERO 39
1559#define WE_GET_PPS_RSSI_CHECK 40
1560/* Private ioctl for QPower */
1561#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1562#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1563#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1564#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001565/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301566/*
1567 * <ioctl>
1568 * get_gtxHTMcs - Get the tx HTM
1569 *
1570 * @INPUT: None
1571 *
1572 * @OUTPUT: HTM
1573 * wlan0 get_gtxHTMcs:32896
1574 *
1575 * This IOTCL used to get HTM
1576 *
1577 * @E.g: iwpriv wlan0 get_gtxHTMcs
1578 *
1579 * Supported Feature: STA
1580 *
1581 * Usage: Internal/External
1582 *
1583 * </ioctl>
1584 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001585#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301586/*
1587 * <ioctl>
1588 * get_gtxVHTMcs - Get the VHTM
1589 *
1590 * @INPUT: None
1591 *
1592 * @OUTPUT: VHTM
1593 * wlan0 get_gtxVHTMcs:524800
1594 *
1595 * This IOTCL used to get the VHTM
1596 *
1597 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1598 *
1599 * Supported Feature: STA
1600 *
1601 * Usage: Internal/External
1602 *
1603 * </ioctl>
1604 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001605#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301606/*
1607 * <ioctl>
1608 * get_gtxUsrCfg - Get the tx cfg
1609 *
1610 * @INPUT: None
1611 *
1612 * @OUTPUT: TXCFG
1613 * wlan0 get_gtxUsrCfg:32
1614 *
1615 * This IOTCL used to get the tx cfg
1616 *
1617 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1618 *
1619 * Supported Feature: STA
1620 *
1621 * Usage: Internal/External
1622 *
1623 * </ioctl>
1624 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001625#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301626/*
1627 * <ioctl>
1628 * get_gtxThre - Get the tx threshold
1629 *
1630 * @INPUT: None
1631 *
1632 * @OUTPUT: Threshold
1633 * wlan0 get_gtxThre:3
1634 *
1635 * This IOCTL is used to get tx threshold
1636 *
1637 * @E.g: iwpriv wlan0 get_gtxThre
1638 *
1639 * Supported Feature: STA
1640 *
1641 * Usage: Internal/External
1642 *
1643 * </ioctl>
1644 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001645#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301646/*
1647 * <ioctl>
1648 * get_gtxMargin - Get the tx margin
1649 *
1650 * @INPUT: None
1651 *
1652 * @OUTPUT: GTXMARGIN
1653 * wlan0 get_gtxMargin:2
1654 *
1655 * This IOCTL is used to set tx margin
1656 *
1657 * @E.g: iwpriv wlan0 get_gtxMargin
1658 *
1659 * Supported Feature: STA
1660 *
1661 * Usage: Internal/External
1662 *
1663 * </ioctl>
1664 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001665#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301666/*
1667 * <ioctl>
1668 * get_gtxStep - Get the tx step
1669 *
1670 * @INPUT: None
1671 *
1672 * @OUTPUT: GTXSTEP
1673 * wlan0 get_gtxStep:0
1674 *
1675 * This IOCTL is used to get the gtx step
1676 *
1677 * @E.g: iwpriv wlan0 get_gtxStep
1678 *
1679 * Supported Feature: STA
1680 *
1681 * Usage: Internal/External
1682 *
1683 * </ioctl>
1684 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001685#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301686/*
1687 * <ioctl>
1688 * get_gtxMinTpc - Get the tx miminum tpc
1689 *
1690 * @INPUT: None
1691 *
1692 * @OUTPUT: TPC
1693 * wlan0 get_gtxMinTpc:0
1694 *
1695 * This IOCTL is used to get tx miminum tpc
1696 *
1697 * @E.g: iwpriv wlan0 get_gtxMinTpc
1698 *
1699 * Supported Feature: STA
1700 *
1701 * Usage: Internal/External
1702 *
1703 * </ioctl>
1704 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001705#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301706/*
1707 * <ioctl>
1708 * get_gtxBWMask - Get the tx BW MASK
1709 *
1710 * @INPUT: None
1711 *
1712 * @OUTPUT: MASK
1713 * wlan0 get_gtxBWMask:15
1714 *
1715 * This IOCTL is used get gtx bw mask
1716 *
1717 * @E.g: iwpriv wlan0 get_gtxBWMask
1718 *
1719 * Supported Feature: STA
1720 *
1721 * Usage: Internal/External
1722 *
1723 * </ioctl>
1724 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001725#define WE_GET_GTX_BWMASK 54
1726#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001727#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001728#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001729
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001730/*
1731 * <ioctl>
1732 * get_dcm - Get dcm enablement value
1733 *
1734 * @INPUT: None
1735 *
1736 * @OUTPUT: 0/1
1737 * wlan0 get_dcm
1738 *
1739 * This IOCTL is used get dcm value
1740 *
1741 * Supported Feature: STA/SAP
1742 *
1743 * Usage: Internal
1744 *
1745 * </ioctl>
1746 */
1747#define WE_GET_DCM 60
1748
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001749/*
1750 * <ioctl>
1751 * get_dcm - Get range extension enablement value
1752 *
1753 * @INPUT: None
1754 *
1755 * @OUTPUT: 0/1
1756 * wlan0 get_range_ext
1757 *
1758 * This IOCTL is used get range_extension value
1759 *
1760 * Supported Feature: STA/SAP
1761 *
1762 * Usage: Internal
1763 *
1764 * </ioctl>
1765 */
1766#define WE_GET_RANGE_EXT 61
1767
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001768/* Private ioctls and their sub-ioctls */
1769#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1770
1771/* Private ioctls and their sub-ioctls */
1772#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1773#define WE_WOWL_ADD_PTRN 1
1774#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301775/*
1776 * <ioctl>
1777 * neighbor - Send neighbor report request
1778 *
1779 * @INPUT: string
1780 *
1781 * @OUTPUT: None
1782 *
1783 * This IOCTL create a Neighbor report request and send it to peer
1784 *
1785 * @E.g: iwpriv wlan0 neighbor "SSID"
1786 *
1787 * Supported Feature: 11k
1788 *
1789 * Usage: Internal/External
1790 *
1791 * </ioctl>
1792 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001793#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301794/*
1795 * <ioctl>
1796 * set_ap_wps_ie - Set the P2P IE of the probe response
1797 *
1798 * @INPUT: string
1799 *
1800 * @OUTPUT: None
1801 *
1802 * This IOCTL sets the P2P IE of the probe response
1803 *
1804 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1805 *
1806 * Supported Feature: STA
1807 *
1808 * Usage: Internal/External
1809 *
1810 * </ioctl>
1811 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001812#define WE_SET_AP_WPS_IE 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001813#define WE_SET_CONFIG 5
1814
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07001815/*
1816 * <ioctl>
1817 * unit_test - execute component-level unit tests
1818 *
1819 * @INPUT: string - the name of the component to test.
1820 * All tests are executed if unspecified
1821 * @OUTPUT: None
1822 *
1823 * Usage: Internal only
1824 * </ioctl>
1825 */
1826#define WE_UNIT_TEST 6
1827
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001828/* Private ioctls and their sub-ioctls */
1829#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1830#define WE_SET_WLAN_DBG 1
1831#define WE_SET_DP_TRACE 2
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301832#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001833
1834/* Private ioctls and their sub-ioctls */
1835#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1836#define WE_WLAN_VERSION 1
1837#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301838/*
1839 * <ioctl>
1840 * getConfig - gets the values of all configurations listed in WCNSS
1841 *
1842 * @INPUT: None
1843 *
1844 * @OUTPUT: Current configuration to the sys log
1845 * wlan0 getConfig: WLAN configuration written to system log
1846 *
1847 * This IOCTL gets the values of all configurations listed in WCNSS
1848 *
1849 * @E.g: iwpriv wlan0 getConfig
1850 *
1851 * Supported Feature: STA
1852 *
1853 * Usage: Internal/External
1854 *
1855 * </ioctl>
1856 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001857#define WE_GET_CFG 3
1858#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301859/*
1860 * <ioctl>
1861 * getChannelList - Get the available channel list while in QCMobileAP
1862 *
1863 * @INPUT: None
1864 *
1865 * @OUTPUT: Channel list
1866 * wlan0 getChannelList:36 US 1..165
1867 *
1868 * This IOCTL gets the available channel list while in QCMobileAP
1869 *
1870 * @E.g: iwpriv wlan0 getChannelList
1871 *
1872 * Supported Feature: STA
1873 *
1874 * Usage: Internal/External
1875 *
1876 * </ioctl>
1877 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001878#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301879/*
1880 * <ioctl>
1881 * getRSSI - Get the Received Signal Strength Indicator
1882 *
1883 * @INPUT: None
1884 *
1885 * @OUTPUT: RSSI
1886 * wlan0 getRSSI:rsssi=-32
1887 *
1888 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1889 *
1890 * @E.g: iwpriv wlan0 getRSSI
1891 *
1892 * Supported Feature: STA
1893 *
1894 * Usage: Internal/External
1895 *
1896 * </ioctl>
1897 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001898#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001899
1900/*
1901 * <ioctl>
1902 * getSuspendStats - Get suspend/resume stats
1903 *
1904 * @INPUT: None
1905 *
1906 * @OUTPUT: character string containing formatted suspend/resume stats
1907 *
1908 * This ioctl is used to get suspend/resume stats formatted for display.
1909 * Currently it includes suspend/resume counts, wow wake up reasons, and
1910 * suspend fail reasons.
1911 *
1912 * @E.g: iwpriv wlan0 getSuspendStats
1913 * iwpriv wlan0 getSuspendStats
1914 *
1915 * Supported Feature: suspend/resume
1916 *
1917 * Usage: Internal
1918 *
1919 * </ioctl>
1920 */
1921#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001922#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05301923/*
1924 * <ioctl>
1925 * getTdlsPeers - Get all TDLS peers.
1926 *
1927 * @INPUT: None
1928 *
1929 * @OUTPUT: Returns the MAC address of all the TDLS peers
1930 * wlan0 getTdlsPeers:
1931 * MAC Id cap up RSSI
1932 * ---------------------------------
1933 * 00:0a:f5:0e:bd:18 2 Y Y -44
1934 * 00:0a:f5:bf:0e:12 0 N N 0
1935 *
1936 * This IOCTL is used to get all TDLS peers.
1937 *
1938 * @E.g: iwpriv wlan0 getTdlsPeers
1939 *
1940 * Supported Feature: TDLS
1941 *
1942 * Usage: Internal/External
1943 *
1944 * </ioctl>
1945 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001946#define WE_GET_TDLS_PEERS 8
1947#endif
1948#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05301949/*
1950 * <ioctl>
1951 * getPMFInfo - get the PMF info of the connected session
1952 *
1953 * @INPUT: None
1954 *
1955 * @OUTPUT:
1956 * wlan0 getPMFInfo:
1957 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
1958 * Number of Unprotected Disassocs 0
1959 * Number of Unprotected Deauths 0
1960 *
1961 * This IOCTL is used to get the PMF stats/status of the current
1962 * connection.
1963 *
1964 * @e.g:iwpriv wlan0 getPMFInfo
1965 *
1966 * Supported Feature: PMF
1967 *
1968 * Usage: Internal/External
1969 *
1970 * </ioctl>
1971 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001972#define WE_GET_11W_INFO 9
1973#endif
1974#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05301975/*
1976 * <ioctl>
1977 * getIbssSTAs - get ibss sta info
1978 *
1979 * @INPUT: None
1980 *
1981 * @OUTPUT: Give the MAC of the IBSS STA
1982 * wlan0 getIbssSTAs:
1983 * 1 .8c:fd:f0:01:9c:bf
1984 *
1985 * This IOCTL is used to get ibss sta info
1986 *
1987 * @E.g: iwpriv wlan0 getIbssSTAs
1988 *
1989 * Supported Feature: IBSS
1990 *
1991 * Usage: Internal/External
1992 *
1993 * </ioctl>
1994 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001995#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301996/*
1997 * <ioctl>
1998 * getphymode - Get the current phymode.
1999 *
2000 * @INPUT: None
2001 *
2002 * @OUTPUT: In phymode
2003 * wlan0 getphymode:AUTO MODE
2004 *
2005 * This IOCTL used to gets the current phymode.
2006 *
2007 * @E.g: iwpriv wlan0 getphymode
2008 *
2009 * Supported Feature: STA
2010 *
2011 * Usage: Internal/External
2012 *
2013 * </ioctl>
2014 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002015#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002016
2017/*
2018 * <ioctl>
2019 * getOemDataCap - Get the oem data caps.
2020 *
2021 * @INPUT: None
2022 *
2023 * @OUTPUT: oem data capability
2024 *
2025 * This IOCTL used to gets the current oem data cap.
2026 *
2027 * @E.g: iwpriv wlan0 getOemDataCap
2028 *
2029 * Usage: Internal/External
2030 *
2031 * </ioctl>
2032 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002033#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002034
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302035/*
2036 * <ioctl>
2037 * getSNR - Enable SNR Monitoring
2038 *
2039 * @INPUT: None
2040 *
2041 * @OUTPUT: Signal strength/ratio
2042 * wlan0 getSNR:1
2043 *
2044 * This IOCTL is used to get ibss sta info
2045 *
2046 * @E.g: iwpriv wlan0 getSNR
2047 *
2048 * Supported Feature: STA
2049 *
2050 * Usage: Internal/External
2051 *
2052 * </ioctl>
2053 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002054
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002055#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302056#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002057
Krunal Soni6c3859f2018-06-01 19:57:40 -07002058/*
2059 * <ioctl>
2060 *
2061 * get_ba_timeout - to get timeout for each AC
2062 *
2063 * @INPUT: None
2064 *
2065 * @OUTPUT: displays timeout value for each access class
2066 *
2067 * @E.g.: iwpriv wlan0 get_ba_timeout
2068 *
2069 * Usage: Internal
2070 *
2071 * </ioctl>
2072 */
2073#define WE_GET_BA_AGEING_TIMEOUT 16
2074
Krunal Soni5e483782018-10-25 15:42:44 -07002075/*
2076 * <ioctl>
2077 *
2078 * sta_cxn_info - STA connection information
2079 *
2080 * @INPUT: none
2081 *
2082 * @OUTPUT: STA's connection information
2083 *
2084 * This IOCTL is used to get connection's information.
2085 *
2086 * @E.g: iwpriv wlan0 get_cxn_info
2087 *
2088 * Usage: Internal
2089 *
2090 * </ioctl>
2091 */
2092#define WE_GET_STA_CXN_INFO 17
2093
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002094/* Private ioctls and their sub-ioctls */
2095#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302096
2097/*
2098 * <ioctl>
2099 * reassoc - Trigger STA re-association to the connected AP
2100 *
2101 * @INPUT: None
2102 *
2103 * @OUTPUT: None
2104 *
2105 * This IOCTL is used to trigger STA reassociation to the connected AP.
2106 *
2107 * @E.g: iwpriv wlan0 reassoc
2108 *
2109 * Supported Feature: Roaming
2110 *
2111 * Usage: Internal
2112 *
2113 * </ioctl>
2114 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002115#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302116/*
2117 * <ioctl>
2118 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2119 *
2120 * @INPUT: None
2121 *
2122 * @OUTPUT: print ibss peer in info logs
2123 * pPeerInfo->numIBSSPeers = 1
2124 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2125 *
2126 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2127 * in info logs
2128 *
2129 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2130 *
2131 * Supported Feature: IBSS
2132 *
2133 * Usage: Internal/External
2134 *
2135 * </ioctl>
2136 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002137#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002138/* Sub ioctls 11 to 16 are not used */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002139#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302140/*
2141 * <ioctl>
2142 * stop_obss_scan - Stop obss scan
2143 *
2144 * @INPUT: None
2145 *
2146 * @OUTPUT: None
2147 *
2148 * This IOCTL is used to stop obss scan
2149 *
2150 * @E.g: iwpriv wlan0 stop_obss_scan
2151 *
2152 * Supported Feature: Scan
2153 *
2154 * Usage: Internal/External
2155 *
2156 * </ioctl>
2157 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002158#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002159
2160/* Private ioctls and their sub-ioctls */
2161#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2162
2163#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302164/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002165
Manjeet Singhf82ed072016-07-08 11:40:00 +05302166#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002167
Kabilan Kannan6894e6a2017-11-09 14:37:55 -08002168/* subcommand 5 is unused */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302169
Abhishek Singh49b654e2016-12-01 16:11:17 +05302170/*
2171 * <ioctl>
2172 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2173 *
2174 * @INPUT: staid
2175 *
2176 * @OUTPUT: print ibss peer corresponding to staid in info logs
2177 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2178 *
2179 * This IOCTL is used to print the specific ibss peers's MAC,
2180 * rate and RSSI in info logs
2181 *
2182 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2183 * iwpriv wlan0 ibssPeerInfo 0
2184 *
2185 * Supported Feature: IBSS
2186 *
2187 * Usage: Internal/External
2188 *
2189 * </ioctl>
2190 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002191#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002192#define WE_UNIT_TEST_CMD 7
2193
2194#define WE_MTRACE_DUMP_CMD 8
2195#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2196
2197
2198#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2199#define WE_LED_FLASHING_PARAM 10
2200#endif
2201
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302202/*
2203 * <ioctl>
2204 * pm_clist - Increments the index value of the concurrent connection list
2205 * and update with the input parameters provided.
2206 *
2207 * @INPUT: Following 8 arguments:
2208 * @vdev_id: vdev id
2209 * @tx_streams: TX streams
2210 * @rx_streams: RX streams
2211 * @chain_mask: Chain mask
2212 * @type: vdev_type
2213 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2214 * @sub_type: vdev_subtype
2215 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2216 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2217 * @channel: Channel
2218 * @mac: Mac id
2219 *
2220 * @OUTPUT: None
2221 *
2222 * This IOCTL is used to increments the index value of the concurrent connection
2223 * list and update with the input parameters provided.
2224 *
2225 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2226 * sub_type channel mac
2227 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2228 *
2229 * Supported Feature: DBS
2230 *
2231 * Usage: Internal/External
2232 *
2233 * </ioctl>
2234 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002235#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302236
2237/*
2238 * <ioctl>
2239 * pm_dlist - Delete the index from the concurrent connection list that is
2240 * present in the given vdev_id.
2241 *
2242 * @INPUT: delete_all, vdev_id
2243 * @delete_all: delete all indices
2244 * @vdev_id: vdev id
2245 *
2246 * @OUTPUT: None
2247 *
2248 * This IOCTL is used to delete the index from the concurrent connection list
2249 * that is present in the given vdev_id.
2250 *
2251 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2252 * iwpriv wlan0 pm_dlist 0 1
2253 *
2254 * Supported Feature: DBS
2255 *
2256 * Usage: Internal/External
2257 *
2258 * </ioctl>
2259 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002260#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302261
2262/*
2263 * <ioctl>
2264 * pm_dbs - Set dbs capability and system preference
2265 *
2266 * @INPUT: dbs, system_pref
2267 * @dbs: Value of DBS capability to be set
2268 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002269 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302270 *
2271 * @OUTPUT: None
2272 *
2273 * This IOCTL is used to set dbs capability and system preference.
2274 *
2275 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2276 * iwpriv wlan0 pm_dbs 1 0
2277 *
2278 * Supported Feature: DBS
2279 *
2280 * Usage: Internal/External
2281 *
2282 * </ioctl>
2283 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002284#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302285
2286/*
2287 * <ioctl>
2288 * pm_pcl - Set pcl for concurrency mode.
2289 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002290 * @INPUT: policy_mgr_con_mode
2291 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302292 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2293 *
2294 * @OUTPUT: None
2295 *
2296 * This IOCTL is used to set pcl for concurrency mode.
2297 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002298 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302299 * iwpriv wlan0 pm_pcl 0
2300 *
2301 * Supported Feature: DBS
2302 *
2303 * Usage: Internal/External
2304 *
2305 * </ioctl>
2306 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002307#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302308
2309/*
2310 * <ioctl>
2311 * pm_cinfo - Shows the concurrent connection list.
2312 *
2313 * @INPUT: None
2314 *
2315 * @OUTPUT: None
2316 *
2317 * This IOCTL is used to show the concurrent connection list.
2318 *
2319 * @E.g: iwpriv wlan0 pm_cinfo
2320 *
2321 * Supported Feature: DBS
2322 *
2323 * Usage: Internal/External
2324 *
2325 * </ioctl>
2326 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002327#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302328
2329/*
2330 * <ioctl>
2331 * pm_ulist - Updates the index value of the concurrent connection list
2332 * with the input parameters provided.
2333 *
2334 * @INPUT: Following 8 arguments:
2335 * @vdev_id: vdev id
2336 * @tx_streams: TX streams
2337 * @rx_streams: RX streams
2338 * @chain_mask: Chain mask
2339 * @type: vdev_type
2340 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2341 * @sub_type: vdev_subtype
2342 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2343 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2344 * @channel: Channel
2345 * @mac: Mac id
2346 *
2347 * @OUTPUT: None
2348 *
2349 * This IOCTL is used to updates the index value of the concurrent
2350 * connection list with the input parameters provided.
2351 *
2352 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2353 * sub_type channel mac
2354 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2355 *
2356 * Supported Feature: DBS
2357 *
2358 * Usage: Internal/External
2359 *
2360 * </ioctl>
2361 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002362#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302363
2364/*
2365 * <ioctl>
2366 * pm_query_action - Initiate actions needed on current connections as
2367 * per the channel provided.
2368 *
2369 * @INPUT: channel
2370 * @channel: Channel on which new connection will be.
2371 *
2372 * @OUTPUT: None
2373 *
2374 * This IOCTL is used to initiate actions needed on current connections
2375 * as per the channel provided.
2376 *
2377 * @E.g: iwpriv wlan0 pm_query_action channel
2378 * iwpriv wlan0 pm_query_action 6
2379 *
2380 * Supported Feature: DBS
2381 *
2382 * Usage: Internal/External
2383 *
2384 * </ioctl>
2385 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002386#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302387
2388/*
2389 * <ioctl>
2390 * pm_query_allow - Checks for allowed concurrency combination
2391 *
2392 * @INPUT: mode, channel, bandwidth
2393 * @mode: new connection mode
2394 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2395 * @channel: channel on which new connection is coming up
2396 * @bandwidth: Bandwidth requested by the connection
2397 * 0:None 1:5MHz 2:10MHz 3:20MHz
2398 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2399 *
2400 * @OUTPUT: None
2401 *
2402 * This IOCTL is used to checks for allowed concurrency combination.
2403 *
2404 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2405 * iwpriv wlan0 pm_query_allow 0 6 4
2406 *
2407 * Supported Feature: DBS
2408 *
2409 * Usage: Internal/External
2410 *
2411 * </ioctl>
2412 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002413#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302414
2415/*
2416 * <ioctl>
2417 * pm_run_scenario - Create scenario with number of connections provided.
2418 *
2419 * @INPUT: num_of_conn
2420 * @num_of_conn: the number of connections (values: 1~3)
2421 *
2422 * @OUTPUT: None
2423 *
2424 * This IOCTL is used to create scenario with the number of connections
2425 * provided.
2426 *
2427 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2428 * iwpriv wlan0 pm_run_scenario 1
2429 *
2430 * Supported Feature: DBS
2431 *
2432 * Usage: Internal/External
2433 *
2434 * </ioctl>
2435 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002436#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302437
2438/*
2439 * <ioctl>
2440 * pm_set_hw_mode - Set hardware for single/dual mac.
2441 *
2442 * @INPUT: hw_mode
2443 * 0:single mac 1:dual mac
Liangwei Dong509c3472018-05-30 07:05:59 -04002444 * 2: 2x2 5g + 1x1 2g dbs mode
2445 * 3: 2x2 2g + 1x1 5g dbs mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302446 *
2447 * @OUTPUT: None
2448 *
2449 * This IOCTL is used to set hardware for single/dual mac.
2450 *
2451 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2452 * iwpriv wlan0 pm_set_hw_mode 1
2453 *
2454 * Supported Feature: DBS
2455 *
2456 * Usage: Internal/External
2457 *
2458 * </ioctl>
2459 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002460#define WE_POLICY_SET_HW_MODE_CMD 20
2461
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302462/*
2463 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002464 * ch_avoid - unit test SAP channel avoidance
2465 *
2466 * @INPUT: chan avoid ranges
2467 *
2468 * @OUTPUT: none
2469 *
2470 * This IOCTL is used to fake a channel avoidance event.
2471 * To test SAP/GO chan switch during chan avoid event process.
2472 *
2473 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2474 *
2475 * Supported Feature: SAP chan avoidance.
2476 *
2477 * Usage: Internal
2478 *
2479 * </ioctl>
2480 */
2481#define WE_SET_CHAN_AVOID 21
2482
2483/*
2484 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302485 * set_scan_cfg - Set dual MAC scan config parameters.
2486 *
2487 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2488 * @dbs: Value of DBS bit
2489 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2490 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2491 *
2492 * @OUTPUT: None
2493 *
2494 * This IOCTL is used to set the dual MAC scan config.
2495 *
2496 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2497 * single_mac_scan_with_dbs
2498 * iwpriv wlan0 set_scan_cfg 1 0 1
2499 *
2500 * Supported Feature: DBS
2501 *
2502 * Usage: Internal/External
2503 *
2504 * </ioctl>
2505 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002506#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302507
2508/*
2509 * <ioctl>
2510 * set_fw_mode_cfg - Sets the dual mac FW mode config
2511 *
2512 * @INPUT: dbs, dfs
2513 * @dbs: DBS bit
2514 * @dfs: Agile DFS bit
2515 *
2516 * @OUTPUT: None
2517 *
2518 * This IOCTL is used to set the dual mac FW mode config.
2519 *
2520 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2521 * iwpriv wlan0 set_fw_mode_cfg 1 1
2522 *
2523 * Supported Feature: DBS
2524 *
2525 * Usage: Internal/External
2526 *
2527 * </ioctl>
2528 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002529#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002530#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002531/*
2532 * <ioctl>
2533 * txrx_stats - TXRX statistics query
2534 *
2535 * @INPUT: query category, mac id (default mac id is 0)
2536 *
2537 * @OUTPUT: TXRX statistics result
2538 *
2539 * This IOCTL is used to get TXRX statistics counters.
2540 *
2541 * @E.g: iwpriv wlan0 txrx_stats 21 0
2542 * iwpriv wlan0 txrx_stats 21 1
2543 *
2544 * Usage: Internal
2545 *
2546 * </ioctl>
2547 */
2548#define WE_SET_TXRX_STATS 24
2549
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002550
2551#ifdef FEATURE_WLAN_TDLS
2552#undef MAX_VAR_ARGS
2553#define MAX_VAR_ARGS 11
2554#else
2555#undef MAX_VAR_ARGS
2556#define MAX_VAR_ARGS 9
2557#endif
2558
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302559#ifdef WLAN_FEATURE_MOTION_DETECTION
2560#undef MAX_VAR_ARGS
2561#define MAX_VAR_ARGS 15
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302562#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302563#define WE_MOTION_DET_CONFIG_PARAM 25
2564#define WE_MOTION_DET_BASE_LINE_CONFIG_PARAM 26
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302565
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302566#define WE_SET_THERMAL_THROTTLE_CFG 27
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002567/*
2568 * <ioctl>
2569 * fips_test - Perform a FIPS test
2570 *
2571 * @INPUT: Binary representation of the following packed structure
2572 *
2573 * @OUTPUT: Binary representation of the following packed structure
2574 *
2575 * This IOCTL is used to perform FIPS certification testing
2576 *
2577 * @E.g: iwpriv wlan0 fips_test <test vector>
2578 *
2579 * iwpriv wlan0 fips_test <tbd>
2580 *
2581 * Supported Feature: FIPS
2582 *
2583 * Usage: Internal
2584 *
2585 * </ioctl>
2586 */
2587#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2588
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002589/* Private ioctls (with no sub-ioctls) */
2590/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302591/*
2592 * <ioctl>
2593 * addTspec - Add TSPEC for each AC
2594 *
2595 * @INPUT: 19 TSPEC params
2596 * @[arg0]: handle
2597 * @[arg1]: tid
2598 * @[arg2]: dir
2599 * @[arg3]: psb
2600 * @[arg4]: up
2601 * @[arg5]: nomMsduSize
2602 * @[arg6]: maxMsduSize
2603 * @[arg7]: minDataRate
2604 * @[arg8]: meanDataRate
2605 * @[arg9]: peakDataRate
2606 * @[arg10]: maxBurstSize
2607 * @[arg11]: minPhyRate
2608 * @[arg12]: sba
2609 * @[arg13]: minServiceIntv
2610 * @[arg14]: suspendIntv
2611 * @[arg15]: burstSizeDefn
2612 * @[arg16]: ackPolicy
2613 * @[arg17]: inactivityPeriod
2614 * @[arg18]: maxServiceIntv
2615 *
2616 * @OUTPUT: Success/Failure
2617 *
2618 * This IOCTL is used to add TSPEC for each AC.
2619 *
2620 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2621 * <maxMsduSize> <minDataRate> <meanDataRate>
2622 * <peakDataRate> <maxBurstSize> <minPhyRate>
2623 * <sba> <minServiceIntv> <suspendIntv>
2624 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2625 * <maxServiceIntv>
2626 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2627 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2628 * wlan0 addTspec:3
2629 *
2630 * Supported Feature: WMM
2631 *
2632 * Usage: Internal/External
2633 *
2634 * </ioctl>
2635 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002636#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302637/*
2638 * <ioctl>
2639 * delTspec - Delete TSPEC entry for each AC
2640 *
2641 * @INPUT: 1 TSPEC param
2642 * @[arg0]: handle
2643 *
2644 * @OUTPUT: Success/Failure
2645 *
2646 * This IOCTL is used to delete TSPEC entry for each AC.
2647 *
2648 * @E.g: iwpriv wlan0 delTspec <handle>
2649 * iwpriv wlan0 delTspec 7001
2650 * wlan0 delTspec:16
2651 *
2652 * Supported Feature: WMM
2653 *
2654 * Usage: Internal/External
2655 *
2656 * </ioctl>
2657 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002658#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302659/*
2660 * <ioctl>
2661 * getTspec - Get TSPEC entry for each AC
2662 *
2663 * @INPUT: 1 TSPEC param
2664 * @[arg0]: handle
2665 *
2666 * @OUTPUT: Success/Failure
2667 *
2668 * This IOCTL is used to get TSPEC entry for each AC.
2669 *
2670 * @E.g: iwpriv wlan0 getTspec <handle>
2671 * iwpriv wlan0 getTspec 7001
2672 * wlan0 delTspec:18
2673 *
2674 * Supported Feature: WMM
2675 *
2676 * Usage: Internal/External
2677 *
2678 * </ioctl>
2679 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002680#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2681
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002682/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2683/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2684/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002685#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2686#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002687/* (SIOCIWFIRSTPRIV + 16) is currently unused */
2688/* (SIOCIWFIRSTPRIV + 17) is currently unused */
2689/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2690
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002691#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002692
2693/* Private ioctl for setting the host offload feature */
2694#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2695
2696/* Private ioctl to get the statistics */
2697#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2698
2699/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302700/*
2701 * <ioctl>
2702 * setKeepAlive - Set the keep alive feature
2703 *
2704 * @INPUT: 28 bytes of information in the order of packet type, time period
2705 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2706 *
2707 * @OUTPUT: None
2708 *
2709 * This IOCTL sets the keep alive feature to send either NULL
2710 * or unsolicited ARP response packets
2711 *
2712 * @E.g: iwpriv wlan0 setKeepAlive
2713 *
2714 * Supported Feature: STA
2715 *
2716 * Usage: Internal/External
2717 *
2718 * </ioctl>
2719 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002720#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2721
2722#ifdef WLAN_FEATURE_PACKET_FILTERING
2723/* Private ioctl to set the packet filtering params */
2724#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2725#endif
2726
2727
2728#ifdef FEATURE_WLAN_SCAN_PNO
2729/* Private ioctl to get the statistics */
2730#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2731#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302732/*
2733 * <ioctl>
2734 * SETBAND - Set the operational band
2735 *
2736 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2737 *
2738 * @OUTPUT: None
2739 *
2740 * This IOCTL Set the operational band If the new band is different from the
2741 * current operational band, it aborts the pending scan requests, flushes
2742 * the existing scan results, and then change * the band capability
2743 *
2744 * @E.g: iwpriv wlan0 SETBAND <value>
2745 *
2746 * Supported Feature: STA
2747 *
2748 * Usage: Internal/External
2749 *
2750 * </ioctl>
2751 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002752#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2753
Dustin Brown0cbc7572016-12-16 13:54:40 -08002754#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002755/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002756
2757/* Private ioctls and their sub-ioctls */
2758#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2759#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002760#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002761#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302762/* Private sub ioctl for enabling and setting histogram interval of profiling */
2763#define WE_ENABLE_FW_PROFILE 4
2764#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002765
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002766/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002767#define WE_SET_WLAN_SUSPEND 6
2768#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002769
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002770/*
2771 * <ioctl>
2772 * log_buffer - prints host/target related communication logs via dmesg
2773 *
2774 * @INPUT: Log Id, Count
2775 *
2776 * Log Id:
2777 * 0) HTC_CREDIT_HISTORY_LOG
2778 * 1) COMMAND_LOG,
2779 * 2) COMMAND_TX_CMP_LOG,
2780 * 3) MGMT_COMMAND_LOG,
2781 * 4) MGMT_COMMAND_TX_CMP_LOG,
2782 * 5) EVENT_LOG,
2783 * 6) RX_EVENT_LOG,
2784 * 7) MGMT_EVENT_LOG
2785 *
2786 * @OUTPUT: None
2787 *
2788 * @E.g:
2789 * # print up to 10 of the most recent records from HTC Credit History
2790 * iwpriv wlan0 log_buffer 0 10
2791 * # print up to 3 of the most recent records from Event Log
2792 * iwpriv wlan0 log_buffer 5 3
2793 *
2794 * Supported Feature: WLAN Trace
2795 *
2796 * Usage: Internal/External
2797 *
2798 * </ioctl>
2799 */
2800#define WE_LOG_BUFFER 8
2801
Krunal Soni6c3859f2018-06-01 19:57:40 -07002802/*
2803 * <ioctl>
2804 * set_ba_timeout - sets Block ACK aging timeout value for each Access class
2805 *
2806 * @INPUT: Access Class [0:BK, 1:BE, 2:VI, 3:VO], Timeout value
2807 *
2808 * @OUTPUT: None
2809 *
2810 * @E.g.:
2811 * # to set duration of 2 seconds for BE
2812 * iwpriv wlan0 set_ba_timeout 1 2
2813 * # to set duration of 3 seconds for VO
2814 * iwpriv wlan0 set_ba_timeout 3 3
2815 *
2816 * Usage: Internal
2817 *
2818 * </ioctl>
2819 */
2820#define WE_SET_BA_AGEING_TIMEOUT 9
2821
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002822enum host_target_comm_log {
2823 HTC_CREDIT_HISTORY_LOG = 0,
2824 COMMAND_LOG,
2825 COMMAND_TX_CMP_LOG,
2826 MGMT_COMMAND_LOG,
2827 MGMT_COMMAND_TX_CMP_LOG,
2828 EVENT_LOG,
2829 RX_EVENT_LOG,
2830 MGMT_EVENT_LOG
2831};
2832
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002833/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2834
2835/* 802.11p IOCTL */
2836#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2837
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302838/*
2839 * <ioctl>
2840 * getLinkSpeed - Gets the current link speed in Mbps
2841 *
2842 * @INPUT: None
2843 *
2844 * @OUTPUT: linkspeed in mbps
2845 * wlan0 getLinkSpeed:7
2846 *
2847 * This IOCTL is used get the current link speed in Mbps
2848 *
2849 * @E.g: iwpriv wlan0 getLinkSpeed
2850 *
2851 * Supported Feature: STA
2852 *
2853 * Usage: Internal/External
2854 *
2855 * </ioctl>
2856 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002857#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2858
2859#define WLAN_STATS_INVALID 0
2860#define WLAN_STATS_RETRY_CNT 1
2861#define WLAN_STATS_MUL_RETRY_CNT 2
2862#define WLAN_STATS_TX_FRM_CNT 3
2863#define WLAN_STATS_RX_FRM_CNT 4
2864#define WLAN_STATS_FRM_DUP_CNT 5
2865#define WLAN_STATS_FAIL_CNT 6
2866#define WLAN_STATS_RTS_FAIL_CNT 7
2867#define WLAN_STATS_ACK_FAIL_CNT 8
2868#define WLAN_STATS_RTS_SUC_CNT 9
2869#define WLAN_STATS_RX_DISCARD_CNT 10
2870#define WLAN_STATS_RX_ERROR_CNT 11
2871#define WLAN_STATS_TX_BYTE_CNT 12
2872
2873#define WLAN_STATS_RX_BYTE_CNT 13
2874#define WLAN_STATS_RX_RATE 14
2875#define WLAN_STATS_TX_RATE 15
2876
2877#define WLAN_STATS_RX_UC_BYTE_CNT 16
2878#define WLAN_STATS_RX_MC_BYTE_CNT 17
2879#define WLAN_STATS_RX_BC_BYTE_CNT 18
2880#define WLAN_STATS_TX_UC_BYTE_CNT 19
2881#define WLAN_STATS_TX_MC_BYTE_CNT 20
2882#define WLAN_STATS_TX_BC_BYTE_CNT 21
2883
2884#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2885 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2886 *__p++ = __type; \
2887 *__p++ = __size; \
2888 memcpy(__p, __val, __size); \
2889 __p += __size; \
2890 __tlen += __size + 2; \
2891 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002892 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002893 } \
2894 } while (0)
2895
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002896#define TX_PER_TRACKING_DEFAULT_RATIO 5
2897#define TX_PER_TRACKING_MAX_RATIO 10
2898#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2899
2900#define WLAN_ADAPTER 0
2901#define P2P_ADAPTER 1
2902
2903/**
2904 * mem_alloc_copy_from_user_helper - copy from user helper
2905 * @wrqu_data: wireless extensions request data
2906 * @len: length of @wrqu_data
2907 *
2908 * Helper function to allocate buffer and copy user data.
2909 *
2910 * Return: On success return a pointer to a kernel buffer containing a
2911 * copy of the userspace data (with an additional NUL character
2912 * appended for safety). On failure return %NULL.
2913 */
2914void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2915{
2916 u8 *ptr = NULL;
2917
2918 /* in order to protect the code, an extra byte is post
2919 * appended to the buffer and the null termination is added.
2920 * However, when allocating (len+1) byte of memory, we need to
2921 * make sure that there is no uint overflow when doing
2922 * addition. In theory check len < UINT_MAX protects the uint
2923 * overflow. For wlan private ioctl, the buffer size is much
2924 * less than UINT_MAX, as a good guess, now, it is assumed
2925 * that the private command buffer size is no greater than 4K
2926 * (4096 bytes). So we use 4096 as the upper boundary for now.
2927 */
2928 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002929 hdd_err("Invalid length: %zu max: %u",
2930 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002931 return NULL;
2932 }
2933
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002934 ptr = qdf_mem_malloc(len + 1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002935 if (NULL == ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002936 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002937 return NULL;
2938 }
2939
2940 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002941 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002942 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002943 return NULL;
2944 }
2945 ptr[len] = '\0';
2946 return ptr;
2947}
2948
2949/**
2950 * hdd_priv_get_data() - Get pointer to ioctl private data
2951 * @p_priv_data: pointer to iw_point struct to be filled
2952 * @wrqu: Pointer to IOCTL Data received from userspace
2953 *
2954 * Helper function to get compatible struct iw_point passed to ioctl
2955 *
2956 * Return - 0 if p_priv_data successfully filled, error otherwise
2957 */
2958int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
2959{
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002960 if ((NULL == p_priv_data) || (NULL == wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002961 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002962
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002963#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07002964 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002965 struct compat_iw_point *p_compat_priv_data;
2966
2967 /* Compat task:
2968 * typecast to compat structure and copy the members.
2969 */
2970 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
2971
2972 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
2973 p_priv_data->length = p_compat_priv_data->length;
2974 p_priv_data->flags = p_compat_priv_data->flags;
2975 } else {
2976#endif /* #ifdef CONFIG_COMPAT */
2977
2978 /* Non compat task: directly copy the structure. */
2979 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
2980
2981#ifdef CONFIG_COMPAT
2982 }
2983#endif /* #ifdef CONFIG_COMPAT */
2984
2985 return 0;
2986}
2987
Jeff Johnson441e1f72017-02-07 08:50:49 -08002988static int hdd_check_wext_control(enum hdd_wext_control wext_control,
2989 struct iw_request_info *info)
2990{
2991 switch (wext_control) {
2992 default:
2993 case hdd_wext_disabled:
Jeff Johnsonb135c662018-10-12 12:24:07 -07002994 hdd_err_rl("Rejecting disabled ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08002995 return -ENOTSUPP;
2996 case hdd_wext_deprecated:
Jeff Johnsonb135c662018-10-12 12:24:07 -07002997 hdd_warn_rl("Using deprecated ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08002998 return 0;
2999 case hdd_wext_enabled:
3000 return 0;
3001 }
3002}
3003
Jeff Johnson82797b62017-08-11 15:31:27 -07003004int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08003005 struct iw_request_info *info)
3006{
3007 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
3008 info);
3009}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003010
3011/**
3012 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003013 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003014 * @length: Size of the data copied
3015 * @buffer: Pointer to char buffer.
3016 * @buf_len: Length of the char buffer.
3017 *
3018 * This function called when the "iwpriv wlan0 get_stats" command is given.
3019 * It used to collect the txrx stats when the device is configured in SAP mode.
3020 *
3021 * Return - none
3022 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003023void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003024 char *buffer, uint16_t buf_len)
3025{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003026 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003027 uint32_t len = 0;
3028 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
3029 uint32_t total_rx_delv = 0, total_rx_refused = 0;
3030 int i = 0;
Mohit Khanna81418772018-10-30 14:14:46 -07003031 struct hdd_context *hdd_ctx = adapter->hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003032
3033 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003034 total_rx_pkt += stats->rx_packets[i];
3035 total_rx_dropped += stats->rx_dropped[i];
3036 total_rx_delv += stats->rx_delivered[i];
3037 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003038 }
3039
3040 len = scnprintf(buffer, buf_len,
Mohit Khanna81418772018-10-30 14:14:46 -07003041 "\nTransmit[%lu] - "
3042 "called %u, dropped %u orphan %u,"
3043 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
3044 "\n[classified] BK %u, BE %u, VI %u, VO %u"
3045 "\n\nReceive[%lu] - "
3046 "packets %u, dropped %u, delivered %u, refused %u\n"
3047 "GRO - agg %u non-agg %u flushes(%u %u) disabled(conc %u low-tput %u)\n",
3048 qdf_system_ticks(),
3049 stats->tx_called,
3050 stats->tx_dropped,
3051 stats->tx_orphaned,
3052 stats->tx_dropped_ac[SME_AC_BK],
3053 stats->tx_dropped_ac[SME_AC_BE],
3054 stats->tx_dropped_ac[SME_AC_VI],
3055 stats->tx_dropped_ac[SME_AC_VO],
3056 stats->tx_classified_ac[SME_AC_BK],
3057 stats->tx_classified_ac[SME_AC_BE],
3058 stats->tx_classified_ac[SME_AC_VI],
3059 stats->tx_classified_ac[SME_AC_VO],
3060 qdf_system_ticks(),
3061 total_rx_pkt, total_rx_dropped, total_rx_delv,
3062 total_rx_refused,
3063 stats->rx_aggregated, stats->rx_non_aggregated,
3064 stats->rx_gro_flushes,
3065 stats->rx_gro_force_flushes,
3066 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_concurrency),
3067 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_low_tput));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003068
3069 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003070 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003071 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003072 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna81418772018-10-30 14:14:46 -07003073 "Rx CPU[%d]:"
3074 "packets %u, dropped %u, delivered %u, refused %u\n",
3075 i, stats->rx_packets[i], stats->rx_dropped[i],
3076 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003077 }
3078
3079 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003080 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003081 "\nCurrent status: %s"
3082 "\ntx-flow timer start count %u"
3083 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003084 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3085 stats->txflow_timer_cnt,
3086 stats->txflow_pause_cnt,
3087 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003088
Leo Changfdb45c32016-10-28 11:09:23 -07003089 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Mohit Khanna81418772018-10-30 14:14:46 -07003090 adapter->session_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003091 *length = len + 1;
3092}
3093
3094/**
Dustin Brownd9322482017-01-09 12:46:03 -08003095 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3096 * @hdd_ctx: The Hdd context owning the stats to be written
3097 * @buffer: The char buffer to write to
3098 * @max_len: The maximum number of chars to write
3099 *
3100 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3101 *
3102 * Return - length of written content, negative number on error
3103 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003104#ifdef QCA_SUPPORT_CP_STATS
3105static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
3106 char *buffer, uint16_t max_len)
3107{
3108 int ret;
3109 QDF_STATUS status;
3110 struct suspend_resume_stats *sr_stats;
3111
3112 sr_stats = &hdd_ctx->suspend_resume_stats;
3113 ret = scnprintf(buffer, max_len,
3114 "\n"
3115 "Suspends: %u\n"
3116 "Resumes: %u\n"
3117 "\n"
3118 "Suspend Fail Reasons\n"
3119 "\tIPA: %u\n"
3120 "\tRadar: %u\n"
3121 "\tRoam: %u\n"
3122 "\tScan: %u\n"
3123 "\tInitial Wakeup: %u\n"
3124 "\n",
3125 sr_stats->suspends, sr_stats->resumes,
3126 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3127 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3128 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3129 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3130 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]);
3131
Dustin Brown05d81302018-09-11 16:49:22 -07003132 status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->psoc,
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003133 &buffer[ret], max_len - ret,
3134 &ret);
3135 if (QDF_IS_STATUS_ERROR(status)) {
3136 hdd_err("Failed to get WoW stats");
3137 return qdf_status_to_os_return(status);
3138 }
3139
3140 return ret;
3141}
3142#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003143static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
Dustin Brownd9322482017-01-09 12:46:03 -08003144 char *buffer, uint16_t max_len)
3145{
3146 QDF_STATUS status;
3147 struct suspend_resume_stats *sr_stats;
3148 struct sir_wake_lock_stats wow_stats;
3149
3150 sr_stats = &hdd_ctx->suspend_resume_stats;
3151
3152 status = wma_get_wakelock_stats(&wow_stats);
3153 if (QDF_IS_STATUS_ERROR(status)) {
3154 hdd_err("Failed to get WoW stats");
3155 return qdf_status_to_os_return(status);
3156 }
3157
3158 return scnprintf(buffer, max_len,
3159 "\n"
3160 "Suspends: %u\n"
3161 "Resumes: %u\n"
3162 "\n"
3163 "Suspend Fail Reasons\n"
3164 "\tIPA: %u\n"
3165 "\tRadar: %u\n"
3166 "\tRoam: %u\n"
3167 "\tScan: %u\n"
3168 "\tInitial Wakeup: %u\n"
3169 "\n"
3170 "WoW Wake Reasons\n"
3171 "\tunicast: %u\n"
3172 "\tbroadcast: %u\n"
3173 "\tIPv4 multicast: %u\n"
3174 "\tIPv6 multicast: %u\n"
3175 "\tIPv6 multicast RA: %u\n"
3176 "\tIPv6 multicast NS: %u\n"
3177 "\tIPv6 multicast NA: %u\n"
3178 "\tICMPv4: %u\n"
3179 "\tICMPv6: %u\n"
3180 "\tRSSI Breach: %u\n"
3181 "\tLow RSSI: %u\n"
3182 "\tG-Scan: %u\n"
3183 "\tPNO Complete: %u\n"
3184 "\tPNO Match: %u\n",
3185 sr_stats->suspends,
3186 sr_stats->resumes,
3187 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3188 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3189 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3190 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3191 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP],
3192 wow_stats.wow_ucast_wake_up_count,
3193 wow_stats.wow_bcast_wake_up_count,
3194 wow_stats.wow_ipv4_mcast_wake_up_count,
3195 wow_stats.wow_ipv6_mcast_wake_up_count,
3196 wow_stats.wow_ipv6_mcast_ra_stats,
3197 wow_stats.wow_ipv6_mcast_ns_stats,
3198 wow_stats.wow_ipv6_mcast_na_stats,
3199 wow_stats.wow_icmpv4_count,
3200 wow_stats.wow_icmpv6_count,
3201 wow_stats.wow_rssi_breach_wake_up_count,
3202 wow_stats.wow_low_rssi_wake_up_count,
3203 wow_stats.wow_gscan_wake_up_count,
3204 wow_stats.wow_pno_complete_wake_up_count,
3205 wow_stats.wow_pno_match_wake_up_count);
3206}
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003207#endif
Dustin Brownd9322482017-01-09 12:46:03 -08003208/**
Govind Singha471e5e2015-10-12 17:11:14 +05303209 * hdd_wlan_list_fw_profile() - Get fw profiling points
3210 * @length: Size of the data copied
3211 * @buffer: Pointer to char buffer.
3212 * @buf_len: Length of the char buffer.
3213 *
3214 * This function called when the "iwpriv wlan0 listProfile" command is given.
3215 * It is used to get the supported profiling points in FW.
3216 *
3217 * Return - none
3218 */
3219void hdd_wlan_list_fw_profile(uint16_t *length,
3220 char *buffer, uint16_t buf_len)
3221{
3222 uint32_t len = 0;
3223
3224 len = scnprintf(buffer, buf_len,
3225 "PROF_CPU_IDLE: %u\n"
3226 "PROF_PPDU_PROC: %u\n"
3227 "PROF_PPDU_POST: %u\n"
3228 "PROF_HTT_TX_INPUT: %u\n"
3229 "PROF_MSDU_ENQ: %u\n"
3230 "PROF_PPDU_POST_HAL: %u\n"
3231 "PROF_COMPUTE_TX_TIME: %u\n",
3232 PROF_CPU_IDLE,
3233 PROF_PPDU_PROC,
3234 PROF_PPDU_POST,
3235 PROF_HTT_TX_INPUT,
3236 PROF_MSDU_ENQ,
3237 PROF_PPDU_POST_HAL,
3238 PROF_COMPUTE_TX_TIME);
3239
3240 *length = len + 1;
3241}
Mohit Khannac9649652018-11-28 18:10:28 -08003242
3243#define HDD_DUMP_STAT_HELP(STAT_ID) \
3244 hdd_nofl_info("%u -- %s", STAT_ID, (# STAT_ID))
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003245/**
3246 * hdd_display_stats_help() - print statistics help
3247 *
3248 * Return: none
3249 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003250static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003251{
Nirav Shahe6194ac2018-07-13 11:04:41 +05303252 hdd_nofl_info("iwpriv wlan0 dumpStats [option] - dump statistics");
3253 hdd_nofl_info("iwpriv wlan0 clearStats [option] - clear statistics");
3254 hdd_nofl_info("options:");
Mohit Khannac9649652018-11-28 18:10:28 -08003255 HDD_DUMP_STAT_HELP(CDP_TXRX_PATH_STATS);
3256 HDD_DUMP_STAT_HELP(CDP_TXRX_HIST_STATS);
3257 HDD_DUMP_STAT_HELP(CDP_TXRX_TSO_STATS);
3258 HDD_DUMP_STAT_HELP(CDP_HDD_NETIF_OPER_HISTORY);
3259 HDD_DUMP_STAT_HELP(CDP_DUMP_TX_FLOW_POOL_INFO);
3260 HDD_DUMP_STAT_HELP(CDP_TXRX_DESC_STATS);
3261 HDD_DUMP_STAT_HELP(CDP_HIF_STATS);
3262 HDD_DUMP_STAT_HELP(CDP_NAPI_STATS);
3263 HDD_DUMP_STAT_HELP(CDP_DP_NAPI_STATS);
3264 HDD_DUMP_STAT_HELP(CDP_DP_RX_THREAD_STATS);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003265}
Govind Singha471e5e2015-10-12 17:11:14 +05303266
3267/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003268 * hdd_wlan_dump_stats() - display dump Stats
3269 * @adapter: adapter handle
3270 * @value: value from user
3271 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003272 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003273 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003274int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003275{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003276 int ret = 0;
3277 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003278 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003279
Jeff Johnson0e07ca12018-11-12 21:04:45 -08003280 hdd_debug("%d", value);
3281
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003282 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003283 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003284 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3285 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003286 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003287 wlan_hdd_display_netif_queue_history
3288 (hdd_ctx,
3289 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003290 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003291 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303292 hdd_display_hif_stats();
3293 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003294 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003295 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303296 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003297 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003298 if (hdd_display_napi_stats()) {
3299 hdd_err("error displaying napi stats");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303300 ret = -EFAULT;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003301 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003302 break;
Mohit Khannac9649652018-11-28 18:10:28 -08003303 case CDP_DP_RX_THREAD_STATS:
3304 dp_txrx_ext_dump_stats(cds_get_context(QDF_MODULE_ID_SOC),
3305 CDP_DP_RX_THREAD_STATS);
3306 break;
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303307 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003308 sme_display_disconnect_stats(hdd_ctx->mac_handle,
3309 adapter->session_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303310 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003311 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003312 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003313 value,
3314 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003315 if (status == QDF_STATUS_E_INVAL) {
3316 hdd_display_stats_help();
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303317 ret = -EINVAL;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003318 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003319 break;
3320 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003321 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003322}
3323
3324/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003325 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003326 * @adapter: Adapter upon which the IBSS client is active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003327 * @staIdx: Station index of the IBSS peer
3328 *
3329 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3330 * otherwise an appropriate QDF_STATUS_E_* failure code.
3331 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003332static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnsonaf2a0932016-10-05 14:52:57 -07003333 uint8_t staIdx)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003334{
3335 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003336 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003337 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003338 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003339
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003340 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003341 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003342 hdd_get_ibss_peer_info_cb,
3343 false, staIdx);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003344
3345 if (QDF_STATUS_SUCCESS == status) {
3346 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003347
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003348 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003349 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003350 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3351 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003352 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003353 return QDF_STATUS_E_FAILURE;
3354 }
3355
3356 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003357 hdd_debug("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003358 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003359 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3360 uint32_t tx_rate = pPeerInfo->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003361
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003362 qdf_mem_copy(mac_addr, pPeerInfo->peerInfoParams[0].
3363 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003364 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003365 mac_addr, (int)tx_rate,
3366 (int)pPeerInfo->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003367 }
3368 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003369 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003370 }
3371
3372 return status;
3373}
3374
3375/**
3376 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003377 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003378 *
3379 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3380 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3381 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003382static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003383{
3384 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003385 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003386 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003387 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003388 int i;
3389
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003390 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003391 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003392 hdd_get_ibss_peer_info_cb,
3393 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003394
3395 if (QDF_STATUS_SUCCESS == status) {
3396 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003397
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003398 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003399 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003400 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3401 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003402 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003403 return QDF_STATUS_E_FAILURE;
3404 }
3405
3406 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003407 hdd_debug("pPeerInfo->numIBSSPeers = %d ",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003408 (int)pPeerInfo->numPeers);
3409 for (i = 0; i < pPeerInfo->numPeers; i++) {
3410 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3411 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003412
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003413 tx_rate = pPeerInfo->peerInfoParams[i].txRate;
3414 qdf_mem_copy(mac_addr,
3415 pPeerInfo->peerInfoParams[i].mac_addr,
3416 sizeof(mac_addr));
3417
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003418 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003419 mac_addr, (int)tx_rate,
3420 (int)pPeerInfo->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003421 }
3422 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003423 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003424 }
3425
3426 return status;
3427}
3428
3429/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303430 * hdd_get_ldpc() - Get adapter LDPC
3431 * @adapter: adapter being queried
3432 * @value: where to store the value
3433 *
3434 * Return: 0 on success, negative errno on failure
3435 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003436int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303437{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003438 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303439 int ret;
3440
Dustin Brown491d54b2018-03-14 12:39:11 -07003441 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003442 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303443 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3444 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003445 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303446 } else {
3447 *value = ret;
3448 ret = 0;
3449 }
3450 return ret;
3451}
3452
Jeff Johnson3d278b02017-08-29 14:17:47 -07003453int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303454{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003455 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303456 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003457 QDF_STATUS status;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003458 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303459 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303460
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003461 hdd_debug("%d", value);
Jeff Johnson1ca04762018-10-25 10:24:39 -07003462
3463 if (!mac_handle) {
3464 hdd_err("NULL Mac handle");
3465 return -EINVAL;
3466 }
3467
Dustin Brown05d81302018-09-11 16:49:22 -07003468 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003469 if (QDF_STATUS_SUCCESS != status) {
3470 hdd_err("Failed to get HT capability info");
3471 return -EIO;
3472 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003473
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303474 ht_cap_info.adv_coding_cap = value;
Dustin Brown05d81302018-09-11 16:49:22 -07003475 status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003476 if (QDF_STATUS_SUCCESS != status) {
3477 hdd_err("Failed to set HT capability info");
3478 return -EIO;
3479 }
Vignesh Viswanathanecd4de72018-11-22 13:02:20 +05303480 status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303481 if (QDF_IS_STATUS_ERROR(status)) {
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003482 hdd_err("Failed to set VHT LDPC capability info");
3483 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303484 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003485 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303486 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
3487 value);
3488 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003489 hdd_err("Failed to set LDPC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003490 ret = sme_update_he_ldpc_supp(mac_handle, adapter->session_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003491 if (ret)
3492 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303493
3494 return ret;
3495}
3496
3497/**
3498 * hdd_get_tx_stbc() - Get adapter TX STBC
3499 * @adapter: adapter being queried
3500 * @value: where to store the value
3501 *
3502 * Return: 0 on success, negative errno on failure
3503 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003504int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303505{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003506 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303507 int ret;
3508
Dustin Brown491d54b2018-03-14 12:39:11 -07003509 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003510 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303511 WNI_CFG_HT_CAP_INFO_TX_STBC);
3512 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003513 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303514 } else {
3515 *value = ret;
3516 ret = 0;
3517 }
3518
3519 return ret;
3520}
3521
Jeff Johnson3d278b02017-08-29 14:17:47 -07003522int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303523{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003524 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303525 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303526 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303527 QDF_STATUS status;
3528 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303529
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003530 hdd_debug("%d", value);
Jeff Johnson57ff4fa2018-10-25 10:29:47 -07003531
3532 if (!mac_handle) {
3533 hdd_err("NULL Mac handle");
3534 return -EINVAL;
3535 }
3536
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303537 if (value) {
3538 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003539 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303540 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303541 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003542 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303543 return -EIO;
3544 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303545 if (!ht_cap_info.tx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003546 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303547 return -EINVAL;
3548 }
3549 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003550 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303551 WNI_CFG_HT_CAP_INFO_TX_STBC,
3552 value);
3553 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003554 hdd_err("Failed to set TX STBC value");
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003555 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003556 if (ret)
3557 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303558
3559 return ret;
3560}
3561
3562/**
3563 * hdd_get_rx_stbc() - Get adapter RX STBC
3564 * @adapter: adapter being queried
3565 * @value: where to store the value
3566 *
3567 * Return: 0 on success, negative errno on failure
3568 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003569int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303570{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003571 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303572 int ret;
3573
Dustin Brown491d54b2018-03-14 12:39:11 -07003574 hdd_enter();
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003575 ret = sme_get_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303576 WNI_CFG_HT_CAP_INFO_RX_STBC);
3577 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003578 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303579 } else {
3580 *value = ret;
3581 ret = 0;
3582 }
3583
3584 return ret;
3585}
3586
Jeff Johnson3d278b02017-08-29 14:17:47 -07003587int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303588{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003589 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303590 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303591 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303592 QDF_STATUS status;
3593 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303594
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003595 hdd_debug("%d", value);
Jeff Johnsonb6645852018-10-25 10:35:41 -07003596
3597 if (!mac_handle) {
3598 hdd_err("NULL Mac handle");
3599 return -EINVAL;
3600 }
3601
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303602 if (value) {
3603 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003604 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303605 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303606 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003607 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303608 return -EIO;
3609 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303610 if (!ht_cap_info.rx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003611 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303612 return -EINVAL;
3613 }
3614 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003615 ret = sme_update_ht_config(mac_handle, adapter->session_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303616 WNI_CFG_HT_CAP_INFO_RX_STBC,
3617 value);
3618 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003619 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303620
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003621 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->session_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003622 if (ret)
3623 hdd_err("Failed to set HE RX STBC value");
3624
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303625 return ret;
3626}
3627
3628/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003629 * iw_get_linkspeed() - Get current link speed ioctl
3630 * @dev: device upon which the ioctl was received
3631 * @info: ioctl request information
3632 * @wrqu: ioctl request data
3633 * @extra: extra ioctl buffer
3634 *
3635 * Return: 0 on success, non-zero on error
3636 */
3637static int __iw_get_linkspeed(struct net_device *dev,
3638 struct iw_request_info *info,
3639 union iwreq_data *wrqu, char *extra)
3640{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003641 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003642 char *pLinkSpeed = (char *)extra;
3643 int len = sizeof(uint32_t) + 1;
3644 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003645 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003646 int ret;
3647 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003648
Dustin Brownfdf17c12018-03-14 12:55:34 -07003649 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303650
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003651 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003652 ret = wlan_hdd_validate_context(hdd_ctx);
3653 if (0 != ret)
3654 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003655
Jeff Johnson441e1f72017-02-07 08:50:49 -08003656 ret = hdd_check_private_wext_control(hdd_ctx, info);
3657 if (0 != ret)
3658 return ret;
3659
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003660 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003661 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003662 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003663
3664 wrqu->data.length = len;
3665 /* return the linkspeed as a string */
3666 rc = snprintf(pLinkSpeed, len, "%u", link_speed);
3667 if ((rc < 0) || (rc >= len)) {
3668 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003669 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003670 return -EIO;
3671 }
3672
Dustin Browne74003f2018-03-14 12:51:58 -07003673 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003674 /* a value is being successfully returned */
3675 return 0;
3676}
3677
3678static int iw_get_linkspeed(struct net_device *dev,
3679 struct iw_request_info *info,
3680 union iwreq_data *wrqu, char *extra)
3681{
3682 int ret;
3683
3684 cds_ssr_protect(__func__);
3685 ret = __iw_get_linkspeed(dev, info, wrqu, extra);
3686 cds_ssr_unprotect(__func__);
3687
3688 return ret;
3689}
3690
Jeff Johnsonc1713242018-10-23 13:45:42 -07003691int wlan_hdd_update_phymode(struct hdd_adapter *adapter, int new_phymode)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003692{
Jeff Johnsonc1713242018-10-23 13:45:42 -07003693 struct net_device *net = adapter->dev;
3694 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
3695 mac_handle_t mac_handle = phddctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003696 bool band_24 = false, band_5g = false;
3697 bool ch_bond24 = false, ch_bond5g = false;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303698 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003699 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303700 uint8_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003701 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07003702 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003703 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303704 int retval = 0;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303705 uint8_t band_capability;
3706 QDF_STATUS status;
Wu Gaoed616a12019-01-16 15:19:21 +08003707 uint32_t channel_bonding_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003708
Jeff Johnsonc1713242018-10-23 13:45:42 -07003709 if (!mac_handle)
3710 return -EINVAL;
3711
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003712 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003713
Wu Gaoed616a12019-01-16 15:19:21 +08003714 ucfg_mlme_get_channel_bonding_24ghz(phddctx->psoc,
3715 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003716 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003717 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003718 ch_bond24 = true;
3719
Wu Gaoed616a12019-01-16 15:19:21 +08003720 ucfg_mlme_get_channel_bonding_5ghz(phddctx->psoc,
3721 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003722 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003723 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003724 ch_bond5g = true;
3725
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303726 status = wlan_mlme_get_band_capability(phddctx->psoc, &band_capability);
3727 if (QDF_IS_STATUS_ERROR(status)) {
3728 hdd_err("Failed to get MLME Band capability");
3729 return -EIO;
3730 }
3731
3732 if (band_capability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003733 band_24 = band_5g = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303734 else if (band_capability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003735 band_24 = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303736 else if (band_capability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003737 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003738
Jeff Johnsonc1713242018-10-23 13:45:42 -07003739 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc, &vhtchanwidth);
3740 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003741 hdd_err("Failed to get channel_width");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303742
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003743 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 -08003744 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3745
3746 switch (new_phymode) {
3747 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003748 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003749 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003750 phymode = eCSR_DOT11_MODE_AUTO;
3751 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3752 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003753 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003754 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3755 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003756 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003757 return -EIO;
3758 }
3759 break;
3760 case IEEE80211_MODE_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003761 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003762 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003763 phymode = eCSR_DOT11_MODE_11a;
3764 hdd_dot11mode = eHDD_DOT11_MODE_11a;
3765 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003766 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003767 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003768 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003769 return -EIO;
3770 }
3771 break;
3772 case IEEE80211_MODE_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003773 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003774 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003775 phymode = eCSR_DOT11_MODE_11b;
3776 hdd_dot11mode = eHDD_DOT11_MODE_11b;
3777 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003778 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003779 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003780 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003781 return -EIO;
3782 }
3783 break;
3784 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003785 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003786 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003787 phymode = eCSR_DOT11_MODE_11g;
3788 hdd_dot11mode = eHDD_DOT11_MODE_11g;
3789 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003790 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003791 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003792 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003793 return -EIO;
3794 }
3795 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07003796 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003797 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
3798 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
3799 */
3800 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003801 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003802 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003803 phymode = eCSR_DOT11_MODE_11n;
3804 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3805 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003806 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003807 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003808 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003809 return -EIO;
3810 }
3811 break;
3812 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003813 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003814 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003815 phymode = eCSR_DOT11_MODE_11n;
3816 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3817 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003818 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003819 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003820 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003821 return -EIO;
3822 }
3823 break;
3824 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003825 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003826 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003827 phymode = eCSR_DOT11_MODE_11n;
3828 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3829 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003830 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003831 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003832 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003833 return -EIO;
3834 }
3835 break;
3836 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003837 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003838 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003839 phymode = eCSR_DOT11_MODE_11n;
3840 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3841 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003842 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003843 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003844 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003845 return -EIO;
3846 }
3847 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003848 case IEEE80211_MODE_11AC_VHT20:
3849 case IEEE80211_MODE_11AC_VHT40:
3850 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003851 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003852 phymode = eCSR_DOT11_MODE_11ac;
3853 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
3854 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3855 if (band_5g && band_24) {
3856 curr_band = BAND_ALL;
3857 break;
3858 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003859 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07003860 break;
3861 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
3862 curr_band = BAND_2G;
3863 break;
3864 }
3865 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
3866 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003867 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003868 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003869 return -EIO;
3870 }
3871 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003872 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003873 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003874 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003875 phymode = eCSR_DOT11_MODE_AUTO;
3876 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3877 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003878 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003879 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003880 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003881 return -EIO;
3882 }
3883 break;
3884 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003885 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003886 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003887 phymode = eCSR_DOT11_MODE_AUTO;
3888 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3889 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3890 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003891 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003892 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003893 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003894 return -EIO;
3895 }
3896 break;
3897 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003898 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003899 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003900 phymode = eCSR_DOT11_MODE_11n;
3901 hdd_dot11mode = eHDD_DOT11_MODE_11n;
3902 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003903 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003904 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003905 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003906 return -EIO;
3907 }
3908 break;
3909 default:
3910 return -EIO;
3911 }
3912
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003913 switch (new_phymode) {
3914 case IEEE80211_MODE_11AC_VHT20:
3915 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3916 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
3917 break;
3918 case IEEE80211_MODE_11AC_VHT40:
3919 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
3920 break;
3921 case IEEE80211_MODE_11AC_VHT80:
3922 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3923 break;
3924 default:
Jeff Johnsonc1713242018-10-23 13:45:42 -07003925 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc,
3926 &vhtchanwidth);
3927 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003928 hdd_err("Failed to get channel_width");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003929 break;
3930 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003931
3932 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303933 sme_config = qdf_mem_malloc(sizeof(*sme_config));
3934 if (!sme_config) {
3935 hdd_err("Failed to allocate memory for sme_config");
3936 return -ENOMEM;
3937 }
3938 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003939 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303940 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003941#ifdef QCA_HT_2040_COEX
3942 if (phymode == eCSR_DOT11_MODE_11n &&
3943 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303944 sme_config->csrConfig.obssEnabled = false;
Jeff Johnsonc1713242018-10-23 13:45:42 -07003945 status = sme_set_ht2040_mode(mac_handle,
3946 adapter->session_id,
3947 eHT_CHAN_HT20, false);
3948 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003949 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303950 retval = -EIO;
3951 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003952 }
3953 } else if (phymode == eCSR_DOT11_MODE_11n &&
3954 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303955 sme_config->csrConfig.obssEnabled = true;
Jeff Johnsonc1713242018-10-23 13:45:42 -07003956 status = sme_set_ht2040_mode(mac_handle,
3957 adapter->session_id,
3958 eHT_CHAN_HT20, true);
3959 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003960 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303961 retval = -EIO;
3962 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003963 }
3964 }
3965#endif
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303966 status = ucfg_mlme_set_band_capability(phddctx->psoc,
3967 curr_band);
3968 if (QDF_IS_STATUS_ERROR(status)) {
3969 hdd_err("failed to set MLME band capability");
3970 goto free;
3971 }
3972
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05303973 if (curr_band == BAND_2G) {
3974 status = ucfg_mlme_set_11h_enabled(phddctx->psoc, 0);
3975 if (!QDF_IS_STATUS_SUCCESS(status)) {
3976 hdd_err("Failed to set 11h_enable flag");
3977 goto free;
3978 }
3979 }
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003980 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303981 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07003982 else if (curr_band == BAND_5G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303983 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003984 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303985 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
3986 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003987 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003988 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003989
3990 phddctx->config->dot11Mode = hdd_dot11mode;
Wu Gaoed616a12019-01-16 15:19:21 +08003991 ucfg_mlme_set_channel_bonding_24ghz(
3992 phddctx->psoc,
3993 sme_config->csrConfig.channelBondingMode24GHz);
3994 ucfg_mlme_set_channel_bonding_5ghz(
3995 phddctx->psoc,
3996 sme_config->csrConfig.channelBondingMode5GHz);
Krunal Sonidf0f8742016-09-26 14:56:31 -07003997 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003998 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303999 retval = -EIO;
4000 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004001 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304002
4003 if (band_5g) {
4004 struct ieee80211_supported_band *band;
4005
Wu Gaoed616a12019-01-16 15:19:21 +08004006 ucfg_mlme_get_channel_bonding_5ghz(
4007 phddctx->psoc, &channel_bonding_mode);
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304008 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
Wu Gaoed616a12019-01-16 15:19:21 +08004009 if (channel_bonding_mode)
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304010 band->ht_cap.cap |=
4011 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4012 else
4013 band->ht_cap.cap &=
4014 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4015 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004016
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004017 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004018 phymode, chwidth, curr_band, vhtchanwidth);
4019 }
4020
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304021free:
4022 if (sme_config)
4023 qdf_mem_free(sme_config);
4024 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004025}
4026
Jeff Johnson011c4502017-10-05 15:25:56 -07004027static int hdd_validate_pdev_reset(int value)
4028{
4029 if ((value < 1) || (value > 5)) {
4030 hdd_warn(" Invalid value %d: Use any one of the below values\n"
4031 " TX_FLUSH = 1\n"
4032 " WARM_RESET = 2\n"
4033 " COLD_RESET = 3\n"
4034 " WARM_RESET_RESTORE_CAL = 4\n"
4035 " COLD_RESET_RESTORE_CAL = 5", value);
4036
4037 return -EINVAL;
4038 }
4039
4040 return 0;
4041}
4042
4043static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
4044{
4045 int ret;
4046
4047 hdd_debug("%d", value);
4048
4049 ret = hdd_validate_pdev_reset(value);
4050 if (ret)
4051 return ret;
4052
Jeff Johnson1b780e42017-10-31 14:11:45 -07004053 ret = wma_cli_set_command(adapter->session_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07004054 WMI_PDEV_PARAM_PDEV_RESET,
4055 value, PDEV_CMD);
4056
4057 return ret;
4058}
4059
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004060static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
4061{
4062 int errno;
4063 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4064 ePhyChanBondState bonding_state;
4065 uint32_t bonding_mode;
4066 tSmeConfigParams *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004067 mac_handle_t mac_handle;
Wu Gaoed616a12019-01-16 15:19:21 +08004068 uint32_t channel_bonding_mode;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004069
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004070 mac_handle = hdd_ctx->mac_handle;
4071 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004072 return -EINVAL;
4073
4074 /* updating channel bonding only on 5Ghz */
4075 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4076
4077 switch (ch_width) {
4078 case eHT_CHANNEL_WIDTH_20MHZ:
4079 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4080 break;
4081
4082 case eHT_CHANNEL_WIDTH_40MHZ:
4083 case eHT_CHANNEL_WIDTH_80MHZ:
Wu Gaoed616a12019-01-16 15:19:21 +08004084 ucfg_mlme_get_channel_bonding_5ghz(hdd_ctx->psoc,
4085 &channel_bonding_mode);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004086 bonding_state = csr_convert_cb_ini_value_to_phy_cb_state(
Wu Gaoed616a12019-01-16 15:19:21 +08004087 channel_bonding_mode);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004088
4089 if (bonding_state == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE)
4090 return -EINVAL;
4091
Wu Gaoed616a12019-01-16 15:19:21 +08004092 bonding_mode = channel_bonding_mode;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004093 break;
4094
4095 default:
4096 hdd_err("Invalid channel width 0->20 1->40 2->80");
4097 return -EINVAL;
4098 }
4099
4100 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4101 if (!sme_config) {
4102 hdd_err("failed to allocate memory for sme_config");
4103 return -ENOMEM;
4104 }
4105
4106 errno = wma_cli_set_command(adapter->session_id, WMI_VDEV_PARAM_CHWIDTH,
4107 ch_width, VDEV_CMD);
4108 if (errno)
4109 goto free_config;
4110
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004111 sme_get_config_param(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004112 sme_config->csrConfig.channelBondingMode5GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004113 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004114
4115free_config:
4116 qdf_mem_free(sme_config);
4117
4118 return errno;
4119}
4120
Jeff Johnsondeab8572018-11-13 15:29:53 -08004121static int hdd_we_set_11d_state(struct hdd_adapter *adapter, int state_11d)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004122{
Jeff Johnsondeab8572018-11-13 15:29:53 -08004123 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004124 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004125 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304126 QDF_STATUS status;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004127
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004128 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004129 return -EINVAL;
4130
4131 switch (state_11d) {
4132 case ENABLE_11D:
4133 enable_11d = true;
4134 break;
4135 case DISABLE_11D:
4136 enable_11d = false;
4137 break;
4138 default:
4139 return -EINVAL;
4140 }
4141
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304142 status = ucfg_mlme_set_11d_enabled(hdd_ctx->psoc, enable_11d);
4143 if (!QDF_IS_STATUS_SUCCESS(status))
4144 hdd_err("Invalid 11d_enable flag");
Dustin Brownd90f61a2018-04-26 12:25:58 -07004145
Dustin Brownea82d562018-05-23 12:07:16 -07004146 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004147
4148 return 0;
4149}
4150
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004151static int hdd_we_set_power(struct hdd_adapter *adapter, int value)
4152{
4153 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4154 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4155
4156 if (!mac_handle)
4157 return -EINVAL;
4158
4159 switch (value) {
4160 case 1:
4161 /* Enable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004162 sme_save_usr_ps_cfg(mac_handle, true);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004163 sme_ps_enable_disable(mac_handle, adapter->session_id,
4164 SME_PS_ENABLE);
4165 return 0;
4166 case 2:
4167 /* Disable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004168 sme_save_usr_ps_cfg(mac_handle, false);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004169 sme_ps_enable_disable(mac_handle, adapter->session_id,
4170 SME_PS_DISABLE);
4171 return 0;
4172 case 3:
4173 /* Enable UASPD */
4174 sme_ps_uapsd_enable(mac_handle, adapter->session_id);
4175 return 0;
4176 case 4:
4177 /* Disable UASPD */
4178 sme_ps_uapsd_disable(mac_handle, adapter->session_id);
4179 return 0;
4180 default:
4181 hdd_err("Invalid value %d", value);
4182 return -EINVAL;
4183 }
4184}
4185
Jeff Johnsoneb4368a2018-10-19 13:02:52 -07004186static int hdd_we_set_max_assoc(struct hdd_adapter *adapter, int value)
4187{
4188 struct hdd_context *hdd_ctx;
4189 QDF_STATUS status;
4190
4191 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4192 status = ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, value);
4193 if (QDF_IS_STATUS_ERROR(status))
4194 hdd_err("cfg set failed, value %d status %d", value, status);
4195
4196 return qdf_status_to_os_return(status);
4197}
4198
Jeff Johnson693722c2018-10-19 13:11:16 -07004199static int hdd_we_set_data_inactivity_timeout(struct hdd_adapter *adapter,
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004200 int inactivity_timeout)
Jeff Johnson693722c2018-10-19 13:11:16 -07004201{
4202 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004203 QDF_STATUS status;
Jeff Johnson693722c2018-10-19 13:11:16 -07004204
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004205 status = ucfg_mlme_set_ps_data_inactivity_timeout(hdd_ctx->psoc,
4206 inactivity_timeout);
Jeff Johnson693722c2018-10-19 13:11:16 -07004207
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004208 return qdf_status_to_os_return(status);
Jeff Johnson693722c2018-10-19 13:11:16 -07004209}
4210
Jeff Johnson94511942018-10-19 13:15:22 -07004211static int hdd_we_set_wow_data_inactivity_timeout(struct hdd_adapter *adapter,
4212 int value)
4213{
4214 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4215 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Jeff Johnson94511942018-10-19 13:15:22 -07004216
4217 if (!mac_handle)
4218 return -EINVAL;
4219
Wu Gaoa796d712019-01-07 14:15:32 +08004220 if (!cfg_in_range(CFG_PMO_WOW_DATA_INACTIVITY_TIMEOUT, value)) {
Jeff Johnson94511942018-10-19 13:15:22 -07004221 hdd_err_rl("Invalid value %d", value);
4222 return -EINVAL;
4223 }
4224
Wu Gaoa796d712019-01-07 14:15:32 +08004225 ucfg_pmo_set_wow_data_inactivity_timeout(hdd_ctx->psoc, (uint8_t)value);
Jeff Johnson94511942018-10-19 13:15:22 -07004226
Wu Gaoa796d712019-01-07 14:15:32 +08004227 return 0;
Jeff Johnson94511942018-10-19 13:15:22 -07004228}
4229
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004230static int hdd_we_set_tx_power(struct hdd_adapter *adapter, int value)
4231{
4232 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4233 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4234 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4235 QDF_STATUS status;
4236
4237 if (!mac_handle)
4238 return -EINVAL;
4239
4240 status = sme_set_tx_power(mac_handle, adapter->session_id,
4241 sta_ctx->conn_info.bssId,
4242 adapter->device_mode, value);
4243
4244 if (QDF_IS_STATUS_ERROR(status))
4245 hdd_err("cfg set failed, value %d status %d", value, status);
4246
4247 return qdf_status_to_os_return(status);
4248}
4249
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004250static int hdd_we_set_max_tx_power(struct hdd_adapter *adapter, int value)
4251{
4252 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4253 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4254 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4255 QDF_STATUS status;
4256
4257 if (!mac_handle)
4258 return -EINVAL;
4259
4260 status = sme_set_max_tx_power(mac_handle,
4261 sta_ctx->conn_info.bssId,
4262 sta_ctx->conn_info.bssId,
4263 value);
4264
4265 if (QDF_IS_STATUS_ERROR(status))
4266 hdd_err("cfg set failed, value %d status %d", value, status);
4267
4268 return qdf_status_to_os_return(status);
4269}
4270
Jeff Johnsonf3892b52018-10-23 11:32:04 -07004271static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power)
4272{
4273 QDF_STATUS status;
4274
4275 hdd_debug("power %d dBm", power);
4276 status = sme_set_max_tx_power_per_band(BAND_2G, power);
4277 if (QDF_IS_STATUS_ERROR(status))
4278 hdd_err("cfg set failed, value %d status %d", power, status);
4279
4280 return qdf_status_to_os_return(status);
4281}
4282
Jeff Johnson175004c2018-10-23 12:03:16 -07004283static int hdd_we_set_max_tx_power_5_0(struct hdd_adapter *adapter, int power)
4284{
4285 QDF_STATUS status;
4286
4287 hdd_debug("power %d dBm", power);
4288 status = sme_set_max_tx_power_per_band(BAND_5G, power);
4289 if (QDF_IS_STATUS_ERROR(status))
4290 hdd_err("cfg set failed, value %d status %d", power, status);
4291
4292 return qdf_status_to_os_return(status);
4293}
4294
Jeff Johnson0187c622019-01-04 06:39:44 -08004295#ifdef HASTINGS_BT_WAR
4296
4297/*
4298 * replicate logic:
4299 * iwpriv wlan0 setUnitTestCmd 19 2 23 1 => enable WAR
4300 * iwpriv wlan0 setUnitTestCmd 19 2 23 0 => disable WAR
4301 */
4302
4303#define HASTINGS_WAR_FW_PARAM_ID 23
4304
4305static int hdd_hastings_bt_war_set_fw(struct hdd_context *hdd_ctx,
4306 uint32_t value)
4307{
4308 uint32_t vdev_id = 0; /* not used */
4309 uint32_t module_id = WLAN_MODULE_WAL;
4310 uint32_t arg_count = 2;
4311 uint32_t arg[2] = {HASTINGS_WAR_FW_PARAM_ID, value};
4312 QDF_STATUS status;
4313
4314 status = wma_form_unit_test_cmd_and_send(vdev_id, module_id,
4315 arg_count, arg);
4316
4317 return qdf_status_to_os_return(status);
4318}
4319
4320int hdd_hastings_bt_war_enable_fw(struct hdd_context *hdd_ctx)
4321{
4322 return hdd_hastings_bt_war_set_fw(hdd_ctx, 1);
4323}
4324
4325int hdd_hastings_bt_war_disable_fw(struct hdd_context *hdd_ctx)
4326{
4327 return hdd_hastings_bt_war_set_fw(hdd_ctx, 0);
4328}
4329
4330/* value to restore the config when the WAR is disabled */
4331static uint32_t iface_change_wait_time_checkpoint;
4332static void checkpoint_iface_change_wait_time(struct hdd_context *hdd_ctx)
4333{
4334 struct hdd_config *config = hdd_ctx->config;
4335
4336 /* did we already checkpoint a value ? */
4337 if (iface_change_wait_time_checkpoint)
4338 return;
4339
4340 /* checkpoint current value */
4341 iface_change_wait_time_checkpoint = config->iface_change_wait_time;
4342
4343 /* was the timer enabled when we checkpointed? */
4344 if (iface_change_wait_time_checkpoint)
4345 return;
4346
4347 /* WAR was enabled at boot, use default when disable */
4348 iface_change_wait_time_checkpoint =
4349 cfg_default(CFG_INTERFACE_CHANGE_WAIT);
4350}
4351
4352static int hdd_hastings_war_enable(struct hdd_context *hdd_ctx)
4353{
4354 struct hdd_config *config = hdd_ctx->config;
4355
4356 config->iface_change_wait_time = 0;
4357
4358 return hdd_hastings_bt_war_enable_fw(hdd_ctx);
4359}
4360
4361static int hdd_hastings_war_disable(struct hdd_context *hdd_ctx)
4362{
4363 struct hdd_config *config = hdd_ctx->config;
4364
4365 config->iface_change_wait_time = iface_change_wait_time_checkpoint;
4366
4367 return hdd_hastings_bt_war_disable_fw(hdd_ctx);
4368}
4369
4370static int hdd_we_set_hastings_bt_war(struct hdd_adapter *adapter, int enable)
4371{
4372 int errno;
4373 struct hdd_context *hdd_ctx;
4374
4375 errno = hdd_validate_adapter(adapter);
4376 if (errno)
4377 return errno;
4378
4379 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4380 checkpoint_iface_change_wait_time(hdd_ctx);
4381
4382 return enable ?
4383 hdd_hastings_war_enable(hdd_ctx) :
4384 hdd_hastings_war_disable(hdd_ctx);
4385}
4386#endif
4387
Jeff Johnson5bee39b2018-10-23 12:34:38 -07004388static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level)
4389{
4390 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4391 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4392 QDF_STATUS status;
4393
4394 if (!mac_handle)
4395 return -EINVAL;
4396
4397 hdd_debug("Thermal Mitigation Level %d", level);
4398 status = sme_set_thermal_level(mac_handle, level);
4399 if (QDF_IS_STATUS_ERROR(status))
4400 hdd_err("cfg set failed, value %d status %d", level, status);
4401
4402 return qdf_status_to_os_return(status);
4403}
4404
Jeff Johnson38912642018-10-24 15:01:40 -07004405static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss)
4406{
4407 QDF_STATUS status;
4408
4409 hdd_debug("NSS %d", nss);
4410
4411 if ((nss > 2) || (nss <= 0)) {
4412 hdd_err("Invalid NSS: %d", nss);
4413 return -EINVAL;
4414 }
4415
4416 status = hdd_update_nss(adapter, nss);
4417 if (QDF_IS_STATUS_ERROR(status))
4418 hdd_err("cfg set failed, value %d status %d", nss, status);
4419
4420 return qdf_status_to_os_return(status);
4421}
4422
Jeff Johnsonce996b32018-10-25 10:52:40 -07004423static int hdd_we_set_short_gi(struct hdd_adapter *adapter, int sgi)
4424{
4425 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
4426 int errno;
4427
4428 hdd_debug("Short GI %d", sgi);
4429
4430 if (!mac_handle) {
4431 hdd_err("NULL Mac handle");
4432 return -EINVAL;
4433 }
4434
4435 if (sgi & HDD_AUTO_RATE_SGI)
4436 errno = sme_set_auto_rate_he_sgi(mac_handle,
4437 adapter->session_id,
4438 sgi);
4439 else
4440 errno = sme_update_ht_config(mac_handle,
4441 adapter->session_id,
4442 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4443 sgi);
4444 if (errno)
4445 hdd_err("cfg set failed, value %d status %d", sgi, errno);
4446
4447 return errno;
4448}
4449
Jeff Johnson71d80382018-10-25 15:45:01 -07004450static int hdd_we_set_rtscts(struct hdd_adapter *adapter, int rtscts)
4451{
4452 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4453 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4454 uint32_t value;
4455 uint32_t rts_threshold_val;
4456 QDF_STATUS status;
4457 int errno;
4458
4459 hdd_debug("RTSCTS %d", rtscts);
4460
4461 if (!mac_handle) {
4462 hdd_err("NULL Mac handle");
4463 return -EINVAL;
4464 }
4465
4466 status = ucfg_mlme_get_rts_threshold(hdd_ctx->psoc,
4467 &rts_threshold_val);
4468 if (QDF_IS_STATUS_ERROR(status)) {
4469 hdd_err("Get rts threshold failed, status %d", status);
4470 return -EINVAL;
4471 }
4472
4473 if ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_RTSCTS_ENABLE) {
4474 value = rts_threshold_val;
4475 } else if (((rtscts & HDD_RTSCTS_EN_MASK) == 0) ||
4476 ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_CTS_ENABLE)) {
4477 value = cfg_max(CFG_RTS_THRESHOLD);
4478 } else {
4479 hdd_err_rl("Invalid value %d", rtscts);
4480 return -EINVAL;
4481 }
4482
4483 errno = wma_cli_set_command(adapter->session_id,
4484 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4485 rtscts, VDEV_CMD);
4486 if (errno) {
4487 hdd_err("Failed to set firmware, errno %d", errno);
4488 return errno;
4489 }
4490
4491 status = ucfg_mlme_set_rts_threshold(hdd_ctx->psoc, value);
4492 if (QDF_IS_STATUS_ERROR(status)) {
4493 hdd_err("Set rts threshold failed, status %d", status);
4494 return -EINVAL;
4495 }
4496
4497 return 0;
4498}
4499
Jeff Johnson50b15882018-10-26 10:27:37 -07004500static int hdd_we_set_11n_rate(struct hdd_adapter *adapter, int rate_code)
4501{
4502 uint8_t preamble = 0, nss = 0, rix = 0;
4503 int errno;
4504
4505 hdd_debug("Rate code %d", rate_code);
4506
4507 if (rate_code != 0xff) {
4508 rix = RC_2_RATE_IDX(rate_code);
4509 if (rate_code & 0x80) {
4510 preamble = WMI_RATE_PREAMBLE_HT;
4511 nss = HT_RC_2_STREAMS(rate_code) - 1;
4512 } else {
4513 nss = 0;
4514 rix = RC_2_RATE_IDX(rate_code);
4515 if (rate_code & 0x10) {
4516 preamble = WMI_RATE_PREAMBLE_CCK;
4517 if (rix != 0x3)
4518 /* Enable Short preamble
4519 * always for CCK except 1mbps
4520 */
4521 rix |= 0x4;
4522 } else {
4523 preamble = WMI_RATE_PREAMBLE_OFDM;
4524 }
4525 }
4526 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4527 }
4528
4529 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4530 rate_code, rix, preamble, nss);
4531
4532 errno = wma_cli_set_command(adapter->session_id,
4533 WMI_VDEV_PARAM_FIXED_RATE,
4534 rate_code, VDEV_CMD);
4535 if (errno)
4536 hdd_err("Failed to set firmware, errno %d", errno);
4537
4538 return errno;
4539}
4540
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004541static int hdd_we_set_vht_rate(struct hdd_adapter *adapter, int rate_code)
4542{
4543 uint8_t preamble = 0, nss = 0, rix = 0;
4544 int errno;
4545
4546 hdd_debug("Rate code %d", rate_code);
4547
4548 if (rate_code != 0xff) {
4549 rix = RC_2_RATE_IDX_11AC(rate_code);
4550 preamble = WMI_RATE_PREAMBLE_VHT;
4551 nss = HT_RC_2_STREAMS_11AC(rate_code) - 1;
4552 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4553 }
4554
4555 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4556 rate_code, rix, preamble, nss);
4557
4558 errno = wma_cli_set_command(adapter->session_id,
4559 WMI_VDEV_PARAM_FIXED_RATE,
4560 rate_code, VDEV_CMD);
4561 if (errno)
4562 hdd_err("Failed to set firmware, errno %d", errno);
4563
4564 return errno;
4565}
4566
Jeff Johnson7c433502018-11-12 15:00:52 -08004567static int hdd_we_set_ampdu(struct hdd_adapter *adapter, int ampdu)
4568{
4569 hdd_debug("AMPDU %d", ampdu);
4570
4571 return wma_cli_set_command(adapter->session_id,
4572 GEN_VDEV_PARAM_AMPDU,
4573 ampdu, GEN_CMD);
4574}
4575
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004576static int hdd_we_set_amsdu(struct hdd_adapter *adapter, int amsdu)
4577{
4578 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4579 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4580 int errno;
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304581 QDF_STATUS status;
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004582
4583 hdd_debug("AMSDU %d", amsdu);
4584
4585 if (!mac_handle) {
4586 hdd_err("NULL Mac handle");
4587 return -EINVAL;
4588 }
4589
4590 if (amsdu > 1)
4591 sme_set_amsdu(mac_handle, true);
4592 else
4593 sme_set_amsdu(mac_handle, false);
4594
4595 errno = wma_cli_set_command(adapter->session_id,
4596 GEN_VDEV_PARAM_AMSDU,
4597 amsdu, GEN_CMD);
4598 if (errno) {
4599 hdd_err("Failed to set firmware, errno %d", errno);
4600 return errno;
4601 }
4602
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304603 status = ucfg_mlme_set_max_amsdu_num(hdd_ctx->psoc,
4604 amsdu);
4605 if (QDF_IS_STATUS_ERROR(status))
4606 hdd_err("Failed to set Max AMSDU Num to cfg");
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004607
4608 return 0;
4609}
4610
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004611static int hdd_we_clear_stats(struct hdd_adapter *adapter, int option)
4612{
4613 hdd_debug("option %d", option);
4614
4615 switch (option) {
4616 case CDP_HDD_STATS:
4617 memset(&adapter->stats, 0, sizeof(adapter->stats));
4618 memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
4619 break;
4620 case CDP_TXRX_HIST_STATS:
4621 wlan_hdd_clear_tx_rx_histogram(adapter->hdd_ctx);
4622 break;
4623 case CDP_HDD_NETIF_OPER_HISTORY:
4624 wlan_hdd_clear_netif_queue_history(adapter->hdd_ctx);
4625 break;
4626 case CDP_HIF_STATS:
4627 hdd_clear_hif_stats();
4628 break;
4629 case CDP_NAPI_STATS:
4630 hdd_clear_napi_stats();
4631 break;
4632 default:
4633 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4634 option);
4635 }
4636
4637 return 0;
4638}
4639
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004640static int hdd_we_set_green_tx_param(struct hdd_adapter *adapter,
4641 green_tx_param id,
4642 const char *id_string,
4643 int value)
4644{
4645 int errno;
4646
4647 hdd_debug("%s %d", id_string, value);
4648 errno = wma_cli_set_command(adapter->session_id, id, value, GTX_CMD);
4649 if (errno)
4650 hdd_err("Failed to set firmware, errno %d", errno);
4651
4652 return errno;
4653}
4654
4655#define hdd_we_set_green_tx_param(adapter, id, value) \
4656 hdd_we_set_green_tx_param(adapter, id, #id, value)
4657
4658static int hdd_we_set_gtx_ht_mcs(struct hdd_adapter *adapter, int value)
4659{
4660 return hdd_we_set_green_tx_param(adapter,
4661 WMI_VDEV_PARAM_GTX_HT_MCS,
4662 value);
4663}
4664
4665static int hdd_we_set_gtx_vht_mcs(struct hdd_adapter *adapter, int value)
4666{
4667 return hdd_we_set_green_tx_param(adapter,
4668 WMI_VDEV_PARAM_GTX_VHT_MCS,
4669 value);
4670}
4671
4672static int hdd_we_set_gtx_usrcfg(struct hdd_adapter *adapter, int value)
4673{
4674 return hdd_we_set_green_tx_param(adapter,
4675 WMI_VDEV_PARAM_GTX_USR_CFG,
4676 value);
4677}
4678
4679static int hdd_we_set_gtx_thre(struct hdd_adapter *adapter, int value)
4680{
4681 return hdd_we_set_green_tx_param(adapter,
4682 WMI_VDEV_PARAM_GTX_THRE,
4683 value);
4684}
4685
4686static int hdd_we_set_gtx_margin(struct hdd_adapter *adapter, int value)
4687{
4688 return hdd_we_set_green_tx_param(adapter,
4689 WMI_VDEV_PARAM_GTX_MARGIN,
4690 value);
4691}
4692
4693static int hdd_we_set_gtx_step(struct hdd_adapter *adapter, int value)
4694{
4695 return hdd_we_set_green_tx_param(adapter,
4696 WMI_VDEV_PARAM_GTX_STEP,
4697 value);
4698}
4699
4700static int hdd_we_set_gtx_mintpc(struct hdd_adapter *adapter, int value)
4701{
4702 return hdd_we_set_green_tx_param(adapter,
4703 WMI_VDEV_PARAM_GTX_MINTPC,
4704 value);
4705}
4706
4707static int hdd_we_set_gtx_bwmask(struct hdd_adapter *adapter, int value)
4708{
4709 return hdd_we_set_green_tx_param(adapter,
4710 WMI_VDEV_PARAM_GTX_BW_MASK,
4711 value);
4712}
4713
Jeff Johnsond0477f22018-10-29 12:26:25 -07004714static int hdd_we_packet_power_save(struct hdd_adapter *adapter,
4715 packet_power_save id,
4716 const char *id_string,
4717 int value)
4718{
4719 int errno;
4720
4721 if (adapter->device_mode != QDF_STA_MODE) {
4722 hdd_err_rl("Not supported in mode %d", adapter->device_mode);
4723 return -EINVAL;
4724 }
4725
4726 hdd_debug("%s %d", id_string, value);
4727 errno = wma_cli_set_command(adapter->session_id, id, value, PPS_CMD);
4728 if (errno)
4729 hdd_err("Failed to set firmware, errno %d", errno);
4730
4731 return errno;
4732}
4733
4734#define hdd_we_packet_power_save(adapter, id, value) \
4735 hdd_we_packet_power_save(adapter, id, #id, value)
4736
4737static int hdd_we_pps_paid_match(struct hdd_adapter *adapter, int value)
4738{
4739 return hdd_we_packet_power_save(adapter,
4740 WMI_VDEV_PPS_PAID_MATCH,
4741 value);
4742}
4743
4744static int hdd_we_pps_gid_match(struct hdd_adapter *adapter, int value)
4745{
4746 return hdd_we_packet_power_save(adapter,
4747 WMI_VDEV_PPS_GID_MATCH,
4748 value);
4749}
4750
4751static int hdd_we_pps_early_tim_clear(struct hdd_adapter *adapter, int value)
4752{
4753 return hdd_we_packet_power_save(adapter,
4754 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4755 value);
4756}
4757
4758static int hdd_we_pps_early_dtim_clear(struct hdd_adapter *adapter, int value)
4759{
4760 return hdd_we_packet_power_save(adapter,
4761 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4762 value);
4763}
4764
4765static int hdd_we_pps_eof_pad_delim(struct hdd_adapter *adapter, int value)
4766{
4767 return hdd_we_packet_power_save(adapter,
4768 WMI_VDEV_PPS_EOF_PAD_DELIM,
4769 value);
4770}
4771
4772static int hdd_we_pps_macaddr_mismatch(struct hdd_adapter *adapter, int value)
4773{
4774 return hdd_we_packet_power_save(adapter,
4775 WMI_VDEV_PPS_MACADDR_MISMATCH,
4776 value);
4777}
4778
4779static int hdd_we_pps_delim_crc_fail(struct hdd_adapter *adapter, int value)
4780{
4781 return hdd_we_packet_power_save(adapter,
4782 WMI_VDEV_PPS_DELIM_CRC_FAIL,
4783 value);
4784}
4785
4786static int hdd_we_pps_gid_nsts_zero(struct hdd_adapter *adapter, int value)
4787{
4788 return hdd_we_packet_power_save(adapter,
4789 WMI_VDEV_PPS_GID_NSTS_ZERO,
4790 value);
4791}
4792
4793static int hdd_we_pps_rssi_check(struct hdd_adapter *adapter, int value)
4794{
4795 return hdd_we_packet_power_save(adapter,
4796 WMI_VDEV_PPS_RSSI_CHECK,
4797 value);
4798}
4799
4800static int hdd_we_pps_5g_ebt(struct hdd_adapter *adapter, int value)
4801{
4802 return hdd_we_packet_power_save(adapter,
4803 WMI_VDEV_PPS_5G_EBT,
4804 value);
4805}
4806
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07004807static int hdd_we_set_qpower(struct hdd_adapter *adapter,
4808 enum wmi_sta_powersave_param id,
4809 const char *id_string,
4810 int value)
4811{
4812 int errno;
4813
4814 hdd_debug("%s %d", id_string, value);
4815 errno = wma_cli_set_command(adapter->session_id, id, value, QPOWER_CMD);
4816 if (errno)
4817 hdd_err("Failed to set firmware, errno %d", errno);
4818
4819 return errno;
4820}
4821
4822#define hdd_we_set_qpower(adapter, id, value) \
4823 hdd_we_set_qpower(adapter, id, #id, value)
4824
4825static int
4826hdd_we_set_qpower_max_pspoll_count(struct hdd_adapter *adapter, int value)
4827{
4828 enum wmi_sta_powersave_param id =
4829 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT;
4830
4831 return hdd_we_set_qpower(adapter, id, value);
4832}
4833
4834static int
4835hdd_we_set_qpower_max_tx_before_wake(struct hdd_adapter *adapter, int value)
4836{
4837 enum wmi_sta_powersave_param id =
4838 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE;
4839
4840 return hdd_we_set_qpower(adapter, id, value);
4841}
4842
4843static int
4844hdd_we_set_qpower_spec_pspoll_wake_interval(struct hdd_adapter *adapter,
4845 int value)
4846{
4847 enum wmi_sta_powersave_param id =
4848 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL;
4849
4850 return hdd_we_set_qpower(adapter, id, value);
4851}
4852
4853static int
4854hdd_we_set_qpower_spec_max_spec_nodata_pspoll(struct hdd_adapter *adapter,
4855 int value)
4856{
4857 enum wmi_sta_powersave_param id =
4858 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL;
4859
4860 return hdd_we_set_qpower(adapter, id, value);
4861}
4862
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08004863static int hdd_we_set_pdev(struct hdd_adapter *adapter,
4864 WMI_PDEV_PARAM id,
4865 const char *id_string,
4866 int value)
4867{
4868 int errno;
4869
4870 hdd_debug("%s %d", id_string, value);
4871 errno = wma_cli_set_command(adapter->session_id, id, value, PDEV_CMD);
4872 if (errno)
4873 hdd_err("Failed to set firmware, errno %d", errno);
4874
4875 return errno;
4876}
4877
4878#define hdd_we_set_pdev(adapter, id, value) \
4879 hdd_we_set_pdev(adapter, id, #id, value)
4880
4881static int hdd_we_set_ani_en_dis(struct hdd_adapter *adapter, int value)
4882{
4883 return hdd_we_set_pdev(adapter,
4884 WMI_PDEV_PARAM_ANI_ENABLE,
4885 value);
4886}
4887
4888static int hdd_we_set_ani_poll_period(struct hdd_adapter *adapter, int value)
4889{
4890 return hdd_we_set_pdev(adapter,
4891 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
4892 value);
4893}
4894
4895static int hdd_we_set_ani_listen_period(struct hdd_adapter *adapter, int value)
4896{
4897 return hdd_we_set_pdev(adapter,
4898 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
4899 value);
4900}
4901
4902static int hdd_we_set_ani_ofdm_level(struct hdd_adapter *adapter, int value)
4903{
4904 return hdd_we_set_pdev(adapter,
4905 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
4906 value);
4907}
4908
4909static int hdd_we_set_ani_cck_level(struct hdd_adapter *adapter, int value)
4910{
4911 return hdd_we_set_pdev(adapter,
4912 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
4913 value);
4914}
4915
4916static int hdd_we_set_dynamic_bw(struct hdd_adapter *adapter, int value)
4917{
4918 return hdd_we_set_pdev(adapter,
4919 WMI_PDEV_PARAM_DYNAMIC_BW,
4920 value);
4921}
4922
4923static int hdd_we_set_cts_cbw(struct hdd_adapter *adapter, int value)
4924{
4925 return hdd_we_set_pdev(adapter,
4926 WMI_PDEV_PARAM_CTS_CBW,
4927 value);
4928}
4929
4930static int hdd_we_set_tx_chainmask(struct hdd_adapter *adapter, int value)
4931{
4932 int errno;
4933
4934 errno = hdd_we_set_pdev(adapter,
4935 WMI_PDEV_PARAM_TX_CHAIN_MASK,
4936 value);
4937 if (errno)
4938 return errno;
4939
4940 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
4941}
4942
4943static int hdd_we_set_rx_chainmask(struct hdd_adapter *adapter, int value)
4944{
4945 int errno;
4946
4947 errno = hdd_we_set_pdev(adapter,
4948 WMI_PDEV_PARAM_RX_CHAIN_MASK,
4949 value);
4950 if (errno)
4951 return errno;
4952
4953 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
4954}
4955
4956static int hdd_we_set_txpow_2g(struct hdd_adapter *adapter, int value)
4957{
4958 return hdd_we_set_pdev(adapter,
4959 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
4960 value);
4961}
4962
4963static int hdd_we_set_txpow_5g(struct hdd_adapter *adapter, int value)
4964{
4965 return hdd_we_set_pdev(adapter,
4966 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
4967 value);
4968}
4969
Jeff Johnson2e381272018-11-10 09:33:39 -08004970static int hdd_we_set_vdev(struct hdd_adapter *adapter,
4971 int id,
4972 const char *id_string,
4973 int value)
4974{
4975 int errno;
4976
4977 hdd_debug("%s %d", id_string, value);
4978 errno = wma_cli_set_command(adapter->session_id, id, value, VDEV_CMD);
4979 if (errno)
4980 hdd_err("Failed to set firmware, errno %d", errno);
4981
4982 return errno;
4983}
4984
4985#define hdd_we_set_vdev(adapter, id, value) \
4986 hdd_we_set_vdev(adapter, id, #id, value)
4987
4988static int hdd_we_set_txrx_fwstats(struct hdd_adapter *adapter, int value)
4989{
4990 return hdd_we_set_vdev(adapter,
4991 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
4992 value);
4993}
4994
4995static int hdd_we_txrx_fwstats_reset(struct hdd_adapter *adapter, int value)
4996{
4997 return hdd_we_set_vdev(adapter,
4998 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
4999 value);
5000}
5001
5002static int hdd_we_set_htsmps(struct hdd_adapter *adapter, int value)
5003{
5004 return hdd_we_set_vdev(adapter,
5005 WMI_STA_SMPS_FORCE_MODE_CMDID,
5006 value);
5007}
5008
5009static int hdd_we_set_early_rx_adjust_enable(struct hdd_adapter *adapter,
5010 int value)
5011{
5012 if ((value != 0) && (value != 1))
5013 return -EINVAL;
5014
5015 return hdd_we_set_vdev(adapter,
5016 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
5017 value);
5018}
5019
5020static int hdd_we_set_early_rx_tgt_bmiss_num(struct hdd_adapter *adapter,
5021 int value)
5022{
5023 return hdd_we_set_vdev(adapter,
5024 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
5025 value);
5026}
5027
5028static int hdd_we_set_early_rx_bmiss_sample_cycle(struct hdd_adapter *adapter,
5029 int value)
5030{
5031 return hdd_we_set_vdev(adapter,
5032 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
5033 value);
5034}
5035
5036static int hdd_we_set_early_rx_slop_step(struct hdd_adapter *adapter, int value)
5037{
5038 return hdd_we_set_vdev(adapter,
5039 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
5040 value);
5041}
5042
5043static int hdd_we_set_early_rx_init_slop(struct hdd_adapter *adapter, int value)
5044{
5045 return hdd_we_set_vdev(adapter,
5046 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
5047 value);
5048}
5049
5050static int hdd_we_set_early_rx_adjust_pause(struct hdd_adapter *adapter,
5051 int value)
5052{
5053 if ((value != 0) && (value != 1))
5054 return -EINVAL;
5055
5056 return hdd_we_set_vdev(adapter,
5057 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
5058 value);
5059}
5060
5061static int hdd_we_set_early_rx_drift_sample(struct hdd_adapter *adapter,
5062 int value)
5063{
5064 return hdd_we_set_vdev(adapter,
5065 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
5066 value);
5067}
5068
5069static int hdd_we_set_dcm(struct hdd_adapter *adapter, int value)
5070{
5071 return hdd_we_set_vdev(adapter,
5072 WMI_VDEV_PARAM_HE_DCM,
5073 value);
5074}
5075
5076static int hdd_we_set_range_ext(struct hdd_adapter *adapter, int value)
5077{
5078 return hdd_we_set_vdev(adapter,
5079 WMI_VDEV_PARAM_HE_RANGE_EXT,
5080 value);
5081}
5082
Jeff Johnson22e57f12018-11-10 16:02:00 -08005083static int hdd_we_set_dbg(struct hdd_adapter *adapter,
5084 int id,
5085 const char *id_string,
5086 int value)
5087{
5088 int errno;
5089
5090 hdd_debug("%s %d", id_string, value);
5091 errno = wma_cli_set_command(adapter->session_id, id, value, DBG_CMD);
5092 if (errno)
5093 hdd_err("Failed to set firmware, errno %d", errno);
5094
5095 return errno;
5096}
5097
5098#define hdd_we_set_dbg(adapter, id, value) \
5099 hdd_we_set_dbg(adapter, id, #id, value)
5100
5101static int hdd_we_dbglog_log_level(struct hdd_adapter *adapter, int value)
5102{
5103 return hdd_we_set_dbg(adapter,
5104 WMI_DBGLOG_LOG_LEVEL,
5105 value);
5106}
5107
5108static int hdd_we_dbglog_vap_enable(struct hdd_adapter *adapter, int value)
5109{
5110 return hdd_we_set_dbg(adapter,
5111 WMI_DBGLOG_VAP_ENABLE,
5112 value);
5113}
5114
5115static int hdd_we_dbglog_vap_disable(struct hdd_adapter *adapter, int value)
5116{
5117 return hdd_we_set_dbg(adapter,
5118 WMI_DBGLOG_VAP_DISABLE,
5119 value);
5120}
5121
5122static int hdd_we_dbglog_module_enable(struct hdd_adapter *adapter, int value)
5123{
5124 return hdd_we_set_dbg(adapter,
5125 WMI_DBGLOG_MODULE_ENABLE,
5126 value);
5127}
5128
5129static int hdd_we_dbglog_module_disable(struct hdd_adapter *adapter, int value)
5130{
5131 return hdd_we_set_dbg(adapter,
5132 WMI_DBGLOG_MODULE_DISABLE,
5133 value);
5134}
5135
5136static int hdd_we_dbglog_mod_log_level(struct hdd_adapter *adapter, int value)
5137{
5138 return hdd_we_set_dbg(adapter,
5139 WMI_DBGLOG_MOD_LOG_LEVEL,
5140 value);
5141}
5142
5143static int hdd_we_dbglog_type(struct hdd_adapter *adapter, int value)
5144{
5145 return hdd_we_set_dbg(adapter,
5146 WMI_DBGLOG_TYPE,
5147 value);
5148}
5149
5150static int hdd_we_dbglog_report_enable(struct hdd_adapter *adapter, int value)
5151{
5152 return hdd_we_set_dbg(adapter,
5153 WMI_DBGLOG_REPORT_ENABLE,
5154 value);
5155}
5156
5157static int hdd_we_start_fw_profile(struct hdd_adapter *adapter, int value)
5158{
5159 return hdd_we_set_dbg(adapter,
5160 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5161 value);
5162}
5163
Jeff Johnson274a1d62018-11-12 20:31:51 -08005164static int hdd_we_set_channel(struct hdd_adapter *adapter, int channel)
5165{
5166 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5167 QDF_STATUS status;
5168
5169 hdd_debug("Set Channel %d Session ID %d mode %d", channel,
5170 adapter->session_id, adapter->device_mode);
5171
5172 if (!hdd_ctx->mac_handle)
5173 return -EINVAL;
5174
5175 switch (adapter->device_mode) {
5176 case QDF_STA_MODE:
5177 case QDF_P2P_CLIENT_MODE:
5178 /* supported */
5179 break;
5180 default:
5181 hdd_err("change channel not supported for device mode %d",
5182 adapter->device_mode);
5183 return -EINVAL;
5184 }
5185
5186 status = sme_ext_change_channel(hdd_ctx->mac_handle, channel,
5187 adapter->session_id);
5188 if (status != QDF_STATUS_SUCCESS)
5189 hdd_err("Error in change channel status %d", status);
5190
5191 return qdf_status_to_os_return(status);
5192}
5193
Jeff Johnson0e07ca12018-11-12 21:04:45 -08005194static int hdd_we_mcc_config_latency(struct hdd_adapter *adapter, int latency)
5195{
5196 hdd_debug("MCC latency %d", latency);
5197
5198 wlan_hdd_set_mcc_latency(adapter, latency);
5199
5200 return 0;
5201}
5202
5203static int hdd_we_mcc_config_quota(struct hdd_adapter *adapter, int quota)
5204{
5205 hdd_debug("MCC quota %dms", quota);
5206
5207 return wlan_hdd_set_mcc_p2p_quota(adapter, quota);
5208}
5209
Jeff Johnson33ec1982018-11-12 21:40:33 -08005210static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value)
5211{
5212 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5213
5214 if (!hdd_ctx->mac_handle)
5215 return -EINVAL;
5216
5217 sme_update_connect_debug(hdd_ctx->mac_handle, value);
5218
5219 return 0;
5220}
5221
Jeff Johnsone50951c2018-11-13 12:20:23 -08005222static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value)
5223{
5224 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5225
5226 hdd_debug("%d", value);
5227
Abhishek Singh935e4772018-11-21 14:14:10 +05305228 if (!hdd_ctx->psoc)
Jeff Johnsone50951c2018-11-13 12:20:23 -08005229 return -EINVAL;
5230
Abhishek Singh935e4772018-11-21 14:14:10 +05305231 if (value)
5232 ucfg_scan_psoc_set_disable(hdd_ctx->psoc, REASON_USER_SPACE);
5233 else
5234 ucfg_scan_psoc_set_enable(hdd_ctx->psoc, REASON_USER_SPACE);
Jeff Johnsone50951c2018-11-13 12:20:23 -08005235
5236 return 0;
5237}
5238
Jeff Johnsond3f1efd2018-11-13 13:26:19 -08005239static int hdd_we_set_conc_system_pref(struct hdd_adapter *adapter,
5240 int preference)
5241{
5242 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5243
5244 hdd_debug("%d", preference);
5245
5246 if (!hdd_ctx->psoc)
5247 return -EINVAL;
5248
5249 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, preference);
5250
5251 return 0;
5252}
5253
Jeff Johnson74696bb2018-11-13 13:30:36 -08005254static int hdd_we_set_11ax_rate(struct hdd_adapter *adapter, int rate)
5255{
5256 return hdd_set_11ax_rate(adapter, rate, NULL);
5257}
5258
Jeff Johnsonb43ec122018-11-13 14:17:08 -08005259static int hdd_we_set_modulated_dtim(struct hdd_adapter *adapter, int value)
5260{
5261 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5262
5263 hdd_debug("%d", value);
5264
5265 if (!hdd_ctx->psoc)
5266 return -EINVAL;
5267
5268 if ((value < cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM)) ||
5269 (value > cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM))) {
5270 hdd_err("Invalid value %d", value);
5271 return -EINVAL;
5272 }
5273
5274 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, value);
5275
5276 return 0;
5277}
5278
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305279#ifdef WLAN_FEATURE_MOTION_DETECTION
5280/**
5281 * hdd_we_motion_det_start_stop - start/stop motion detection
5282 * @adapter: hdd adapter
5283 * @value: start/stop value to set
5284 *
5285 * Return: 0 on success, error on failure
5286 */
5287static int hdd_we_motion_det_start_stop(struct hdd_adapter *adapter, int value)
5288{
5289 struct sme_motion_det_en motion_det;
5290 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5291
5292 if (value < 0 || value > 1) {
5293 hdd_err("Invalid value %d in mt_start", value);
5294 return -EINVAL;
5295 }
5296 motion_det.vdev_id = adapter->session_id;
5297 motion_det.enable = value;
5298
5299 if (!value)
5300 adapter->motion_detection_mode = 0;
5301
5302 sme_motion_det_enable(hdd_ctx->mac_handle, &motion_det);
5303
5304 return 0;
5305}
5306
5307/**
5308 * hdd_we_motion_det_base_line_start_stop - start/stop md baselining
5309 * @adapter: hdd adapter
5310 * @value: start/stop value to set
5311 *
5312 * Return: 0 on success, error on failure
5313 */
5314static int hdd_we_motion_det_base_line_start_stop(struct hdd_adapter *adapter,
5315 int value)
5316{
5317 struct sme_motion_det_base_line_en motion_det_base_line;
5318 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5319
5320 if (value < 0 || value > 1) {
5321 hdd_err("Invalid value %d in mt_bl_start", value);
5322 return -EINVAL;
5323 }
5324
5325 motion_det_base_line.vdev_id = adapter->session_id;
5326 motion_det_base_line.enable = value;
5327 sme_motion_det_base_line_enable(hdd_ctx->mac_handle,
5328 &motion_det_base_line);
5329
5330 return 0;
5331}
5332#endif /* WLAN_FEATURE_MOTION_DETECTION */
5333
Jeff Johnson3ba27322018-11-13 17:58:28 -08005334typedef int (*setint_getnone_fn)(struct hdd_adapter *adapter, int value);
5335static const setint_getnone_fn setint_getnone_cb[] = {
5336 [WE_SET_11D_STATE] = hdd_we_set_11d_state,
5337 [WE_SET_POWER] = hdd_we_set_power,
5338 [WE_SET_MAX_ASSOC] = hdd_we_set_max_assoc,
5339 [WE_SET_DATA_INACTIVITY_TO] = hdd_we_set_data_inactivity_timeout,
5340 [WE_SET_WOW_DATA_INACTIVITY_TO] =
5341 hdd_we_set_wow_data_inactivity_timeout,
5342 [WE_SET_MC_RATE] = wlan_hdd_set_mc_rate,
5343 [WE_SET_TX_POWER] = hdd_we_set_tx_power,
5344 [WE_SET_MAX_TX_POWER] = hdd_we_set_max_tx_power,
5345 [WE_SET_MAX_TX_POWER_2_4] = hdd_we_set_max_tx_power_2_4,
5346 [WE_SET_MAX_TX_POWER_5_0] = hdd_we_set_max_tx_power_5_0,
Jeff Johnson0187c622019-01-04 06:39:44 -08005347#ifdef HASTINGS_BT_WAR
5348 [WE_SET_HASTINGS_BT_WAR] = hdd_we_set_hastings_bt_war,
5349#endif
Jeff Johnson3ba27322018-11-13 17:58:28 -08005350 [WE_SET_TM_LEVEL] = hdd_we_set_tm_level,
5351 [WE_SET_PHYMODE] = wlan_hdd_update_phymode,
5352 [WE_SET_NSS] = hdd_we_set_nss,
5353 [WE_SET_GTX_HT_MCS] = hdd_we_set_gtx_ht_mcs,
5354 [WE_SET_GTX_VHT_MCS] = hdd_we_set_gtx_vht_mcs,
5355 [WE_SET_GTX_USRCFG] = hdd_we_set_gtx_usrcfg,
5356 [WE_SET_GTX_THRE] = hdd_we_set_gtx_thre,
5357 [WE_SET_GTX_MARGIN] = hdd_we_set_gtx_margin,
5358 [WE_SET_GTX_STEP] = hdd_we_set_gtx_step,
5359 [WE_SET_GTX_MINTPC] = hdd_we_set_gtx_mintpc,
5360 [WE_SET_GTX_BWMASK] = hdd_we_set_gtx_bwmask,
5361 [WE_SET_LDPC] = hdd_set_ldpc,
5362 [WE_SET_TX_STBC] = hdd_set_tx_stbc,
5363 [WE_SET_RX_STBC] = hdd_set_rx_stbc,
5364 [WE_SET_SHORT_GI] = hdd_we_set_short_gi,
5365 [WE_SET_RTSCTS] = hdd_we_set_rtscts,
5366 [WE_SET_CHWIDTH] = hdd_we_set_ch_width,
5367 [WE_SET_ANI_EN_DIS] = hdd_we_set_ani_en_dis,
5368 [WE_SET_ANI_POLL_PERIOD] = hdd_we_set_ani_poll_period,
5369 [WE_SET_ANI_LISTEN_PERIOD] = hdd_we_set_ani_listen_period,
5370 [WE_SET_ANI_OFDM_LEVEL] = hdd_we_set_ani_ofdm_level,
5371 [WE_SET_ANI_CCK_LEVEL] = hdd_we_set_ani_cck_level,
5372 [WE_SET_DYNAMIC_BW] = hdd_we_set_dynamic_bw,
5373 [WE_SET_CTS_CBW] = hdd_we_set_cts_cbw,
5374 [WE_SET_11N_RATE] = hdd_we_set_11n_rate,
5375 [WE_SET_VHT_RATE] = hdd_we_set_vht_rate,
5376 [WE_SET_AMPDU] = hdd_we_set_ampdu,
5377 [WE_SET_AMSDU] = hdd_we_set_amsdu,
5378 [WE_SET_TX_CHAINMASK] = hdd_we_set_tx_chainmask,
5379 [WE_SET_RX_CHAINMASK] = hdd_we_set_rx_chainmask,
5380 [WE_SET_TXPOW_2G] = hdd_we_set_txpow_2g,
5381 [WE_SET_TXPOW_5G] = hdd_we_set_txpow_5g,
5382 [WE_DBGLOG_LOG_LEVEL] = hdd_we_dbglog_log_level,
5383 [WE_DBGLOG_VAP_ENABLE] = hdd_we_dbglog_vap_enable,
5384 [WE_DBGLOG_VAP_DISABLE] = hdd_we_dbglog_vap_disable,
5385 [WE_DBGLOG_MODULE_ENABLE] = hdd_we_dbglog_module_enable,
5386 [WE_DBGLOG_MODULE_DISABLE] = hdd_we_dbglog_module_disable,
5387 [WE_DBGLOG_MOD_LOG_LEVEL] = hdd_we_dbglog_mod_log_level,
5388 [WE_DBGLOG_TYPE] = hdd_we_dbglog_type,
5389 [WE_DBGLOG_REPORT_ENABLE] = hdd_we_dbglog_report_enable,
5390 [WE_SET_TXRX_FWSTATS] = hdd_we_set_txrx_fwstats,
5391 [WE_TXRX_FWSTATS_RESET] = hdd_we_txrx_fwstats_reset,
5392 [WE_DUMP_STATS] = hdd_wlan_dump_stats,
5393 [WE_CLEAR_STATS] = hdd_we_clear_stats,
5394 [WE_PPS_PAID_MATCH] = hdd_we_pps_paid_match,
5395 [WE_PPS_GID_MATCH] = hdd_we_pps_gid_match,
5396 [WE_PPS_EARLY_TIM_CLEAR] = hdd_we_pps_early_tim_clear,
5397 [WE_PPS_EARLY_DTIM_CLEAR] = hdd_we_pps_early_dtim_clear,
5398 [WE_PPS_EOF_PAD_DELIM] = hdd_we_pps_eof_pad_delim,
5399 [WE_PPS_MACADDR_MISMATCH] = hdd_we_pps_macaddr_mismatch,
5400 [WE_PPS_DELIM_CRC_FAIL] = hdd_we_pps_delim_crc_fail,
5401 [WE_PPS_GID_NSTS_ZERO] = hdd_we_pps_gid_nsts_zero,
5402 [WE_PPS_RSSI_CHECK] = hdd_we_pps_rssi_check,
5403 [WE_PPS_5G_EBT] = hdd_we_pps_5g_ebt,
5404 [WE_SET_HTSMPS] = hdd_we_set_htsmps,
5405 [WE_SET_QPOWER_MAX_PSPOLL_COUNT] = hdd_we_set_qpower_max_pspoll_count,
5406 [WE_SET_QPOWER_MAX_TX_BEFORE_WAKE] =
5407 hdd_we_set_qpower_max_tx_before_wake,
5408 [WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL] =
5409 hdd_we_set_qpower_spec_pspoll_wake_interval,
5410 [WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL] =
5411 hdd_we_set_qpower_spec_max_spec_nodata_pspoll,
5412 [WE_MCC_CONFIG_LATENCY] = hdd_we_mcc_config_latency,
5413 [WE_MCC_CONFIG_QUOTA] = hdd_we_mcc_config_quota,
5414 [WE_SET_DEBUG_LOG] = hdd_we_set_debug_log,
5415 [WE_SET_EARLY_RX_ADJUST_ENABLE] = hdd_we_set_early_rx_adjust_enable,
5416 [WE_SET_EARLY_RX_TGT_BMISS_NUM] = hdd_we_set_early_rx_tgt_bmiss_num,
5417 [WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE] =
5418 hdd_we_set_early_rx_bmiss_sample_cycle,
5419 [WE_SET_EARLY_RX_SLOP_STEP] = hdd_we_set_early_rx_slop_step,
5420 [WE_SET_EARLY_RX_INIT_SLOP] = hdd_we_set_early_rx_init_slop,
5421 [WE_SET_EARLY_RX_ADJUST_PAUSE] = hdd_we_set_early_rx_adjust_pause,
5422 [WE_SET_EARLY_RX_DRIFT_SAMPLE] = hdd_we_set_early_rx_drift_sample,
5423 [WE_SET_SCAN_DISABLE] = hdd_we_set_scan_disable,
5424 [WE_START_FW_PROFILE] = hdd_we_start_fw_profile,
5425 [WE_SET_CHANNEL] = hdd_we_set_channel,
5426 [WE_SET_CONC_SYSTEM_PREF] = hdd_we_set_conc_system_pref,
5427 [WE_SET_11AX_RATE] = hdd_we_set_11ax_rate,
5428 [WE_SET_DCM] = hdd_we_set_dcm,
5429 [WE_SET_RANGE_EXT] = hdd_we_set_range_ext,
5430 [WE_SET_PDEV_RESET] = hdd_handle_pdev_reset,
5431 [WE_SET_MODULATED_DTIM] = hdd_we_set_modulated_dtim,
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305432#ifdef WLAN_FEATURE_MOTION_DETECTION
5433 [WE_MOTION_DET_START_STOP] = hdd_we_motion_det_start_stop,
5434 [WE_MOTION_DET_BASE_LINE_START_STOP] =
5435 hdd_we_motion_det_base_line_start_stop,
5436#endif /* WLAN_FEATURE_MOTION_DETECTION */
Jeff Johnson3ba27322018-11-13 17:58:28 -08005437};
5438
5439static setint_getnone_fn hdd_get_setint_getnone_cb(int param)
5440{
5441 if (param < 0)
5442 return NULL;
5443
5444 if (param >= QDF_ARRAY_SIZE(setint_getnone_cb))
5445 return NULL;
5446
5447 return setint_getnone_cb[param];
5448}
5449
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005450/**
5451 * iw_setint_getnone() - Generic "set integer" private ioctl handler
5452 * @dev: device upon which the ioctl was received
5453 * @info: ioctl request information
5454 * @wrqu: ioctl request data
5455 * @extra: ioctl extra data
5456 *
5457 * Return: 0 on success, non-zero on error
5458 */
5459static int __iw_setint_getnone(struct net_device *dev,
5460 struct iw_request_info *info,
5461 union iwreq_data *wrqu, char *extra)
5462{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005463 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005464 struct hdd_context *hdd_ctx;
Jeff Johnson3ba27322018-11-13 17:58:28 -08005465 setint_getnone_fn cb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005466 int *value = (int *)extra;
5467 int sub_cmd = value[0];
5468 int set_value = value[1];
5469 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005470
Dustin Brownfdf17c12018-03-14 12:55:34 -07005471 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305472
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005473 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005474 ret = wlan_hdd_validate_context(hdd_ctx);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005475 if (ret)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005476 return ret;
5477
Jeff Johnson441e1f72017-02-07 08:50:49 -08005478 ret = hdd_check_private_wext_control(hdd_ctx, info);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005479 if (ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08005480 return ret;
5481
Jeff Johnson3ba27322018-11-13 17:58:28 -08005482 cb = hdd_get_setint_getnone_cb(sub_cmd);
5483 if (!cb) {
Rajeev Kumard0565362018-03-01 12:02:01 -08005484 hdd_debug("Invalid sub command %d", sub_cmd);
Jeff Johnson3ba27322018-11-13 17:58:28 -08005485 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005486 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005487
Jeff Johnson3ba27322018-11-13 17:58:28 -08005488 ret = cb(adapter, set_value);
5489
Dustin Browne74003f2018-03-14 12:51:58 -07005490 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005491
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005492 return ret;
5493}
5494
5495static int iw_setint_getnone(struct net_device *dev,
5496 struct iw_request_info *info,
5497 union iwreq_data *wrqu,
5498 char *extra)
5499{
5500 int ret;
5501
5502 cds_ssr_protect(__func__);
5503 ret = __iw_setint_getnone(dev, info, wrqu, extra);
5504 cds_ssr_unprotect(__func__);
5505
5506 return ret;
5507}
5508
5509/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005510 * __iw_setnone_get_threeint() - return three value to up layer.
5511 *
5512 * @dev: pointer of net_device of this wireless card
5513 * @info: meta data about Request sent
5514 * @wrqu: include request info
5515 * @extra: buf used for in/Output
5516 *
5517 * Return: execute result
5518 */
5519static int __iw_setnone_get_threeint(struct net_device *dev,
5520 struct iw_request_info *info,
5521 union iwreq_data *wrqu, char *extra)
5522{
5523 int ret = 0; /* success */
5524 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005525 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005526 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005527
Dustin Brownfdf17c12018-03-14 12:55:34 -07005528 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005529 ret = wlan_hdd_validate_context(hdd_ctx);
5530 if (0 != ret)
5531 return ret;
5532
Jeff Johnson441e1f72017-02-07 08:50:49 -08005533 ret = hdd_check_private_wext_control(hdd_ctx, info);
5534 if (0 != ret)
5535 return ret;
5536
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005537 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005538 switch (value[0]) {
5539 case WE_GET_TSF:
5540 ret = hdd_indicate_tsf(adapter, value, 3);
5541 break;
5542 default:
5543 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5544 break;
5545 }
5546 return ret;
5547}
5548
5549/**
5550 * iw_setnone_get_threeint() - return three value to up layer.
5551 *
5552 * @dev: pointer of net_device of this wireless card
5553 * @info: meta data about Request sent
5554 * @wrqu: include request info
5555 * @extra: buf used for in/Output
5556 *
5557 * Return: execute result
5558 */
5559static int iw_setnone_get_threeint(struct net_device *dev,
5560 struct iw_request_info *info,
5561 union iwreq_data *wrqu, char *extra)
5562{
5563 int ret;
5564
5565 cds_ssr_protect(__func__);
5566 ret = __iw_setnone_get_threeint(dev, info, wrqu, extra);
5567 cds_ssr_unprotect(__func__);
5568
5569 return ret;
5570}
5571
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005572#ifdef WLAN_UNIT_TEST
Dustin Brown7d038e52018-11-29 14:28:13 -08005573typedef uint32_t (*hdd_ut_callback)(void);
5574
5575struct hdd_ut_entry {
5576 const hdd_ut_callback callback;
5577 const char *name;
5578};
5579
5580struct hdd_ut_entry hdd_ut_entries[] = {
5581 { .name = "dsc", .callback = dsc_unit_test },
Dustin Brown6fb7a752018-11-30 11:33:57 -08005582 { .name = "ht", .callback = qdf_ht_unit_test },
Dustin Brownd315c452018-11-27 11:28:48 -08005583 { .name = "talloc", .callback = qdf_talloc_unit_test },
Dustin Brownebb16d12018-11-29 17:52:07 -08005584 { .name = "types", .callback = qdf_types_unit_test },
Dustin Brown7d038e52018-11-29 14:28:13 -08005585};
5586
5587#define hdd_for_each_ut_entry(cursor) \
5588 for (cursor = hdd_ut_entries; \
5589 cursor < hdd_ut_entries + ARRAY_SIZE(hdd_ut_entries); \
5590 cursor++)
5591
5592static struct hdd_ut_entry *hdd_ut_lookup(const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005593{
Dustin Brown7d038e52018-11-29 14:28:13 -08005594 struct hdd_ut_entry *entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005595
Dustin Brown7d038e52018-11-29 14:28:13 -08005596 hdd_for_each_ut_entry(entry) {
5597 if (qdf_str_eq(entry->name, name))
5598 return entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005599 }
5600
Dustin Brown7d038e52018-11-29 14:28:13 -08005601 return NULL;
5602}
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005603
Dustin Brown7d038e52018-11-29 14:28:13 -08005604static uint32_t hdd_ut_single(const struct hdd_ut_entry *entry)
5605{
5606 uint32_t errors;
5607
5608 hdd_nofl_info("START: '%s'", entry->name);
5609
5610 errors = entry->callback();
5611 if (errors)
5612 hdd_nofl_err("FAIL: '%s' with %u errors", entry->name, errors);
5613 else
5614 hdd_nofl_info("PASS: '%s'", entry->name);
5615
5616 return errors;
5617}
5618
5619static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
5620{
5621 struct hdd_ut_entry *entry;
5622 uint32_t errors = 0;
5623
5624 hdd_nofl_info("Unit tests begin");
5625
5626 if (!name || !name[0] || qdf_str_eq(name, "all")) {
5627 hdd_for_each_ut_entry(entry)
5628 errors += hdd_ut_single(entry);
5629 } else {
5630 entry = hdd_ut_lookup(name);
5631 if (entry)
5632 errors += hdd_ut_single(entry);
5633 else
5634 hdd_nofl_err("Unit test '%s' not found", name);
5635 }
5636
5637 hdd_nofl_info("Unit tests complete");
5638
5639 return errors ? -EPERM : 0;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005640}
5641#else
Dustin Brown7d038e52018-11-29 14:28:13 -08005642static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005643{
5644 return -EOPNOTSUPP;
5645}
5646#endif /* WLAN_UNIT_TEST */
5647
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005648/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005649 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5650 * @dev: device upon which the ioctl was received
5651 * @info: ioctl request information
5652 * @wrqu: ioctl request data
5653 * @extra: ioctl extra data
5654 *
5655 * Return: 0 on success, non-zero on error
5656 */
5657static int __iw_setchar_getnone(struct net_device *dev,
5658 struct iw_request_info *info,
5659 union iwreq_data *wrqu, char *extra)
5660{
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005661 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005662 int sub_cmd;
5663 int ret;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005664 char *str_arg = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005665 struct hdd_adapter *adapter = (netdev_priv(dev));
5666 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005667 struct iw_point s_priv_data;
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005668 bool neighbor_report_req_support = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005669
Dustin Brownfdf17c12018-03-14 12:55:34 -07005670 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005671
Mukul Sharma34777c62015-11-02 20:22:30 +05305672 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005673 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305674 return -EPERM;
5675 }
5676
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005677 ret = wlan_hdd_validate_context(hdd_ctx);
5678 if (0 != ret)
5679 return ret;
5680
Jeff Johnson441e1f72017-02-07 08:50:49 -08005681 ret = hdd_check_private_wext_control(hdd_ctx, info);
5682 if (0 != ret)
5683 return ret;
5684
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005685 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005686 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005687 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005688
5689 /* make sure all params are correctly passed to function */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005690 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005691 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005692
5693 sub_cmd = s_priv_data.flags;
5694
5695 /* ODD number is used for set, copy data using copy_from_user */
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005696 str_arg = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005697 s_priv_data.length);
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005698 if (!str_arg) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005699 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005700 return -ENOMEM;
5701 }
5702
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005703 hdd_debug("Received length: %d data: %s",
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005704 s_priv_data.length, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005705
5706 switch (sub_cmd) {
5707 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005708 hdd_debug("ADD_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305709 if (!hdd_add_wowl_ptrn(adapter, str_arg))
5710 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005711 break;
5712 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005713 hdd_debug("DEL_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305714 if (!hdd_del_wowl_ptrn(adapter, str_arg))
5715 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005716 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005717 case WE_NEIGHBOR_REPORT_REQUEST:
5718 {
5719 tRrmNeighborReq neighborReq;
5720 tRrmNeighborRspCallbackInfo callbackInfo;
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305721 bool rrm_enabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005722
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05305723 ucfg_wlan_mlme_get_rrm_enabled(hdd_ctx->psoc,
5724 &rrm_enabled);
5725
5726 if (rrm_enabled) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305727 neighborReq.neighbor_report_offload = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005728 neighborReq.no_ssid =
5729 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305730 hdd_debug("Neighbor Request ssid present %d",
5731 neighborReq.no_ssid);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005732 if (!neighborReq.no_ssid) {
5733 neighborReq.ssid.length =
5734 (s_priv_data.length - 1) >
5735 32 ? 32 : (s_priv_data.length - 1);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05305736 qdf_mem_copy(neighborReq.ssid.ssId,
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005737 str_arg,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005738 neighborReq.ssid.length);
5739 }
5740
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305741 /*
5742 * If 11k offload is supported by FW and enabled
5743 * in the ini, set the offload to true
5744 */
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005745 if (QDF_IS_STATUS_ERROR(
5746 ucfg_fwol_is_neighbor_report_req_supported(
5747 hdd_ctx->psoc, &neighbor_report_req_support)))
5748 hdd_err("Neighbor report req bit get fail");
5749
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305750 if (hdd_ctx->config->is_11k_offload_supported &&
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005751 neighbor_report_req_support) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305752 hdd_debug("Neighbor report offloaded to FW");
5753 neighborReq.neighbor_report_offload = true;
5754 }
5755
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005756 callbackInfo.neighborRspCallback = NULL;
5757 callbackInfo.neighborRspCallbackContext = NULL;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305758 callbackInfo.timeout = 5000; /* 5 seconds */
5759 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005760 hdd_ctx->mac_handle,
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05305761 adapter->session_id,
5762 &neighborReq,
5763 &callbackInfo);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005764 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005765 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005766 ret = -EINVAL;
5767 }
5768 }
5769 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005770 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08005771 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005772 break;
5773 case WE_SET_CONFIG:
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005774 status = hdd_execute_global_config_command(hdd_ctx, str_arg);
5775 if (QDF_IS_STATUS_ERROR(status))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005776 ret = -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005777
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005778 break;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005779 case WE_UNIT_TEST:
5780 ret = hdd_we_unit_test(hdd_ctx, str_arg);
5781 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005782 default:
5783 {
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005784 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005785 ret = -EINVAL;
5786 break;
5787 }
5788 }
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005789
5790 qdf_mem_free(str_arg);
Dustin Browne74003f2018-03-14 12:51:58 -07005791 hdd_exit();
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005792
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005793 return ret;
5794}
5795
5796static int iw_setchar_getnone(struct net_device *dev,
5797 struct iw_request_info *info,
5798 union iwreq_data *wrqu, char *extra)
5799{
5800 int ret;
5801
5802 cds_ssr_protect(__func__);
5803 ret = __iw_setchar_getnone(dev, info, wrqu, extra);
5804 cds_ssr_unprotect(__func__);
5805
5806 return ret;
5807}
5808
5809/**
5810 * iw_setnone_getint() - Generic "get integer" private ioctl handler
5811 * @dev: device upon which the ioctl was received
5812 * @info: ioctl request information
5813 * @wrqu: ioctl request data
5814 * @extra: ioctl extra data
5815 *
5816 * Return: 0 on success, non-zero on error
5817 */
5818static int __iw_setnone_getint(struct net_device *dev,
5819 struct iw_request_info *info,
5820 union iwreq_data *wrqu, char *extra)
5821{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005822 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005823 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005824 int *value = (int *)extra;
5825 int ret;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305826 tSmeConfigParams *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005827 struct hdd_context *hdd_ctx;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05305828 QDF_STATUS status;
5829 bool bval = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005830
Dustin Brownfdf17c12018-03-14 12:55:34 -07005831 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305832
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005833 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005834 ret = wlan_hdd_validate_context(hdd_ctx);
5835 if (0 != ret)
5836 return ret;
5837
Jeff Johnson441e1f72017-02-07 08:50:49 -08005838 ret = hdd_check_private_wext_control(hdd_ctx, info);
5839 if (0 != ret)
5840 return ret;
5841
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08005842 sme_config = qdf_mem_malloc(sizeof(*sme_config));
5843 if (!sme_config) {
5844 hdd_err("failed to allocate memory for sme_config");
5845 return -ENOMEM;
5846 }
5847
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005848 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005849 switch (value[0]) {
5850 case WE_GET_11D_STATE:
5851 {
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05305852 status = ucfg_mlme_is_11d_enabled(hdd_ctx->psoc, &bval);
5853 if (!QDF_IS_STATUS_SUCCESS(status))
5854 hdd_err("Invalid 11d_enable flag");
5855 *value = bval;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005856 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005857
5858 break;
5859 }
5860
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005861 case WE_GET_WLAN_DBG:
5862 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05305863 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005864 *value = 0;
5865 break;
5866 }
5867 case WE_GET_MAX_ASSOC:
5868 {
Dustin Brown05d81302018-09-11 16:49:22 -07005869 if (ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, *value) !=
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05305870 QDF_STATUS_SUCCESS) {
5871 hdd_err("CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005872 ret = -EIO;
5873 }
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05305874
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005875 break;
5876 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005877
5878 case WE_GET_CONCURRENCY_MODE:
5879 {
Dustin Brown05d81302018-09-11 16:49:22 -07005880 *value = policy_mgr_get_concurrency_mode(hdd_ctx->psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005881
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005882 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005883 break;
5884 }
5885
5886 case WE_GET_NSS:
5887 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07005888 sme_get_config_param(mac_handle, sme_config);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05305889 status = ucfg_mlme_get_vht_enable2x2(hdd_ctx->psoc, &bval);
5890 if (!QDF_IS_STATUS_SUCCESS(status))
5891 hdd_err("unable to get vht_enable2x2");
5892 *value = (bval == 0) ? 1 : 2;
Dustin Brown05d81302018-09-11 16:49:22 -07005893 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc))
Srinivas Girigowda576b2352017-08-25 14:44:26 -07005894 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005895 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005896 break;
5897 }
5898
5899 case WE_GET_GTX_HT_MCS:
5900 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005901 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005902 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005903 WMI_VDEV_PARAM_GTX_HT_MCS,
5904 GTX_CMD);
5905 break;
5906 }
5907
5908 case WE_GET_GTX_VHT_MCS:
5909 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005910 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005911 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005912 WMI_VDEV_PARAM_GTX_VHT_MCS,
5913 GTX_CMD);
5914 break;
5915 }
5916
5917 case WE_GET_GTX_USRCFG:
5918 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005919 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005920 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005921 WMI_VDEV_PARAM_GTX_USR_CFG,
5922 GTX_CMD);
5923 break;
5924 }
5925
5926 case WE_GET_GTX_THRE:
5927 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005928 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005929 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005930 WMI_VDEV_PARAM_GTX_THRE,
5931 GTX_CMD);
5932 break;
5933 }
5934
5935 case WE_GET_GTX_MARGIN:
5936 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005937 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005938 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005939 WMI_VDEV_PARAM_GTX_MARGIN,
5940 GTX_CMD);
5941 break;
5942 }
5943
5944 case WE_GET_GTX_STEP:
5945 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005946 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005947 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005948 WMI_VDEV_PARAM_GTX_STEP,
5949 GTX_CMD);
5950 break;
5951 }
5952
5953 case WE_GET_GTX_MINTPC:
5954 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005955 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005956 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005957 WMI_VDEV_PARAM_GTX_MINTPC,
5958 GTX_CMD);
5959 break;
5960 }
5961
5962 case WE_GET_GTX_BWMASK:
5963 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005964 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005965 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005966 WMI_VDEV_PARAM_GTX_BW_MASK,
5967 GTX_CMD);
5968 break;
5969 }
5970
5971 case WE_GET_LDPC:
5972 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005973 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005974 break;
5975 }
5976
5977 case WE_GET_TX_STBC:
5978 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005979 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005980 break;
5981 }
5982
5983 case WE_GET_RX_STBC:
5984 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005985 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005986 break;
5987 }
5988
5989 case WE_GET_SHORT_GI:
5990 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005991 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnson1b780e42017-10-31 14:11:45 -07005992 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08005993 WMI_VDEV_PARAM_SGI,
5994 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005995 break;
5996 }
5997
5998 case WE_GET_RTSCTS:
5999 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006000 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006001 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006002 WMI_VDEV_PARAM_ENABLE_RTSCTS,
6003 VDEV_CMD);
6004 break;
6005 }
6006
6007 case WE_GET_CHWIDTH:
6008 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006009 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006010 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006011 WMI_VDEV_PARAM_CHWIDTH,
6012 VDEV_CMD);
6013 break;
6014 }
6015
6016 case WE_GET_ANI_EN_DIS:
6017 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006018 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006019 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006020 WMI_PDEV_PARAM_ANI_ENABLE,
6021 PDEV_CMD);
6022 break;
6023 }
6024
6025 case WE_GET_ANI_POLL_PERIOD:
6026 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006027 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006028 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006029 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
6030 PDEV_CMD);
6031 break;
6032 }
6033
6034 case WE_GET_ANI_LISTEN_PERIOD:
6035 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006036 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006037 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006038 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
6039 PDEV_CMD);
6040 break;
6041 }
6042
6043 case WE_GET_ANI_OFDM_LEVEL:
6044 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006045 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006046 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006047 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
6048 PDEV_CMD);
6049 break;
6050 }
6051
6052 case WE_GET_ANI_CCK_LEVEL:
6053 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006054 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006055 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006056 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
6057 PDEV_CMD);
6058 break;
6059 }
6060
6061 case WE_GET_DYNAMIC_BW:
6062 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006063 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006064 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006065 WMI_PDEV_PARAM_DYNAMIC_BW,
6066 PDEV_CMD);
6067 break;
6068 }
6069
6070 case WE_GET_11N_RATE:
6071 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006072 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006073 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006074 WMI_VDEV_PARAM_FIXED_RATE,
6075 VDEV_CMD);
6076 break;
6077 }
6078
6079 case WE_GET_AMPDU:
6080 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006081 hdd_debug("GET AMPDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006082 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006083 GEN_VDEV_PARAM_AMPDU,
6084 GEN_CMD);
6085 break;
6086 }
6087
6088 case WE_GET_AMSDU:
6089 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006090 hdd_debug("GET AMSDU");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006091 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006092 GEN_VDEV_PARAM_AMSDU,
6093 GEN_CMD);
6094 break;
6095 }
6096
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006097 case WE_GET_ROAM_SYNCH_DELAY:
6098 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006099 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006100 *value = wma_cli_get_command(adapter->session_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006101 GEN_VDEV_ROAM_SYNCH_DELAY,
6102 GEN_CMD);
6103 break;
6104 }
6105
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006106 case WE_GET_TX_CHAINMASK:
6107 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006108 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006109 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006110 WMI_PDEV_PARAM_TX_CHAIN_MASK,
6111 PDEV_CMD);
6112 break;
6113 }
6114
6115 case WE_GET_RX_CHAINMASK:
6116 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006117 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006118 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006119 WMI_PDEV_PARAM_RX_CHAIN_MASK,
6120 PDEV_CMD);
6121 break;
6122 }
6123
6124 case WE_GET_TXPOW_2G:
6125 {
Wu Gao5f764082019-01-04 15:54:38 +08006126 uint8_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006127
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006128 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006129 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006130 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
6131 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006132 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow2g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006133 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006134 break;
6135 }
6136
6137 case WE_GET_TXPOW_5G:
6138 {
Wu Gao5f764082019-01-04 15:54:38 +08006139 uint8_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006140
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006141 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006142 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006143 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
6144 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006145 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow5g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006146 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006147 break;
6148 }
6149
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006150 case WE_GET_PPS_PAID_MATCH:
6151 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006152 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006153 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006154 WMI_VDEV_PPS_PAID_MATCH,
6155 PPS_CMD);
6156 break;
6157 }
6158
6159 case WE_GET_PPS_GID_MATCH:
6160 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006161 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006162 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006163 WMI_VDEV_PPS_GID_MATCH,
6164 PPS_CMD);
6165 break;
6166 }
6167
6168 case WE_GET_PPS_EARLY_TIM_CLEAR:
6169 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006170 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006171 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006172 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
6173 PPS_CMD);
6174 break;
6175 }
6176
6177 case WE_GET_PPS_EARLY_DTIM_CLEAR:
6178 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006179 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006180 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006181 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
6182 PPS_CMD);
6183 break;
6184 }
6185
6186 case WE_GET_PPS_EOF_PAD_DELIM:
6187 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006188 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006189 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006190 WMI_VDEV_PPS_EOF_PAD_DELIM,
6191 PPS_CMD);
6192 break;
6193 }
6194
6195 case WE_GET_PPS_MACADDR_MISMATCH:
6196 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006197 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006198 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006199 WMI_VDEV_PPS_MACADDR_MISMATCH,
6200 PPS_CMD);
6201 break;
6202 }
6203
6204 case WE_GET_PPS_DELIM_CRC_FAIL:
6205 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006206 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006207 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006208 WMI_VDEV_PPS_DELIM_CRC_FAIL,
6209 PPS_CMD);
6210 break;
6211 }
6212
6213 case WE_GET_PPS_GID_NSTS_ZERO:
6214 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006215 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006216 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006217 WMI_VDEV_PPS_GID_NSTS_ZERO,
6218 PPS_CMD);
6219 break;
6220 }
6221
6222 case WE_GET_PPS_RSSI_CHECK:
6223 {
6224
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006225 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006226 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006227 WMI_VDEV_PPS_RSSI_CHECK,
6228 PPS_CMD);
6229 break;
6230 }
6231
6232 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
6233 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006234 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006235 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006236 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
6237 QPOWER_CMD);
6238 break;
6239 }
6240
6241 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
6242 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006243 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006244 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006245 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
6246 QPOWER_CMD);
6247 break;
6248 }
6249
6250 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
6251 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006252 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006253 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006254 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
6255 QPOWER_CMD);
6256 break;
6257 }
6258
6259 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
6260 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006261 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006262 *value = wma_cli_get_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006263 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
6264 QPOWER_CMD);
6265 break;
6266 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006267 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006268 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006269 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006270 case WE_GET_TEMPERATURE:
6271 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006272 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006273 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006274 break;
6275 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006276 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006277 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006278 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006279 WMI_VDEV_PARAM_HE_DCM,
6280 VDEV_CMD);
6281 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006282 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006283 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnson1b780e42017-10-31 14:11:45 -07006284 *value = wma_cli_get_command(adapter->session_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006285 WMI_VDEV_PARAM_HE_RANGE_EXT,
6286 VDEV_CMD);
6287 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006288 default:
6289 {
Jeff Johnson99bac312016-06-28 10:38:18 -07006290 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006291 value[0]);
6292 break;
6293 }
6294 }
Dustin Browne74003f2018-03-14 12:51:58 -07006295 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306296 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006297 return ret;
6298}
6299
6300static int iw_setnone_getint(struct net_device *dev,
6301 struct iw_request_info *info,
6302 union iwreq_data *wrqu, char *extra)
6303{
6304 int ret;
6305
6306 cds_ssr_protect(__func__);
6307 ret = __iw_setnone_getint(dev, info, wrqu, extra);
6308 cds_ssr_unprotect(__func__);
6309
6310 return ret;
6311}
6312
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306313static int hdd_set_fwtest(int argc, int cmd, int value)
6314{
6315 struct set_fwtest_params *fw_test;
6316
6317 /* check for max number of arguments */
6318 if (argc > (WMA_MAX_NUM_ARGS) ||
6319 argc != HDD_FWTEST_PARAMS) {
6320 hdd_err("Too Many args %d", argc);
6321 return -EINVAL;
6322 }
6323 /*
6324 * check if number of arguments are 3 then, check
6325 * then set the default value for sounding interval.
6326 */
6327 if (HDD_FWTEST_PARAMS == argc) {
6328 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
6329 value = HDD_FWTEST_SU_DEFAULT_VALUE;
6330 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6331 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6332 }
6333 /* check sounding interval value should not exceed to max */
6334 if (value > HDD_FWTEST_MAX_VALUE) {
6335 hdd_err("Invalid arguments value should not exceed max: %d",
6336 value);
6337 return -EINVAL;
6338 }
6339 fw_test = qdf_mem_malloc(sizeof(*fw_test));
6340 if (NULL == fw_test) {
6341 hdd_err("qdf_mem_malloc failed for fw_test");
6342 return -ENOMEM;
6343 }
6344 fw_test->arg = cmd;
6345 fw_test->value = value;
6346 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6347 qdf_mem_free(fw_test);
6348 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6349 return -EINVAL;
6350 }
6351 return 0;
6352}
6353
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006354/**
6355 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6356 * @dev: device upon which the ioctl was received
6357 * @info: ioctl request information
6358 * @wrqu: ioctl request data
6359 * @extra: ioctl extra data
6360 *
6361 * Return: 0 on success, non-zero on error
6362 */
6363static int __iw_set_three_ints_getnone(struct net_device *dev,
6364 struct iw_request_info *info,
6365 union iwreq_data *wrqu, char *extra)
6366{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006367 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006368 int *value = (int *)extra;
6369 int sub_cmd = value[0];
6370 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08006371 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006372 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08006373 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006374
Dustin Brownfdf17c12018-03-14 12:55:34 -07006375 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306376
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006377 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006378 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006379 return -EPERM;
6380 }
6381
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006382 ret = wlan_hdd_validate_context(hdd_ctx);
6383 if (0 != ret)
6384 return ret;
6385
Jeff Johnson441e1f72017-02-07 08:50:49 -08006386 ret = hdd_check_private_wext_control(hdd_ctx, info);
6387 if (0 != ret)
6388 return ret;
6389
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006390 switch (sub_cmd) {
6391
6392 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006393 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6394 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006395 break;
6396 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306397 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006398 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306399
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006400 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6401 hdd_debug("Ioctl to set dual mac scan config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08006402 status =
6403 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
6404 &dual_mac_feature);
6405 if (status != QDF_STATUS_SUCCESS)
6406 hdd_err("can't get dual mac feature val, use def");
6407 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006408 hdd_err("Dual mac feature is disabled from INI");
6409 return -EPERM;
6410 }
6411 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Dustin Brown05d81302018-09-11 16:49:22 -07006412 policy_mgr_set_dual_mac_scan_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006413 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006414 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306415 case WE_SET_FW_TEST:
6416 {
6417 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6418 if (ret) {
6419 hdd_err("Not able to set fwtest %d", ret);
6420 return ret;
6421 }
6422 }
6423 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006424 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006425 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006426 break;
6427
6428 }
Dustin Browne74003f2018-03-14 12:51:58 -07006429 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006430 return ret;
6431}
6432
6433int iw_set_three_ints_getnone(struct net_device *dev,
6434 struct iw_request_info *info,
6435 union iwreq_data *wrqu, char *extra)
6436{
6437 int ret;
6438
6439 cds_ssr_protect(__func__);
6440 ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
6441 cds_ssr_unprotect(__func__);
6442
6443 return ret;
6444}
6445
6446/**
6447 * hdd_connection_state_string() - Get connection state string
6448 * @connection_state: enum to be converted to a string
6449 *
6450 * Return: the string equivalent of @connection_state
6451 */
6452static const char *
6453hdd_connection_state_string(eConnectionState connection_state)
6454{
6455 switch (connection_state) {
6456 CASE_RETURN_STRING(eConnectionState_NotConnected);
6457 CASE_RETURN_STRING(eConnectionState_Connecting);
6458 CASE_RETURN_STRING(eConnectionState_Associated);
6459 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6460 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6461 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6462 default:
6463 return "UNKNOWN";
6464 }
6465}
6466
Naveen Rawat910726a2017-03-06 11:42:51 -08006467#if defined(FEATURE_OEM_DATA_SUPPORT)
6468/**
6469 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6470 * wifi_pos api to get oem data caps
6471 * @dev: net device upon which the request was received
6472 * @info: ioctl request information
6473 * @wrqu: ioctl request data
6474 * @extra: ioctl data payload
6475 *
6476 * Return: 0 for success, negative errno value on failure
6477 */
6478static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6479 struct iw_request_info *info,
6480 union iwreq_data *wrqu, char *extra)
6481{
6482 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6483}
6484#elif defined(WIFI_POS_CONVERGED)
6485static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6486 struct iw_request_info *info,
6487 union iwreq_data *wrqu, char *extra)
6488{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006489 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006490 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006491
Dustin Brown05d81302018-09-11 16:49:22 -07006492 return os_if_wifi_pos_populate_caps(hdd_ctx->psoc,
Naveen Rawat910726a2017-03-06 11:42:51 -08006493 (struct wifi_pos_driver_caps *)extra);
6494}
6495#else
6496static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6497 struct iw_request_info *info,
6498 union iwreq_data *wrqu, char *extra)
6499{
6500 return -ENOTSUPP;
6501}
6502#endif
6503
Krunal Soni5e483782018-10-25 15:42:44 -07006504#ifdef WLAN_UNIT_TEST
6505static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6506 struct hdd_adapter *adapter,
6507 char *extra)
6508{
6509 QDF_STATUS status;
6510
6511 status = sme_get_sta_cxn_info(hdd_ctx->mac_handle, adapter->session_id,
6512 extra, WE_MAX_STR_LEN);
6513 if (status != QDF_STATUS_SUCCESS)
6514 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6515 "\nNo active connection");
6516
6517 return 0;
6518}
6519#else
6520static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6521 struct hdd_adapter *adapter,
6522 char *extra)
6523{
6524 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6525 "\nNot supported");
6526 return -ENOTSUPP;
6527}
6528#endif
6529
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006530/**
6531 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6532 * @dev: device upon which the ioctl was received
6533 * @info: ioctl request information
6534 * @wrqu: ioctl request data
6535 * @extra: ioctl extra data
6536 *
6537 * Return: 0 on success, non-zero on error
6538 */
6539static int __iw_get_char_setnone(struct net_device *dev,
6540 struct iw_request_info *info,
6541 union iwreq_data *wrqu, char *extra)
6542{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006543 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006544 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006545 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006546 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006547 int ret;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306548 QDF_STATUS status;
6549 uint8_t value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006550
Dustin Brownfdf17c12018-03-14 12:55:34 -07006551 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306552
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006553 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006554 ret = wlan_hdd_validate_context(hdd_ctx);
6555 if (0 != ret)
6556 return ret;
6557
Jeff Johnson441e1f72017-02-07 08:50:49 -08006558 ret = hdd_check_private_wext_control(hdd_ctx, info);
6559 if (0 != ret)
6560 return ret;
6561
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006562 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006563 switch (sub_cmd) {
6564 case WE_WLAN_VERSION:
6565 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006566 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6567 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006568 break;
6569 }
6570
6571 case WE_GET_STATS:
6572 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006573 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006574 extra, WE_MAX_STR_LEN);
6575 break;
6576 }
6577
Dustin Brownd9322482017-01-09 12:46:03 -08006578 case WE_GET_SUSPEND_RESUME_STATS:
6579 {
6580 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6581 WE_MAX_STR_LEN);
6582 if (ret >= 0) {
6583 wrqu->data.length = ret;
6584 ret = 0;
6585 }
6586
6587 break;
6588 }
6589
Govind Singha471e5e2015-10-12 17:11:14 +05306590 case WE_LIST_FW_PROFILE:
6591 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6592 extra, WE_MAX_STR_LEN);
6593 break;
6594
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006595 /* The case prints the current state of the HDD, SME, CSR, PE,
6596 * TL it can be extended for WDI Global State as well. And
6597 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6598 * and P2P_GO have not been added as of now.
6599 */
6600 case WE_GET_STATES:
6601 {
6602 int buf = 0, len = 0;
6603 int adapter_num = 0;
6604 int count = 0, check = 1;
6605
Jeff Johnsond377dce2017-10-04 10:32:42 -07006606 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006607
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006608 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson3d278b02017-08-29 14:17:47 -07006609 struct hdd_adapter *useAdapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006610
6611 /* Print wlan0 or p2p0 states based on the adapter_num
6612 * by using the correct adapter
6613 */
6614 while (adapter_num < 2) {
6615 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006616 useAdapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006617 buf =
6618 scnprintf(extra + len,
6619 WE_MAX_STR_LEN - len,
6620 "\n\n wlan0 States:-");
6621 len += buf;
6622 } else if (P2P_ADAPTER == adapter_num) {
6623 buf =
6624 scnprintf(extra + len,
6625 WE_MAX_STR_LEN - len,
6626 "\n\n p2p0 States:-");
6627 len += buf;
6628
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006629 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006630 buf =
6631 scnprintf(extra + len,
6632 WE_MAX_STR_LEN -
6633 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006634 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006635 len += buf;
6636 break;
6637 }
6638
6639 /* Printing p2p0 states only in the
6640 * case when the device is configured
6641 * as a p2p_client
6642 */
6643 useAdapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006644 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006645 QDF_P2P_CLIENT_MODE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006646 if (!useAdapter) {
6647 buf =
6648 scnprintf(extra + len,
6649 WE_MAX_STR_LEN -
6650 len,
6651 "\n Device not configured as P2P_CLIENT.");
6652 len += buf;
6653 break;
6654 }
6655 }
6656
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006657 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006658 buf = scnprintf(extra + len,
6659 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006660 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006661 len += buf;
6662 break;
6663 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006664 sta_ctx =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006665 WLAN_HDD_GET_STATION_CTX_PTR(useAdapter);
6666
6667
6668 buf =
6669 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6670 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006671 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006672 "\n Neighbour Roam State - %s"
6673 "\n CSR State - %s"
6674 "\n CSR Substate - %s",
6675 hdd_connection_state_string
Jeff Johnsond377dce2017-10-04 10:32:42 -07006676 (sta_ctx->conn_info.connState),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006677 mac_trace_get_neighbour_roam_state
6678 (sme_get_neighbor_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006679 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006680 mac_trace_getcsr_roam_state
6681 (sme_get_current_roam_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006682 (mac_handle, useAdapter->session_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006683 mac_trace_getcsr_roam_sub_state
6684 (sme_get_current_roam_sub_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006685 (mac_handle, useAdapter->session_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006686 );
6687 len += buf;
6688 adapter_num++;
6689 }
6690
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006691 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006692 /* Printing Lim State starting with global lim states */
6693 buf =
6694 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006695 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006696 "\n Global Sme State - %s "
6697 "\n Global mlm State - %s " "\n",
6698 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006699 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006700 mac_trace_get_lim_mlm_state
Jeff Johnson71d465a2018-12-05 11:13:30 -08006701 (sme_get_lim_mlm_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006702 );
6703 len += buf;
6704
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006705 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006706 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006707 buf =
6708 scnprintf(extra + len,
6709 WE_MAX_STR_LEN -
6710 len,
6711 "\n Lim Valid Session %d:-"
6712 "\n PE Sme State - %s "
6713 "\n PE Mlm State - %s "
6714 "\n", check,
6715 mac_trace_get_lim_sme_state
6716 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006717 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006718 mac_trace_get_lim_mlm_state
6719 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006720 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006721 );
6722
6723 len += buf;
6724 check++;
6725 }
6726 count++;
6727 }
6728 }
6729
6730 wrqu->data.length = strlen(extra) + 1;
6731 break;
6732 }
6733
6734 case WE_GET_CFG:
6735 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006736 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006737 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006738 extra,
6739 QCSAP_IOCTL_MAX_STR_LEN);
6740 wrqu->data.length = strlen(extra) + 1;
6741 break;
6742 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006743 case WE_GET_RSSI:
6744 {
6745 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006746
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006747 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006748 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
6749 wrqu->data.length = strlen(extra) + 1;
6750 break;
6751 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006752
6753 case WE_GET_WMM_STATUS:
6754 {
6755 snprintf(extra, WE_MAX_STR_LEN,
6756 "\nDir: 0=up, 1=down, 3=both\n"
6757 "|------------------------|\n"
6758 "|AC | ACM |Admitted| Dir |\n"
6759 "|------------------------|\n"
6760 "|VO | %d | %3s | %d |\n"
6761 "|VI | %d | %3s | %d |\n"
6762 "|BE | %d | %3s | %d |\n"
6763 "|BK | %d | %3s | %d |\n"
6764 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006765 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006766 wmmAcStatus[SME_AC_VO].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006767 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006768 wmmAcStatus[SME_AC_VO].
6769 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006770 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006771 wmmAcStatus[SME_AC_VO].wmmAcTspecInfo.
6772 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006773 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006774 wmmAcStatus[SME_AC_VI].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006775 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006776 wmmAcStatus[SME_AC_VI].
6777 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006778 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006779 wmmAcStatus[SME_AC_VI].wmmAcTspecInfo.
6780 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006781 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006782 wmmAcStatus[SME_AC_BE].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006783 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006784 wmmAcStatus[SME_AC_BE].
6785 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006786 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006787 wmmAcStatus[SME_AC_BE].wmmAcTspecInfo.
6788 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006789 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006790 wmmAcStatus[SME_AC_BK].wmmAcAccessRequired,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006791 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006792 wmmAcStatus[SME_AC_BK].
6793 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07006794 adapter->hdd_wmm_status.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006795 wmmAcStatus[SME_AC_BK].wmmAcTspecInfo.
6796 ts_info.direction);
6797
6798 wrqu->data.length = strlen(extra) + 1;
6799 break;
6800 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07006801
6802 case WE_GET_BA_AGEING_TIMEOUT:
6803 {
6804 uint8_t ac_cat = 4;
Yuanyuan Liu755671e2019-01-16 16:47:19 -08006805 uint32_t duration[WME_AC_NUM], i;
Krunal Soni6c3859f2018-06-01 19:57:40 -07006806 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
6807
6808 if (!soc) {
6809 hdd_err("Invalid SOC handle");
6810 break;
6811 }
6812
6813 for (i = 0; i < ac_cat; i++)
6814 cdp_get_ba_timeout(soc, i, &duration[i]);
6815
6816 snprintf(extra, WE_MAX_STR_LEN,
6817 "\n|------------------------------|\n"
6818 "|AC | BA aging timeout duration |\n"
6819 "|--------------------------------|\n"
6820 "|VO | %d |\n"
6821 "|VI | %d |\n"
6822 "|BE | %d |\n"
6823 "|BK | %d |\n"
6824 "|--------------------------------|\n",
6825 duration[3], duration[2], duration[1], duration[0]);
6826
6827 wrqu->data.length = strlen(extra) + 1;
6828 break;
6829 }
6830
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006831 case WE_GET_CHANNEL_LIST:
6832 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306833 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006834 uint8_t i, len;
6835 char *buf;
Wu Gaoaa155142019-01-14 15:09:26 +08006836 uint8_t ubuf[CFG_COUNTRY_CODE_LEN];
6837 uint8_t ubuf_len = CFG_COUNTRY_CODE_LEN;
Srinivas Girigowdac231df62017-03-24 18:27:57 -07006838 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006839
6840 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05306841 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006842 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306843 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006844 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006845 return -EINVAL;
6846 }
6847 buf = extra;
6848 /*
Wu Gao0821b0d2019-01-11 17:31:11 +08006849 * Maximum channels = CFG_VALID_CHANNEL_LIST_LEN.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006850 * Maximum buffer needed = 5 * number of channels.
6851 * Check ifsufficient buffer is available and then
6852 * proceed to fill the buffer.
6853 */
6854 if (WE_MAX_STR_LEN <
Wu Gao0821b0d2019-01-11 17:31:11 +08006855 (5 * CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006856 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006857 return -EINVAL;
6858 }
6859 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
6860 channel_list.num_channels);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006861 if (QDF_STATUS_SUCCESS == sme_get_country_code(mac_handle,
6862 ubuf,
6863 &ubuf_len)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006864 /* Printing Country code in getChannelList */
6865 for (i = 0; i < (ubuf_len - 1); i++)
6866 len += scnprintf(buf + len,
6867 WE_MAX_STR_LEN - len,
6868 "%c", ubuf[i]);
6869 }
6870 for (i = 0; i < channel_list.num_channels; i++) {
6871 len +=
6872 scnprintf(buf + len, WE_MAX_STR_LEN - len,
6873 " %u", channel_list.channels[i]);
6874 }
6875 wrqu->data.length = strlen(extra) + 1;
6876
6877 break;
6878 }
6879#ifdef FEATURE_WLAN_TDLS
6880 case WE_GET_TDLS_PEERS:
6881 {
6882 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006883 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006884 WE_MAX_STR_LEN) + 1;
6885 break;
6886 }
6887#endif
6888#ifdef WLAN_FEATURE_11W
6889 case WE_GET_11W_INFO:
6890 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006891 struct csr_roam_profile *roam_profile =
6892 hdd_roam_profile(adapter);
6893
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006894 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006895 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006896
6897 snprintf(extra, WE_MAX_STR_LEN,
6898 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
6899 "\n Number of Unprotected Disassocs %d"
6900 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07006901 roam_profile->BSSIDs.bssid->bytes[0],
6902 roam_profile->BSSIDs.bssid->bytes[1],
6903 roam_profile->BSSIDs.bssid->bytes[2],
6904 roam_profile->BSSIDs.bssid->bytes[3],
6905 roam_profile->BSSIDs.bssid->bytes[4],
6906 roam_profile->BSSIDs.bssid->bytes[5],
6907 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07006908 adapter->hdd_stats.hdd_pmf_stats.
6909 num_unprot_disassoc_rx,
6910 adapter->hdd_stats.hdd_pmf_stats.
6911 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006912
6913 wrqu->data.length = strlen(extra) + 1;
6914 break;
6915 }
6916#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006917 case WE_GET_IBSS_STA_INFO:
6918 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07006919 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006920 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006921 int idx = 0;
6922 int length = 0, buf = 0;
6923
Naveen Rawatc45d1622016-07-05 12:20:09 -07006924 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07006925 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07006926 sta_ctx->conn_info.staId[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006927 buf = snprintf
6928 ((extra + length),
6929 WE_MAX_STR_LEN - length,
6930 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnsond377dce2017-10-04 10:32:42 -07006931 sta_ctx->conn_info.staId[idx],
6932 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006933 peerMacAddress[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006934 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006935 peerMacAddress[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006936 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006937 peerMacAddress[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006938 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006939 peerMacAddress[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006940 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006941 peerMacAddress[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07006942 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08006943 peerMacAddress[idx].bytes[5]
6944 );
6945 length += buf;
6946 }
6947 }
6948 wrqu->data.length = strlen(extra) + 1;
6949 break;
6950 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006951 case WE_GET_PHYMODE:
6952 {
6953 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006954 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006955 eCsrPhyMode phymode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006956 enum band_info currBand;
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006957 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006958
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006959 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6960 if (!sme_config) {
6961 hdd_err("Out of memory");
6962 ret = -ENOMEM;
6963 break;
6964 }
6965
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006966 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006967 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006968 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006969 ch_bond24 = true;
6970
6971 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006972 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006973 ch_bond5g = true;
6974
Dustin Browne9c6b3a2017-01-23 17:17:32 -08006975 qdf_mem_free(sme_config);
6976
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006977 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306978 if ((QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006979 sme_get_freq_band(mac_handle, &currBand))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006980 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006981 return -EIO;
6982 }
6983
6984 switch (phymode) {
6985 case eCSR_DOT11_MODE_AUTO:
6986 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
6987 break;
6988 case eCSR_DOT11_MODE_11n:
6989 case eCSR_DOT11_MODE_11n_ONLY:
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006990 if (currBand == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006991 if (ch_bond24)
6992 snprintf(extra, WE_MAX_STR_LEN,
6993 "11NGHT40");
6994 else
6995 snprintf(extra, WE_MAX_STR_LEN,
6996 "11NGHT20");
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08006997 } else if (currBand == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006998 if (ch_bond5g)
6999 snprintf(extra, WE_MAX_STR_LEN,
7000 "11NAHT40");
7001 else
7002 snprintf(extra, WE_MAX_STR_LEN,
7003 "11NAHT20");
7004 } else {
7005 snprintf(extra, WE_MAX_STR_LEN, "11N");
7006 }
7007 break;
7008 case eCSR_DOT11_MODE_abg:
7009 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
7010 break;
7011 case eCSR_DOT11_MODE_11a:
7012 snprintf(extra, WE_MAX_STR_LEN, "11A");
7013 break;
7014 case eCSR_DOT11_MODE_11b:
7015 case eCSR_DOT11_MODE_11b_ONLY:
7016 snprintf(extra, WE_MAX_STR_LEN, "11B");
7017 break;
7018 case eCSR_DOT11_MODE_11g:
7019 case eCSR_DOT11_MODE_11g_ONLY:
7020 snprintf(extra, WE_MAX_STR_LEN, "11G");
7021 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007022 case eCSR_DOT11_MODE_11ac:
7023 case eCSR_DOT11_MODE_11ac_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307024 status =
7025 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7026 &value);
7027 if (!QDF_IS_STATUS_SUCCESS(status))
7028 hdd_err("Failed to set channel_width");
7029 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007030 snprintf(extra, WE_MAX_STR_LEN,
7031 "11ACVHT20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307032 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007033 snprintf(extra, WE_MAX_STR_LEN,
7034 "11ACVHT40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307035 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007036 snprintf(extra, WE_MAX_STR_LEN,
7037 "11ACVHT80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307038 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007039 snprintf(extra, WE_MAX_STR_LEN,
7040 "11ACVHT160");
7041 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007042 case eCSR_DOT11_MODE_11ax:
7043 case eCSR_DOT11_MODE_11ax_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307044 status =
7045 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7046 &value);
7047 if (!QDF_IS_STATUS_SUCCESS(status))
7048 hdd_err("Failed to set channel_width");
7049
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007050 /* currently using vhtChannelWidth */
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307051 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007052 snprintf(extra, WE_MAX_STR_LEN,
7053 "11AX_HE_20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307054 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007055 snprintf(extra, WE_MAX_STR_LEN,
7056 "11AX_HE_40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307057 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007058 snprintf(extra, WE_MAX_STR_LEN,
7059 "11AX_HE_80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307060 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007061 snprintf(extra, WE_MAX_STR_LEN,
7062 "11AX_HE_160");
7063 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007064 }
7065
7066 wrqu->data.length = strlen(extra) + 1;
7067 break;
7068 }
7069
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007070 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08007071 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007072 case WE_GET_SNR:
7073 {
7074 int8_t s7snr = 0;
7075 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007076 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07007077 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007078
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007079 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007080 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307081 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007082 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307083
Jeff Johnsond377dce2017-10-04 10:32:42 -07007084 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007085 if (0 == hdd_ctx->config->fEnableSNRMonitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007086 eConnectionState_Associated !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07007087 sta_ctx->conn_info.connState) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007088 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007089 hdd_ctx->config->fEnableSNRMonitoring,
Jeff Johnsond377dce2017-10-04 10:32:42 -07007090 sta_ctx->conn_info.connState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007091 return -ENONET;
7092 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007093 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007094 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
7095 wrqu->data.length = strlen(extra) + 1;
7096 break;
7097 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007098
Krunal Soni5e483782018-10-25 15:42:44 -07007099 case WE_GET_STA_CXN_INFO:
7100 ret = hdd_get_sta_cxn_info(hdd_ctx, adapter, extra);
7101 wrqu->data.length = strlen(extra) + 1;
7102 break;
7103
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007104 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007105 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007106 break;
7107 }
Dustin Brownd9322482017-01-09 12:46:03 -08007108
Dustin Browne74003f2018-03-14 12:51:58 -07007109 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08007110 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007111}
7112
7113static int iw_get_char_setnone(struct net_device *dev,
7114 struct iw_request_info *info,
7115 union iwreq_data *wrqu, char *extra)
7116{
7117 int ret;
7118
7119 cds_ssr_protect(__func__);
7120 ret = __iw_get_char_setnone(dev, info, wrqu, extra);
7121 cds_ssr_unprotect(__func__);
7122
7123 return ret;
7124}
7125
7126/**
7127 * iw_setnone_getnone() - Generic "action" private ioctl handler
7128 * @dev: device upon which the ioctl was received
7129 * @info: ioctl request information
7130 * @wrqu: ioctl request data
7131 * @extra: ioctl extra data
7132 *
7133 * Return: 0 on success, non-zero on error
7134 */
7135static int __iw_setnone_getnone(struct net_device *dev,
7136 struct iw_request_info *info,
7137 union iwreq_data *wrqu, char *extra)
7138{
Jeff Johnson3d278b02017-08-29 14:17:47 -07007139 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007140 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007141 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007142 int ret;
7143 int sub_cmd;
7144
Dustin Brownfdf17c12018-03-14 12:55:34 -07007145 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307146
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007147 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007148 ret = wlan_hdd_validate_context(hdd_ctx);
7149 if (0 != ret)
7150 return ret;
7151
Jeff Johnson441e1f72017-02-07 08:50:49 -08007152 ret = hdd_check_private_wext_control(hdd_ctx, info);
7153 if (0 != ret)
7154 return ret;
7155
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007156#ifdef CONFIG_COMPAT
7157 /* this ioctl is a special case where a sub-ioctl is used and both
7158 * the number of get and set args is 0. in this specific case the
7159 * logic in iwpriv places the sub_cmd in the data.flags portion of
7160 * the iwreq. unfortunately the location of this field will be
7161 * different between 32-bit and 64-bit userspace, and the standard
7162 * compat support in the kernel does not handle this case. so we
7163 * need to explicitly handle it here.
7164 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07007165 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007166 struct compat_iw_point *compat_iw_point =
7167 (struct compat_iw_point *)&wrqu->data;
7168 sub_cmd = compat_iw_point->flags;
7169 } else {
7170 sub_cmd = wrqu->data.flags;
7171 }
7172#else
7173 sub_cmd = wrqu->data.flags;
7174#endif
7175
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007176 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007177 switch (sub_cmd) {
Govind Singha471e5e2015-10-12 17:11:14 +05307178 case WE_GET_FW_PROFILE_DATA:
Jeff Johnson1b780e42017-10-31 14:11:45 -07007179 ret = wma_cli_set_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05307180 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
7181 0, DBG_CMD);
7182 break;
7183
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007184 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007185 hdd_wlan_get_ibss_peer_info_all(adapter);
7186 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007187
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007188 case WE_SET_REASSOC_TRIGGER:
7189 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07007190 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307191 tSirMacAddr bssid;
Krunal Sonibfd05492017-10-03 15:48:37 -07007192 uint32_t roamId = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307193 uint8_t operating_ch =
Jeff Johnsonb9424862017-10-30 08:49:35 -07007194 adapter->session.station.conn_info.operationChannel;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007195 tCsrRoamModifyProfileFields modProfileFields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007196
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007197 sme_get_modify_profile_fields(mac_handle, adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007198 &modProfileFields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307199 if (roaming_offload_enabled(hdd_ctx)) {
7200 qdf_mem_copy(bssid,
Jeff Johnsonb9424862017-10-30 08:49:35 -07007201 &adapter->session.station.conn_info.bssId,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307202 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08007203 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307204 bssid, operating_ch);
7205 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007206 sme_roam_reassoc(mac_handle, adapter->session_id,
7207 NULL, modProfileFields, &roamId, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307208 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007209 return 0;
7210 }
7211
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007212 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007213 /*
7214 * 1.OBSS Scan is mandatory while operating in 2.4GHz
7215 * 2.OBSS scan is stopped by Firmware during the disassociation
7216 * 3.OBSS stop comamnd is added for debugging purpose
7217 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007218 if (!mac_handle) {
7219 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007220 return -EINVAL;
7221 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007222 sme_ht40_stop_obss_scan(mac_handle, adapter->session_id);
7223 break;
7224
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007225 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007226 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007227 break;
7228 }
Dustin Browne74003f2018-03-14 12:51:58 -07007229 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007230 return ret;
7231}
7232
7233static int iw_setnone_getnone(struct net_device *dev,
7234 struct iw_request_info *info,
7235 union iwreq_data *wrqu, char *extra)
7236{
7237 int ret;
7238
7239 cds_ssr_protect(__func__);
7240 ret = __iw_setnone_getnone(dev, info, wrqu, extra);
7241 cds_ssr_unprotect(__func__);
7242
7243 return ret;
7244}
7245
Krunal Sonia6e505b2017-01-12 12:25:18 -08007246#ifdef MPC_UT_FRAMEWORK
Liangwei Dong509c3472018-05-30 07:05:59 -04007247static void
7248hdd_policy_mgr_set_hw_mode_ut(struct hdd_context *hdd_ctx,
7249 struct hdd_adapter *adapter, int cmd)
7250{
7251 enum hw_mode_ss_config mac0_ss;
7252 enum hw_mode_bandwidth mac0_bw;
7253 enum hw_mode_ss_config mac1_ss;
7254 enum hw_mode_bandwidth mac1_bw;
7255 enum hw_mode_mac_band_cap mac0_band_cap;
7256 enum hw_mode_dbs_capab dbs;
7257
7258 switch (cmd) {
7259 case 0:
7260 hdd_debug("set hw mode for single mac");
7261 mac0_ss = HW_MODE_SS_2x2;
7262 mac0_bw = HW_MODE_80_MHZ;
7263 mac1_ss = HW_MODE_SS_0x0;
7264 mac1_bw = HW_MODE_BW_NONE;
7265 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7266 dbs = HW_MODE_DBS_NONE;
7267 break;
7268 case 1:
7269 hdd_debug("set hw mode for dual mac");
7270 mac0_ss = HW_MODE_SS_1x1;
7271 mac0_bw = HW_MODE_80_MHZ;
7272 mac1_ss = HW_MODE_SS_1x1;
7273 mac1_bw = HW_MODE_40_MHZ;
7274 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7275 dbs = HW_MODE_DBS;
7276 break;
7277 case 2:
7278 hdd_debug("set hw mode for 2x2 5g + 1x1 2g");
7279 mac0_ss = HW_MODE_SS_2x2;
7280 mac0_bw = HW_MODE_80_MHZ;
7281 mac1_ss = HW_MODE_SS_1x1;
7282 mac1_bw = HW_MODE_40_MHZ;
7283 mac0_band_cap = HW_MODE_MAC_BAND_5G;
7284 dbs = HW_MODE_DBS;
7285 break;
7286 case 3:
7287 hdd_debug("set hw mode for 2x2 2g + 1x1 5g");
7288 mac0_ss = HW_MODE_SS_2x2;
7289 mac0_bw = HW_MODE_40_MHZ;
7290 mac1_ss = HW_MODE_SS_1x1;
7291 mac1_bw = HW_MODE_40_MHZ;
7292 mac0_band_cap = HW_MODE_MAC_BAND_2G;
7293 dbs = HW_MODE_DBS;
7294 break;
7295 default:
7296 hdd_err("unknown cmd %d", cmd);
7297 return;
7298 }
7299 policy_mgr_pdev_set_hw_mode(hdd_ctx->psoc, adapter->session_id,
7300 mac0_ss, mac0_bw, mac1_ss, mac1_bw,
7301 mac0_band_cap, dbs, HW_MODE_AGILE_DFS_NONE,
7302 HW_MODE_SBS_NONE,
7303 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
7304}
7305
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007306static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007307 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007308{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08007309 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08007310 case WE_POLICY_MANAGER_CLIST_CMD:
7311 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007312 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307313 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307314 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7315 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7316 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7317 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307318 return 0;
7319 }
Dustin Brown05d81302018-09-11 16:49:22 -07007320 policy_mgr_incr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007321 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7322 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007323 }
7324 break;
7325
7326 case WE_POLICY_MANAGER_DLIST_CMD:
7327 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007328 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307329 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307330 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307331 return 0;
7332 }
Dustin Brown05d81302018-09-11 16:49:22 -07007333 policy_mgr_decr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007334 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007335 }
7336 break;
7337
7338 case WE_POLICY_MANAGER_ULIST_CMD:
7339 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007340 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307341 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307342 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7343 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7344 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7345 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307346 return 0;
7347 }
Dustin Brown05d81302018-09-11 16:49:22 -07007348 policy_mgr_update_connection_info_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007349 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7350 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007351 }
7352 break;
7353
7354 case WE_POLICY_MANAGER_DBS_CMD:
7355 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007356 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007357 if (apps_args[0] == 0)
7358 wma_set_dbs_capability_ut(0);
7359 else
7360 wma_set_dbs_capability_ut(1);
7361
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007362 if (apps_args[1] >= PM_THROUGHPUT &&
7363 apps_args[1] <= PM_LATENCY) {
Liangwei Dong509c3472018-05-30 07:05:59 -04007364 hdd_debug("setting system pref to [%d]\n",
7365 apps_args[1]);
Krunal Sonie71838d2018-09-27 10:45:05 -07007366 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc,
7367 apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007368 }
7369 }
7370 break;
7371
7372 case WE_POLICY_MANAGER_PCL_CMD:
7373 {
7374 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
7375 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
7376 uint32_t pcl_len = 0, i = 0;
7377
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007378 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007379
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307380 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307381 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307382 return 0;
7383 }
Dustin Brown05d81302018-09-11 16:49:22 -07007384 policy_mgr_get_pcl(hdd_ctx->psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08007385 pcl, &pcl_len,
7386 weight_list, QDF_ARRAY_SIZE(weight_list));
Liangwei Dong509c3472018-05-30 07:05:59 -04007387 hdd_debug("PCL list for role[%d] is {", apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007388 for (i = 0 ; i < pcl_len; i++)
Liangwei Dong509c3472018-05-30 07:05:59 -04007389 hdd_debug(" %d, ", pcl[i]);
7390 hdd_debug("}--------->\n");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007391 }
7392 break;
7393
7394 case WE_POLICY_SET_HW_MODE_CMD:
7395 {
Liangwei Dong509c3472018-05-30 07:05:59 -04007396 hdd_debug("pm_set_hw_mode cmd %d", apps_args[0]);
7397 hdd_policy_mgr_set_hw_mode_ut(hdd_ctx, adapter, apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007398 }
7399 break;
7400
7401 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7402 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007403 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307404 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307405 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307406 return 0;
7407 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07007408 policy_mgr_current_connections_update(
Dustin Brown05d81302018-09-11 16:49:22 -07007409 hdd_ctx->psoc,
Jeff Johnson1b780e42017-10-31 14:11:45 -07007410 adapter->session_id, apps_args[0],
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07007411 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007412 }
7413 break;
7414
7415 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7416 {
7417 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007418
Dustin Brown5e89ef82018-03-14 11:50:23 -07007419 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307420 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307421 (apps_args[2] < 0)) {
7422 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307423 return 0;
7424 }
Dustin Brown05d81302018-09-11 16:49:22 -07007425 allow = policy_mgr_allow_concurrency(hdd_ctx->psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08007426 apps_args[0], apps_args[1], apps_args[2]);
Liangwei Dong509c3472018-05-30 07:05:59 -04007427 hdd_debug("allow %d {0 = don't allow, 1 = allow}", allow);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007428 }
7429 break;
7430
7431 case WE_POLICY_MANAGER_SCENARIO_CMD:
7432 {
7433 clean_report(hdd_ctx);
7434 if (apps_args[0] == 1) {
7435 wlan_hdd_one_connection_scenario(hdd_ctx);
7436 } else if (apps_args[0] == 2) {
7437 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007438 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007439 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007440 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007441 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007442 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007443 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007444 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007445 } else if (apps_args[0] == 3) {
7446 /* MCC on same band with 2x2 same mac*/
7447 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007448 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007449 /* MCC on diff band with 2x2 same mac*/
7450 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007451 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007452 /* MCC on diff band with 1x1 diff mac */
7453 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007454 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007455 /* MCC on diff band with 1x1 same mac */
7456 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007457 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007458 /* SCC on same band with 2x2 same mac */
7459 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007460 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007461 /* SCC on same band with 1x1 same mac */
7462 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007463 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007464 /* MCC on same band with 2x2 same mac */
7465 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007466 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007467 /* MCC on same band with 1x1 same mac */
7468 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007469 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007470 }
7471 print_report(hdd_ctx);
7472 }
7473 break;
7474 }
7475 return 0;
7476}
7477#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007478static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007479 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007480{
7481 return 0;
7482}
7483#endif
7484
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007485/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007486 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7487 * @hdd_ctx: hdd_context
7488 * @num_args: input args number
7489 * @apps_args: args data ptr
7490 *
7491 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7492 *
7493 * Return: void
7494 */
7495#if WLAN_DEBUG
7496static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7497 int num_args, int *apps_args)
7498{
7499 struct ch_avoid_ind_type ch_avoid;
7500 int cnt = 0, i;
7501
7502 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7503 num_args % 2 != 0)
7504 return;
7505 hdd_info("simulate ch avoid num_args %d", num_args);
7506 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7507 ch_avoid.avoid_freq_range[cnt].start_freq =
7508 apps_args[i];
7509 ch_avoid.avoid_freq_range[cnt].end_freq =
7510 apps_args[++i];
7511
7512 hdd_info("simulate ch avoid [%d %d]",
7513 ch_avoid.avoid_freq_range[cnt].start_freq,
7514 ch_avoid.avoid_freq_range[cnt].end_freq);
7515 cnt++;
7516 }
7517 ch_avoid.ch_avoid_range_cnt = cnt;
Dustin Brown05d81302018-09-11 16:49:22 -07007518 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->psoc, &ch_avoid);
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007519}
7520#else
7521static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7522 int num_args, int *apps_args)
7523{
7524}
7525#endif
7526/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007527 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7528 * @dev: device upon which the ioctl was received
7529 * @info: ioctl request information
7530 * @wrqu: ioctl request data
7531 * @extra: ioctl extra data
7532 *
7533 * This is an SSR-protected generic handler for private ioctls which
7534 * take multiple arguments. Note that this implementation is also
7535 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7536 * interfaces.
7537 *
7538 * Return: 0 on success, non-zero on error
7539 */
7540static int __iw_set_var_ints_getnone(struct net_device *dev,
7541 struct iw_request_info *info,
7542 union iwreq_data *wrqu, char *extra)
7543{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007544 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007545 mac_handle_t mac_handle;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007546 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007547 int sub_cmd;
7548 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007549 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007550 int ret, num_args;
chenguoaa7c90c2018-05-24 17:08:47 +08007551 void *soc = NULL;
7552 struct cdp_pdev *pdev = NULL;
7553 struct cdp_vdev *vdev = NULL;
7554 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007555
Dustin Brownfdf17c12018-03-14 12:55:34 -07007556 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307557
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007558 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007559 ret = wlan_hdd_validate_context(hdd_ctx);
7560 if (0 != ret)
7561 return ret;
7562
Jeff Johnson441e1f72017-02-07 08:50:49 -08007563 ret = hdd_check_private_wext_control(hdd_ctx, info);
7564 if (0 != ret)
7565 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007566
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007567 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007568 sub_cmd = wrqu->data.flags;
7569 num_args = wrqu->data.length;
7570
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007571 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007572
7573 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007574 case WE_IBSS_GET_PEER_INFO:
7575 {
7576 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007577 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007578 }
7579 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007580
7581 case WE_P2P_NOA_CMD:
7582 {
Srinivas Girigowda5d5fdc52017-03-24 22:30:57 -07007583 struct p2p_app_set_ps p2pNoA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007584
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007585 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007586 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
Dustin Brown458027c2018-10-19 12:26:27 -07007587 qdf_opmode_str(adapter->device_mode),
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007588 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007589 return -EINVAL;
7590 }
7591
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007592 p2pNoA.opp_ps = apps_args[0];
7593 p2pNoA.ctWindow = apps_args[1];
7594 p2pNoA.duration = apps_args[2];
7595 p2pNoA.interval = apps_args[3];
7596 p2pNoA.count = apps_args[4];
7597 p2pNoA.single_noa_duration = apps_args[5];
7598 p2pNoA.psSelection = apps_args[6];
7599
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007600 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 -07007601 apps_args[0], apps_args[1], apps_args[2],
7602 apps_args[3], apps_args[4],
7603 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007604
7605 hdd_set_p2p_ps(dev, &p2pNoA);
7606
7607 }
7608 break;
7609
7610 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7611 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007612 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007613 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307614 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007615 }
7616 break;
7617
7618 case WE_MTRACE_DUMP_CMD:
7619 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007620 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007621 apps_args[0], apps_args[1],
7622 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007623 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007624 apps_args[1], apps_args[2],
7625 apps_args[3]);
7626
7627 }
7628 break;
7629
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007630 case WE_POLICY_MANAGER_CINFO_CMD:
7631 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007632 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007633 uint32_t i = 0, len = 0;
7634
Krunal Sonia6e505b2017-01-12 12:25:18 -08007635 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007636 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007637 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007638 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007639 pr_info("|table_index[%d]\t\t\n", i);
7640 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
7641 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
7642 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7643 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7644 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7645 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7646 pr_info("+--------------------------+\n");
7647 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007648 }
7649 }
7650 break;
7651
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007652 case WE_UNIT_TEST_CMD:
7653 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007654 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007655
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007656 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7657 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007658 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007659 return -EINVAL;
7660 }
Sourav Mohapatraea7210b2018-11-16 16:58:52 +05307661 if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307662 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007663 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007664 return -EINVAL;
7665 }
Jeff Johnson1b780e42017-10-31 14:11:45 -07007666 status = sme_send_unit_test_cmd(adapter->session_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007667 apps_args[0],
7668 apps_args[1],
7669 &apps_args[2]);
7670 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007671 hdd_err("sme_send_unit_test_cmd returned %d", status);
7672 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007673 }
7674 }
7675 break;
7676#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7677 case WE_LED_FLASHING_PARAM:
7678 {
7679 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007680
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007681 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007682 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007683 return -EINVAL;
7684 }
7685 for (i = 0; i < num_args; i++) {
7686 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007687 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007688 return -EINVAL;
7689 }
7690 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007691 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007692 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007693 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007694 1, apps_args[2], apps_args[3]);
7695 }
7696 break;
7697#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05307698 case WE_SET_PKTLOG:
7699 {
7700 int ret;
7701
7702 if (num_args < 1 || num_args > 2) {
7703 hdd_err("pktlog: either 1 or 2 parameters are required");
7704 return -EINVAL;
7705 }
7706
7707 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
7708 apps_args[1]);
7709 if (ret)
7710 return ret;
7711 break;
7712 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05307713 case WE_MAC_PWR_DEBUG_CMD:
7714 {
7715 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05307716 int i, j;
7717
7718 if (num_args < 3) {
7719 hdd_err("number of arguments can't be null %d",
7720 num_args);
7721 return -EINVAL;
7722 }
7723 if (num_args - 3 != apps_args[2]) {
7724 hdd_err("arg list of size %d doesn't match num_args %d",
7725 num_args-3, apps_args[2]);
7726 return -EINVAL;
7727 }
7728 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
7729 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
7730 hdd_err("Invalid MODULE ID %d", apps_args[1]);
7731 return -EINVAL;
7732 }
7733 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
7734 hdd_err("Too Many args %d", apps_args[2]);
7735 return -EINVAL;
7736 }
7737 mac_pwr_dbg_args.pdev_id = apps_args[0];
7738 mac_pwr_dbg_args.module_id = apps_args[1];
7739 mac_pwr_dbg_args.num_args = apps_args[2];
7740
7741 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
7742 mac_pwr_dbg_args.args[i] = apps_args[j];
7743
7744 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007745 sme_process_mac_pwr_dbg_cmd(mac_handle,
7746 adapter->session_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05307747 &mac_pwr_dbg_args)) {
7748 return -EINVAL;
7749 }
7750 }
7751 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08007752 case WE_POLICY_MANAGER_CLIST_CMD:
7753 case WE_POLICY_MANAGER_DLIST_CMD:
7754 case WE_POLICY_MANAGER_ULIST_CMD:
7755 case WE_POLICY_MANAGER_DBS_CMD:
7756 case WE_POLICY_MANAGER_PCL_CMD:
7757 case WE_POLICY_SET_HW_MODE_CMD:
7758 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7759 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7760 case WE_POLICY_MANAGER_SCENARIO_CMD:
7761 {
Krunal Soni3de68532018-09-05 12:16:58 -07007762 if (!hdd_ctx->config->is_unit_test_framework_enabled) {
7763 hdd_warn_rl("UT framework is disabled");
7764 return -EINVAL;
7765 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007766 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Soni3de68532018-09-05 12:16:58 -07007767 sub_cmd, apps_args);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007768 }
7769 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007770 case WE_SET_CHAN_AVOID:
7771 {
7772 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
7773 }
7774 break;
chenguoaa7c90c2018-05-24 17:08:47 +08007775 case WE_SET_TXRX_STATS:
7776 {
7777 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
7778 adapter->session_id);
7779
7780 if (ret != 0) {
7781 hdd_err("Invalid handles");
7782 break;
7783 }
7784
7785 req.stats = apps_args[0];
7786 /* default value of secondary parameter is 0(mac_id) */
7787 req.mac_id = apps_args[1];
7788
7789 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
7790 req.stats, req.mac_id);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007791 if (apps_args[0] == CDP_TXRX_STATS_28) {
7792 if (sta_ctx->conn_info.uIsAuthenticated) {
7793 hdd_debug("ap mac addr: %pM",
7794 (void *)&sta_ctx->conn_info.bssId);
7795 req.peer_addr =
7796 (char *)&sta_ctx->conn_info.bssId;
7797 }
7798 }
chenguoaa7c90c2018-05-24 17:08:47 +08007799 ret = cdp_txrx_stats_request(soc, vdev, &req);
7800 break;
7801 }
Visweswara Tanuku633976b2019-01-07 16:13:12 +05307802#ifdef WLAN_FEATURE_MOTION_DETECTION
7803 case WE_MOTION_DET_CONFIG_PARAM:
7804 {
7805 struct sme_motion_det_cfg motion_det_cfg;
7806
7807 if (num_args != 15) {
7808 hdd_err("mt_config: Invalid no of args");
7809 return -EINVAL;
7810 }
7811
7812 motion_det_cfg.vdev_id = adapter->session_id;
7813 motion_det_cfg.time_t1 = apps_args[0];
7814 motion_det_cfg.time_t2 = apps_args[1];
7815 motion_det_cfg.n1 = apps_args[2];
7816 motion_det_cfg.n2 = apps_args[3];
7817 motion_det_cfg.time_t1_gap = apps_args[4];
7818 motion_det_cfg.time_t2_gap = apps_args[5];
7819 motion_det_cfg.coarse_K = apps_args[6];
7820 motion_det_cfg.fine_K = apps_args[7];
7821 motion_det_cfg.coarse_Q = apps_args[8];
7822 motion_det_cfg.fine_Q = apps_args[9];
7823 motion_det_cfg.md_coarse_thr_high = apps_args[10];
7824 motion_det_cfg.md_fine_thr_high = apps_args[11];
7825 motion_det_cfg.md_coarse_thr_low = apps_args[12];
7826 motion_det_cfg.md_fine_thr_low = apps_args[13];
7827 adapter->motion_detection_mode = apps_args[14];
7828 sme_motion_det_config(hdd_ctx->mac_handle, &motion_det_cfg);
7829 }
7830 break;
7831 case WE_MOTION_DET_BASE_LINE_CONFIG_PARAM:
7832 {
7833 struct sme_motion_det_base_line_cfg motion_det_base_line_cfg;
7834
7835 if (num_args != 4) {
7836 hdd_err("mt_bl_config: Invalid no of args");
7837 return -EINVAL;
7838 }
7839
7840 motion_det_base_line_cfg.vdev_id = adapter->session_id;
7841 motion_det_base_line_cfg.bl_time_t = apps_args[0];
7842 motion_det_base_line_cfg.bl_packet_gap = apps_args[1];
7843 motion_det_base_line_cfg.bl_n = apps_args[2];
7844 motion_det_base_line_cfg.bl_num_meas = apps_args[3];
7845 sme_motion_det_base_line_config(hdd_ctx->mac_handle,
7846 &motion_det_base_line_cfg);
7847 }
7848 break;
7849#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku025f5862019-01-08 17:35:33 +05307850#ifdef FW_THERMAL_THROTTLE_SUPPORT
7851 case WE_SET_THERMAL_THROTTLE_CFG:
7852 {
7853 QDF_STATUS status;
7854
7855 if (num_args != 7) {
7856 hdd_err("set_thermal_cfg: Invalid no of args");
7857 return -EINVAL;
7858 }
7859
7860 /* Check for valid inputs */
7861 if (apps_args[0] < 0 || apps_args[0] > 1 || apps_args[1] < 0 ||
7862 apps_args[2] < 0 || apps_args[2] > 100 ||
7863 apps_args[3] < 0 || apps_args[3] > 3 || apps_args[4] < 0 ||
7864 apps_args[5] < 0 || apps_args[6] < 0 ||
7865 apps_args[5] <= apps_args[4])
7866 return -EINVAL;
7867
7868 status = sme_set_thermal_throttle_cfg(hdd_ctx->mac_handle,
7869 apps_args[0],
7870 apps_args[1],
7871 apps_args[2],
7872 apps_args[3],
7873 apps_args[6]);
7874 if (QDF_IS_STATUS_ERROR(status))
7875 return qdf_status_to_os_return(status);
7876
7877 if (!apps_args[6]) {
7878 status = sme_set_thermal_mgmt(hdd_ctx->mac_handle,
7879 apps_args[4],
7880 apps_args[5]);
7881 if (QDF_IS_STATUS_ERROR(status))
7882 return qdf_status_to_os_return(status);
7883 }
7884 break;
7885 }
7886#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007887 default:
7888 {
Jeff Johnson99bac312016-06-28 10:38:18 -07007889 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007890 }
7891 break;
7892 }
Dustin Browne74003f2018-03-14 12:51:58 -07007893 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007894 return 0;
7895}
7896
7897/**
7898 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
7899 * @dev: pointer to net_device structure
7900 * @info: pointer to iw_request_info structure
7901 * @wrqu: pointer to iwreq_data
7902 * @extra; extra
7903 *
7904 * Return: 0 on success, error number otherwise
7905 *
7906 */
7907static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
7908 struct iw_request_info *info,
7909 union iwreq_data *wrqu, char *extra)
7910{
7911 union iwreq_data u_priv_wrqu;
7912 int apps_args[MAX_VAR_ARGS] = {0};
7913 int ret, num_args;
7914
Mukul Sharma64a70e82015-11-02 20:05:09 +05307915 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007916 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05307917 return -EPERM;
7918 }
7919
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007920 /* Helper function to get iwreq_data with compat handling. */
7921 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
7922 return -EINVAL;
7923
7924 if (NULL == u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007925 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007926 return -EINVAL;
7927 }
7928
7929 num_args = u_priv_wrqu.data.length;
7930 if (num_args > MAX_VAR_ARGS)
7931 num_args = MAX_VAR_ARGS;
7932
7933 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
7934 (sizeof(int)) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007935 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007936 return -EFAULT;
7937 }
7938
7939 cds_ssr_protect(__func__);
7940 ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
7941 (char *)&apps_args);
7942 cds_ssr_unprotect(__func__);
7943 return ret;
7944}
7945
7946/**
7947 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7948 * @dev: device upon which the ioctl was received
7949 * @info: ioctl request information
7950 * @wrqu: ioctl request data
7951 * @extra: ioctl extra data
7952 *
7953 * This is a generic handler for private ioctls which take multiple
7954 * arguments. Note that this implementation is also somewhat unique
7955 * in that it is shared by both STA-mode and SAP-mode interfaces.
7956 *
7957 * Return: 0 on success, non-zero on error
7958 */
7959int iw_set_var_ints_getnone(struct net_device *dev,
7960 struct iw_request_info *info,
7961 union iwreq_data *wrqu, char *extra)
7962{
7963 int ret;
7964
7965 cds_ssr_protect(__func__);
7966 ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
7967 cds_ssr_unprotect(__func__);
7968 return ret;
7969}
7970
7971/**
7972 * iw_add_tspec - Add TSpec private ioctl handler
7973 * @dev: device upon which the ioctl was received
7974 * @info: ioctl request information
7975 * @wrqu: ioctl request data
7976 * @extra: ioctl extra data
7977 *
7978 * Return: 0 on success, non-zero on error
7979 */
7980static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
7981 union iwreq_data *wrqu, char *extra)
7982{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007983 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07007984 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007985 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
7986 int params[HDD_WLAN_WMM_PARAM_COUNT];
Abhishek Singh12be60f2017-08-11 13:52:42 +05307987 struct sme_qos_wmmtspecinfo tSpec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007988 uint32_t handle;
7989 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007990 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007991 int ret;
7992
Dustin Brownfdf17c12018-03-14 12:55:34 -07007993 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307994
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007995 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007996 ret = wlan_hdd_validate_context(hdd_ctx);
7997 if (0 != ret)
7998 return ret;
7999
Jeff Johnson441e1f72017-02-07 08:50:49 -08008000 ret = hdd_check_private_wext_control(hdd_ctx, info);
8001 if (0 != ret)
8002 return ret;
8003
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008004 /* make sure the application is sufficiently priviledged */
8005 /* note that the kernel will do this for "set" ioctls, but since */
8006 /* this ioctl wants to return status to user space it must be */
8007 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008008 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008009 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008010
8011 /* we must be associated in order to add a tspec */
Jeff Johnsond377dce2017-10-04 10:32:42 -07008012 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008013 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8014 return 0;
8015 }
8016 /* since we are defined to be a "get" ioctl, and since the number */
8017 /* of params exceeds the number of params that wireless extensions */
8018 /* will pass down in the iwreq_data, we must copy the "set" params. */
8019 /* We must handle the compat for iwreq_data in 32U/64K environment. */
8020
8021 /* helper function to get iwreq_data with compat handling. */
8022 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
8023 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8024 return 0;
8025 }
8026 /* make sure all params are correctly passed to function */
8027 if ((NULL == s_priv_data.pointer) ||
8028 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
8029 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8030 return 0;
8031 }
8032 /* from user space ourselves */
8033 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
8034 /* hmmm, can't get them */
8035 return -EIO;
8036 }
8037 /* clear the tspec */
8038 memset(&tSpec, 0, sizeof(tSpec));
8039
8040 /* validate the handle */
8041 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8042 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8043 /* that one is reserved */
8044 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8045 return 0;
8046 }
8047 /* validate the TID */
8048 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
8049 /* out of range */
8050 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8051 return 0;
8052 }
8053 tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
8054
8055 /* validate the direction */
8056 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
8057 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
8058 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
8059 break;
8060
8061 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
8062 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
8063 break;
8064
8065 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
8066 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
8067 break;
8068
8069 default:
8070 /* unknown */
8071 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8072 return 0;
8073 }
8074
8075 tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
8076
8077 /* validate the user priority */
8078 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
8079 /* out of range */
8080 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8081 return 0;
8082 }
8083 tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
8084 if (0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008085 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008086 return 0;
8087 }
8088
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008089 hdd_debug("TS_INFO PSB %d UP %d !!!",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008090 tSpec.ts_info.psb, tSpec.ts_info.up);
8091
8092 tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
8093 tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
8094 tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
8095 tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
8096 tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
8097 tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
8098 tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
8099 tSpec.surplus_bw_allowance =
8100 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
8101 tSpec.min_service_interval =
8102 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
8103 tSpec.max_service_interval =
8104 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
8105 tSpec.suspension_interval =
8106 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
8107 tSpec.inactivity_interval =
8108 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
8109
8110 tSpec.ts_info.burst_size_defn =
8111 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
8112
8113 /* validate the ts info ack policy */
8114 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
Abhinav Kumarab576712018-11-05 14:32:49 +05308115 case TS_INFO_ACK_POLICY_NORMAL_ACK:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008116 tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
8117 break;
8118
Abhinav Kumarab576712018-11-05 14:32:49 +05308119 case TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008120 tSpec.ts_info.ack_policy =
8121 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
8122 break;
8123
8124 default:
8125 /* unknown */
8126 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8127 return 0;
8128 }
8129
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008130 *pStatus = hdd_wmm_addts(adapter, handle, &tSpec);
Dustin Browne74003f2018-03-14 12:51:58 -07008131 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008132 return 0;
8133}
8134
8135static int iw_add_tspec(struct net_device *dev,
8136 struct iw_request_info *info,
8137 union iwreq_data *wrqu, char *extra)
8138{
8139 int ret;
8140
8141 cds_ssr_protect(__func__);
8142 ret = __iw_add_tspec(dev, info, wrqu, extra);
8143 cds_ssr_unprotect(__func__);
8144
8145 return ret;
8146}
8147
8148/**
8149 * iw_del_tspec - Delete TSpec private ioctl handler
8150 * @dev: device upon which the ioctl was received
8151 * @info: ioctl request information
8152 * @wrqu: ioctl request data
8153 * @extra: ioctl extra data
8154 *
8155 * Return: 0 on success, non-zero on error
8156 */
8157static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
8158 union iwreq_data *wrqu, char *extra)
8159{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008160 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008161 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008162 int *params = (int *)extra;
8163 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
8164 uint32_t handle;
8165 int ret;
8166
Dustin Brownfdf17c12018-03-14 12:55:34 -07008167 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308168
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008169 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008170 ret = wlan_hdd_validate_context(hdd_ctx);
8171 if (0 != ret)
8172 return ret;
8173
Jeff Johnson441e1f72017-02-07 08:50:49 -08008174 ret = hdd_check_private_wext_control(hdd_ctx, info);
8175 if (0 != ret)
8176 return ret;
8177
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008178 /* make sure the application is sufficiently priviledged */
8179 /* note that the kernel will do this for "set" ioctls, but since */
8180 /* this ioctl wants to return status to user space it must be */
8181 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008182 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008183 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008184
8185 /* although we are defined to be a "get" ioctl, the params we require */
8186 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8187 /* is no need to copy the params from user space */
8188
8189 /* validate the handle */
8190 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8191 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8192 /* that one is reserved */
8193 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8194 return 0;
8195 }
8196
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008197 *pStatus = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008198 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008199 return 0;
8200}
8201
8202static int iw_del_tspec(struct net_device *dev,
8203 struct iw_request_info *info,
8204 union iwreq_data *wrqu, char *extra)
8205{
8206 int ret;
8207
8208 cds_ssr_protect(__func__);
8209 ret = __iw_del_tspec(dev, info, wrqu, extra);
8210 cds_ssr_unprotect(__func__);
8211
8212 return ret;
8213}
8214
8215/**
8216 * iw_get_tspec - Get TSpec private ioctl handler
8217 * @dev: device upon which the ioctl was received
8218 * @info: ioctl request information
8219 * @wrqu: ioctl request data
8220 * @extra: ioctl extra data
8221 *
8222 * Return: 0 on success, non-zero on error
8223 */
8224static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
8225 union iwreq_data *wrqu, char *extra)
8226{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008227 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008228 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008229 int *params = (int *)extra;
8230 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
8231 uint32_t handle;
8232 int ret;
8233
Dustin Brownfdf17c12018-03-14 12:55:34 -07008234 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308235
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008236 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008237 ret = wlan_hdd_validate_context(hdd_ctx);
8238 if (0 != ret)
8239 return ret;
8240
Jeff Johnson441e1f72017-02-07 08:50:49 -08008241 ret = hdd_check_private_wext_control(hdd_ctx, info);
8242 if (0 != ret)
8243 return ret;
8244
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008245 /* although we are defined to be a "get" ioctl, the params we require */
8246 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8247 /* is no need to copy the params from user space */
8248
8249 /* validate the handle */
8250 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8251 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8252 /* that one is reserved */
8253 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
8254 return 0;
8255 }
8256
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008257 *pStatus = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008258 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008259 return 0;
8260}
8261
8262static int iw_get_tspec(struct net_device *dev,
8263 struct iw_request_info *info,
8264 union iwreq_data *wrqu, char *extra)
8265{
8266 int ret;
8267
8268 cds_ssr_protect(__func__);
8269 ret = __iw_get_tspec(dev, info, wrqu, extra);
8270 cds_ssr_unprotect(__func__);
8271
8272 return ret;
8273}
8274
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008275/**
8276 * iw_set_fties - Set FT IEs private ioctl handler
8277 * @dev: device upon which the ioctl was received
8278 * @info: ioctl request information
8279 * @wrqu: ioctl request data
8280 * @extra: ioctl extra data
8281 *
8282 * Each time the supplicant has the auth_request or reassoc request
8283 * IEs ready they are pushed to the driver. The driver will in turn
8284 * use it to send out the auth req and reassoc req for 11r FT Assoc.
8285 *
8286 * Return: 0 on success, non-zero on error
8287 */
8288static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
8289 union iwreq_data *wrqu, char *extra)
8290{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008291 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008292 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008293 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008294 int ret;
8295
Dustin Brownfdf17c12018-03-14 12:55:34 -07008296 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308297
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008298 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008299 ret = wlan_hdd_validate_context(hdd_ctx);
8300 if (0 != ret)
8301 return ret;
8302
Jeff Johnson441e1f72017-02-07 08:50:49 -08008303 ret = hdd_check_private_wext_control(hdd_ctx, info);
8304 if (0 != ret)
8305 return ret;
8306
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008307 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008308 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008309 return -EINVAL;
8310 }
8311 if (wrqu->data.pointer == NULL) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008312 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008313 return -EINVAL;
8314 }
8315 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsond377dce2017-10-04 10:32:42 -07008316 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008317 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008318 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008319 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008320 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008321 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008322
8323 /* Pass the received FT IEs to SME */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008324 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->session_id,
8325 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07008326 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008327 return 0;
8328}
8329
8330static int iw_set_fties(struct net_device *dev,
8331 struct iw_request_info *info,
8332 union iwreq_data *wrqu, char *extra)
8333{
8334 int ret;
8335
8336 cds_ssr_protect(__func__);
8337 ret = __iw_set_fties(dev, info, wrqu, extra);
8338 cds_ssr_unprotect(__func__);
8339
8340 return ret;
8341}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008342
Dustin Brown0cbc7572016-12-16 13:54:40 -08008343/**
8344 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
8345 * @dev: device upon which the ioctl was received
8346 * @info: ioctl request information
8347 * @wrqu: ioctl request data
8348 * @extra: ioctl extra data
8349 *
Dustin Brown860566f2017-01-31 15:24:43 -08008350 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
8351 * time being to provide guidance in migrating to standard APIs.
8352 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08008353 * Return: 0 on success, non-zero on error
8354 */
8355static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
8356 struct iw_request_info *info,
8357 union iwreq_data *wrqu,
8358 char *extra)
8359{
Dustin Brown860566f2017-01-31 15:24:43 -08008360 hdd_err("\n"
8361 "setMCBCFilter is obsolete. Use the following instead:\n"
8362 "Configure multicast filtering via the ‘ip’ command.\n"
8363 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
8364 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
8365 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
8366 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
8367 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07008368 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08008369}
8370
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008371/**
8372 * iw_set_host_offload - Set host offload ioctl handler
8373 * @dev: device upon which the ioctl was received
8374 * @info: ioctl request information
8375 * @wrqu: ioctl request data
8376 * @extra: ioctl extra data
8377 *
8378 * Return: 0 on success, non-zero on error
8379 */
8380static int __iw_set_host_offload(struct net_device *dev,
8381 struct iw_request_info *info,
8382 union iwreq_data *wrqu, char *extra)
8383{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008384 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Srinivas Girigowda077143e2017-03-25 10:47:27 -07008385 struct host_offload_req *pRequest = (struct host_offload_req *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008386 tSirHostOffloadReq offloadRequest;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008387 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008388 int ret;
8389
Dustin Brownfdf17c12018-03-14 12:55:34 -07008390 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308391
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008392 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008393 ret = wlan_hdd_validate_context(hdd_ctx);
8394 if (0 != ret)
8395 return ret;
8396
Jeff Johnson441e1f72017-02-07 08:50:49 -08008397 ret = hdd_check_private_wext_control(hdd_ctx, info);
8398 if (0 != ret)
8399 return ret;
8400
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008401 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008402 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008403 return -EINVAL;
8404 }
8405
8406 /* Debug display of request components. */
8407 switch (pRequest->offloadType) {
8408 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008409 hdd_debug("Host offload request: ARP reply");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008410 switch (pRequest->enableOrDisable) {
8411 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008412 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008413 break;
8414 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008415 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07008416 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008417 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008418 hdd_debug(" ARP offload enable");
8419 hdd_debug(" IP address: %d.%d.%d.%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008420 pRequest->params.hostIpv4Addr[0],
8421 pRequest->params.hostIpv4Addr[1],
8422 pRequest->params.hostIpv4Addr[2],
8423 pRequest->params.hostIpv4Addr[3]);
8424 }
8425 break;
8426
8427 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008428 hdd_debug("Host offload request: neighbor discovery");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008429 switch (pRequest->enableOrDisable) {
8430 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008431 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008432 break;
8433 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008434 hdd_debug(" enable");
8435 hdd_debug(" IP address: %x:%x:%x:%x:%x:%x:%x:%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008436 *(uint16_t *) (pRequest->params.hostIpv6Addr),
8437 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8438 2),
8439 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8440 4),
8441 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8442 6),
8443 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8444 8),
8445 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8446 10),
8447 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8448 12),
8449 *(uint16_t *) (pRequest->params.hostIpv6Addr +
8450 14));
8451 }
8452 }
8453
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05308454 qdf_mem_zero(&offloadRequest, sizeof(offloadRequest));
8455 offloadRequest.offloadType = pRequest->offloadType;
8456 offloadRequest.enableOrDisable = pRequest->enableOrDisable;
8457 qdf_mem_copy(&offloadRequest.params, &pRequest->params,
8458 sizeof(pRequest->params));
8459 qdf_mem_copy(&offloadRequest.bssid, &pRequest->bssId.bytes,
8460 QDF_MAC_ADDR_SIZE);
8461
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308462 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008463 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnson1b780e42017-10-31 14:11:45 -07008464 adapter->session_id, &offloadRequest)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008465 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008466 return -EINVAL;
8467 }
Dustin Browne74003f2018-03-14 12:51:58 -07008468 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008469 return 0;
8470}
8471
8472static int iw_set_host_offload(struct net_device *dev,
8473 struct iw_request_info *info,
8474 union iwreq_data *wrqu, char *extra)
8475{
8476 int ret;
8477
8478 cds_ssr_protect(__func__);
8479 ret = __iw_set_host_offload(dev, info, wrqu, extra);
8480 cds_ssr_unprotect(__func__);
8481
8482 return ret;
8483}
8484
8485/**
8486 * iw_set_keepalive_params - Set keepalive params ioctl handler
8487 * @dev: device upon which the ioctl was received
8488 * @info: ioctl request information
8489 * @wrqu: ioctl request data
8490 * @extra: ioctl extra data
8491 *
8492 * Return: 0 on success, non-zero on error
8493 */
8494static int __iw_set_keepalive_params(struct net_device *dev,
8495 struct iw_request_info *info,
8496 union iwreq_data *wrqu, char *extra)
8497{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008498 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008499 tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008500 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008501 int ret;
8502
Dustin Brownfdf17c12018-03-14 12:55:34 -07008503 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308504
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008505 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008506 ret = wlan_hdd_validate_context(hdd_ctx);
8507 if (0 != ret)
8508 return ret;
8509
Jeff Johnson441e1f72017-02-07 08:50:49 -08008510 ret = hdd_check_private_wext_control(hdd_ctx, info);
8511 if (0 != ret)
8512 return ret;
8513
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008514 if (wrqu->data.length != sizeof(*request)) {
8515 hdd_err("Invalid length %d", wrqu->data.length);
8516 return -EINVAL;
8517 }
8518
Wu Gao93816212018-08-31 16:49:54 +08008519 if (request->timePeriod > cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008520 hdd_err("Value of timePeriod %d exceed Max limit %d",
8521 request->timePeriod,
Wu Gao93816212018-08-31 16:49:54 +08008522 cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008523 return -EINVAL;
8524 }
8525
8526 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008527 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008528 request->timePeriod, sizeof(tSirKeepAliveReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008529
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008530 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008531 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008532 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008533 break;
8534
8535 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008536 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008537
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008538 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008539 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8540 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008541
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008542 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008543 request->destIpv4Addr[0], request->destIpv4Addr[1],
8544 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008545
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008546 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -08008547 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008548 break;
8549 }
8550
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008551 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008552
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308553 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008554 sme_set_keep_alive(hdd_ctx->mac_handle,
8555 adapter->session_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008556 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008557 return -EINVAL;
8558 }
Dustin Browne74003f2018-03-14 12:51:58 -07008559 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008560 return 0;
8561}
8562
8563static int iw_set_keepalive_params(struct net_device *dev,
8564 struct iw_request_info *info,
8565 union iwreq_data *wrqu,
8566 char *extra)
8567{
8568 int ret;
8569
8570 cds_ssr_protect(__func__);
8571 ret = __iw_set_keepalive_params(dev, info, wrqu, extra);
8572 cds_ssr_unprotect(__func__);
8573
8574 return ret;
8575}
8576
8577#ifdef WLAN_FEATURE_PACKET_FILTERING
8578/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308579 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8580 * @priv_data: Pointer to the priv data from user space
8581 * @request: Pointer to the struct containing the copied data from user space
8582 *
8583 * Return: False on invalid length, true otherwise
8584 */
8585static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8586 uint16_t length)
8587{
8588 int max_params_size, rcvd_params_size;
8589
8590 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8591 sizeof(struct pkt_filter_param_cfg);
8592
8593 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8594 hdd_err("Less than minimum number of arguments needed");
8595 return false;
8596 }
8597
8598 rcvd_params_size = request->num_params *
8599 sizeof(struct pkt_filter_param_cfg);
8600
8601 if (length != sizeof(struct pkt_filter_cfg) -
8602 max_params_size + rcvd_params_size) {
8603 hdd_err("Arguments do not match the number of params provided");
8604 return false;
8605 }
8606
8607 return true;
8608}
8609
8610/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008611 * __iw_set_packet_filter_params() - set packet filter parameters in target
8612 * @dev: Pointer to netdev
8613 * @info: Pointer to iw request info
8614 * @wrqu: Pointer to data
8615 * @extra: Pointer to extra data
8616 *
8617 * Return: 0 on success, non-zero on error
8618 */
8619static int __iw_set_packet_filter_params(struct net_device *dev,
8620 struct iw_request_info *info,
8621 union iwreq_data *wrqu, char *extra)
8622{
8623 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008624 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008625 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008626 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008627 struct pkt_filter_cfg *request = NULL;
8628
Mukul Sharma472382f2015-11-02 20:16:31 +05308629 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008630 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308631 return -EPERM;
8632 }
8633
Dustin Brownfdf17c12018-03-14 12:55:34 -07008634 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308635
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008636 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8637 ret = wlan_hdd_validate_context(hdd_ctx);
8638 if (0 != ret)
8639 return ret;
8640
Jeff Johnson441e1f72017-02-07 08:50:49 -08008641 ret = hdd_check_private_wext_control(hdd_ctx, info);
8642 if (0 != ret)
8643 return ret;
8644
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008645 if (hdd_priv_get_data(&priv_data, wrqu)) {
8646 hdd_err("failed to get priv data");
8647 return -EINVAL;
8648 }
8649
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308650 if ((NULL == priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008651 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008652 priv_data.pointer, priv_data.length);
8653 return -EINVAL;
8654 }
8655
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308656 if (adapter->device_mode != QDF_STA_MODE) {
8657 hdd_err("Packet filter not supported for this mode :%d",
8658 adapter->device_mode);
8659 return -ENOTSUPP;
8660 }
8661
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308662 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8663 hdd_err("Packet filter not supported in disconnected state");
8664 return -ENOTSUPP;
8665 }
8666
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008667 /* copy data using copy_from_user */
8668 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
8669 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308670
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008671 if (NULL == request) {
8672 hdd_err("mem_alloc_copy_from_user_helper fail");
8673 return -ENOMEM;
8674 }
8675
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308676 if (!validate_packet_filter_params_size(request, priv_data.length)) {
8677 hdd_err("Invalid priv data length %d", priv_data.length);
8678 qdf_mem_free(request);
8679 return -EINVAL;
8680 }
8681
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05308682 if (request->filter_action == HDD_RCV_FILTER_SET)
8683 hdd_ctx->user_configured_pkt_filter_rules |=
8684 1 << request->filter_id;
8685 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
8686 hdd_ctx->user_configured_pkt_filter_rules &=
8687 ~(1 << request->filter_id);
8688
Jeff Johnson1b780e42017-10-31 14:11:45 -07008689 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->session_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008690
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07008691 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07008692 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008693 return ret;
8694}
8695
8696/**
8697 * iw_set_packet_filter_params() - set packet filter parameters in target
8698 * @dev: Pointer to netdev
8699 * @info: Pointer to iw request info
8700 * @wrqu: Pointer to data
8701 * @extra: Pointer to extra data
8702 *
8703 * Return: 0 on success, non-zero on error
8704 */
8705static int iw_set_packet_filter_params(struct net_device *dev,
8706 struct iw_request_info *info,
8707 union iwreq_data *wrqu, char *extra)
8708{
8709 int ret;
8710
8711 cds_ssr_protect(__func__);
8712 ret = __iw_set_packet_filter_params(dev, info, wrqu, extra);
8713 cds_ssr_unprotect(__func__);
8714
8715 return ret;
8716}
8717#endif
8718
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008719#ifdef QCA_SUPPORT_CP_STATS
8720static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
8721{
8722 return wlan_hdd_get_station_stats(adapter);
8723}
8724#else /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008725struct hdd_statistics_priv {
8726 tCsrSummaryStatsInfo summary_stats;
8727 tCsrGlobalClassAStatsInfo class_a_stats;
8728 tCsrGlobalClassDStatsInfo class_d_stats;
8729};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008730
Jeff Johnsond37833f2018-03-07 14:22:44 -08008731/**
8732 * hdd_statistics_cb() - "Get statistics" callback function
Jeff Johnsonced658b2018-03-08 09:54:01 -08008733 * @stats: statistics payload
8734 * @context: opaque context originally passed to SME. HDD always passes
8735 * a cookie for the request context
Jeff Johnsond37833f2018-03-07 14:22:44 -08008736 *
8737 * Return: None
8738 */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008739static void hdd_statistics_cb(void *stats, void *context)
Jeff Johnsond37833f2018-03-07 14:22:44 -08008740{
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008741 struct osif_request *request;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008742 struct hdd_statistics_priv *priv;
8743 tCsrSummaryStatsInfo *summary_stats;
8744 tCsrGlobalClassAStatsInfo *class_a_stats;
8745 tCsrGlobalClassDStatsInfo *class_d_stats;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008746
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008747 request = osif_request_get(context);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008748 if (!request) {
8749 hdd_err("Obsolete request");
8750 return;
Jeff Johnsond37833f2018-03-07 14:22:44 -08008751 }
8752
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008753 priv = osif_request_priv(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008754
8755 summary_stats = (tCsrSummaryStatsInfo *)stats;
8756 priv->summary_stats = *summary_stats;
8757
8758 class_a_stats = (tCsrGlobalClassAStatsInfo *)(summary_stats + 1);
8759 priv->class_a_stats = *class_a_stats;
8760
8761 class_d_stats = (tCsrGlobalClassDStatsInfo *)(class_a_stats + 1);
8762 priv->class_d_stats = *class_d_stats;
8763
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008764 osif_request_complete(request);
8765 osif_request_put(request);
Jeff Johnsond37833f2018-03-07 14:22:44 -08008766}
8767
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008768static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008769{
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008770 int ret = 0;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008771 void *cookie;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008772 QDF_STATUS status;
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008773 struct osif_request *request;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008774 struct hdd_station_ctx *sta_ctx;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008775 struct hdd_statistics_priv *priv;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008776 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008777 static const struct osif_request_params params = {
Jeff Johnsonced658b2018-03-08 09:54:01 -08008778 .priv_size = sizeof(*priv),
8779 .timeout_ms = WLAN_WAIT_TIME_STATS,
8780 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008781
Jeff Johnsonced658b2018-03-08 09:54:01 -08008782 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008783 request = osif_request_alloc(&params);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008784 if (!request) {
8785 hdd_warn("request allocation failed");
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008786 return -EINVAL;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008787 }
8788
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008789 cookie = osif_request_cookie(request);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008790 status = sme_get_statistics(hdd_ctx->mac_handle, eCSR_HDD,
Jeff Johnsonced658b2018-03-08 09:54:01 -08008791 SME_SUMMARY_STATS |
8792 SME_GLOBAL_CLASSA_STATS |
8793 SME_GLOBAL_CLASSD_STATS,
8794 hdd_statistics_cb,
8795 sta_ctx->conn_info.staId[0],
8796 cookie, adapter->session_id);
8797
8798 if (QDF_STATUS_SUCCESS != status) {
8799 hdd_warn("Unable to retrieve SME statistics");
8800 goto put_request;
8801 }
8802
8803 /* request was sent -- wait for the response */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008804 ret = osif_request_wait_for_response(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08008805 if (ret) {
8806 hdd_err("Failed to wait for statistics, errno %d", ret);
8807 goto put_request;
8808 }
8809
8810 /* update the adapter cache with the fresh results */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008811 priv = osif_request_priv(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008812 adapter->hdd_stats.summary_stat = priv->summary_stats;
8813 adapter->hdd_stats.class_a_stat = priv->class_a_stats;
8814 adapter->hdd_stats.class_d_stat = priv->class_d_stats;
Jeff Johnsonced658b2018-03-08 09:54:01 -08008815
8816put_request:
8817 /*
8818 * either we never sent a request, we sent a request and
8819 * received a response or we sent a request and timed out.
8820 * regardless we are done with the request.
8821 */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07008822 osif_request_put(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008823 return ret;
8824}
8825#endif /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08008826
Naveen Rawatfa2a1002018-05-17 16:06:37 -07008827static int __iw_get_statistics(struct net_device *dev,
8828 struct iw_request_info *info,
8829 union iwreq_data *wrqu, char *extra)
8830{
8831 int ret;
8832 char *p;
8833 int tlen;
8834 struct hdd_station_ctx *sta_ctx;
8835 tCsrSummaryStatsInfo *summary_stats;
8836 tCsrGlobalClassAStatsInfo *class_a_stats;
8837 tCsrGlobalClassDStatsInfo *class_d_stats;
8838 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
8839 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8840
8841 hdd_enter_dev(dev);
8842
8843 ret = wlan_hdd_validate_context(hdd_ctx);
8844 if (0 != ret)
8845 return ret;
8846
8847 ret = hdd_check_private_wext_control(hdd_ctx, info);
8848 if (0 != ret)
8849 return ret;
8850
8851 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
8852 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
8853 wrqu->data.length = 0;
8854 return 0;
8855 }
8856
8857 hdd_get_wlan_stats(adapter);
8858
8859 summary_stats = &(adapter->hdd_stats.summary_stat);
8860 class_a_stats = &(adapter->hdd_stats.class_a_stat);
8861 class_d_stats = &(adapter->hdd_stats.class_d_stat);
8862
Jeff Johnsonced658b2018-03-08 09:54:01 -08008863 p = extra;
8864 tlen = 0;
8865
8866 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
8867 sizeof(summary_stats->retry_cnt),
8868 &(summary_stats->retry_cnt[0]), tlen);
8869
8870 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
8871 sizeof(summary_stats->multiple_retry_cnt),
8872 &(summary_stats->multiple_retry_cnt[0]), tlen);
8873
8874 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
8875 sizeof(summary_stats->tx_frm_cnt),
8876 &(summary_stats->tx_frm_cnt[0]), tlen);
8877
8878 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
8879 sizeof(summary_stats->rx_frm_cnt),
8880 &(summary_stats->rx_frm_cnt), tlen);
8881
8882 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
8883 sizeof(summary_stats->frm_dup_cnt),
8884 &(summary_stats->frm_dup_cnt), tlen);
8885
8886 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
8887 sizeof(summary_stats->fail_cnt),
8888 &(summary_stats->fail_cnt[0]), tlen);
8889
8890 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
8891 sizeof(summary_stats->rts_fail_cnt),
8892 &(summary_stats->rts_fail_cnt), tlen);
8893
8894 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
8895 sizeof(summary_stats->ack_fail_cnt),
8896 &(summary_stats->ack_fail_cnt), tlen);
8897
8898 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
8899 sizeof(summary_stats->rts_succ_cnt),
8900 &(summary_stats->rts_succ_cnt), tlen);
8901
8902 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
8903 sizeof(summary_stats->rx_discard_cnt),
8904 &(summary_stats->rx_discard_cnt), tlen);
8905
8906 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
8907 sizeof(summary_stats->rx_error_cnt),
8908 &(summary_stats->rx_error_cnt), tlen);
8909
8910 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
8911 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8912 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8913
8914 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
8915 sizeof(class_d_stats->rx_byte_cnt),
8916 &(class_d_stats->rx_byte_cnt), tlen);
8917
8918 FILL_TLV(p, WLAN_STATS_RX_RATE,
8919 sizeof(class_d_stats->rx_rate),
8920 &(class_d_stats->rx_rate), tlen);
8921
8922 /* Transmit rate, in units of 500 kbit/sec */
8923 FILL_TLV(p, WLAN_STATS_TX_RATE,
8924 sizeof(class_a_stats->tx_rate),
8925 &(class_a_stats->tx_rate), tlen);
8926
8927 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
8928 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
8929 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
8930 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
8931 sizeof(class_d_stats->rx_mc_byte_cnt),
8932 &(class_d_stats->rx_mc_byte_cnt), tlen);
8933 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
8934 sizeof(class_d_stats->rx_bc_byte_cnt),
8935 &(class_d_stats->rx_bc_byte_cnt), tlen);
8936 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
8937 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
8938 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
8939 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
8940 sizeof(class_d_stats->tx_mc_byte_cnt),
8941 &(class_d_stats->tx_mc_byte_cnt), tlen);
8942 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
8943 sizeof(class_d_stats->tx_bc_byte_cnt),
8944 &(class_d_stats->tx_bc_byte_cnt), tlen);
8945
8946 wrqu->data.length = tlen;
8947
Dustin Browne74003f2018-03-14 12:51:58 -07008948 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008949
8950 return 0;
8951}
8952
8953static int iw_get_statistics(struct net_device *dev,
8954 struct iw_request_info *info,
8955 union iwreq_data *wrqu, char *extra)
8956{
8957 int ret;
8958
8959 cds_ssr_protect(__func__);
8960 ret = __iw_get_statistics(dev, info, wrqu, extra);
8961 cds_ssr_unprotect(__func__);
8962
8963 return ret;
8964}
8965
8966#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008967/*Max Len for PNO notification*/
8968#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05308969static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
8970 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008971{
Abhishek Singh0481d662017-04-11 18:20:11 +05308972 struct vdev_osif_priv *osif_priv;
8973 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008974 union iwreq_data wrqu;
8975 char buf[MAX_PNO_NOTIFY_LEN + 1];
8976
Abhishek Singh0481d662017-04-11 18:20:11 +05308977 wlan_vdev_obj_lock(vdev);
8978 osif_priv = wlan_vdev_get_ospriv(vdev);
8979 wlan_vdev_obj_unlock(vdev);
8980 if (!osif_priv) {
8981 hdd_err("osif_priv is null");
8982 return;
8983 }
8984
8985 wdev = osif_priv->wdev;
8986 if (!wdev) {
8987 hdd_err("wdev is null");
8988 return;
8989 }
8990
8991 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008992
8993 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05308994 qdf_mem_zero(&wrqu, sizeof(wrqu));
8995 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008996
8997 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05308998 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008999
9000 wrqu.data.pointer = buf;
9001 wrqu.data.length = strlen(buf);
9002
9003 /* send the event */
9004
Abhishek Singh0481d662017-04-11 18:20:11 +05309005 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009006}
9007
9008/**
9009 * __iw_set_pno() - Preferred Network Offload ioctl handler
9010 * @dev: device upon which the ioctl was received
9011 * @info: ioctl request information
9012 * @wrqu: ioctl request data
9013 * @extra: ioctl extra data
9014 *
9015 * This function parses a Preferred Network Offload command
9016 * Input is string based and expected to be of the form:
9017 *
9018 * <enable(1) | disable(0)>
9019 * when enabling:
9020 * <number of networks>
9021 * for each network:
9022 * <ssid_len> <ssid> <authentication> <encryption>
9023 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07009024 * <scan_time (seconds)>
9025 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009026 * <suspend mode>
9027 *
9028 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07009029 * 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 -08009030 *
9031 * this translates into:
9032 * -----------------------------
9033 * enable PNO
9034 * 2 networks
9035 * Network 1:
9036 * test - with authentication type 0 and encryption type 0,
9037 * search on 3 channels: 1 6 and 11,
9038 * SSID bcast type is unknown (directed probe will be sent if
9039 * AP not found) and must meet -40dBm RSSI
9040 * Network 2:
9041 * test2 - with authentication type 4 and encryption type 4,
9042 * search on 6 channels 1, 2, 3, 4, 5 and 6
9043 * bcast type is non-bcast (directed probe will be sent)
9044 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009045 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07009046 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009047 */
9048static int __iw_set_pno(struct net_device *dev,
9049 struct iw_request_info *info,
9050 union iwreq_data *wrqu, char *extra)
9051{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009052 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009053 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05309054 uint8_t value;
9055 struct wlan_objmgr_vdev *vdev;
9056 struct wlan_objmgr_psoc *psoc;
9057 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009058 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309059 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05309060 uint8_t i, j, params;
9061 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309062 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009063
9064 /* request is a large struct, so we make it static to avoid
9065 * stack overflow. This API is only invoked via ioctl, so it
9066 * is serialized by the kernel rtnl_lock and hence does not
9067 * need to be reentrant
9068 */
Abhishek Singh0481d662017-04-11 18:20:11 +05309069 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009070
Dustin Brownfdf17c12018-03-14 12:55:34 -07009071 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009072
9073 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9074 ret = wlan_hdd_validate_context(hdd_ctx);
9075 if (ret)
9076 return ret;
9077
Jeff Johnson441e1f72017-02-07 08:50:49 -08009078 ret = hdd_check_private_wext_control(hdd_ctx, info);
9079 if (0 != ret)
9080 return ret;
9081
Dustin Brown07901ec2018-09-07 11:02:41 -07009082 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->pdev,
9083 dev->dev_addr,
9084 WLAN_LEGACY_MAC_ID);
Abhishek Singh0481d662017-04-11 18:20:11 +05309085 if (!vdev) {
9086 hdd_err("vdev object is NULL");
9087 return -EIO;
9088 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009089
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309090 /* making sure argument string ends with '\0' */
9091 len = (wrqu->data.length + 1);
9092 data = qdf_mem_malloc(len);
9093 if (!data) {
9094 hdd_err("fail to allocate memory %zu", len);
9095 return -EINVAL;
9096 }
9097 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309098 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009099
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05309100 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
9101
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309102 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009103 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309104 ret = -EINVAL;
9105 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009106 }
9107
Abhishek Singh0481d662017-04-11 18:20:11 +05309108 if (!value) {
9109 status = ucfg_scan_pno_stop(vdev);
9110 if (QDF_IS_STATUS_ERROR(status)) {
9111 hdd_err("Failed to disabled PNO");
9112 ret = -EINVAL;
9113 } else {
9114 hdd_debug("PNO scan disabled");
9115 }
9116 goto exit;
9117 }
9118
9119 if (ucfg_scan_get_pno_in_progress(vdev)) {
9120 hdd_debug("pno is already in progress");
9121 ret = -EBUSY;
9122 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009123 }
9124
9125 ptr += offset;
9126
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309127 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009128 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309129 ret = -EINVAL;
9130 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009131 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309132 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009133
Abhishek Singh0481d662017-04-11 18:20:11 +05309134 hdd_debug("PNO enable networks count %d offset %d",
9135 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009136
Abhishek Singh0481d662017-04-11 18:20:11 +05309137 if ((0 == req.networks_cnt) ||
9138 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009139 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05309140 req.networks_cnt);
9141 ret = -EINVAL;
9142 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009143 }
9144
9145 ptr += offset;
9146
Abhishek Singh0481d662017-04-11 18:20:11 +05309147 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009148
Abhishek Singh0481d662017-04-11 18:20:11 +05309149 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009150
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309151 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309152 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009153 &offset);
9154
9155 if (1 != params) {
9156 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309157 ret = -EINVAL;
9158 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009159 }
9160
Abhishek Singh0481d662017-04-11 18:20:11 +05309161 if ((0 == req.networks_list[i].ssid.length) ||
9162 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009163 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309164 req.networks_list[i].ssid.length, i);
9165 ret = -EINVAL;
9166 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009167 }
9168
9169 /* Advance to SSID */
9170 ptr += offset;
9171
Abhishek Singh0481d662017-04-11 18:20:11 +05309172 memcpy(req.networks_list[i].ssid.ssid, ptr,
9173 req.networks_list[i].ssid.length);
9174 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009175
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309176 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309177 &(req.networks_list[i].authentication),
9178 &(req.networks_list[i].encryption),
9179 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009180 &offset);
9181
9182 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009183 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309184 ret = -EINVAL;
9185 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009186 }
9187
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009188 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309189 req.networks_list[i].ssid.length,
9190 req.networks_list[i].ssid.length,
9191 req.networks_list[i].ssid.ssid,
9192 req.networks_list[i].authentication,
9193 req.networks_list[i].encryption,
9194 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009195
9196 /* Advance to channel list */
9197 ptr += offset;
9198
Abhishek Singh0481d662017-04-11 18:20:11 +05309199 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
9200 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009201 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05309202 ret = -EINVAL;
9203 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009204 }
9205
Abhishek Singh0481d662017-04-11 18:20:11 +05309206 if (0 != req.networks_list[i].channel_cnt) {
9207 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009208 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309209 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05309210 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009211 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009212 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309213 ret = -EINVAL;
9214 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009215 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309216 if (!IS_CHANNEL_VALID(value)) {
9217 hdd_err("invalid channel: %hhu", value);
9218 ret = -EINVAL;
9219 goto exit;
9220 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309221 req.networks_list[i].channels[j] =
9222 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009223 /* Advance to next channel number */
9224 ptr += offset;
9225 }
9226 }
9227
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309228 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309229 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009230 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009231 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009232 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309233 ret = -EINVAL;
9234 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009235 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309236 if (req.networks_list[i].bc_new_type > 2) {
9237 hdd_err("invalid bcast nw type: %u",
9238 req.networks_list[i].bc_new_type);
9239 ret = -EINVAL;
9240 goto exit;
9241 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009242
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009243 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309244 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009245
9246 /* Advance to rssi Threshold */
9247 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309248 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309249 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009250 &offset)) {
9251 hdd_err("PNO rssi threshold input is not valid %s",
9252 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309253 ret = -EINVAL;
9254 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009255 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009256 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309257 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009258 /* Advance to next network */
9259 ptr += offset;
9260 } /* For ucNetworkCount */
9261
Abhishek Singh0481d662017-04-11 18:20:11 +05309262 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309263 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05309264 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07009265 ptr += offset;
9266 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309267 if (req.fast_scan_period == 0) {
9268 hdd_err("invalid fast scan period %u",
9269 req.fast_scan_period);
9270 ret = -EINVAL;
9271 goto exit;
9272 }
Dustin Brown43e87292016-10-10 10:38:25 -07009273
Abhishek Singh0481d662017-04-11 18:20:11 +05309274 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309275 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07009276 &offset) > 0)
9277 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05309278 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07009279
Dustin Brown07901ec2018-09-07 11:02:41 -07009280 wlan_pdev_obj_lock(hdd_ctx->pdev);
9281 psoc = wlan_pdev_get_psoc(hdd_ctx->pdev);
9282 wlan_pdev_obj_unlock(hdd_ctx->pdev);
Abhishek Singh0481d662017-04-11 18:20:11 +05309283 ucfg_scan_register_pno_cb(psoc,
9284 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009285
Abhishek Singh0481d662017-04-11 18:20:11 +05309286 ucfg_scan_get_pno_def_params(vdev, &req);
9287 status = ucfg_scan_pno_start(vdev, &req);
9288 if (QDF_IS_STATUS_ERROR(status)) {
9289 hdd_err("Failed to enable PNO");
9290 ret = -EINVAL;
9291 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009292
Abhishek Singh0481d662017-04-11 18:20:11 +05309293exit:
9294 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009295
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309296 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05309297 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009298}
9299
9300static int iw_set_pno(struct net_device *dev,
9301 struct iw_request_info *info,
9302 union iwreq_data *wrqu, char *extra)
9303{
9304 int ret;
9305
9306 cds_ssr_protect(__func__);
9307 ret = __iw_set_pno(dev, info, wrqu, extra);
9308 cds_ssr_unprotect(__func__);
9309
9310 return ret;
9311}
9312#endif /* FEATURE_WLAN_SCAN_PNO */
9313
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009314static int __iw_set_band_config(struct net_device *dev,
9315 struct iw_request_info *info,
9316 union iwreq_data *wrqu, char *extra)
9317{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009318 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009319 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08009320 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009321 int *value = (int *)extra;
9322
Dustin Brownfdf17c12018-03-14 12:55:34 -07009323 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009324
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309325 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009326 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309327 return -EPERM;
9328 }
9329
Jeff Johnson441e1f72017-02-07 08:50:49 -08009330 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9331 ret = hdd_check_private_wext_control(hdd_ctx, info);
9332 if (0 != ret)
9333 return ret;
9334
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07009335 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009336}
9337
9338static int iw_set_band_config(struct net_device *dev,
9339 struct iw_request_info *info,
9340 union iwreq_data *wrqu, char *extra)
9341{
9342 int ret;
9343
9344 cds_ssr_protect(__func__);
9345 ret = __iw_set_band_config(dev, info, wrqu, extra);
9346 cds_ssr_unprotect(__func__);
9347
9348 return ret;
9349}
9350
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009351static int printk_adapter(void *priv, const char *fmt, ...)
9352{
9353 int ret;
9354 va_list args;
9355
9356 va_start(args, fmt);
9357 ret = vprintk(fmt, args);
9358 ret += printk("\n");
9359 va_end(args);
9360
9361 return ret;
9362}
9363
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009364static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
9365{
9366 qdf_abstract_print *print = &printk_adapter;
9367
9368 switch (log_id) {
9369 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009370 cds_print_htc_credit_history(count, print, NULL);
9371 break;
9372 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009373 wma_print_wmi_cmd_log(count, print, NULL);
9374 break;
9375 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009376 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
9377 break;
9378 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009379 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
9380 break;
9381 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009382 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
9383 break;
9384 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009385 wma_print_wmi_event_log(count, print, NULL);
9386 break;
9387 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009388 wma_print_wmi_rx_event_log(count, print, NULL);
9389 break;
9390 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009391 wma_print_wmi_mgmt_event_log(count, print, NULL);
9392 break;
9393 default:
9394 print(NULL, "Invalid Log Id %d", log_id);
9395 break;
9396 }
9397}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009398
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009399#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
9400int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
9401{
9402 struct hdd_context *hdd_ctx;
9403 int ret;
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309404 bool crash_inject;
9405 QDF_STATUS status;
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009406
9407 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
9408 v1, v2);
9409 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
9410 v1, v2);
9411 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309412
Vignesh Viswanathana1f3a1a2018-10-04 13:10:46 +05309413 status = ucfg_mlme_get_crash_inject(hdd_ctx->psoc, &crash_inject);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309414 if (QDF_IS_STATUS_ERROR(status)) {
9415 hdd_err("Failed to get crash inject ini config");
9416 return 0;
9417 }
9418
9419 if (!crash_inject) {
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009420 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
9421 return 0;
9422 }
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309423
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009424 if (v1 == 3) {
9425 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
9426 return 0;
9427 }
9428 ret = wma_cli_set2_command(adapter->session_id,
9429 GEN_PARAM_CRASH_INJECT,
9430 v1, v2, GEN_CMD);
9431 return ret;
9432}
9433#endif
9434
Nirav Shahd21a2e32018-04-20 16:34:43 +05309435#ifdef CONFIG_DP_TRACE
9436void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
9437{
9438 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
9439 cmd_type, count);
9440 if (cmd_type == DUMP_DP_TRACE)
9441 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
9442 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
9443 qdf_dp_trace_enable_live_mode();
9444 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
9445 qdf_dp_trace_clear_buffer();
9446 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
9447 qdf_dp_trace_disable_live_mode();
9448}
9449#endif
9450
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009451static int __iw_set_two_ints_getnone(struct net_device *dev,
9452 struct iw_request_info *info,
9453 union iwreq_data *wrqu, char *extra)
9454{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009455 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009456 int *value = (int *)extra;
9457 int sub_cmd = value[0];
9458 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08009459 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009460 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08009461 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009462
Dustin Brownfdf17c12018-03-14 12:55:34 -07009463 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009464
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009465 ret = wlan_hdd_validate_context(hdd_ctx);
9466 if (0 != ret)
9467 return ret;
9468
Jeff Johnson441e1f72017-02-07 08:50:49 -08009469 ret = hdd_check_private_wext_control(hdd_ctx, info);
9470 if (0 != ret)
9471 return ret;
9472
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009473 switch (sub_cmd) {
9474 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009475 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07009476 ret = wma_cli_set_command(adapter->session_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009477 WMI_STA_SMPS_PARAM_CMDID,
9478 value[1] << WMA_SMPS_PARAM_VALUE_S
9479 | value[2],
9480 VDEV_CMD);
9481 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009482 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009483 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009484 break;
Govind Singha471e5e2015-10-12 17:11:14 +05309485 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07009486 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309487 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07009488 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309489 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
9490 value[1], value[2], DBG_CMD);
9491 break;
9492 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07009493 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309494 value[1], value[2]);
Jeff Johnson1b780e42017-10-31 14:11:45 -07009495 ret = wma_cli_set2_command(adapter->session_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309496 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
9497 value[1], value[2], DBG_CMD);
9498 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009499 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
9500 hdd_debug("Ioctl to set dual fw mode config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08009501 status =
9502 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
9503 &dual_mac_feature);
9504 if (status != QDF_STATUS_SUCCESS)
9505 hdd_err("can't get dual mac feature val, use def");
9506 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009507 hdd_err("Dual mac feature is disabled from INI");
9508 return -EPERM;
9509 }
9510 hdd_debug("%d %d", value[1], value[2]);
Dustin Brown05d81302018-09-11 16:49:22 -07009511 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009512 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009513 break;
9514 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05309515 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009516 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009517 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009518 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009519 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07009520 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08009521 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
9522 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009523 break;
9524 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07009525 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009526 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009527 case WE_LOG_BUFFER: {
9528 int log_id = value[1];
9529 uint32_t count = value[2] < 0 ? 0 : value[2];
9530
9531 hdd_ioctl_log_buffer(log_id, count);
9532
9533 break;
9534 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07009535 case WE_SET_BA_AGEING_TIMEOUT:
9536 {
9537 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
9538
9539 if (!soc) {
9540 hdd_err("Invalid handles");
9541 break;
9542 }
9543 cdp_set_ba_timeout(soc, value[1], value[2]);
9544 break;
9545 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009546 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07009547 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009548 break;
9549 }
9550
9551 return ret;
9552}
9553
9554static int iw_set_two_ints_getnone(struct net_device *dev,
9555 struct iw_request_info *info,
9556 union iwreq_data *wrqu, char *extra)
9557{
9558 int ret;
9559
9560 cds_ssr_protect(__func__);
9561 ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
9562 cds_ssr_unprotect(__func__);
9563
9564 return ret;
9565}
9566
9567/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009568
9569static const iw_handler we_private[] = {
9570
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009571 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9572 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9573 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009574 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9575 iw_set_three_ints_getnone,
9576 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009577 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009578 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9579 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009580 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9581 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309582#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009583 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309584#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009585 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9586 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9587 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009588 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009589 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9590 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9591 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9592 iw_set_keepalive_params,
9593#ifdef WLAN_FEATURE_PACKET_FILTERING
9594 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9595 iw_set_packet_filter_params,
9596#endif
9597#ifdef FEATURE_WLAN_SCAN_PNO
9598 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9599#endif
9600 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009601 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9602 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009603 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
9604 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9605 iw_set_two_ints_getnone,
9606 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9607 iw_set_dot11p_channel_sched,
9608};
9609
9610/*Maximum command length can be only 15 */
9611static const struct iw_priv_args we_private_args[] = {
9612
9613 /* handlers for main ioctl */
9614 {WLAN_PRIV_SET_INT_GET_NONE,
9615 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9616 0,
9617 ""},
9618
9619 /* handlers for sub-ioctl */
9620 {WE_SET_11D_STATE,
9621 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9622 0,
9623 "set11Dstate"},
9624
9625 {WE_WOWL,
9626 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9627 0,
9628 "wowl"},
9629
9630 {WE_SET_POWER,
9631 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9632 0,
9633 "setPower"},
9634
9635 {WE_SET_MAX_ASSOC,
9636 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9637 0,
9638 "setMaxAssoc"},
9639
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009640 {WE_SET_SCAN_DISABLE,
9641 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9642 0,
9643 "scan_disable"},
9644
9645 {WE_SET_DATA_INACTIVITY_TO,
9646 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9647 0,
9648 "inactivityTO"},
9649
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05309650 {WE_SET_WOW_DATA_INACTIVITY_TO,
9651 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9652 0,
9653 "wow_ito"},
9654
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009655 {WE_SET_MAX_TX_POWER,
9656 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9657 0,
9658 "setMaxTxPower"},
9659
9660 {WE_SET_TX_POWER,
9661 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9662 0,
9663 "setTxPower"},
9664
9665 {WE_SET_MC_RATE,
9666 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9667 0,
9668 "setMcRate"},
9669
9670 {WE_SET_MAX_TX_POWER_2_4,
9671 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9672 0,
9673 "setTxMaxPower2G"},
9674
9675 {WE_SET_MAX_TX_POWER_5_0,
9676 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9677 0,
9678 "setTxMaxPower5G"},
9679
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309680#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009681 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05309682 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009683 0,
9684 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +05309685#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08009686
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009687 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
9688 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -08009689 * will support both
9690 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009691 {WE_SET_MAX_TX_POWER,
9692 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9693 0,
9694 "setTxMaxPower"},
9695
Jeff Johnson0187c622019-01-04 06:39:44 -08009696#ifdef HASTINGS_BT_WAR
9697 {WE_SET_HASTINGS_BT_WAR,
9698 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9699 0,
9700 "hastings_bt_war"},
9701#endif
9702
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009703 {WE_SET_TM_LEVEL,
9704 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9705 0,
9706 "setTmLevel"},
9707
9708 {WE_SET_PHYMODE,
9709 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9710 0,
9711 "setphymode"},
9712
9713 {WE_SET_NSS,
9714 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9715 0,
9716 "nss"},
9717
9718 {WE_SET_LDPC,
9719 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9720 0,
9721 "ldpc"},
9722
9723 {WE_SET_TX_STBC,
9724 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9725 0,
9726 "tx_stbc"},
9727
9728 {WE_SET_RX_STBC,
9729 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9730 0,
9731 "rx_stbc"},
9732
9733 {WE_SET_SHORT_GI,
9734 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9735 0,
9736 "shortgi"},
9737
9738 {WE_SET_RTSCTS,
9739 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9740 0,
9741 "enablertscts"},
9742
9743 {WE_SET_CHWIDTH,
9744 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9745 0,
9746 "chwidth"},
9747
9748 {WE_SET_ANI_EN_DIS,
9749 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9750 0,
9751 "anienable"},
9752
9753 {WE_SET_ANI_POLL_PERIOD,
9754 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9755 0,
9756 "aniplen"},
9757
9758 {WE_SET_ANI_LISTEN_PERIOD,
9759 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9760 0,
9761 "anilislen"},
9762
9763 {WE_SET_ANI_OFDM_LEVEL,
9764 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9765 0,
9766 "aniofdmlvl"},
9767
9768 {WE_SET_ANI_CCK_LEVEL,
9769 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9770 0,
9771 "aniccklvl"},
9772
9773 {WE_SET_DYNAMIC_BW,
9774 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9775 0,
9776 "cwmenable"},
9777
9778 {WE_SET_CTS_CBW,
9779 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9780 0,
9781 "cts_cbw" },
9782
9783 {WE_SET_GTX_HT_MCS,
9784 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9785 0,
9786 "gtxHTMcs"},
9787
9788 {WE_SET_GTX_VHT_MCS,
9789 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9790 0,
9791 "gtxVHTMcs"},
9792
9793 {WE_SET_GTX_USRCFG,
9794 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9795 0,
9796 "gtxUsrCfg"},
9797
9798 {WE_SET_GTX_THRE,
9799 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9800 0,
9801 "gtxThre"},
9802
9803 {WE_SET_GTX_MARGIN,
9804 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9805 0,
9806 "gtxMargin"},
9807
9808 {WE_SET_GTX_STEP,
9809 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9810 0,
9811 "gtxStep"},
9812
9813 {WE_SET_GTX_MINTPC,
9814 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9815 0,
9816 "gtxMinTpc"},
9817
9818 {WE_SET_GTX_BWMASK,
9819 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9820 0,
9821 "gtxBWMask"},
9822
9823 {WE_SET_TX_CHAINMASK,
9824 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9825 0,
9826 "txchainmask"},
9827
9828 {WE_SET_RX_CHAINMASK,
9829 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9830 0,
9831 "rxchainmask"},
9832
9833 {WE_SET_11N_RATE,
9834 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9835 0,
9836 "set11NRates"},
9837
9838 {WE_SET_VHT_RATE,
9839 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9840 0,
9841 "set11ACRates"},
9842
9843 {WE_SET_AMPDU,
9844 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9845 0,
9846 "ampdu"},
9847
9848 {WE_SET_AMSDU,
9849 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9850 0,
9851 "amsdu"},
9852
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009853 {WE_SET_TXPOW_2G,
9854 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9855 0,
9856 "txpow2g"},
9857
9858 {WE_SET_TXPOW_5G,
9859 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9860 0,
9861 "txpow5g"},
9862
Wen Gong99768902018-04-25 12:07:49 +08009863#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009864 /* Sub-cmds DBGLOG specific commands */
9865 {WE_DBGLOG_LOG_LEVEL,
9866 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9867 0,
9868 "dl_loglevel"},
9869
9870 {WE_DBGLOG_VAP_ENABLE,
9871 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9872 0,
9873 "dl_vapon"},
9874
9875 {WE_DBGLOG_VAP_DISABLE,
9876 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9877 0,
9878 "dl_vapoff"},
9879
9880 {WE_DBGLOG_MODULE_ENABLE,
9881 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9882 0,
9883 "dl_modon"},
9884
9885 {WE_DBGLOG_MODULE_DISABLE,
9886 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9887 0,
9888 "dl_modoff"},
9889
9890 {WE_DBGLOG_MOD_LOG_LEVEL,
9891 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9892 0,
9893 "dl_mod_loglevel"},
9894
9895 {WE_DBGLOG_TYPE,
9896 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9897 0,
9898 "dl_type"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +05309899
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009900 {WE_DBGLOG_REPORT_ENABLE,
9901 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9902 0,
9903 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +08009904#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009905
9906 {WE_SET_TXRX_FWSTATS,
9907 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9908 0,
9909 "txrx_fw_stats"},
9910
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009911 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +08009912 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08009913 0,
9914 "txrx_stats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +05309915#ifdef FW_THERMAL_THROTTLE_SUPPORT
9916 {WE_SET_THERMAL_THROTTLE_CFG,
9917 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
9918 0,
9919 "set_thermal_cfg"},
9920#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009921 {WE_TXRX_FWSTATS_RESET,
9922 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9923 0,
9924 "txrx_fw_st_rst"},
9925
9926 {WE_PPS_PAID_MATCH,
9927 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9928 0, "paid_match"},
9929
9930 {WE_PPS_GID_MATCH,
9931 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9932 0, "gid_match"},
9933
9934 {WE_PPS_EARLY_TIM_CLEAR,
9935 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9936 0, "tim_clear"},
9937
9938 {WE_PPS_EARLY_DTIM_CLEAR,
9939 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9940 0, "dtim_clear"},
9941
9942 {WE_PPS_EOF_PAD_DELIM,
9943 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9944 0, "eof_delim"},
9945
9946 {WE_PPS_MACADDR_MISMATCH,
9947 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9948 0, "mac_match"},
9949
9950 {WE_PPS_DELIM_CRC_FAIL,
9951 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9952 0, "delim_fail"},
9953
9954 {WE_PPS_GID_NSTS_ZERO,
9955 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9956 0, "nsts_zero"},
9957
9958 {WE_PPS_RSSI_CHECK,
9959 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9960 0, "rssi_chk"},
9961
9962 {WE_PPS_5G_EBT,
9963 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9964 0, "5g_ebt"},
9965
9966 {WE_SET_HTSMPS,
9967 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9968 0, "htsmps"},
9969
9970 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
9971 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9972 0, "set_qpspollcnt"},
9973
9974 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
9975 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9976 0, "set_qtxwake"},
9977
9978 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
9979 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9980 0, "set_qwakeintv"},
9981
9982 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
9983 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9984 0, "set_qnodatapoll"},
9985
9986 /* handlers for MCC time quota and latency sub ioctls */
9987 {WE_MCC_CONFIG_LATENCY,
9988 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9989 0, "setMccLatency"},
9990
9991 {WE_MCC_CONFIG_QUOTA,
9992 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9993 0, "setMccQuota"},
9994
9995 {WE_SET_DEBUG_LOG,
9996 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9997 0, "setDbgLvl"},
9998
9999 /* handlers for early_rx power save */
10000 {WE_SET_EARLY_RX_ADJUST_ENABLE,
10001 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10002 0, "erx_enable"},
10003
10004 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
10005 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10006 0, "erx_bmiss_val"},
10007
10008 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
10009 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10010 0, "erx_bmiss_smpl"},
10011
10012 {WE_SET_EARLY_RX_SLOP_STEP,
10013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10014 0, "erx_slop_step"},
10015
10016 {WE_SET_EARLY_RX_INIT_SLOP,
10017 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10018 0, "erx_init_slop"},
10019
10020 {WE_SET_EARLY_RX_ADJUST_PAUSE,
10021 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10022 0, "erx_adj_pause"},
10023
10024 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
10025 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10026 0, "erx_dri_sample"},
10027
10028 {WE_DUMP_STATS,
10029 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10030 0, "dumpStats"},
10031
10032 {WE_CLEAR_STATS,
10033 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10034 0, "clearStats"},
10035
Govind Singha471e5e2015-10-12 17:11:14 +053010036 {WE_START_FW_PROFILE,
10037 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10038 0, "startProfile"},
10039
Abhishek Singh1bdb1572015-10-16 16:24:19 +053010040 {WE_SET_CHANNEL,
10041 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10042 0, "setChanChange" },
10043
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +053010044 {WE_SET_CONC_SYSTEM_PREF,
10045 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10046 0, "setConcSysPref" },
10047
Jeff Johnson011c4502017-10-05 15:25:56 -070010048 {WE_SET_PDEV_RESET,
10049 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10050 0, "pdev_reset" },
10051
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010052 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -080010053 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10054 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010055
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010056 {WLAN_PRIV_SET_NONE_GET_INT,
10057 0,
10058 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10059 ""},
10060
10061 /* handlers for sub-ioctl */
10062 {WE_GET_11D_STATE,
10063 0,
10064 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10065 "get11Dstate"},
10066
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010067 {WE_GET_WLAN_DBG,
10068 0,
10069 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10070 "getwlandbg"},
10071
10072 {WE_GET_MAX_ASSOC,
10073 0,
10074 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10075 "getMaxAssoc"},
10076
10077 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010078 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10079 "getAutoChannel"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010080
10081 {WE_GET_CONCURRENCY_MODE,
10082 0,
10083 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10084 "getconcurrency"},
10085
10086 {WE_GET_NSS,
10087 0,
10088 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10089 "get_nss"},
10090
10091 {WE_GET_LDPC,
10092 0,
10093 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10094 "get_ldpc"},
10095
10096 {WE_GET_TX_STBC,
10097 0,
10098 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10099 "get_tx_stbc"},
10100
10101 {WE_GET_RX_STBC,
10102 0,
10103 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10104 "get_rx_stbc"},
10105
10106 {WE_GET_SHORT_GI,
10107 0,
10108 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10109 "get_shortgi"},
10110
10111 {WE_GET_RTSCTS,
10112 0,
10113 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10114 "get_rtscts"},
10115
10116 {WE_GET_CHWIDTH,
10117 0,
10118 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10119 "get_chwidth"},
10120
10121 {WE_GET_ANI_EN_DIS,
10122 0,
10123 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10124 "get_anienable"},
10125
10126 {WE_GET_ANI_POLL_PERIOD,
10127 0,
10128 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10129 "get_aniplen"},
10130
10131 {WE_GET_ANI_LISTEN_PERIOD,
10132 0,
10133 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10134 "get_anilislen"},
10135
10136 {WE_GET_ANI_OFDM_LEVEL,
10137 0,
10138 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10139 "get_aniofdmlvl"},
10140
10141 {WE_GET_ANI_CCK_LEVEL,
10142 0,
10143 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10144 "get_aniccklvl"},
10145
10146 {WE_GET_DYNAMIC_BW,
10147 0,
10148 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10149 "get_cwmenable"},
10150
10151 {WE_GET_GTX_HT_MCS,
10152 0,
10153 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10154 "get_gtxHTMcs"},
10155
10156 {WE_GET_GTX_VHT_MCS,
10157 0,
10158 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10159 "get_gtxVHTMcs"},
10160
10161 {WE_GET_GTX_USRCFG,
10162 0,
10163 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10164 "get_gtxUsrCfg"},
10165
10166 {WE_GET_GTX_THRE,
10167 0,
10168 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10169 "get_gtxThre"},
10170
10171 {WE_GET_GTX_MARGIN,
10172 0,
10173 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10174 "get_gtxMargin"},
10175
10176 {WE_GET_GTX_STEP,
10177 0,
10178 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10179 "get_gtxStep"},
10180
10181 {WE_GET_GTX_MINTPC,
10182 0,
10183 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10184 "get_gtxMinTpc"},
10185
10186 {WE_GET_GTX_BWMASK,
10187 0,
10188 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10189 "get_gtxBWMask"},
10190
10191 {WE_GET_TX_CHAINMASK,
10192 0,
10193 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10194 "get_txchainmask"},
10195
10196 {WE_GET_RX_CHAINMASK,
10197 0,
10198 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10199 "get_rxchainmask"},
10200
10201 {WE_GET_11N_RATE,
10202 0,
10203 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10204 "get_11nrate"},
10205
10206 {WE_GET_AMPDU,
10207 0,
10208 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10209 "get_ampdu"},
10210
10211 {WE_GET_AMSDU,
10212 0,
10213 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10214 "get_amsdu"},
10215
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010216 {WE_GET_TXPOW_2G,
10217 0,
10218 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10219 "get_txpow2g"},
10220
10221 {WE_GET_TXPOW_5G,
10222 0,
10223 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10224 "get_txpow5g"},
10225
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010226 {WE_GET_PPS_PAID_MATCH,
10227 0,
10228 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10229 "get_paid_match"},
10230
10231 {WE_GET_PPS_GID_MATCH,
10232 0,
10233 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10234 "get_gid_match"},
10235
10236 {WE_GET_PPS_EARLY_TIM_CLEAR,
10237 0,
10238 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10239 "get_tim_clear"},
10240
10241 {WE_GET_PPS_EARLY_DTIM_CLEAR,
10242 0,
10243 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10244 "get_dtim_clear"},
10245
10246 {WE_GET_PPS_EOF_PAD_DELIM,
10247 0,
10248 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10249 "get_eof_delim"},
10250
10251 {WE_GET_PPS_MACADDR_MISMATCH,
10252 0,
10253 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10254 "get_mac_match"},
10255
10256 {WE_GET_PPS_DELIM_CRC_FAIL,
10257 0,
10258 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10259 "get_delim_fail"},
10260
10261 {WE_GET_PPS_GID_NSTS_ZERO,
10262 0,
10263 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10264 "get_nsts_zero"},
10265
10266 {WE_GET_PPS_RSSI_CHECK,
10267 0,
10268 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10269 "get_rssi_chk"},
10270
10271 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
10272 0,
10273 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10274 "get_qpspollcnt"},
10275
10276 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
10277 0,
10278 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10279 "get_qtxwake"},
10280
10281 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10282 0,
10283 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10284 "get_qwakeintv"},
10285
10286 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10287 0,
10288 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10289 "get_qnodatapoll"},
10290
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010291 {WE_CAP_TSF,
10292 0,
10293 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10294 "cap_tsf"},
10295
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010296 {WE_GET_TEMPERATURE,
10297 0,
10298 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10299 "get_temp"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010300
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010301 {WE_GET_DCM,
10302 0,
10303 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10304 "get_dcm"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010305
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010306 {WE_GET_RANGE_EXT,
10307 0,
10308 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10309 "get_range_ext"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010310
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010311 /* handlers for main ioctl */
10312 {WLAN_PRIV_SET_CHAR_GET_NONE,
10313 IW_PRIV_TYPE_CHAR | 512,
10314 0,
10315 ""},
10316
10317 /* handlers for sub-ioctl */
10318 {WE_WOWL_ADD_PTRN,
10319 IW_PRIV_TYPE_CHAR | 512,
10320 0,
10321 "wowlAddPtrn"},
10322
10323 {WE_WOWL_DEL_PTRN,
10324 IW_PRIV_TYPE_CHAR | 512,
10325 0,
10326 "wowlDelPtrn"},
10327
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010328 /* handlers for sub-ioctl */
10329 {WE_NEIGHBOR_REPORT_REQUEST,
10330 IW_PRIV_TYPE_CHAR | 512,
10331 0,
10332 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080010333
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010334 {WE_SET_AP_WPS_IE,
10335 IW_PRIV_TYPE_CHAR | 512,
10336 0,
10337 "set_ap_wps_ie"},
10338
10339 {WE_SET_CONFIG,
10340 IW_PRIV_TYPE_CHAR | 512,
10341 0,
10342 "setConfig"},
10343
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070010344#ifdef WLAN_UNIT_TEST
10345 {WE_UNIT_TEST,
10346 IW_PRIV_TYPE_CHAR | 512,
10347 0,
10348 "unit_test"},
10349#endif
10350
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010351 /* handlers for main ioctl */
10352 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
10353 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10354 0,
10355 ""},
10356
10357 /* handlers for sub-ioctl */
10358 {WE_SET_WLAN_DBG,
10359 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10360 0,
10361 "setwlandbg"},
10362
Nirav Shahd21a2e32018-04-20 16:34:43 +053010363#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010364 /* handlers for sub-ioctl */
10365 {WE_SET_DP_TRACE,
10366 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10367 0,
10368 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010369#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010370
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053010371 {WE_SET_FW_TEST,
10372 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10373 0, "fw_test"},
10374
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010375 /* handlers for main ioctl */
10376 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
10377 0,
10378 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010379 ""},
10380
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010381 {WE_GET_TSF,
10382 0,
10383 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010384 "get_tsf"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010385
10386 {WE_SET_DUAL_MAC_SCAN_CONFIG,
10387 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10388 0,
10389 "set_scan_cfg"},
10390
10391 /* handlers for main ioctl */
10392 {WLAN_PRIV_GET_CHAR_SET_NONE,
10393 0,
10394 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10395 ""},
10396
10397 /* handlers for sub-ioctl */
10398 {WE_WLAN_VERSION,
10399 0,
10400 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10401 "version"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010402
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010403 {WE_GET_STATS,
10404 0,
10405 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10406 "getStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010407
Dustin Brownd9322482017-01-09 12:46:03 -080010408 {WE_GET_SUSPEND_RESUME_STATS,
10409 0,
10410 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10411 "getSuspendStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010412
Govind Singha471e5e2015-10-12 17:11:14 +053010413 {WE_LIST_FW_PROFILE,
10414 0,
10415 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10416 "listProfile"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010417
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010418 {WE_GET_STATES,
10419 0,
10420 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10421 "getHostStates"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010422
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010423 {WE_GET_CFG,
10424 0,
10425 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10426 "getConfig"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010427
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010428 {WE_GET_RSSI,
10429 0,
10430 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10431 "getRSSI"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010432
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010433 {WE_GET_WMM_STATUS,
10434 0,
10435 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10436 "getWmmStatus"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010437
10438 {WE_GET_CHANNEL_LIST,
10439 0,
10440 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10441 "getChannelList"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010442#ifdef FEATURE_WLAN_TDLS
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010443 {WE_GET_TDLS_PEERS,
10444 0,
10445 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10446 "getTdlsPeers"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010447#endif
10448#ifdef WLAN_FEATURE_11W
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010449 {WE_GET_11W_INFO,
10450 0,
10451 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10452 "getPMFInfo"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010453#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010454 {WE_GET_STA_CXN_INFO,
10455 0,
10456 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10457 "get_cxn_info" },
Krunal Soni5e483782018-10-25 15:42:44 -070010458
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010459 {WE_GET_IBSS_STA_INFO,
10460 0,
10461 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10462 "getIbssSTAs"},
10463
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010464 {WE_GET_PHYMODE,
10465 0,
10466 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10467 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010468#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010469 {WE_GET_OEM_DATA_CAP,
10470 0,
10471 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10472 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010473#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010474 {WE_GET_SNR,
10475 0,
10476 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10477 "getSNR"},
10478
Krunal Soni6c3859f2018-06-01 19:57:40 -070010479 {WE_GET_BA_AGEING_TIMEOUT,
10480 0,
10481 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10482 "get_ba_timeout"},
10483
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010484 /* handlers for main ioctl */
10485 {WLAN_PRIV_SET_NONE_GET_NONE,
10486 0,
10487 0,
10488 ""},
10489
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010490 /* handlers for sub-ioctl */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010491 {WE_IBSS_GET_PEER_INFO_ALL,
10492 0,
10493 0,
10494 "ibssPeerInfoAll"},
10495
Govind Singha471e5e2015-10-12 17:11:14 +053010496 {WE_GET_FW_PROFILE_DATA,
10497 0,
10498 0,
10499 "getProfileData"},
10500
10501 {WE_SET_REASSOC_TRIGGER,
10502 0,
10503 0,
10504 "reassoc"},
10505
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010506 {WE_STOP_OBSS_SCAN,
10507 0,
10508 0,
10509 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010510 /* handlers for main ioctl */
10511 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
10512 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10513 0,
10514 ""},
10515
10516 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010517 {WE_IBSS_GET_PEER_INFO,
10518 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10519 0,
10520 "ibssPeerInfo"},
10521
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010522#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010523 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010524 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
10525 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10526 0,
10527 "setdumplog"},
10528
10529 {WE_MTRACE_DUMP_CMD,
10530 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10531 0,
10532 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010533#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -080010534
10535 {WE_POLICY_MANAGER_CINFO_CMD,
10536 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10537 0,
10538 "pm_cinfo"},
10539
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010540#ifdef MPC_UT_FRAMEWORK
10541 {WE_POLICY_MANAGER_CLIST_CMD,
10542 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10543 0,
10544 "pm_clist"},
10545
10546 {WE_POLICY_MANAGER_DLIST_CMD,
10547 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10548 0,
10549 "pm_dlist"},
10550
10551 {WE_POLICY_MANAGER_DBS_CMD,
10552 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10553 0,
10554 "pm_dbs"},
10555
10556 {WE_POLICY_MANAGER_PCL_CMD,
10557 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10558 0,
10559 "pm_pcl"},
10560
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010561 {WE_POLICY_MANAGER_ULIST_CMD,
10562 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10563 0,
10564 "pm_ulist"},
10565
10566 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
10567 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10568 0,
10569 "pm_query_action"},
10570
10571 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
10572 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10573 0,
10574 "pm_query_allow"},
10575
10576 {WE_POLICY_MANAGER_SCENARIO_CMD,
10577 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10578 0,
10579 "pm_run_scenario"},
10580
10581 {WE_POLICY_SET_HW_MODE_CMD,
10582 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10583 0,
10584 "pm_set_hw_mode"},
10585#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010586 {WE_UNIT_TEST_CMD,
10587 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10588 0,
10589 "setUnitTestCmd"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010590
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010591 {WE_MAC_PWR_DEBUG_CMD,
10592 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10593 0,
10594 "halPwrDebug"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010595#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10596 {WE_LED_FLASHING_PARAM,
10597 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10598 0,
10599 "gpio_control"},
10600#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010601#ifdef WLAN_DEBUG
10602 {WE_SET_CHAN_AVOID,
10603 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10604 0,
10605 "ch_avoid"},
10606#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010607 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010608 {WLAN_PRIV_FIPS_TEST,
10609 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10610 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10611 "fips_test"},
10612
10613 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010614 {WLAN_PRIV_ADD_TSPEC,
10615 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10616 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10617 "addTspec"},
10618
10619 /* handlers for main ioctl */
10620 {WLAN_PRIV_DEL_TSPEC,
10621 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10622 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10623 "delTspec"},
10624
10625 /* handlers for main ioctl */
10626 {WLAN_PRIV_GET_TSPEC,
10627 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10628 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10629 "getTspec"},
10630
10631 /* handlers for main ioctl - host offload */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010632 {WLAN_PRIV_SET_HOST_OFFLOAD,
10633 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
10634 0,
10635 "setHostOffload"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010636
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010637 {WLAN_GET_WLAN_STATISTICS,
10638 0,
10639 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10640 "getWlanStats"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010641
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010642 {WLAN_SET_KEEPALIVE_PARAMS,
10643 IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) |
10644 IW_PRIV_SIZE_FIXED,
10645 0,
10646 "setKeepAlive"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010647#ifdef WLAN_FEATURE_PACKET_FILTERING
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010648 {WLAN_SET_PACKET_FILTER_PARAMS,
10649 IW_PRIV_TYPE_BYTE |
10650 sizeof(struct pkt_filter_cfg),
10651 0,
10652 "setPktFilter"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010653#endif
10654#ifdef FEATURE_WLAN_SCAN_PNO
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010655 {WLAN_SET_PNO,
10656 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10657 0,
10658 "setpno"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010659#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010660 {WLAN_SET_BAND_CONFIG,
10661 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10662 0,
10663 "SETBAND"},
Dustin Brown0cbc7572016-12-16 13:54:40 -080010664
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010665 {WLAN_PRIV_SET_MCBC_FILTER,
10666 0,
10667 0,
10668 "setMCBCFilter"},
10669
10670 {WLAN_GET_LINK_SPEED,
10671 IW_PRIV_TYPE_CHAR | 18,
10672 IW_PRIV_TYPE_CHAR | 5,
10673 "getLinkSpeed"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010674
10675 /* handlers for main ioctl */
10676 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
10677 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
10678 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010679 ""},
10680
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010681 {WE_SET_SMPS_PARAM,
10682 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010683 0, "set_smps_param"},
10684
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010685 {WLAN_SET_DOT11P_CHANNEL_SCHED,
10686 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010687 0, "set_dot11p" },
10688
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010689#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010690 {WE_SET_FW_CRASH_INJECT,
10691 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010692 0, "crash_inject"},
10693
Jeff Johnsondf5d7792018-04-14 15:58:24 -070010694#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053010695#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070010696 {WE_LOG_BUFFER,
10697 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010698 0, "log_buffer"},
10699
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010700#endif
Krunal Soni6c3859f2018-06-01 19:57:40 -070010701 {WE_SET_BA_AGEING_TIMEOUT,
10702 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010703 0, "set_ba_timeout"},
10704
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010705#ifdef WLAN_SUSPEND_RESUME_TEST
10706 {WE_SET_WLAN_SUSPEND,
10707 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010708 0, "wlan_suspend"},
10709
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010710 {WE_SET_WLAN_RESUME,
10711 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010712 0, "wlan_resume"},
Rajeev Kumara78a0a42016-07-13 19:28:20 -070010713#endif
Govind Singha471e5e2015-10-12 17:11:14 +053010714 {WE_ENABLE_FW_PROFILE,
10715 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010716 0, "enableProfile"},
10717
Govind Singha471e5e2015-10-12 17:11:14 +053010718 {WE_SET_FW_PROFILE_HIST_INTVL,
10719 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010720 0, "set_hist_intvl"},
10721
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010722 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
10723 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010724 0, "set_fw_mode_cfg"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010725#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010726 {WE_DUMP_DP_TRACE_LEVEL,
10727 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010728 0, "dump_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010729#endif
Nirav Shah73713f72018-05-17 14:50:41 +053010730#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070010731 {WE_SET_MON_MODE_CHAN,
10732 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010733 0, "setMonChan"},
Nirav Shah73713f72018-05-17 14:50:41 +053010734#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070010735 {WE_GET_ROAM_SYNCH_DELAY,
10736 0,
10737 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010738 "hostroamdelay"},
10739
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080010740 {WE_SET_11AX_RATE,
10741 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10742 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010743 "set_11ax_rate"},
10744
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010745 {WE_SET_DCM,
10746 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10747 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010748 "enable_dcm"},
10749
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010750 {WE_SET_RANGE_EXT,
10751 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10752 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010753 "range_ext"},
10754
Naveen Rawatc921c7b2017-06-13 17:29:51 -070010755 {WLAN_PRIV_SET_FTIES,
10756 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
10757 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010758 "set_ft_ies"},
10759
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010760#ifdef WLAN_FEATURE_MOTION_DETECTION
10761 {WE_MOTION_DET_START_STOP,
10762 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10763 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010764 "mt_start"},
10765
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010766 {WE_MOTION_DET_BASE_LINE_START_STOP,
10767 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10768 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010769 "mt_bl_start"},
10770
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010771 {WE_MOTION_DET_CONFIG_PARAM,
10772 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10773 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010774 "mt_config"},
10775
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010776 {WE_MOTION_DET_BASE_LINE_CONFIG_PARAM,
10777 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10778 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010779 "mt_bl_config"},
Visweswara Tanuku633976b2019-01-07 16:13:12 +053010780#endif /* WLAN_FEATURE_MOTION_DETECTION */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010781};
10782
10783const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010784 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053010785 .num_private = QDF_ARRAY_SIZE(we_private),
10786 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010787
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070010788 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010789 .private = (iw_handler *) we_private,
10790 .private_args = we_private_args,
10791 .get_wireless_stats = NULL,
10792};
10793
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010794void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010795{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010796 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010797
Dustin Browne7e71d32018-05-11 16:00:08 -070010798 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010799
Dustin Browne74003f2018-03-14 12:51:58 -070010800 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010801}
10802
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010803void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010804{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010805 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010806
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010807 rtnl_lock();
10808 dev->wireless_handlers = NULL;
10809 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010810
Jeff Johnson7f2c5912018-03-23 11:42:28 -070010811 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010812}