blob: 4ddc751a36992f19eb67a6b69dcd2daabd748700 [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>
Dustin Brown389e5072018-11-08 17:10:01 +053031#include "osif_sync.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080032#include <wlan_hdd_includes.h>
33#include <cds_api.h>
Rajeev Kumarea95edd2017-01-11 20:49:36 -080034#include "scheduler_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035#include <net/arp.h>
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080036#include <cdp_txrx_cmn.h>
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070037#include <cdp_txrx_stats.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038#include "sir_params.h"
39#include "csr_api.h"
40#include "csr_inside_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080041#include "sme_rrm_internal.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080042#include <ani_global.h>
43#include "dot11f.h"
44#include <wlan_hdd_wowl.h>
45#include <wlan_hdd_cfg.h>
46#include <wlan_hdd_wmm.h>
47#include "utils_api.h"
48#include "wlan_hdd_p2p.h"
49#ifdef FEATURE_WLAN_TDLS
50#include "wlan_hdd_tdls.h"
51#endif
52
53#include "cds_ieee80211_common.h"
54#include "ol_if_athvar.h"
55#include "dbglog_host.h"
56#include "wma.h"
57
58#include "wlan_hdd_power.h"
59#include "qwlan_version.h"
60#include "wlan_hdd_host_offload.h"
61
62#include <linux/wireless.h>
63#include <net/cfg80211.h>
64
65#include "wlan_hdd_misc.h"
66
67#include "qc_sap_ioctl.h"
68#include "sme_api.h"
69#include "wma_types.h"
Dustin Brown05a0658f2019-03-05 11:27:38 -080070#include "qdf_delayed_work_test.h"
Dustin Brown6fb7a752018-11-30 11:33:57 -080071#include "qdf_hashtable_test.h"
Dustin Brown9c49a332019-03-05 11:27:38 -080072#include "qdf_periodic_work_test.h"
Dustin Brown92acafe2019-02-15 17:17:10 -080073#include "qdf_ptr_hash_test.h"
Dustin Brown128e2d02019-02-15 12:59:07 -080074#include "qdf_slist_test.h"
Dustin Brownd315c452018-11-27 11:28:48 -080075#include "qdf_talloc_test.h"
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070076#include "qdf_str.h"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053077#include "qdf_trace.h"
Dustin Brownebb16d12018-11-29 17:52:07 -080078#include "qdf_types_test.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079#include "wlan_hdd_assoc.h"
80#include "wlan_hdd_ioctl.h"
81#include "wlan_hdd_scan.h"
82#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080083#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080084#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070085#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070086#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080087#include "wlan_hdd_ocb.h"
88#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080089#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070090#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053091#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070092#ifdef WLAN_SUSPEND_RESUME_TEST
93#include "wlan_hdd_driver_ops.h"
94#include "hif.h"
Rajeev Kumar9bb2e852016-09-24 12:29:25 -070095#include "pld_common.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070096#endif
Dhanashri Atree7d442a2016-07-14 18:20:29 -070097#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053098#include "cds_utils.h"
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -070099#include "wlan_osif_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -0800100#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -0800101#include <cdp_txrx_stats.h>
102#include <cds_api.h>
Dustin Brown6099ddc2018-07-06 14:32:53 -0700103#include "wlan_dsc_test.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530104#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -0700105#include "wlan_hdd_regulatory.h"
106#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +0530107#include "wlan_hdd_packet_filter_api.h"
Naveen Rawat3ff5cff2018-01-29 14:31:16 -0800108#include "wlan_cp_stats_mc_ucfg_api.h"
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +0530109#include "wlan_mlme_ucfg_api.h"
Wu Gao93816212018-08-31 16:49:54 +0800110#include "cfg_mlme_sta.h"
Arif Hussain43e09712018-09-18 19:31:57 -0700111#include "wlan_mlme_public_struct.h"
Wu Gao93816212018-08-31 16:49:54 +0800112#include "cfg_ucfg_api.h"
Krunal Sonie71838d2018-09-27 10:45:05 -0700113#include "wlan_policy_mgr_ucfg.h"
Harprit Chhabadabec6de42018-09-10 10:21:15 -0700114#include "wlan_mlme_public_struct.h"
115#include "cfg_ucfg_api.h"
116#include "cfg_mlme_threshold.h"
Wu Gao66454f12018-09-26 19:55:41 +0800117#include "wlan_pmo_cfg.h"
118#include "wlan_pmo_ucfg_api.h"
Mohit Khannac9649652018-11-28 18:10:28 -0800119#include "dp_txrx.h"
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800120#include "wlan_fwol_ucfg_api.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530121
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122/* Private ioctls and their sub-ioctls */
123#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
124#define WE_SET_11D_STATE 1
125#define WE_WOWL 2
126#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530127/*
128 * <ioctl>
129 * setMaxAssoc - Sets the maximum number of associated stations
130 *
131 * @INPUT: 1 to 32
132 *
133 * @OUTPUT: None
134 *
135 * This IOTCL sets the maximum number of associated stations
136 *
137 * @E.g: iwpriv wlan0 setMaxAssoc <value>
138 *
139 * Supported Feature: STA
140 *
141 * Usage: Internal/External
142 *
143 * </ioctl>
144 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800145#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530146/*
147 * <ioctl>
Jeff Johnsonf2cf6592018-05-06 16:27:44 -0700148 * scan_disable - Disable scan
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530149 *
150 * @INPUT: set_value
151 *
152 * @OUTPUT: None
153 *
154 * This IOCTL is used to set disable scan
155 *
156 * @E.g: iwpriv wlan0 scan_disable 1
157 *
158 * Supported Feature: Scan
159 *
160 * Usage: Internal/External
161 *
162 * </ioctl>
163 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800164#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530165/*
166 * <ioctl>
167 * inactivityTO - sets the timeout value for inactivity data while
168 * in power save mode
169 *
170 * @INPUT: int1…..int255
171 *
172 * @OUTPUT: None
173 *
174 * This IOCTL set the timeout value for inactivity data in power save mode
175 *
176 * @E.g: iwpriv wlan0 inactivityTO 20
177 *
178 * Supported Feature: STA
179 *
180 * Usage: Internal/External
181 *
182 * </ioctl>
183 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800184#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530185/*
186 * <ioctl>
187 * setMaxTxPower - Dynamically sets the maximum transmission power
188 *
189 * @INPUT: Transmission power in dBm
190 *
191 * @OUTPUT: None
192 *
193 * This IOCTL dynamically sets the maximum transmission power
194 * This setting does not persist over reboots
195 *
196 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
197 *
198 * Supported Feature: STA
199 *
200 * Usage: Internal/External
201 *
202 * </ioctl>
203 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800204#define WE_SET_MAX_TX_POWER 7
Jeff Johnson0187c622019-01-04 06:39:44 -0800205
206#ifdef HASTINGS_BT_WAR
207/* Temporary WAR for Hastings 1.1 only */
208#define WE_SET_HASTINGS_BT_WAR 8
209#endif
210
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800211#define WE_SET_TM_LEVEL 9
Jeff Johnson0187c622019-01-04 06:39:44 -0800212
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530213/*
214 * <ioctl>
215 * setphymode - Set the phymode dynamically
216 *
217 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
218 *
219 * @OUTPUT: None
220 *
221 * This IOCTL sets the phymode dynamically
222 *
223 * @E.g: iwpriv wlan0 setphymode 10
224 *
225 * Supported Feature: STA
226 *
227 * Usage: Internal/External
228 *
229 * </ioctl>
230 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800231#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530232/*
233 * <ioctl>
234 * nss - Set the number of spatial streams
235 *
236 * @INPUT: int1…..int3
237 *
238 * @OUTPUT: None
239 *
240 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
241 *
242 * @E.g: iwpriv wlan0 nss 2
243 *
244 * Supported Feature: STA
245 *
246 * Usage: Internal/External
247 *
248 * </ioctl>
249 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800250#define WE_SET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530251/*
252 * <ioctl>
253 * ldpc - Enables or disables LDPC
254 *
255 * @INPUT: 0 – Disable, 1 - Enable
256 *
257 * @OUTPUT: None
258 *
259 * This IOCTL enables or disables LDPC
260 *
261 * @E.g: iwpriv wlan0 ldpc 1
262 *
263 * Supported Feature: STA
264 *
265 * Usage: Internal/External
266 *
267 * </ioctl>
268 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800269#define WE_SET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530270/*
271 * <ioctl>
272 * tx_stbc - Enables or disables tx_stbc
273 *
274 * @INPUT: Int 0 – Disable, 1 - Enable
275 *
276 * @OUTPUT: None
277 *
278 * This IOTCL used to enables or disables tx_stbc
279 *
280 * @E.g: iwpriv wlan0 tx_stbc <value>
281 *
282 * Supported Feature: STA
283 *
284 * Usage: Internal/External
285 *
286 * </ioctl>
287 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800288#define WE_SET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530289/*
290 * <ioctl>
291 * rx_stbc - Set the rx_stbc parameter
292 *
293 * @INPUT: Int 0 – Disable, 1 - Enable
294 *
295 * @OUTPUT: None
296 *
297 * This IOTCL used to set rx_stbc parameter
298 *
299 * @E.g: iwpriv wlan0 rx_stbc <value>
300 *
301 * Supported Feature: STA
302 *
303 * Usage: Internal/External
304 *
305 * </ioctl>
306 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800307#define WE_SET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530308/*
309 * <ioctl>
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800310 * shortgi - Sets the short-guard interval
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530311 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800312 * @INPUT: Fixed Rate: 0 - 400ns, 1 - 800ns, 2 - 1600ns, 3 - 3200us
313 * Auto Rate: 8 - 400ns, 9 - 800ns, 10 - 1600ns, 11 - 3200us
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530314 *
315 * @OUTPUT: None
316 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800317 * This IOCTL sets the short-guard interval.
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530318 *
319 * @E.g: iwpriv wlan0 shortgi <value>
320 *
321 * Supported Feature: STA
322 *
323 * Usage: Internal/External
324 *
325 * </ioctl>
326 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800327#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530328/*
329 * <ioctl>
330 * enablertscts - enables or disables rts/cts.
331 *
332 * @INPUT: 1-Enable , 0-Disable
333 *
334 * @OUTPUT: None
335 *
336 * This IOCTL enables or disables rts/cts.
337 *
338 * @E.g: iwpriv wlan0 enablertscts <value>
339 *
340 * Supported Feature: STA
341 *
342 * Usage: Internal/External
343 *
344 * </ioctl>
345 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800346#define WE_SET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530347/*
348 * <ioctl>
349 * chwidth - Set the channel bandwidth
350 *
351 * @INPUT: 0-20mhz to 3-160mhz
352 *
353 * @OUTPUT: None
354 *
355 * This IOTCL used to set the channel bandwidth
356 *
357 * @E.g: iwpriv wlan0 chwidth 1
358 *
359 * Supported Feature: STA
360 *
361 * Usage: Internal/External
362 *
363 * </ioctl>
364 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800365#define WE_SET_CHWIDTH 17
366#define WE_SET_ANI_EN_DIS 18
367#define WE_SET_ANI_POLL_PERIOD 19
368#define WE_SET_ANI_LISTEN_PERIOD 20
369#define WE_SET_ANI_OFDM_LEVEL 21
370#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530371/*
372 * <ioctl>
373 * cwmenable - Enables or disables the dynamic channel bandwidth
374 *
375 * @INPUT: 0-Disable, 1-Enable
376 *
377 * @OUTPUT: None
378 *
379 * This IOTCL used to enables or disables the dynamic channel bandwidth
380 *
381 * @E.g: iwpriv wlan0 cwmenable <value>
382 *
383 * Supported Feature: STA
384 *
385 * Usage: Internal/External
386 *
387 * </ioctl>
388 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800389#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530390/*
391 * <ioctl>
392 * txchainmask - This IOCTL sets the current Tx chain mask
393 *
394 * @INPUT: Mask Value
395 *
396 * @OUTPUT: None
397 *
398 * This IOCTL sets the current Tx chain mask
399 *
400 * @E.g: iwpriv wlan0 txchainmask 1
401 *
402 * Supported Feature: STA
403 *
404 * Usage: Internal/External
405 *
406 * </ioctl>
407 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800408#define WE_SET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530409/*
410 * <ioctl>
411 * rxchainmask - Sets the current Rx chain mask
412 *
413 * @INPUT: Mask Value
414 *
415 * @OUTPUT: None
416 *
417 * This IOCTL sets the current Rx chain mask. This command is the
418 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
419 *
420 * @E.g: iwpriv wlan0 rxchainmask <value>
421 *
422 * Supported Feature: STA
423 *
424 * Usage: Internal/External
425 *
426 * </ioctl>
427 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800428#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530429/*
430 * <ioctl>
431 * set11NRates - Fixes the Tx data rate of the 11N mode.
432 *
433 * @INPUT: 0x1b to 0x8f
434 *
435 * @OUTPUT: None
436 *
437 * This IOCTL fixes the Tx data rate of the 11N mode.
438 *
439 * @E.g: iwpriv wlan0 set11NRates 0x85
440 *
441 * Supported Feature: STA
442 *
443 * Usage: Internal/External
444 *
445 * </ioctl>
446 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800447#define WE_SET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530448/*
449 * <ioctl>
450 * ampdu - Set the the maximum subframe of ampdu
451 *
452 * @INPUT: int 1 to int 63
453 *
454 * @OUTPUT: None
455 *
456 * This IOCTL sets the maximum subframe of ampdu.
457 *
458 * @E.g: iwpriv wlan0 ampdu 9
459 *
460 * Supported Feature: STA
461 *
462 * Usage: Internal/External
463 *
464 * </ioctl>
465 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800466#define WE_SET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530467/*
468 * <ioctl>
469 * amsdu - Sets the maximum subframe of amsdu.
470 *
471 * @INPUT: int 1 to int 31
472 *
473 * @OUTPUT: None
474 *
475 * This IOCTL sets the maximum subframe of amsdu.
476 *
477 * @E.g: iwpriv wlan0 amsdu 9
478 *
479 * Supported Feature: STA
480 *
481 * Usage: Internal/External
482 *
483 * </ioctl>
484 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800485#define WE_SET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530486/*
487 * <ioctl>
488 * txpow2g - current 2 GHz Tx power setting
489 *
490 * @INPUT: Tx power in dBm
491 *
492 * @OUTPUT: None
493 *
494 * This IOTCL used to set 2 ghz tx power
495 *
496 * @E.g: iwpriv wlan0 txpow2g
497 *
498 * Supported Feature: STA
499 *
500 * Usage: Internal/External
501 *
502 * </ioctl>
503 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800504#define WE_SET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530505/*
506 * <ioctl>
507 * txpow5g - Current 5 GHz tx power setting
508 *
509 * @INPUT: Tx power in dBm
510 *
511 * @OUTPUT: None
512 *
513 * This IOTCL used to set the 5 ghz txpower
514 *
515 * @E.g: iwpriv wlan0 txpow5g
516 *
517 * Supported Feature: STA
518 *
519 * Usage: Internal/External
520 *
521 * </ioctl>
522 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800523#define WE_SET_TXPOW_5G 30
524/* Private ioctl for firmware debug log */
525#define WE_DBGLOG_LOG_LEVEL 31
526#define WE_DBGLOG_VAP_ENABLE 32
527#define WE_DBGLOG_VAP_DISABLE 33
528#define WE_DBGLOG_MODULE_ENABLE 34
529#define WE_DBGLOG_MODULE_DISABLE 35
530#define WE_DBGLOG_MOD_LOG_LEVEL 36
531#define WE_DBGLOG_TYPE 37
532#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530533/*
534 * <ioctl>
535 * set11ACRates - Fixes the Tx data rate of 11AC
536 *
537 * @INPUT: 0x1 to 0x9
538 *
539 * @OUTPUT: None
540 *
541 * This IOCTL fixes the Tx data rate of 11AC.
542 *
543 * @E.g: iwpriv wlan0 set11ACRates 0x9
544 *
545 * Supported Feature: STA
546 *
547 * Usage: Internal/External
548 *
549 * </ioctl>
550 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800551#define WE_SET_VHT_RATE 39
552#define WE_DBGLOG_REPORT_ENABLE 40
553#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530554/*
555 * <ioctl>
556 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
557 *
558 * @INPUT: Transmission power in dBm
559 *
560 * @OUTPUT: None
561 *
562 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
563 * This setting does not persist over reboots
564 *
565 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
566 *
567 * Supported Feature: STA
568 *
569 * Usage: Internal/External
570 *
571 * </ioctl>
572 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800573#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530574/*
575 * <ioctl>
576 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
577 *
578 * @INPUT: Transmission power in dBm
579 *
580 * @OUTPUT: None
581 *
582 * This IOCTL sets the maximum transmit power for the 5-GHz band
583 * This setting does not persist over reboots
584 *
585 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
586 *
587 * Supported Feature: STA
588 *
589 * Usage: Internal/External
590 *
591 * </ioctl>
592 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800593#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800594#define WE_SET_PKTLOG 44
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530595/* Private ioctl for packet power save */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800596#define WE_PPS_PAID_MATCH 45
597#define WE_PPS_GID_MATCH 46
598#define WE_PPS_EARLY_TIM_CLEAR 47
599#define WE_PPS_EARLY_DTIM_CLEAR 48
600#define WE_PPS_EOF_PAD_DELIM 49
601#define WE_PPS_MACADDR_MISMATCH 50
602#define WE_PPS_DELIM_CRC_FAIL 51
603#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530604/*
605 * <ioctl>
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530606 * rssi_chk - Check the rssi
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530607 *
608 * @INPUT: One argument as input
609 *
610 * @OUTPUT: rssi
611 * wlan0 rssi_chk:56
612 *
613 * This IOTCL used to chek rssi
614 *
615 * @E.g: iwpriv wlan0 rssi_chk <value>
616 *
617 * Supported Feature: STA
618 *
619 * Usage: Internal/External
620 *
621 * </ioctl>
622 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800623#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530624/*
625 * <ioctl>
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530626 * htsmps - Sets the htsmps
627 *
628 * @INPUT: Atleast one int argument
629 *
630 * @OUTPUT: None
631 *
632 * This IOTCL used to set htsmps
633 *
634 * @E.g: iwpriv wlan0 htsmps <value>
635 *
636 * Supported Feature: STA
637 *
638 * Usage: Internal/External
639 *
640 * </ioctl>
641 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800642#define WE_SET_HTSMPS 55
643/* Private ioctl for QPower */
644#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
645#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
646#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
647#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800648/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530649/*
650 * <ioctl>
651 * gtxHTMcs - Set the tx HTM value
652 *
653 * @INPUT: Atleast one int orgument
654 *
655 * @OUTPUT: None
656 *
657 * This IOTCL sets htm tx value
658 *
659 * @E.g: iwpriv wlan0 gtxHTMcs <value>
660 *
661 * Supported Feature: STA
662 *
663 * Usage: Internal/External
664 *
665 * </ioctl>
666 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800667#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530668/*
669 * <ioctl>
670 * gtxVHTMcs - Set gtxVHTMcs value
671 *
672 * @INPUT: Atleast one int argument
673 *
674 * @OUTPUT: None
675 *
676 * This IOTCL used to set gtxVHTMcs value
677 *
678 * @E.g: iwpriv wlan0 gtxVHTMcs <value>
679 *
680 * Supported Feature: STA
681 *
682 * Usage: Internal/External
683 *
684 * </ioctl>
685 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800686#define WE_SET_GTX_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530687/*
688 * <ioctl>
689 * gtxUsrCfg - Host request for GTX mask
690 *
691 * @INPUT: Atleast one int orgument
692 *
693 * @OUTPUT: None
694 *
695 * This IOTCL used send the host request for GTX mask
696 *
697 * @E.g: iwpriv wlan0 gtxUsrCfg <value>
698 *
699 * Supported Feature: STA
700 *
701 * Usage: Internal/External
702 *
703 * </ioctl>
704 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800705#define WE_SET_GTX_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530706/*
707 * <ioctl>
708 * gtxThre - Set the tx threshold
709 *
710 * @INPUT: Atleast one int argument
711 *
712 * @OUTPUT: None
713 *
714 * This IOTCL used to set tx threshold
715 *
716 * @E.g: iwpriv wlan0 gtxThre <value>
717 *
718 * Supported Feature: STA
719 *
720 * Usage: Internal/External
721 *
722 * </ioctl>
723 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800724#define WE_SET_GTX_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530725/*
726 * <ioctl>
727 * gtxMargin - Set the gtxMargin
728 *
729 * @INPUT: 1 to 32
730 *
731 * @OUTPUT: None
732 *
733 * This IOTCL use dto set gtxMargin
734 *
735 * @E.g: iwpriv wlan0 gtxMargini <value>
736 *
737 * Supported Feature: STA
738 *
739 * Usage: Internal/External
740 *
741 * </ioctl>
742 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800743#define WE_SET_GTX_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530744/*
745 * <ioctl>
746 * gtxStep - Set the gtxStep
747 *
748 * @INPUT: None
749 *
750 * @OUTPUT: None
751 *
752 * This IOTCL used to sets gtxStep
753 *
754 * @E.g: iwpriv wlan0 gtxStep <value>
755 *
756 * Supported Feature: STA
757 *
758 * Usage: Internal/External
759 *
760 * </ioctl>
761 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800762#define WE_SET_GTX_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530763/*
764 * <ioctl>
765 * gtxMinTpc - Sets the gtxMinTpc
766 *
767 * @INPUT: Atleast one int argument
768 *
769 * @OUTPUT: None
770 *
771 * This IOTCL sets the tx MinTpc
772 *
773 * @E.g: iwpriv wlan0 gtxMinTpc <value>
774 *
775 * Supported Feature: STA
776 *
777 * Usage: Internal/External
778 *
779 * </ioctl>
780 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800781#define WE_SET_GTX_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530782/*
783 * <ioctl>
784 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
785 *
786 * @INPUT: Mask value
787 *
788 * @OUTPUT: None
789 *
790 * This IOTCL used to set gtxBWMask
791 *
792 * @E.g: iwpriv wlan0 gtxBWMask <value>
793 *
794 * Supported Feature: STA
795 *
796 * Usage: Internal/External
797 *
798 * </ioctl>
799 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530800
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530801#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530802/*
803 * <ioctl>
804 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
805 *
806 * @INPUT: set_value
807 *
808 * @OUTPUT: None
809 *
810 * This IOCTL is used to set the MCC latency value in milliseconds
811 * during STA-P2P concurrency.
812 *
813 * If 0ms latency is provided, then FW will set to a default.
814 * Otherwise, latency must be at least 30ms.
815 *
816 * @E.g: iwpriv wlan0 setMccLatency 40
817 *
818 *
819 * Supported Feature: Concurrency
820 *
821 * Usage: Internal/External
822 *
823 * </ioctl>
824 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800825#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530826
827/*
828 * <ioctl>
829 * setMccQuota- Set the quota for P2P cases
830 *
831 * @INPUT: set_value [0,100]
832 *
833 * @OUTPUT: None
834 *
835 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
836 *
837 * Currently used to set time quota for 2 MCC vdevs/adapters using
838 * (operating channel, quota) for each mode.
839 * The info is provided run time using iwpriv command:
840 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
841 * Note: the quota provided in command is for the same mode in cmd.
842 * HDD checks if MCC mode is active, gets the second mode and its
843 * operating chan.
844 * Quota for the 2nd role is calculated as 100 - quota of first mode.
845 *
846 * @E.g: iwpriv wlan0 setMccQuota 50
847 * iwpriv p2p0 setMccQuota 50
848 *
849 * Supported Feature: Concurrency
850 *
851 * Usage: Internal/External
852 *
853 * </ioctl>
854 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800855#define WE_MCC_CONFIG_QUOTA 71
856/* Private IOCTL for debug connection issues */
857#define WE_SET_DEBUG_LOG 72
858#ifdef WE_SET_TX_POWER
859#undef WE_SET_TX_POWER
860#endif
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -0800861
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530862/*
863 * <ioctl>
864 * setTxPower - Set the current transmit power
865 *
866 * @INPUT: Transmission power in dBm
867 *
868 * @OUTPUT: None
869 *
870 * This IOCTL sets the current transmit power.
871 * This setting does not persist over reboots.
872 *
873 * @E.g: iwpriv wlan0 setTxPower 10
874 *
875 * Supported Feature: STA
876 *
877 * Usage: Internal/External
878 *
879 * </ioctl>
880 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800881#define WE_SET_TX_POWER 74
882/* Private ioctl for earlyrx power save feature */
883#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
884#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
885#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
886#define WE_SET_EARLY_RX_SLOP_STEP 78
887#define WE_SET_EARLY_RX_INIT_SLOP 79
888#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530889/*
890 * <ioctl>
891 * setMcRate - Set the data rate for multicast data
892 *
893 * @INPUT: 1 to 32
894 *
895 * @OUTPUT: None
896 *
897 * This IOCTL sets the data rate for multicast data. Note that this command
898 * is allowed only in STA, IBSS, or QCMobileAP mode
899 *
900 * @E.g: iwpriv wlan0 setMcRate <value>
901 *
902 * Supported Feature: STA
903 *
904 * Usage: Internal/External
905 *
906 * </ioctl>
907 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800908#define WE_SET_MC_RATE 81
909#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
910/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530911/*
912 * <ioctl>
913 * 5g_ebt - Sets the 5g_ebt
914 *
915 * @INPUT: <value>
916 *
917 * @OUTPUT: None
918 *
919 * This IOTCL used to set 5g_ebt
920 *
921 * @E.g: iwpriv wlan0 5g_ebt <value>
922 *
923 * Supported Feature: STA
924 *
925 * Usage: Internal/External
926 *
927 * </ioctl>
928 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800929#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530930/*
931 * <ioctl>
932 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
933 *
934 * @INPUT: 20 t0 160
935 *
936 * @OUTPUT: None
937 *
938 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
939 *
940 * @E.g: iwpriv wlan0 cts_cbw <value>
941 *
942 * Supported Feature: STA
943 *
944 * Usage: Internal/External
945 *
946 * </ioctl>
947 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800948#define WE_SET_CTS_CBW 84
949#define WE_DUMP_STATS 85
950#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +0530951/* Private sub ioctl for starting/stopping the profiling */
952#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +0530953
Abhishek Singh3c507012016-12-01 11:15:42 +0530954/*
955 * <ioctl>
956 * setChanChange - Initiate channel change
957 *
958 * @INPUT: channel number to switch to.
959 *
960 * @OUTPUT: None
961 *
962 * This IOCTL is used to initiate a channel change.
963 * If called on STA/CLI interface it will send the
964 * ECSA action frame to the connected SAP/GO asking to
965 * initiate the ECSA, if supported.
966 * If called on SAP/GO interface it will initiate
967 * ECSA and ask connected peers to move to new channel.
968 *
969 * @E.g: iwpriv wlan0 setChanChange <channel>
970 * iwpriv wlan0 setChanChange 1
971 *
972 * Supported Feature: ECSA
973 *
974 * Usage: Internal/External
975 *
976 * </ioctl>
977 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +0530978#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +0530979#define WE_SET_CONC_SYSTEM_PREF 89
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800980
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800981/*
982 * <ioctl>
983 * set_11ax_rate - set 11ax rates to FW
984 *
985 * @INPUT: rate code
986 *
987 * @OUTPUT: None
988 *
989 * This IOCTL fixes the Tx data rate of 11AX.
990 *
991 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
992 *
993 * Supported Feature: STA/SAP
994 *
995 * Usage: Internal
996 *
997 * </ioctl>
998 */
999#define WE_SET_11AX_RATE 91
1000
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001001/*
1002 * <ioctl>
1003 * enable_dcm - enable Dual Carrier Modulation(DCM)
1004 *
1005 * @INPUT: 0/1
1006 *
1007 * @OUTPUT: None
1008 *
1009 * This IOCTL enables/disables DCM.
1010 *
1011 * @E.g: iwpriv wlan0 enable_dcm <0/1>
1012 *
1013 * Supported Feature: STA/SAP
1014 *
1015 * Usage: Internal
1016 *
1017 * </ioctl>
1018 */
1019#define WE_SET_DCM 92
1020
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001021/*
1022 * <ioctl>
Naveen Rawat53448ea2017-11-27 11:43:18 -08001023 * range_ext - enable Range extension
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001024 *
1025 * @INPUT: 0/1
1026 *
1027 * @OUTPUT: None
1028 *
1029 * This IOCTL enables/disables Range extension.
1030 *
Naveen Rawat53448ea2017-11-27 11:43:18 -08001031 * @E.g: iwpriv wlan0 range_ext <1/0>
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001032 *
1033 * Supported Feature: STA/SAP
1034 *
1035 * Usage: Internal
1036 *
1037 * </ioctl>
1038 */
1039#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001040
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301041/*
1042 * <ioctl>
1043 * wow_ito - sets the timeout value for inactivity data while
1044 * in power save mode during wow
1045 *
1046 * @INPUT: int
1047 *
1048 * @OUTPUT: None
1049 *
1050 * This IOCTL set the timeout value for inactivity data in power save mode
1051 *
1052 * @E.g: iwpriv wlan0 wow_ito 20
1053 *
1054 * Supported Feature: STA
1055 *
1056 * Usage: External
1057 *
1058 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001059 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301060#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1061
Jeff Johnson011c4502017-10-05 15:25:56 -07001062/*
1063 * <ioctl>
1064 * pdev_reset - reset the pdev
1065 *
1066 * @INPUT: Reset command to initiate:
1067 * TX_FLUSH = 1
1068 * WARM_RESET = 2
1069 * COLD_RESET = 3
1070 * WARM_RESET_RESTORE_CAL = 4
1071 * COLD_RESET_RESTORE_CAL = 5
1072 *
1073 * @OUTPUT: None
1074 *
1075 * This IOCTL is used to reset the pdev. The primary use is
1076 * for internal testing. It is not expected that this will
1077 * be used on a production device.
1078 *
1079 * @E.g: iwpriv wlan0 pdev_reset <command>
1080 * iwpriv wlan0 pdev_reset 1
1081 *
1082 * Supported Feature: None
1083 *
1084 * Usage: Internal
1085 *
1086 * </ioctl>
1087 */
1088#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301089
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301090/*
1091 * setModDTIM - Change Modulated DTIM
1092 *
1093 * @INPUT: set_value.
1094 *
1095 * @OUTPUT: None
1096 *
1097 * This IOCTL is used to change modulated DTIM
1098 * value without WIFI OFF/ON.
1099 *
1100 * @E.g: iwpriv wlan0 setModDTIM <value>
1101 * iwpriv wlan0 setModDTIM 2
1102 *
1103 * Supported Feature: N/A
1104 *
1105 * Usage: Internal/External
1106 *
1107 * </ioctl>
1108 */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05301109#define WE_SET_MODULATED_DTIM 96
1110
1111#ifdef WLAN_FEATURE_MOTION_DETECTION
1112#define WE_MOTION_DET_START_STOP 97
1113#define WE_MOTION_DET_BASE_LINE_START_STOP 98
1114#endif /* WLAN_FEATURE_MOTION_DETECTION */
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301115
Krishna Reddya50d09f2019-02-04 14:55:06 +05301116/*
Krishna Reddy64c14da2019-02-12 20:23:12 +05301117 * set_btc_mode Set BTCoexMode
Krishna Reddya50d09f2019-02-04 14:55:06 +05301118 *
1119 * @INPUT: set_value.
1120 *
1121 * @OUTPUT: None
1122 *
1123 * This IOCTL is used to set the BT COex operating mode
Krishna Reddy64c14da2019-02-12 20:23:12 +05301124 * Allowed values are 0(TDD), 1(FDD), 2(Hybrid)
Krishna Reddya50d09f2019-02-04 14:55:06 +05301125 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301126 * @E.g: iwpriv wlan0 set_btc_mode <value>
1127 * iwpriv wlan0 set_btc_mode 2
Krishna Reddya50d09f2019-02-04 14:55:06 +05301128 *
1129 * Supported Feature: N/A
1130 *
1131 * Usage: Internal/External
1132 *
1133 * </ioctl>
1134 */
1135#define WE_SET_BTCOEX_MODE 99
1136
1137/*
Krishna Reddy64c14da2019-02-12 20:23:12 +05301138 * set_btc_rssi- Set WLAN low RSSI threshold for BTCOex
Krishna Reddya50d09f2019-02-04 14:55:06 +05301139 *
1140 * @INPUT: set_value.
1141 *
1142 * @OUTPUT: None
1143 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301144 * This IOCTL is used to modify the threshold at which
1145 * the COex mode changes from TDD to Hybrid mode
Krishna Reddya50d09f2019-02-04 14:55:06 +05301146 * Allowed values are from -100 to 0
1147 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301148 * @E.g: iwpriv wlan0 set_btc_rssi <value>
1149 * iwpriv wlan0 set_btc_rssi -70
Krishna Reddya50d09f2019-02-04 14:55:06 +05301150 *
1151 * Supported Feature: N/A
1152 *
1153 * Usage: Internal/External
1154 *
1155 * </ioctl>
1156 */
1157#define WE_SET_BTCOEX_RSSI_THRESHOLD 100
1158
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001159/* Private ioctls and their sub-ioctls */
1160#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1161#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001162#define WE_GET_WLAN_DBG 4
1163#define WE_GET_MAX_ASSOC 6
1164/* 7 is unused */
1165#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301166
1167/*
1168 * <ioctl>
1169 * getconcurrency - Get concurrency mode
1170 *
1171 * @INPUT: None
1172 *
1173 * @OUTPUT: It shows concurrency value
1174 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1175 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1176 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1177 *
1178 * This IOCTL is used to retrieve concurrency mode.
1179 *
1180 * @E.g: iwpriv wlan0 getconcurrency
1181 * wlan0 getconcurrency:5
1182 * Above value shows STA+P2P_Client
1183 *
1184 * Supported Feature: Concurrency
1185 *
1186 * Usage: Internal/External
1187 *
1188 * </ioctl>
1189 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001190#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301191/*
1192 * <ioctl>
1193 * get_nss - Get the number of spatial STBC streams (NSS)
1194 *
1195 * @INPUT: None
1196 *
1197 * @OUTPUT: NSS
1198 * wlan0 get_nss:2
1199 *
1200 * This IOTCL used to get the number of spatial STBC streams
1201 *
1202 * @E.g: iwpriv wlan0 get_nss
1203 *
1204 * Supported Feature: STA
1205 *
1206 * Usage: Internal/External
1207 *
1208 * </ioctl>
1209 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001210#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301211/*
1212 * <ioctl>
1213 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1214 *
1215 * @INPUT: None
1216 *
1217 * @OUTPUT: ldpc
1218 * wlan0 get_ldpc:1
1219 *
1220 * This IOTCL used to gets the low density parity check (LDPC)
1221 *
1222 * @E.g: iwpriv wlan0 get_ldpc
1223 *
1224 * Supported Feature: STA
1225 *
1226 * Usage: Internal/External
1227 *
1228 * </ioctl>
1229 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001230#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301231/*
1232 * <ioctl>
1233 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1234 *
1235 * @INPUT: None
1236 *
1237 * @OUTPUT: TXSTBC
1238 * wlan0 get_tx_stbc:1
1239 *
1240 * This IOTCL get the value of the current Tx space time block code (STBC)
1241 *
1242 * @E.g: iwpriv wlan0 get_tx_stbc
1243 *
1244 * Supported Feature: STA
1245 *
1246 * Usage: Internal/External
1247 *
1248 * </ioctl>
1249 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001250#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301251/*
1252 * <ioctl>
1253 * get_rx_stbc - Gets the value of the current Rx STBC
1254 *
1255 * @INPUT: None
1256 *
1257 * @OUTPUT: Rx STBC
1258 * wlan0 get_rx_stbc:1
1259 *
1260 * This IOTCL used to get the value of the current Rx STBC
1261 *
1262 * @E.g: iwpriv wlan0 get_rx_stbc
1263 *
1264 * Supported Feature: STA
1265 *
1266 * Usage: Internal/External
1267 *
1268 * </ioctl>
1269 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001270#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301271/*
1272 * <ioctl>
1273 * get_shortgi - Get the value of the current short GI setting
1274 *
1275 * @INPUT: None
1276 *
1277 * @OUTPUT: Enable/disable of shortgi
1278 * wlan0 get_shortgi:1
1279 *
1280 * This IOCTL gets the value of the current short GI setting
1281 *
1282 * @E.g: iwpriv wlan0 get_shortgi
1283 *
1284 * Supported Feature: STA
1285 *
1286 * Usage: Internal/External
1287 *
1288 * </ioctl>
1289 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001290#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301291/*
1292 * <ioctl>
1293 * get_rtscts - Get the value of the current RTS/CTS setting.
1294 *
1295 * @INPUT: None
1296 *
1297 * @OUTPUT: Enable/disable of RTS/CTS
1298 * wlan0 get_rtscts:33
1299 *
1300 * This IOTCL get the value of the current RTS/CTS setting.
1301 *
1302 * @E.g: iwpriv wlan0 get_rtscts
1303 *
1304 * Supported Feature: STA
1305 *
1306 * Usage: Internal/External
1307 *
1308 * </ioctl>
1309 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001310#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301311/*
1312 * <ioctl>
1313 * get_chwidth - Get the current channel width setting
1314 *
1315 * @INPUT: None
1316 *
1317 * @OUTPUT: channel width
1318 * wlan0 get_chwidth:0
1319 *
1320 * This IOTCL get the current channel width setting.
1321 *
1322 * @E.g: iwpriv wlan0 get_chwidth
1323 *
1324 * Supported Feature: STA
1325 *
1326 * Usage: Internal/External
1327 *
1328 * </ioctl>
1329 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001330#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301331/*
1332 * <ioctl>
1333 * get_anienable - Get the anienable
1334 *
1335 * @INPUT: None
1336 *
1337 * @OUTPUT:
1338 * wlan0 get_anienable:0
1339 *
1340 * This IOTCL get the anienable
1341 *
1342 * @E.g: iwpriv wlan0 get_anienable
1343 *
1344 * Supported Feature: STA
1345 *
1346 * Usage: Internal/External
1347 *
1348 * </ioctl>
1349 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001350#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301351/*
1352 * <ioctl>
1353 * get_aniplen - Get the aniplen
1354 *
1355 * @INPUT: None
1356 *
1357 * @OUTPUT:
1358 * wlan0 get_aniplen:0
1359 *
1360 * This IOTCL get the aniplen
1361 *
1362 * @E.g: iwpriv wlan0 get_aniplen
1363 *
1364 * Supported Feature: STA
1365 *
1366 * Usage: Internal/External
1367 *
1368 * </ioctl>
1369 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001370#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301371/*
1372 * <ioctl>
1373 * get_anilislen- Get the anilislen
1374 *
1375 * @INPUT: None
1376 *
1377 * @OUTPUT:
1378 * wlan0 get_anilislen:0
1379 *
1380 * This IOTCL used to get anilislen
1381 *
1382 * @E.g: iwpriv wlan0 get_anilislen
1383 *
1384 * Supported Feature: STA
1385 *
1386 * Usage: Internal/External
1387 *
1388 * </ioctl>
1389 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001390#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301391/*
1392 * <ioctl>
1393 * get_aniofdmlvl - Get the OFDM level
1394 *
1395 * @INPUT: None
1396 *
1397 * @OUTPUT: OFDM
1398 * wlan0 get_aniofdmlvl:0
1399 *
1400 * This IOTCL used to get ofdm level
1401 *
1402 * @E.g: iwpriv wlan0 get_aniofdmlvl
1403 *
1404 * Supported Feature: STA
1405 *
1406 * Usage: Internal/External
1407 *
1408 * </ioctl>
1409 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001410#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301411/*
1412 * <ioctl>
1413 * get_aniccklvl - Get the cck level
1414 *
1415 * @INPUT: None
1416 *
1417 * @OUTPUT:
1418 * wlan0 get_aniccklvl:0
1419 *
1420 * This IOTCL used to get cck level
1421 *
1422 * @E.g: iwpriv wlan0 get_aniccklvl
1423 *
1424 * Supported Feature: STA
1425 *
1426 * Usage: Internal/External
1427 *
1428 * </ioctl>
1429 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001430#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301431/*
1432 * <ioctl>
1433 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1434 *
1435 * @INPUT: None
1436 *
1437 * @OUTPUT: Enable/disable dynamic channel bandwidth
1438 * wlan0 get_cwmenable:0
1439 *
1440 * This IOTCL get the value of the dynamic channel bandwidth setting
1441 *
1442 * @E.g: iwpriv wlan0 get_cwmenable
1443 *
1444 * Supported Feature: STA
1445 *
1446 * Usage: Internal/External
1447 *
1448 * </ioctl>
1449 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001450#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301451/*
1452 * <ioctl>
1453 * get_txchainmask - Get the txchainmask that was set
1454 *
1455 * @INPUT: None
1456 *
1457 * @OUTPUT: txchainmask
1458 * wlan0 get_txchainmask:1
1459 *
1460 * This IOCTL gets the txchainmask that was set
1461 * This command is useful if it was previously set
1462 *
1463 * @E.g: iwpriv wlan0 get_txchainmask
1464 *
1465 * Supported Feature: STA
1466 *
1467 * Usage: Internal/External
1468 *
1469 * </ioctl>
1470 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001471#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301472/*
1473 * <ioctl>
1474 * get_rxchainmask - Get the rxchainmask that was set
1475 *
1476 * @INPUT: None
1477 *
1478 * @OUTPUT: rxchainmask
1479 * wlan0 get_rxchainmask:1
1480 *
1481 * This IOCTL gets the rxchainmask that was set
1482 * This command is useful only if it was previously set.
1483 *
1484 * @E.g: iwpriv wlan0 get_rxchainmask
1485 *
1486 * Supported Feature: STA
1487 *
1488 * Usage: Internal/External
1489 *
1490 * </ioctl>
1491 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001492#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301493/*
1494 * <ioctl>
1495 * get_11nrate - Get the fixed Tx data rate
1496 *
1497 * @INPUT: None
1498 *
1499 * @OUTPUT: Using this command does not return the same value as set
1500 * wlan0 get_11nrate:0
1501 *
1502 * This IOCTL gets the fixed Tx data rate
1503 * This command is useful only if setting the fixed Tx rate.
1504 *
1505 * @E.g: iwpriv wlan0 get_11nrate
1506 *
1507 * Supported Feature: STA
1508 *
1509 * Usage: Internal/External
1510 *
1511 * </ioctl>
1512 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001513#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301514/*
1515 * <ioctl>
1516 * get_ampdu - Get the maximum subframe of ampdu
1517 *
1518 * @INPUT: None
1519 *
1520 * @OUTPUT: Maximum subframe of ampdu
1521 * wlan0 get_ampdu:1
1522 *
1523 * This IOCTL gets the maximum subframe of ampdu
1524 * This command is useful only if setting ampdu.
1525 *
1526 * @E.g: iwpriv wlan0 get_ampdu
1527 *
1528 * Supported Feature: STA
1529 *
1530 * Usage: Internal/External
1531 *
1532 * </ioctl>
1533 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001534#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301535/*
1536 * <ioctl>
1537 * get_amsdu - Get the maximum subframe of amsdu
1538 *
1539 * @INPUT: None
1540 *
1541 * @OUTPUT: Maximum subframe of amsdu
1542 * wlan0 get_amsdu:1
1543 *
1544 * This IOCTL gets the maximum subframe of amsdu.
1545 * This command is useful only if setting amsdu
1546 *
1547 * @E.g: iwpriv wlan0 get_amsdu
1548 *
1549 * Supported Feature: STA
1550 *
1551 * Usage: Internal/External
1552 *
1553 * </ioctl>
1554 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001555#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301556/*
1557 * <ioctl>
1558 * get_txpow2g - Get the current 2 GHz Tx power setting
1559 *
1560 * @INPUT: None
1561 *
1562 * @OUTPUT: Tx Power in dbm
1563 * wlan0 get_txpow2g:0
1564 *
1565 * This IOCTL gets the current 2 GHz Tx power setting
1566 * This command is useful if setting Tx power
1567 *
1568 * @E.g: iwpriv wlan0 get_txpow2g
1569 *
1570 * Supported Feature: STA
1571 *
1572 * Usage: Internal/External
1573 *
1574 * </ioctl>
1575 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001576#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301577/*
1578 * <ioctl>
1579 * get_txpow5g - Get the current 5 GHz Tx power setting
1580 *
1581 * @INPUT: None
1582 *
1583 * @OUTPUT: Tx Power in dbm
1584 * wlan0 get_txpow5g:0
1585 *
1586 * This IOCTL gets the current 5 GHz Tx power setting
1587 * This command is useful if setting Tx power
1588 *
1589 * @E.g: iwpriv wlan0 get_txpow5g
1590 *
1591 * Supported Feature: STA
1592 *
1593 * Usage: Internal/External
1594 *
1595 * </ioctl>
1596 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001597#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001598/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001599#define WE_GET_PPS_PAID_MATCH 32
1600#define WE_GET_PPS_GID_MATCH 33
1601#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1602#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1603#define WE_GET_PPS_EOF_PAD_DELIM 36
1604#define WE_GET_PPS_MACADDR_MISMATCH 37
1605#define WE_GET_PPS_DELIM_CRC_FAIL 38
1606#define WE_GET_PPS_GID_NSTS_ZERO 39
1607#define WE_GET_PPS_RSSI_CHECK 40
1608/* Private ioctl for QPower */
1609#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1610#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1611#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1612#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001613/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301614/*
1615 * <ioctl>
1616 * get_gtxHTMcs - Get the tx HTM
1617 *
1618 * @INPUT: None
1619 *
1620 * @OUTPUT: HTM
1621 * wlan0 get_gtxHTMcs:32896
1622 *
1623 * This IOTCL used to get HTM
1624 *
1625 * @E.g: iwpriv wlan0 get_gtxHTMcs
1626 *
1627 * Supported Feature: STA
1628 *
1629 * Usage: Internal/External
1630 *
1631 * </ioctl>
1632 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001633#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301634/*
1635 * <ioctl>
1636 * get_gtxVHTMcs - Get the VHTM
1637 *
1638 * @INPUT: None
1639 *
1640 * @OUTPUT: VHTM
1641 * wlan0 get_gtxVHTMcs:524800
1642 *
1643 * This IOTCL used to get the VHTM
1644 *
1645 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1646 *
1647 * Supported Feature: STA
1648 *
1649 * Usage: Internal/External
1650 *
1651 * </ioctl>
1652 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001653#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301654/*
1655 * <ioctl>
1656 * get_gtxUsrCfg - Get the tx cfg
1657 *
1658 * @INPUT: None
1659 *
1660 * @OUTPUT: TXCFG
1661 * wlan0 get_gtxUsrCfg:32
1662 *
1663 * This IOTCL used to get the tx cfg
1664 *
1665 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1666 *
1667 * Supported Feature: STA
1668 *
1669 * Usage: Internal/External
1670 *
1671 * </ioctl>
1672 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001673#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301674/*
1675 * <ioctl>
1676 * get_gtxThre - Get the tx threshold
1677 *
1678 * @INPUT: None
1679 *
1680 * @OUTPUT: Threshold
1681 * wlan0 get_gtxThre:3
1682 *
1683 * This IOCTL is used to get tx threshold
1684 *
1685 * @E.g: iwpriv wlan0 get_gtxThre
1686 *
1687 * Supported Feature: STA
1688 *
1689 * Usage: Internal/External
1690 *
1691 * </ioctl>
1692 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001693#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301694/*
1695 * <ioctl>
1696 * get_gtxMargin - Get the tx margin
1697 *
1698 * @INPUT: None
1699 *
1700 * @OUTPUT: GTXMARGIN
1701 * wlan0 get_gtxMargin:2
1702 *
1703 * This IOCTL is used to set tx margin
1704 *
1705 * @E.g: iwpriv wlan0 get_gtxMargin
1706 *
1707 * Supported Feature: STA
1708 *
1709 * Usage: Internal/External
1710 *
1711 * </ioctl>
1712 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001713#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301714/*
1715 * <ioctl>
1716 * get_gtxStep - Get the tx step
1717 *
1718 * @INPUT: None
1719 *
1720 * @OUTPUT: GTXSTEP
1721 * wlan0 get_gtxStep:0
1722 *
1723 * This IOCTL is used to get the gtx step
1724 *
1725 * @E.g: iwpriv wlan0 get_gtxStep
1726 *
1727 * Supported Feature: STA
1728 *
1729 * Usage: Internal/External
1730 *
1731 * </ioctl>
1732 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001733#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301734/*
1735 * <ioctl>
1736 * get_gtxMinTpc - Get the tx miminum tpc
1737 *
1738 * @INPUT: None
1739 *
1740 * @OUTPUT: TPC
1741 * wlan0 get_gtxMinTpc:0
1742 *
1743 * This IOCTL is used to get tx miminum tpc
1744 *
1745 * @E.g: iwpriv wlan0 get_gtxMinTpc
1746 *
1747 * Supported Feature: STA
1748 *
1749 * Usage: Internal/External
1750 *
1751 * </ioctl>
1752 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001753#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301754/*
1755 * <ioctl>
1756 * get_gtxBWMask - Get the tx BW MASK
1757 *
1758 * @INPUT: None
1759 *
1760 * @OUTPUT: MASK
1761 * wlan0 get_gtxBWMask:15
1762 *
1763 * This IOCTL is used get gtx bw mask
1764 *
1765 * @E.g: iwpriv wlan0 get_gtxBWMask
1766 *
1767 * Supported Feature: STA
1768 *
1769 * Usage: Internal/External
1770 *
1771 * </ioctl>
1772 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001773#define WE_GET_GTX_BWMASK 54
1774#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001775#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001776#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001777
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001778/*
1779 * <ioctl>
1780 * get_dcm - Get dcm enablement value
1781 *
1782 * @INPUT: None
1783 *
1784 * @OUTPUT: 0/1
1785 * wlan0 get_dcm
1786 *
1787 * This IOCTL is used get dcm value
1788 *
1789 * Supported Feature: STA/SAP
1790 *
1791 * Usage: Internal
1792 *
1793 * </ioctl>
1794 */
1795#define WE_GET_DCM 60
1796
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001797/*
1798 * <ioctl>
1799 * get_dcm - Get range extension enablement value
1800 *
1801 * @INPUT: None
1802 *
1803 * @OUTPUT: 0/1
1804 * wlan0 get_range_ext
1805 *
1806 * This IOCTL is used get range_extension value
1807 *
1808 * Supported Feature: STA/SAP
1809 *
1810 * Usage: Internal
1811 *
1812 * </ioctl>
1813 */
1814#define WE_GET_RANGE_EXT 61
1815
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001816/* Private ioctls and their sub-ioctls */
1817#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1818
1819/* Private ioctls and their sub-ioctls */
1820#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1821#define WE_WOWL_ADD_PTRN 1
1822#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301823/*
1824 * <ioctl>
1825 * neighbor - Send neighbor report request
1826 *
1827 * @INPUT: string
1828 *
1829 * @OUTPUT: None
1830 *
1831 * This IOCTL create a Neighbor report request and send it to peer
1832 *
1833 * @E.g: iwpriv wlan0 neighbor "SSID"
1834 *
1835 * Supported Feature: 11k
1836 *
1837 * Usage: Internal/External
1838 *
1839 * </ioctl>
1840 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001841#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301842/*
1843 * <ioctl>
1844 * set_ap_wps_ie - Set the P2P IE of the probe response
1845 *
1846 * @INPUT: string
1847 *
1848 * @OUTPUT: None
1849 *
1850 * This IOCTL sets the P2P IE of the probe response
1851 *
1852 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1853 *
1854 * Supported Feature: STA
1855 *
1856 * Usage: Internal/External
1857 *
1858 * </ioctl>
1859 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001860#define WE_SET_AP_WPS_IE 4
Jeff Johnson0fcc94e2019-03-06 19:48:17 -08001861
1862/* 5 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001863
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07001864/*
1865 * <ioctl>
1866 * unit_test - execute component-level unit tests
1867 *
1868 * @INPUT: string - the name of the component to test.
1869 * All tests are executed if unspecified
1870 * @OUTPUT: None
1871 *
1872 * Usage: Internal only
1873 * </ioctl>
1874 */
1875#define WE_UNIT_TEST 6
1876
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001877/* Private ioctls and their sub-ioctls */
1878#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1879#define WE_SET_WLAN_DBG 1
1880#define WE_SET_DP_TRACE 2
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301881#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001882
1883/* Private ioctls and their sub-ioctls */
1884#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1885#define WE_WLAN_VERSION 1
1886#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301887/*
1888 * <ioctl>
1889 * getConfig - gets the values of all configurations listed in WCNSS
1890 *
1891 * @INPUT: None
1892 *
1893 * @OUTPUT: Current configuration to the sys log
1894 * wlan0 getConfig: WLAN configuration written to system log
1895 *
1896 * This IOCTL gets the values of all configurations listed in WCNSS
1897 *
1898 * @E.g: iwpriv wlan0 getConfig
1899 *
1900 * Supported Feature: STA
1901 *
1902 * Usage: Internal/External
1903 *
1904 * </ioctl>
1905 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001906#define WE_GET_CFG 3
1907#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301908/*
1909 * <ioctl>
1910 * getChannelList - Get the available channel list while in QCMobileAP
1911 *
1912 * @INPUT: None
1913 *
1914 * @OUTPUT: Channel list
1915 * wlan0 getChannelList:36 US 1..165
1916 *
1917 * This IOCTL gets the available channel list while in QCMobileAP
1918 *
1919 * @E.g: iwpriv wlan0 getChannelList
1920 *
1921 * Supported Feature: STA
1922 *
1923 * Usage: Internal/External
1924 *
1925 * </ioctl>
1926 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001927#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301928/*
1929 * <ioctl>
1930 * getRSSI - Get the Received Signal Strength Indicator
1931 *
1932 * @INPUT: None
1933 *
1934 * @OUTPUT: RSSI
1935 * wlan0 getRSSI:rsssi=-32
1936 *
1937 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1938 *
1939 * @E.g: iwpriv wlan0 getRSSI
1940 *
1941 * Supported Feature: STA
1942 *
1943 * Usage: Internal/External
1944 *
1945 * </ioctl>
1946 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001947#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001948
1949/*
1950 * <ioctl>
1951 * getSuspendStats - Get suspend/resume stats
1952 *
1953 * @INPUT: None
1954 *
1955 * @OUTPUT: character string containing formatted suspend/resume stats
1956 *
1957 * This ioctl is used to get suspend/resume stats formatted for display.
1958 * Currently it includes suspend/resume counts, wow wake up reasons, and
1959 * suspend fail reasons.
1960 *
1961 * @E.g: iwpriv wlan0 getSuspendStats
1962 * iwpriv wlan0 getSuspendStats
1963 *
1964 * Supported Feature: suspend/resume
1965 *
1966 * Usage: Internal
1967 *
1968 * </ioctl>
1969 */
1970#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001971#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05301972/*
1973 * <ioctl>
1974 * getTdlsPeers - Get all TDLS peers.
1975 *
1976 * @INPUT: None
1977 *
1978 * @OUTPUT: Returns the MAC address of all the TDLS peers
1979 * wlan0 getTdlsPeers:
1980 * MAC Id cap up RSSI
1981 * ---------------------------------
1982 * 00:0a:f5:0e:bd:18 2 Y Y -44
1983 * 00:0a:f5:bf:0e:12 0 N N 0
1984 *
1985 * This IOCTL is used to get all TDLS peers.
1986 *
1987 * @E.g: iwpriv wlan0 getTdlsPeers
1988 *
1989 * Supported Feature: TDLS
1990 *
1991 * Usage: Internal/External
1992 *
1993 * </ioctl>
1994 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001995#define WE_GET_TDLS_PEERS 8
1996#endif
1997#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05301998/*
1999 * <ioctl>
2000 * getPMFInfo - get the PMF info of the connected session
2001 *
2002 * @INPUT: None
2003 *
2004 * @OUTPUT:
2005 * wlan0 getPMFInfo:
2006 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
2007 * Number of Unprotected Disassocs 0
2008 * Number of Unprotected Deauths 0
2009 *
2010 * This IOCTL is used to get the PMF stats/status of the current
2011 * connection.
2012 *
2013 * @e.g:iwpriv wlan0 getPMFInfo
2014 *
2015 * Supported Feature: PMF
2016 *
2017 * Usage: Internal/External
2018 *
2019 * </ioctl>
2020 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002021#define WE_GET_11W_INFO 9
2022#endif
2023#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05302024/*
2025 * <ioctl>
2026 * getIbssSTAs - get ibss sta info
2027 *
2028 * @INPUT: None
2029 *
2030 * @OUTPUT: Give the MAC of the IBSS STA
2031 * wlan0 getIbssSTAs:
2032 * 1 .8c:fd:f0:01:9c:bf
2033 *
2034 * This IOCTL is used to get ibss sta info
2035 *
2036 * @E.g: iwpriv wlan0 getIbssSTAs
2037 *
2038 * Supported Feature: IBSS
2039 *
2040 * Usage: Internal/External
2041 *
2042 * </ioctl>
2043 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002044#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302045/*
2046 * <ioctl>
2047 * getphymode - Get the current phymode.
2048 *
2049 * @INPUT: None
2050 *
2051 * @OUTPUT: In phymode
2052 * wlan0 getphymode:AUTO MODE
2053 *
2054 * This IOCTL used to gets the current phymode.
2055 *
2056 * @E.g: iwpriv wlan0 getphymode
2057 *
2058 * Supported Feature: STA
2059 *
2060 * Usage: Internal/External
2061 *
2062 * </ioctl>
2063 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002064#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002065
2066/*
2067 * <ioctl>
2068 * getOemDataCap - Get the oem data caps.
2069 *
2070 * @INPUT: None
2071 *
2072 * @OUTPUT: oem data capability
2073 *
2074 * This IOCTL used to gets the current oem data cap.
2075 *
2076 * @E.g: iwpriv wlan0 getOemDataCap
2077 *
2078 * Usage: Internal/External
2079 *
2080 * </ioctl>
2081 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002082#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002083
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302084/*
2085 * <ioctl>
2086 * getSNR - Enable SNR Monitoring
2087 *
2088 * @INPUT: None
2089 *
2090 * @OUTPUT: Signal strength/ratio
2091 * wlan0 getSNR:1
2092 *
2093 * This IOCTL is used to get ibss sta info
2094 *
2095 * @E.g: iwpriv wlan0 getSNR
2096 *
2097 * Supported Feature: STA
2098 *
2099 * Usage: Internal/External
2100 *
2101 * </ioctl>
2102 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002103
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002104#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302105#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002106
Krunal Soni6c3859f2018-06-01 19:57:40 -07002107/*
2108 * <ioctl>
2109 *
2110 * get_ba_timeout - to get timeout for each AC
2111 *
2112 * @INPUT: None
2113 *
2114 * @OUTPUT: displays timeout value for each access class
2115 *
2116 * @E.g.: iwpriv wlan0 get_ba_timeout
2117 *
2118 * Usage: Internal
2119 *
2120 * </ioctl>
2121 */
2122#define WE_GET_BA_AGEING_TIMEOUT 16
2123
Krunal Soni5e483782018-10-25 15:42:44 -07002124/*
2125 * <ioctl>
2126 *
2127 * sta_cxn_info - STA connection information
2128 *
2129 * @INPUT: none
2130 *
2131 * @OUTPUT: STA's connection information
2132 *
2133 * This IOCTL is used to get connection's information.
2134 *
2135 * @E.g: iwpriv wlan0 get_cxn_info
2136 *
2137 * Usage: Internal
2138 *
2139 * </ioctl>
2140 */
2141#define WE_GET_STA_CXN_INFO 17
2142
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002143/* Private ioctls and their sub-ioctls */
2144#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302145
2146/*
2147 * <ioctl>
2148 * reassoc - Trigger STA re-association to the connected AP
2149 *
2150 * @INPUT: None
2151 *
2152 * @OUTPUT: None
2153 *
2154 * This IOCTL is used to trigger STA reassociation to the connected AP.
2155 *
2156 * @E.g: iwpriv wlan0 reassoc
2157 *
2158 * Supported Feature: Roaming
2159 *
2160 * Usage: Internal
2161 *
2162 * </ioctl>
2163 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002164#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302165/*
2166 * <ioctl>
2167 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2168 *
2169 * @INPUT: None
2170 *
2171 * @OUTPUT: print ibss peer in info logs
Jeff Johnson52f19d52019-02-26 08:35:38 -08002172 * peer_info->numIBSSPeers = 1
Abhishek Singh49b654e2016-12-01 16:11:17 +05302173 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2174 *
2175 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2176 * in info logs
2177 *
2178 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2179 *
2180 * Supported Feature: IBSS
2181 *
2182 * Usage: Internal/External
2183 *
2184 * </ioctl>
2185 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002186#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002187/* Sub ioctls 11 to 16 are not used */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002188#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302189/*
2190 * <ioctl>
2191 * stop_obss_scan - Stop obss scan
2192 *
2193 * @INPUT: None
2194 *
2195 * @OUTPUT: None
2196 *
2197 * This IOCTL is used to stop obss scan
2198 *
2199 * @E.g: iwpriv wlan0 stop_obss_scan
2200 *
2201 * Supported Feature: Scan
2202 *
2203 * Usage: Internal/External
2204 *
2205 * </ioctl>
2206 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002207#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002208
2209/* Private ioctls and their sub-ioctls */
2210#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2211
2212#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302213/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002214
Manjeet Singhf82ed072016-07-08 11:40:00 +05302215#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002216
Kabilan Kannan6894e6a2017-11-09 14:37:55 -08002217/* subcommand 5 is unused */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302218
Abhishek Singh49b654e2016-12-01 16:11:17 +05302219/*
2220 * <ioctl>
2221 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2222 *
Jeff Johnson0a082d92019-03-04 12:25:49 -08002223 * @INPUT: sta_id
Abhishek Singh49b654e2016-12-01 16:11:17 +05302224 *
Jeff Johnson0a082d92019-03-04 12:25:49 -08002225 * @OUTPUT: print ibss peer corresponding to sta_id in info logs
Abhishek Singh49b654e2016-12-01 16:11:17 +05302226 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2227 *
2228 * This IOCTL is used to print the specific ibss peers's MAC,
2229 * rate and RSSI in info logs
2230 *
2231 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2232 * iwpriv wlan0 ibssPeerInfo 0
2233 *
2234 * Supported Feature: IBSS
2235 *
2236 * Usage: Internal/External
2237 *
2238 * </ioctl>
2239 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002240#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002241#define WE_UNIT_TEST_CMD 7
2242
2243#define WE_MTRACE_DUMP_CMD 8
2244#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2245
2246
2247#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2248#define WE_LED_FLASHING_PARAM 10
2249#endif
2250
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302251/*
2252 * <ioctl>
2253 * pm_clist - Increments the index value of the concurrent connection list
2254 * and update with the input parameters provided.
2255 *
2256 * @INPUT: Following 8 arguments:
2257 * @vdev_id: vdev id
2258 * @tx_streams: TX streams
2259 * @rx_streams: RX streams
2260 * @chain_mask: Chain mask
2261 * @type: vdev_type
2262 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2263 * @sub_type: vdev_subtype
2264 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2265 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2266 * @channel: Channel
2267 * @mac: Mac id
2268 *
2269 * @OUTPUT: None
2270 *
2271 * This IOCTL is used to increments the index value of the concurrent connection
2272 * list and update with the input parameters provided.
2273 *
2274 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2275 * sub_type channel mac
2276 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
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_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302285
2286/*
2287 * <ioctl>
2288 * pm_dlist - Delete the index from the concurrent connection list that is
2289 * present in the given vdev_id.
2290 *
2291 * @INPUT: delete_all, vdev_id
2292 * @delete_all: delete all indices
2293 * @vdev_id: vdev id
2294 *
2295 * @OUTPUT: None
2296 *
2297 * This IOCTL is used to delete the index from the concurrent connection list
2298 * that is present in the given vdev_id.
2299 *
2300 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2301 * iwpriv wlan0 pm_dlist 0 1
2302 *
2303 * Supported Feature: DBS
2304 *
2305 * Usage: Internal/External
2306 *
2307 * </ioctl>
2308 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002309#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302310
2311/*
2312 * <ioctl>
2313 * pm_dbs - Set dbs capability and system preference
2314 *
2315 * @INPUT: dbs, system_pref
2316 * @dbs: Value of DBS capability to be set
2317 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002318 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302319 *
2320 * @OUTPUT: None
2321 *
2322 * This IOCTL is used to set dbs capability and system preference.
2323 *
2324 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2325 * iwpriv wlan0 pm_dbs 1 0
2326 *
2327 * Supported Feature: DBS
2328 *
2329 * Usage: Internal/External
2330 *
2331 * </ioctl>
2332 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002333#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302334
2335/*
2336 * <ioctl>
2337 * pm_pcl - Set pcl for concurrency mode.
2338 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002339 * @INPUT: policy_mgr_con_mode
2340 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302341 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2342 *
2343 * @OUTPUT: None
2344 *
2345 * This IOCTL is used to set pcl for concurrency mode.
2346 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002347 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302348 * iwpriv wlan0 pm_pcl 0
2349 *
2350 * Supported Feature: DBS
2351 *
2352 * Usage: Internal/External
2353 *
2354 * </ioctl>
2355 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002356#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302357
2358/*
2359 * <ioctl>
2360 * pm_cinfo - Shows the concurrent connection list.
2361 *
2362 * @INPUT: None
2363 *
2364 * @OUTPUT: None
2365 *
2366 * This IOCTL is used to show the concurrent connection list.
2367 *
2368 * @E.g: iwpriv wlan0 pm_cinfo
2369 *
2370 * Supported Feature: DBS
2371 *
2372 * Usage: Internal/External
2373 *
2374 * </ioctl>
2375 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002376#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302377
2378/*
2379 * <ioctl>
2380 * pm_ulist - Updates the index value of the concurrent connection list
2381 * with the input parameters provided.
2382 *
2383 * @INPUT: Following 8 arguments:
2384 * @vdev_id: vdev id
2385 * @tx_streams: TX streams
2386 * @rx_streams: RX streams
2387 * @chain_mask: Chain mask
2388 * @type: vdev_type
2389 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2390 * @sub_type: vdev_subtype
2391 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2392 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2393 * @channel: Channel
2394 * @mac: Mac id
2395 *
2396 * @OUTPUT: None
2397 *
2398 * This IOCTL is used to updates the index value of the concurrent
2399 * connection list with the input parameters provided.
2400 *
2401 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2402 * sub_type channel mac
2403 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2404 *
2405 * Supported Feature: DBS
2406 *
2407 * Usage: Internal/External
2408 *
2409 * </ioctl>
2410 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002411#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302412
2413/*
2414 * <ioctl>
2415 * pm_query_action - Initiate actions needed on current connections as
2416 * per the channel provided.
2417 *
2418 * @INPUT: channel
2419 * @channel: Channel on which new connection will be.
2420 *
2421 * @OUTPUT: None
2422 *
2423 * This IOCTL is used to initiate actions needed on current connections
2424 * as per the channel provided.
2425 *
2426 * @E.g: iwpriv wlan0 pm_query_action channel
2427 * iwpriv wlan0 pm_query_action 6
2428 *
2429 * Supported Feature: DBS
2430 *
2431 * Usage: Internal/External
2432 *
2433 * </ioctl>
2434 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002435#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302436
2437/*
2438 * <ioctl>
2439 * pm_query_allow - Checks for allowed concurrency combination
2440 *
2441 * @INPUT: mode, channel, bandwidth
2442 * @mode: new connection mode
2443 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2444 * @channel: channel on which new connection is coming up
2445 * @bandwidth: Bandwidth requested by the connection
2446 * 0:None 1:5MHz 2:10MHz 3:20MHz
2447 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2448 *
2449 * @OUTPUT: None
2450 *
2451 * This IOCTL is used to checks for allowed concurrency combination.
2452 *
2453 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2454 * iwpriv wlan0 pm_query_allow 0 6 4
2455 *
2456 * Supported Feature: DBS
2457 *
2458 * Usage: Internal/External
2459 *
2460 * </ioctl>
2461 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002462#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302463
2464/*
2465 * <ioctl>
2466 * pm_run_scenario - Create scenario with number of connections provided.
2467 *
2468 * @INPUT: num_of_conn
2469 * @num_of_conn: the number of connections (values: 1~3)
2470 *
2471 * @OUTPUT: None
2472 *
2473 * This IOCTL is used to create scenario with the number of connections
2474 * provided.
2475 *
2476 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2477 * iwpriv wlan0 pm_run_scenario 1
2478 *
2479 * Supported Feature: DBS
2480 *
2481 * Usage: Internal/External
2482 *
2483 * </ioctl>
2484 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002485#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302486
2487/*
2488 * <ioctl>
2489 * pm_set_hw_mode - Set hardware for single/dual mac.
2490 *
2491 * @INPUT: hw_mode
2492 * 0:single mac 1:dual mac
Liangwei Dong509c3472018-05-30 07:05:59 -04002493 * 2: 2x2 5g + 1x1 2g dbs mode
2494 * 3: 2x2 2g + 1x1 5g dbs mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302495 *
2496 * @OUTPUT: None
2497 *
2498 * This IOCTL is used to set hardware for single/dual mac.
2499 *
2500 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2501 * iwpriv wlan0 pm_set_hw_mode 1
2502 *
2503 * Supported Feature: DBS
2504 *
2505 * Usage: Internal/External
2506 *
2507 * </ioctl>
2508 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002509#define WE_POLICY_SET_HW_MODE_CMD 20
2510
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302511/*
2512 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002513 * ch_avoid - unit test SAP channel avoidance
2514 *
2515 * @INPUT: chan avoid ranges
2516 *
2517 * @OUTPUT: none
2518 *
2519 * This IOCTL is used to fake a channel avoidance event.
2520 * To test SAP/GO chan switch during chan avoid event process.
2521 *
2522 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2523 *
2524 * Supported Feature: SAP chan avoidance.
2525 *
2526 * Usage: Internal
2527 *
2528 * </ioctl>
2529 */
2530#define WE_SET_CHAN_AVOID 21
2531
2532/*
2533 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302534 * set_scan_cfg - Set dual MAC scan config parameters.
2535 *
2536 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2537 * @dbs: Value of DBS bit
2538 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2539 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2540 *
2541 * @OUTPUT: None
2542 *
2543 * This IOCTL is used to set the dual MAC scan config.
2544 *
2545 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2546 * single_mac_scan_with_dbs
2547 * iwpriv wlan0 set_scan_cfg 1 0 1
2548 *
2549 * Supported Feature: DBS
2550 *
2551 * Usage: Internal/External
2552 *
2553 * </ioctl>
2554 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002555#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302556
2557/*
2558 * <ioctl>
2559 * set_fw_mode_cfg - Sets the dual mac FW mode config
2560 *
2561 * @INPUT: dbs, dfs
2562 * @dbs: DBS bit
2563 * @dfs: Agile DFS bit
2564 *
2565 * @OUTPUT: None
2566 *
2567 * This IOCTL is used to set the dual mac FW mode config.
2568 *
2569 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2570 * iwpriv wlan0 set_fw_mode_cfg 1 1
2571 *
2572 * Supported Feature: DBS
2573 *
2574 * Usage: Internal/External
2575 *
2576 * </ioctl>
2577 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002578#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002579#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002580/*
2581 * <ioctl>
2582 * txrx_stats - TXRX statistics query
2583 *
2584 * @INPUT: query category, mac id (default mac id is 0)
2585 *
2586 * @OUTPUT: TXRX statistics result
2587 *
2588 * This IOCTL is used to get TXRX statistics counters.
2589 *
2590 * @E.g: iwpriv wlan0 txrx_stats 21 0
2591 * iwpriv wlan0 txrx_stats 21 1
2592 *
2593 * Usage: Internal
2594 *
2595 * </ioctl>
2596 */
2597#define WE_SET_TXRX_STATS 24
2598
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002599
2600#ifdef FEATURE_WLAN_TDLS
2601#undef MAX_VAR_ARGS
2602#define MAX_VAR_ARGS 11
2603#else
2604#undef MAX_VAR_ARGS
2605#define MAX_VAR_ARGS 9
2606#endif
2607
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302608#ifdef WLAN_FEATURE_MOTION_DETECTION
2609#undef MAX_VAR_ARGS
2610#define MAX_VAR_ARGS 15
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302611#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302612#define WE_MOTION_DET_CONFIG_PARAM 25
2613#define WE_MOTION_DET_BASE_LINE_CONFIG_PARAM 26
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302614
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302615#define WE_SET_THERMAL_THROTTLE_CFG 27
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002616/*
2617 * <ioctl>
2618 * fips_test - Perform a FIPS test
2619 *
2620 * @INPUT: Binary representation of the following packed structure
2621 *
2622 * @OUTPUT: Binary representation of the following packed structure
2623 *
2624 * This IOCTL is used to perform FIPS certification testing
2625 *
2626 * @E.g: iwpriv wlan0 fips_test <test vector>
2627 *
2628 * iwpriv wlan0 fips_test <tbd>
2629 *
2630 * Supported Feature: FIPS
2631 *
2632 * Usage: Internal
2633 *
2634 * </ioctl>
2635 */
2636#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2637
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002638/* Private ioctls (with no sub-ioctls) */
2639/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302640/*
2641 * <ioctl>
2642 * addTspec - Add TSPEC for each AC
2643 *
2644 * @INPUT: 19 TSPEC params
2645 * @[arg0]: handle
2646 * @[arg1]: tid
2647 * @[arg2]: dir
2648 * @[arg3]: psb
2649 * @[arg4]: up
2650 * @[arg5]: nomMsduSize
2651 * @[arg6]: maxMsduSize
2652 * @[arg7]: minDataRate
2653 * @[arg8]: meanDataRate
2654 * @[arg9]: peakDataRate
2655 * @[arg10]: maxBurstSize
2656 * @[arg11]: minPhyRate
2657 * @[arg12]: sba
2658 * @[arg13]: minServiceIntv
2659 * @[arg14]: suspendIntv
2660 * @[arg15]: burstSizeDefn
2661 * @[arg16]: ackPolicy
2662 * @[arg17]: inactivityPeriod
2663 * @[arg18]: maxServiceIntv
2664 *
2665 * @OUTPUT: Success/Failure
2666 *
2667 * This IOCTL is used to add TSPEC for each AC.
2668 *
2669 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2670 * <maxMsduSize> <minDataRate> <meanDataRate>
2671 * <peakDataRate> <maxBurstSize> <minPhyRate>
2672 * <sba> <minServiceIntv> <suspendIntv>
2673 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2674 * <maxServiceIntv>
2675 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2676 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2677 * wlan0 addTspec:3
2678 *
2679 * Supported Feature: WMM
2680 *
2681 * Usage: Internal/External
2682 *
2683 * </ioctl>
2684 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002685#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302686/*
2687 * <ioctl>
2688 * delTspec - Delete TSPEC entry for each AC
2689 *
2690 * @INPUT: 1 TSPEC param
2691 * @[arg0]: handle
2692 *
2693 * @OUTPUT: Success/Failure
2694 *
2695 * This IOCTL is used to delete TSPEC entry for each AC.
2696 *
2697 * @E.g: iwpriv wlan0 delTspec <handle>
2698 * iwpriv wlan0 delTspec 7001
2699 * wlan0 delTspec:16
2700 *
2701 * Supported Feature: WMM
2702 *
2703 * Usage: Internal/External
2704 *
2705 * </ioctl>
2706 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002707#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302708/*
2709 * <ioctl>
2710 * getTspec - Get TSPEC entry for each AC
2711 *
2712 * @INPUT: 1 TSPEC param
2713 * @[arg0]: handle
2714 *
2715 * @OUTPUT: Success/Failure
2716 *
2717 * This IOCTL is used to get TSPEC entry for each AC.
2718 *
2719 * @E.g: iwpriv wlan0 getTspec <handle>
2720 * iwpriv wlan0 getTspec 7001
2721 * wlan0 delTspec:18
2722 *
2723 * Supported Feature: WMM
2724 *
2725 * Usage: Internal/External
2726 *
2727 * </ioctl>
2728 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002729#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2730
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002731/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2732/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2733/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002734#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2735#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002736/* (SIOCIWFIRSTPRIV + 16) is currently unused */
Krunal Sonif9ba53d2019-01-03 21:44:41 -08002737
2738#ifdef FEATURE_WLM_STATS
2739/*
2740 * <ioctl>
2741 *
2742 * get_wlm_stats - Get stats from FW for game latency
2743 *
2744 * @INPUT: BITMASK inform of decimal number
2745 *
2746 * @OUTPUT: HEX string given by FW
2747 *
2748 * This IOCTL is used to get game latency related STATS from FW
2749 *
2750 * @E.g.: iwpriv wlan0 get_wlm_stats 1
2751 *
2752 * Usage: internal
2753 *
2754 * </ioctl>
2755 */
2756#define WLAN_GET_WLM_STATS (SIOCIWFIRSTPRIV + 17)
2757#endif
2758
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002759/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2760
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002761#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002762
2763/* Private ioctl for setting the host offload feature */
2764#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2765
2766/* Private ioctl to get the statistics */
2767#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2768
2769/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302770/*
2771 * <ioctl>
2772 * setKeepAlive - Set the keep alive feature
2773 *
2774 * @INPUT: 28 bytes of information in the order of packet type, time period
2775 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2776 *
2777 * @OUTPUT: None
2778 *
2779 * This IOCTL sets the keep alive feature to send either NULL
2780 * or unsolicited ARP response packets
2781 *
2782 * @E.g: iwpriv wlan0 setKeepAlive
2783 *
2784 * Supported Feature: STA
2785 *
2786 * Usage: Internal/External
2787 *
2788 * </ioctl>
2789 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002790#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2791
2792#ifdef WLAN_FEATURE_PACKET_FILTERING
2793/* Private ioctl to set the packet filtering params */
2794#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2795#endif
2796
2797
2798#ifdef FEATURE_WLAN_SCAN_PNO
2799/* Private ioctl to get the statistics */
2800#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2801#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302802/*
2803 * <ioctl>
2804 * SETBAND - Set the operational band
2805 *
2806 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2807 *
2808 * @OUTPUT: None
2809 *
2810 * This IOCTL Set the operational band If the new band is different from the
2811 * current operational band, it aborts the pending scan requests, flushes
2812 * the existing scan results, and then change * the band capability
2813 *
2814 * @E.g: iwpriv wlan0 SETBAND <value>
2815 *
2816 * Supported Feature: STA
2817 *
2818 * Usage: Internal/External
2819 *
2820 * </ioctl>
2821 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002822#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2823
Dustin Brown0cbc7572016-12-16 13:54:40 -08002824#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002825/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002826
2827/* Private ioctls and their sub-ioctls */
2828#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2829#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002830#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002831#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302832/* Private sub ioctl for enabling and setting histogram interval of profiling */
2833#define WE_ENABLE_FW_PROFILE 4
2834#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002835
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002836/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002837#define WE_SET_WLAN_SUSPEND 6
2838#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002839
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002840/*
2841 * <ioctl>
2842 * log_buffer - prints host/target related communication logs via dmesg
2843 *
2844 * @INPUT: Log Id, Count
2845 *
2846 * Log Id:
2847 * 0) HTC_CREDIT_HISTORY_LOG
2848 * 1) COMMAND_LOG,
2849 * 2) COMMAND_TX_CMP_LOG,
2850 * 3) MGMT_COMMAND_LOG,
2851 * 4) MGMT_COMMAND_TX_CMP_LOG,
2852 * 5) EVENT_LOG,
2853 * 6) RX_EVENT_LOG,
2854 * 7) MGMT_EVENT_LOG
2855 *
2856 * @OUTPUT: None
2857 *
2858 * @E.g:
2859 * # print up to 10 of the most recent records from HTC Credit History
2860 * iwpriv wlan0 log_buffer 0 10
2861 * # print up to 3 of the most recent records from Event Log
2862 * iwpriv wlan0 log_buffer 5 3
2863 *
2864 * Supported Feature: WLAN Trace
2865 *
2866 * Usage: Internal/External
2867 *
2868 * </ioctl>
2869 */
2870#define WE_LOG_BUFFER 8
2871
Krunal Soni6c3859f2018-06-01 19:57:40 -07002872/*
2873 * <ioctl>
2874 * set_ba_timeout - sets Block ACK aging timeout value for each Access class
2875 *
2876 * @INPUT: Access Class [0:BK, 1:BE, 2:VI, 3:VO], Timeout value
2877 *
2878 * @OUTPUT: None
2879 *
2880 * @E.g.:
2881 * # to set duration of 2 seconds for BE
2882 * iwpriv wlan0 set_ba_timeout 1 2
2883 * # to set duration of 3 seconds for VO
2884 * iwpriv wlan0 set_ba_timeout 3 3
2885 *
2886 * Usage: Internal
2887 *
2888 * </ioctl>
2889 */
2890#define WE_SET_BA_AGEING_TIMEOUT 9
2891
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002892enum host_target_comm_log {
2893 HTC_CREDIT_HISTORY_LOG = 0,
2894 COMMAND_LOG,
2895 COMMAND_TX_CMP_LOG,
2896 MGMT_COMMAND_LOG,
2897 MGMT_COMMAND_TX_CMP_LOG,
2898 EVENT_LOG,
2899 RX_EVENT_LOG,
2900 MGMT_EVENT_LOG
2901};
2902
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002903/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2904
2905/* 802.11p IOCTL */
2906#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2907
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302908/*
2909 * <ioctl>
2910 * getLinkSpeed - Gets the current link speed in Mbps
2911 *
2912 * @INPUT: None
2913 *
2914 * @OUTPUT: linkspeed in mbps
2915 * wlan0 getLinkSpeed:7
2916 *
2917 * This IOCTL is used get the current link speed in Mbps
2918 *
2919 * @E.g: iwpriv wlan0 getLinkSpeed
2920 *
2921 * Supported Feature: STA
2922 *
2923 * Usage: Internal/External
2924 *
2925 * </ioctl>
2926 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002927#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2928
2929#define WLAN_STATS_INVALID 0
2930#define WLAN_STATS_RETRY_CNT 1
2931#define WLAN_STATS_MUL_RETRY_CNT 2
2932#define WLAN_STATS_TX_FRM_CNT 3
2933#define WLAN_STATS_RX_FRM_CNT 4
2934#define WLAN_STATS_FRM_DUP_CNT 5
2935#define WLAN_STATS_FAIL_CNT 6
2936#define WLAN_STATS_RTS_FAIL_CNT 7
2937#define WLAN_STATS_ACK_FAIL_CNT 8
2938#define WLAN_STATS_RTS_SUC_CNT 9
2939#define WLAN_STATS_RX_DISCARD_CNT 10
2940#define WLAN_STATS_RX_ERROR_CNT 11
2941#define WLAN_STATS_TX_BYTE_CNT 12
2942
2943#define WLAN_STATS_RX_BYTE_CNT 13
2944#define WLAN_STATS_RX_RATE 14
2945#define WLAN_STATS_TX_RATE 15
2946
2947#define WLAN_STATS_RX_UC_BYTE_CNT 16
2948#define WLAN_STATS_RX_MC_BYTE_CNT 17
2949#define WLAN_STATS_RX_BC_BYTE_CNT 18
2950#define WLAN_STATS_TX_UC_BYTE_CNT 19
2951#define WLAN_STATS_TX_MC_BYTE_CNT 20
2952#define WLAN_STATS_TX_BC_BYTE_CNT 21
2953
2954#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2955 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2956 *__p++ = __type; \
2957 *__p++ = __size; \
2958 memcpy(__p, __val, __size); \
2959 __p += __size; \
2960 __tlen += __size + 2; \
2961 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002962 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002963 } \
2964 } while (0)
2965
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002966#define TX_PER_TRACKING_DEFAULT_RATIO 5
2967#define TX_PER_TRACKING_MAX_RATIO 10
2968#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2969
2970#define WLAN_ADAPTER 0
2971#define P2P_ADAPTER 1
2972
2973/**
2974 * mem_alloc_copy_from_user_helper - copy from user helper
2975 * @wrqu_data: wireless extensions request data
2976 * @len: length of @wrqu_data
2977 *
2978 * Helper function to allocate buffer and copy user data.
2979 *
2980 * Return: On success return a pointer to a kernel buffer containing a
2981 * copy of the userspace data (with an additional NUL character
2982 * appended for safety). On failure return %NULL.
2983 */
2984void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2985{
2986 u8 *ptr = NULL;
2987
2988 /* in order to protect the code, an extra byte is post
2989 * appended to the buffer and the null termination is added.
2990 * However, when allocating (len+1) byte of memory, we need to
2991 * make sure that there is no uint overflow when doing
2992 * addition. In theory check len < UINT_MAX protects the uint
2993 * overflow. For wlan private ioctl, the buffer size is much
2994 * less than UINT_MAX, as a good guess, now, it is assumed
2995 * that the private command buffer size is no greater than 4K
2996 * (4096 bytes). So we use 4096 as the upper boundary for now.
2997 */
2998 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002999 hdd_err("Invalid length: %zu max: %u",
3000 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003001 return NULL;
3002 }
3003
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07003004 ptr = qdf_mem_malloc(len + 1);
Jeff Johnsond36fa332019-03-18 13:42:25 -07003005 if (!ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003006 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003007 return NULL;
3008 }
3009
3010 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003011 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07003012 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003013 return NULL;
3014 }
3015 ptr[len] = '\0';
3016 return ptr;
3017}
3018
3019/**
3020 * hdd_priv_get_data() - Get pointer to ioctl private data
3021 * @p_priv_data: pointer to iw_point struct to be filled
3022 * @wrqu: Pointer to IOCTL Data received from userspace
3023 *
3024 * Helper function to get compatible struct iw_point passed to ioctl
3025 *
3026 * Return - 0 if p_priv_data successfully filled, error otherwise
3027 */
3028int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
3029{
Jeff Johnsond36fa332019-03-18 13:42:25 -07003030 if ((!p_priv_data) || (!wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003031 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003032
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003033#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07003034 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003035 struct compat_iw_point *p_compat_priv_data;
3036
3037 /* Compat task:
3038 * typecast to compat structure and copy the members.
3039 */
3040 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
3041
3042 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
3043 p_priv_data->length = p_compat_priv_data->length;
3044 p_priv_data->flags = p_compat_priv_data->flags;
3045 } else {
3046#endif /* #ifdef CONFIG_COMPAT */
3047
3048 /* Non compat task: directly copy the structure. */
3049 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
3050
3051#ifdef CONFIG_COMPAT
3052 }
3053#endif /* #ifdef CONFIG_COMPAT */
3054
3055 return 0;
3056}
3057
Jeff Johnson441e1f72017-02-07 08:50:49 -08003058static int hdd_check_wext_control(enum hdd_wext_control wext_control,
3059 struct iw_request_info *info)
3060{
3061 switch (wext_control) {
3062 default:
3063 case hdd_wext_disabled:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003064 hdd_err_rl("Rejecting disabled ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003065 return -ENOTSUPP;
3066 case hdd_wext_deprecated:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003067 hdd_warn_rl("Using deprecated ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003068 return 0;
3069 case hdd_wext_enabled:
3070 return 0;
3071 }
3072}
3073
Jeff Johnson82797b62017-08-11 15:31:27 -07003074int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08003075 struct iw_request_info *info)
3076{
3077 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
3078 info);
3079}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003080
3081/**
3082 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003083 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003084 * @length: Size of the data copied
3085 * @buffer: Pointer to char buffer.
3086 * @buf_len: Length of the char buffer.
3087 *
3088 * This function called when the "iwpriv wlan0 get_stats" command is given.
3089 * It used to collect the txrx stats when the device is configured in SAP mode.
3090 *
3091 * Return - none
3092 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003093void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003094 char *buffer, uint16_t buf_len)
3095{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003096 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003097 uint32_t len = 0;
3098 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
3099 uint32_t total_rx_delv = 0, total_rx_refused = 0;
3100 int i = 0;
Mohit Khanna81418772018-10-30 14:14:46 -07003101 struct hdd_context *hdd_ctx = adapter->hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003102
3103 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003104 total_rx_pkt += stats->rx_packets[i];
3105 total_rx_dropped += stats->rx_dropped[i];
3106 total_rx_delv += stats->rx_delivered[i];
3107 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003108 }
3109
3110 len = scnprintf(buffer, buf_len,
Mohit Khanna81418772018-10-30 14:14:46 -07003111 "\nTransmit[%lu] - "
3112 "called %u, dropped %u orphan %u,"
3113 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
3114 "\n[classified] BK %u, BE %u, VI %u, VO %u"
3115 "\n\nReceive[%lu] - "
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003116 "packets %u, dropped %u, unsolict_arp_n_mcast_drp %u, delivered %u, refused %u\n"
Mohit Khanna81418772018-10-30 14:14:46 -07003117 "GRO - agg %u non-agg %u flushes(%u %u) disabled(conc %u low-tput %u)\n",
3118 qdf_system_ticks(),
3119 stats->tx_called,
3120 stats->tx_dropped,
3121 stats->tx_orphaned,
3122 stats->tx_dropped_ac[SME_AC_BK],
3123 stats->tx_dropped_ac[SME_AC_BE],
3124 stats->tx_dropped_ac[SME_AC_VI],
3125 stats->tx_dropped_ac[SME_AC_VO],
3126 stats->tx_classified_ac[SME_AC_BK],
3127 stats->tx_classified_ac[SME_AC_BE],
3128 stats->tx_classified_ac[SME_AC_VI],
3129 stats->tx_classified_ac[SME_AC_VO],
3130 qdf_system_ticks(),
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003131 total_rx_pkt, total_rx_dropped,
3132 qdf_atomic_read(&stats->rx_usolict_arp_n_mcast_drp),
3133 total_rx_delv,
Mohit Khanna81418772018-10-30 14:14:46 -07003134 total_rx_refused,
3135 stats->rx_aggregated, stats->rx_non_aggregated,
3136 stats->rx_gro_flushes,
3137 stats->rx_gro_force_flushes,
3138 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_concurrency),
3139 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_low_tput));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003140
3141 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003142 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003143 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003144 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna81418772018-10-30 14:14:46 -07003145 "Rx CPU[%d]:"
3146 "packets %u, dropped %u, delivered %u, refused %u\n",
3147 i, stats->rx_packets[i], stats->rx_dropped[i],
3148 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003149 }
3150
3151 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003152 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003153 "\nCurrent status: %s"
3154 "\ntx-flow timer start count %u"
3155 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003156 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3157 stats->txflow_timer_cnt,
3158 stats->txflow_pause_cnt,
3159 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003160
Leo Changfdb45c32016-10-28 11:09:23 -07003161 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003162 adapter->vdev_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003163 *length = len + 1;
3164}
3165
3166/**
Dustin Brownd9322482017-01-09 12:46:03 -08003167 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3168 * @hdd_ctx: The Hdd context owning the stats to be written
3169 * @buffer: The char buffer to write to
3170 * @max_len: The maximum number of chars to write
3171 *
3172 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3173 *
3174 * Return - length of written content, negative number on error
3175 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003176#ifdef QCA_SUPPORT_CP_STATS
3177static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
3178 char *buffer, uint16_t max_len)
3179{
3180 int ret;
3181 QDF_STATUS status;
3182 struct suspend_resume_stats *sr_stats;
3183
3184 sr_stats = &hdd_ctx->suspend_resume_stats;
3185 ret = scnprintf(buffer, max_len,
3186 "\n"
3187 "Suspends: %u\n"
3188 "Resumes: %u\n"
3189 "\n"
3190 "Suspend Fail Reasons\n"
3191 "\tIPA: %u\n"
3192 "\tRadar: %u\n"
3193 "\tRoam: %u\n"
3194 "\tScan: %u\n"
3195 "\tInitial Wakeup: %u\n"
3196 "\n",
3197 sr_stats->suspends, sr_stats->resumes,
3198 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3199 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3200 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3201 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3202 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]);
3203
Dustin Brown05d81302018-09-11 16:49:22 -07003204 status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->psoc,
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003205 &buffer[ret], max_len - ret,
3206 &ret);
3207 if (QDF_IS_STATUS_ERROR(status)) {
3208 hdd_err("Failed to get WoW stats");
3209 return qdf_status_to_os_return(status);
3210 }
3211
3212 return ret;
3213}
3214#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003215static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
Dustin Brownd9322482017-01-09 12:46:03 -08003216 char *buffer, uint16_t max_len)
3217{
3218 QDF_STATUS status;
3219 struct suspend_resume_stats *sr_stats;
3220 struct sir_wake_lock_stats wow_stats;
3221
3222 sr_stats = &hdd_ctx->suspend_resume_stats;
3223
3224 status = wma_get_wakelock_stats(&wow_stats);
3225 if (QDF_IS_STATUS_ERROR(status)) {
3226 hdd_err("Failed to get WoW stats");
3227 return qdf_status_to_os_return(status);
3228 }
3229
3230 return scnprintf(buffer, max_len,
3231 "\n"
3232 "Suspends: %u\n"
3233 "Resumes: %u\n"
3234 "\n"
3235 "Suspend Fail Reasons\n"
3236 "\tIPA: %u\n"
3237 "\tRadar: %u\n"
3238 "\tRoam: %u\n"
3239 "\tScan: %u\n"
3240 "\tInitial Wakeup: %u\n"
3241 "\n"
3242 "WoW Wake Reasons\n"
3243 "\tunicast: %u\n"
3244 "\tbroadcast: %u\n"
3245 "\tIPv4 multicast: %u\n"
3246 "\tIPv6 multicast: %u\n"
3247 "\tIPv6 multicast RA: %u\n"
3248 "\tIPv6 multicast NS: %u\n"
3249 "\tIPv6 multicast NA: %u\n"
3250 "\tICMPv4: %u\n"
3251 "\tICMPv6: %u\n"
3252 "\tRSSI Breach: %u\n"
3253 "\tLow RSSI: %u\n"
3254 "\tG-Scan: %u\n"
3255 "\tPNO Complete: %u\n"
3256 "\tPNO Match: %u\n",
3257 sr_stats->suspends,
3258 sr_stats->resumes,
3259 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3260 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3261 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3262 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3263 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP],
3264 wow_stats.wow_ucast_wake_up_count,
3265 wow_stats.wow_bcast_wake_up_count,
3266 wow_stats.wow_ipv4_mcast_wake_up_count,
3267 wow_stats.wow_ipv6_mcast_wake_up_count,
3268 wow_stats.wow_ipv6_mcast_ra_stats,
3269 wow_stats.wow_ipv6_mcast_ns_stats,
3270 wow_stats.wow_ipv6_mcast_na_stats,
3271 wow_stats.wow_icmpv4_count,
3272 wow_stats.wow_icmpv6_count,
3273 wow_stats.wow_rssi_breach_wake_up_count,
3274 wow_stats.wow_low_rssi_wake_up_count,
3275 wow_stats.wow_gscan_wake_up_count,
3276 wow_stats.wow_pno_complete_wake_up_count,
3277 wow_stats.wow_pno_match_wake_up_count);
3278}
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003279#endif
Dustin Brownd9322482017-01-09 12:46:03 -08003280/**
Govind Singha471e5e2015-10-12 17:11:14 +05303281 * hdd_wlan_list_fw_profile() - Get fw profiling points
3282 * @length: Size of the data copied
3283 * @buffer: Pointer to char buffer.
3284 * @buf_len: Length of the char buffer.
3285 *
3286 * This function called when the "iwpriv wlan0 listProfile" command is given.
3287 * It is used to get the supported profiling points in FW.
3288 *
3289 * Return - none
3290 */
3291void hdd_wlan_list_fw_profile(uint16_t *length,
3292 char *buffer, uint16_t buf_len)
3293{
3294 uint32_t len = 0;
3295
3296 len = scnprintf(buffer, buf_len,
3297 "PROF_CPU_IDLE: %u\n"
3298 "PROF_PPDU_PROC: %u\n"
3299 "PROF_PPDU_POST: %u\n"
3300 "PROF_HTT_TX_INPUT: %u\n"
3301 "PROF_MSDU_ENQ: %u\n"
3302 "PROF_PPDU_POST_HAL: %u\n"
3303 "PROF_COMPUTE_TX_TIME: %u\n",
3304 PROF_CPU_IDLE,
3305 PROF_PPDU_PROC,
3306 PROF_PPDU_POST,
3307 PROF_HTT_TX_INPUT,
3308 PROF_MSDU_ENQ,
3309 PROF_PPDU_POST_HAL,
3310 PROF_COMPUTE_TX_TIME);
3311
3312 *length = len + 1;
3313}
Mohit Khannac9649652018-11-28 18:10:28 -08003314
3315#define HDD_DUMP_STAT_HELP(STAT_ID) \
3316 hdd_nofl_info("%u -- %s", STAT_ID, (# STAT_ID))
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003317/**
3318 * hdd_display_stats_help() - print statistics help
3319 *
3320 * Return: none
3321 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003322static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003323{
Nirav Shahe6194ac2018-07-13 11:04:41 +05303324 hdd_nofl_info("iwpriv wlan0 dumpStats [option] - dump statistics");
3325 hdd_nofl_info("iwpriv wlan0 clearStats [option] - clear statistics");
3326 hdd_nofl_info("options:");
Mohit Khannac9649652018-11-28 18:10:28 -08003327 HDD_DUMP_STAT_HELP(CDP_TXRX_PATH_STATS);
3328 HDD_DUMP_STAT_HELP(CDP_TXRX_HIST_STATS);
3329 HDD_DUMP_STAT_HELP(CDP_TXRX_TSO_STATS);
3330 HDD_DUMP_STAT_HELP(CDP_HDD_NETIF_OPER_HISTORY);
3331 HDD_DUMP_STAT_HELP(CDP_DUMP_TX_FLOW_POOL_INFO);
3332 HDD_DUMP_STAT_HELP(CDP_TXRX_DESC_STATS);
3333 HDD_DUMP_STAT_HELP(CDP_HIF_STATS);
3334 HDD_DUMP_STAT_HELP(CDP_NAPI_STATS);
3335 HDD_DUMP_STAT_HELP(CDP_DP_NAPI_STATS);
3336 HDD_DUMP_STAT_HELP(CDP_DP_RX_THREAD_STATS);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003337}
Govind Singha471e5e2015-10-12 17:11:14 +05303338
3339/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003340 * hdd_wlan_dump_stats() - display dump Stats
3341 * @adapter: adapter handle
3342 * @value: value from user
3343 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003344 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003345 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003346int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003347{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003348 int ret = 0;
3349 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003350 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003351
Jeff Johnson0e07ca12018-11-12 21:04:45 -08003352 hdd_debug("%d", value);
3353
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003354 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003355 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003356 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3357 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003358 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003359 wlan_hdd_display_netif_queue_history
3360 (hdd_ctx,
3361 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003362 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003363 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303364 hdd_display_hif_stats();
3365 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003366 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003367 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303368 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003369 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003370 if (hdd_display_napi_stats()) {
3371 hdd_err("error displaying napi stats");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303372 ret = -EFAULT;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003373 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003374 break;
Mohit Khannac9649652018-11-28 18:10:28 -08003375 case CDP_DP_RX_THREAD_STATS:
3376 dp_txrx_ext_dump_stats(cds_get_context(QDF_MODULE_ID_SOC),
3377 CDP_DP_RX_THREAD_STATS);
3378 break;
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303379 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003380 sme_display_disconnect_stats(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003381 adapter->vdev_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303382 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003383 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003384 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003385 value,
3386 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003387 if (status == QDF_STATUS_E_INVAL) {
3388 hdd_display_stats_help();
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303389 ret = -EINVAL;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003390 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003391 break;
3392 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003393 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003394}
3395
3396/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003397 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003398 * @adapter: Adapter upon which the IBSS client is active
Jeff Johnson0a082d92019-03-04 12:25:49 -08003399 * @sta_id: Station index of the IBSS peer
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003400 *
3401 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3402 * otherwise an appropriate QDF_STATUS_E_* failure code.
3403 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003404static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnson0a082d92019-03-04 12:25:49 -08003405 uint8_t sta_id)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003406{
3407 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003408 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnson93107ad2019-02-26 08:14:46 -08003409 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson52f19d52019-02-26 08:35:38 -08003410 tSirPeerInfoRspParams *peer_info = &sta_ctx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003411
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003412 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003413 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003414 hdd_get_ibss_peer_info_cb,
Jeff Johnson0a082d92019-03-04 12:25:49 -08003415 false, sta_id);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003416
3417 if (QDF_STATUS_SUCCESS == status) {
3418 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003419
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003420 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003421 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003422 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3423 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003424 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003425 return QDF_STATUS_E_FAILURE;
3426 }
3427
3428 /** Print the peer info */
Jeff Johnson52f19d52019-02-26 08:35:38 -08003429 hdd_debug("peer_info->numIBSSPeers = %d ", peer_info->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003430 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003431 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
Jeff Johnson52f19d52019-02-26 08:35:38 -08003432 uint32_t tx_rate = peer_info->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003433
Jeff Johnson52f19d52019-02-26 08:35:38 -08003434 qdf_mem_copy(mac_addr, peer_info->peerInfoParams[0].
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003435 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003436 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003437 mac_addr, (int)tx_rate,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003438 (int)peer_info->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003439 }
3440 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003441 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003442 }
3443
3444 return status;
3445}
3446
3447/**
3448 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003449 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003450 *
3451 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3452 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3453 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003454static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003455{
3456 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003457 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnson93107ad2019-02-26 08:14:46 -08003458 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson52f19d52019-02-26 08:35:38 -08003459 tSirPeerInfoRspParams *peer_info = &sta_ctx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003460 int i;
3461
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003462 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003463 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003464 hdd_get_ibss_peer_info_cb,
3465 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003466
3467 if (QDF_STATUS_SUCCESS == status) {
3468 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003469
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003470 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003471 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003472 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3473 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003474 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003475 return QDF_STATUS_E_FAILURE;
3476 }
3477
3478 /** Print the peer info */
Jeff Johnson52f19d52019-02-26 08:35:38 -08003479 hdd_debug("peer_info->numIBSSPeers = %d ",
3480 (int)peer_info->numPeers);
3481 for (i = 0; i < peer_info->numPeers; i++) {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003482 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3483 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003484
Jeff Johnson52f19d52019-02-26 08:35:38 -08003485 tx_rate = peer_info->peerInfoParams[i].txRate;
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003486 qdf_mem_copy(mac_addr,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003487 peer_info->peerInfoParams[i].mac_addr,
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003488 sizeof(mac_addr));
3489
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003490 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003491 mac_addr, (int)tx_rate,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003492 (int)peer_info->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003493 }
3494 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003495 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003496 }
3497
3498 return status;
3499}
3500
3501/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303502 * hdd_get_ldpc() - Get adapter LDPC
3503 * @adapter: adapter being queried
3504 * @value: where to store the value
3505 *
3506 * Return: 0 on success, negative errno on failure
3507 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003508int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303509{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003510 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303511 int ret;
3512
Dustin Brown491d54b2018-03-14 12:39:11 -07003513 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003514 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303515 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3516 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003517 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303518 } else {
3519 *value = ret;
3520 ret = 0;
3521 }
3522 return ret;
3523}
3524
Jeff Johnson3d278b02017-08-29 14:17:47 -07003525int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303526{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003527 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303528 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003529 QDF_STATUS status;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003530 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303531 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303532
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003533 hdd_debug("%d", value);
Jeff Johnson1ca04762018-10-25 10:24:39 -07003534
3535 if (!mac_handle) {
3536 hdd_err("NULL Mac handle");
3537 return -EINVAL;
3538 }
3539
Dustin Brown05d81302018-09-11 16:49:22 -07003540 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003541 if (QDF_STATUS_SUCCESS != status) {
3542 hdd_err("Failed to get HT capability info");
3543 return -EIO;
3544 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003545
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303546 ht_cap_info.adv_coding_cap = value;
Dustin Brown05d81302018-09-11 16:49:22 -07003547 status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003548 if (QDF_STATUS_SUCCESS != status) {
3549 hdd_err("Failed to set HT capability info");
3550 return -EIO;
3551 }
Vignesh Viswanathanecd4de72018-11-22 13:02:20 +05303552 status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303553 if (QDF_IS_STATUS_ERROR(status)) {
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003554 hdd_err("Failed to set VHT LDPC capability info");
3555 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303556 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003557 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303558 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
3559 value);
3560 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003561 hdd_err("Failed to set LDPC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003562 ret = sme_update_he_ldpc_supp(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003563 if (ret)
3564 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303565
3566 return ret;
3567}
3568
3569/**
3570 * hdd_get_tx_stbc() - Get adapter TX STBC
3571 * @adapter: adapter being queried
3572 * @value: where to store the value
3573 *
3574 * Return: 0 on success, negative errno on failure
3575 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003576int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303577{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003578 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303579 int ret;
3580
Dustin Brown491d54b2018-03-14 12:39:11 -07003581 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003582 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303583 WNI_CFG_HT_CAP_INFO_TX_STBC);
3584 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003585 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303586 } else {
3587 *value = ret;
3588 ret = 0;
3589 }
3590
3591 return ret;
3592}
3593
Jeff Johnson3d278b02017-08-29 14:17:47 -07003594int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303595{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003596 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303597 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303598 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303599 QDF_STATUS status;
3600 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303601
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003602 hdd_debug("%d", value);
Jeff Johnson57ff4fa2018-10-25 10:29:47 -07003603
3604 if (!mac_handle) {
3605 hdd_err("NULL Mac handle");
3606 return -EINVAL;
3607 }
3608
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303609 if (value) {
3610 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003611 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303612 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303613 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003614 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303615 return -EIO;
3616 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303617 if (!ht_cap_info.tx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003618 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303619 return -EINVAL;
3620 }
3621 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003622 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303623 WNI_CFG_HT_CAP_INFO_TX_STBC,
3624 value);
3625 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003626 hdd_err("Failed to set TX STBC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003627 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003628 if (ret)
3629 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303630
3631 return ret;
3632}
3633
3634/**
3635 * hdd_get_rx_stbc() - Get adapter RX STBC
3636 * @adapter: adapter being queried
3637 * @value: where to store the value
3638 *
3639 * Return: 0 on success, negative errno on failure
3640 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003641int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303642{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003643 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303644 int ret;
3645
Dustin Brown491d54b2018-03-14 12:39:11 -07003646 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003647 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303648 WNI_CFG_HT_CAP_INFO_RX_STBC);
3649 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003650 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303651 } else {
3652 *value = ret;
3653 ret = 0;
3654 }
3655
3656 return ret;
3657}
3658
Jeff Johnson3d278b02017-08-29 14:17:47 -07003659int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303660{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003661 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303662 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303663 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303664 QDF_STATUS status;
3665 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303666
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003667 hdd_debug("%d", value);
Jeff Johnsonb6645852018-10-25 10:35:41 -07003668
3669 if (!mac_handle) {
3670 hdd_err("NULL Mac handle");
3671 return -EINVAL;
3672 }
3673
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303674 if (value) {
3675 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003676 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303677 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303678 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003679 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303680 return -EIO;
3681 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303682 if (!ht_cap_info.rx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003683 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303684 return -EINVAL;
3685 }
3686 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003687 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303688 WNI_CFG_HT_CAP_INFO_RX_STBC,
3689 value);
3690 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003691 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303692
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003693 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003694 if (ret)
3695 hdd_err("Failed to set HE RX STBC value");
3696
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303697 return ret;
3698}
3699
3700/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003701 * iw_get_linkspeed() - Get current link speed ioctl
3702 * @dev: device upon which the ioctl was received
3703 * @info: ioctl request information
3704 * @wrqu: ioctl request data
3705 * @extra: extra ioctl buffer
3706 *
3707 * Return: 0 on success, non-zero on error
3708 */
3709static int __iw_get_linkspeed(struct net_device *dev,
3710 struct iw_request_info *info,
3711 union iwreq_data *wrqu, char *extra)
3712{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003713 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson21451ae2019-03-10 21:54:04 -07003714 char *out_link_speed = (char *)extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003715 int len = sizeof(uint32_t) + 1;
3716 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003717 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003718 int ret;
3719 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003720
Dustin Brownfdf17c12018-03-14 12:55:34 -07003721 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303722
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003723 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003724 ret = wlan_hdd_validate_context(hdd_ctx);
3725 if (0 != ret)
3726 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003727
Jeff Johnson441e1f72017-02-07 08:50:49 -08003728 ret = hdd_check_private_wext_control(hdd_ctx, info);
3729 if (0 != ret)
3730 return ret;
3731
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003732 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003733 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003734 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003735
3736 wrqu->data.length = len;
3737 /* return the linkspeed as a string */
Jeff Johnson21451ae2019-03-10 21:54:04 -07003738 rc = snprintf(out_link_speed, len, "%u", link_speed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003739 if ((rc < 0) || (rc >= len)) {
3740 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003741 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003742 return -EIO;
3743 }
3744
Dustin Browne74003f2018-03-14 12:51:58 -07003745 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003746 /* a value is being successfully returned */
3747 return 0;
3748}
3749
3750static int iw_get_linkspeed(struct net_device *dev,
3751 struct iw_request_info *info,
3752 union iwreq_data *wrqu, char *extra)
3753{
Dustin Brown389e5072018-11-08 17:10:01 +05303754 int errno;
3755 struct osif_vdev_sync *vdev_sync;
3756
3757 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
3758 if (errno)
3759 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003760
Dustin Brown389e5072018-11-08 17:10:01 +05303761 errno = __iw_get_linkspeed(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003762
Dustin Brown389e5072018-11-08 17:10:01 +05303763 osif_vdev_sync_op_stop(vdev_sync);
3764
3765 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003766}
3767
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003768#ifdef FEATURE_WLM_STATS
3769static void wlan_get_wlm_stats_cb(void *cookie, const char *data)
3770{
3771 struct osif_request *request;
3772 char *priv;
3773
3774 request = osif_request_get(cookie);
3775 if (!request) {
3776 hdd_err("Obsolete request");
3777 return;
3778 }
3779 priv = osif_request_priv(request);
3780 strlcpy(priv, data, WE_MAX_STR_LEN);
3781 osif_request_complete(request);
3782 osif_request_put(request);
3783}
3784
3785static int wlan_get_wlm_stats(struct hdd_adapter *adapter, uint32_t bitmask,
3786 char *response)
3787{
3788 struct osif_request *request;
3789 void *cookie;
3790 int errno;
3791 char *priv;
3792 static const struct osif_request_params params = {
3793 .priv_size = WE_MAX_STR_LEN,
3794 .timeout_ms = 2000,
3795 };
3796
3797 if (!adapter) {
3798 hdd_err("NULL argument");
3799 return -EINVAL;
3800 }
3801 request = osif_request_alloc(&params);
3802 if (!request) {
3803 hdd_err("Request allocation failure");
3804 return -ENOMEM;
3805 }
3806 cookie = osif_request_cookie(request);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003807 errno = wma_wlm_stats_req(adapter->vdev_id, bitmask,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003808 params.priv_size,
3809 wlan_get_wlm_stats_cb, cookie);
3810 if (errno) {
3811 hdd_err("Request failed be sent, %d", errno);
3812 goto cleanup;
3813 }
3814 errno = osif_request_wait_for_response(request);
3815 if (errno) {
3816 hdd_err("Timeout happened, can't complete the req");
3817 goto cleanup;
3818 }
3819 priv = osif_request_priv(request);
3820 strlcpy(response, priv, params.priv_size);
3821
3822cleanup:
3823 osif_request_put(request);
3824
3825 return errno;
3826}
3827
3828/*
3829 * Due to a limitation in iwpriv the "get_wlm_stats" ioctl is defined
3830 * to take as input a variable-length string as opposed to taking a
3831 * single integer "bitmask" value. Hence we must have a buffer large
3832 * enough to hold a string representing the largest possible
3833 * value. MAX_INT = 2,147,483,647 which can be fit in 10 chars.
3834 * Round up to 12 to hold the trailing NUL and be a multiple of 4.
3835 */
3836#define WLM_USER_DATA_SIZE 12
3837
3838static int __iw_get_wlm_stats(struct net_device *dev,
3839 struct iw_request_info *info,
3840 union iwreq_data *wrqu, char *extra)
3841{
3842 struct iw_point priv_data;
3843 char user_data[WLM_USER_DATA_SIZE] = {0};
3844 uint32_t bitmask = 0;
3845 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
3846 struct hdd_context *hdd_ctx;
3847 int errno;
3848
3849 hdd_enter_dev(dev);
3850
3851 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3852 errno = wlan_hdd_validate_context(hdd_ctx);
3853 if (errno)
3854 return errno;
3855
3856 if (!capable(CAP_NET_ADMIN)) {
3857 hdd_err("permission check failed");
3858 return -EPERM;
3859 }
3860
3861 /*
3862 * Since this is GETTER iwpriv ioctl, driver needs to
3863 * copy SET data from user space to kernel space.
3864 * Helper function to get iwreq_data with compat handling.
3865 */
3866 if (hdd_priv_get_data(&priv_data, wrqu))
3867 return -EINVAL;
3868
3869 /*
3870 * priv_data.pointer should be pointing to data given
3871 * to iwpriv command.
3872 *
3873 * For example "iwpriv wlan0 get_wlm_stats 1234"
3874 *
3875 * priv_data.pointer should be pointing to "1234"
3876 * priv_data.length should be zero as this GETTER iwpriv ioctl
3877 */
3878 if (!priv_data.pointer) {
3879 hdd_err("NULL data pointer");
3880 return -EINVAL;
3881 }
3882
3883 /*
3884 * ideally driver should have used priv_data.length to copy
3885 * data from priv_data.pointer but this iwpriv IOCTL has been
3886 * declared as GETTER in nature which makes length field zero
3887 * for input arguments but priv_data.pointer still points to
3888 * user's input argument (just doesn't pass the length of the
3889 * argument)
3890 */
3891 if (copy_from_user(user_data, priv_data.pointer,
3892 sizeof(user_data) - 1)) {
3893 hdd_err("failed to copy data from user buffer");
3894 return -EFAULT;
3895 }
3896
3897 /*
3898 * user data is given in ascii, convert ascii to integer
3899 */
3900 if (kstrtou32(user_data, 0, &bitmask)) {
3901 hdd_err("failed to parse input %s", user_data);
3902 return -EFAULT;
3903 }
3904
3905 if (wlan_get_wlm_stats(adapter, bitmask, extra)) {
3906 hdd_err("returning failure");
3907 return -EFAULT;
3908 }
3909 wrqu->data.length = strlen(extra) + 1;
3910
3911 return 0;
3912}
3913
Dustin Brown96b98dd2019-03-06 12:39:37 -08003914static int iw_get_wlm_stats(struct net_device *net_dev,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003915 struct iw_request_info *info,
3916 union iwreq_data *wrqu, char *extra)
3917{
Dustin Brown96b98dd2019-03-06 12:39:37 -08003918 struct osif_vdev_sync *vdev_sync;
3919 int errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003920
Dustin Brown96b98dd2019-03-06 12:39:37 -08003921 errno = osif_vdev_sync_op_start(net_dev, &vdev_sync);
3922 if (errno)
3923 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003924
Dustin Brown96b98dd2019-03-06 12:39:37 -08003925 errno = __iw_get_wlm_stats(net_dev, info, wrqu, extra);
3926
3927 osif_vdev_sync_op_stop(vdev_sync);
3928
3929 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003930}
3931#endif /* FEATURE_WLM_STATS */
3932
Jeff Johnsonc1713242018-10-23 13:45:42 -07003933int wlan_hdd_update_phymode(struct hdd_adapter *adapter, int new_phymode)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003934{
Jeff Johnsonc1713242018-10-23 13:45:42 -07003935 struct net_device *net = adapter->dev;
3936 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
3937 mac_handle_t mac_handle = phddctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003938 bool band_24 = false, band_5g = false;
3939 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08003940 struct sme_config_params *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003941 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303942 uint8_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003943 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07003944 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003945 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303946 int retval = 0;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303947 uint8_t band_capability;
3948 QDF_STATUS status;
Wu Gaoed616a12019-01-16 15:19:21 +08003949 uint32_t channel_bonding_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003950
Jeff Johnsonc1713242018-10-23 13:45:42 -07003951 if (!mac_handle)
3952 return -EINVAL;
3953
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003954 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003955
Wu Gaoed616a12019-01-16 15:19:21 +08003956 ucfg_mlme_get_channel_bonding_24ghz(phddctx->psoc,
3957 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003958 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003959 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003960 ch_bond24 = true;
3961
Wu Gaoed616a12019-01-16 15:19:21 +08003962 ucfg_mlme_get_channel_bonding_5ghz(phddctx->psoc,
3963 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003964 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003965 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003966 ch_bond5g = true;
3967
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303968 status = wlan_mlme_get_band_capability(phddctx->psoc, &band_capability);
3969 if (QDF_IS_STATUS_ERROR(status)) {
3970 hdd_err("Failed to get MLME Band capability");
3971 return -EIO;
3972 }
3973
3974 if (band_capability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003975 band_24 = band_5g = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303976 else if (band_capability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003977 band_24 = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303978 else if (band_capability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003979 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003980
Jeff Johnsonc1713242018-10-23 13:45:42 -07003981 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc, &vhtchanwidth);
3982 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003983 hdd_err("Failed to get channel_width");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303984
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003985 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 -08003986 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3987
3988 switch (new_phymode) {
3989 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003990 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003991 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003992 phymode = eCSR_DOT11_MODE_AUTO;
3993 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3994 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003995 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003996 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3997 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003998 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003999 return -EIO;
4000 }
4001 break;
4002 case IEEE80211_MODE_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004003 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004004 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004005 phymode = eCSR_DOT11_MODE_11a;
4006 hdd_dot11mode = eHDD_DOT11_MODE_11a;
4007 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004008 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004009 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004010 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004011 return -EIO;
4012 }
4013 break;
4014 case IEEE80211_MODE_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004015 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004016 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004017 phymode = eCSR_DOT11_MODE_11b;
4018 hdd_dot11mode = eHDD_DOT11_MODE_11b;
4019 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004020 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004021 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004022 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004023 return -EIO;
4024 }
4025 break;
4026 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004027 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004028 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004029 phymode = eCSR_DOT11_MODE_11g;
4030 hdd_dot11mode = eHDD_DOT11_MODE_11g;
4031 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004032 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004033 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004034 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004035 return -EIO;
4036 }
4037 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07004038 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004039 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
4040 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
4041 */
4042 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004043 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004044 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004045 phymode = eCSR_DOT11_MODE_11n;
4046 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4047 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004048 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004049 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004050 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004051 return -EIO;
4052 }
4053 break;
4054 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004055 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004056 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004057 phymode = eCSR_DOT11_MODE_11n;
4058 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4059 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004060 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004061 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004062 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004063 return -EIO;
4064 }
4065 break;
4066 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004067 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004068 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004069 phymode = eCSR_DOT11_MODE_11n;
4070 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4071 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004072 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004073 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004074 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004075 return -EIO;
4076 }
4077 break;
4078 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004079 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004080 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004081 phymode = eCSR_DOT11_MODE_11n;
4082 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4083 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004084 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004085 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004086 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004087 return -EIO;
4088 }
4089 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004090 case IEEE80211_MODE_11AC_VHT20:
4091 case IEEE80211_MODE_11AC_VHT40:
4092 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004093 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07004094 phymode = eCSR_DOT11_MODE_11ac;
4095 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
4096 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
4097 if (band_5g && band_24) {
4098 curr_band = BAND_ALL;
4099 break;
4100 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004101 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07004102 break;
4103 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
4104 curr_band = BAND_2G;
4105 break;
4106 }
4107 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
4108 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004109 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004110 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004111 return -EIO;
4112 }
4113 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004114 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004115 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004116 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004117 phymode = eCSR_DOT11_MODE_AUTO;
4118 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4119 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004120 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004121 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004122 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004123 return -EIO;
4124 }
4125 break;
4126 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004127 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004128 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004129 phymode = eCSR_DOT11_MODE_AUTO;
4130 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4131 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
4132 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004133 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004134 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004135 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004136 return -EIO;
4137 }
4138 break;
4139 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004140 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004141 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004142 phymode = eCSR_DOT11_MODE_11n;
4143 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4144 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004145 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004146 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004147 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004148 return -EIO;
4149 }
4150 break;
4151 default:
4152 return -EIO;
4153 }
4154
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004155 switch (new_phymode) {
4156 case IEEE80211_MODE_11AC_VHT20:
4157 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4158 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
4159 break;
4160 case IEEE80211_MODE_11AC_VHT40:
4161 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
4162 break;
4163 case IEEE80211_MODE_11AC_VHT80:
4164 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
4165 break;
4166 default:
Jeff Johnsonc1713242018-10-23 13:45:42 -07004167 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc,
4168 &vhtchanwidth);
4169 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07004170 hdd_err("Failed to get channel_width");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004171 break;
4172 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004173
4174 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304175 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4176 if (!sme_config) {
4177 hdd_err("Failed to allocate memory for sme_config");
4178 return -ENOMEM;
4179 }
4180 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004181 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304182 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004183#ifdef QCA_HT_2040_COEX
4184 if (phymode == eCSR_DOT11_MODE_11n &&
4185 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304186 sme_config->csrConfig.obssEnabled = false;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004187 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004188 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004189 eHT_CHAN_HT20, false);
4190 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004191 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304192 retval = -EIO;
4193 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004194 }
4195 } else if (phymode == eCSR_DOT11_MODE_11n &&
4196 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304197 sme_config->csrConfig.obssEnabled = true;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004198 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004199 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004200 eHT_CHAN_HT20, true);
4201 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004202 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304203 retval = -EIO;
4204 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004205 }
4206 }
4207#endif
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05304208 status = ucfg_mlme_set_band_capability(phddctx->psoc,
4209 curr_band);
4210 if (QDF_IS_STATUS_ERROR(status)) {
4211 hdd_err("failed to set MLME band capability");
4212 goto free;
4213 }
4214
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304215 if (curr_band == BAND_2G) {
4216 status = ucfg_mlme_set_11h_enabled(phddctx->psoc, 0);
4217 if (!QDF_IS_STATUS_SUCCESS(status)) {
4218 hdd_err("Failed to set 11h_enable flag");
4219 goto free;
4220 }
4221 }
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004222 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304223 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07004224 else if (curr_band == BAND_5G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304225 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004226 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304227 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
4228 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004229 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004230 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004231
4232 phddctx->config->dot11Mode = hdd_dot11mode;
Wu Gaoed616a12019-01-16 15:19:21 +08004233 ucfg_mlme_set_channel_bonding_24ghz(
4234 phddctx->psoc,
4235 sme_config->csrConfig.channelBondingMode24GHz);
4236 ucfg_mlme_set_channel_bonding_5ghz(
4237 phddctx->psoc,
4238 sme_config->csrConfig.channelBondingMode5GHz);
Krunal Sonidf0f8742016-09-26 14:56:31 -07004239 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004240 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304241 retval = -EIO;
4242 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004243 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304244
4245 if (band_5g) {
4246 struct ieee80211_supported_band *band;
4247
Wu Gaoed616a12019-01-16 15:19:21 +08004248 ucfg_mlme_get_channel_bonding_5ghz(
4249 phddctx->psoc, &channel_bonding_mode);
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304250 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
Wu Gaoed616a12019-01-16 15:19:21 +08004251 if (channel_bonding_mode)
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304252 band->ht_cap.cap |=
4253 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4254 else
4255 band->ht_cap.cap &=
4256 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4257 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004258
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004259 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004260 phymode, chwidth, curr_band, vhtchanwidth);
4261 }
4262
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304263free:
4264 if (sme_config)
4265 qdf_mem_free(sme_config);
4266 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004267}
4268
Jeff Johnson011c4502017-10-05 15:25:56 -07004269static int hdd_validate_pdev_reset(int value)
4270{
4271 if ((value < 1) || (value > 5)) {
4272 hdd_warn(" Invalid value %d: Use any one of the below values\n"
4273 " TX_FLUSH = 1\n"
4274 " WARM_RESET = 2\n"
4275 " COLD_RESET = 3\n"
4276 " WARM_RESET_RESTORE_CAL = 4\n"
4277 " COLD_RESET_RESTORE_CAL = 5", value);
4278
4279 return -EINVAL;
4280 }
4281
4282 return 0;
4283}
4284
4285static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
4286{
4287 int ret;
4288
4289 hdd_debug("%d", value);
4290
4291 ret = hdd_validate_pdev_reset(value);
4292 if (ret)
4293 return ret;
4294
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004295 ret = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07004296 WMI_PDEV_PARAM_PDEV_RESET,
4297 value, PDEV_CMD);
4298
4299 return ret;
4300}
4301
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004302static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
4303{
4304 int errno;
4305 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004306 uint32_t bonding_mode;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08004307 struct sme_config_params *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004308 mac_handle_t mac_handle;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004309
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004310 mac_handle = hdd_ctx->mac_handle;
4311 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004312 return -EINVAL;
4313
4314 /* updating channel bonding only on 5Ghz */
4315 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4316
4317 switch (ch_width) {
4318 case eHT_CHANNEL_WIDTH_20MHZ:
4319 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4320 break;
4321
4322 case eHT_CHANNEL_WIDTH_40MHZ:
4323 case eHT_CHANNEL_WIDTH_80MHZ:
Kiran Kumar Lokere9df090b2019-02-07 18:48:22 -08004324 bonding_mode = 1;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004325 break;
4326
4327 default:
4328 hdd_err("Invalid channel width 0->20 1->40 2->80");
4329 return -EINVAL;
4330 }
4331
4332 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4333 if (!sme_config) {
4334 hdd_err("failed to allocate memory for sme_config");
4335 return -ENOMEM;
4336 }
4337
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004338 errno = wma_cli_set_command(adapter->vdev_id, WMI_VDEV_PARAM_CHWIDTH,
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004339 ch_width, VDEV_CMD);
4340 if (errno)
4341 goto free_config;
4342
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004343 sme_get_config_param(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004344 sme_config->csrConfig.channelBondingMode5GHz = bonding_mode;
Kiran Kumar Lokere9df090b2019-02-07 18:48:22 -08004345 sme_config->csrConfig.channelBondingMode24GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004346 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004347
4348free_config:
4349 qdf_mem_free(sme_config);
4350
4351 return errno;
4352}
4353
Jeff Johnsondeab8572018-11-13 15:29:53 -08004354static int hdd_we_set_11d_state(struct hdd_adapter *adapter, int state_11d)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004355{
Jeff Johnsondeab8572018-11-13 15:29:53 -08004356 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004357 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004358 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304359 QDF_STATUS status;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004360
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004361 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004362 return -EINVAL;
4363
4364 switch (state_11d) {
4365 case ENABLE_11D:
4366 enable_11d = true;
4367 break;
4368 case DISABLE_11D:
4369 enable_11d = false;
4370 break;
4371 default:
4372 return -EINVAL;
4373 }
4374
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304375 status = ucfg_mlme_set_11d_enabled(hdd_ctx->psoc, enable_11d);
4376 if (!QDF_IS_STATUS_SUCCESS(status))
4377 hdd_err("Invalid 11d_enable flag");
Dustin Brownd90f61a2018-04-26 12:25:58 -07004378
Dustin Brownea82d562018-05-23 12:07:16 -07004379 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004380
4381 return 0;
4382}
4383
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004384static int hdd_we_set_power(struct hdd_adapter *adapter, int value)
4385{
4386 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4387 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4388
4389 if (!mac_handle)
4390 return -EINVAL;
4391
4392 switch (value) {
4393 case 1:
4394 /* Enable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004395 sme_save_usr_ps_cfg(mac_handle, true);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004396 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004397 SME_PS_ENABLE);
4398 return 0;
4399 case 2:
4400 /* Disable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004401 sme_save_usr_ps_cfg(mac_handle, false);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004402 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004403 SME_PS_DISABLE);
4404 return 0;
4405 case 3:
4406 /* Enable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004407 sme_ps_uapsd_enable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004408 return 0;
4409 case 4:
4410 /* Disable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004411 sme_ps_uapsd_disable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004412 return 0;
4413 default:
4414 hdd_err("Invalid value %d", value);
4415 return -EINVAL;
4416 }
4417}
4418
Jeff Johnsoneb4368a2018-10-19 13:02:52 -07004419static int hdd_we_set_max_assoc(struct hdd_adapter *adapter, int value)
4420{
4421 struct hdd_context *hdd_ctx;
4422 QDF_STATUS status;
4423
4424 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4425 status = ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, value);
4426 if (QDF_IS_STATUS_ERROR(status))
4427 hdd_err("cfg set failed, value %d status %d", value, status);
4428
4429 return qdf_status_to_os_return(status);
4430}
4431
Jeff Johnson693722c2018-10-19 13:11:16 -07004432static int hdd_we_set_data_inactivity_timeout(struct hdd_adapter *adapter,
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004433 int inactivity_timeout)
Jeff Johnson693722c2018-10-19 13:11:16 -07004434{
4435 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004436 QDF_STATUS status;
Jeff Johnson693722c2018-10-19 13:11:16 -07004437
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004438 status = ucfg_mlme_set_ps_data_inactivity_timeout(hdd_ctx->psoc,
4439 inactivity_timeout);
Jeff Johnson693722c2018-10-19 13:11:16 -07004440
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004441 return qdf_status_to_os_return(status);
Jeff Johnson693722c2018-10-19 13:11:16 -07004442}
4443
Jeff Johnson94511942018-10-19 13:15:22 -07004444static int hdd_we_set_wow_data_inactivity_timeout(struct hdd_adapter *adapter,
4445 int value)
4446{
4447 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4448 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Jeff Johnson94511942018-10-19 13:15:22 -07004449
4450 if (!mac_handle)
4451 return -EINVAL;
4452
Wu Gaoa796d712019-01-07 14:15:32 +08004453 if (!cfg_in_range(CFG_PMO_WOW_DATA_INACTIVITY_TIMEOUT, value)) {
Jeff Johnson94511942018-10-19 13:15:22 -07004454 hdd_err_rl("Invalid value %d", value);
4455 return -EINVAL;
4456 }
4457
Wu Gaoa796d712019-01-07 14:15:32 +08004458 ucfg_pmo_set_wow_data_inactivity_timeout(hdd_ctx->psoc, (uint8_t)value);
Jeff Johnson94511942018-10-19 13:15:22 -07004459
Wu Gaoa796d712019-01-07 14:15:32 +08004460 return 0;
Jeff Johnson94511942018-10-19 13:15:22 -07004461}
4462
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004463static int hdd_we_set_tx_power(struct hdd_adapter *adapter, int value)
4464{
4465 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4466 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4467 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4468 QDF_STATUS status;
4469
4470 if (!mac_handle)
4471 return -EINVAL;
4472
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004473 status = sme_set_tx_power(mac_handle, adapter->vdev_id,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004474 sta_ctx->conn_info.bssid,
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004475 adapter->device_mode, value);
4476
4477 if (QDF_IS_STATUS_ERROR(status))
4478 hdd_err("cfg set failed, value %d status %d", value, status);
4479
4480 return qdf_status_to_os_return(status);
4481}
4482
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004483static int hdd_we_set_max_tx_power(struct hdd_adapter *adapter, int value)
4484{
4485 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4486 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4487 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4488 QDF_STATUS status;
4489
4490 if (!mac_handle)
4491 return -EINVAL;
4492
4493 status = sme_set_max_tx_power(mac_handle,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004494 sta_ctx->conn_info.bssid,
4495 sta_ctx->conn_info.bssid,
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004496 value);
4497
4498 if (QDF_IS_STATUS_ERROR(status))
4499 hdd_err("cfg set failed, value %d status %d", value, status);
4500
4501 return qdf_status_to_os_return(status);
4502}
4503
Jeff Johnsonf3892b52018-10-23 11:32:04 -07004504static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power)
4505{
4506 QDF_STATUS status;
4507
4508 hdd_debug("power %d dBm", power);
4509 status = sme_set_max_tx_power_per_band(BAND_2G, power);
4510 if (QDF_IS_STATUS_ERROR(status))
4511 hdd_err("cfg set failed, value %d status %d", power, status);
4512
4513 return qdf_status_to_os_return(status);
4514}
4515
Jeff Johnson175004c2018-10-23 12:03:16 -07004516static int hdd_we_set_max_tx_power_5_0(struct hdd_adapter *adapter, int power)
4517{
4518 QDF_STATUS status;
4519
4520 hdd_debug("power %d dBm", power);
4521 status = sme_set_max_tx_power_per_band(BAND_5G, power);
4522 if (QDF_IS_STATUS_ERROR(status))
4523 hdd_err("cfg set failed, value %d status %d", power, status);
4524
4525 return qdf_status_to_os_return(status);
4526}
4527
Jeff Johnson0187c622019-01-04 06:39:44 -08004528#ifdef HASTINGS_BT_WAR
4529
4530/*
4531 * replicate logic:
4532 * iwpriv wlan0 setUnitTestCmd 19 2 23 1 => enable WAR
4533 * iwpriv wlan0 setUnitTestCmd 19 2 23 0 => disable WAR
4534 */
4535
4536#define HASTINGS_WAR_FW_PARAM_ID 23
4537
4538static int hdd_hastings_bt_war_set_fw(struct hdd_context *hdd_ctx,
4539 uint32_t value)
4540{
4541 uint32_t vdev_id = 0; /* not used */
4542 uint32_t module_id = WLAN_MODULE_WAL;
4543 uint32_t arg_count = 2;
4544 uint32_t arg[2] = {HASTINGS_WAR_FW_PARAM_ID, value};
4545 QDF_STATUS status;
4546
4547 status = wma_form_unit_test_cmd_and_send(vdev_id, module_id,
4548 arg_count, arg);
4549
4550 return qdf_status_to_os_return(status);
4551}
4552
4553int hdd_hastings_bt_war_enable_fw(struct hdd_context *hdd_ctx)
4554{
4555 return hdd_hastings_bt_war_set_fw(hdd_ctx, 1);
4556}
4557
4558int hdd_hastings_bt_war_disable_fw(struct hdd_context *hdd_ctx)
4559{
4560 return hdd_hastings_bt_war_set_fw(hdd_ctx, 0);
4561}
4562
4563/* value to restore the config when the WAR is disabled */
4564static uint32_t iface_change_wait_time_checkpoint;
4565static void checkpoint_iface_change_wait_time(struct hdd_context *hdd_ctx)
4566{
4567 struct hdd_config *config = hdd_ctx->config;
4568
4569 /* did we already checkpoint a value ? */
4570 if (iface_change_wait_time_checkpoint)
4571 return;
4572
4573 /* checkpoint current value */
4574 iface_change_wait_time_checkpoint = config->iface_change_wait_time;
4575
4576 /* was the timer enabled when we checkpointed? */
4577 if (iface_change_wait_time_checkpoint)
4578 return;
4579
4580 /* WAR was enabled at boot, use default when disable */
4581 iface_change_wait_time_checkpoint =
4582 cfg_default(CFG_INTERFACE_CHANGE_WAIT);
4583}
4584
4585static int hdd_hastings_war_enable(struct hdd_context *hdd_ctx)
4586{
4587 struct hdd_config *config = hdd_ctx->config;
4588
4589 config->iface_change_wait_time = 0;
4590
4591 return hdd_hastings_bt_war_enable_fw(hdd_ctx);
4592}
4593
4594static int hdd_hastings_war_disable(struct hdd_context *hdd_ctx)
4595{
4596 struct hdd_config *config = hdd_ctx->config;
4597
4598 config->iface_change_wait_time = iface_change_wait_time_checkpoint;
4599
4600 return hdd_hastings_bt_war_disable_fw(hdd_ctx);
4601}
4602
4603static int hdd_we_set_hastings_bt_war(struct hdd_adapter *adapter, int enable)
4604{
4605 int errno;
4606 struct hdd_context *hdd_ctx;
4607
4608 errno = hdd_validate_adapter(adapter);
4609 if (errno)
4610 return errno;
4611
4612 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4613 checkpoint_iface_change_wait_time(hdd_ctx);
4614
4615 return enable ?
4616 hdd_hastings_war_enable(hdd_ctx) :
4617 hdd_hastings_war_disable(hdd_ctx);
4618}
4619#endif
4620
Jeff Johnson5bee39b2018-10-23 12:34:38 -07004621static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level)
4622{
4623 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4624 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4625 QDF_STATUS status;
4626
4627 if (!mac_handle)
4628 return -EINVAL;
4629
4630 hdd_debug("Thermal Mitigation Level %d", level);
4631 status = sme_set_thermal_level(mac_handle, level);
4632 if (QDF_IS_STATUS_ERROR(status))
4633 hdd_err("cfg set failed, value %d status %d", level, status);
4634
4635 return qdf_status_to_os_return(status);
4636}
4637
Jeff Johnson38912642018-10-24 15:01:40 -07004638static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss)
4639{
4640 QDF_STATUS status;
4641
4642 hdd_debug("NSS %d", nss);
4643
4644 if ((nss > 2) || (nss <= 0)) {
4645 hdd_err("Invalid NSS: %d", nss);
4646 return -EINVAL;
4647 }
4648
4649 status = hdd_update_nss(adapter, nss);
4650 if (QDF_IS_STATUS_ERROR(status))
4651 hdd_err("cfg set failed, value %d status %d", nss, status);
4652
4653 return qdf_status_to_os_return(status);
4654}
4655
Jeff Johnsonce996b32018-10-25 10:52:40 -07004656static int hdd_we_set_short_gi(struct hdd_adapter *adapter, int sgi)
4657{
4658 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
4659 int errno;
4660
4661 hdd_debug("Short GI %d", sgi);
4662
4663 if (!mac_handle) {
4664 hdd_err("NULL Mac handle");
4665 return -EINVAL;
4666 }
4667
4668 if (sgi & HDD_AUTO_RATE_SGI)
4669 errno = sme_set_auto_rate_he_sgi(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004670 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004671 sgi);
4672 else
4673 errno = sme_update_ht_config(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004674 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004675 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4676 sgi);
4677 if (errno)
4678 hdd_err("cfg set failed, value %d status %d", sgi, errno);
4679
4680 return errno;
4681}
4682
Jeff Johnson71d80382018-10-25 15:45:01 -07004683static int hdd_we_set_rtscts(struct hdd_adapter *adapter, int rtscts)
4684{
4685 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4686 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4687 uint32_t value;
4688 uint32_t rts_threshold_val;
4689 QDF_STATUS status;
4690 int errno;
4691
4692 hdd_debug("RTSCTS %d", rtscts);
4693
4694 if (!mac_handle) {
4695 hdd_err("NULL Mac handle");
4696 return -EINVAL;
4697 }
4698
4699 status = ucfg_mlme_get_rts_threshold(hdd_ctx->psoc,
4700 &rts_threshold_val);
4701 if (QDF_IS_STATUS_ERROR(status)) {
4702 hdd_err("Get rts threshold failed, status %d", status);
4703 return -EINVAL;
4704 }
4705
4706 if ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_RTSCTS_ENABLE) {
4707 value = rts_threshold_val;
4708 } else if (((rtscts & HDD_RTSCTS_EN_MASK) == 0) ||
4709 ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_CTS_ENABLE)) {
4710 value = cfg_max(CFG_RTS_THRESHOLD);
4711 } else {
4712 hdd_err_rl("Invalid value %d", rtscts);
4713 return -EINVAL;
4714 }
4715
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004716 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson71d80382018-10-25 15:45:01 -07004717 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4718 rtscts, VDEV_CMD);
4719 if (errno) {
4720 hdd_err("Failed to set firmware, errno %d", errno);
4721 return errno;
4722 }
4723
4724 status = ucfg_mlme_set_rts_threshold(hdd_ctx->psoc, value);
4725 if (QDF_IS_STATUS_ERROR(status)) {
4726 hdd_err("Set rts threshold failed, status %d", status);
4727 return -EINVAL;
4728 }
4729
4730 return 0;
4731}
4732
Jeff Johnson50b15882018-10-26 10:27:37 -07004733static int hdd_we_set_11n_rate(struct hdd_adapter *adapter, int rate_code)
4734{
4735 uint8_t preamble = 0, nss = 0, rix = 0;
4736 int errno;
4737
4738 hdd_debug("Rate code %d", rate_code);
4739
4740 if (rate_code != 0xff) {
4741 rix = RC_2_RATE_IDX(rate_code);
4742 if (rate_code & 0x80) {
4743 preamble = WMI_RATE_PREAMBLE_HT;
4744 nss = HT_RC_2_STREAMS(rate_code) - 1;
4745 } else {
4746 nss = 0;
4747 rix = RC_2_RATE_IDX(rate_code);
4748 if (rate_code & 0x10) {
4749 preamble = WMI_RATE_PREAMBLE_CCK;
4750 if (rix != 0x3)
4751 /* Enable Short preamble
4752 * always for CCK except 1mbps
4753 */
4754 rix |= 0x4;
4755 } else {
4756 preamble = WMI_RATE_PREAMBLE_OFDM;
4757 }
4758 }
4759 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4760 }
4761
4762 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4763 rate_code, rix, preamble, nss);
4764
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004765 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson50b15882018-10-26 10:27:37 -07004766 WMI_VDEV_PARAM_FIXED_RATE,
4767 rate_code, VDEV_CMD);
4768 if (errno)
4769 hdd_err("Failed to set firmware, errno %d", errno);
4770
4771 return errno;
4772}
4773
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004774static int hdd_we_set_vht_rate(struct hdd_adapter *adapter, int rate_code)
4775{
4776 uint8_t preamble = 0, nss = 0, rix = 0;
4777 int errno;
4778
4779 hdd_debug("Rate code %d", rate_code);
4780
4781 if (rate_code != 0xff) {
4782 rix = RC_2_RATE_IDX_11AC(rate_code);
4783 preamble = WMI_RATE_PREAMBLE_VHT;
4784 nss = HT_RC_2_STREAMS_11AC(rate_code) - 1;
4785 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4786 }
4787
4788 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4789 rate_code, rix, preamble, nss);
4790
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004791 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004792 WMI_VDEV_PARAM_FIXED_RATE,
4793 rate_code, VDEV_CMD);
4794 if (errno)
4795 hdd_err("Failed to set firmware, errno %d", errno);
4796
4797 return errno;
4798}
4799
Jeff Johnson7c433502018-11-12 15:00:52 -08004800static int hdd_we_set_ampdu(struct hdd_adapter *adapter, int ampdu)
4801{
4802 hdd_debug("AMPDU %d", ampdu);
4803
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004804 return wma_cli_set_command(adapter->vdev_id,
Jeff Johnson7c433502018-11-12 15:00:52 -08004805 GEN_VDEV_PARAM_AMPDU,
4806 ampdu, GEN_CMD);
4807}
4808
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004809static int hdd_we_set_amsdu(struct hdd_adapter *adapter, int amsdu)
4810{
4811 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4812 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4813 int errno;
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304814 QDF_STATUS status;
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004815
4816 hdd_debug("AMSDU %d", amsdu);
4817
4818 if (!mac_handle) {
4819 hdd_err("NULL Mac handle");
4820 return -EINVAL;
4821 }
4822
4823 if (amsdu > 1)
4824 sme_set_amsdu(mac_handle, true);
4825 else
4826 sme_set_amsdu(mac_handle, false);
4827
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004828 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004829 GEN_VDEV_PARAM_AMSDU,
4830 amsdu, GEN_CMD);
4831 if (errno) {
4832 hdd_err("Failed to set firmware, errno %d", errno);
4833 return errno;
4834 }
4835
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304836 status = ucfg_mlme_set_max_amsdu_num(hdd_ctx->psoc,
4837 amsdu);
4838 if (QDF_IS_STATUS_ERROR(status))
4839 hdd_err("Failed to set Max AMSDU Num to cfg");
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004840
4841 return 0;
4842}
4843
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004844static int hdd_we_clear_stats(struct hdd_adapter *adapter, int option)
4845{
4846 hdd_debug("option %d", option);
4847
4848 switch (option) {
4849 case CDP_HDD_STATS:
4850 memset(&adapter->stats, 0, sizeof(adapter->stats));
4851 memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
4852 break;
4853 case CDP_TXRX_HIST_STATS:
4854 wlan_hdd_clear_tx_rx_histogram(adapter->hdd_ctx);
4855 break;
4856 case CDP_HDD_NETIF_OPER_HISTORY:
4857 wlan_hdd_clear_netif_queue_history(adapter->hdd_ctx);
4858 break;
4859 case CDP_HIF_STATS:
4860 hdd_clear_hif_stats();
4861 break;
4862 case CDP_NAPI_STATS:
4863 hdd_clear_napi_stats();
4864 break;
4865 default:
4866 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4867 option);
4868 }
4869
4870 return 0;
4871}
4872
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004873static int hdd_we_set_green_tx_param(struct hdd_adapter *adapter,
4874 green_tx_param id,
4875 const char *id_string,
4876 int value)
4877{
4878 int errno;
4879
4880 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004881 errno = wma_cli_set_command(adapter->vdev_id, id, value, GTX_CMD);
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004882 if (errno)
4883 hdd_err("Failed to set firmware, errno %d", errno);
4884
4885 return errno;
4886}
4887
4888#define hdd_we_set_green_tx_param(adapter, id, value) \
4889 hdd_we_set_green_tx_param(adapter, id, #id, value)
4890
4891static int hdd_we_set_gtx_ht_mcs(struct hdd_adapter *adapter, int value)
4892{
4893 return hdd_we_set_green_tx_param(adapter,
4894 WMI_VDEV_PARAM_GTX_HT_MCS,
4895 value);
4896}
4897
4898static int hdd_we_set_gtx_vht_mcs(struct hdd_adapter *adapter, int value)
4899{
4900 return hdd_we_set_green_tx_param(adapter,
4901 WMI_VDEV_PARAM_GTX_VHT_MCS,
4902 value);
4903}
4904
4905static int hdd_we_set_gtx_usrcfg(struct hdd_adapter *adapter, int value)
4906{
4907 return hdd_we_set_green_tx_param(adapter,
4908 WMI_VDEV_PARAM_GTX_USR_CFG,
4909 value);
4910}
4911
4912static int hdd_we_set_gtx_thre(struct hdd_adapter *adapter, int value)
4913{
4914 return hdd_we_set_green_tx_param(adapter,
4915 WMI_VDEV_PARAM_GTX_THRE,
4916 value);
4917}
4918
4919static int hdd_we_set_gtx_margin(struct hdd_adapter *adapter, int value)
4920{
4921 return hdd_we_set_green_tx_param(adapter,
4922 WMI_VDEV_PARAM_GTX_MARGIN,
4923 value);
4924}
4925
4926static int hdd_we_set_gtx_step(struct hdd_adapter *adapter, int value)
4927{
4928 return hdd_we_set_green_tx_param(adapter,
4929 WMI_VDEV_PARAM_GTX_STEP,
4930 value);
4931}
4932
4933static int hdd_we_set_gtx_mintpc(struct hdd_adapter *adapter, int value)
4934{
4935 return hdd_we_set_green_tx_param(adapter,
4936 WMI_VDEV_PARAM_GTX_MINTPC,
4937 value);
4938}
4939
4940static int hdd_we_set_gtx_bwmask(struct hdd_adapter *adapter, int value)
4941{
4942 return hdd_we_set_green_tx_param(adapter,
4943 WMI_VDEV_PARAM_GTX_BW_MASK,
4944 value);
4945}
4946
Jeff Johnsond0477f22018-10-29 12:26:25 -07004947static int hdd_we_packet_power_save(struct hdd_adapter *adapter,
4948 packet_power_save id,
4949 const char *id_string,
4950 int value)
4951{
4952 int errno;
4953
4954 if (adapter->device_mode != QDF_STA_MODE) {
4955 hdd_err_rl("Not supported in mode %d", adapter->device_mode);
4956 return -EINVAL;
4957 }
4958
4959 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004960 errno = wma_cli_set_command(adapter->vdev_id, id, value, PPS_CMD);
Jeff Johnsond0477f22018-10-29 12:26:25 -07004961 if (errno)
4962 hdd_err("Failed to set firmware, errno %d", errno);
4963
4964 return errno;
4965}
4966
4967#define hdd_we_packet_power_save(adapter, id, value) \
4968 hdd_we_packet_power_save(adapter, id, #id, value)
4969
4970static int hdd_we_pps_paid_match(struct hdd_adapter *adapter, int value)
4971{
4972 return hdd_we_packet_power_save(adapter,
4973 WMI_VDEV_PPS_PAID_MATCH,
4974 value);
4975}
4976
4977static int hdd_we_pps_gid_match(struct hdd_adapter *adapter, int value)
4978{
4979 return hdd_we_packet_power_save(adapter,
4980 WMI_VDEV_PPS_GID_MATCH,
4981 value);
4982}
4983
4984static int hdd_we_pps_early_tim_clear(struct hdd_adapter *adapter, int value)
4985{
4986 return hdd_we_packet_power_save(adapter,
4987 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4988 value);
4989}
4990
4991static int hdd_we_pps_early_dtim_clear(struct hdd_adapter *adapter, int value)
4992{
4993 return hdd_we_packet_power_save(adapter,
4994 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4995 value);
4996}
4997
4998static int hdd_we_pps_eof_pad_delim(struct hdd_adapter *adapter, int value)
4999{
5000 return hdd_we_packet_power_save(adapter,
5001 WMI_VDEV_PPS_EOF_PAD_DELIM,
5002 value);
5003}
5004
5005static int hdd_we_pps_macaddr_mismatch(struct hdd_adapter *adapter, int value)
5006{
5007 return hdd_we_packet_power_save(adapter,
5008 WMI_VDEV_PPS_MACADDR_MISMATCH,
5009 value);
5010}
5011
5012static int hdd_we_pps_delim_crc_fail(struct hdd_adapter *adapter, int value)
5013{
5014 return hdd_we_packet_power_save(adapter,
5015 WMI_VDEV_PPS_DELIM_CRC_FAIL,
5016 value);
5017}
5018
5019static int hdd_we_pps_gid_nsts_zero(struct hdd_adapter *adapter, int value)
5020{
5021 return hdd_we_packet_power_save(adapter,
5022 WMI_VDEV_PPS_GID_NSTS_ZERO,
5023 value);
5024}
5025
5026static int hdd_we_pps_rssi_check(struct hdd_adapter *adapter, int value)
5027{
5028 return hdd_we_packet_power_save(adapter,
5029 WMI_VDEV_PPS_RSSI_CHECK,
5030 value);
5031}
5032
5033static int hdd_we_pps_5g_ebt(struct hdd_adapter *adapter, int value)
5034{
5035 return hdd_we_packet_power_save(adapter,
5036 WMI_VDEV_PPS_5G_EBT,
5037 value);
5038}
5039
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07005040static int hdd_we_set_qpower(struct hdd_adapter *adapter,
5041 enum wmi_sta_powersave_param id,
5042 const char *id_string,
5043 int value)
5044{
5045 int errno;
5046
5047 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005048 errno = wma_cli_set_command(adapter->vdev_id, id, value, QPOWER_CMD);
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07005049 if (errno)
5050 hdd_err("Failed to set firmware, errno %d", errno);
5051
5052 return errno;
5053}
5054
5055#define hdd_we_set_qpower(adapter, id, value) \
5056 hdd_we_set_qpower(adapter, id, #id, value)
5057
5058static int
5059hdd_we_set_qpower_max_pspoll_count(struct hdd_adapter *adapter, int value)
5060{
5061 enum wmi_sta_powersave_param id =
5062 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT;
5063
5064 return hdd_we_set_qpower(adapter, id, value);
5065}
5066
5067static int
5068hdd_we_set_qpower_max_tx_before_wake(struct hdd_adapter *adapter, int value)
5069{
5070 enum wmi_sta_powersave_param id =
5071 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE;
5072
5073 return hdd_we_set_qpower(adapter, id, value);
5074}
5075
5076static int
5077hdd_we_set_qpower_spec_pspoll_wake_interval(struct hdd_adapter *adapter,
5078 int value)
5079{
5080 enum wmi_sta_powersave_param id =
5081 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL;
5082
5083 return hdd_we_set_qpower(adapter, id, value);
5084}
5085
5086static int
5087hdd_we_set_qpower_spec_max_spec_nodata_pspoll(struct hdd_adapter *adapter,
5088 int value)
5089{
5090 enum wmi_sta_powersave_param id =
5091 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL;
5092
5093 return hdd_we_set_qpower(adapter, id, value);
5094}
5095
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005096static int hdd_we_set_pdev(struct hdd_adapter *adapter,
5097 WMI_PDEV_PARAM id,
5098 const char *id_string,
5099 int value)
5100{
5101 int errno;
5102
5103 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005104 errno = wma_cli_set_command(adapter->vdev_id, id, value, PDEV_CMD);
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005105 if (errno)
5106 hdd_err("Failed to set firmware, errno %d", errno);
5107
5108 return errno;
5109}
5110
5111#define hdd_we_set_pdev(adapter, id, value) \
5112 hdd_we_set_pdev(adapter, id, #id, value)
5113
5114static int hdd_we_set_ani_en_dis(struct hdd_adapter *adapter, int value)
5115{
5116 return hdd_we_set_pdev(adapter,
5117 WMI_PDEV_PARAM_ANI_ENABLE,
5118 value);
5119}
5120
5121static int hdd_we_set_ani_poll_period(struct hdd_adapter *adapter, int value)
5122{
5123 return hdd_we_set_pdev(adapter,
5124 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
5125 value);
5126}
5127
5128static int hdd_we_set_ani_listen_period(struct hdd_adapter *adapter, int value)
5129{
5130 return hdd_we_set_pdev(adapter,
5131 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
5132 value);
5133}
5134
5135static int hdd_we_set_ani_ofdm_level(struct hdd_adapter *adapter, int value)
5136{
5137 return hdd_we_set_pdev(adapter,
5138 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
5139 value);
5140}
5141
5142static int hdd_we_set_ani_cck_level(struct hdd_adapter *adapter, int value)
5143{
5144 return hdd_we_set_pdev(adapter,
5145 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
5146 value);
5147}
5148
5149static int hdd_we_set_dynamic_bw(struct hdd_adapter *adapter, int value)
5150{
5151 return hdd_we_set_pdev(adapter,
5152 WMI_PDEV_PARAM_DYNAMIC_BW,
5153 value);
5154}
5155
5156static int hdd_we_set_cts_cbw(struct hdd_adapter *adapter, int value)
5157{
5158 return hdd_we_set_pdev(adapter,
5159 WMI_PDEV_PARAM_CTS_CBW,
5160 value);
5161}
5162
5163static int hdd_we_set_tx_chainmask(struct hdd_adapter *adapter, int value)
5164{
5165 int errno;
5166
5167 errno = hdd_we_set_pdev(adapter,
5168 WMI_PDEV_PARAM_TX_CHAIN_MASK,
5169 value);
5170 if (errno)
5171 return errno;
5172
5173 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5174}
5175
5176static int hdd_we_set_rx_chainmask(struct hdd_adapter *adapter, int value)
5177{
5178 int errno;
5179
5180 errno = hdd_we_set_pdev(adapter,
5181 WMI_PDEV_PARAM_RX_CHAIN_MASK,
5182 value);
5183 if (errno)
5184 return errno;
5185
5186 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5187}
5188
5189static int hdd_we_set_txpow_2g(struct hdd_adapter *adapter, int value)
5190{
5191 return hdd_we_set_pdev(adapter,
5192 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
5193 value);
5194}
5195
5196static int hdd_we_set_txpow_5g(struct hdd_adapter *adapter, int value)
5197{
5198 return hdd_we_set_pdev(adapter,
5199 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
5200 value);
5201}
5202
Jeff Johnson2e381272018-11-10 09:33:39 -08005203static int hdd_we_set_vdev(struct hdd_adapter *adapter,
5204 int id,
5205 const char *id_string,
5206 int value)
5207{
5208 int errno;
5209
5210 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005211 errno = wma_cli_set_command(adapter->vdev_id, id, value, VDEV_CMD);
Jeff Johnson2e381272018-11-10 09:33:39 -08005212 if (errno)
5213 hdd_err("Failed to set firmware, errno %d", errno);
5214
5215 return errno;
5216}
5217
5218#define hdd_we_set_vdev(adapter, id, value) \
5219 hdd_we_set_vdev(adapter, id, #id, value)
5220
5221static int hdd_we_set_txrx_fwstats(struct hdd_adapter *adapter, int value)
5222{
5223 return hdd_we_set_vdev(adapter,
5224 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
5225 value);
5226}
5227
5228static int hdd_we_txrx_fwstats_reset(struct hdd_adapter *adapter, int value)
5229{
5230 return hdd_we_set_vdev(adapter,
5231 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
5232 value);
5233}
5234
5235static int hdd_we_set_htsmps(struct hdd_adapter *adapter, int value)
5236{
5237 return hdd_we_set_vdev(adapter,
5238 WMI_STA_SMPS_FORCE_MODE_CMDID,
5239 value);
5240}
5241
5242static int hdd_we_set_early_rx_adjust_enable(struct hdd_adapter *adapter,
5243 int value)
5244{
5245 if ((value != 0) && (value != 1))
5246 return -EINVAL;
5247
5248 return hdd_we_set_vdev(adapter,
5249 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
5250 value);
5251}
5252
5253static int hdd_we_set_early_rx_tgt_bmiss_num(struct hdd_adapter *adapter,
5254 int value)
5255{
5256 return hdd_we_set_vdev(adapter,
5257 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
5258 value);
5259}
5260
5261static int hdd_we_set_early_rx_bmiss_sample_cycle(struct hdd_adapter *adapter,
5262 int value)
5263{
5264 return hdd_we_set_vdev(adapter,
5265 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
5266 value);
5267}
5268
5269static int hdd_we_set_early_rx_slop_step(struct hdd_adapter *adapter, int value)
5270{
5271 return hdd_we_set_vdev(adapter,
5272 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
5273 value);
5274}
5275
5276static int hdd_we_set_early_rx_init_slop(struct hdd_adapter *adapter, int value)
5277{
5278 return hdd_we_set_vdev(adapter,
5279 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
5280 value);
5281}
5282
5283static int hdd_we_set_early_rx_adjust_pause(struct hdd_adapter *adapter,
5284 int value)
5285{
5286 if ((value != 0) && (value != 1))
5287 return -EINVAL;
5288
5289 return hdd_we_set_vdev(adapter,
5290 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
5291 value);
5292}
5293
5294static int hdd_we_set_early_rx_drift_sample(struct hdd_adapter *adapter,
5295 int value)
5296{
5297 return hdd_we_set_vdev(adapter,
5298 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
5299 value);
5300}
5301
5302static int hdd_we_set_dcm(struct hdd_adapter *adapter, int value)
5303{
5304 return hdd_we_set_vdev(adapter,
5305 WMI_VDEV_PARAM_HE_DCM,
5306 value);
5307}
5308
5309static int hdd_we_set_range_ext(struct hdd_adapter *adapter, int value)
5310{
5311 return hdd_we_set_vdev(adapter,
5312 WMI_VDEV_PARAM_HE_RANGE_EXT,
5313 value);
5314}
5315
Jeff Johnson22e57f12018-11-10 16:02:00 -08005316static int hdd_we_set_dbg(struct hdd_adapter *adapter,
5317 int id,
5318 const char *id_string,
5319 int value)
5320{
5321 int errno;
5322
5323 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005324 errno = wma_cli_set_command(adapter->vdev_id, id, value, DBG_CMD);
Jeff Johnson22e57f12018-11-10 16:02:00 -08005325 if (errno)
5326 hdd_err("Failed to set firmware, errno %d", errno);
5327
5328 return errno;
5329}
5330
5331#define hdd_we_set_dbg(adapter, id, value) \
5332 hdd_we_set_dbg(adapter, id, #id, value)
5333
5334static int hdd_we_dbglog_log_level(struct hdd_adapter *adapter, int value)
5335{
5336 return hdd_we_set_dbg(adapter,
5337 WMI_DBGLOG_LOG_LEVEL,
5338 value);
5339}
5340
5341static int hdd_we_dbglog_vap_enable(struct hdd_adapter *adapter, int value)
5342{
5343 return hdd_we_set_dbg(adapter,
5344 WMI_DBGLOG_VAP_ENABLE,
5345 value);
5346}
5347
5348static int hdd_we_dbglog_vap_disable(struct hdd_adapter *adapter, int value)
5349{
5350 return hdd_we_set_dbg(adapter,
5351 WMI_DBGLOG_VAP_DISABLE,
5352 value);
5353}
5354
5355static int hdd_we_dbglog_module_enable(struct hdd_adapter *adapter, int value)
5356{
5357 return hdd_we_set_dbg(adapter,
5358 WMI_DBGLOG_MODULE_ENABLE,
5359 value);
5360}
5361
5362static int hdd_we_dbglog_module_disable(struct hdd_adapter *adapter, int value)
5363{
5364 return hdd_we_set_dbg(adapter,
5365 WMI_DBGLOG_MODULE_DISABLE,
5366 value);
5367}
5368
5369static int hdd_we_dbglog_mod_log_level(struct hdd_adapter *adapter, int value)
5370{
5371 return hdd_we_set_dbg(adapter,
5372 WMI_DBGLOG_MOD_LOG_LEVEL,
5373 value);
5374}
5375
5376static int hdd_we_dbglog_type(struct hdd_adapter *adapter, int value)
5377{
5378 return hdd_we_set_dbg(adapter,
5379 WMI_DBGLOG_TYPE,
5380 value);
5381}
5382
5383static int hdd_we_dbglog_report_enable(struct hdd_adapter *adapter, int value)
5384{
5385 return hdd_we_set_dbg(adapter,
5386 WMI_DBGLOG_REPORT_ENABLE,
5387 value);
5388}
5389
5390static int hdd_we_start_fw_profile(struct hdd_adapter *adapter, int value)
5391{
5392 return hdd_we_set_dbg(adapter,
5393 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5394 value);
5395}
5396
Jeff Johnson274a1d62018-11-12 20:31:51 -08005397static int hdd_we_set_channel(struct hdd_adapter *adapter, int channel)
5398{
5399 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5400 QDF_STATUS status;
5401
5402 hdd_debug("Set Channel %d Session ID %d mode %d", channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005403 adapter->vdev_id, adapter->device_mode);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005404
5405 if (!hdd_ctx->mac_handle)
5406 return -EINVAL;
5407
5408 switch (adapter->device_mode) {
5409 case QDF_STA_MODE:
5410 case QDF_P2P_CLIENT_MODE:
5411 /* supported */
5412 break;
5413 default:
5414 hdd_err("change channel not supported for device mode %d",
5415 adapter->device_mode);
5416 return -EINVAL;
5417 }
5418
5419 status = sme_ext_change_channel(hdd_ctx->mac_handle, channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005420 adapter->vdev_id);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005421 if (status != QDF_STATUS_SUCCESS)
5422 hdd_err("Error in change channel status %d", status);
5423
5424 return qdf_status_to_os_return(status);
5425}
5426
Jeff Johnson0e07ca12018-11-12 21:04:45 -08005427static int hdd_we_mcc_config_latency(struct hdd_adapter *adapter, int latency)
5428{
5429 hdd_debug("MCC latency %d", latency);
5430
5431 wlan_hdd_set_mcc_latency(adapter, latency);
5432
5433 return 0;
5434}
5435
5436static int hdd_we_mcc_config_quota(struct hdd_adapter *adapter, int quota)
5437{
5438 hdd_debug("MCC quota %dms", quota);
5439
5440 return wlan_hdd_set_mcc_p2p_quota(adapter, quota);
5441}
5442
Jeff Johnson33ec1982018-11-12 21:40:33 -08005443static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value)
5444{
5445 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5446
5447 if (!hdd_ctx->mac_handle)
5448 return -EINVAL;
5449
5450 sme_update_connect_debug(hdd_ctx->mac_handle, value);
5451
5452 return 0;
5453}
5454
Jeff Johnsone50951c2018-11-13 12:20:23 -08005455static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value)
5456{
5457 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5458
5459 hdd_debug("%d", value);
5460
Abhishek Singh935e4772018-11-21 14:14:10 +05305461 if (!hdd_ctx->psoc)
Jeff Johnsone50951c2018-11-13 12:20:23 -08005462 return -EINVAL;
5463
Abhishek Singh935e4772018-11-21 14:14:10 +05305464 if (value)
5465 ucfg_scan_psoc_set_disable(hdd_ctx->psoc, REASON_USER_SPACE);
5466 else
5467 ucfg_scan_psoc_set_enable(hdd_ctx->psoc, REASON_USER_SPACE);
Jeff Johnsone50951c2018-11-13 12:20:23 -08005468
5469 return 0;
5470}
5471
Jeff Johnsond3f1efd2018-11-13 13:26:19 -08005472static int hdd_we_set_conc_system_pref(struct hdd_adapter *adapter,
5473 int preference)
5474{
5475 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5476
5477 hdd_debug("%d", preference);
5478
5479 if (!hdd_ctx->psoc)
5480 return -EINVAL;
5481
5482 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, preference);
5483
5484 return 0;
5485}
5486
Jeff Johnson74696bb2018-11-13 13:30:36 -08005487static int hdd_we_set_11ax_rate(struct hdd_adapter *adapter, int rate)
5488{
5489 return hdd_set_11ax_rate(adapter, rate, NULL);
5490}
5491
Jeff Johnsonb43ec122018-11-13 14:17:08 -08005492static int hdd_we_set_modulated_dtim(struct hdd_adapter *adapter, int value)
5493{
5494 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5495
5496 hdd_debug("%d", value);
5497
5498 if (!hdd_ctx->psoc)
5499 return -EINVAL;
5500
5501 if ((value < cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM)) ||
5502 (value > cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM))) {
5503 hdd_err("Invalid value %d", value);
5504 return -EINVAL;
5505 }
5506
5507 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, value);
5508
5509 return 0;
5510}
5511
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305512#ifdef WLAN_FEATURE_MOTION_DETECTION
5513/**
5514 * hdd_we_motion_det_start_stop - start/stop motion detection
5515 * @adapter: hdd adapter
5516 * @value: start/stop value to set
5517 *
5518 * Return: 0 on success, error on failure
5519 */
5520static int hdd_we_motion_det_start_stop(struct hdd_adapter *adapter, int value)
5521{
5522 struct sme_motion_det_en motion_det;
5523 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5524
5525 if (value < 0 || value > 1) {
5526 hdd_err("Invalid value %d in mt_start", value);
5527 return -EINVAL;
5528 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005529 motion_det.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305530 motion_det.enable = value;
5531
5532 if (!value)
5533 adapter->motion_detection_mode = 0;
5534
5535 sme_motion_det_enable(hdd_ctx->mac_handle, &motion_det);
5536
5537 return 0;
5538}
5539
5540/**
5541 * hdd_we_motion_det_base_line_start_stop - start/stop md baselining
5542 * @adapter: hdd adapter
5543 * @value: start/stop value to set
5544 *
5545 * Return: 0 on success, error on failure
5546 */
5547static int hdd_we_motion_det_base_line_start_stop(struct hdd_adapter *adapter,
5548 int value)
5549{
5550 struct sme_motion_det_base_line_en motion_det_base_line;
5551 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5552
5553 if (value < 0 || value > 1) {
5554 hdd_err("Invalid value %d in mt_bl_start", value);
5555 return -EINVAL;
5556 }
5557
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005558 motion_det_base_line.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305559 motion_det_base_line.enable = value;
5560 sme_motion_det_base_line_enable(hdd_ctx->mac_handle,
5561 &motion_det_base_line);
5562
5563 return 0;
5564}
5565#endif /* WLAN_FEATURE_MOTION_DETECTION */
5566
Krishna Reddya50d09f2019-02-04 14:55:06 +05305567int wlan_hdd_set_btcoex_mode(struct hdd_adapter *adapter, int value)
5568{
5569 struct coex_config_params coex_cfg_params = {0};
5570
5571 coex_cfg_params.config_type = WMI_COEX_CONFIG_BTC_MODE;
5572 coex_cfg_params.config_arg1 = value;
5573 coex_cfg_params.vdev_id = adapter->vdev_id;
5574
5575 if (value < cfg_min(CFG_BTC_MODE) || value > cfg_max(CFG_BTC_MODE)) {
5576 hdd_err_rl("Invalid value %d", value);
5577 return -EINVAL;
5578 }
5579
5580 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5581 hdd_err_rl("Failed to send coex BTC mode");
5582 return -EINVAL;
5583 }
5584
5585 return 0;
5586}
5587
5588int wlan_hdd_set_btcoex_rssi_threshold(struct hdd_adapter *adapter, int value)
5589{
5590 struct coex_config_params coex_cfg_params = {0};
5591
5592 coex_cfg_params.config_type = WMI_COEX_CONFIG_BT_LOW_RSSI_THRESHOLD;
5593 coex_cfg_params.config_arg1 = value;
5594 coex_cfg_params.vdev_id = adapter->vdev_id;
5595
5596 if (value < cfg_min(CFG_WLAN_LOW_RSSI_THRESHOLD) ||
5597 value > cfg_max(CFG_WLAN_LOW_RSSI_THRESHOLD)) {
5598 hdd_err_rl("Invalid value %d", value);
5599 return -EINVAL;
5600 }
5601
5602 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5603 hdd_err_rl("Failed to send coex BTC RSSI Threshold");
5604 return -EINVAL;
5605 }
5606 return 0;
5607}
Jeff Johnson3ba27322018-11-13 17:58:28 -08005608typedef int (*setint_getnone_fn)(struct hdd_adapter *adapter, int value);
5609static const setint_getnone_fn setint_getnone_cb[] = {
5610 [WE_SET_11D_STATE] = hdd_we_set_11d_state,
5611 [WE_SET_POWER] = hdd_we_set_power,
5612 [WE_SET_MAX_ASSOC] = hdd_we_set_max_assoc,
5613 [WE_SET_DATA_INACTIVITY_TO] = hdd_we_set_data_inactivity_timeout,
5614 [WE_SET_WOW_DATA_INACTIVITY_TO] =
5615 hdd_we_set_wow_data_inactivity_timeout,
5616 [WE_SET_MC_RATE] = wlan_hdd_set_mc_rate,
5617 [WE_SET_TX_POWER] = hdd_we_set_tx_power,
5618 [WE_SET_MAX_TX_POWER] = hdd_we_set_max_tx_power,
5619 [WE_SET_MAX_TX_POWER_2_4] = hdd_we_set_max_tx_power_2_4,
5620 [WE_SET_MAX_TX_POWER_5_0] = hdd_we_set_max_tx_power_5_0,
Jeff Johnson0187c622019-01-04 06:39:44 -08005621#ifdef HASTINGS_BT_WAR
5622 [WE_SET_HASTINGS_BT_WAR] = hdd_we_set_hastings_bt_war,
5623#endif
Jeff Johnson3ba27322018-11-13 17:58:28 -08005624 [WE_SET_TM_LEVEL] = hdd_we_set_tm_level,
5625 [WE_SET_PHYMODE] = wlan_hdd_update_phymode,
5626 [WE_SET_NSS] = hdd_we_set_nss,
5627 [WE_SET_GTX_HT_MCS] = hdd_we_set_gtx_ht_mcs,
5628 [WE_SET_GTX_VHT_MCS] = hdd_we_set_gtx_vht_mcs,
5629 [WE_SET_GTX_USRCFG] = hdd_we_set_gtx_usrcfg,
5630 [WE_SET_GTX_THRE] = hdd_we_set_gtx_thre,
5631 [WE_SET_GTX_MARGIN] = hdd_we_set_gtx_margin,
5632 [WE_SET_GTX_STEP] = hdd_we_set_gtx_step,
5633 [WE_SET_GTX_MINTPC] = hdd_we_set_gtx_mintpc,
5634 [WE_SET_GTX_BWMASK] = hdd_we_set_gtx_bwmask,
5635 [WE_SET_LDPC] = hdd_set_ldpc,
5636 [WE_SET_TX_STBC] = hdd_set_tx_stbc,
5637 [WE_SET_RX_STBC] = hdd_set_rx_stbc,
5638 [WE_SET_SHORT_GI] = hdd_we_set_short_gi,
5639 [WE_SET_RTSCTS] = hdd_we_set_rtscts,
5640 [WE_SET_CHWIDTH] = hdd_we_set_ch_width,
5641 [WE_SET_ANI_EN_DIS] = hdd_we_set_ani_en_dis,
5642 [WE_SET_ANI_POLL_PERIOD] = hdd_we_set_ani_poll_period,
5643 [WE_SET_ANI_LISTEN_PERIOD] = hdd_we_set_ani_listen_period,
5644 [WE_SET_ANI_OFDM_LEVEL] = hdd_we_set_ani_ofdm_level,
5645 [WE_SET_ANI_CCK_LEVEL] = hdd_we_set_ani_cck_level,
5646 [WE_SET_DYNAMIC_BW] = hdd_we_set_dynamic_bw,
5647 [WE_SET_CTS_CBW] = hdd_we_set_cts_cbw,
5648 [WE_SET_11N_RATE] = hdd_we_set_11n_rate,
5649 [WE_SET_VHT_RATE] = hdd_we_set_vht_rate,
5650 [WE_SET_AMPDU] = hdd_we_set_ampdu,
5651 [WE_SET_AMSDU] = hdd_we_set_amsdu,
5652 [WE_SET_TX_CHAINMASK] = hdd_we_set_tx_chainmask,
5653 [WE_SET_RX_CHAINMASK] = hdd_we_set_rx_chainmask,
5654 [WE_SET_TXPOW_2G] = hdd_we_set_txpow_2g,
5655 [WE_SET_TXPOW_5G] = hdd_we_set_txpow_5g,
5656 [WE_DBGLOG_LOG_LEVEL] = hdd_we_dbglog_log_level,
5657 [WE_DBGLOG_VAP_ENABLE] = hdd_we_dbglog_vap_enable,
5658 [WE_DBGLOG_VAP_DISABLE] = hdd_we_dbglog_vap_disable,
5659 [WE_DBGLOG_MODULE_ENABLE] = hdd_we_dbglog_module_enable,
5660 [WE_DBGLOG_MODULE_DISABLE] = hdd_we_dbglog_module_disable,
5661 [WE_DBGLOG_MOD_LOG_LEVEL] = hdd_we_dbglog_mod_log_level,
5662 [WE_DBGLOG_TYPE] = hdd_we_dbglog_type,
5663 [WE_DBGLOG_REPORT_ENABLE] = hdd_we_dbglog_report_enable,
5664 [WE_SET_TXRX_FWSTATS] = hdd_we_set_txrx_fwstats,
5665 [WE_TXRX_FWSTATS_RESET] = hdd_we_txrx_fwstats_reset,
5666 [WE_DUMP_STATS] = hdd_wlan_dump_stats,
5667 [WE_CLEAR_STATS] = hdd_we_clear_stats,
5668 [WE_PPS_PAID_MATCH] = hdd_we_pps_paid_match,
5669 [WE_PPS_GID_MATCH] = hdd_we_pps_gid_match,
5670 [WE_PPS_EARLY_TIM_CLEAR] = hdd_we_pps_early_tim_clear,
5671 [WE_PPS_EARLY_DTIM_CLEAR] = hdd_we_pps_early_dtim_clear,
5672 [WE_PPS_EOF_PAD_DELIM] = hdd_we_pps_eof_pad_delim,
5673 [WE_PPS_MACADDR_MISMATCH] = hdd_we_pps_macaddr_mismatch,
5674 [WE_PPS_DELIM_CRC_FAIL] = hdd_we_pps_delim_crc_fail,
5675 [WE_PPS_GID_NSTS_ZERO] = hdd_we_pps_gid_nsts_zero,
5676 [WE_PPS_RSSI_CHECK] = hdd_we_pps_rssi_check,
5677 [WE_PPS_5G_EBT] = hdd_we_pps_5g_ebt,
5678 [WE_SET_HTSMPS] = hdd_we_set_htsmps,
5679 [WE_SET_QPOWER_MAX_PSPOLL_COUNT] = hdd_we_set_qpower_max_pspoll_count,
5680 [WE_SET_QPOWER_MAX_TX_BEFORE_WAKE] =
5681 hdd_we_set_qpower_max_tx_before_wake,
5682 [WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL] =
5683 hdd_we_set_qpower_spec_pspoll_wake_interval,
5684 [WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL] =
5685 hdd_we_set_qpower_spec_max_spec_nodata_pspoll,
5686 [WE_MCC_CONFIG_LATENCY] = hdd_we_mcc_config_latency,
5687 [WE_MCC_CONFIG_QUOTA] = hdd_we_mcc_config_quota,
5688 [WE_SET_DEBUG_LOG] = hdd_we_set_debug_log,
5689 [WE_SET_EARLY_RX_ADJUST_ENABLE] = hdd_we_set_early_rx_adjust_enable,
5690 [WE_SET_EARLY_RX_TGT_BMISS_NUM] = hdd_we_set_early_rx_tgt_bmiss_num,
5691 [WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE] =
5692 hdd_we_set_early_rx_bmiss_sample_cycle,
5693 [WE_SET_EARLY_RX_SLOP_STEP] = hdd_we_set_early_rx_slop_step,
5694 [WE_SET_EARLY_RX_INIT_SLOP] = hdd_we_set_early_rx_init_slop,
5695 [WE_SET_EARLY_RX_ADJUST_PAUSE] = hdd_we_set_early_rx_adjust_pause,
5696 [WE_SET_EARLY_RX_DRIFT_SAMPLE] = hdd_we_set_early_rx_drift_sample,
5697 [WE_SET_SCAN_DISABLE] = hdd_we_set_scan_disable,
5698 [WE_START_FW_PROFILE] = hdd_we_start_fw_profile,
5699 [WE_SET_CHANNEL] = hdd_we_set_channel,
5700 [WE_SET_CONC_SYSTEM_PREF] = hdd_we_set_conc_system_pref,
5701 [WE_SET_11AX_RATE] = hdd_we_set_11ax_rate,
5702 [WE_SET_DCM] = hdd_we_set_dcm,
5703 [WE_SET_RANGE_EXT] = hdd_we_set_range_ext,
5704 [WE_SET_PDEV_RESET] = hdd_handle_pdev_reset,
5705 [WE_SET_MODULATED_DTIM] = hdd_we_set_modulated_dtim,
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305706#ifdef WLAN_FEATURE_MOTION_DETECTION
5707 [WE_MOTION_DET_START_STOP] = hdd_we_motion_det_start_stop,
5708 [WE_MOTION_DET_BASE_LINE_START_STOP] =
5709 hdd_we_motion_det_base_line_start_stop,
5710#endif /* WLAN_FEATURE_MOTION_DETECTION */
Krishna Reddya50d09f2019-02-04 14:55:06 +05305711 [WE_SET_BTCOEX_MODE] = wlan_hdd_set_btcoex_mode,
5712 [WE_SET_BTCOEX_RSSI_THRESHOLD] = wlan_hdd_set_btcoex_rssi_threshold,
Jeff Johnson3ba27322018-11-13 17:58:28 -08005713};
5714
5715static setint_getnone_fn hdd_get_setint_getnone_cb(int param)
5716{
5717 if (param < 0)
5718 return NULL;
5719
5720 if (param >= QDF_ARRAY_SIZE(setint_getnone_cb))
5721 return NULL;
5722
5723 return setint_getnone_cb[param];
5724}
5725
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005726/**
5727 * iw_setint_getnone() - Generic "set integer" private ioctl handler
5728 * @dev: device upon which the ioctl was received
5729 * @info: ioctl request information
5730 * @wrqu: ioctl request data
5731 * @extra: ioctl extra data
5732 *
5733 * Return: 0 on success, non-zero on error
5734 */
5735static int __iw_setint_getnone(struct net_device *dev,
5736 struct iw_request_info *info,
5737 union iwreq_data *wrqu, char *extra)
5738{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005739 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005740 struct hdd_context *hdd_ctx;
Jeff Johnson3ba27322018-11-13 17:58:28 -08005741 setint_getnone_fn cb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005742 int *value = (int *)extra;
5743 int sub_cmd = value[0];
5744 int set_value = value[1];
5745 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005746
Dustin Brownfdf17c12018-03-14 12:55:34 -07005747 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305748
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005749 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005750 ret = wlan_hdd_validate_context(hdd_ctx);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005751 if (ret)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005752 return ret;
5753
Jeff Johnson441e1f72017-02-07 08:50:49 -08005754 ret = hdd_check_private_wext_control(hdd_ctx, info);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005755 if (ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08005756 return ret;
5757
Jeff Johnson3ba27322018-11-13 17:58:28 -08005758 cb = hdd_get_setint_getnone_cb(sub_cmd);
5759 if (!cb) {
Rajeev Kumard0565362018-03-01 12:02:01 -08005760 hdd_debug("Invalid sub command %d", sub_cmd);
Jeff Johnson3ba27322018-11-13 17:58:28 -08005761 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005762 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005763
Jeff Johnson3ba27322018-11-13 17:58:28 -08005764 ret = cb(adapter, set_value);
5765
Dustin Browne74003f2018-03-14 12:51:58 -07005766 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005767
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005768 return ret;
5769}
5770
5771static int iw_setint_getnone(struct net_device *dev,
5772 struct iw_request_info *info,
5773 union iwreq_data *wrqu,
5774 char *extra)
5775{
Dustin Brown389e5072018-11-08 17:10:01 +05305776 int errno;
5777 struct osif_vdev_sync *vdev_sync;
5778
5779 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5780 if (errno)
5781 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005782
Dustin Brown389e5072018-11-08 17:10:01 +05305783 errno = __iw_setint_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005784
Dustin Brown389e5072018-11-08 17:10:01 +05305785 osif_vdev_sync_op_stop(vdev_sync);
5786
5787 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005788}
5789
5790/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005791 * __iw_setnone_get_threeint() - return three value to up layer.
5792 *
5793 * @dev: pointer of net_device of this wireless card
5794 * @info: meta data about Request sent
5795 * @wrqu: include request info
5796 * @extra: buf used for in/Output
5797 *
5798 * Return: execute result
5799 */
5800static int __iw_setnone_get_threeint(struct net_device *dev,
5801 struct iw_request_info *info,
5802 union iwreq_data *wrqu, char *extra)
5803{
5804 int ret = 0; /* success */
5805 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005806 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005807 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005808
Dustin Brownfdf17c12018-03-14 12:55:34 -07005809 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005810 ret = wlan_hdd_validate_context(hdd_ctx);
5811 if (0 != ret)
5812 return ret;
5813
Jeff Johnson441e1f72017-02-07 08:50:49 -08005814 ret = hdd_check_private_wext_control(hdd_ctx, info);
5815 if (0 != ret)
5816 return ret;
5817
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005818 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005819 switch (value[0]) {
5820 case WE_GET_TSF:
5821 ret = hdd_indicate_tsf(adapter, value, 3);
5822 break;
5823 default:
5824 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5825 break;
5826 }
5827 return ret;
5828}
5829
5830/**
5831 * iw_setnone_get_threeint() - return three value to up layer.
5832 *
5833 * @dev: pointer of net_device of this wireless card
5834 * @info: meta data about Request sent
5835 * @wrqu: include request info
5836 * @extra: buf used for in/Output
5837 *
5838 * Return: execute result
5839 */
5840static int iw_setnone_get_threeint(struct net_device *dev,
5841 struct iw_request_info *info,
5842 union iwreq_data *wrqu, char *extra)
5843{
Dustin Brown389e5072018-11-08 17:10:01 +05305844 int errno;
5845 struct osif_vdev_sync *vdev_sync;
5846
5847 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5848 if (errno)
5849 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005850
Dustin Brown389e5072018-11-08 17:10:01 +05305851 errno = __iw_setnone_get_threeint(dev, info, wrqu, extra);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005852
Dustin Brown389e5072018-11-08 17:10:01 +05305853 osif_vdev_sync_op_stop(vdev_sync);
5854
5855 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005856}
5857
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005858#ifdef WLAN_UNIT_TEST
Dustin Brown7d038e52018-11-29 14:28:13 -08005859typedef uint32_t (*hdd_ut_callback)(void);
5860
5861struct hdd_ut_entry {
5862 const hdd_ut_callback callback;
5863 const char *name;
5864};
5865
5866struct hdd_ut_entry hdd_ut_entries[] = {
5867 { .name = "dsc", .callback = dsc_unit_test },
Dustin Brown05a0658f2019-03-05 11:27:38 -08005868 { .name = "qdf_delayed_work", .callback = qdf_delayed_work_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005869 { .name = "qdf_ht", .callback = qdf_ht_unit_test },
5870 { .name = "qdf_periodic_work",
5871 .callback = qdf_periodic_work_unit_test },
Dustin Brown92acafe2019-02-15 17:17:10 -08005872 { .name = "qdf_ptr_hash", .callback = qdf_ptr_hash_unit_test },
Dustin Brown128e2d02019-02-15 12:59:07 -08005873 { .name = "qdf_slist", .callback = qdf_slist_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005874 { .name = "qdf_talloc", .callback = qdf_talloc_unit_test },
5875 { .name = "qdf_types", .callback = qdf_types_unit_test },
Dustin Brown7d038e52018-11-29 14:28:13 -08005876};
5877
5878#define hdd_for_each_ut_entry(cursor) \
5879 for (cursor = hdd_ut_entries; \
5880 cursor < hdd_ut_entries + ARRAY_SIZE(hdd_ut_entries); \
5881 cursor++)
5882
5883static struct hdd_ut_entry *hdd_ut_lookup(const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005884{
Dustin Brown7d038e52018-11-29 14:28:13 -08005885 struct hdd_ut_entry *entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005886
Dustin Brown7d038e52018-11-29 14:28:13 -08005887 hdd_for_each_ut_entry(entry) {
5888 if (qdf_str_eq(entry->name, name))
5889 return entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005890 }
5891
Dustin Brown7d038e52018-11-29 14:28:13 -08005892 return NULL;
5893}
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005894
Dustin Brown7d038e52018-11-29 14:28:13 -08005895static uint32_t hdd_ut_single(const struct hdd_ut_entry *entry)
5896{
5897 uint32_t errors;
5898
5899 hdd_nofl_info("START: '%s'", entry->name);
5900
5901 errors = entry->callback();
5902 if (errors)
5903 hdd_nofl_err("FAIL: '%s' with %u errors", entry->name, errors);
5904 else
5905 hdd_nofl_info("PASS: '%s'", entry->name);
5906
5907 return errors;
5908}
5909
5910static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
5911{
5912 struct hdd_ut_entry *entry;
5913 uint32_t errors = 0;
5914
5915 hdd_nofl_info("Unit tests begin");
5916
5917 if (!name || !name[0] || qdf_str_eq(name, "all")) {
5918 hdd_for_each_ut_entry(entry)
5919 errors += hdd_ut_single(entry);
5920 } else {
5921 entry = hdd_ut_lookup(name);
5922 if (entry)
5923 errors += hdd_ut_single(entry);
5924 else
5925 hdd_nofl_err("Unit test '%s' not found", name);
5926 }
5927
5928 hdd_nofl_info("Unit tests complete");
5929
5930 return errors ? -EPERM : 0;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005931}
5932#else
Dustin Brown7d038e52018-11-29 14:28:13 -08005933static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005934{
5935 return -EOPNOTSUPP;
5936}
5937#endif /* WLAN_UNIT_TEST */
5938
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005939/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005940 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5941 * @dev: device upon which the ioctl was received
5942 * @info: ioctl request information
5943 * @wrqu: ioctl request data
5944 * @extra: ioctl extra data
5945 *
5946 * Return: 0 on success, non-zero on error
5947 */
5948static int __iw_setchar_getnone(struct net_device *dev,
5949 struct iw_request_info *info,
5950 union iwreq_data *wrqu, char *extra)
5951{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005952 int sub_cmd;
5953 int ret;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005954 char *str_arg = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005955 struct hdd_adapter *adapter = (netdev_priv(dev));
5956 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005957 struct iw_point s_priv_data;
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005958 bool neighbor_report_req_support = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005959
Dustin Brownfdf17c12018-03-14 12:55:34 -07005960 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005961
Mukul Sharma34777c62015-11-02 20:22:30 +05305962 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005963 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305964 return -EPERM;
5965 }
5966
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005967 ret = wlan_hdd_validate_context(hdd_ctx);
5968 if (0 != ret)
5969 return ret;
5970
Jeff Johnson441e1f72017-02-07 08:50:49 -08005971 ret = hdd_check_private_wext_control(hdd_ctx, info);
5972 if (0 != ret)
5973 return ret;
5974
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005975 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005976 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005977 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005978
5979 /* make sure all params are correctly passed to function */
Jeff Johnsond36fa332019-03-18 13:42:25 -07005980 if ((!s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005981 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005982
5983 sub_cmd = s_priv_data.flags;
5984
5985 /* ODD number is used for set, copy data using copy_from_user */
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005986 str_arg = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005987 s_priv_data.length);
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005988 if (!str_arg) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005989 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005990 return -ENOMEM;
5991 }
5992
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005993 hdd_debug("Received length: %d data: %s",
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005994 s_priv_data.length, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005995
5996 switch (sub_cmd) {
5997 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005998 hdd_debug("ADD_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305999 if (!hdd_add_wowl_ptrn(adapter, str_arg))
6000 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006001 break;
6002 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006003 hdd_debug("DEL_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05306004 if (!hdd_del_wowl_ptrn(adapter, str_arg))
6005 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006006 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006007 case WE_NEIGHBOR_REPORT_REQUEST:
6008 {
Jeff Johnson84b34332019-03-09 18:21:35 -08006009 tRrmNeighborReq request;
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006010 tRrmNeighborRspCallbackInfo callback;
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05306011 bool rrm_enabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006012
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05306013 ucfg_wlan_mlme_get_rrm_enabled(hdd_ctx->psoc,
6014 &rrm_enabled);
6015
6016 if (rrm_enabled) {
Jeff Johnson84b34332019-03-09 18:21:35 -08006017 request.neighbor_report_offload = false;
6018 request.no_ssid =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006019 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306020 hdd_debug("Neighbor Request ssid present %d",
Jeff Johnson84b34332019-03-09 18:21:35 -08006021 request.no_ssid);
6022 if (!request.no_ssid) {
6023 request.ssid.length =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006024 (s_priv_data.length - 1) >
6025 32 ? 32 : (s_priv_data.length - 1);
Jeff Johnson84b34332019-03-09 18:21:35 -08006026 qdf_mem_copy(request.ssid.ssId,
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006027 str_arg,
Jeff Johnson84b34332019-03-09 18:21:35 -08006028 request.ssid.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006029 }
6030
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306031 /*
6032 * If 11k offload is supported by FW and enabled
6033 * in the ini, set the offload to true
6034 */
Manikandan Mohan06d38d82018-11-26 18:36:58 -08006035 if (QDF_IS_STATUS_ERROR(
6036 ucfg_fwol_is_neighbor_report_req_supported(
6037 hdd_ctx->psoc, &neighbor_report_req_support)))
6038 hdd_err("Neighbor report req bit get fail");
6039
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306040 if (hdd_ctx->config->is_11k_offload_supported &&
Manikandan Mohan06d38d82018-11-26 18:36:58 -08006041 neighbor_report_req_support) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306042 hdd_debug("Neighbor report offloaded to FW");
Jeff Johnson84b34332019-03-09 18:21:35 -08006043 request.neighbor_report_offload = true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306044 }
6045
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006046 callback.neighborRspCallback = NULL;
6047 callback.neighborRspCallbackContext = NULL;
6048 callback.timeout = 5000; /* 5 seconds */
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306049 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006050 hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006051 adapter->vdev_id,
Jeff Johnson84b34332019-03-09 18:21:35 -08006052 &request,
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006053 &callback);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006054 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006055 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006056 ret = -EINVAL;
6057 }
6058 }
6059 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006060 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08006061 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006062 break;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006063 case WE_UNIT_TEST:
6064 ret = hdd_we_unit_test(hdd_ctx, str_arg);
6065 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006066 default:
6067 {
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006068 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006069 ret = -EINVAL;
6070 break;
6071 }
6072 }
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006073
6074 qdf_mem_free(str_arg);
Dustin Browne74003f2018-03-14 12:51:58 -07006075 hdd_exit();
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006076
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006077 return ret;
6078}
6079
6080static int iw_setchar_getnone(struct net_device *dev,
6081 struct iw_request_info *info,
6082 union iwreq_data *wrqu, char *extra)
6083{
Dustin Brown389e5072018-11-08 17:10:01 +05306084 int errno;
6085 struct osif_vdev_sync *vdev_sync;
6086
6087 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6088 if (errno)
6089 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006090
Dustin Brown389e5072018-11-08 17:10:01 +05306091 errno = __iw_setchar_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006092
Dustin Brown389e5072018-11-08 17:10:01 +05306093 osif_vdev_sync_op_stop(vdev_sync);
6094
6095 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006096}
6097
6098/**
6099 * iw_setnone_getint() - Generic "get integer" private ioctl handler
6100 * @dev: device upon which the ioctl was received
6101 * @info: ioctl request information
6102 * @wrqu: ioctl request data
6103 * @extra: ioctl extra data
6104 *
6105 * Return: 0 on success, non-zero on error
6106 */
6107static int __iw_setnone_getint(struct net_device *dev,
6108 struct iw_request_info *info,
6109 union iwreq_data *wrqu, char *extra)
6110{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006111 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006112 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006113 int *value = (int *)extra;
6114 int ret;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08006115 struct sme_config_params *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006116 struct hdd_context *hdd_ctx;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306117 QDF_STATUS status;
6118 bool bval = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006119
Dustin Brownfdf17c12018-03-14 12:55:34 -07006120 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306121
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006122 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006123 ret = wlan_hdd_validate_context(hdd_ctx);
6124 if (0 != ret)
6125 return ret;
6126
Jeff Johnson441e1f72017-02-07 08:50:49 -08006127 ret = hdd_check_private_wext_control(hdd_ctx, info);
6128 if (0 != ret)
6129 return ret;
6130
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08006131 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6132 if (!sme_config) {
6133 hdd_err("failed to allocate memory for sme_config");
6134 return -ENOMEM;
6135 }
6136
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006137 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006138 switch (value[0]) {
6139 case WE_GET_11D_STATE:
6140 {
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05306141 status = ucfg_mlme_is_11d_enabled(hdd_ctx->psoc, &bval);
6142 if (!QDF_IS_STATUS_SUCCESS(status))
6143 hdd_err("Invalid 11d_enable flag");
6144 *value = bval;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006145 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006146
6147 break;
6148 }
6149
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006150 case WE_GET_WLAN_DBG:
6151 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306152 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006153 *value = 0;
6154 break;
6155 }
6156 case WE_GET_MAX_ASSOC:
6157 {
Dustin Brown05d81302018-09-11 16:49:22 -07006158 if (ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, *value) !=
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306159 QDF_STATUS_SUCCESS) {
6160 hdd_err("CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006161 ret = -EIO;
6162 }
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306163
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006164 break;
6165 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006166
6167 case WE_GET_CONCURRENCY_MODE:
6168 {
Dustin Brown05d81302018-09-11 16:49:22 -07006169 *value = policy_mgr_get_concurrency_mode(hdd_ctx->psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006170
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006171 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006172 break;
6173 }
6174
6175 case WE_GET_NSS:
6176 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006177 sme_get_config_param(mac_handle, sme_config);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306178 status = ucfg_mlme_get_vht_enable2x2(hdd_ctx->psoc, &bval);
6179 if (!QDF_IS_STATUS_SUCCESS(status))
6180 hdd_err("unable to get vht_enable2x2");
6181 *value = (bval == 0) ? 1 : 2;
Dustin Brown05d81302018-09-11 16:49:22 -07006182 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc))
Srinivas Girigowda576b2352017-08-25 14:44:26 -07006183 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006184 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006185 break;
6186 }
6187
6188 case WE_GET_GTX_HT_MCS:
6189 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006190 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006191 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006192 WMI_VDEV_PARAM_GTX_HT_MCS,
6193 GTX_CMD);
6194 break;
6195 }
6196
6197 case WE_GET_GTX_VHT_MCS:
6198 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006199 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006200 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006201 WMI_VDEV_PARAM_GTX_VHT_MCS,
6202 GTX_CMD);
6203 break;
6204 }
6205
6206 case WE_GET_GTX_USRCFG:
6207 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006208 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006209 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006210 WMI_VDEV_PARAM_GTX_USR_CFG,
6211 GTX_CMD);
6212 break;
6213 }
6214
6215 case WE_GET_GTX_THRE:
6216 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006217 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006218 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006219 WMI_VDEV_PARAM_GTX_THRE,
6220 GTX_CMD);
6221 break;
6222 }
6223
6224 case WE_GET_GTX_MARGIN:
6225 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006226 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006227 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006228 WMI_VDEV_PARAM_GTX_MARGIN,
6229 GTX_CMD);
6230 break;
6231 }
6232
6233 case WE_GET_GTX_STEP:
6234 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006235 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006236 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006237 WMI_VDEV_PARAM_GTX_STEP,
6238 GTX_CMD);
6239 break;
6240 }
6241
6242 case WE_GET_GTX_MINTPC:
6243 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006244 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006245 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006246 WMI_VDEV_PARAM_GTX_MINTPC,
6247 GTX_CMD);
6248 break;
6249 }
6250
6251 case WE_GET_GTX_BWMASK:
6252 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006253 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006254 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006255 WMI_VDEV_PARAM_GTX_BW_MASK,
6256 GTX_CMD);
6257 break;
6258 }
6259
6260 case WE_GET_LDPC:
6261 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006262 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006263 break;
6264 }
6265
6266 case WE_GET_TX_STBC:
6267 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006268 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006269 break;
6270 }
6271
6272 case WE_GET_RX_STBC:
6273 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006274 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006275 break;
6276 }
6277
6278 case WE_GET_SHORT_GI:
6279 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006280 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006281 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08006282 WMI_VDEV_PARAM_SGI,
6283 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006284 break;
6285 }
6286
6287 case WE_GET_RTSCTS:
6288 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006289 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006290 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006291 WMI_VDEV_PARAM_ENABLE_RTSCTS,
6292 VDEV_CMD);
6293 break;
6294 }
6295
6296 case WE_GET_CHWIDTH:
6297 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006298 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006299 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006300 WMI_VDEV_PARAM_CHWIDTH,
6301 VDEV_CMD);
6302 break;
6303 }
6304
6305 case WE_GET_ANI_EN_DIS:
6306 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006307 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006308 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006309 WMI_PDEV_PARAM_ANI_ENABLE,
6310 PDEV_CMD);
6311 break;
6312 }
6313
6314 case WE_GET_ANI_POLL_PERIOD:
6315 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006316 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006317 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006318 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
6319 PDEV_CMD);
6320 break;
6321 }
6322
6323 case WE_GET_ANI_LISTEN_PERIOD:
6324 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006325 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006326 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006327 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
6328 PDEV_CMD);
6329 break;
6330 }
6331
6332 case WE_GET_ANI_OFDM_LEVEL:
6333 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006334 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006335 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006336 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
6337 PDEV_CMD);
6338 break;
6339 }
6340
6341 case WE_GET_ANI_CCK_LEVEL:
6342 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006343 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006344 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006345 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
6346 PDEV_CMD);
6347 break;
6348 }
6349
6350 case WE_GET_DYNAMIC_BW:
6351 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006352 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006353 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006354 WMI_PDEV_PARAM_DYNAMIC_BW,
6355 PDEV_CMD);
6356 break;
6357 }
6358
6359 case WE_GET_11N_RATE:
6360 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006361 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006362 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006363 WMI_VDEV_PARAM_FIXED_RATE,
6364 VDEV_CMD);
6365 break;
6366 }
6367
6368 case WE_GET_AMPDU:
6369 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006370 hdd_debug("GET AMPDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006371 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006372 GEN_VDEV_PARAM_AMPDU,
6373 GEN_CMD);
6374 break;
6375 }
6376
6377 case WE_GET_AMSDU:
6378 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006379 hdd_debug("GET AMSDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006380 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006381 GEN_VDEV_PARAM_AMSDU,
6382 GEN_CMD);
6383 break;
6384 }
6385
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006386 case WE_GET_ROAM_SYNCH_DELAY:
6387 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006388 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006389 *value = wma_cli_get_command(adapter->vdev_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006390 GEN_VDEV_ROAM_SYNCH_DELAY,
6391 GEN_CMD);
6392 break;
6393 }
6394
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006395 case WE_GET_TX_CHAINMASK:
6396 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006397 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006398 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006399 WMI_PDEV_PARAM_TX_CHAIN_MASK,
6400 PDEV_CMD);
6401 break;
6402 }
6403
6404 case WE_GET_RX_CHAINMASK:
6405 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006406 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006407 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006408 WMI_PDEV_PARAM_RX_CHAIN_MASK,
6409 PDEV_CMD);
6410 break;
6411 }
6412
6413 case WE_GET_TXPOW_2G:
6414 {
Wu Gao5f764082019-01-04 15:54:38 +08006415 uint8_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006416
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006417 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006418 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006419 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
6420 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006421 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow2g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006422 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006423 break;
6424 }
6425
6426 case WE_GET_TXPOW_5G:
6427 {
Wu Gao5f764082019-01-04 15:54:38 +08006428 uint8_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006429
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006430 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006431 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006432 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
6433 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006434 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow5g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006435 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006436 break;
6437 }
6438
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006439 case WE_GET_PPS_PAID_MATCH:
6440 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006441 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006442 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006443 WMI_VDEV_PPS_PAID_MATCH,
6444 PPS_CMD);
6445 break;
6446 }
6447
6448 case WE_GET_PPS_GID_MATCH:
6449 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006450 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006451 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006452 WMI_VDEV_PPS_GID_MATCH,
6453 PPS_CMD);
6454 break;
6455 }
6456
6457 case WE_GET_PPS_EARLY_TIM_CLEAR:
6458 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006459 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006460 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006461 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
6462 PPS_CMD);
6463 break;
6464 }
6465
6466 case WE_GET_PPS_EARLY_DTIM_CLEAR:
6467 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006468 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006469 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006470 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
6471 PPS_CMD);
6472 break;
6473 }
6474
6475 case WE_GET_PPS_EOF_PAD_DELIM:
6476 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006477 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006478 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006479 WMI_VDEV_PPS_EOF_PAD_DELIM,
6480 PPS_CMD);
6481 break;
6482 }
6483
6484 case WE_GET_PPS_MACADDR_MISMATCH:
6485 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006486 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006487 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006488 WMI_VDEV_PPS_MACADDR_MISMATCH,
6489 PPS_CMD);
6490 break;
6491 }
6492
6493 case WE_GET_PPS_DELIM_CRC_FAIL:
6494 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006495 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006496 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006497 WMI_VDEV_PPS_DELIM_CRC_FAIL,
6498 PPS_CMD);
6499 break;
6500 }
6501
6502 case WE_GET_PPS_GID_NSTS_ZERO:
6503 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006504 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006505 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006506 WMI_VDEV_PPS_GID_NSTS_ZERO,
6507 PPS_CMD);
6508 break;
6509 }
6510
6511 case WE_GET_PPS_RSSI_CHECK:
6512 {
6513
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006514 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006515 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006516 WMI_VDEV_PPS_RSSI_CHECK,
6517 PPS_CMD);
6518 break;
6519 }
6520
6521 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
6522 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006523 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006524 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006525 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
6526 QPOWER_CMD);
6527 break;
6528 }
6529
6530 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
6531 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006532 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006533 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006534 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
6535 QPOWER_CMD);
6536 break;
6537 }
6538
6539 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
6540 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006541 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006542 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006543 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
6544 QPOWER_CMD);
6545 break;
6546 }
6547
6548 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
6549 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006550 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006551 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006552 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
6553 QPOWER_CMD);
6554 break;
6555 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006556 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006557 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006558 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006559 case WE_GET_TEMPERATURE:
6560 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006561 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006562 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006563 break;
6564 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006565 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006566 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006567 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006568 WMI_VDEV_PARAM_HE_DCM,
6569 VDEV_CMD);
6570 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006571 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006572 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006573 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006574 WMI_VDEV_PARAM_HE_RANGE_EXT,
6575 VDEV_CMD);
6576 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006577 default:
6578 {
Jeff Johnson99bac312016-06-28 10:38:18 -07006579 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006580 value[0]);
6581 break;
6582 }
6583 }
Dustin Browne74003f2018-03-14 12:51:58 -07006584 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306585 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006586 return ret;
6587}
6588
6589static int iw_setnone_getint(struct net_device *dev,
6590 struct iw_request_info *info,
6591 union iwreq_data *wrqu, char *extra)
6592{
Dustin Brown389e5072018-11-08 17:10:01 +05306593 int errno;
6594 struct osif_vdev_sync *vdev_sync;
6595
6596 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6597 if (errno)
6598 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006599
Dustin Brown389e5072018-11-08 17:10:01 +05306600 errno = __iw_setnone_getint(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006601
Dustin Brown389e5072018-11-08 17:10:01 +05306602 osif_vdev_sync_op_stop(vdev_sync);
6603
6604 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006605}
6606
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306607static int hdd_set_fwtest(int argc, int cmd, int value)
6608{
6609 struct set_fwtest_params *fw_test;
6610
6611 /* check for max number of arguments */
6612 if (argc > (WMA_MAX_NUM_ARGS) ||
6613 argc != HDD_FWTEST_PARAMS) {
6614 hdd_err("Too Many args %d", argc);
6615 return -EINVAL;
6616 }
6617 /*
6618 * check if number of arguments are 3 then, check
6619 * then set the default value for sounding interval.
6620 */
6621 if (HDD_FWTEST_PARAMS == argc) {
6622 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
6623 value = HDD_FWTEST_SU_DEFAULT_VALUE;
6624 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6625 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6626 }
6627 /* check sounding interval value should not exceed to max */
6628 if (value > HDD_FWTEST_MAX_VALUE) {
6629 hdd_err("Invalid arguments value should not exceed max: %d",
6630 value);
6631 return -EINVAL;
6632 }
6633 fw_test = qdf_mem_malloc(sizeof(*fw_test));
Jeff Johnsond36fa332019-03-18 13:42:25 -07006634 if (!fw_test) {
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306635 hdd_err("qdf_mem_malloc failed for fw_test");
6636 return -ENOMEM;
6637 }
6638 fw_test->arg = cmd;
6639 fw_test->value = value;
6640 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6641 qdf_mem_free(fw_test);
6642 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6643 return -EINVAL;
6644 }
6645 return 0;
6646}
6647
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006648/**
6649 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6650 * @dev: device upon which the ioctl was received
6651 * @info: ioctl request information
6652 * @wrqu: ioctl request data
6653 * @extra: ioctl extra data
6654 *
6655 * Return: 0 on success, non-zero on error
6656 */
6657static int __iw_set_three_ints_getnone(struct net_device *dev,
6658 struct iw_request_info *info,
6659 union iwreq_data *wrqu, char *extra)
6660{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006661 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006662 int *value = (int *)extra;
6663 int sub_cmd = value[0];
6664 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08006665 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006666 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08006667 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006668
Dustin Brownfdf17c12018-03-14 12:55:34 -07006669 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306670
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006671 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006672 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006673 return -EPERM;
6674 }
6675
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006676 ret = wlan_hdd_validate_context(hdd_ctx);
6677 if (0 != ret)
6678 return ret;
6679
Jeff Johnson441e1f72017-02-07 08:50:49 -08006680 ret = hdd_check_private_wext_control(hdd_ctx, info);
6681 if (0 != ret)
6682 return ret;
6683
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006684 switch (sub_cmd) {
6685
6686 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006687 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6688 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006689 break;
6690 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306691 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006692 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306693
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006694 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6695 hdd_debug("Ioctl to set dual mac scan config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08006696 status =
6697 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
6698 &dual_mac_feature);
6699 if (status != QDF_STATUS_SUCCESS)
6700 hdd_err("can't get dual mac feature val, use def");
6701 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006702 hdd_err("Dual mac feature is disabled from INI");
6703 return -EPERM;
6704 }
6705 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Dustin Brown05d81302018-09-11 16:49:22 -07006706 policy_mgr_set_dual_mac_scan_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006707 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006708 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306709 case WE_SET_FW_TEST:
6710 {
6711 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6712 if (ret) {
6713 hdd_err("Not able to set fwtest %d", ret);
6714 return ret;
6715 }
6716 }
6717 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006718 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006719 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006720 break;
6721
6722 }
Dustin Browne74003f2018-03-14 12:51:58 -07006723 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006724 return ret;
6725}
6726
6727int iw_set_three_ints_getnone(struct net_device *dev,
6728 struct iw_request_info *info,
6729 union iwreq_data *wrqu, char *extra)
6730{
Dustin Brown389e5072018-11-08 17:10:01 +05306731 int errno;
6732 struct osif_vdev_sync *vdev_sync;
6733
6734 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6735 if (errno)
6736 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006737
Dustin Brown389e5072018-11-08 17:10:01 +05306738 errno = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006739
Dustin Brown389e5072018-11-08 17:10:01 +05306740 osif_vdev_sync_op_stop(vdev_sync);
6741
6742 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006743}
6744
6745/**
6746 * hdd_connection_state_string() - Get connection state string
6747 * @connection_state: enum to be converted to a string
6748 *
6749 * Return: the string equivalent of @connection_state
6750 */
6751static const char *
6752hdd_connection_state_string(eConnectionState connection_state)
6753{
6754 switch (connection_state) {
6755 CASE_RETURN_STRING(eConnectionState_NotConnected);
6756 CASE_RETURN_STRING(eConnectionState_Connecting);
6757 CASE_RETURN_STRING(eConnectionState_Associated);
6758 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6759 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6760 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6761 default:
6762 return "UNKNOWN";
6763 }
6764}
6765
Naveen Rawat910726a2017-03-06 11:42:51 -08006766#if defined(FEATURE_OEM_DATA_SUPPORT)
6767/**
6768 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6769 * wifi_pos api to get oem data caps
6770 * @dev: net device upon which the request was received
6771 * @info: ioctl request information
6772 * @wrqu: ioctl request data
6773 * @extra: ioctl data payload
6774 *
6775 * Return: 0 for success, negative errno value on failure
6776 */
6777static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6778 struct iw_request_info *info,
6779 union iwreq_data *wrqu, char *extra)
6780{
6781 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6782}
6783#elif defined(WIFI_POS_CONVERGED)
6784static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6785 struct iw_request_info *info,
6786 union iwreq_data *wrqu, char *extra)
6787{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006788 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006789 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006790
Dustin Brown05d81302018-09-11 16:49:22 -07006791 return os_if_wifi_pos_populate_caps(hdd_ctx->psoc,
Naveen Rawat910726a2017-03-06 11:42:51 -08006792 (struct wifi_pos_driver_caps *)extra);
6793}
6794#else
6795static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6796 struct iw_request_info *info,
6797 union iwreq_data *wrqu, char *extra)
6798{
6799 return -ENOTSUPP;
6800}
6801#endif
6802
Krunal Soni5e483782018-10-25 15:42:44 -07006803#ifdef WLAN_UNIT_TEST
6804static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6805 struct hdd_adapter *adapter,
6806 char *extra)
6807{
6808 QDF_STATUS status;
6809
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006810 status = sme_get_sta_cxn_info(hdd_ctx->mac_handle, adapter->vdev_id,
Krunal Soni5e483782018-10-25 15:42:44 -07006811 extra, WE_MAX_STR_LEN);
6812 if (status != QDF_STATUS_SUCCESS)
6813 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6814 "\nNo active connection");
6815
6816 return 0;
6817}
6818#else
6819static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6820 struct hdd_adapter *adapter,
6821 char *extra)
6822{
6823 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6824 "\nNot supported");
6825 return -ENOTSUPP;
6826}
6827#endif
6828
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006829/**
6830 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6831 * @dev: device upon which the ioctl was received
6832 * @info: ioctl request information
6833 * @wrqu: ioctl request data
6834 * @extra: ioctl extra data
6835 *
6836 * Return: 0 on success, non-zero on error
6837 */
6838static int __iw_get_char_setnone(struct net_device *dev,
6839 struct iw_request_info *info,
6840 union iwreq_data *wrqu, char *extra)
6841{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006842 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006843 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006844 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006845 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006846 int ret;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306847 QDF_STATUS status;
6848 uint8_t value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006849
Dustin Brownfdf17c12018-03-14 12:55:34 -07006850 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306851
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006852 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006853 ret = wlan_hdd_validate_context(hdd_ctx);
6854 if (0 != ret)
6855 return ret;
6856
Jeff Johnson441e1f72017-02-07 08:50:49 -08006857 ret = hdd_check_private_wext_control(hdd_ctx, info);
6858 if (0 != ret)
6859 return ret;
6860
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006861 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006862 switch (sub_cmd) {
6863 case WE_WLAN_VERSION:
6864 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006865 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6866 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006867 break;
6868 }
6869
6870 case WE_GET_STATS:
6871 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006872 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006873 extra, WE_MAX_STR_LEN);
6874 break;
6875 }
6876
Dustin Brownd9322482017-01-09 12:46:03 -08006877 case WE_GET_SUSPEND_RESUME_STATS:
6878 {
6879 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6880 WE_MAX_STR_LEN);
6881 if (ret >= 0) {
6882 wrqu->data.length = ret;
6883 ret = 0;
6884 }
6885
6886 break;
6887 }
6888
Govind Singha471e5e2015-10-12 17:11:14 +05306889 case WE_LIST_FW_PROFILE:
6890 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6891 extra, WE_MAX_STR_LEN);
6892 break;
6893
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006894 /* The case prints the current state of the HDD, SME, CSR, PE,
6895 * TL it can be extended for WDI Global State as well. And
6896 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6897 * and P2P_GO have not been added as of now.
6898 */
6899 case WE_GET_STATES:
6900 {
6901 int buf = 0, len = 0;
6902 int adapter_num = 0;
6903 int count = 0, check = 1;
6904
Jeff Johnsond377dce2017-10-04 10:32:42 -07006905 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006906
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006907 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006908 struct hdd_adapter *stat_adapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006909
6910 /* Print wlan0 or p2p0 states based on the adapter_num
6911 * by using the correct adapter
6912 */
6913 while (adapter_num < 2) {
6914 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006915 stat_adapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006916 buf =
6917 scnprintf(extra + len,
6918 WE_MAX_STR_LEN - len,
6919 "\n\n wlan0 States:-");
6920 len += buf;
6921 } else if (P2P_ADAPTER == adapter_num) {
6922 buf =
6923 scnprintf(extra + len,
6924 WE_MAX_STR_LEN - len,
6925 "\n\n p2p0 States:-");
6926 len += buf;
6927
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006928 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006929 buf =
6930 scnprintf(extra + len,
6931 WE_MAX_STR_LEN -
6932 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006933 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006934 len += buf;
6935 break;
6936 }
6937
6938 /* Printing p2p0 states only in the
6939 * case when the device is configured
6940 * as a p2p_client
6941 */
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006942 stat_adapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006943 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006944 QDF_P2P_CLIENT_MODE);
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006945 if (!stat_adapter) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006946 buf =
6947 scnprintf(extra + len,
6948 WE_MAX_STR_LEN -
6949 len,
6950 "\n Device not configured as P2P_CLIENT.");
6951 len += buf;
6952 break;
6953 }
6954 }
6955
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006956 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006957 buf = scnprintf(extra + len,
6958 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006959 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006960 len += buf;
6961 break;
6962 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006963 sta_ctx =
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006964 WLAN_HDD_GET_STATION_CTX_PTR(stat_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006965
6966
6967 buf =
6968 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6969 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006970 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006971 "\n Neighbour Roam State - %s"
6972 "\n CSR State - %s"
6973 "\n CSR Substate - %s",
6974 hdd_connection_state_string
Jeff Johnsone7951512019-02-27 10:02:51 -08006975 (sta_ctx->conn_info.conn_state),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006976 mac_trace_get_neighbour_roam_state
6977 (sme_get_neighbor_roam_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006978 (mac_handle, stat_adapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006979 mac_trace_getcsr_roam_state
6980 (sme_get_current_roam_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006981 (mac_handle, stat_adapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006982 mac_trace_getcsr_roam_sub_state
6983 (sme_get_current_roam_sub_state
Jeff Johnsone8e148f2019-03-23 12:25:52 -07006984 (mac_handle, stat_adapter->vdev_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006985 );
6986 len += buf;
6987 adapter_num++;
6988 }
6989
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006990 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006991 /* Printing Lim State starting with global lim states */
6992 buf =
6993 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006994 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006995 "\n Global Sme State - %s "
6996 "\n Global mlm State - %s " "\n",
6997 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006998 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006999 mac_trace_get_lim_mlm_state
Jeff Johnson71d465a2018-12-05 11:13:30 -08007000 (sme_get_lim_mlm_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007001 );
7002 len += buf;
7003
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007004 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007005 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007006 buf =
7007 scnprintf(extra + len,
7008 WE_MAX_STR_LEN -
7009 len,
7010 "\n Lim Valid Session %d:-"
7011 "\n PE Sme State - %s "
7012 "\n PE Mlm State - %s "
7013 "\n", check,
7014 mac_trace_get_lim_sme_state
7015 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007016 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007017 mac_trace_get_lim_mlm_state
7018 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007019 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007020 );
7021
7022 len += buf;
7023 check++;
7024 }
7025 count++;
7026 }
7027 }
7028
7029 wrqu->data.length = strlen(extra) + 1;
7030 break;
7031 }
7032
7033 case WE_GET_CFG:
7034 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007035 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007036 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007037 extra,
7038 QCSAP_IOCTL_MAX_STR_LEN);
7039 wrqu->data.length = strlen(extra) + 1;
7040 break;
7041 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007042 case WE_GET_RSSI:
7043 {
7044 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007045
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007046 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007047 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
7048 wrqu->data.length = strlen(extra) + 1;
7049 break;
7050 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007051
7052 case WE_GET_WMM_STATUS:
7053 {
7054 snprintf(extra, WE_MAX_STR_LEN,
7055 "\nDir: 0=up, 1=down, 3=both\n"
7056 "|------------------------|\n"
7057 "|AC | ACM |Admitted| Dir |\n"
7058 "|------------------------|\n"
7059 "|VO | %d | %3s | %d |\n"
7060 "|VI | %d | %3s | %d |\n"
7061 "|BE | %d | %3s | %d |\n"
7062 "|BK | %d | %3s | %d |\n"
7063 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007064 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007065 ac_status[SME_AC_VO].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007066 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007067 ac_status[SME_AC_VO].
Jeff Johnsona5548972019-03-09 14:22:18 -08007068 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007069 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007070 ac_status[SME_AC_VO].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007071 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007072 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007073 ac_status[SME_AC_VI].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007074 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007075 ac_status[SME_AC_VI].
Jeff Johnsona5548972019-03-09 14:22:18 -08007076 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007077 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007078 ac_status[SME_AC_VI].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007079 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007080 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007081 ac_status[SME_AC_BE].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007082 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007083 ac_status[SME_AC_BE].
Jeff Johnsona5548972019-03-09 14:22:18 -08007084 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007085 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007086 ac_status[SME_AC_BE].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007087 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007088 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007089 ac_status[SME_AC_BK].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007090 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007091 ac_status[SME_AC_BK].
Jeff Johnsona5548972019-03-09 14:22:18 -08007092 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007093 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007094 ac_status[SME_AC_BK].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007095 ts_info.direction);
7096
7097 wrqu->data.length = strlen(extra) + 1;
7098 break;
7099 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07007100
7101 case WE_GET_BA_AGEING_TIMEOUT:
7102 {
7103 uint8_t ac_cat = 4;
Srinivas Girigowda167ea822019-03-21 17:19:30 -07007104 uint32_t duration[QCA_WLAN_AC_ALL], i;
Krunal Soni6c3859f2018-06-01 19:57:40 -07007105 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
7106
7107 if (!soc) {
7108 hdd_err("Invalid SOC handle");
7109 break;
7110 }
7111
7112 for (i = 0; i < ac_cat; i++)
7113 cdp_get_ba_timeout(soc, i, &duration[i]);
7114
7115 snprintf(extra, WE_MAX_STR_LEN,
7116 "\n|------------------------------|\n"
7117 "|AC | BA aging timeout duration |\n"
7118 "|--------------------------------|\n"
7119 "|VO | %d |\n"
7120 "|VI | %d |\n"
7121 "|BE | %d |\n"
7122 "|BK | %d |\n"
7123 "|--------------------------------|\n",
7124 duration[3], duration[2], duration[1], duration[0]);
7125
7126 wrqu->data.length = strlen(extra) + 1;
7127 break;
7128 }
7129
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007130 case WE_GET_CHANNEL_LIST:
7131 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307132 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007133 uint8_t i, len;
7134 char *buf;
Wu Gaoaa155142019-01-14 15:09:26 +08007135 uint8_t ubuf[CFG_COUNTRY_CODE_LEN];
7136 uint8_t ubuf_len = CFG_COUNTRY_CODE_LEN;
Srinivas Girigowdac231df62017-03-24 18:27:57 -07007137 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007138
7139 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05307140 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007141 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307142 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007143 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007144 return -EINVAL;
7145 }
7146 buf = extra;
7147 /*
Wu Gao0821b0d2019-01-11 17:31:11 +08007148 * Maximum channels = CFG_VALID_CHANNEL_LIST_LEN.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007149 * Maximum buffer needed = 5 * number of channels.
7150 * Check ifsufficient buffer is available and then
7151 * proceed to fill the buffer.
7152 */
7153 if (WE_MAX_STR_LEN <
Wu Gao0821b0d2019-01-11 17:31:11 +08007154 (5 * CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007155 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007156 return -EINVAL;
7157 }
7158 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
7159 channel_list.num_channels);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007160 if (QDF_STATUS_SUCCESS == sme_get_country_code(mac_handle,
7161 ubuf,
7162 &ubuf_len)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007163 /* Printing Country code in getChannelList */
7164 for (i = 0; i < (ubuf_len - 1); i++)
7165 len += scnprintf(buf + len,
7166 WE_MAX_STR_LEN - len,
7167 "%c", ubuf[i]);
7168 }
7169 for (i = 0; i < channel_list.num_channels; i++) {
7170 len +=
7171 scnprintf(buf + len, WE_MAX_STR_LEN - len,
7172 " %u", channel_list.channels[i]);
7173 }
7174 wrqu->data.length = strlen(extra) + 1;
7175
7176 break;
7177 }
7178#ifdef FEATURE_WLAN_TDLS
7179 case WE_GET_TDLS_PEERS:
7180 {
7181 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007182 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007183 WE_MAX_STR_LEN) + 1;
7184 break;
7185 }
7186#endif
7187#ifdef WLAN_FEATURE_11W
7188 case WE_GET_11W_INFO:
7189 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007190 struct csr_roam_profile *roam_profile =
7191 hdd_roam_profile(adapter);
7192
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007193 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007194 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007195
7196 snprintf(extra, WE_MAX_STR_LEN,
7197 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
7198 "\n Number of Unprotected Disassocs %d"
7199 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007200 roam_profile->BSSIDs.bssid->bytes[0],
7201 roam_profile->BSSIDs.bssid->bytes[1],
7202 roam_profile->BSSIDs.bssid->bytes[2],
7203 roam_profile->BSSIDs.bssid->bytes[3],
7204 roam_profile->BSSIDs.bssid->bytes[4],
7205 roam_profile->BSSIDs.bssid->bytes[5],
7206 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07007207 adapter->hdd_stats.hdd_pmf_stats.
7208 num_unprot_disassoc_rx,
7209 adapter->hdd_stats.hdd_pmf_stats.
7210 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007211
7212 wrqu->data.length = strlen(extra) + 1;
7213 break;
7214 }
7215#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007216 case WE_GET_IBSS_STA_INFO:
7217 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07007218 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007219 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007220 int idx = 0;
7221 int length = 0, buf = 0;
7222
Naveen Rawatc45d1622016-07-05 12:20:09 -07007223 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07007224 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnson0a082d92019-03-04 12:25:49 -08007225 sta_ctx->conn_info.sta_id[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007226 buf = snprintf
7227 ((extra + length),
7228 WE_MAX_STR_LEN - length,
7229 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnson0a082d92019-03-04 12:25:49 -08007230 sta_ctx->conn_info.sta_id[idx],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007231 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007232 peer_macaddr[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007233 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007234 peer_macaddr[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007235 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007236 peer_macaddr[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007237 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007238 peer_macaddr[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007239 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007240 peer_macaddr[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007241 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007242 peer_macaddr[idx].bytes[5]
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007243 );
7244 length += buf;
7245 }
7246 }
7247 wrqu->data.length = strlen(extra) + 1;
7248 break;
7249 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007250 case WE_GET_PHYMODE:
7251 {
7252 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007253 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007254 eCsrPhyMode phymode;
Jeff Johnsondbae0172019-03-09 17:01:56 -08007255 enum band_info current_band;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08007256 struct sme_config_params *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007257
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007258 sme_config = qdf_mem_malloc(sizeof(*sme_config));
7259 if (!sme_config) {
7260 hdd_err("Out of memory");
7261 ret = -ENOMEM;
7262 break;
7263 }
7264
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007265 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007266 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007267 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007268 ch_bond24 = true;
7269
7270 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007271 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007272 ch_bond5g = true;
7273
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007274 qdf_mem_free(sme_config);
7275
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007276 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307277 if ((QDF_STATUS_SUCCESS !=
Harprit Chhabada5dff30e2019-03-12 17:56:45 -07007278 ucfg_reg_get_band(hddctx->pdev, &current_band))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007279 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007280 return -EIO;
7281 }
7282
7283 switch (phymode) {
7284 case eCSR_DOT11_MODE_AUTO:
7285 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
7286 break;
7287 case eCSR_DOT11_MODE_11n:
7288 case eCSR_DOT11_MODE_11n_ONLY:
Jeff Johnsondbae0172019-03-09 17:01:56 -08007289 if (current_band == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007290 if (ch_bond24)
7291 snprintf(extra, WE_MAX_STR_LEN,
7292 "11NGHT40");
7293 else
7294 snprintf(extra, WE_MAX_STR_LEN,
7295 "11NGHT20");
Jeff Johnsondbae0172019-03-09 17:01:56 -08007296 } else if (current_band == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007297 if (ch_bond5g)
7298 snprintf(extra, WE_MAX_STR_LEN,
7299 "11NAHT40");
7300 else
7301 snprintf(extra, WE_MAX_STR_LEN,
7302 "11NAHT20");
7303 } else {
7304 snprintf(extra, WE_MAX_STR_LEN, "11N");
7305 }
7306 break;
7307 case eCSR_DOT11_MODE_abg:
7308 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
7309 break;
7310 case eCSR_DOT11_MODE_11a:
7311 snprintf(extra, WE_MAX_STR_LEN, "11A");
7312 break;
7313 case eCSR_DOT11_MODE_11b:
7314 case eCSR_DOT11_MODE_11b_ONLY:
7315 snprintf(extra, WE_MAX_STR_LEN, "11B");
7316 break;
7317 case eCSR_DOT11_MODE_11g:
7318 case eCSR_DOT11_MODE_11g_ONLY:
7319 snprintf(extra, WE_MAX_STR_LEN, "11G");
7320 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007321 case eCSR_DOT11_MODE_11ac:
7322 case eCSR_DOT11_MODE_11ac_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307323 status =
7324 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7325 &value);
7326 if (!QDF_IS_STATUS_SUCCESS(status))
7327 hdd_err("Failed to set channel_width");
7328 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007329 snprintf(extra, WE_MAX_STR_LEN,
7330 "11ACVHT20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307331 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007332 snprintf(extra, WE_MAX_STR_LEN,
7333 "11ACVHT40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307334 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007335 snprintf(extra, WE_MAX_STR_LEN,
7336 "11ACVHT80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307337 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007338 snprintf(extra, WE_MAX_STR_LEN,
7339 "11ACVHT160");
7340 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007341 case eCSR_DOT11_MODE_11ax:
7342 case eCSR_DOT11_MODE_11ax_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307343 status =
7344 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7345 &value);
7346 if (!QDF_IS_STATUS_SUCCESS(status))
7347 hdd_err("Failed to set channel_width");
7348
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007349 /* currently using vhtChannelWidth */
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307350 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007351 snprintf(extra, WE_MAX_STR_LEN,
7352 "11AX_HE_20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307353 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007354 snprintf(extra, WE_MAX_STR_LEN,
7355 "11AX_HE_40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307356 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007357 snprintf(extra, WE_MAX_STR_LEN,
7358 "11AX_HE_80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307359 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007360 snprintf(extra, WE_MAX_STR_LEN,
7361 "11AX_HE_160");
7362 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007363 }
7364
7365 wrqu->data.length = strlen(extra) + 1;
7366 break;
7367 }
7368
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007369 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08007370 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007371 case WE_GET_SNR:
7372 {
7373 int8_t s7snr = 0;
7374 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007375 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07007376 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007377
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007378 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007379 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307380 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007381 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307382
Jeff Johnsond377dce2017-10-04 10:32:42 -07007383 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsona8fef4e2019-03-11 14:38:49 -07007384 if (!hdd_ctx->config->enable_snr_monitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007385 eConnectionState_Associated !=
Jeff Johnsone7951512019-02-27 10:02:51 -08007386 sta_ctx->conn_info.conn_state) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007387 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsona8fef4e2019-03-11 14:38:49 -07007388 hdd_ctx->config->enable_snr_monitoring,
Jeff Johnsone7951512019-02-27 10:02:51 -08007389 sta_ctx->conn_info.conn_state);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007390 return -ENONET;
7391 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007392 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007393 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
7394 wrqu->data.length = strlen(extra) + 1;
7395 break;
7396 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007397
Krunal Soni5e483782018-10-25 15:42:44 -07007398 case WE_GET_STA_CXN_INFO:
7399 ret = hdd_get_sta_cxn_info(hdd_ctx, adapter, extra);
7400 wrqu->data.length = strlen(extra) + 1;
7401 break;
7402
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007403 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007404 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007405 break;
7406 }
Dustin Brownd9322482017-01-09 12:46:03 -08007407
Dustin Browne74003f2018-03-14 12:51:58 -07007408 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08007409 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007410}
7411
7412static int iw_get_char_setnone(struct net_device *dev,
7413 struct iw_request_info *info,
7414 union iwreq_data *wrqu, char *extra)
7415{
Dustin Brown389e5072018-11-08 17:10:01 +05307416 int errno;
7417 struct osif_vdev_sync *vdev_sync;
7418
7419 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7420 if (errno)
7421 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007422
Dustin Brown389e5072018-11-08 17:10:01 +05307423 errno = __iw_get_char_setnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007424
Dustin Brown389e5072018-11-08 17:10:01 +05307425 osif_vdev_sync_op_stop(vdev_sync);
7426
7427 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007428}
7429
7430/**
7431 * iw_setnone_getnone() - Generic "action" private ioctl handler
7432 * @dev: device upon which the ioctl was received
7433 * @info: ioctl request information
7434 * @wrqu: ioctl request data
7435 * @extra: ioctl extra data
7436 *
7437 * Return: 0 on success, non-zero on error
7438 */
7439static int __iw_setnone_getnone(struct net_device *dev,
7440 struct iw_request_info *info,
7441 union iwreq_data *wrqu, char *extra)
7442{
Jeff Johnson3d278b02017-08-29 14:17:47 -07007443 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007444 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007445 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007446 int ret;
7447 int sub_cmd;
7448
Dustin Brownfdf17c12018-03-14 12:55:34 -07007449 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307450
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007451 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007452 ret = wlan_hdd_validate_context(hdd_ctx);
7453 if (0 != ret)
7454 return ret;
7455
Jeff Johnson441e1f72017-02-07 08:50:49 -08007456 ret = hdd_check_private_wext_control(hdd_ctx, info);
7457 if (0 != ret)
7458 return ret;
7459
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007460#ifdef CONFIG_COMPAT
7461 /* this ioctl is a special case where a sub-ioctl is used and both
7462 * the number of get and set args is 0. in this specific case the
7463 * logic in iwpriv places the sub_cmd in the data.flags portion of
7464 * the iwreq. unfortunately the location of this field will be
7465 * different between 32-bit and 64-bit userspace, and the standard
7466 * compat support in the kernel does not handle this case. so we
7467 * need to explicitly handle it here.
7468 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07007469 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007470 struct compat_iw_point *compat_iw_point =
7471 (struct compat_iw_point *)&wrqu->data;
7472 sub_cmd = compat_iw_point->flags;
7473 } else {
7474 sub_cmd = wrqu->data.flags;
7475 }
7476#else
7477 sub_cmd = wrqu->data.flags;
7478#endif
7479
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007480 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007481 switch (sub_cmd) {
Govind Singha471e5e2015-10-12 17:11:14 +05307482 case WE_GET_FW_PROFILE_DATA:
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007483 ret = wma_cli_set_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05307484 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
7485 0, DBG_CMD);
7486 break;
7487
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007488 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007489 hdd_wlan_get_ibss_peer_info_all(adapter);
7490 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007491
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007492 case WE_SET_REASSOC_TRIGGER:
7493 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07007494 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307495 tSirMacAddr bssid;
Jeff Johnson29c78672019-02-26 21:05:53 -08007496 uint32_t roam_id = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307497 uint8_t operating_ch =
Jeff Johnson8626e932019-02-27 18:35:22 -08007498 adapter->session.station.conn_info.channel;
Jeff Johnson9ff16952019-02-26 20:58:44 -08007499 tCsrRoamModifyProfileFields mod_fields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007500
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007501 sme_get_modify_profile_fields(mac_handle, adapter->vdev_id,
Jeff Johnson9ff16952019-02-26 20:58:44 -08007502 &mod_fields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307503 if (roaming_offload_enabled(hdd_ctx)) {
7504 qdf_mem_copy(bssid,
Jeff Johnsone04b6992019-02-27 14:06:55 -08007505 &adapter->session.station.conn_info.bssid,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307506 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08007507 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307508 bssid, operating_ch);
7509 } else {
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007510 sme_roam_reassoc(mac_handle, adapter->vdev_id,
Jeff Johnson29c78672019-02-26 21:05:53 -08007511 NULL, mod_fields, &roam_id, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307512 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007513 return 0;
7514 }
7515
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007516 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007517 /*
7518 * 1.OBSS Scan is mandatory while operating in 2.4GHz
7519 * 2.OBSS scan is stopped by Firmware during the disassociation
7520 * 3.OBSS stop comamnd is added for debugging purpose
7521 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007522 if (!mac_handle) {
7523 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007524 return -EINVAL;
7525 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007526 sme_ht40_stop_obss_scan(mac_handle, adapter->vdev_id);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007527 break;
7528
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007529 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007530 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007531 break;
7532 }
Dustin Browne74003f2018-03-14 12:51:58 -07007533 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007534 return ret;
7535}
7536
7537static int iw_setnone_getnone(struct net_device *dev,
7538 struct iw_request_info *info,
7539 union iwreq_data *wrqu, char *extra)
7540{
Dustin Brown389e5072018-11-08 17:10:01 +05307541 int errno;
7542 struct osif_vdev_sync *vdev_sync;
7543
7544 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7545 if (errno)
7546 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007547
Dustin Brown389e5072018-11-08 17:10:01 +05307548 errno = __iw_setnone_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007549
Dustin Brown389e5072018-11-08 17:10:01 +05307550 osif_vdev_sync_op_stop(vdev_sync);
7551
7552 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007553}
7554
Krunal Sonia6e505b2017-01-12 12:25:18 -08007555#ifdef MPC_UT_FRAMEWORK
Liangwei Dong509c3472018-05-30 07:05:59 -04007556static void
7557hdd_policy_mgr_set_hw_mode_ut(struct hdd_context *hdd_ctx,
7558 struct hdd_adapter *adapter, int cmd)
7559{
7560 enum hw_mode_ss_config mac0_ss;
7561 enum hw_mode_bandwidth mac0_bw;
7562 enum hw_mode_ss_config mac1_ss;
7563 enum hw_mode_bandwidth mac1_bw;
7564 enum hw_mode_mac_band_cap mac0_band_cap;
7565 enum hw_mode_dbs_capab dbs;
7566
7567 switch (cmd) {
7568 case 0:
7569 hdd_debug("set hw mode for single mac");
7570 mac0_ss = HW_MODE_SS_2x2;
7571 mac0_bw = HW_MODE_80_MHZ;
7572 mac1_ss = HW_MODE_SS_0x0;
7573 mac1_bw = HW_MODE_BW_NONE;
7574 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7575 dbs = HW_MODE_DBS_NONE;
7576 break;
7577 case 1:
7578 hdd_debug("set hw mode for dual mac");
7579 mac0_ss = HW_MODE_SS_1x1;
7580 mac0_bw = HW_MODE_80_MHZ;
7581 mac1_ss = HW_MODE_SS_1x1;
7582 mac1_bw = HW_MODE_40_MHZ;
7583 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7584 dbs = HW_MODE_DBS;
7585 break;
7586 case 2:
7587 hdd_debug("set hw mode for 2x2 5g + 1x1 2g");
7588 mac0_ss = HW_MODE_SS_2x2;
7589 mac0_bw = HW_MODE_80_MHZ;
7590 mac1_ss = HW_MODE_SS_1x1;
7591 mac1_bw = HW_MODE_40_MHZ;
7592 mac0_band_cap = HW_MODE_MAC_BAND_5G;
7593 dbs = HW_MODE_DBS;
7594 break;
7595 case 3:
7596 hdd_debug("set hw mode for 2x2 2g + 1x1 5g");
7597 mac0_ss = HW_MODE_SS_2x2;
7598 mac0_bw = HW_MODE_40_MHZ;
7599 mac1_ss = HW_MODE_SS_1x1;
7600 mac1_bw = HW_MODE_40_MHZ;
7601 mac0_band_cap = HW_MODE_MAC_BAND_2G;
7602 dbs = HW_MODE_DBS;
7603 break;
7604 default:
7605 hdd_err("unknown cmd %d", cmd);
7606 return;
7607 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007608 policy_mgr_pdev_set_hw_mode(hdd_ctx->psoc, adapter->vdev_id,
Liangwei Dong509c3472018-05-30 07:05:59 -04007609 mac0_ss, mac0_bw, mac1_ss, mac1_bw,
7610 mac0_band_cap, dbs, HW_MODE_AGILE_DFS_NONE,
7611 HW_MODE_SBS_NONE,
7612 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
7613}
7614
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007615static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007616 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007617{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08007618 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08007619 case WE_POLICY_MANAGER_CLIST_CMD:
7620 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007621 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307622 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307623 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7624 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7625 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7626 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307627 return 0;
7628 }
Dustin Brown05d81302018-09-11 16:49:22 -07007629 policy_mgr_incr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007630 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7631 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007632 }
7633 break;
7634
7635 case WE_POLICY_MANAGER_DLIST_CMD:
7636 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007637 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307638 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307639 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307640 return 0;
7641 }
Dustin Brown05d81302018-09-11 16:49:22 -07007642 policy_mgr_decr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007643 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007644 }
7645 break;
7646
7647 case WE_POLICY_MANAGER_ULIST_CMD:
7648 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007649 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307650 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307651 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7652 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7653 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7654 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307655 return 0;
7656 }
Dustin Brown05d81302018-09-11 16:49:22 -07007657 policy_mgr_update_connection_info_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007658 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7659 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007660 }
7661 break;
7662
7663 case WE_POLICY_MANAGER_DBS_CMD:
7664 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007665 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007666 if (apps_args[0] == 0)
7667 wma_set_dbs_capability_ut(0);
7668 else
7669 wma_set_dbs_capability_ut(1);
7670
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007671 if (apps_args[1] >= PM_THROUGHPUT &&
7672 apps_args[1] <= PM_LATENCY) {
Liangwei Dong509c3472018-05-30 07:05:59 -04007673 hdd_debug("setting system pref to [%d]\n",
7674 apps_args[1]);
Krunal Sonie71838d2018-09-27 10:45:05 -07007675 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc,
7676 apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007677 }
7678 }
7679 break;
7680
7681 case WE_POLICY_MANAGER_PCL_CMD:
7682 {
7683 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
7684 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
7685 uint32_t pcl_len = 0, i = 0;
7686
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007687 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007688
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307689 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307690 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307691 return 0;
7692 }
Dustin Brown05d81302018-09-11 16:49:22 -07007693 policy_mgr_get_pcl(hdd_ctx->psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08007694 pcl, &pcl_len,
7695 weight_list, QDF_ARRAY_SIZE(weight_list));
Liangwei Dong509c3472018-05-30 07:05:59 -04007696 hdd_debug("PCL list for role[%d] is {", apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007697 for (i = 0 ; i < pcl_len; i++)
Liangwei Dong509c3472018-05-30 07:05:59 -04007698 hdd_debug(" %d, ", pcl[i]);
7699 hdd_debug("}--------->\n");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007700 }
7701 break;
7702
7703 case WE_POLICY_SET_HW_MODE_CMD:
7704 {
Liangwei Dong509c3472018-05-30 07:05:59 -04007705 hdd_debug("pm_set_hw_mode cmd %d", apps_args[0]);
7706 hdd_policy_mgr_set_hw_mode_ut(hdd_ctx, adapter, apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007707 }
7708 break;
7709
7710 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7711 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007712 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307713 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307714 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307715 return 0;
7716 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07007717 policy_mgr_current_connections_update(
Dustin Brown05d81302018-09-11 16:49:22 -07007718 hdd_ctx->psoc,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007719 adapter->vdev_id, apps_args[0],
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07007720 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007721 }
7722 break;
7723
7724 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7725 {
7726 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007727
Dustin Brown5e89ef82018-03-14 11:50:23 -07007728 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307729 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307730 (apps_args[2] < 0)) {
7731 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307732 return 0;
7733 }
Dustin Brown05d81302018-09-11 16:49:22 -07007734 allow = policy_mgr_allow_concurrency(hdd_ctx->psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08007735 apps_args[0], apps_args[1], apps_args[2]);
Liangwei Dong509c3472018-05-30 07:05:59 -04007736 hdd_debug("allow %d {0 = don't allow, 1 = allow}", allow);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007737 }
7738 break;
7739
7740 case WE_POLICY_MANAGER_SCENARIO_CMD:
7741 {
7742 clean_report(hdd_ctx);
7743 if (apps_args[0] == 1) {
7744 wlan_hdd_one_connection_scenario(hdd_ctx);
7745 } else if (apps_args[0] == 2) {
7746 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007747 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007748 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007749 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007750 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007751 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007752 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007753 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007754 } else if (apps_args[0] == 3) {
7755 /* MCC on same band with 2x2 same mac*/
7756 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007757 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007758 /* MCC on diff band with 2x2 same mac*/
7759 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007760 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007761 /* MCC on diff band with 1x1 diff mac */
7762 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007763 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007764 /* MCC on diff band with 1x1 same mac */
7765 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007766 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007767 /* SCC on same band with 2x2 same mac */
7768 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007769 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007770 /* SCC on same band with 1x1 same mac */
7771 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007772 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007773 /* MCC on same band with 2x2 same mac */
7774 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007775 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007776 /* MCC on same band with 1x1 same mac */
7777 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007778 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007779 }
7780 print_report(hdd_ctx);
7781 }
7782 break;
7783 }
7784 return 0;
7785}
7786#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007787static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007788 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007789{
7790 return 0;
7791}
7792#endif
7793
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007794/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007795 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7796 * @hdd_ctx: hdd_context
7797 * @num_args: input args number
7798 * @apps_args: args data ptr
7799 *
7800 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7801 *
7802 * Return: void
7803 */
7804#if WLAN_DEBUG
7805static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7806 int num_args, int *apps_args)
7807{
7808 struct ch_avoid_ind_type ch_avoid;
7809 int cnt = 0, i;
7810
7811 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7812 num_args % 2 != 0)
7813 return;
7814 hdd_info("simulate ch avoid num_args %d", num_args);
7815 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7816 ch_avoid.avoid_freq_range[cnt].start_freq =
7817 apps_args[i];
7818 ch_avoid.avoid_freq_range[cnt].end_freq =
7819 apps_args[++i];
7820
7821 hdd_info("simulate ch avoid [%d %d]",
7822 ch_avoid.avoid_freq_range[cnt].start_freq,
7823 ch_avoid.avoid_freq_range[cnt].end_freq);
7824 cnt++;
7825 }
7826 ch_avoid.ch_avoid_range_cnt = cnt;
Dustin Brown05d81302018-09-11 16:49:22 -07007827 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->psoc, &ch_avoid);
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007828}
7829#else
7830static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7831 int num_args, int *apps_args)
7832{
7833}
7834#endif
7835/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007836 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7837 * @dev: device upon which the ioctl was received
7838 * @info: ioctl request information
7839 * @wrqu: ioctl request data
7840 * @extra: ioctl extra data
7841 *
7842 * This is an SSR-protected generic handler for private ioctls which
7843 * take multiple arguments. Note that this implementation is also
7844 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7845 * interfaces.
7846 *
7847 * Return: 0 on success, non-zero on error
7848 */
7849static int __iw_set_var_ints_getnone(struct net_device *dev,
7850 struct iw_request_info *info,
7851 union iwreq_data *wrqu, char *extra)
7852{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007853 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007854 mac_handle_t mac_handle;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007855 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007856 int sub_cmd;
7857 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007858 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007859 int ret, num_args;
chenguoaa7c90c2018-05-24 17:08:47 +08007860 void *soc = NULL;
7861 struct cdp_pdev *pdev = NULL;
7862 struct cdp_vdev *vdev = NULL;
7863 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007864
Dustin Brownfdf17c12018-03-14 12:55:34 -07007865 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307866
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007867 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007868 ret = wlan_hdd_validate_context(hdd_ctx);
7869 if (0 != ret)
7870 return ret;
7871
Jeff Johnson441e1f72017-02-07 08:50:49 -08007872 ret = hdd_check_private_wext_control(hdd_ctx, info);
7873 if (0 != ret)
7874 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007875
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007876 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007877 sub_cmd = wrqu->data.flags;
7878 num_args = wrqu->data.length;
7879
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007880 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007881
7882 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007883 case WE_IBSS_GET_PEER_INFO:
7884 {
7885 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007886 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007887 }
7888 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007889
7890 case WE_P2P_NOA_CMD:
7891 {
Jeff Johnson156cd082019-03-10 21:49:54 -07007892 struct p2p_app_set_ps p2p_noa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007893
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007894 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007895 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
Dustin Brown458027c2018-10-19 12:26:27 -07007896 qdf_opmode_str(adapter->device_mode),
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007897 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007898 return -EINVAL;
7899 }
7900
Jeff Johnson156cd082019-03-10 21:49:54 -07007901 p2p_noa.opp_ps = apps_args[0];
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007902 p2p_noa.ct_window = apps_args[1];
Jeff Johnson156cd082019-03-10 21:49:54 -07007903 p2p_noa.duration = apps_args[2];
7904 p2p_noa.interval = apps_args[3];
7905 p2p_noa.count = apps_args[4];
7906 p2p_noa.single_noa_duration = apps_args[5];
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007907 p2p_noa.ps_selection = apps_args[6];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007908
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07007909 hdd_debug("P2P_NOA_ATTR:opp ps %d ct window %d duration %d interval %d count %d single noa duration %d ps selection %x",
Jeff Johnson99bac312016-06-28 10:38:18 -07007910 apps_args[0], apps_args[1], apps_args[2],
7911 apps_args[3], apps_args[4],
7912 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007913
Jeff Johnson156cd082019-03-10 21:49:54 -07007914 hdd_set_p2p_ps(dev, &p2p_noa);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007915
7916 }
7917 break;
7918
7919 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7920 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007921 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007922 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307923 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007924 }
7925 break;
7926
7927 case WE_MTRACE_DUMP_CMD:
7928 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007929 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007930 apps_args[0], apps_args[1],
7931 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007932 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007933 apps_args[1], apps_args[2],
7934 apps_args[3]);
7935
7936 }
7937 break;
7938
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007939 case WE_POLICY_MANAGER_CINFO_CMD:
7940 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007941 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007942 uint32_t i = 0, len = 0;
7943
Krunal Sonia6e505b2017-01-12 12:25:18 -08007944 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007945 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007946 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007947 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007948 pr_info("|table_index[%d]\t\t\n", i);
7949 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
7950 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
7951 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7952 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7953 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7954 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7955 pr_info("+--------------------------+\n");
7956 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007957 }
7958 }
7959 break;
7960
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007961 case WE_UNIT_TEST_CMD:
7962 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007963 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007964
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007965 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7966 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007967 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007968 return -EINVAL;
7969 }
Sourav Mohapatraea7210b2018-11-16 16:58:52 +05307970 if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307971 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007972 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007973 return -EINVAL;
7974 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007975 status = sme_send_unit_test_cmd(adapter->vdev_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007976 apps_args[0],
7977 apps_args[1],
7978 &apps_args[2]);
7979 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007980 hdd_err("sme_send_unit_test_cmd returned %d", status);
7981 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007982 }
7983 }
7984 break;
7985#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7986 case WE_LED_FLASHING_PARAM:
7987 {
7988 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007989
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007990 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007991 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007992 return -EINVAL;
7993 }
7994 for (i = 0; i < num_args; i++) {
7995 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007996 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007997 return -EINVAL;
7998 }
7999 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008000 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008001 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008002 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008003 1, apps_args[2], apps_args[3]);
8004 }
8005 break;
8006#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05308007 case WE_SET_PKTLOG:
8008 {
8009 int ret;
8010
8011 if (num_args < 1 || num_args > 2) {
8012 hdd_err("pktlog: either 1 or 2 parameters are required");
8013 return -EINVAL;
8014 }
8015
8016 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
8017 apps_args[1]);
8018 if (ret)
8019 return ret;
8020 break;
8021 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05308022 case WE_MAC_PWR_DEBUG_CMD:
8023 {
8024 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05308025 int i, j;
8026
8027 if (num_args < 3) {
8028 hdd_err("number of arguments can't be null %d",
8029 num_args);
8030 return -EINVAL;
8031 }
8032 if (num_args - 3 != apps_args[2]) {
8033 hdd_err("arg list of size %d doesn't match num_args %d",
8034 num_args-3, apps_args[2]);
8035 return -EINVAL;
8036 }
8037 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
8038 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
8039 hdd_err("Invalid MODULE ID %d", apps_args[1]);
8040 return -EINVAL;
8041 }
8042 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
8043 hdd_err("Too Many args %d", apps_args[2]);
8044 return -EINVAL;
8045 }
8046 mac_pwr_dbg_args.pdev_id = apps_args[0];
8047 mac_pwr_dbg_args.module_id = apps_args[1];
8048 mac_pwr_dbg_args.num_args = apps_args[2];
8049
8050 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
8051 mac_pwr_dbg_args.args[i] = apps_args[j];
8052
8053 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008054 sme_process_mac_pwr_dbg_cmd(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008055 adapter->vdev_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05308056 &mac_pwr_dbg_args)) {
8057 return -EINVAL;
8058 }
8059 }
8060 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08008061 case WE_POLICY_MANAGER_CLIST_CMD:
8062 case WE_POLICY_MANAGER_DLIST_CMD:
8063 case WE_POLICY_MANAGER_ULIST_CMD:
8064 case WE_POLICY_MANAGER_DBS_CMD:
8065 case WE_POLICY_MANAGER_PCL_CMD:
8066 case WE_POLICY_SET_HW_MODE_CMD:
8067 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
8068 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
8069 case WE_POLICY_MANAGER_SCENARIO_CMD:
8070 {
Krunal Soni3de68532018-09-05 12:16:58 -07008071 if (!hdd_ctx->config->is_unit_test_framework_enabled) {
8072 hdd_warn_rl("UT framework is disabled");
8073 return -EINVAL;
8074 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008075 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Soni3de68532018-09-05 12:16:58 -07008076 sub_cmd, apps_args);
Krunal Sonia6e505b2017-01-12 12:25:18 -08008077 }
8078 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08008079 case WE_SET_CHAN_AVOID:
8080 {
8081 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
8082 }
8083 break;
chenguoaa7c90c2018-05-24 17:08:47 +08008084 case WE_SET_TXRX_STATS:
8085 {
8086 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008087 adapter->vdev_id);
chenguoaa7c90c2018-05-24 17:08:47 +08008088
8089 if (ret != 0) {
8090 hdd_err("Invalid handles");
8091 break;
8092 }
8093
8094 req.stats = apps_args[0];
8095 /* default value of secondary parameter is 0(mac_id) */
8096 req.mac_id = apps_args[1];
8097
8098 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
8099 req.stats, req.mac_id);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008100 if (apps_args[0] == CDP_TXRX_STATS_28) {
Jeff Johnson457c2422019-02-27 13:56:04 -08008101 if (sta_ctx->conn_info.is_authenticated) {
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008102 hdd_debug("ap mac addr: %pM",
Jeff Johnsone04b6992019-02-27 14:06:55 -08008103 (void *)&sta_ctx->conn_info.bssid);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008104 req.peer_addr =
Jeff Johnsone04b6992019-02-27 14:06:55 -08008105 (char *)&sta_ctx->conn_info.bssid;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008106 }
8107 }
chenguoaa7c90c2018-05-24 17:08:47 +08008108 ret = cdp_txrx_stats_request(soc, vdev, &req);
8109 break;
8110 }
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308111#ifdef WLAN_FEATURE_MOTION_DETECTION
8112 case WE_MOTION_DET_CONFIG_PARAM:
8113 {
8114 struct sme_motion_det_cfg motion_det_cfg;
8115
8116 if (num_args != 15) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308117 hdd_err_rl("mt_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308118 return -EINVAL;
8119 }
8120
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008121 motion_det_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308122 motion_det_cfg.time_t1 = apps_args[0];
8123 motion_det_cfg.time_t2 = apps_args[1];
8124 motion_det_cfg.n1 = apps_args[2];
8125 motion_det_cfg.n2 = apps_args[3];
8126 motion_det_cfg.time_t1_gap = apps_args[4];
8127 motion_det_cfg.time_t2_gap = apps_args[5];
8128 motion_det_cfg.coarse_K = apps_args[6];
8129 motion_det_cfg.fine_K = apps_args[7];
8130 motion_det_cfg.coarse_Q = apps_args[8];
8131 motion_det_cfg.fine_Q = apps_args[9];
8132 motion_det_cfg.md_coarse_thr_high = apps_args[10];
8133 motion_det_cfg.md_fine_thr_high = apps_args[11];
8134 motion_det_cfg.md_coarse_thr_low = apps_args[12];
8135 motion_det_cfg.md_fine_thr_low = apps_args[13];
8136 adapter->motion_detection_mode = apps_args[14];
8137 sme_motion_det_config(hdd_ctx->mac_handle, &motion_det_cfg);
8138 }
8139 break;
8140 case WE_MOTION_DET_BASE_LINE_CONFIG_PARAM:
8141 {
8142 struct sme_motion_det_base_line_cfg motion_det_base_line_cfg;
8143
8144 if (num_args != 4) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308145 hdd_err_rl("mt_bl_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308146 return -EINVAL;
8147 }
8148
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008149 motion_det_base_line_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308150 motion_det_base_line_cfg.bl_time_t = apps_args[0];
8151 motion_det_base_line_cfg.bl_packet_gap = apps_args[1];
8152 motion_det_base_line_cfg.bl_n = apps_args[2];
8153 motion_det_base_line_cfg.bl_num_meas = apps_args[3];
8154 sme_motion_det_base_line_config(hdd_ctx->mac_handle,
8155 &motion_det_base_line_cfg);
8156 }
8157 break;
8158#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308159#ifdef FW_THERMAL_THROTTLE_SUPPORT
8160 case WE_SET_THERMAL_THROTTLE_CFG:
8161 {
8162 QDF_STATUS status;
8163
8164 if (num_args != 7) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308165 hdd_err_rl("set_thermal_cfg: Invalid no of args");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308166 return -EINVAL;
8167 }
8168
8169 /* Check for valid inputs */
8170 if (apps_args[0] < 0 || apps_args[0] > 1 || apps_args[1] < 0 ||
8171 apps_args[2] < 0 || apps_args[2] > 100 ||
8172 apps_args[3] < 0 || apps_args[3] > 3 || apps_args[4] < 0 ||
8173 apps_args[5] < 0 || apps_args[6] < 0 ||
8174 apps_args[5] <= apps_args[4])
8175 return -EINVAL;
8176
8177 status = sme_set_thermal_throttle_cfg(hdd_ctx->mac_handle,
8178 apps_args[0],
8179 apps_args[1],
8180 apps_args[2],
8181 apps_args[3],
8182 apps_args[6]);
8183 if (QDF_IS_STATUS_ERROR(status))
8184 return qdf_status_to_os_return(status);
8185
8186 if (!apps_args[6]) {
8187 status = sme_set_thermal_mgmt(hdd_ctx->mac_handle,
8188 apps_args[4],
8189 apps_args[5]);
8190 if (QDF_IS_STATUS_ERROR(status))
8191 return qdf_status_to_os_return(status);
8192 }
8193 break;
8194 }
8195#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008196 default:
8197 {
Jeff Johnson99bac312016-06-28 10:38:18 -07008198 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008199 }
8200 break;
8201 }
Dustin Browne74003f2018-03-14 12:51:58 -07008202 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008203 return 0;
8204}
8205
8206/**
8207 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
8208 * @dev: pointer to net_device structure
8209 * @info: pointer to iw_request_info structure
8210 * @wrqu: pointer to iwreq_data
8211 * @extra; extra
8212 *
8213 * Return: 0 on success, error number otherwise
8214 *
8215 */
8216static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
8217 struct iw_request_info *info,
8218 union iwreq_data *wrqu, char *extra)
8219{
8220 union iwreq_data u_priv_wrqu;
8221 int apps_args[MAX_VAR_ARGS] = {0};
Dustin Brown389e5072018-11-08 17:10:01 +05308222 int errno, num_args;
8223 struct osif_vdev_sync *vdev_sync;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008224
Mukul Sharma64a70e82015-11-02 20:05:09 +05308225 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008226 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05308227 return -EPERM;
8228 }
8229
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008230 /* Helper function to get iwreq_data with compat handling. */
8231 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
8232 return -EINVAL;
8233
Jeff Johnsond36fa332019-03-18 13:42:25 -07008234 if (!u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008235 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008236 return -EINVAL;
8237 }
8238
8239 num_args = u_priv_wrqu.data.length;
8240 if (num_args > MAX_VAR_ARGS)
8241 num_args = MAX_VAR_ARGS;
8242
8243 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
Dustin Brown389e5072018-11-08 17:10:01 +05308244 sizeof(int) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008245 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008246 return -EFAULT;
8247 }
8248
Dustin Brown389e5072018-11-08 17:10:01 +05308249 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8250 if (errno)
8251 return errno;
8252
Dustin Brown389e5072018-11-08 17:10:01 +05308253 errno = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
8254 (char *)&apps_args);
Dustin Brown389e5072018-11-08 17:10:01 +05308255
8256 osif_vdev_sync_op_stop(vdev_sync);
8257
8258 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008259}
8260
8261/**
8262 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
8263 * @dev: device upon which the ioctl was received
8264 * @info: ioctl request information
8265 * @wrqu: ioctl request data
8266 * @extra: ioctl extra data
8267 *
8268 * This is a generic handler for private ioctls which take multiple
8269 * arguments. Note that this implementation is also somewhat unique
8270 * in that it is shared by both STA-mode and SAP-mode interfaces.
8271 *
8272 * Return: 0 on success, non-zero on error
8273 */
8274int iw_set_var_ints_getnone(struct net_device *dev,
8275 struct iw_request_info *info,
8276 union iwreq_data *wrqu, char *extra)
8277{
Dustin Brown389e5072018-11-08 17:10:01 +05308278 int errno;
8279 struct osif_vdev_sync *vdev_sync;
8280
8281 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8282 if (errno)
8283 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008284
Dustin Brown389e5072018-11-08 17:10:01 +05308285 errno = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
Dustin Brown389e5072018-11-08 17:10:01 +05308286
8287 osif_vdev_sync_op_stop(vdev_sync);
8288
8289 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008290}
8291
8292/**
8293 * iw_add_tspec - Add TSpec private ioctl handler
8294 * @dev: device upon which the ioctl was received
8295 * @info: ioctl request information
8296 * @wrqu: ioctl request data
8297 * @extra: ioctl extra data
8298 *
8299 * Return: 0 on success, non-zero on error
8300 */
8301static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
8302 union iwreq_data *wrqu, char *extra)
8303{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008304 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008305 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008306 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008307 int params[HDD_WLAN_WMM_PARAM_COUNT];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008308 struct sme_qos_wmmtspecinfo tspec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008309 uint32_t handle;
8310 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008311 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008312 int ret;
8313
Dustin Brownfdf17c12018-03-14 12:55:34 -07008314 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308315
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008316 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008317 ret = wlan_hdd_validate_context(hdd_ctx);
8318 if (0 != ret)
8319 return ret;
8320
Jeff Johnson441e1f72017-02-07 08:50:49 -08008321 ret = hdd_check_private_wext_control(hdd_ctx, info);
8322 if (0 != ret)
8323 return ret;
8324
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008325 /* make sure the application is sufficiently priviledged */
8326 /* note that the kernel will do this for "set" ioctls, but since */
8327 /* this ioctl wants to return status to user space it must be */
8328 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008329 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008330 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008331
8332 /* we must be associated in order to add a tspec */
Jeff Johnsone7951512019-02-27 10:02:51 -08008333 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008334 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008335 return 0;
8336 }
8337 /* since we are defined to be a "get" ioctl, and since the number */
8338 /* of params exceeds the number of params that wireless extensions */
8339 /* will pass down in the iwreq_data, we must copy the "set" params. */
8340 /* We must handle the compat for iwreq_data in 32U/64K environment. */
8341
8342 /* helper function to get iwreq_data with compat handling. */
8343 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008344 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008345 return 0;
8346 }
8347 /* make sure all params are correctly passed to function */
Jeff Johnsond36fa332019-03-18 13:42:25 -07008348 if ((!s_priv_data.pointer) ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008349 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008350 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008351 return 0;
8352 }
8353 /* from user space ourselves */
8354 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
8355 /* hmmm, can't get them */
8356 return -EIO;
8357 }
8358 /* clear the tspec */
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008359 memset(&tspec, 0, sizeof(tspec));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008360
8361 /* validate the handle */
8362 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8363 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8364 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008365 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008366 return 0;
8367 }
8368 /* validate the TID */
8369 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
8370 /* out of range */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008371 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008372 return 0;
8373 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008374 tspec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008375
8376 /* validate the direction */
8377 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
8378 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008379 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008380 break;
8381
8382 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008383 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008384 break;
8385
8386 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008387 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008388 break;
8389
8390 default:
8391 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008392 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008393 return 0;
8394 }
8395
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008396 tspec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008397
8398 /* validate the user priority */
8399 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
8400 /* out of range */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008401 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008402 return 0;
8403 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008404 tspec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
8405 if (0 > tspec.ts_info.up || SME_QOS_WMM_UP_MAX < tspec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008406 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008407 return 0;
8408 }
8409
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008410 hdd_debug("TS_INFO PSB %d UP %d !!!",
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008411 tspec.ts_info.psb, tspec.ts_info.up);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008412
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008413 tspec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
8414 tspec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
8415 tspec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
8416 tspec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
8417 tspec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
8418 tspec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
8419 tspec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
8420 tspec.surplus_bw_allowance =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008421 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008422 tspec.min_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008423 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008424 tspec.max_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008425 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008426 tspec.suspension_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008427 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008428 tspec.inactivity_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008429 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
8430
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008431 tspec.ts_info.burst_size_defn =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008432 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
8433
8434 /* validate the ts info ack policy */
8435 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
Abhinav Kumarab576712018-11-05 14:32:49 +05308436 case TS_INFO_ACK_POLICY_NORMAL_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008437 tspec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008438 break;
8439
Abhinav Kumarab576712018-11-05 14:32:49 +05308440 case TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008441 tspec.ts_info.ack_policy =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008442 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
8443 break;
8444
8445 default:
8446 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008447 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008448 return 0;
8449 }
8450
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008451 *wmm_status = hdd_wmm_addts(adapter, handle, &tspec);
Dustin Browne74003f2018-03-14 12:51:58 -07008452 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008453 return 0;
8454}
8455
8456static int iw_add_tspec(struct net_device *dev,
8457 struct iw_request_info *info,
8458 union iwreq_data *wrqu, char *extra)
8459{
Dustin Brown389e5072018-11-08 17:10:01 +05308460 int errno;
8461 struct osif_vdev_sync *vdev_sync;
8462
8463 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8464 if (errno)
8465 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008466
Dustin Brown389e5072018-11-08 17:10:01 +05308467 errno = __iw_add_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008468
Dustin Brown389e5072018-11-08 17:10:01 +05308469 osif_vdev_sync_op_stop(vdev_sync);
8470
8471 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008472}
8473
8474/**
8475 * iw_del_tspec - Delete TSpec private ioctl handler
8476 * @dev: device upon which the ioctl was received
8477 * @info: ioctl request information
8478 * @wrqu: ioctl request data
8479 * @extra: ioctl extra data
8480 *
8481 * Return: 0 on success, non-zero on error
8482 */
8483static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
8484 union iwreq_data *wrqu, char *extra)
8485{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008486 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008487 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008488 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008489 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008490 uint32_t handle;
8491 int ret;
8492
Dustin Brownfdf17c12018-03-14 12:55:34 -07008493 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308494
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008495 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008496 ret = wlan_hdd_validate_context(hdd_ctx);
8497 if (0 != ret)
8498 return ret;
8499
Jeff Johnson441e1f72017-02-07 08:50:49 -08008500 ret = hdd_check_private_wext_control(hdd_ctx, info);
8501 if (0 != ret)
8502 return ret;
8503
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008504 /* make sure the application is sufficiently priviledged */
8505 /* note that the kernel will do this for "set" ioctls, but since */
8506 /* this ioctl wants to return status to user space it must be */
8507 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008508 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008509 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008510
8511 /* although we are defined to be a "get" ioctl, the params we require */
8512 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8513 /* is no need to copy the params from user space */
8514
8515 /* validate the handle */
8516 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8517 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8518 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008519 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008520 return 0;
8521 }
8522
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008523 *wmm_status = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008524 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008525 return 0;
8526}
8527
8528static int iw_del_tspec(struct net_device *dev,
8529 struct iw_request_info *info,
8530 union iwreq_data *wrqu, char *extra)
8531{
Dustin Brown389e5072018-11-08 17:10:01 +05308532 int errno;
8533 struct osif_vdev_sync *vdev_sync;
8534
8535 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8536 if (errno)
8537 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008538
Dustin Brown389e5072018-11-08 17:10:01 +05308539 errno = __iw_del_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008540
Dustin Brown389e5072018-11-08 17:10:01 +05308541 osif_vdev_sync_op_stop(vdev_sync);
8542
8543 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008544}
8545
8546/**
8547 * iw_get_tspec - Get TSpec private ioctl handler
8548 * @dev: device upon which the ioctl was received
8549 * @info: ioctl request information
8550 * @wrqu: ioctl request data
8551 * @extra: ioctl extra data
8552 *
8553 * Return: 0 on success, non-zero on error
8554 */
8555static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
8556 union iwreq_data *wrqu, char *extra)
8557{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008558 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008559 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008560 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008561 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008562 uint32_t handle;
8563 int ret;
8564
Dustin Brownfdf17c12018-03-14 12:55:34 -07008565 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308566
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008567 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008568 ret = wlan_hdd_validate_context(hdd_ctx);
8569 if (0 != ret)
8570 return ret;
8571
Jeff Johnson441e1f72017-02-07 08:50:49 -08008572 ret = hdd_check_private_wext_control(hdd_ctx, info);
8573 if (0 != ret)
8574 return ret;
8575
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008576 /* although we are defined to be a "get" ioctl, the params we require */
8577 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8578 /* is no need to copy the params from user space */
8579
8580 /* validate the handle */
8581 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8582 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8583 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008584 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008585 return 0;
8586 }
8587
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008588 *wmm_status = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008589 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008590 return 0;
8591}
8592
8593static int iw_get_tspec(struct net_device *dev,
8594 struct iw_request_info *info,
8595 union iwreq_data *wrqu, char *extra)
8596{
Dustin Brown389e5072018-11-08 17:10:01 +05308597 int errno;
8598 struct osif_vdev_sync *vdev_sync;
8599
8600 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8601 if (errno)
8602 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008603
Dustin Brown389e5072018-11-08 17:10:01 +05308604 errno = __iw_get_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008605
Dustin Brown389e5072018-11-08 17:10:01 +05308606 osif_vdev_sync_op_stop(vdev_sync);
8607
8608 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008609}
8610
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008611/**
8612 * iw_set_fties - Set FT IEs private ioctl handler
8613 * @dev: device upon which the ioctl was received
8614 * @info: ioctl request information
8615 * @wrqu: ioctl request data
8616 * @extra: ioctl extra data
8617 *
8618 * Each time the supplicant has the auth_request or reassoc request
8619 * IEs ready they are pushed to the driver. The driver will in turn
8620 * use it to send out the auth req and reassoc req for 11r FT Assoc.
8621 *
8622 * Return: 0 on success, non-zero on error
8623 */
8624static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
8625 union iwreq_data *wrqu, char *extra)
8626{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008627 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008628 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008629 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008630 int ret;
8631
Dustin Brownfdf17c12018-03-14 12:55:34 -07008632 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308633
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008634 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008635 ret = wlan_hdd_validate_context(hdd_ctx);
8636 if (0 != ret)
8637 return ret;
8638
Jeff Johnson441e1f72017-02-07 08:50:49 -08008639 ret = hdd_check_private_wext_control(hdd_ctx, info);
8640 if (0 != ret)
8641 return ret;
8642
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008643 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008644 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008645 return -EINVAL;
8646 }
Jeff Johnsond36fa332019-03-18 13:42:25 -07008647 if (!wrqu->data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008648 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008649 return -EINVAL;
8650 }
8651 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsone7951512019-02-27 10:02:51 -08008652 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008653 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008654 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008655 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008656 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008657 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008658
8659 /* Pass the received FT IEs to SME */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008660 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->vdev_id,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008661 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07008662 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008663 return 0;
8664}
8665
8666static int iw_set_fties(struct net_device *dev,
8667 struct iw_request_info *info,
8668 union iwreq_data *wrqu, char *extra)
8669{
Dustin Brown389e5072018-11-08 17:10:01 +05308670 int errno;
8671 struct osif_vdev_sync *vdev_sync;
8672
8673 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8674 if (errno)
8675 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008676
Dustin Brown389e5072018-11-08 17:10:01 +05308677 errno = __iw_set_fties(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008678
Dustin Brown389e5072018-11-08 17:10:01 +05308679 osif_vdev_sync_op_stop(vdev_sync);
8680
8681 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008682}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008683
Dustin Brown0cbc7572016-12-16 13:54:40 -08008684/**
8685 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
8686 * @dev: device upon which the ioctl was received
8687 * @info: ioctl request information
8688 * @wrqu: ioctl request data
8689 * @extra: ioctl extra data
8690 *
Dustin Brown860566f2017-01-31 15:24:43 -08008691 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
8692 * time being to provide guidance in migrating to standard APIs.
8693 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08008694 * Return: 0 on success, non-zero on error
8695 */
8696static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
8697 struct iw_request_info *info,
8698 union iwreq_data *wrqu,
8699 char *extra)
8700{
Dustin Brown860566f2017-01-31 15:24:43 -08008701 hdd_err("\n"
8702 "setMCBCFilter is obsolete. Use the following instead:\n"
8703 "Configure multicast filtering via the ‘ip’ command.\n"
8704 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
8705 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
8706 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
8707 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
8708 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07008709 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08008710}
8711
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008712/**
8713 * iw_set_host_offload - Set host offload ioctl handler
8714 * @dev: device upon which the ioctl was received
8715 * @info: ioctl request information
8716 * @wrqu: ioctl request data
8717 * @extra: ioctl extra data
8718 *
8719 * Return: 0 on success, non-zero on error
8720 */
8721static int __iw_set_host_offload(struct net_device *dev,
8722 struct iw_request_info *info,
8723 union iwreq_data *wrqu, char *extra)
8724{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008725 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008726 struct host_offload_req *user_request =
8727 (struct host_offload_req *) extra;
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008728 struct sir_host_offload_req offload_request;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008729 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008730 int ret;
8731
Dustin Brownfdf17c12018-03-14 12:55:34 -07008732 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308733
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008734 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008735 ret = wlan_hdd_validate_context(hdd_ctx);
8736 if (0 != ret)
8737 return ret;
8738
Jeff Johnson441e1f72017-02-07 08:50:49 -08008739 ret = hdd_check_private_wext_control(hdd_ctx, info);
8740 if (0 != ret)
8741 return ret;
8742
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008743 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008744 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008745 return -EINVAL;
8746 }
8747
8748 /* Debug display of request components. */
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008749 switch (user_request->offloadType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008750 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008751 hdd_debug("Host offload request: ARP reply");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008752 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008753 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008754 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008755 break;
8756 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008757 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07008758 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008759 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008760 hdd_debug(" ARP offload enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008761 hdd_debug(" IP address: %pI4",
8762 user_request->params.hostIpv4Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008763 }
8764 break;
8765
8766 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008767 hdd_debug("Host offload request: neighbor discovery");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008768 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008769 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008770 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008771 break;
8772 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008773 hdd_debug(" enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008774 hdd_debug(" IP address: %pI6c",
8775 user_request->params.hostIpv6Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008776 }
8777 }
8778
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008779 qdf_mem_zero(&offload_request, sizeof(offload_request));
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008780 offload_request.offloadType = user_request->offloadType;
8781 offload_request.enableOrDisable = user_request->enableOrDisable;
8782 qdf_mem_copy(&offload_request.params, &user_request->params,
8783 sizeof(user_request->params));
8784 qdf_mem_copy(&offload_request.bssid, &user_request->bssId.bytes,
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05308785 QDF_MAC_ADDR_SIZE);
8786
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308787 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008788 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008789 adapter->vdev_id, &offload_request)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008790 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008791 return -EINVAL;
8792 }
Dustin Browne74003f2018-03-14 12:51:58 -07008793 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008794 return 0;
8795}
8796
8797static int iw_set_host_offload(struct net_device *dev,
8798 struct iw_request_info *info,
8799 union iwreq_data *wrqu, char *extra)
8800{
Dustin Brown389e5072018-11-08 17:10:01 +05308801 int errno;
8802 struct osif_vdev_sync *vdev_sync;
8803
8804 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8805 if (errno)
8806 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008807
Dustin Brown389e5072018-11-08 17:10:01 +05308808 errno = __iw_set_host_offload(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008809
Dustin Brown389e5072018-11-08 17:10:01 +05308810 osif_vdev_sync_op_stop(vdev_sync);
8811
8812 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008813}
8814
8815/**
8816 * iw_set_keepalive_params - Set keepalive params ioctl handler
8817 * @dev: device upon which the ioctl was received
8818 * @info: ioctl request information
8819 * @wrqu: ioctl request data
8820 * @extra: ioctl extra data
8821 *
8822 * Return: 0 on success, non-zero on error
8823 */
8824static int __iw_set_keepalive_params(struct net_device *dev,
8825 struct iw_request_info *info,
8826 union iwreq_data *wrqu, char *extra)
8827{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008828 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson562ccad2019-02-06 22:10:24 -08008829 struct keep_alive_req *request = (struct keep_alive_req *)extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008830 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008831 int ret;
8832
Dustin Brownfdf17c12018-03-14 12:55:34 -07008833 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308834
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008835 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008836 ret = wlan_hdd_validate_context(hdd_ctx);
8837 if (0 != ret)
8838 return ret;
8839
Jeff Johnson441e1f72017-02-07 08:50:49 -08008840 ret = hdd_check_private_wext_control(hdd_ctx, info);
8841 if (0 != ret)
8842 return ret;
8843
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008844 if (wrqu->data.length != sizeof(*request)) {
8845 hdd_err("Invalid length %d", wrqu->data.length);
8846 return -EINVAL;
8847 }
8848
Wu Gao93816212018-08-31 16:49:54 +08008849 if (request->timePeriod > cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008850 hdd_err("Value of timePeriod %d exceed Max limit %d",
8851 request->timePeriod,
Wu Gao93816212018-08-31 16:49:54 +08008852 cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008853 return -EINVAL;
8854 }
8855
8856 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008857 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Jeff Johnson562ccad2019-02-06 22:10:24 -08008858 request->timePeriod, sizeof(struct keep_alive_req));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008859
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008860 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008861 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008862 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008863 break;
8864
8865 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008866 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008867
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008868 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008869 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8870 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008871
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008872 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008873 request->destIpv4Addr[0], request->destIpv4Addr[1],
8874 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008875
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008876 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -08008877 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008878 break;
8879 }
8880
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008881 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008882
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308883 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008884 sme_set_keep_alive(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008885 adapter->vdev_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008886 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008887 return -EINVAL;
8888 }
Dustin Browne74003f2018-03-14 12:51:58 -07008889 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008890 return 0;
8891}
8892
8893static int iw_set_keepalive_params(struct net_device *dev,
8894 struct iw_request_info *info,
8895 union iwreq_data *wrqu,
8896 char *extra)
8897{
Dustin Brown389e5072018-11-08 17:10:01 +05308898 int errno;
8899 struct osif_vdev_sync *vdev_sync;
8900
8901 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8902 if (errno)
8903 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008904
Dustin Brown389e5072018-11-08 17:10:01 +05308905 errno = __iw_set_keepalive_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008906
Dustin Brown389e5072018-11-08 17:10:01 +05308907 osif_vdev_sync_op_stop(vdev_sync);
8908
8909 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008910}
8911
8912#ifdef WLAN_FEATURE_PACKET_FILTERING
8913/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308914 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8915 * @priv_data: Pointer to the priv data from user space
8916 * @request: Pointer to the struct containing the copied data from user space
8917 *
8918 * Return: False on invalid length, true otherwise
8919 */
8920static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8921 uint16_t length)
8922{
8923 int max_params_size, rcvd_params_size;
8924
8925 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8926 sizeof(struct pkt_filter_param_cfg);
8927
8928 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8929 hdd_err("Less than minimum number of arguments needed");
8930 return false;
8931 }
8932
8933 rcvd_params_size = request->num_params *
8934 sizeof(struct pkt_filter_param_cfg);
8935
8936 if (length != sizeof(struct pkt_filter_cfg) -
8937 max_params_size + rcvd_params_size) {
8938 hdd_err("Arguments do not match the number of params provided");
8939 return false;
8940 }
8941
8942 return true;
8943}
8944
8945/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008946 * __iw_set_packet_filter_params() - set packet filter parameters in target
8947 * @dev: Pointer to netdev
8948 * @info: Pointer to iw request info
8949 * @wrqu: Pointer to data
8950 * @extra: Pointer to extra data
8951 *
8952 * Return: 0 on success, non-zero on error
8953 */
8954static int __iw_set_packet_filter_params(struct net_device *dev,
8955 struct iw_request_info *info,
8956 union iwreq_data *wrqu, char *extra)
8957{
8958 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008959 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008960 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008961 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008962 struct pkt_filter_cfg *request = NULL;
8963
Mukul Sharma472382f2015-11-02 20:16:31 +05308964 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008965 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308966 return -EPERM;
8967 }
8968
Dustin Brownfdf17c12018-03-14 12:55:34 -07008969 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308970
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008971 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8972 ret = wlan_hdd_validate_context(hdd_ctx);
8973 if (0 != ret)
8974 return ret;
8975
Jeff Johnson441e1f72017-02-07 08:50:49 -08008976 ret = hdd_check_private_wext_control(hdd_ctx, info);
8977 if (0 != ret)
8978 return ret;
8979
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008980 if (hdd_priv_get_data(&priv_data, wrqu)) {
8981 hdd_err("failed to get priv data");
8982 return -EINVAL;
8983 }
8984
Jeff Johnsond36fa332019-03-18 13:42:25 -07008985 if ((!priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008986 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008987 priv_data.pointer, priv_data.length);
8988 return -EINVAL;
8989 }
8990
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308991 if (adapter->device_mode != QDF_STA_MODE) {
8992 hdd_err("Packet filter not supported for this mode :%d",
8993 adapter->device_mode);
8994 return -ENOTSUPP;
8995 }
8996
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308997 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8998 hdd_err("Packet filter not supported in disconnected state");
8999 return -ENOTSUPP;
9000 }
9001
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009002 /* copy data using copy_from_user */
9003 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
9004 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05309005
Jeff Johnsond36fa332019-03-18 13:42:25 -07009006 if (!request) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009007 hdd_err("mem_alloc_copy_from_user_helper fail");
9008 return -ENOMEM;
9009 }
9010
Sourav Mohapatra69d07802018-05-31 17:09:05 +05309011 if (!validate_packet_filter_params_size(request, priv_data.length)) {
9012 hdd_err("Invalid priv data length %d", priv_data.length);
9013 qdf_mem_free(request);
9014 return -EINVAL;
9015 }
9016
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05309017 if (request->filter_action == HDD_RCV_FILTER_SET)
9018 hdd_ctx->user_configured_pkt_filter_rules |=
9019 1 << request->filter_id;
9020 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
9021 hdd_ctx->user_configured_pkt_filter_rules &=
9022 ~(1 << request->filter_id);
9023
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009024 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->vdev_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009025
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07009026 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07009027 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009028 return ret;
9029}
9030
9031/**
9032 * iw_set_packet_filter_params() - set packet filter parameters in target
9033 * @dev: Pointer to netdev
9034 * @info: Pointer to iw request info
9035 * @wrqu: Pointer to data
9036 * @extra: Pointer to extra data
9037 *
9038 * Return: 0 on success, non-zero on error
9039 */
9040static int iw_set_packet_filter_params(struct net_device *dev,
9041 struct iw_request_info *info,
9042 union iwreq_data *wrqu, char *extra)
9043{
Dustin Brown389e5072018-11-08 17:10:01 +05309044 int errno;
9045 struct osif_vdev_sync *vdev_sync;
9046
9047 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9048 if (errno)
9049 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009050
Dustin Brown389e5072018-11-08 17:10:01 +05309051 errno = __iw_set_packet_filter_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009052
Dustin Brown389e5072018-11-08 17:10:01 +05309053 osif_vdev_sync_op_stop(vdev_sync);
9054
9055 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009056}
9057#endif
9058
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009059#ifdef QCA_SUPPORT_CP_STATS
9060static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
9061{
9062 return wlan_hdd_get_station_stats(adapter);
9063}
9064#else /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08009065struct hdd_statistics_priv {
9066 tCsrSummaryStatsInfo summary_stats;
9067 tCsrGlobalClassAStatsInfo class_a_stats;
9068 tCsrGlobalClassDStatsInfo class_d_stats;
9069};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009070
Jeff Johnsond37833f2018-03-07 14:22:44 -08009071/**
9072 * hdd_statistics_cb() - "Get statistics" callback function
Jeff Johnsonced658b2018-03-08 09:54:01 -08009073 * @stats: statistics payload
9074 * @context: opaque context originally passed to SME. HDD always passes
9075 * a cookie for the request context
Jeff Johnsond37833f2018-03-07 14:22:44 -08009076 *
9077 * Return: None
9078 */
Jeff Johnsonced658b2018-03-08 09:54:01 -08009079static void hdd_statistics_cb(void *stats, void *context)
Jeff Johnsond37833f2018-03-07 14:22:44 -08009080{
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009081 struct osif_request *request;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009082 struct hdd_statistics_priv *priv;
9083 tCsrSummaryStatsInfo *summary_stats;
9084 tCsrGlobalClassAStatsInfo *class_a_stats;
9085 tCsrGlobalClassDStatsInfo *class_d_stats;
Jeff Johnsond37833f2018-03-07 14:22:44 -08009086
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009087 request = osif_request_get(context);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009088 if (!request) {
9089 hdd_err("Obsolete request");
9090 return;
Jeff Johnsond37833f2018-03-07 14:22:44 -08009091 }
9092
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009093 priv = osif_request_priv(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009094
9095 summary_stats = (tCsrSummaryStatsInfo *)stats;
9096 priv->summary_stats = *summary_stats;
9097
9098 class_a_stats = (tCsrGlobalClassAStatsInfo *)(summary_stats + 1);
9099 priv->class_a_stats = *class_a_stats;
9100
9101 class_d_stats = (tCsrGlobalClassDStatsInfo *)(class_a_stats + 1);
9102 priv->class_d_stats = *class_d_stats;
9103
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009104 osif_request_complete(request);
9105 osif_request_put(request);
Jeff Johnsond37833f2018-03-07 14:22:44 -08009106}
9107
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009108static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009109{
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009110 int ret = 0;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009111 void *cookie;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009112 QDF_STATUS status;
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009113 struct osif_request *request;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009114 struct hdd_station_ctx *sta_ctx;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009115 struct hdd_statistics_priv *priv;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009116 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009117 static const struct osif_request_params params = {
Jeff Johnsonced658b2018-03-08 09:54:01 -08009118 .priv_size = sizeof(*priv),
9119 .timeout_ms = WLAN_WAIT_TIME_STATS,
9120 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009121
Jeff Johnsonced658b2018-03-08 09:54:01 -08009122 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009123 request = osif_request_alloc(&params);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009124 if (!request) {
9125 hdd_warn("request allocation failed");
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009126 return -EINVAL;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009127 }
9128
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009129 cookie = osif_request_cookie(request);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07009130 status = sme_get_statistics(hdd_ctx->mac_handle, eCSR_HDD,
Jeff Johnsonced658b2018-03-08 09:54:01 -08009131 SME_SUMMARY_STATS |
9132 SME_GLOBAL_CLASSA_STATS |
9133 SME_GLOBAL_CLASSD_STATS,
9134 hdd_statistics_cb,
Jeff Johnson0a082d92019-03-04 12:25:49 -08009135 sta_ctx->conn_info.sta_id[0],
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009136 cookie, adapter->vdev_id);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009137
9138 if (QDF_STATUS_SUCCESS != status) {
9139 hdd_warn("Unable to retrieve SME statistics");
9140 goto put_request;
9141 }
9142
9143 /* request was sent -- wait for the response */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009144 ret = osif_request_wait_for_response(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009145 if (ret) {
9146 hdd_err("Failed to wait for statistics, errno %d", ret);
9147 goto put_request;
9148 }
9149
9150 /* update the adapter cache with the fresh results */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009151 priv = osif_request_priv(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009152 adapter->hdd_stats.summary_stat = priv->summary_stats;
9153 adapter->hdd_stats.class_a_stat = priv->class_a_stats;
9154 adapter->hdd_stats.class_d_stat = priv->class_d_stats;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009155
9156put_request:
9157 /*
9158 * either we never sent a request, we sent a request and
9159 * received a response or we sent a request and timed out.
9160 * regardless we are done with the request.
9161 */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009162 osif_request_put(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009163 return ret;
9164}
9165#endif /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08009166
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009167static int __iw_get_statistics(struct net_device *dev,
9168 struct iw_request_info *info,
9169 union iwreq_data *wrqu, char *extra)
9170{
9171 int ret;
9172 char *p;
9173 int tlen;
9174 struct hdd_station_ctx *sta_ctx;
9175 tCsrSummaryStatsInfo *summary_stats;
9176 tCsrGlobalClassAStatsInfo *class_a_stats;
9177 tCsrGlobalClassDStatsInfo *class_d_stats;
9178 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
9179 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9180
9181 hdd_enter_dev(dev);
9182
9183 ret = wlan_hdd_validate_context(hdd_ctx);
9184 if (0 != ret)
9185 return ret;
9186
9187 ret = hdd_check_private_wext_control(hdd_ctx, info);
9188 if (0 != ret)
9189 return ret;
9190
9191 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsone7951512019-02-27 10:02:51 -08009192 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009193 wrqu->data.length = 0;
9194 return 0;
9195 }
9196
9197 hdd_get_wlan_stats(adapter);
9198
9199 summary_stats = &(adapter->hdd_stats.summary_stat);
9200 class_a_stats = &(adapter->hdd_stats.class_a_stat);
9201 class_d_stats = &(adapter->hdd_stats.class_d_stat);
9202
Jeff Johnsonced658b2018-03-08 09:54:01 -08009203 p = extra;
9204 tlen = 0;
9205
9206 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
9207 sizeof(summary_stats->retry_cnt),
9208 &(summary_stats->retry_cnt[0]), tlen);
9209
9210 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
9211 sizeof(summary_stats->multiple_retry_cnt),
9212 &(summary_stats->multiple_retry_cnt[0]), tlen);
9213
9214 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
9215 sizeof(summary_stats->tx_frm_cnt),
9216 &(summary_stats->tx_frm_cnt[0]), tlen);
9217
9218 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
9219 sizeof(summary_stats->rx_frm_cnt),
9220 &(summary_stats->rx_frm_cnt), tlen);
9221
9222 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
9223 sizeof(summary_stats->frm_dup_cnt),
9224 &(summary_stats->frm_dup_cnt), tlen);
9225
9226 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
9227 sizeof(summary_stats->fail_cnt),
9228 &(summary_stats->fail_cnt[0]), tlen);
9229
9230 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
9231 sizeof(summary_stats->rts_fail_cnt),
9232 &(summary_stats->rts_fail_cnt), tlen);
9233
9234 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
9235 sizeof(summary_stats->ack_fail_cnt),
9236 &(summary_stats->ack_fail_cnt), tlen);
9237
9238 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
9239 sizeof(summary_stats->rts_succ_cnt),
9240 &(summary_stats->rts_succ_cnt), tlen);
9241
9242 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
9243 sizeof(summary_stats->rx_discard_cnt),
9244 &(summary_stats->rx_discard_cnt), tlen);
9245
9246 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
9247 sizeof(summary_stats->rx_error_cnt),
9248 &(summary_stats->rx_error_cnt), tlen);
9249
9250 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
9251 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9252 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9253
9254 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
9255 sizeof(class_d_stats->rx_byte_cnt),
9256 &(class_d_stats->rx_byte_cnt), tlen);
9257
9258 FILL_TLV(p, WLAN_STATS_RX_RATE,
9259 sizeof(class_d_stats->rx_rate),
9260 &(class_d_stats->rx_rate), tlen);
9261
9262 /* Transmit rate, in units of 500 kbit/sec */
9263 FILL_TLV(p, WLAN_STATS_TX_RATE,
9264 sizeof(class_a_stats->tx_rate),
9265 &(class_a_stats->tx_rate), tlen);
9266
9267 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
9268 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
9269 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
9270 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
9271 sizeof(class_d_stats->rx_mc_byte_cnt),
9272 &(class_d_stats->rx_mc_byte_cnt), tlen);
9273 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
9274 sizeof(class_d_stats->rx_bc_byte_cnt),
9275 &(class_d_stats->rx_bc_byte_cnt), tlen);
9276 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
9277 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9278 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9279 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
9280 sizeof(class_d_stats->tx_mc_byte_cnt),
9281 &(class_d_stats->tx_mc_byte_cnt), tlen);
9282 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
9283 sizeof(class_d_stats->tx_bc_byte_cnt),
9284 &(class_d_stats->tx_bc_byte_cnt), tlen);
9285
9286 wrqu->data.length = tlen;
9287
Dustin Browne74003f2018-03-14 12:51:58 -07009288 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009289
9290 return 0;
9291}
9292
9293static int iw_get_statistics(struct net_device *dev,
9294 struct iw_request_info *info,
9295 union iwreq_data *wrqu, char *extra)
9296{
Dustin Brown389e5072018-11-08 17:10:01 +05309297 int errno;
9298 struct osif_vdev_sync *vdev_sync;
9299
9300 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9301 if (errno)
9302 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009303
Dustin Brown389e5072018-11-08 17:10:01 +05309304 errno = __iw_get_statistics(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009305
Dustin Brown389e5072018-11-08 17:10:01 +05309306 osif_vdev_sync_op_stop(vdev_sync);
9307
9308 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009309}
9310
9311#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009312/*Max Len for PNO notification*/
9313#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05309314static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
9315 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009316{
Abhishek Singh0481d662017-04-11 18:20:11 +05309317 struct vdev_osif_priv *osif_priv;
9318 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009319 union iwreq_data wrqu;
9320 char buf[MAX_PNO_NOTIFY_LEN + 1];
9321
Abhishek Singh0481d662017-04-11 18:20:11 +05309322 wlan_vdev_obj_lock(vdev);
9323 osif_priv = wlan_vdev_get_ospriv(vdev);
9324 wlan_vdev_obj_unlock(vdev);
9325 if (!osif_priv) {
9326 hdd_err("osif_priv is null");
9327 return;
9328 }
9329
9330 wdev = osif_priv->wdev;
9331 if (!wdev) {
9332 hdd_err("wdev is null");
9333 return;
9334 }
9335
9336 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009337
9338 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05309339 qdf_mem_zero(&wrqu, sizeof(wrqu));
9340 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009341
9342 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05309343 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009344
9345 wrqu.data.pointer = buf;
9346 wrqu.data.length = strlen(buf);
9347
9348 /* send the event */
9349
Abhishek Singh0481d662017-04-11 18:20:11 +05309350 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009351}
9352
9353/**
9354 * __iw_set_pno() - Preferred Network Offload ioctl handler
9355 * @dev: device upon which the ioctl was received
9356 * @info: ioctl request information
9357 * @wrqu: ioctl request data
9358 * @extra: ioctl extra data
9359 *
9360 * This function parses a Preferred Network Offload command
9361 * Input is string based and expected to be of the form:
9362 *
9363 * <enable(1) | disable(0)>
9364 * when enabling:
9365 * <number of networks>
9366 * for each network:
9367 * <ssid_len> <ssid> <authentication> <encryption>
9368 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07009369 * <scan_time (seconds)>
9370 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009371 * <suspend mode>
9372 *
9373 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07009374 * 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 -08009375 *
9376 * this translates into:
9377 * -----------------------------
9378 * enable PNO
9379 * 2 networks
9380 * Network 1:
9381 * test - with authentication type 0 and encryption type 0,
9382 * search on 3 channels: 1 6 and 11,
9383 * SSID bcast type is unknown (directed probe will be sent if
9384 * AP not found) and must meet -40dBm RSSI
9385 * Network 2:
9386 * test2 - with authentication type 4 and encryption type 4,
9387 * search on 6 channels 1, 2, 3, 4, 5 and 6
9388 * bcast type is non-bcast (directed probe will be sent)
9389 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009390 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07009391 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009392 */
9393static int __iw_set_pno(struct net_device *dev,
9394 struct iw_request_info *info,
9395 union iwreq_data *wrqu, char *extra)
9396{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009397 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009398 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05309399 uint8_t value;
9400 struct wlan_objmgr_vdev *vdev;
9401 struct wlan_objmgr_psoc *psoc;
9402 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009403 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309404 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05309405 uint8_t i, j, params;
9406 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309407 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009408
9409 /* request is a large struct, so we make it static to avoid
9410 * stack overflow. This API is only invoked via ioctl, so it
9411 * is serialized by the kernel rtnl_lock and hence does not
9412 * need to be reentrant
9413 */
Abhishek Singh0481d662017-04-11 18:20:11 +05309414 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009415
Dustin Brownfdf17c12018-03-14 12:55:34 -07009416 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009417
9418 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9419 ret = wlan_hdd_validate_context(hdd_ctx);
9420 if (ret)
9421 return ret;
9422
Jeff Johnson441e1f72017-02-07 08:50:49 -08009423 ret = hdd_check_private_wext_control(hdd_ctx, info);
9424 if (0 != ret)
9425 return ret;
9426
Dustin Brown07901ec2018-09-07 11:02:41 -07009427 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->pdev,
9428 dev->dev_addr,
9429 WLAN_LEGACY_MAC_ID);
Abhishek Singh0481d662017-04-11 18:20:11 +05309430 if (!vdev) {
9431 hdd_err("vdev object is NULL");
9432 return -EIO;
9433 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009434
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309435 /* making sure argument string ends with '\0' */
9436 len = (wrqu->data.length + 1);
9437 data = qdf_mem_malloc(len);
9438 if (!data) {
9439 hdd_err("fail to allocate memory %zu", len);
9440 return -EINVAL;
9441 }
9442 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309443 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009444
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05309445 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
9446
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309447 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009448 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309449 ret = -EINVAL;
9450 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009451 }
9452
Abhishek Singh0481d662017-04-11 18:20:11 +05309453 if (!value) {
9454 status = ucfg_scan_pno_stop(vdev);
9455 if (QDF_IS_STATUS_ERROR(status)) {
9456 hdd_err("Failed to disabled PNO");
9457 ret = -EINVAL;
9458 } else {
9459 hdd_debug("PNO scan disabled");
9460 }
9461 goto exit;
9462 }
9463
9464 if (ucfg_scan_get_pno_in_progress(vdev)) {
9465 hdd_debug("pno is already in progress");
9466 ret = -EBUSY;
9467 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009468 }
9469
9470 ptr += offset;
9471
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309472 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009473 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309474 ret = -EINVAL;
9475 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009476 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309477 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009478
Abhishek Singh0481d662017-04-11 18:20:11 +05309479 hdd_debug("PNO enable networks count %d offset %d",
9480 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009481
Abhishek Singh0481d662017-04-11 18:20:11 +05309482 if ((0 == req.networks_cnt) ||
9483 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009484 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05309485 req.networks_cnt);
9486 ret = -EINVAL;
9487 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009488 }
9489
9490 ptr += offset;
9491
Abhishek Singh0481d662017-04-11 18:20:11 +05309492 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009493
Abhishek Singh0481d662017-04-11 18:20:11 +05309494 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009495
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309496 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309497 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009498 &offset);
9499
9500 if (1 != params) {
9501 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309502 ret = -EINVAL;
9503 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009504 }
9505
Abhishek Singh0481d662017-04-11 18:20:11 +05309506 if ((0 == req.networks_list[i].ssid.length) ||
9507 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009508 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309509 req.networks_list[i].ssid.length, i);
9510 ret = -EINVAL;
9511 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009512 }
9513
9514 /* Advance to SSID */
9515 ptr += offset;
9516
Abhishek Singh0481d662017-04-11 18:20:11 +05309517 memcpy(req.networks_list[i].ssid.ssid, ptr,
9518 req.networks_list[i].ssid.length);
9519 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009520
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309521 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309522 &(req.networks_list[i].authentication),
9523 &(req.networks_list[i].encryption),
9524 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009525 &offset);
9526
9527 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009528 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309529 ret = -EINVAL;
9530 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009531 }
9532
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009533 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309534 req.networks_list[i].ssid.length,
9535 req.networks_list[i].ssid.length,
9536 req.networks_list[i].ssid.ssid,
9537 req.networks_list[i].authentication,
9538 req.networks_list[i].encryption,
9539 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009540
9541 /* Advance to channel list */
9542 ptr += offset;
9543
Abhishek Singh0481d662017-04-11 18:20:11 +05309544 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
9545 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009546 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05309547 ret = -EINVAL;
9548 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009549 }
9550
Abhishek Singh0481d662017-04-11 18:20:11 +05309551 if (0 != req.networks_list[i].channel_cnt) {
9552 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009553 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309554 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05309555 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009556 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009557 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309558 ret = -EINVAL;
9559 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009560 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309561 if (!IS_CHANNEL_VALID(value)) {
9562 hdd_err("invalid channel: %hhu", value);
9563 ret = -EINVAL;
9564 goto exit;
9565 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309566 req.networks_list[i].channels[j] =
9567 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009568 /* Advance to next channel number */
9569 ptr += offset;
9570 }
9571 }
9572
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309573 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309574 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009575 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009576 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009577 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309578 ret = -EINVAL;
9579 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009580 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309581 if (req.networks_list[i].bc_new_type > 2) {
9582 hdd_err("invalid bcast nw type: %u",
9583 req.networks_list[i].bc_new_type);
9584 ret = -EINVAL;
9585 goto exit;
9586 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009587
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009588 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309589 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009590
9591 /* Advance to rssi Threshold */
9592 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309593 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309594 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009595 &offset)) {
9596 hdd_err("PNO rssi threshold input is not valid %s",
9597 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309598 ret = -EINVAL;
9599 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009600 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009601 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309602 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009603 /* Advance to next network */
9604 ptr += offset;
9605 } /* For ucNetworkCount */
9606
Abhishek Singh0481d662017-04-11 18:20:11 +05309607 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309608 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05309609 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07009610 ptr += offset;
9611 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309612 if (req.fast_scan_period == 0) {
9613 hdd_err("invalid fast scan period %u",
9614 req.fast_scan_period);
9615 ret = -EINVAL;
9616 goto exit;
9617 }
Dustin Brown43e87292016-10-10 10:38:25 -07009618
Abhishek Singh0481d662017-04-11 18:20:11 +05309619 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309620 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07009621 &offset) > 0)
9622 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05309623 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07009624
Dustin Brown07901ec2018-09-07 11:02:41 -07009625 wlan_pdev_obj_lock(hdd_ctx->pdev);
9626 psoc = wlan_pdev_get_psoc(hdd_ctx->pdev);
9627 wlan_pdev_obj_unlock(hdd_ctx->pdev);
Abhishek Singh0481d662017-04-11 18:20:11 +05309628 ucfg_scan_register_pno_cb(psoc,
9629 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009630
Abhishek Singh0481d662017-04-11 18:20:11 +05309631 ucfg_scan_get_pno_def_params(vdev, &req);
9632 status = ucfg_scan_pno_start(vdev, &req);
9633 if (QDF_IS_STATUS_ERROR(status)) {
9634 hdd_err("Failed to enable PNO");
9635 ret = -EINVAL;
9636 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009637
Abhishek Singh0481d662017-04-11 18:20:11 +05309638exit:
9639 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009640
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309641 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05309642 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009643}
9644
9645static int iw_set_pno(struct net_device *dev,
9646 struct iw_request_info *info,
9647 union iwreq_data *wrqu, char *extra)
9648{
Dustin Brown389e5072018-11-08 17:10:01 +05309649 int errno;
9650 struct osif_vdev_sync *vdev_sync;
9651
9652 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9653 if (errno)
9654 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009655
Dustin Brown389e5072018-11-08 17:10:01 +05309656 errno = __iw_set_pno(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009657
Dustin Brown389e5072018-11-08 17:10:01 +05309658 osif_vdev_sync_op_stop(vdev_sync);
9659
9660 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009661}
9662#endif /* FEATURE_WLAN_SCAN_PNO */
9663
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009664static int __iw_set_band_config(struct net_device *dev,
9665 struct iw_request_info *info,
9666 union iwreq_data *wrqu, char *extra)
9667{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009668 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009669 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08009670 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009671 int *value = (int *)extra;
9672
Dustin Brownfdf17c12018-03-14 12:55:34 -07009673 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009674
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309675 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009676 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309677 return -EPERM;
9678 }
9679
Jeff Johnson441e1f72017-02-07 08:50:49 -08009680 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9681 ret = hdd_check_private_wext_control(hdd_ctx, info);
9682 if (0 != ret)
9683 return ret;
9684
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07009685 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009686}
9687
9688static int iw_set_band_config(struct net_device *dev,
9689 struct iw_request_info *info,
9690 union iwreq_data *wrqu, char *extra)
9691{
Dustin Brown389e5072018-11-08 17:10:01 +05309692 int errno;
9693 struct osif_vdev_sync *vdev_sync;
9694
9695 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9696 if (errno)
9697 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009698
Dustin Brown389e5072018-11-08 17:10:01 +05309699 errno = __iw_set_band_config(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009700
Dustin Brown389e5072018-11-08 17:10:01 +05309701 osif_vdev_sync_op_stop(vdev_sync);
9702
9703 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009704}
9705
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009706static int printk_adapter(void *priv, const char *fmt, ...)
9707{
9708 int ret;
9709 va_list args;
9710
9711 va_start(args, fmt);
9712 ret = vprintk(fmt, args);
9713 ret += printk("\n");
9714 va_end(args);
9715
9716 return ret;
9717}
9718
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009719static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
9720{
9721 qdf_abstract_print *print = &printk_adapter;
9722
9723 switch (log_id) {
9724 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009725 cds_print_htc_credit_history(count, print, NULL);
9726 break;
9727 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009728 wma_print_wmi_cmd_log(count, print, NULL);
9729 break;
9730 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009731 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
9732 break;
9733 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009734 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
9735 break;
9736 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009737 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
9738 break;
9739 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009740 wma_print_wmi_event_log(count, print, NULL);
9741 break;
9742 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009743 wma_print_wmi_rx_event_log(count, print, NULL);
9744 break;
9745 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009746 wma_print_wmi_mgmt_event_log(count, print, NULL);
9747 break;
9748 default:
9749 print(NULL, "Invalid Log Id %d", log_id);
9750 break;
9751 }
9752}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009753
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009754#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
9755int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
9756{
9757 struct hdd_context *hdd_ctx;
9758 int ret;
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309759 bool crash_inject;
9760 QDF_STATUS status;
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009761
9762 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
9763 v1, v2);
9764 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
9765 v1, v2);
9766 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309767
Vignesh Viswanathana1f3a1a2018-10-04 13:10:46 +05309768 status = ucfg_mlme_get_crash_inject(hdd_ctx->psoc, &crash_inject);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309769 if (QDF_IS_STATUS_ERROR(status)) {
9770 hdd_err("Failed to get crash inject ini config");
9771 return 0;
9772 }
9773
9774 if (!crash_inject) {
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009775 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
9776 return 0;
9777 }
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309778
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009779 if (v1 == 3) {
9780 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
9781 return 0;
9782 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009783 ret = wma_cli_set2_command(adapter->vdev_id,
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009784 GEN_PARAM_CRASH_INJECT,
9785 v1, v2, GEN_CMD);
9786 return ret;
9787}
9788#endif
9789
Nirav Shahd21a2e32018-04-20 16:34:43 +05309790#ifdef CONFIG_DP_TRACE
9791void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
9792{
9793 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
9794 cmd_type, count);
9795 if (cmd_type == DUMP_DP_TRACE)
9796 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
9797 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
9798 qdf_dp_trace_enable_live_mode();
9799 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
9800 qdf_dp_trace_clear_buffer();
9801 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
9802 qdf_dp_trace_disable_live_mode();
9803}
9804#endif
9805
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009806static int __iw_set_two_ints_getnone(struct net_device *dev,
9807 struct iw_request_info *info,
9808 union iwreq_data *wrqu, char *extra)
9809{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009810 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009811 int *value = (int *)extra;
9812 int sub_cmd = value[0];
9813 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08009814 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009815 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08009816 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009817
Dustin Brownfdf17c12018-03-14 12:55:34 -07009818 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009819
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009820 ret = wlan_hdd_validate_context(hdd_ctx);
9821 if (0 != ret)
9822 return ret;
9823
Jeff Johnson441e1f72017-02-07 08:50:49 -08009824 ret = hdd_check_private_wext_control(hdd_ctx, info);
9825 if (0 != ret)
9826 return ret;
9827
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009828 switch (sub_cmd) {
9829 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009830 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009831 ret = wma_cli_set_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009832 WMI_STA_SMPS_PARAM_CMDID,
9833 value[1] << WMA_SMPS_PARAM_VALUE_S
9834 | value[2],
9835 VDEV_CMD);
9836 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009837 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009838 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009839 break;
Govind Singha471e5e2015-10-12 17:11:14 +05309840 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07009841 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309842 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009843 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309844 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
9845 value[1], value[2], DBG_CMD);
9846 break;
9847 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07009848 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309849 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009850 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309851 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
9852 value[1], value[2], DBG_CMD);
9853 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009854 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
9855 hdd_debug("Ioctl to set dual fw mode config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08009856 status =
9857 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
9858 &dual_mac_feature);
9859 if (status != QDF_STATUS_SUCCESS)
9860 hdd_err("can't get dual mac feature val, use def");
9861 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009862 hdd_err("Dual mac feature is disabled from INI");
9863 return -EPERM;
9864 }
9865 hdd_debug("%d %d", value[1], value[2]);
Dustin Brown05d81302018-09-11 16:49:22 -07009866 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009867 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009868 break;
9869 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05309870 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009871 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009872 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009873 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009874 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07009875 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08009876 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
9877 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009878 break;
9879 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07009880 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009881 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009882 case WE_LOG_BUFFER: {
9883 int log_id = value[1];
9884 uint32_t count = value[2] < 0 ? 0 : value[2];
9885
9886 hdd_ioctl_log_buffer(log_id, count);
9887
9888 break;
9889 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07009890 case WE_SET_BA_AGEING_TIMEOUT:
9891 {
9892 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
9893
9894 if (!soc) {
9895 hdd_err("Invalid handles");
9896 break;
9897 }
9898 cdp_set_ba_timeout(soc, value[1], value[2]);
9899 break;
9900 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009901 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07009902 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009903 break;
9904 }
9905
9906 return ret;
9907}
9908
9909static int iw_set_two_ints_getnone(struct net_device *dev,
9910 struct iw_request_info *info,
9911 union iwreq_data *wrqu, char *extra)
9912{
Dustin Brown389e5072018-11-08 17:10:01 +05309913 int errno;
9914 struct osif_vdev_sync *vdev_sync;
9915
9916 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9917 if (errno)
9918 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009919
Dustin Brown389e5072018-11-08 17:10:01 +05309920 errno = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009921
Dustin Brown389e5072018-11-08 17:10:01 +05309922 osif_vdev_sync_op_stop(vdev_sync);
9923
9924 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009925}
9926
9927/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009928
9929static const iw_handler we_private[] = {
9930
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009931 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9932 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9933 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009934 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9935 iw_set_three_ints_getnone,
9936 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009937 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009938 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9939 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009940 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9941 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309942#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009943 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309944#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009945 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9946 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9947 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009948 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009949 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9950 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9951 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9952 iw_set_keepalive_params,
9953#ifdef WLAN_FEATURE_PACKET_FILTERING
9954 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9955 iw_set_packet_filter_params,
9956#endif
9957#ifdef FEATURE_WLAN_SCAN_PNO
9958 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9959#endif
9960 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009961 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9962 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009963 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08009964#ifdef FEATURE_WLM_STATS
9965 [WLAN_GET_WLM_STATS - SIOCIWFIRSTPRIV] = iw_get_wlm_stats,
9966#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009967 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9968 iw_set_two_ints_getnone,
9969 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9970 iw_set_dot11p_channel_sched,
9971};
9972
9973/*Maximum command length can be only 15 */
9974static const struct iw_priv_args we_private_args[] = {
9975
9976 /* handlers for main ioctl */
9977 {WLAN_PRIV_SET_INT_GET_NONE,
9978 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9979 0,
9980 ""},
9981
9982 /* handlers for sub-ioctl */
9983 {WE_SET_11D_STATE,
9984 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9985 0,
9986 "set11Dstate"},
9987
9988 {WE_WOWL,
9989 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9990 0,
9991 "wowl"},
9992
9993 {WE_SET_POWER,
9994 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9995 0,
9996 "setPower"},
9997
9998 {WE_SET_MAX_ASSOC,
9999 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10000 0,
10001 "setMaxAssoc"},
10002
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010003 {WE_SET_SCAN_DISABLE,
10004 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10005 0,
10006 "scan_disable"},
10007
10008 {WE_SET_DATA_INACTIVITY_TO,
10009 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10010 0,
10011 "inactivityTO"},
10012
Mukul Sharmaed92f2f2017-04-20 00:06:28 +053010013 {WE_SET_WOW_DATA_INACTIVITY_TO,
10014 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10015 0,
10016 "wow_ito"},
10017
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010018 {WE_SET_MAX_TX_POWER,
10019 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10020 0,
10021 "setMaxTxPower"},
10022
10023 {WE_SET_TX_POWER,
10024 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10025 0,
10026 "setTxPower"},
10027
10028 {WE_SET_MC_RATE,
10029 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10030 0,
10031 "setMcRate"},
10032
10033 {WE_SET_MAX_TX_POWER_2_4,
10034 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10035 0,
10036 "setTxMaxPower2G"},
10037
10038 {WE_SET_MAX_TX_POWER_5_0,
10039 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10040 0,
10041 "setTxMaxPower5G"},
10042
Nirav Shahbb8e47c2018-05-17 16:56:41 +053010043#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080010044 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +053010045 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080010046 0,
10047 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +053010048#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080010049
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010050 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
10051 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -080010052 * will support both
10053 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010054 {WE_SET_MAX_TX_POWER,
10055 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10056 0,
10057 "setTxMaxPower"},
10058
Jeff Johnson0187c622019-01-04 06:39:44 -080010059#ifdef HASTINGS_BT_WAR
10060 {WE_SET_HASTINGS_BT_WAR,
10061 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10062 0,
10063 "hastings_bt_war"},
10064#endif
10065
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010066 {WE_SET_TM_LEVEL,
10067 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10068 0,
10069 "setTmLevel"},
10070
10071 {WE_SET_PHYMODE,
10072 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10073 0,
10074 "setphymode"},
10075
10076 {WE_SET_NSS,
10077 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10078 0,
10079 "nss"},
10080
10081 {WE_SET_LDPC,
10082 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10083 0,
10084 "ldpc"},
10085
10086 {WE_SET_TX_STBC,
10087 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10088 0,
10089 "tx_stbc"},
10090
10091 {WE_SET_RX_STBC,
10092 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10093 0,
10094 "rx_stbc"},
10095
10096 {WE_SET_SHORT_GI,
10097 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10098 0,
10099 "shortgi"},
10100
10101 {WE_SET_RTSCTS,
10102 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10103 0,
10104 "enablertscts"},
10105
10106 {WE_SET_CHWIDTH,
10107 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10108 0,
10109 "chwidth"},
10110
10111 {WE_SET_ANI_EN_DIS,
10112 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10113 0,
10114 "anienable"},
10115
10116 {WE_SET_ANI_POLL_PERIOD,
10117 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10118 0,
10119 "aniplen"},
10120
10121 {WE_SET_ANI_LISTEN_PERIOD,
10122 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10123 0,
10124 "anilislen"},
10125
10126 {WE_SET_ANI_OFDM_LEVEL,
10127 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10128 0,
10129 "aniofdmlvl"},
10130
10131 {WE_SET_ANI_CCK_LEVEL,
10132 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10133 0,
10134 "aniccklvl"},
10135
10136 {WE_SET_DYNAMIC_BW,
10137 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10138 0,
10139 "cwmenable"},
10140
10141 {WE_SET_CTS_CBW,
10142 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10143 0,
10144 "cts_cbw" },
10145
10146 {WE_SET_GTX_HT_MCS,
10147 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10148 0,
10149 "gtxHTMcs"},
10150
10151 {WE_SET_GTX_VHT_MCS,
10152 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10153 0,
10154 "gtxVHTMcs"},
10155
10156 {WE_SET_GTX_USRCFG,
10157 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10158 0,
10159 "gtxUsrCfg"},
10160
10161 {WE_SET_GTX_THRE,
10162 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10163 0,
10164 "gtxThre"},
10165
10166 {WE_SET_GTX_MARGIN,
10167 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10168 0,
10169 "gtxMargin"},
10170
10171 {WE_SET_GTX_STEP,
10172 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10173 0,
10174 "gtxStep"},
10175
10176 {WE_SET_GTX_MINTPC,
10177 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10178 0,
10179 "gtxMinTpc"},
10180
10181 {WE_SET_GTX_BWMASK,
10182 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10183 0,
10184 "gtxBWMask"},
10185
10186 {WE_SET_TX_CHAINMASK,
10187 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10188 0,
10189 "txchainmask"},
10190
10191 {WE_SET_RX_CHAINMASK,
10192 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10193 0,
10194 "rxchainmask"},
10195
10196 {WE_SET_11N_RATE,
10197 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10198 0,
10199 "set11NRates"},
10200
10201 {WE_SET_VHT_RATE,
10202 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10203 0,
10204 "set11ACRates"},
10205
10206 {WE_SET_AMPDU,
10207 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10208 0,
10209 "ampdu"},
10210
10211 {WE_SET_AMSDU,
10212 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10213 0,
10214 "amsdu"},
10215
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010216 {WE_SET_TXPOW_2G,
10217 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10218 0,
10219 "txpow2g"},
10220
10221 {WE_SET_TXPOW_5G,
10222 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10223 0,
10224 "txpow5g"},
10225
Wen Gong99768902018-04-25 12:07:49 +080010226#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010227 /* Sub-cmds DBGLOG specific commands */
10228 {WE_DBGLOG_LOG_LEVEL,
10229 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10230 0,
10231 "dl_loglevel"},
10232
10233 {WE_DBGLOG_VAP_ENABLE,
10234 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10235 0,
10236 "dl_vapon"},
10237
10238 {WE_DBGLOG_VAP_DISABLE,
10239 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10240 0,
10241 "dl_vapoff"},
10242
10243 {WE_DBGLOG_MODULE_ENABLE,
10244 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10245 0,
10246 "dl_modon"},
10247
10248 {WE_DBGLOG_MODULE_DISABLE,
10249 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10250 0,
10251 "dl_modoff"},
10252
10253 {WE_DBGLOG_MOD_LOG_LEVEL,
10254 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10255 0,
10256 "dl_mod_loglevel"},
10257
10258 {WE_DBGLOG_TYPE,
10259 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10260 0,
10261 "dl_type"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010262
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010263 {WE_DBGLOG_REPORT_ENABLE,
10264 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10265 0,
10266 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +080010267#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010268
10269 {WE_SET_TXRX_FWSTATS,
10270 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10271 0,
10272 "txrx_fw_stats"},
10273
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010274 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +080010275 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010276 0,
10277 "txrx_stats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010278#ifdef FW_THERMAL_THROTTLE_SUPPORT
10279 {WE_SET_THERMAL_THROTTLE_CFG,
10280 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10281 0,
10282 "set_thermal_cfg"},
10283#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Krishna Reddya50d09f2019-02-04 14:55:06 +053010284 {WE_SET_BTCOEX_MODE,
10285 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10286 0, "set_btc_mode" },
10287 {WE_SET_BTCOEX_RSSI_THRESHOLD,
10288 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10289 0, "set_btc_rssi" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010290 {WE_TXRX_FWSTATS_RESET,
10291 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10292 0,
10293 "txrx_fw_st_rst"},
10294
10295 {WE_PPS_PAID_MATCH,
10296 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10297 0, "paid_match"},
10298
10299 {WE_PPS_GID_MATCH,
10300 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10301 0, "gid_match"},
10302
10303 {WE_PPS_EARLY_TIM_CLEAR,
10304 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10305 0, "tim_clear"},
10306
10307 {WE_PPS_EARLY_DTIM_CLEAR,
10308 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10309 0, "dtim_clear"},
10310
10311 {WE_PPS_EOF_PAD_DELIM,
10312 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10313 0, "eof_delim"},
10314
10315 {WE_PPS_MACADDR_MISMATCH,
10316 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10317 0, "mac_match"},
10318
10319 {WE_PPS_DELIM_CRC_FAIL,
10320 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10321 0, "delim_fail"},
10322
10323 {WE_PPS_GID_NSTS_ZERO,
10324 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10325 0, "nsts_zero"},
10326
10327 {WE_PPS_RSSI_CHECK,
10328 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10329 0, "rssi_chk"},
10330
10331 {WE_PPS_5G_EBT,
10332 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10333 0, "5g_ebt"},
10334
10335 {WE_SET_HTSMPS,
10336 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10337 0, "htsmps"},
10338
10339 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
10340 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10341 0, "set_qpspollcnt"},
10342
10343 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
10344 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10345 0, "set_qtxwake"},
10346
10347 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10348 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10349 0, "set_qwakeintv"},
10350
10351 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10352 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10353 0, "set_qnodatapoll"},
10354
10355 /* handlers for MCC time quota and latency sub ioctls */
10356 {WE_MCC_CONFIG_LATENCY,
10357 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10358 0, "setMccLatency"},
10359
10360 {WE_MCC_CONFIG_QUOTA,
10361 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10362 0, "setMccQuota"},
10363
10364 {WE_SET_DEBUG_LOG,
10365 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10366 0, "setDbgLvl"},
10367
10368 /* handlers for early_rx power save */
10369 {WE_SET_EARLY_RX_ADJUST_ENABLE,
10370 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10371 0, "erx_enable"},
10372
10373 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
10374 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10375 0, "erx_bmiss_val"},
10376
10377 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
10378 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10379 0, "erx_bmiss_smpl"},
10380
10381 {WE_SET_EARLY_RX_SLOP_STEP,
10382 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10383 0, "erx_slop_step"},
10384
10385 {WE_SET_EARLY_RX_INIT_SLOP,
10386 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10387 0, "erx_init_slop"},
10388
10389 {WE_SET_EARLY_RX_ADJUST_PAUSE,
10390 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10391 0, "erx_adj_pause"},
10392
10393 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
10394 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10395 0, "erx_dri_sample"},
10396
10397 {WE_DUMP_STATS,
10398 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10399 0, "dumpStats"},
10400
10401 {WE_CLEAR_STATS,
10402 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10403 0, "clearStats"},
10404
Govind Singha471e5e2015-10-12 17:11:14 +053010405 {WE_START_FW_PROFILE,
10406 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10407 0, "startProfile"},
10408
Abhishek Singh1bdb1572015-10-16 16:24:19 +053010409 {WE_SET_CHANNEL,
10410 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10411 0, "setChanChange" },
10412
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +053010413 {WE_SET_CONC_SYSTEM_PREF,
10414 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10415 0, "setConcSysPref" },
10416
Jeff Johnson011c4502017-10-05 15:25:56 -070010417 {WE_SET_PDEV_RESET,
10418 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10419 0, "pdev_reset" },
10420
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010421 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -080010422 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10423 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010424
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010425 {WLAN_PRIV_SET_NONE_GET_INT,
10426 0,
10427 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10428 ""},
10429
10430 /* handlers for sub-ioctl */
10431 {WE_GET_11D_STATE,
10432 0,
10433 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10434 "get11Dstate"},
10435
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010436 {WE_GET_WLAN_DBG,
10437 0,
10438 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10439 "getwlandbg"},
10440
10441 {WE_GET_MAX_ASSOC,
10442 0,
10443 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10444 "getMaxAssoc"},
10445
10446 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010447 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10448 "getAutoChannel"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010449
10450 {WE_GET_CONCURRENCY_MODE,
10451 0,
10452 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10453 "getconcurrency"},
10454
10455 {WE_GET_NSS,
10456 0,
10457 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10458 "get_nss"},
10459
10460 {WE_GET_LDPC,
10461 0,
10462 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10463 "get_ldpc"},
10464
10465 {WE_GET_TX_STBC,
10466 0,
10467 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10468 "get_tx_stbc"},
10469
10470 {WE_GET_RX_STBC,
10471 0,
10472 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10473 "get_rx_stbc"},
10474
10475 {WE_GET_SHORT_GI,
10476 0,
10477 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10478 "get_shortgi"},
10479
10480 {WE_GET_RTSCTS,
10481 0,
10482 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10483 "get_rtscts"},
10484
10485 {WE_GET_CHWIDTH,
10486 0,
10487 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10488 "get_chwidth"},
10489
10490 {WE_GET_ANI_EN_DIS,
10491 0,
10492 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10493 "get_anienable"},
10494
10495 {WE_GET_ANI_POLL_PERIOD,
10496 0,
10497 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10498 "get_aniplen"},
10499
10500 {WE_GET_ANI_LISTEN_PERIOD,
10501 0,
10502 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10503 "get_anilislen"},
10504
10505 {WE_GET_ANI_OFDM_LEVEL,
10506 0,
10507 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10508 "get_aniofdmlvl"},
10509
10510 {WE_GET_ANI_CCK_LEVEL,
10511 0,
10512 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10513 "get_aniccklvl"},
10514
10515 {WE_GET_DYNAMIC_BW,
10516 0,
10517 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10518 "get_cwmenable"},
10519
10520 {WE_GET_GTX_HT_MCS,
10521 0,
10522 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10523 "get_gtxHTMcs"},
10524
10525 {WE_GET_GTX_VHT_MCS,
10526 0,
10527 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10528 "get_gtxVHTMcs"},
10529
10530 {WE_GET_GTX_USRCFG,
10531 0,
10532 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10533 "get_gtxUsrCfg"},
10534
10535 {WE_GET_GTX_THRE,
10536 0,
10537 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10538 "get_gtxThre"},
10539
10540 {WE_GET_GTX_MARGIN,
10541 0,
10542 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10543 "get_gtxMargin"},
10544
10545 {WE_GET_GTX_STEP,
10546 0,
10547 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10548 "get_gtxStep"},
10549
10550 {WE_GET_GTX_MINTPC,
10551 0,
10552 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10553 "get_gtxMinTpc"},
10554
10555 {WE_GET_GTX_BWMASK,
10556 0,
10557 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10558 "get_gtxBWMask"},
10559
10560 {WE_GET_TX_CHAINMASK,
10561 0,
10562 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10563 "get_txchainmask"},
10564
10565 {WE_GET_RX_CHAINMASK,
10566 0,
10567 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10568 "get_rxchainmask"},
10569
10570 {WE_GET_11N_RATE,
10571 0,
10572 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10573 "get_11nrate"},
10574
10575 {WE_GET_AMPDU,
10576 0,
10577 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10578 "get_ampdu"},
10579
10580 {WE_GET_AMSDU,
10581 0,
10582 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10583 "get_amsdu"},
10584
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010585 {WE_GET_TXPOW_2G,
10586 0,
10587 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10588 "get_txpow2g"},
10589
10590 {WE_GET_TXPOW_5G,
10591 0,
10592 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10593 "get_txpow5g"},
10594
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010595 {WE_GET_PPS_PAID_MATCH,
10596 0,
10597 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10598 "get_paid_match"},
10599
10600 {WE_GET_PPS_GID_MATCH,
10601 0,
10602 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10603 "get_gid_match"},
10604
10605 {WE_GET_PPS_EARLY_TIM_CLEAR,
10606 0,
10607 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10608 "get_tim_clear"},
10609
10610 {WE_GET_PPS_EARLY_DTIM_CLEAR,
10611 0,
10612 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10613 "get_dtim_clear"},
10614
10615 {WE_GET_PPS_EOF_PAD_DELIM,
10616 0,
10617 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10618 "get_eof_delim"},
10619
10620 {WE_GET_PPS_MACADDR_MISMATCH,
10621 0,
10622 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10623 "get_mac_match"},
10624
10625 {WE_GET_PPS_DELIM_CRC_FAIL,
10626 0,
10627 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10628 "get_delim_fail"},
10629
10630 {WE_GET_PPS_GID_NSTS_ZERO,
10631 0,
10632 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10633 "get_nsts_zero"},
10634
10635 {WE_GET_PPS_RSSI_CHECK,
10636 0,
10637 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10638 "get_rssi_chk"},
10639
10640 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
10641 0,
10642 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10643 "get_qpspollcnt"},
10644
10645 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
10646 0,
10647 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10648 "get_qtxwake"},
10649
10650 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10651 0,
10652 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10653 "get_qwakeintv"},
10654
10655 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10656 0,
10657 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10658 "get_qnodatapoll"},
10659
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010660 {WE_CAP_TSF,
10661 0,
10662 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10663 "cap_tsf"},
10664
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010665 {WE_GET_TEMPERATURE,
10666 0,
10667 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10668 "get_temp"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010669
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010670 {WE_GET_DCM,
10671 0,
10672 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10673 "get_dcm"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010674
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010675 {WE_GET_RANGE_EXT,
10676 0,
10677 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10678 "get_range_ext"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010679
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010680 /* handlers for main ioctl */
10681 {WLAN_PRIV_SET_CHAR_GET_NONE,
10682 IW_PRIV_TYPE_CHAR | 512,
10683 0,
10684 ""},
10685
10686 /* handlers for sub-ioctl */
10687 {WE_WOWL_ADD_PTRN,
10688 IW_PRIV_TYPE_CHAR | 512,
10689 0,
10690 "wowlAddPtrn"},
10691
10692 {WE_WOWL_DEL_PTRN,
10693 IW_PRIV_TYPE_CHAR | 512,
10694 0,
10695 "wowlDelPtrn"},
10696
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010697 /* handlers for sub-ioctl */
10698 {WE_NEIGHBOR_REPORT_REQUEST,
10699 IW_PRIV_TYPE_CHAR | 512,
10700 0,
10701 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080010702
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010703 {WE_SET_AP_WPS_IE,
10704 IW_PRIV_TYPE_CHAR | 512,
10705 0,
10706 "set_ap_wps_ie"},
10707
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070010708#ifdef WLAN_UNIT_TEST
10709 {WE_UNIT_TEST,
10710 IW_PRIV_TYPE_CHAR | 512,
10711 0,
10712 "unit_test"},
10713#endif
10714
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010715 /* handlers for main ioctl */
10716 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
10717 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10718 0,
10719 ""},
10720
10721 /* handlers for sub-ioctl */
10722 {WE_SET_WLAN_DBG,
10723 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10724 0,
10725 "setwlandbg"},
10726
Nirav Shahd21a2e32018-04-20 16:34:43 +053010727#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010728 /* handlers for sub-ioctl */
10729 {WE_SET_DP_TRACE,
10730 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10731 0,
10732 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010733#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010734
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053010735 {WE_SET_FW_TEST,
10736 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10737 0, "fw_test"},
10738
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010739 /* handlers for main ioctl */
10740 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
10741 0,
10742 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010743 ""},
10744
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010745 {WE_GET_TSF,
10746 0,
10747 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010748 "get_tsf"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010749
10750 {WE_SET_DUAL_MAC_SCAN_CONFIG,
10751 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10752 0,
10753 "set_scan_cfg"},
10754
10755 /* handlers for main ioctl */
10756 {WLAN_PRIV_GET_CHAR_SET_NONE,
10757 0,
10758 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10759 ""},
10760
10761 /* handlers for sub-ioctl */
10762 {WE_WLAN_VERSION,
10763 0,
10764 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10765 "version"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010766
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010767 {WE_GET_STATS,
10768 0,
10769 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10770 "getStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010771
Dustin Brownd9322482017-01-09 12:46:03 -080010772 {WE_GET_SUSPEND_RESUME_STATS,
10773 0,
10774 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10775 "getSuspendStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010776
Govind Singha471e5e2015-10-12 17:11:14 +053010777 {WE_LIST_FW_PROFILE,
10778 0,
10779 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10780 "listProfile"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010781
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010782 {WE_GET_STATES,
10783 0,
10784 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10785 "getHostStates"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010786
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010787 {WE_GET_CFG,
10788 0,
10789 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10790 "getConfig"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010791
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010792 {WE_GET_RSSI,
10793 0,
10794 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10795 "getRSSI"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010796
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010797 {WE_GET_WMM_STATUS,
10798 0,
10799 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10800 "getWmmStatus"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010801
10802 {WE_GET_CHANNEL_LIST,
10803 0,
10804 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10805 "getChannelList"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010806#ifdef FEATURE_WLAN_TDLS
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010807 {WE_GET_TDLS_PEERS,
10808 0,
10809 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10810 "getTdlsPeers"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010811#endif
10812#ifdef WLAN_FEATURE_11W
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010813 {WE_GET_11W_INFO,
10814 0,
10815 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10816 "getPMFInfo"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010817#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010818 {WE_GET_STA_CXN_INFO,
10819 0,
10820 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10821 "get_cxn_info" },
Krunal Soni5e483782018-10-25 15:42:44 -070010822
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010823 {WE_GET_IBSS_STA_INFO,
10824 0,
10825 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10826 "getIbssSTAs"},
10827
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010828 {WE_GET_PHYMODE,
10829 0,
10830 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10831 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010832#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010833 {WE_GET_OEM_DATA_CAP,
10834 0,
10835 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10836 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010837#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010838 {WE_GET_SNR,
10839 0,
10840 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10841 "getSNR"},
10842
Krunal Soni6c3859f2018-06-01 19:57:40 -070010843 {WE_GET_BA_AGEING_TIMEOUT,
10844 0,
10845 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10846 "get_ba_timeout"},
10847
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010848 /* handlers for main ioctl */
10849 {WLAN_PRIV_SET_NONE_GET_NONE,
10850 0,
10851 0,
10852 ""},
10853
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010854 /* handlers for sub-ioctl */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010855 {WE_IBSS_GET_PEER_INFO_ALL,
10856 0,
10857 0,
10858 "ibssPeerInfoAll"},
10859
Govind Singha471e5e2015-10-12 17:11:14 +053010860 {WE_GET_FW_PROFILE_DATA,
10861 0,
10862 0,
10863 "getProfileData"},
10864
10865 {WE_SET_REASSOC_TRIGGER,
10866 0,
10867 0,
10868 "reassoc"},
10869
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010870 {WE_STOP_OBSS_SCAN,
10871 0,
10872 0,
10873 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010874 /* handlers for main ioctl */
10875 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
10876 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10877 0,
10878 ""},
10879
10880 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010881 {WE_IBSS_GET_PEER_INFO,
10882 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10883 0,
10884 "ibssPeerInfo"},
10885
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010886#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010887 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010888 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
10889 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10890 0,
10891 "setdumplog"},
10892
10893 {WE_MTRACE_DUMP_CMD,
10894 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10895 0,
10896 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010897#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -080010898
10899 {WE_POLICY_MANAGER_CINFO_CMD,
10900 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10901 0,
10902 "pm_cinfo"},
10903
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010904#ifdef MPC_UT_FRAMEWORK
10905 {WE_POLICY_MANAGER_CLIST_CMD,
10906 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10907 0,
10908 "pm_clist"},
10909
10910 {WE_POLICY_MANAGER_DLIST_CMD,
10911 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10912 0,
10913 "pm_dlist"},
10914
10915 {WE_POLICY_MANAGER_DBS_CMD,
10916 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10917 0,
10918 "pm_dbs"},
10919
10920 {WE_POLICY_MANAGER_PCL_CMD,
10921 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10922 0,
10923 "pm_pcl"},
10924
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010925 {WE_POLICY_MANAGER_ULIST_CMD,
10926 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10927 0,
10928 "pm_ulist"},
10929
10930 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
10931 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10932 0,
10933 "pm_query_action"},
10934
10935 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
10936 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10937 0,
10938 "pm_query_allow"},
10939
10940 {WE_POLICY_MANAGER_SCENARIO_CMD,
10941 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10942 0,
10943 "pm_run_scenario"},
10944
10945 {WE_POLICY_SET_HW_MODE_CMD,
10946 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10947 0,
10948 "pm_set_hw_mode"},
10949#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010950 {WE_UNIT_TEST_CMD,
10951 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10952 0,
10953 "setUnitTestCmd"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010954
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010955 {WE_MAC_PWR_DEBUG_CMD,
10956 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10957 0,
10958 "halPwrDebug"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010959#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10960 {WE_LED_FLASHING_PARAM,
10961 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10962 0,
10963 "gpio_control"},
10964#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010965#ifdef WLAN_DEBUG
10966 {WE_SET_CHAN_AVOID,
10967 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10968 0,
10969 "ch_avoid"},
10970#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010971 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010972 {WLAN_PRIV_FIPS_TEST,
10973 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10974 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10975 "fips_test"},
10976
10977 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010978 {WLAN_PRIV_ADD_TSPEC,
10979 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10980 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10981 "addTspec"},
10982
10983 /* handlers for main ioctl */
10984 {WLAN_PRIV_DEL_TSPEC,
10985 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10986 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10987 "delTspec"},
10988
10989 /* handlers for main ioctl */
10990 {WLAN_PRIV_GET_TSPEC,
10991 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10992 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10993 "getTspec"},
10994
10995 /* handlers for main ioctl - host offload */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010996 {WLAN_PRIV_SET_HOST_OFFLOAD,
10997 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
10998 0,
10999 "setHostOffload"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011000
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011001 {WLAN_GET_WLAN_STATISTICS,
11002 0,
11003 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
11004 "getWlanStats"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011005
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011006 {WLAN_SET_KEEPALIVE_PARAMS,
Jeff Johnson562ccad2019-02-06 22:10:24 -080011007 IW_PRIV_TYPE_BYTE | sizeof(struct keep_alive_req) |
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011008 IW_PRIV_SIZE_FIXED,
11009 0,
11010 "setKeepAlive"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011011#ifdef WLAN_FEATURE_PACKET_FILTERING
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011012 {WLAN_SET_PACKET_FILTER_PARAMS,
11013 IW_PRIV_TYPE_BYTE |
11014 sizeof(struct pkt_filter_cfg),
11015 0,
11016 "setPktFilter"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011017#endif
11018#ifdef FEATURE_WLAN_SCAN_PNO
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011019 {WLAN_SET_PNO,
11020 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
11021 0,
11022 "setpno"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011023#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011024 {WLAN_SET_BAND_CONFIG,
11025 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11026 0,
11027 "SETBAND"},
Dustin Brown0cbc7572016-12-16 13:54:40 -080011028
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011029 {WLAN_PRIV_SET_MCBC_FILTER,
11030 0,
11031 0,
11032 "setMCBCFilter"},
11033
11034 {WLAN_GET_LINK_SPEED,
11035 IW_PRIV_TYPE_CHAR | 18,
11036 IW_PRIV_TYPE_CHAR | 5,
11037 "getLinkSpeed"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011038
Krunal Sonif9ba53d2019-01-03 21:44:41 -080011039#ifdef FEATURE_WLM_STATS
11040 {WLAN_GET_WLM_STATS,
11041 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
11042 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
11043 "get_wlm_stats"},
11044#endif
11045
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011046 /* handlers for main ioctl */
11047 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
11048 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
11049 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011050 ""},
11051
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011052 {WE_SET_SMPS_PARAM,
11053 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011054 0, "set_smps_param"},
11055
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011056 {WLAN_SET_DOT11P_CHANNEL_SCHED,
11057 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011058 0, "set_dot11p" },
11059
Jeff Johnsondf5d7792018-04-14 15:58:24 -070011060#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011061 {WE_SET_FW_CRASH_INJECT,
11062 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011063 0, "crash_inject"},
11064
Jeff Johnsondf5d7792018-04-14 15:58:24 -070011065#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053011066#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070011067 {WE_LOG_BUFFER,
11068 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011069 0, "log_buffer"},
11070
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011071#endif
Krunal Soni6c3859f2018-06-01 19:57:40 -070011072 {WE_SET_BA_AGEING_TIMEOUT,
11073 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011074 0, "set_ba_timeout"},
11075
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011076#ifdef WLAN_SUSPEND_RESUME_TEST
11077 {WE_SET_WLAN_SUSPEND,
11078 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011079 0, "wlan_suspend"},
11080
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011081 {WE_SET_WLAN_RESUME,
11082 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011083 0, "wlan_resume"},
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011084#endif
Govind Singha471e5e2015-10-12 17:11:14 +053011085 {WE_ENABLE_FW_PROFILE,
11086 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011087 0, "enableProfile"},
11088
Govind Singha471e5e2015-10-12 17:11:14 +053011089 {WE_SET_FW_PROFILE_HIST_INTVL,
11090 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011091 0, "set_hist_intvl"},
11092
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011093 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
11094 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011095 0, "set_fw_mode_cfg"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053011096#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011097 {WE_DUMP_DP_TRACE_LEVEL,
11098 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011099 0, "dump_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053011100#endif
Nirav Shah73713f72018-05-17 14:50:41 +053011101#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011102 {WE_SET_MON_MODE_CHAN,
11103 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011104 0, "setMonChan"},
Nirav Shah73713f72018-05-17 14:50:41 +053011105#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070011106 {WE_GET_ROAM_SYNCH_DELAY,
11107 0,
11108 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011109 "hostroamdelay"},
11110
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080011111 {WE_SET_11AX_RATE,
11112 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11113 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011114 "set_11ax_rate"},
11115
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070011116 {WE_SET_DCM,
11117 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11118 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011119 "enable_dcm"},
11120
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070011121 {WE_SET_RANGE_EXT,
11122 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11123 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011124 "range_ext"},
11125
Naveen Rawatc921c7b2017-06-13 17:29:51 -070011126 {WLAN_PRIV_SET_FTIES,
11127 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
11128 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011129 "set_ft_ies"},
11130
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011131#ifdef WLAN_FEATURE_MOTION_DETECTION
11132 {WE_MOTION_DET_START_STOP,
11133 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11134 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011135 "mt_start"},
11136
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011137 {WE_MOTION_DET_BASE_LINE_START_STOP,
11138 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11139 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011140 "mt_bl_start"},
11141
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011142 {WE_MOTION_DET_CONFIG_PARAM,
11143 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
11144 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011145 "mt_config"},
11146
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011147 {WE_MOTION_DET_BASE_LINE_CONFIG_PARAM,
11148 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
11149 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011150 "mt_bl_config"},
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011151#endif /* WLAN_FEATURE_MOTION_DETECTION */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011152};
11153
11154const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070011155 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053011156 .num_private = QDF_ARRAY_SIZE(we_private),
11157 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011158
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070011159 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011160 .private = (iw_handler *) we_private,
11161 .private_args = we_private_args,
11162 .get_wireless_stats = NULL,
11163};
11164
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011165void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011166{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011167 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011168
Dustin Browne7e71d32018-05-11 16:00:08 -070011169 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011170
Dustin Browne74003f2018-03-14 12:51:58 -070011171 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011172}
11173
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011174void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011175{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011176 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011177
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011178 rtnl_lock();
11179 dev->wireless_handlers = NULL;
11180 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011181
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011182 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011183}