blob: 33ca9c489dc2c4842c232bb460c22c183bf3f7b5 [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 Brown6fb7a752018-11-30 11:33:57 -080070#include "qdf_hashtable_test.h"
Dustin Brown9c49a332019-03-05 11:27:38 -080071#include "qdf_periodic_work_test.h"
Dustin Brownd315c452018-11-27 11:28:48 -080072#include "qdf_talloc_test.h"
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070073#include "qdf_str.h"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053074#include "qdf_trace.h"
Dustin Brownebb16d12018-11-29 17:52:07 -080075#include "qdf_types_test.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080076#include "wlan_hdd_assoc.h"
77#include "wlan_hdd_ioctl.h"
78#include "wlan_hdd_scan.h"
79#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080080#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080081#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070082#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070083#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080084#include "wlan_hdd_ocb.h"
85#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080086#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070087#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053088#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070089#ifdef WLAN_SUSPEND_RESUME_TEST
90#include "wlan_hdd_driver_ops.h"
91#include "hif.h"
Rajeev Kumar9bb2e852016-09-24 12:29:25 -070092#include "pld_common.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070093#endif
Dhanashri Atree7d442a2016-07-14 18:20:29 -070094#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053095#include "cds_utils.h"
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -070096#include "wlan_osif_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080097#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080098#include <cdp_txrx_stats.h>
99#include <cds_api.h>
Dustin Brown6099ddc2018-07-06 14:32:53 -0700100#include "wlan_dsc_test.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530101#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -0700102#include "wlan_hdd_regulatory.h"
103#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +0530104#include "wlan_hdd_packet_filter_api.h"
Naveen Rawat3ff5cff2018-01-29 14:31:16 -0800105#include "wlan_cp_stats_mc_ucfg_api.h"
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +0530106#include "wlan_mlme_ucfg_api.h"
Wu Gao93816212018-08-31 16:49:54 +0800107#include "cfg_mlme_sta.h"
Arif Hussain43e09712018-09-18 19:31:57 -0700108#include "wlan_mlme_public_struct.h"
Wu Gao93816212018-08-31 16:49:54 +0800109#include "cfg_ucfg_api.h"
Krunal Sonie71838d2018-09-27 10:45:05 -0700110#include "wlan_policy_mgr_ucfg.h"
Harprit Chhabadabec6de42018-09-10 10:21:15 -0700111#include "wlan_mlme_public_struct.h"
112#include "cfg_ucfg_api.h"
113#include "cfg_mlme_threshold.h"
Wu Gao66454f12018-09-26 19:55:41 +0800114#include "wlan_pmo_cfg.h"
115#include "wlan_pmo_ucfg_api.h"
Mohit Khannac9649652018-11-28 18:10:28 -0800116#include "dp_txrx.h"
Manikandan Mohan06d38d82018-11-26 18:36:58 -0800117#include "wlan_fwol_ucfg_api.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530118
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800119/* Private ioctls and their sub-ioctls */
120#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
121#define WE_SET_11D_STATE 1
122#define WE_WOWL 2
123#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530124/*
125 * <ioctl>
126 * setMaxAssoc - Sets the maximum number of associated stations
127 *
128 * @INPUT: 1 to 32
129 *
130 * @OUTPUT: None
131 *
132 * This IOTCL sets the maximum number of associated stations
133 *
134 * @E.g: iwpriv wlan0 setMaxAssoc <value>
135 *
136 * Supported Feature: STA
137 *
138 * Usage: Internal/External
139 *
140 * </ioctl>
141 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800142#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530143/*
144 * <ioctl>
Jeff Johnsonf2cf6592018-05-06 16:27:44 -0700145 * scan_disable - Disable scan
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530146 *
147 * @INPUT: set_value
148 *
149 * @OUTPUT: None
150 *
151 * This IOCTL is used to set disable scan
152 *
153 * @E.g: iwpriv wlan0 scan_disable 1
154 *
155 * Supported Feature: Scan
156 *
157 * Usage: Internal/External
158 *
159 * </ioctl>
160 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800161#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530162/*
163 * <ioctl>
164 * inactivityTO - sets the timeout value for inactivity data while
165 * in power save mode
166 *
167 * @INPUT: int1…..int255
168 *
169 * @OUTPUT: None
170 *
171 * This IOCTL set the timeout value for inactivity data in power save mode
172 *
173 * @E.g: iwpriv wlan0 inactivityTO 20
174 *
175 * Supported Feature: STA
176 *
177 * Usage: Internal/External
178 *
179 * </ioctl>
180 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800181#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530182/*
183 * <ioctl>
184 * setMaxTxPower - Dynamically sets the maximum transmission power
185 *
186 * @INPUT: Transmission power in dBm
187 *
188 * @OUTPUT: None
189 *
190 * This IOCTL dynamically sets the maximum transmission power
191 * This setting does not persist over reboots
192 *
193 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
194 *
195 * Supported Feature: STA
196 *
197 * Usage: Internal/External
198 *
199 * </ioctl>
200 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800201#define WE_SET_MAX_TX_POWER 7
Jeff Johnson0187c622019-01-04 06:39:44 -0800202
203#ifdef HASTINGS_BT_WAR
204/* Temporary WAR for Hastings 1.1 only */
205#define WE_SET_HASTINGS_BT_WAR 8
206#endif
207
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800208#define WE_SET_TM_LEVEL 9
Jeff Johnson0187c622019-01-04 06:39:44 -0800209
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530210/*
211 * <ioctl>
212 * setphymode - Set the phymode dynamically
213 *
214 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
215 *
216 * @OUTPUT: None
217 *
218 * This IOCTL sets the phymode dynamically
219 *
220 * @E.g: iwpriv wlan0 setphymode 10
221 *
222 * Supported Feature: STA
223 *
224 * Usage: Internal/External
225 *
226 * </ioctl>
227 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800228#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530229/*
230 * <ioctl>
231 * nss - Set the number of spatial streams
232 *
233 * @INPUT: int1…..int3
234 *
235 * @OUTPUT: None
236 *
237 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
238 *
239 * @E.g: iwpriv wlan0 nss 2
240 *
241 * Supported Feature: STA
242 *
243 * Usage: Internal/External
244 *
245 * </ioctl>
246 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800247#define WE_SET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530248/*
249 * <ioctl>
250 * ldpc - Enables or disables LDPC
251 *
252 * @INPUT: 0 – Disable, 1 - Enable
253 *
254 * @OUTPUT: None
255 *
256 * This IOCTL enables or disables LDPC
257 *
258 * @E.g: iwpriv wlan0 ldpc 1
259 *
260 * Supported Feature: STA
261 *
262 * Usage: Internal/External
263 *
264 * </ioctl>
265 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800266#define WE_SET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530267/*
268 * <ioctl>
269 * tx_stbc - Enables or disables tx_stbc
270 *
271 * @INPUT: Int 0 – Disable, 1 - Enable
272 *
273 * @OUTPUT: None
274 *
275 * This IOTCL used to enables or disables tx_stbc
276 *
277 * @E.g: iwpriv wlan0 tx_stbc <value>
278 *
279 * Supported Feature: STA
280 *
281 * Usage: Internal/External
282 *
283 * </ioctl>
284 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800285#define WE_SET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530286/*
287 * <ioctl>
288 * rx_stbc - Set the rx_stbc parameter
289 *
290 * @INPUT: Int 0 – Disable, 1 - Enable
291 *
292 * @OUTPUT: None
293 *
294 * This IOTCL used to set rx_stbc parameter
295 *
296 * @E.g: iwpriv wlan0 rx_stbc <value>
297 *
298 * Supported Feature: STA
299 *
300 * Usage: Internal/External
301 *
302 * </ioctl>
303 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800304#define WE_SET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530305/*
306 * <ioctl>
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800307 * shortgi - Sets the short-guard interval
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530308 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800309 * @INPUT: Fixed Rate: 0 - 400ns, 1 - 800ns, 2 - 1600ns, 3 - 3200us
310 * Auto Rate: 8 - 400ns, 9 - 800ns, 10 - 1600ns, 11 - 3200us
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530311 *
312 * @OUTPUT: None
313 *
Kiran Kumar Lokerea006a302018-03-07 20:58:13 -0800314 * This IOCTL sets the short-guard interval.
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530315 *
316 * @E.g: iwpriv wlan0 shortgi <value>
317 *
318 * Supported Feature: STA
319 *
320 * Usage: Internal/External
321 *
322 * </ioctl>
323 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800324#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530325/*
326 * <ioctl>
327 * enablertscts - enables or disables rts/cts.
328 *
329 * @INPUT: 1-Enable , 0-Disable
330 *
331 * @OUTPUT: None
332 *
333 * This IOCTL enables or disables rts/cts.
334 *
335 * @E.g: iwpriv wlan0 enablertscts <value>
336 *
337 * Supported Feature: STA
338 *
339 * Usage: Internal/External
340 *
341 * </ioctl>
342 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800343#define WE_SET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530344/*
345 * <ioctl>
346 * chwidth - Set the channel bandwidth
347 *
348 * @INPUT: 0-20mhz to 3-160mhz
349 *
350 * @OUTPUT: None
351 *
352 * This IOTCL used to set the channel bandwidth
353 *
354 * @E.g: iwpriv wlan0 chwidth 1
355 *
356 * Supported Feature: STA
357 *
358 * Usage: Internal/External
359 *
360 * </ioctl>
361 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800362#define WE_SET_CHWIDTH 17
363#define WE_SET_ANI_EN_DIS 18
364#define WE_SET_ANI_POLL_PERIOD 19
365#define WE_SET_ANI_LISTEN_PERIOD 20
366#define WE_SET_ANI_OFDM_LEVEL 21
367#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530368/*
369 * <ioctl>
370 * cwmenable - Enables or disables the dynamic channel bandwidth
371 *
372 * @INPUT: 0-Disable, 1-Enable
373 *
374 * @OUTPUT: None
375 *
376 * This IOTCL used to enables or disables the dynamic channel bandwidth
377 *
378 * @E.g: iwpriv wlan0 cwmenable <value>
379 *
380 * Supported Feature: STA
381 *
382 * Usage: Internal/External
383 *
384 * </ioctl>
385 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800386#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530387/*
388 * <ioctl>
389 * txchainmask - This IOCTL sets the current Tx chain mask
390 *
391 * @INPUT: Mask Value
392 *
393 * @OUTPUT: None
394 *
395 * This IOCTL sets the current Tx chain mask
396 *
397 * @E.g: iwpriv wlan0 txchainmask 1
398 *
399 * Supported Feature: STA
400 *
401 * Usage: Internal/External
402 *
403 * </ioctl>
404 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800405#define WE_SET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530406/*
407 * <ioctl>
408 * rxchainmask - Sets the current Rx chain mask
409 *
410 * @INPUT: Mask Value
411 *
412 * @OUTPUT: None
413 *
414 * This IOCTL sets the current Rx chain mask. This command is the
415 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
416 *
417 * @E.g: iwpriv wlan0 rxchainmask <value>
418 *
419 * Supported Feature: STA
420 *
421 * Usage: Internal/External
422 *
423 * </ioctl>
424 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800425#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530426/*
427 * <ioctl>
428 * set11NRates - Fixes the Tx data rate of the 11N mode.
429 *
430 * @INPUT: 0x1b to 0x8f
431 *
432 * @OUTPUT: None
433 *
434 * This IOCTL fixes the Tx data rate of the 11N mode.
435 *
436 * @E.g: iwpriv wlan0 set11NRates 0x85
437 *
438 * Supported Feature: STA
439 *
440 * Usage: Internal/External
441 *
442 * </ioctl>
443 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800444#define WE_SET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530445/*
446 * <ioctl>
447 * ampdu - Set the the maximum subframe of ampdu
448 *
449 * @INPUT: int 1 to int 63
450 *
451 * @OUTPUT: None
452 *
453 * This IOCTL sets the maximum subframe of ampdu.
454 *
455 * @E.g: iwpriv wlan0 ampdu 9
456 *
457 * Supported Feature: STA
458 *
459 * Usage: Internal/External
460 *
461 * </ioctl>
462 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800463#define WE_SET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530464/*
465 * <ioctl>
466 * amsdu - Sets the maximum subframe of amsdu.
467 *
468 * @INPUT: int 1 to int 31
469 *
470 * @OUTPUT: None
471 *
472 * This IOCTL sets the maximum subframe of amsdu.
473 *
474 * @E.g: iwpriv wlan0 amsdu 9
475 *
476 * Supported Feature: STA
477 *
478 * Usage: Internal/External
479 *
480 * </ioctl>
481 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800482#define WE_SET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530483/*
484 * <ioctl>
485 * txpow2g - current 2 GHz Tx power setting
486 *
487 * @INPUT: Tx power in dBm
488 *
489 * @OUTPUT: None
490 *
491 * This IOTCL used to set 2 ghz tx power
492 *
493 * @E.g: iwpriv wlan0 txpow2g
494 *
495 * Supported Feature: STA
496 *
497 * Usage: Internal/External
498 *
499 * </ioctl>
500 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800501#define WE_SET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530502/*
503 * <ioctl>
504 * txpow5g - Current 5 GHz tx power setting
505 *
506 * @INPUT: Tx power in dBm
507 *
508 * @OUTPUT: None
509 *
510 * This IOTCL used to set the 5 ghz txpower
511 *
512 * @E.g: iwpriv wlan0 txpow5g
513 *
514 * Supported Feature: STA
515 *
516 * Usage: Internal/External
517 *
518 * </ioctl>
519 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800520#define WE_SET_TXPOW_5G 30
521/* Private ioctl for firmware debug log */
522#define WE_DBGLOG_LOG_LEVEL 31
523#define WE_DBGLOG_VAP_ENABLE 32
524#define WE_DBGLOG_VAP_DISABLE 33
525#define WE_DBGLOG_MODULE_ENABLE 34
526#define WE_DBGLOG_MODULE_DISABLE 35
527#define WE_DBGLOG_MOD_LOG_LEVEL 36
528#define WE_DBGLOG_TYPE 37
529#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530530/*
531 * <ioctl>
532 * set11ACRates - Fixes the Tx data rate of 11AC
533 *
534 * @INPUT: 0x1 to 0x9
535 *
536 * @OUTPUT: None
537 *
538 * This IOCTL fixes the Tx data rate of 11AC.
539 *
540 * @E.g: iwpriv wlan0 set11ACRates 0x9
541 *
542 * Supported Feature: STA
543 *
544 * Usage: Internal/External
545 *
546 * </ioctl>
547 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800548#define WE_SET_VHT_RATE 39
549#define WE_DBGLOG_REPORT_ENABLE 40
550#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530551/*
552 * <ioctl>
553 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
554 *
555 * @INPUT: Transmission power in dBm
556 *
557 * @OUTPUT: None
558 *
559 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
560 * This setting does not persist over reboots
561 *
562 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
563 *
564 * Supported Feature: STA
565 *
566 * Usage: Internal/External
567 *
568 * </ioctl>
569 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800570#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530571/*
572 * <ioctl>
573 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
574 *
575 * @INPUT: Transmission power in dBm
576 *
577 * @OUTPUT: None
578 *
579 * This IOCTL sets the maximum transmit power for the 5-GHz band
580 * This setting does not persist over reboots
581 *
582 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
583 *
584 * Supported Feature: STA
585 *
586 * Usage: Internal/External
587 *
588 * </ioctl>
589 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800590#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800591#define WE_SET_PKTLOG 44
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530592/* Private ioctl for packet power save */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800593#define WE_PPS_PAID_MATCH 45
594#define WE_PPS_GID_MATCH 46
595#define WE_PPS_EARLY_TIM_CLEAR 47
596#define WE_PPS_EARLY_DTIM_CLEAR 48
597#define WE_PPS_EOF_PAD_DELIM 49
598#define WE_PPS_MACADDR_MISMATCH 50
599#define WE_PPS_DELIM_CRC_FAIL 51
600#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530601/*
602 * <ioctl>
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +0530603 * rssi_chk - Check the rssi
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530604 *
605 * @INPUT: One argument as input
606 *
607 * @OUTPUT: rssi
608 * wlan0 rssi_chk:56
609 *
610 * This IOTCL used to chek rssi
611 *
612 * @E.g: iwpriv wlan0 rssi_chk <value>
613 *
614 * Supported Feature: STA
615 *
616 * Usage: Internal/External
617 *
618 * </ioctl>
619 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800620#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530621/*
622 * <ioctl>
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530623 * htsmps - Sets the htsmps
624 *
625 * @INPUT: Atleast one int argument
626 *
627 * @OUTPUT: None
628 *
629 * This IOTCL used to set htsmps
630 *
631 * @E.g: iwpriv wlan0 htsmps <value>
632 *
633 * Supported Feature: STA
634 *
635 * Usage: Internal/External
636 *
637 * </ioctl>
638 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800639#define WE_SET_HTSMPS 55
640/* Private ioctl for QPower */
641#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
642#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
643#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
644#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800645/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530646/*
647 * <ioctl>
648 * gtxHTMcs - Set the tx HTM value
649 *
650 * @INPUT: Atleast one int orgument
651 *
652 * @OUTPUT: None
653 *
654 * This IOTCL sets htm tx value
655 *
656 * @E.g: iwpriv wlan0 gtxHTMcs <value>
657 *
658 * Supported Feature: STA
659 *
660 * Usage: Internal/External
661 *
662 * </ioctl>
663 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800664#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530665/*
666 * <ioctl>
667 * gtxVHTMcs - Set gtxVHTMcs value
668 *
669 * @INPUT: Atleast one int argument
670 *
671 * @OUTPUT: None
672 *
673 * This IOTCL used to set gtxVHTMcs value
674 *
675 * @E.g: iwpriv wlan0 gtxVHTMcs <value>
676 *
677 * Supported Feature: STA
678 *
679 * Usage: Internal/External
680 *
681 * </ioctl>
682 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800683#define WE_SET_GTX_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530684/*
685 * <ioctl>
686 * gtxUsrCfg - Host request for GTX mask
687 *
688 * @INPUT: Atleast one int orgument
689 *
690 * @OUTPUT: None
691 *
692 * This IOTCL used send the host request for GTX mask
693 *
694 * @E.g: iwpriv wlan0 gtxUsrCfg <value>
695 *
696 * Supported Feature: STA
697 *
698 * Usage: Internal/External
699 *
700 * </ioctl>
701 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800702#define WE_SET_GTX_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530703/*
704 * <ioctl>
705 * gtxThre - Set the tx threshold
706 *
707 * @INPUT: Atleast one int argument
708 *
709 * @OUTPUT: None
710 *
711 * This IOTCL used to set tx threshold
712 *
713 * @E.g: iwpriv wlan0 gtxThre <value>
714 *
715 * Supported Feature: STA
716 *
717 * Usage: Internal/External
718 *
719 * </ioctl>
720 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800721#define WE_SET_GTX_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530722/*
723 * <ioctl>
724 * gtxMargin - Set the gtxMargin
725 *
726 * @INPUT: 1 to 32
727 *
728 * @OUTPUT: None
729 *
730 * This IOTCL use dto set gtxMargin
731 *
732 * @E.g: iwpriv wlan0 gtxMargini <value>
733 *
734 * Supported Feature: STA
735 *
736 * Usage: Internal/External
737 *
738 * </ioctl>
739 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800740#define WE_SET_GTX_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530741/*
742 * <ioctl>
743 * gtxStep - Set the gtxStep
744 *
745 * @INPUT: None
746 *
747 * @OUTPUT: None
748 *
749 * This IOTCL used to sets gtxStep
750 *
751 * @E.g: iwpriv wlan0 gtxStep <value>
752 *
753 * Supported Feature: STA
754 *
755 * Usage: Internal/External
756 *
757 * </ioctl>
758 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800759#define WE_SET_GTX_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530760/*
761 * <ioctl>
762 * gtxMinTpc - Sets the gtxMinTpc
763 *
764 * @INPUT: Atleast one int argument
765 *
766 * @OUTPUT: None
767 *
768 * This IOTCL sets the tx MinTpc
769 *
770 * @E.g: iwpriv wlan0 gtxMinTpc <value>
771 *
772 * Supported Feature: STA
773 *
774 * Usage: Internal/External
775 *
776 * </ioctl>
777 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800778#define WE_SET_GTX_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530779/*
780 * <ioctl>
781 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
782 *
783 * @INPUT: Mask value
784 *
785 * @OUTPUT: None
786 *
787 * This IOTCL used to set gtxBWMask
788 *
789 * @E.g: iwpriv wlan0 gtxBWMask <value>
790 *
791 * Supported Feature: STA
792 *
793 * Usage: Internal/External
794 *
795 * </ioctl>
796 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530797
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530798#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530799/*
800 * <ioctl>
801 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
802 *
803 * @INPUT: set_value
804 *
805 * @OUTPUT: None
806 *
807 * This IOCTL is used to set the MCC latency value in milliseconds
808 * during STA-P2P concurrency.
809 *
810 * If 0ms latency is provided, then FW will set to a default.
811 * Otherwise, latency must be at least 30ms.
812 *
813 * @E.g: iwpriv wlan0 setMccLatency 40
814 *
815 *
816 * Supported Feature: Concurrency
817 *
818 * Usage: Internal/External
819 *
820 * </ioctl>
821 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800822#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530823
824/*
825 * <ioctl>
826 * setMccQuota- Set the quota for P2P cases
827 *
828 * @INPUT: set_value [0,100]
829 *
830 * @OUTPUT: None
831 *
832 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
833 *
834 * Currently used to set time quota for 2 MCC vdevs/adapters using
835 * (operating channel, quota) for each mode.
836 * The info is provided run time using iwpriv command:
837 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
838 * Note: the quota provided in command is for the same mode in cmd.
839 * HDD checks if MCC mode is active, gets the second mode and its
840 * operating chan.
841 * Quota for the 2nd role is calculated as 100 - quota of first mode.
842 *
843 * @E.g: iwpriv wlan0 setMccQuota 50
844 * iwpriv p2p0 setMccQuota 50
845 *
846 * Supported Feature: Concurrency
847 *
848 * Usage: Internal/External
849 *
850 * </ioctl>
851 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800852#define WE_MCC_CONFIG_QUOTA 71
853/* Private IOCTL for debug connection issues */
854#define WE_SET_DEBUG_LOG 72
855#ifdef WE_SET_TX_POWER
856#undef WE_SET_TX_POWER
857#endif
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -0800858
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530859/*
860 * <ioctl>
861 * setTxPower - Set the current transmit power
862 *
863 * @INPUT: Transmission power in dBm
864 *
865 * @OUTPUT: None
866 *
867 * This IOCTL sets the current transmit power.
868 * This setting does not persist over reboots.
869 *
870 * @E.g: iwpriv wlan0 setTxPower 10
871 *
872 * Supported Feature: STA
873 *
874 * Usage: Internal/External
875 *
876 * </ioctl>
877 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800878#define WE_SET_TX_POWER 74
879/* Private ioctl for earlyrx power save feature */
880#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
881#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
882#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
883#define WE_SET_EARLY_RX_SLOP_STEP 78
884#define WE_SET_EARLY_RX_INIT_SLOP 79
885#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530886/*
887 * <ioctl>
888 * setMcRate - Set the data rate for multicast data
889 *
890 * @INPUT: 1 to 32
891 *
892 * @OUTPUT: None
893 *
894 * This IOCTL sets the data rate for multicast data. Note that this command
895 * is allowed only in STA, IBSS, or QCMobileAP mode
896 *
897 * @E.g: iwpriv wlan0 setMcRate <value>
898 *
899 * Supported Feature: STA
900 *
901 * Usage: Internal/External
902 *
903 * </ioctl>
904 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800905#define WE_SET_MC_RATE 81
906#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
907/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530908/*
909 * <ioctl>
910 * 5g_ebt - Sets the 5g_ebt
911 *
912 * @INPUT: <value>
913 *
914 * @OUTPUT: None
915 *
916 * This IOTCL used to set 5g_ebt
917 *
918 * @E.g: iwpriv wlan0 5g_ebt <value>
919 *
920 * Supported Feature: STA
921 *
922 * Usage: Internal/External
923 *
924 * </ioctl>
925 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800926#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530927/*
928 * <ioctl>
929 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
930 *
931 * @INPUT: 20 t0 160
932 *
933 * @OUTPUT: None
934 *
935 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
936 *
937 * @E.g: iwpriv wlan0 cts_cbw <value>
938 *
939 * Supported Feature: STA
940 *
941 * Usage: Internal/External
942 *
943 * </ioctl>
944 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800945#define WE_SET_CTS_CBW 84
946#define WE_DUMP_STATS 85
947#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +0530948/* Private sub ioctl for starting/stopping the profiling */
949#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +0530950
Abhishek Singh3c507012016-12-01 11:15:42 +0530951/*
952 * <ioctl>
953 * setChanChange - Initiate channel change
954 *
955 * @INPUT: channel number to switch to.
956 *
957 * @OUTPUT: None
958 *
959 * This IOCTL is used to initiate a channel change.
960 * If called on STA/CLI interface it will send the
961 * ECSA action frame to the connected SAP/GO asking to
962 * initiate the ECSA, if supported.
963 * If called on SAP/GO interface it will initiate
964 * ECSA and ask connected peers to move to new channel.
965 *
966 * @E.g: iwpriv wlan0 setChanChange <channel>
967 * iwpriv wlan0 setChanChange 1
968 *
969 * Supported Feature: ECSA
970 *
971 * Usage: Internal/External
972 *
973 * </ioctl>
974 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +0530975#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +0530976#define WE_SET_CONC_SYSTEM_PREF 89
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800977
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -0800978/*
979 * <ioctl>
980 * set_11ax_rate - set 11ax rates to FW
981 *
982 * @INPUT: rate code
983 *
984 * @OUTPUT: None
985 *
986 * This IOCTL fixes the Tx data rate of 11AX.
987 *
988 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
989 *
990 * Supported Feature: STA/SAP
991 *
992 * Usage: Internal
993 *
994 * </ioctl>
995 */
996#define WE_SET_11AX_RATE 91
997
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -0700998/*
999 * <ioctl>
1000 * enable_dcm - enable Dual Carrier Modulation(DCM)
1001 *
1002 * @INPUT: 0/1
1003 *
1004 * @OUTPUT: None
1005 *
1006 * This IOCTL enables/disables DCM.
1007 *
1008 * @E.g: iwpriv wlan0 enable_dcm <0/1>
1009 *
1010 * Supported Feature: STA/SAP
1011 *
1012 * Usage: Internal
1013 *
1014 * </ioctl>
1015 */
1016#define WE_SET_DCM 92
1017
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001018/*
1019 * <ioctl>
Naveen Rawat53448ea2017-11-27 11:43:18 -08001020 * range_ext - enable Range extension
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001021 *
1022 * @INPUT: 0/1
1023 *
1024 * @OUTPUT: None
1025 *
1026 * This IOCTL enables/disables Range extension.
1027 *
Naveen Rawat53448ea2017-11-27 11:43:18 -08001028 * @E.g: iwpriv wlan0 range_ext <1/0>
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001029 *
1030 * Supported Feature: STA/SAP
1031 *
1032 * Usage: Internal
1033 *
1034 * </ioctl>
1035 */
1036#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001037
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301038/*
1039 * <ioctl>
1040 * wow_ito - sets the timeout value for inactivity data while
1041 * in power save mode during wow
1042 *
1043 * @INPUT: int
1044 *
1045 * @OUTPUT: None
1046 *
1047 * This IOCTL set the timeout value for inactivity data in power save mode
1048 *
1049 * @E.g: iwpriv wlan0 wow_ito 20
1050 *
1051 * Supported Feature: STA
1052 *
1053 * Usage: External
1054 *
1055 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001056 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301057#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1058
Jeff Johnson011c4502017-10-05 15:25:56 -07001059/*
1060 * <ioctl>
1061 * pdev_reset - reset the pdev
1062 *
1063 * @INPUT: Reset command to initiate:
1064 * TX_FLUSH = 1
1065 * WARM_RESET = 2
1066 * COLD_RESET = 3
1067 * WARM_RESET_RESTORE_CAL = 4
1068 * COLD_RESET_RESTORE_CAL = 5
1069 *
1070 * @OUTPUT: None
1071 *
1072 * This IOCTL is used to reset the pdev. The primary use is
1073 * for internal testing. It is not expected that this will
1074 * be used on a production device.
1075 *
1076 * @E.g: iwpriv wlan0 pdev_reset <command>
1077 * iwpriv wlan0 pdev_reset 1
1078 *
1079 * Supported Feature: None
1080 *
1081 * Usage: Internal
1082 *
1083 * </ioctl>
1084 */
1085#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301086
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301087/*
1088 * setModDTIM - Change Modulated DTIM
1089 *
1090 * @INPUT: set_value.
1091 *
1092 * @OUTPUT: None
1093 *
1094 * This IOCTL is used to change modulated DTIM
1095 * value without WIFI OFF/ON.
1096 *
1097 * @E.g: iwpriv wlan0 setModDTIM <value>
1098 * iwpriv wlan0 setModDTIM 2
1099 *
1100 * Supported Feature: N/A
1101 *
1102 * Usage: Internal/External
1103 *
1104 * </ioctl>
1105 */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05301106#define WE_SET_MODULATED_DTIM 96
1107
1108#ifdef WLAN_FEATURE_MOTION_DETECTION
1109#define WE_MOTION_DET_START_STOP 97
1110#define WE_MOTION_DET_BASE_LINE_START_STOP 98
1111#endif /* WLAN_FEATURE_MOTION_DETECTION */
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301112
Krishna Reddya50d09f2019-02-04 14:55:06 +05301113/*
Krishna Reddy64c14da2019-02-12 20:23:12 +05301114 * set_btc_mode Set BTCoexMode
Krishna Reddya50d09f2019-02-04 14:55:06 +05301115 *
1116 * @INPUT: set_value.
1117 *
1118 * @OUTPUT: None
1119 *
1120 * This IOCTL is used to set the BT COex operating mode
Krishna Reddy64c14da2019-02-12 20:23:12 +05301121 * Allowed values are 0(TDD), 1(FDD), 2(Hybrid)
Krishna Reddya50d09f2019-02-04 14:55:06 +05301122 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301123 * @E.g: iwpriv wlan0 set_btc_mode <value>
1124 * iwpriv wlan0 set_btc_mode 2
Krishna Reddya50d09f2019-02-04 14:55:06 +05301125 *
1126 * Supported Feature: N/A
1127 *
1128 * Usage: Internal/External
1129 *
1130 * </ioctl>
1131 */
1132#define WE_SET_BTCOEX_MODE 99
1133
1134/*
Krishna Reddy64c14da2019-02-12 20:23:12 +05301135 * set_btc_rssi- Set WLAN low RSSI threshold for BTCOex
Krishna Reddya50d09f2019-02-04 14:55:06 +05301136 *
1137 * @INPUT: set_value.
1138 *
1139 * @OUTPUT: None
1140 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301141 * This IOCTL is used to modify the threshold at which
1142 * the COex mode changes from TDD to Hybrid mode
Krishna Reddya50d09f2019-02-04 14:55:06 +05301143 * Allowed values are from -100 to 0
1144 *
Krishna Reddy64c14da2019-02-12 20:23:12 +05301145 * @E.g: iwpriv wlan0 set_btc_rssi <value>
1146 * iwpriv wlan0 set_btc_rssi -70
Krishna Reddya50d09f2019-02-04 14:55:06 +05301147 *
1148 * Supported Feature: N/A
1149 *
1150 * Usage: Internal/External
1151 *
1152 * </ioctl>
1153 */
1154#define WE_SET_BTCOEX_RSSI_THRESHOLD 100
1155
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001156/* Private ioctls and their sub-ioctls */
1157#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1158#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001159#define WE_GET_WLAN_DBG 4
1160#define WE_GET_MAX_ASSOC 6
1161/* 7 is unused */
1162#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301163
1164/*
1165 * <ioctl>
1166 * getconcurrency - Get concurrency mode
1167 *
1168 * @INPUT: None
1169 *
1170 * @OUTPUT: It shows concurrency value
1171 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1172 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1173 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1174 *
1175 * This IOCTL is used to retrieve concurrency mode.
1176 *
1177 * @E.g: iwpriv wlan0 getconcurrency
1178 * wlan0 getconcurrency:5
1179 * Above value shows STA+P2P_Client
1180 *
1181 * Supported Feature: Concurrency
1182 *
1183 * Usage: Internal/External
1184 *
1185 * </ioctl>
1186 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001187#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301188/*
1189 * <ioctl>
1190 * get_nss - Get the number of spatial STBC streams (NSS)
1191 *
1192 * @INPUT: None
1193 *
1194 * @OUTPUT: NSS
1195 * wlan0 get_nss:2
1196 *
1197 * This IOTCL used to get the number of spatial STBC streams
1198 *
1199 * @E.g: iwpriv wlan0 get_nss
1200 *
1201 * Supported Feature: STA
1202 *
1203 * Usage: Internal/External
1204 *
1205 * </ioctl>
1206 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001207#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301208/*
1209 * <ioctl>
1210 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1211 *
1212 * @INPUT: None
1213 *
1214 * @OUTPUT: ldpc
1215 * wlan0 get_ldpc:1
1216 *
1217 * This IOTCL used to gets the low density parity check (LDPC)
1218 *
1219 * @E.g: iwpriv wlan0 get_ldpc
1220 *
1221 * Supported Feature: STA
1222 *
1223 * Usage: Internal/External
1224 *
1225 * </ioctl>
1226 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001227#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301228/*
1229 * <ioctl>
1230 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1231 *
1232 * @INPUT: None
1233 *
1234 * @OUTPUT: TXSTBC
1235 * wlan0 get_tx_stbc:1
1236 *
1237 * This IOTCL get the value of the current Tx space time block code (STBC)
1238 *
1239 * @E.g: iwpriv wlan0 get_tx_stbc
1240 *
1241 * Supported Feature: STA
1242 *
1243 * Usage: Internal/External
1244 *
1245 * </ioctl>
1246 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001247#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301248/*
1249 * <ioctl>
1250 * get_rx_stbc - Gets the value of the current Rx STBC
1251 *
1252 * @INPUT: None
1253 *
1254 * @OUTPUT: Rx STBC
1255 * wlan0 get_rx_stbc:1
1256 *
1257 * This IOTCL used to get the value of the current Rx STBC
1258 *
1259 * @E.g: iwpriv wlan0 get_rx_stbc
1260 *
1261 * Supported Feature: STA
1262 *
1263 * Usage: Internal/External
1264 *
1265 * </ioctl>
1266 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001267#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301268/*
1269 * <ioctl>
1270 * get_shortgi - Get the value of the current short GI setting
1271 *
1272 * @INPUT: None
1273 *
1274 * @OUTPUT: Enable/disable of shortgi
1275 * wlan0 get_shortgi:1
1276 *
1277 * This IOCTL gets the value of the current short GI setting
1278 *
1279 * @E.g: iwpriv wlan0 get_shortgi
1280 *
1281 * Supported Feature: STA
1282 *
1283 * Usage: Internal/External
1284 *
1285 * </ioctl>
1286 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001287#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301288/*
1289 * <ioctl>
1290 * get_rtscts - Get the value of the current RTS/CTS setting.
1291 *
1292 * @INPUT: None
1293 *
1294 * @OUTPUT: Enable/disable of RTS/CTS
1295 * wlan0 get_rtscts:33
1296 *
1297 * This IOTCL get the value of the current RTS/CTS setting.
1298 *
1299 * @E.g: iwpriv wlan0 get_rtscts
1300 *
1301 * Supported Feature: STA
1302 *
1303 * Usage: Internal/External
1304 *
1305 * </ioctl>
1306 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001307#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301308/*
1309 * <ioctl>
1310 * get_chwidth - Get the current channel width setting
1311 *
1312 * @INPUT: None
1313 *
1314 * @OUTPUT: channel width
1315 * wlan0 get_chwidth:0
1316 *
1317 * This IOTCL get the current channel width setting.
1318 *
1319 * @E.g: iwpriv wlan0 get_chwidth
1320 *
1321 * Supported Feature: STA
1322 *
1323 * Usage: Internal/External
1324 *
1325 * </ioctl>
1326 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001327#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301328/*
1329 * <ioctl>
1330 * get_anienable - Get the anienable
1331 *
1332 * @INPUT: None
1333 *
1334 * @OUTPUT:
1335 * wlan0 get_anienable:0
1336 *
1337 * This IOTCL get the anienable
1338 *
1339 * @E.g: iwpriv wlan0 get_anienable
1340 *
1341 * Supported Feature: STA
1342 *
1343 * Usage: Internal/External
1344 *
1345 * </ioctl>
1346 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001347#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301348/*
1349 * <ioctl>
1350 * get_aniplen - Get the aniplen
1351 *
1352 * @INPUT: None
1353 *
1354 * @OUTPUT:
1355 * wlan0 get_aniplen:0
1356 *
1357 * This IOTCL get the aniplen
1358 *
1359 * @E.g: iwpriv wlan0 get_aniplen
1360 *
1361 * Supported Feature: STA
1362 *
1363 * Usage: Internal/External
1364 *
1365 * </ioctl>
1366 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001367#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301368/*
1369 * <ioctl>
1370 * get_anilislen- Get the anilislen
1371 *
1372 * @INPUT: None
1373 *
1374 * @OUTPUT:
1375 * wlan0 get_anilislen:0
1376 *
1377 * This IOTCL used to get anilislen
1378 *
1379 * @E.g: iwpriv wlan0 get_anilislen
1380 *
1381 * Supported Feature: STA
1382 *
1383 * Usage: Internal/External
1384 *
1385 * </ioctl>
1386 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001387#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301388/*
1389 * <ioctl>
1390 * get_aniofdmlvl - Get the OFDM level
1391 *
1392 * @INPUT: None
1393 *
1394 * @OUTPUT: OFDM
1395 * wlan0 get_aniofdmlvl:0
1396 *
1397 * This IOTCL used to get ofdm level
1398 *
1399 * @E.g: iwpriv wlan0 get_aniofdmlvl
1400 *
1401 * Supported Feature: STA
1402 *
1403 * Usage: Internal/External
1404 *
1405 * </ioctl>
1406 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001407#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301408/*
1409 * <ioctl>
1410 * get_aniccklvl - Get the cck level
1411 *
1412 * @INPUT: None
1413 *
1414 * @OUTPUT:
1415 * wlan0 get_aniccklvl:0
1416 *
1417 * This IOTCL used to get cck level
1418 *
1419 * @E.g: iwpriv wlan0 get_aniccklvl
1420 *
1421 * Supported Feature: STA
1422 *
1423 * Usage: Internal/External
1424 *
1425 * </ioctl>
1426 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001427#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301428/*
1429 * <ioctl>
1430 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1431 *
1432 * @INPUT: None
1433 *
1434 * @OUTPUT: Enable/disable dynamic channel bandwidth
1435 * wlan0 get_cwmenable:0
1436 *
1437 * This IOTCL get the value of the dynamic channel bandwidth setting
1438 *
1439 * @E.g: iwpriv wlan0 get_cwmenable
1440 *
1441 * Supported Feature: STA
1442 *
1443 * Usage: Internal/External
1444 *
1445 * </ioctl>
1446 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001447#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301448/*
1449 * <ioctl>
1450 * get_txchainmask - Get the txchainmask that was set
1451 *
1452 * @INPUT: None
1453 *
1454 * @OUTPUT: txchainmask
1455 * wlan0 get_txchainmask:1
1456 *
1457 * This IOCTL gets the txchainmask that was set
1458 * This command is useful if it was previously set
1459 *
1460 * @E.g: iwpriv wlan0 get_txchainmask
1461 *
1462 * Supported Feature: STA
1463 *
1464 * Usage: Internal/External
1465 *
1466 * </ioctl>
1467 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001468#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301469/*
1470 * <ioctl>
1471 * get_rxchainmask - Get the rxchainmask that was set
1472 *
1473 * @INPUT: None
1474 *
1475 * @OUTPUT: rxchainmask
1476 * wlan0 get_rxchainmask:1
1477 *
1478 * This IOCTL gets the rxchainmask that was set
1479 * This command is useful only if it was previously set.
1480 *
1481 * @E.g: iwpriv wlan0 get_rxchainmask
1482 *
1483 * Supported Feature: STA
1484 *
1485 * Usage: Internal/External
1486 *
1487 * </ioctl>
1488 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001489#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301490/*
1491 * <ioctl>
1492 * get_11nrate - Get the fixed Tx data rate
1493 *
1494 * @INPUT: None
1495 *
1496 * @OUTPUT: Using this command does not return the same value as set
1497 * wlan0 get_11nrate:0
1498 *
1499 * This IOCTL gets the fixed Tx data rate
1500 * This command is useful only if setting the fixed Tx rate.
1501 *
1502 * @E.g: iwpriv wlan0 get_11nrate
1503 *
1504 * Supported Feature: STA
1505 *
1506 * Usage: Internal/External
1507 *
1508 * </ioctl>
1509 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001510#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301511/*
1512 * <ioctl>
1513 * get_ampdu - Get the maximum subframe of ampdu
1514 *
1515 * @INPUT: None
1516 *
1517 * @OUTPUT: Maximum subframe of ampdu
1518 * wlan0 get_ampdu:1
1519 *
1520 * This IOCTL gets the maximum subframe of ampdu
1521 * This command is useful only if setting ampdu.
1522 *
1523 * @E.g: iwpriv wlan0 get_ampdu
1524 *
1525 * Supported Feature: STA
1526 *
1527 * Usage: Internal/External
1528 *
1529 * </ioctl>
1530 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001531#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301532/*
1533 * <ioctl>
1534 * get_amsdu - Get the maximum subframe of amsdu
1535 *
1536 * @INPUT: None
1537 *
1538 * @OUTPUT: Maximum subframe of amsdu
1539 * wlan0 get_amsdu:1
1540 *
1541 * This IOCTL gets the maximum subframe of amsdu.
1542 * This command is useful only if setting amsdu
1543 *
1544 * @E.g: iwpriv wlan0 get_amsdu
1545 *
1546 * Supported Feature: STA
1547 *
1548 * Usage: Internal/External
1549 *
1550 * </ioctl>
1551 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001552#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301553/*
1554 * <ioctl>
1555 * get_txpow2g - Get the current 2 GHz Tx power setting
1556 *
1557 * @INPUT: None
1558 *
1559 * @OUTPUT: Tx Power in dbm
1560 * wlan0 get_txpow2g:0
1561 *
1562 * This IOCTL gets the current 2 GHz Tx power setting
1563 * This command is useful if setting Tx power
1564 *
1565 * @E.g: iwpriv wlan0 get_txpow2g
1566 *
1567 * Supported Feature: STA
1568 *
1569 * Usage: Internal/External
1570 *
1571 * </ioctl>
1572 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001573#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301574/*
1575 * <ioctl>
1576 * get_txpow5g - Get the current 5 GHz Tx power setting
1577 *
1578 * @INPUT: None
1579 *
1580 * @OUTPUT: Tx Power in dbm
1581 * wlan0 get_txpow5g:0
1582 *
1583 * This IOCTL gets the current 5 GHz Tx power setting
1584 * This command is useful if setting Tx power
1585 *
1586 * @E.g: iwpriv wlan0 get_txpow5g
1587 *
1588 * Supported Feature: STA
1589 *
1590 * Usage: Internal/External
1591 *
1592 * </ioctl>
1593 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001594#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001595/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001596#define WE_GET_PPS_PAID_MATCH 32
1597#define WE_GET_PPS_GID_MATCH 33
1598#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1599#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1600#define WE_GET_PPS_EOF_PAD_DELIM 36
1601#define WE_GET_PPS_MACADDR_MISMATCH 37
1602#define WE_GET_PPS_DELIM_CRC_FAIL 38
1603#define WE_GET_PPS_GID_NSTS_ZERO 39
1604#define WE_GET_PPS_RSSI_CHECK 40
1605/* Private ioctl for QPower */
1606#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1607#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1608#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1609#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001610/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301611/*
1612 * <ioctl>
1613 * get_gtxHTMcs - Get the tx HTM
1614 *
1615 * @INPUT: None
1616 *
1617 * @OUTPUT: HTM
1618 * wlan0 get_gtxHTMcs:32896
1619 *
1620 * This IOTCL used to get HTM
1621 *
1622 * @E.g: iwpriv wlan0 get_gtxHTMcs
1623 *
1624 * Supported Feature: STA
1625 *
1626 * Usage: Internal/External
1627 *
1628 * </ioctl>
1629 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001630#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301631/*
1632 * <ioctl>
1633 * get_gtxVHTMcs - Get the VHTM
1634 *
1635 * @INPUT: None
1636 *
1637 * @OUTPUT: VHTM
1638 * wlan0 get_gtxVHTMcs:524800
1639 *
1640 * This IOTCL used to get the VHTM
1641 *
1642 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1643 *
1644 * Supported Feature: STA
1645 *
1646 * Usage: Internal/External
1647 *
1648 * </ioctl>
1649 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001650#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301651/*
1652 * <ioctl>
1653 * get_gtxUsrCfg - Get the tx cfg
1654 *
1655 * @INPUT: None
1656 *
1657 * @OUTPUT: TXCFG
1658 * wlan0 get_gtxUsrCfg:32
1659 *
1660 * This IOTCL used to get the tx cfg
1661 *
1662 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1663 *
1664 * Supported Feature: STA
1665 *
1666 * Usage: Internal/External
1667 *
1668 * </ioctl>
1669 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001670#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301671/*
1672 * <ioctl>
1673 * get_gtxThre - Get the tx threshold
1674 *
1675 * @INPUT: None
1676 *
1677 * @OUTPUT: Threshold
1678 * wlan0 get_gtxThre:3
1679 *
1680 * This IOCTL is used to get tx threshold
1681 *
1682 * @E.g: iwpriv wlan0 get_gtxThre
1683 *
1684 * Supported Feature: STA
1685 *
1686 * Usage: Internal/External
1687 *
1688 * </ioctl>
1689 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001690#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301691/*
1692 * <ioctl>
1693 * get_gtxMargin - Get the tx margin
1694 *
1695 * @INPUT: None
1696 *
1697 * @OUTPUT: GTXMARGIN
1698 * wlan0 get_gtxMargin:2
1699 *
1700 * This IOCTL is used to set tx margin
1701 *
1702 * @E.g: iwpriv wlan0 get_gtxMargin
1703 *
1704 * Supported Feature: STA
1705 *
1706 * Usage: Internal/External
1707 *
1708 * </ioctl>
1709 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001710#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301711/*
1712 * <ioctl>
1713 * get_gtxStep - Get the tx step
1714 *
1715 * @INPUT: None
1716 *
1717 * @OUTPUT: GTXSTEP
1718 * wlan0 get_gtxStep:0
1719 *
1720 * This IOCTL is used to get the gtx step
1721 *
1722 * @E.g: iwpriv wlan0 get_gtxStep
1723 *
1724 * Supported Feature: STA
1725 *
1726 * Usage: Internal/External
1727 *
1728 * </ioctl>
1729 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001730#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301731/*
1732 * <ioctl>
1733 * get_gtxMinTpc - Get the tx miminum tpc
1734 *
1735 * @INPUT: None
1736 *
1737 * @OUTPUT: TPC
1738 * wlan0 get_gtxMinTpc:0
1739 *
1740 * This IOCTL is used to get tx miminum tpc
1741 *
1742 * @E.g: iwpriv wlan0 get_gtxMinTpc
1743 *
1744 * Supported Feature: STA
1745 *
1746 * Usage: Internal/External
1747 *
1748 * </ioctl>
1749 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001750#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301751/*
1752 * <ioctl>
1753 * get_gtxBWMask - Get the tx BW MASK
1754 *
1755 * @INPUT: None
1756 *
1757 * @OUTPUT: MASK
1758 * wlan0 get_gtxBWMask:15
1759 *
1760 * This IOCTL is used get gtx bw mask
1761 *
1762 * @E.g: iwpriv wlan0 get_gtxBWMask
1763 *
1764 * Supported Feature: STA
1765 *
1766 * Usage: Internal/External
1767 *
1768 * </ioctl>
1769 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001770#define WE_GET_GTX_BWMASK 54
1771#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001772#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001773#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001774
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001775/*
1776 * <ioctl>
1777 * get_dcm - Get dcm enablement value
1778 *
1779 * @INPUT: None
1780 *
1781 * @OUTPUT: 0/1
1782 * wlan0 get_dcm
1783 *
1784 * This IOCTL is used get dcm value
1785 *
1786 * Supported Feature: STA/SAP
1787 *
1788 * Usage: Internal
1789 *
1790 * </ioctl>
1791 */
1792#define WE_GET_DCM 60
1793
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001794/*
1795 * <ioctl>
1796 * get_dcm - Get range extension enablement value
1797 *
1798 * @INPUT: None
1799 *
1800 * @OUTPUT: 0/1
1801 * wlan0 get_range_ext
1802 *
1803 * This IOCTL is used get range_extension value
1804 *
1805 * Supported Feature: STA/SAP
1806 *
1807 * Usage: Internal
1808 *
1809 * </ioctl>
1810 */
1811#define WE_GET_RANGE_EXT 61
1812
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001813/* Private ioctls and their sub-ioctls */
1814#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1815
1816/* Private ioctls and their sub-ioctls */
1817#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1818#define WE_WOWL_ADD_PTRN 1
1819#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301820/*
1821 * <ioctl>
1822 * neighbor - Send neighbor report request
1823 *
1824 * @INPUT: string
1825 *
1826 * @OUTPUT: None
1827 *
1828 * This IOCTL create a Neighbor report request and send it to peer
1829 *
1830 * @E.g: iwpriv wlan0 neighbor "SSID"
1831 *
1832 * Supported Feature: 11k
1833 *
1834 * Usage: Internal/External
1835 *
1836 * </ioctl>
1837 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001838#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301839/*
1840 * <ioctl>
1841 * set_ap_wps_ie - Set the P2P IE of the probe response
1842 *
1843 * @INPUT: string
1844 *
1845 * @OUTPUT: None
1846 *
1847 * This IOCTL sets the P2P IE of the probe response
1848 *
1849 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1850 *
1851 * Supported Feature: STA
1852 *
1853 * Usage: Internal/External
1854 *
1855 * </ioctl>
1856 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001857#define WE_SET_AP_WPS_IE 4
Jeff Johnson0fcc94e2019-03-06 19:48:17 -08001858
1859/* 5 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001860
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07001861/*
1862 * <ioctl>
1863 * unit_test - execute component-level unit tests
1864 *
1865 * @INPUT: string - the name of the component to test.
1866 * All tests are executed if unspecified
1867 * @OUTPUT: None
1868 *
1869 * Usage: Internal only
1870 * </ioctl>
1871 */
1872#define WE_UNIT_TEST 6
1873
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001874/* Private ioctls and their sub-ioctls */
1875#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1876#define WE_SET_WLAN_DBG 1
1877#define WE_SET_DP_TRACE 2
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301878#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001879
1880/* Private ioctls and their sub-ioctls */
1881#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1882#define WE_WLAN_VERSION 1
1883#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301884/*
1885 * <ioctl>
1886 * getConfig - gets the values of all configurations listed in WCNSS
1887 *
1888 * @INPUT: None
1889 *
1890 * @OUTPUT: Current configuration to the sys log
1891 * wlan0 getConfig: WLAN configuration written to system log
1892 *
1893 * This IOCTL gets the values of all configurations listed in WCNSS
1894 *
1895 * @E.g: iwpriv wlan0 getConfig
1896 *
1897 * Supported Feature: STA
1898 *
1899 * Usage: Internal/External
1900 *
1901 * </ioctl>
1902 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001903#define WE_GET_CFG 3
1904#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301905/*
1906 * <ioctl>
1907 * getChannelList - Get the available channel list while in QCMobileAP
1908 *
1909 * @INPUT: None
1910 *
1911 * @OUTPUT: Channel list
1912 * wlan0 getChannelList:36 US 1..165
1913 *
1914 * This IOCTL gets the available channel list while in QCMobileAP
1915 *
1916 * @E.g: iwpriv wlan0 getChannelList
1917 *
1918 * Supported Feature: STA
1919 *
1920 * Usage: Internal/External
1921 *
1922 * </ioctl>
1923 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001924#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301925/*
1926 * <ioctl>
1927 * getRSSI - Get the Received Signal Strength Indicator
1928 *
1929 * @INPUT: None
1930 *
1931 * @OUTPUT: RSSI
1932 * wlan0 getRSSI:rsssi=-32
1933 *
1934 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1935 *
1936 * @E.g: iwpriv wlan0 getRSSI
1937 *
1938 * Supported Feature: STA
1939 *
1940 * Usage: Internal/External
1941 *
1942 * </ioctl>
1943 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001944#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001945
1946/*
1947 * <ioctl>
1948 * getSuspendStats - Get suspend/resume stats
1949 *
1950 * @INPUT: None
1951 *
1952 * @OUTPUT: character string containing formatted suspend/resume stats
1953 *
1954 * This ioctl is used to get suspend/resume stats formatted for display.
1955 * Currently it includes suspend/resume counts, wow wake up reasons, and
1956 * suspend fail reasons.
1957 *
1958 * @E.g: iwpriv wlan0 getSuspendStats
1959 * iwpriv wlan0 getSuspendStats
1960 *
1961 * Supported Feature: suspend/resume
1962 *
1963 * Usage: Internal
1964 *
1965 * </ioctl>
1966 */
1967#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001968#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05301969/*
1970 * <ioctl>
1971 * getTdlsPeers - Get all TDLS peers.
1972 *
1973 * @INPUT: None
1974 *
1975 * @OUTPUT: Returns the MAC address of all the TDLS peers
1976 * wlan0 getTdlsPeers:
1977 * MAC Id cap up RSSI
1978 * ---------------------------------
1979 * 00:0a:f5:0e:bd:18 2 Y Y -44
1980 * 00:0a:f5:bf:0e:12 0 N N 0
1981 *
1982 * This IOCTL is used to get all TDLS peers.
1983 *
1984 * @E.g: iwpriv wlan0 getTdlsPeers
1985 *
1986 * Supported Feature: TDLS
1987 *
1988 * Usage: Internal/External
1989 *
1990 * </ioctl>
1991 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001992#define WE_GET_TDLS_PEERS 8
1993#endif
1994#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05301995/*
1996 * <ioctl>
1997 * getPMFInfo - get the PMF info of the connected session
1998 *
1999 * @INPUT: None
2000 *
2001 * @OUTPUT:
2002 * wlan0 getPMFInfo:
2003 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
2004 * Number of Unprotected Disassocs 0
2005 * Number of Unprotected Deauths 0
2006 *
2007 * This IOCTL is used to get the PMF stats/status of the current
2008 * connection.
2009 *
2010 * @e.g:iwpriv wlan0 getPMFInfo
2011 *
2012 * Supported Feature: PMF
2013 *
2014 * Usage: Internal/External
2015 *
2016 * </ioctl>
2017 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002018#define WE_GET_11W_INFO 9
2019#endif
2020#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05302021/*
2022 * <ioctl>
2023 * getIbssSTAs - get ibss sta info
2024 *
2025 * @INPUT: None
2026 *
2027 * @OUTPUT: Give the MAC of the IBSS STA
2028 * wlan0 getIbssSTAs:
2029 * 1 .8c:fd:f0:01:9c:bf
2030 *
2031 * This IOCTL is used to get ibss sta info
2032 *
2033 * @E.g: iwpriv wlan0 getIbssSTAs
2034 *
2035 * Supported Feature: IBSS
2036 *
2037 * Usage: Internal/External
2038 *
2039 * </ioctl>
2040 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002041#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302042/*
2043 * <ioctl>
2044 * getphymode - Get the current phymode.
2045 *
2046 * @INPUT: None
2047 *
2048 * @OUTPUT: In phymode
2049 * wlan0 getphymode:AUTO MODE
2050 *
2051 * This IOCTL used to gets the current phymode.
2052 *
2053 * @E.g: iwpriv wlan0 getphymode
2054 *
2055 * Supported Feature: STA
2056 *
2057 * Usage: Internal/External
2058 *
2059 * </ioctl>
2060 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002061#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002062
2063/*
2064 * <ioctl>
2065 * getOemDataCap - Get the oem data caps.
2066 *
2067 * @INPUT: None
2068 *
2069 * @OUTPUT: oem data capability
2070 *
2071 * This IOCTL used to gets the current oem data cap.
2072 *
2073 * @E.g: iwpriv wlan0 getOemDataCap
2074 *
2075 * Usage: Internal/External
2076 *
2077 * </ioctl>
2078 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002079#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002080
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302081/*
2082 * <ioctl>
2083 * getSNR - Enable SNR Monitoring
2084 *
2085 * @INPUT: None
2086 *
2087 * @OUTPUT: Signal strength/ratio
2088 * wlan0 getSNR:1
2089 *
2090 * This IOCTL is used to get ibss sta info
2091 *
2092 * @E.g: iwpriv wlan0 getSNR
2093 *
2094 * Supported Feature: STA
2095 *
2096 * Usage: Internal/External
2097 *
2098 * </ioctl>
2099 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002100
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002101#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302102#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002103
Krunal Soni6c3859f2018-06-01 19:57:40 -07002104/*
2105 * <ioctl>
2106 *
2107 * get_ba_timeout - to get timeout for each AC
2108 *
2109 * @INPUT: None
2110 *
2111 * @OUTPUT: displays timeout value for each access class
2112 *
2113 * @E.g.: iwpriv wlan0 get_ba_timeout
2114 *
2115 * Usage: Internal
2116 *
2117 * </ioctl>
2118 */
2119#define WE_GET_BA_AGEING_TIMEOUT 16
2120
Krunal Soni5e483782018-10-25 15:42:44 -07002121/*
2122 * <ioctl>
2123 *
2124 * sta_cxn_info - STA connection information
2125 *
2126 * @INPUT: none
2127 *
2128 * @OUTPUT: STA's connection information
2129 *
2130 * This IOCTL is used to get connection's information.
2131 *
2132 * @E.g: iwpriv wlan0 get_cxn_info
2133 *
2134 * Usage: Internal
2135 *
2136 * </ioctl>
2137 */
2138#define WE_GET_STA_CXN_INFO 17
2139
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002140/* Private ioctls and their sub-ioctls */
2141#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302142
2143/*
2144 * <ioctl>
2145 * reassoc - Trigger STA re-association to the connected AP
2146 *
2147 * @INPUT: None
2148 *
2149 * @OUTPUT: None
2150 *
2151 * This IOCTL is used to trigger STA reassociation to the connected AP.
2152 *
2153 * @E.g: iwpriv wlan0 reassoc
2154 *
2155 * Supported Feature: Roaming
2156 *
2157 * Usage: Internal
2158 *
2159 * </ioctl>
2160 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002161#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302162/*
2163 * <ioctl>
2164 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2165 *
2166 * @INPUT: None
2167 *
2168 * @OUTPUT: print ibss peer in info logs
Jeff Johnson52f19d52019-02-26 08:35:38 -08002169 * peer_info->numIBSSPeers = 1
Abhishek Singh49b654e2016-12-01 16:11:17 +05302170 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2171 *
2172 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2173 * in info logs
2174 *
2175 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2176 *
2177 * Supported Feature: IBSS
2178 *
2179 * Usage: Internal/External
2180 *
2181 * </ioctl>
2182 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002183#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002184/* Sub ioctls 11 to 16 are not used */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002185#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302186/*
2187 * <ioctl>
2188 * stop_obss_scan - Stop obss scan
2189 *
2190 * @INPUT: None
2191 *
2192 * @OUTPUT: None
2193 *
2194 * This IOCTL is used to stop obss scan
2195 *
2196 * @E.g: iwpriv wlan0 stop_obss_scan
2197 *
2198 * Supported Feature: Scan
2199 *
2200 * Usage: Internal/External
2201 *
2202 * </ioctl>
2203 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002204#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002205
2206/* Private ioctls and their sub-ioctls */
2207#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2208
2209#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302210/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002211
Manjeet Singhf82ed072016-07-08 11:40:00 +05302212#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002213
Kabilan Kannan6894e6a2017-11-09 14:37:55 -08002214/* subcommand 5 is unused */
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302215
Abhishek Singh49b654e2016-12-01 16:11:17 +05302216/*
2217 * <ioctl>
2218 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2219 *
Jeff Johnson0a082d92019-03-04 12:25:49 -08002220 * @INPUT: sta_id
Abhishek Singh49b654e2016-12-01 16:11:17 +05302221 *
Jeff Johnson0a082d92019-03-04 12:25:49 -08002222 * @OUTPUT: print ibss peer corresponding to sta_id in info logs
Abhishek Singh49b654e2016-12-01 16:11:17 +05302223 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2224 *
2225 * This IOCTL is used to print the specific ibss peers's MAC,
2226 * rate and RSSI in info logs
2227 *
2228 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2229 * iwpriv wlan0 ibssPeerInfo 0
2230 *
2231 * Supported Feature: IBSS
2232 *
2233 * Usage: Internal/External
2234 *
2235 * </ioctl>
2236 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002237#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002238#define WE_UNIT_TEST_CMD 7
2239
2240#define WE_MTRACE_DUMP_CMD 8
2241#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2242
2243
2244#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2245#define WE_LED_FLASHING_PARAM 10
2246#endif
2247
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302248/*
2249 * <ioctl>
2250 * pm_clist - Increments the index value of the concurrent connection list
2251 * and update with the input parameters provided.
2252 *
2253 * @INPUT: Following 8 arguments:
2254 * @vdev_id: vdev id
2255 * @tx_streams: TX streams
2256 * @rx_streams: RX streams
2257 * @chain_mask: Chain mask
2258 * @type: vdev_type
2259 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2260 * @sub_type: vdev_subtype
2261 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2262 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2263 * @channel: Channel
2264 * @mac: Mac id
2265 *
2266 * @OUTPUT: None
2267 *
2268 * This IOCTL is used to increments the index value of the concurrent connection
2269 * list and update with the input parameters provided.
2270 *
2271 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2272 * sub_type channel mac
2273 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2274 *
2275 * Supported Feature: DBS
2276 *
2277 * Usage: Internal/External
2278 *
2279 * </ioctl>
2280 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002281#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302282
2283/*
2284 * <ioctl>
2285 * pm_dlist - Delete the index from the concurrent connection list that is
2286 * present in the given vdev_id.
2287 *
2288 * @INPUT: delete_all, vdev_id
2289 * @delete_all: delete all indices
2290 * @vdev_id: vdev id
2291 *
2292 * @OUTPUT: None
2293 *
2294 * This IOCTL is used to delete the index from the concurrent connection list
2295 * that is present in the given vdev_id.
2296 *
2297 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2298 * iwpriv wlan0 pm_dlist 0 1
2299 *
2300 * Supported Feature: DBS
2301 *
2302 * Usage: Internal/External
2303 *
2304 * </ioctl>
2305 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002306#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302307
2308/*
2309 * <ioctl>
2310 * pm_dbs - Set dbs capability and system preference
2311 *
2312 * @INPUT: dbs, system_pref
2313 * @dbs: Value of DBS capability to be set
2314 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002315 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302316 *
2317 * @OUTPUT: None
2318 *
2319 * This IOCTL is used to set dbs capability and system preference.
2320 *
2321 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2322 * iwpriv wlan0 pm_dbs 1 0
2323 *
2324 * Supported Feature: DBS
2325 *
2326 * Usage: Internal/External
2327 *
2328 * </ioctl>
2329 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002330#define WE_POLICY_MANAGER_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302331
2332/*
2333 * <ioctl>
2334 * pm_pcl - Set pcl for concurrency mode.
2335 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002336 * @INPUT: policy_mgr_con_mode
2337 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302338 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2339 *
2340 * @OUTPUT: None
2341 *
2342 * This IOCTL is used to set pcl for concurrency mode.
2343 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002344 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302345 * iwpriv wlan0 pm_pcl 0
2346 *
2347 * Supported Feature: DBS
2348 *
2349 * Usage: Internal/External
2350 *
2351 * </ioctl>
2352 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002353#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302354
2355/*
2356 * <ioctl>
2357 * pm_cinfo - Shows the concurrent connection list.
2358 *
2359 * @INPUT: None
2360 *
2361 * @OUTPUT: None
2362 *
2363 * This IOCTL is used to show the concurrent connection list.
2364 *
2365 * @E.g: iwpriv wlan0 pm_cinfo
2366 *
2367 * Supported Feature: DBS
2368 *
2369 * Usage: Internal/External
2370 *
2371 * </ioctl>
2372 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002373#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302374
2375/*
2376 * <ioctl>
2377 * pm_ulist - Updates the index value of the concurrent connection list
2378 * with the input parameters provided.
2379 *
2380 * @INPUT: Following 8 arguments:
2381 * @vdev_id: vdev id
2382 * @tx_streams: TX streams
2383 * @rx_streams: RX streams
2384 * @chain_mask: Chain mask
2385 * @type: vdev_type
2386 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2387 * @sub_type: vdev_subtype
2388 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2389 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2390 * @channel: Channel
2391 * @mac: Mac id
2392 *
2393 * @OUTPUT: None
2394 *
2395 * This IOCTL is used to updates the index value of the concurrent
2396 * connection list with the input parameters provided.
2397 *
2398 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2399 * sub_type channel mac
2400 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2401 *
2402 * Supported Feature: DBS
2403 *
2404 * Usage: Internal/External
2405 *
2406 * </ioctl>
2407 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002408#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302409
2410/*
2411 * <ioctl>
2412 * pm_query_action - Initiate actions needed on current connections as
2413 * per the channel provided.
2414 *
2415 * @INPUT: channel
2416 * @channel: Channel on which new connection will be.
2417 *
2418 * @OUTPUT: None
2419 *
2420 * This IOCTL is used to initiate actions needed on current connections
2421 * as per the channel provided.
2422 *
2423 * @E.g: iwpriv wlan0 pm_query_action channel
2424 * iwpriv wlan0 pm_query_action 6
2425 *
2426 * Supported Feature: DBS
2427 *
2428 * Usage: Internal/External
2429 *
2430 * </ioctl>
2431 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002432#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302433
2434/*
2435 * <ioctl>
2436 * pm_query_allow - Checks for allowed concurrency combination
2437 *
2438 * @INPUT: mode, channel, bandwidth
2439 * @mode: new connection mode
2440 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2441 * @channel: channel on which new connection is coming up
2442 * @bandwidth: Bandwidth requested by the connection
2443 * 0:None 1:5MHz 2:10MHz 3:20MHz
2444 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2445 *
2446 * @OUTPUT: None
2447 *
2448 * This IOCTL is used to checks for allowed concurrency combination.
2449 *
2450 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2451 * iwpriv wlan0 pm_query_allow 0 6 4
2452 *
2453 * Supported Feature: DBS
2454 *
2455 * Usage: Internal/External
2456 *
2457 * </ioctl>
2458 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002459#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302460
2461/*
2462 * <ioctl>
2463 * pm_run_scenario - Create scenario with number of connections provided.
2464 *
2465 * @INPUT: num_of_conn
2466 * @num_of_conn: the number of connections (values: 1~3)
2467 *
2468 * @OUTPUT: None
2469 *
2470 * This IOCTL is used to create scenario with the number of connections
2471 * provided.
2472 *
2473 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2474 * iwpriv wlan0 pm_run_scenario 1
2475 *
2476 * Supported Feature: DBS
2477 *
2478 * Usage: Internal/External
2479 *
2480 * </ioctl>
2481 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002482#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302483
2484/*
2485 * <ioctl>
2486 * pm_set_hw_mode - Set hardware for single/dual mac.
2487 *
2488 * @INPUT: hw_mode
2489 * 0:single mac 1:dual mac
Liangwei Dong509c3472018-05-30 07:05:59 -04002490 * 2: 2x2 5g + 1x1 2g dbs mode
2491 * 3: 2x2 2g + 1x1 5g dbs mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302492 *
2493 * @OUTPUT: None
2494 *
2495 * This IOCTL is used to set hardware for single/dual mac.
2496 *
2497 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2498 * iwpriv wlan0 pm_set_hw_mode 1
2499 *
2500 * Supported Feature: DBS
2501 *
2502 * Usage: Internal/External
2503 *
2504 * </ioctl>
2505 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002506#define WE_POLICY_SET_HW_MODE_CMD 20
2507
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302508/*
2509 * <ioctl>
Liangwei Dong2a7f2912018-02-07 17:08:17 +08002510 * ch_avoid - unit test SAP channel avoidance
2511 *
2512 * @INPUT: chan avoid ranges
2513 *
2514 * @OUTPUT: none
2515 *
2516 * This IOCTL is used to fake a channel avoidance event.
2517 * To test SAP/GO chan switch during chan avoid event process.
2518 *
2519 * @E.g: iwpriv wlan0 ch_avoid 2452 2462
2520 *
2521 * Supported Feature: SAP chan avoidance.
2522 *
2523 * Usage: Internal
2524 *
2525 * </ioctl>
2526 */
2527#define WE_SET_CHAN_AVOID 21
2528
2529/*
2530 * <ioctl>
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302531 * set_scan_cfg - Set dual MAC scan config parameters.
2532 *
2533 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2534 * @dbs: Value of DBS bit
2535 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2536 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2537 *
2538 * @OUTPUT: None
2539 *
2540 * This IOCTL is used to set the dual MAC scan config.
2541 *
2542 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2543 * single_mac_scan_with_dbs
2544 * iwpriv wlan0 set_scan_cfg 1 0 1
2545 *
2546 * Supported Feature: DBS
2547 *
2548 * Usage: Internal/External
2549 *
2550 * </ioctl>
2551 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002552#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302553
2554/*
2555 * <ioctl>
2556 * set_fw_mode_cfg - Sets the dual mac FW mode config
2557 *
2558 * @INPUT: dbs, dfs
2559 * @dbs: DBS bit
2560 * @dfs: Agile DFS bit
2561 *
2562 * @OUTPUT: None
2563 *
2564 * This IOCTL is used to set the dual mac FW mode config.
2565 *
2566 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2567 * iwpriv wlan0 set_fw_mode_cfg 1 1
2568 *
2569 * Supported Feature: DBS
2570 *
2571 * Usage: Internal/External
2572 *
2573 * </ioctl>
2574 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002575#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002576#define WE_SET_MON_MODE_CHAN 23
chenguoaa7c90c2018-05-24 17:08:47 +08002577/*
2578 * <ioctl>
2579 * txrx_stats - TXRX statistics query
2580 *
2581 * @INPUT: query category, mac id (default mac id is 0)
2582 *
2583 * @OUTPUT: TXRX statistics result
2584 *
2585 * This IOCTL is used to get TXRX statistics counters.
2586 *
2587 * @E.g: iwpriv wlan0 txrx_stats 21 0
2588 * iwpriv wlan0 txrx_stats 21 1
2589 *
2590 * Usage: Internal
2591 *
2592 * </ioctl>
2593 */
2594#define WE_SET_TXRX_STATS 24
2595
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002596
2597#ifdef FEATURE_WLAN_TDLS
2598#undef MAX_VAR_ARGS
2599#define MAX_VAR_ARGS 11
2600#else
2601#undef MAX_VAR_ARGS
2602#define MAX_VAR_ARGS 9
2603#endif
2604
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302605#ifdef WLAN_FEATURE_MOTION_DETECTION
2606#undef MAX_VAR_ARGS
2607#define MAX_VAR_ARGS 15
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302608#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302609#define WE_MOTION_DET_CONFIG_PARAM 25
2610#define WE_MOTION_DET_BASE_LINE_CONFIG_PARAM 26
Visweswara Tanuku633976b2019-01-07 16:13:12 +05302611
Visweswara Tanuku025f5862019-01-08 17:35:33 +05302612#define WE_SET_THERMAL_THROTTLE_CFG 27
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002613/*
2614 * <ioctl>
2615 * fips_test - Perform a FIPS test
2616 *
2617 * @INPUT: Binary representation of the following packed structure
2618 *
2619 * @OUTPUT: Binary representation of the following packed structure
2620 *
2621 * This IOCTL is used to perform FIPS certification testing
2622 *
2623 * @E.g: iwpriv wlan0 fips_test <test vector>
2624 *
2625 * iwpriv wlan0 fips_test <tbd>
2626 *
2627 * Supported Feature: FIPS
2628 *
2629 * Usage: Internal
2630 *
2631 * </ioctl>
2632 */
2633#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2634
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002635/* Private ioctls (with no sub-ioctls) */
2636/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302637/*
2638 * <ioctl>
2639 * addTspec - Add TSPEC for each AC
2640 *
2641 * @INPUT: 19 TSPEC params
2642 * @[arg0]: handle
2643 * @[arg1]: tid
2644 * @[arg2]: dir
2645 * @[arg3]: psb
2646 * @[arg4]: up
2647 * @[arg5]: nomMsduSize
2648 * @[arg6]: maxMsduSize
2649 * @[arg7]: minDataRate
2650 * @[arg8]: meanDataRate
2651 * @[arg9]: peakDataRate
2652 * @[arg10]: maxBurstSize
2653 * @[arg11]: minPhyRate
2654 * @[arg12]: sba
2655 * @[arg13]: minServiceIntv
2656 * @[arg14]: suspendIntv
2657 * @[arg15]: burstSizeDefn
2658 * @[arg16]: ackPolicy
2659 * @[arg17]: inactivityPeriod
2660 * @[arg18]: maxServiceIntv
2661 *
2662 * @OUTPUT: Success/Failure
2663 *
2664 * This IOCTL is used to add TSPEC for each AC.
2665 *
2666 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2667 * <maxMsduSize> <minDataRate> <meanDataRate>
2668 * <peakDataRate> <maxBurstSize> <minPhyRate>
2669 * <sba> <minServiceIntv> <suspendIntv>
2670 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2671 * <maxServiceIntv>
2672 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2673 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2674 * wlan0 addTspec:3
2675 *
2676 * Supported Feature: WMM
2677 *
2678 * Usage: Internal/External
2679 *
2680 * </ioctl>
2681 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002682#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302683/*
2684 * <ioctl>
2685 * delTspec - Delete TSPEC entry for each AC
2686 *
2687 * @INPUT: 1 TSPEC param
2688 * @[arg0]: handle
2689 *
2690 * @OUTPUT: Success/Failure
2691 *
2692 * This IOCTL is used to delete TSPEC entry for each AC.
2693 *
2694 * @E.g: iwpriv wlan0 delTspec <handle>
2695 * iwpriv wlan0 delTspec 7001
2696 * wlan0 delTspec:16
2697 *
2698 * Supported Feature: WMM
2699 *
2700 * Usage: Internal/External
2701 *
2702 * </ioctl>
2703 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002704#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302705/*
2706 * <ioctl>
2707 * getTspec - Get TSPEC entry for each AC
2708 *
2709 * @INPUT: 1 TSPEC param
2710 * @[arg0]: handle
2711 *
2712 * @OUTPUT: Success/Failure
2713 *
2714 * This IOCTL is used to get TSPEC entry for each AC.
2715 *
2716 * @E.g: iwpriv wlan0 getTspec <handle>
2717 * iwpriv wlan0 getTspec 7001
2718 * wlan0 delTspec:18
2719 *
2720 * Supported Feature: WMM
2721 *
2722 * Usage: Internal/External
2723 *
2724 * </ioctl>
2725 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002726#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2727
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002728/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2729/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2730/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002731#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2732#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002733/* (SIOCIWFIRSTPRIV + 16) is currently unused */
Krunal Sonif9ba53d2019-01-03 21:44:41 -08002734
2735#ifdef FEATURE_WLM_STATS
2736/*
2737 * <ioctl>
2738 *
2739 * get_wlm_stats - Get stats from FW for game latency
2740 *
2741 * @INPUT: BITMASK inform of decimal number
2742 *
2743 * @OUTPUT: HEX string given by FW
2744 *
2745 * This IOCTL is used to get game latency related STATS from FW
2746 *
2747 * @E.g.: iwpriv wlan0 get_wlm_stats 1
2748 *
2749 * Usage: internal
2750 *
2751 * </ioctl>
2752 */
2753#define WLAN_GET_WLM_STATS (SIOCIWFIRSTPRIV + 17)
2754#endif
2755
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002756/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2757
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002758#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002759
2760/* Private ioctl for setting the host offload feature */
2761#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2762
2763/* Private ioctl to get the statistics */
2764#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2765
2766/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302767/*
2768 * <ioctl>
2769 * setKeepAlive - Set the keep alive feature
2770 *
2771 * @INPUT: 28 bytes of information in the order of packet type, time period
2772 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2773 *
2774 * @OUTPUT: None
2775 *
2776 * This IOCTL sets the keep alive feature to send either NULL
2777 * or unsolicited ARP response packets
2778 *
2779 * @E.g: iwpriv wlan0 setKeepAlive
2780 *
2781 * Supported Feature: STA
2782 *
2783 * Usage: Internal/External
2784 *
2785 * </ioctl>
2786 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002787#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2788
2789#ifdef WLAN_FEATURE_PACKET_FILTERING
2790/* Private ioctl to set the packet filtering params */
2791#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2792#endif
2793
2794
2795#ifdef FEATURE_WLAN_SCAN_PNO
2796/* Private ioctl to get the statistics */
2797#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2798#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302799/*
2800 * <ioctl>
2801 * SETBAND - Set the operational band
2802 *
2803 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2804 *
2805 * @OUTPUT: None
2806 *
2807 * This IOCTL Set the operational band If the new band is different from the
2808 * current operational band, it aborts the pending scan requests, flushes
2809 * the existing scan results, and then change * the band capability
2810 *
2811 * @E.g: iwpriv wlan0 SETBAND <value>
2812 *
2813 * Supported Feature: STA
2814 *
2815 * Usage: Internal/External
2816 *
2817 * </ioctl>
2818 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002819#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2820
Dustin Brown0cbc7572016-12-16 13:54:40 -08002821#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002822/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002823
2824/* Private ioctls and their sub-ioctls */
2825#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2826#define WE_SET_SMPS_PARAM 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002827#define WE_SET_FW_CRASH_INJECT 2
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002828#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302829/* Private sub ioctl for enabling and setting histogram interval of profiling */
2830#define WE_ENABLE_FW_PROFILE 4
2831#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002832
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002833/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002834#define WE_SET_WLAN_SUSPEND 6
2835#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002836
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002837/*
2838 * <ioctl>
2839 * log_buffer - prints host/target related communication logs via dmesg
2840 *
2841 * @INPUT: Log Id, Count
2842 *
2843 * Log Id:
2844 * 0) HTC_CREDIT_HISTORY_LOG
2845 * 1) COMMAND_LOG,
2846 * 2) COMMAND_TX_CMP_LOG,
2847 * 3) MGMT_COMMAND_LOG,
2848 * 4) MGMT_COMMAND_TX_CMP_LOG,
2849 * 5) EVENT_LOG,
2850 * 6) RX_EVENT_LOG,
2851 * 7) MGMT_EVENT_LOG
2852 *
2853 * @OUTPUT: None
2854 *
2855 * @E.g:
2856 * # print up to 10 of the most recent records from HTC Credit History
2857 * iwpriv wlan0 log_buffer 0 10
2858 * # print up to 3 of the most recent records from Event Log
2859 * iwpriv wlan0 log_buffer 5 3
2860 *
2861 * Supported Feature: WLAN Trace
2862 *
2863 * Usage: Internal/External
2864 *
2865 * </ioctl>
2866 */
2867#define WE_LOG_BUFFER 8
2868
Krunal Soni6c3859f2018-06-01 19:57:40 -07002869/*
2870 * <ioctl>
2871 * set_ba_timeout - sets Block ACK aging timeout value for each Access class
2872 *
2873 * @INPUT: Access Class [0:BK, 1:BE, 2:VI, 3:VO], Timeout value
2874 *
2875 * @OUTPUT: None
2876 *
2877 * @E.g.:
2878 * # to set duration of 2 seconds for BE
2879 * iwpriv wlan0 set_ba_timeout 1 2
2880 * # to set duration of 3 seconds for VO
2881 * iwpriv wlan0 set_ba_timeout 3 3
2882 *
2883 * Usage: Internal
2884 *
2885 * </ioctl>
2886 */
2887#define WE_SET_BA_AGEING_TIMEOUT 9
2888
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002889enum host_target_comm_log {
2890 HTC_CREDIT_HISTORY_LOG = 0,
2891 COMMAND_LOG,
2892 COMMAND_TX_CMP_LOG,
2893 MGMT_COMMAND_LOG,
2894 MGMT_COMMAND_TX_CMP_LOG,
2895 EVENT_LOG,
2896 RX_EVENT_LOG,
2897 MGMT_EVENT_LOG
2898};
2899
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002900/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2901
2902/* 802.11p IOCTL */
2903#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2904
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302905/*
2906 * <ioctl>
2907 * getLinkSpeed - Gets the current link speed in Mbps
2908 *
2909 * @INPUT: None
2910 *
2911 * @OUTPUT: linkspeed in mbps
2912 * wlan0 getLinkSpeed:7
2913 *
2914 * This IOCTL is used get the current link speed in Mbps
2915 *
2916 * @E.g: iwpriv wlan0 getLinkSpeed
2917 *
2918 * Supported Feature: STA
2919 *
2920 * Usage: Internal/External
2921 *
2922 * </ioctl>
2923 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002924#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2925
2926#define WLAN_STATS_INVALID 0
2927#define WLAN_STATS_RETRY_CNT 1
2928#define WLAN_STATS_MUL_RETRY_CNT 2
2929#define WLAN_STATS_TX_FRM_CNT 3
2930#define WLAN_STATS_RX_FRM_CNT 4
2931#define WLAN_STATS_FRM_DUP_CNT 5
2932#define WLAN_STATS_FAIL_CNT 6
2933#define WLAN_STATS_RTS_FAIL_CNT 7
2934#define WLAN_STATS_ACK_FAIL_CNT 8
2935#define WLAN_STATS_RTS_SUC_CNT 9
2936#define WLAN_STATS_RX_DISCARD_CNT 10
2937#define WLAN_STATS_RX_ERROR_CNT 11
2938#define WLAN_STATS_TX_BYTE_CNT 12
2939
2940#define WLAN_STATS_RX_BYTE_CNT 13
2941#define WLAN_STATS_RX_RATE 14
2942#define WLAN_STATS_TX_RATE 15
2943
2944#define WLAN_STATS_RX_UC_BYTE_CNT 16
2945#define WLAN_STATS_RX_MC_BYTE_CNT 17
2946#define WLAN_STATS_RX_BC_BYTE_CNT 18
2947#define WLAN_STATS_TX_UC_BYTE_CNT 19
2948#define WLAN_STATS_TX_MC_BYTE_CNT 20
2949#define WLAN_STATS_TX_BC_BYTE_CNT 21
2950
2951#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2952 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2953 *__p++ = __type; \
2954 *__p++ = __size; \
2955 memcpy(__p, __val, __size); \
2956 __p += __size; \
2957 __tlen += __size + 2; \
2958 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002959 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002960 } \
2961 } while (0)
2962
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002963#define TX_PER_TRACKING_DEFAULT_RATIO 5
2964#define TX_PER_TRACKING_MAX_RATIO 10
2965#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2966
2967#define WLAN_ADAPTER 0
2968#define P2P_ADAPTER 1
2969
2970/**
2971 * mem_alloc_copy_from_user_helper - copy from user helper
2972 * @wrqu_data: wireless extensions request data
2973 * @len: length of @wrqu_data
2974 *
2975 * Helper function to allocate buffer and copy user data.
2976 *
2977 * Return: On success return a pointer to a kernel buffer containing a
2978 * copy of the userspace data (with an additional NUL character
2979 * appended for safety). On failure return %NULL.
2980 */
2981void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2982{
2983 u8 *ptr = NULL;
2984
2985 /* in order to protect the code, an extra byte is post
2986 * appended to the buffer and the null termination is added.
2987 * However, when allocating (len+1) byte of memory, we need to
2988 * make sure that there is no uint overflow when doing
2989 * addition. In theory check len < UINT_MAX protects the uint
2990 * overflow. For wlan private ioctl, the buffer size is much
2991 * less than UINT_MAX, as a good guess, now, it is assumed
2992 * that the private command buffer size is no greater than 4K
2993 * (4096 bytes). So we use 4096 as the upper boundary for now.
2994 */
2995 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002996 hdd_err("Invalid length: %zu max: %u",
2997 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002998 return NULL;
2999 }
3000
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07003001 ptr = qdf_mem_malloc(len + 1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003002 if (NULL == ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003003 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003004 return NULL;
3005 }
3006
3007 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003008 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07003009 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003010 return NULL;
3011 }
3012 ptr[len] = '\0';
3013 return ptr;
3014}
3015
3016/**
3017 * hdd_priv_get_data() - Get pointer to ioctl private data
3018 * @p_priv_data: pointer to iw_point struct to be filled
3019 * @wrqu: Pointer to IOCTL Data received from userspace
3020 *
3021 * Helper function to get compatible struct iw_point passed to ioctl
3022 *
3023 * Return - 0 if p_priv_data successfully filled, error otherwise
3024 */
3025int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
3026{
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003027 if ((NULL == p_priv_data) || (NULL == wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003028 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003029
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003030#ifdef CONFIG_COMPAT
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07003031 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003032 struct compat_iw_point *p_compat_priv_data;
3033
3034 /* Compat task:
3035 * typecast to compat structure and copy the members.
3036 */
3037 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
3038
3039 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
3040 p_priv_data->length = p_compat_priv_data->length;
3041 p_priv_data->flags = p_compat_priv_data->flags;
3042 } else {
3043#endif /* #ifdef CONFIG_COMPAT */
3044
3045 /* Non compat task: directly copy the structure. */
3046 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
3047
3048#ifdef CONFIG_COMPAT
3049 }
3050#endif /* #ifdef CONFIG_COMPAT */
3051
3052 return 0;
3053}
3054
Jeff Johnson441e1f72017-02-07 08:50:49 -08003055static int hdd_check_wext_control(enum hdd_wext_control wext_control,
3056 struct iw_request_info *info)
3057{
3058 switch (wext_control) {
3059 default:
3060 case hdd_wext_disabled:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003061 hdd_err_rl("Rejecting disabled ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003062 return -ENOTSUPP;
3063 case hdd_wext_deprecated:
Jeff Johnsonb135c662018-10-12 12:24:07 -07003064 hdd_warn_rl("Using deprecated ioctl %x", info->cmd);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003065 return 0;
3066 case hdd_wext_enabled:
3067 return 0;
3068 }
3069}
3070
Jeff Johnson82797b62017-08-11 15:31:27 -07003071int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08003072 struct iw_request_info *info)
3073{
3074 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
3075 info);
3076}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003077
3078/**
3079 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003080 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003081 * @length: Size of the data copied
3082 * @buffer: Pointer to char buffer.
3083 * @buf_len: Length of the char buffer.
3084 *
3085 * This function called when the "iwpriv wlan0 get_stats" command is given.
3086 * It used to collect the txrx stats when the device is configured in SAP mode.
3087 *
3088 * Return - none
3089 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003090void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003091 char *buffer, uint16_t buf_len)
3092{
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003093 struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003094 uint32_t len = 0;
3095 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
3096 uint32_t total_rx_delv = 0, total_rx_refused = 0;
3097 int i = 0;
Mohit Khanna81418772018-10-30 14:14:46 -07003098 struct hdd_context *hdd_ctx = adapter->hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003099
3100 for (; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003101 total_rx_pkt += stats->rx_packets[i];
3102 total_rx_dropped += stats->rx_dropped[i];
3103 total_rx_delv += stats->rx_delivered[i];
3104 total_rx_refused += stats->rx_refused[i];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003105 }
3106
3107 len = scnprintf(buffer, buf_len,
Mohit Khanna81418772018-10-30 14:14:46 -07003108 "\nTransmit[%lu] - "
3109 "called %u, dropped %u orphan %u,"
3110 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
3111 "\n[classified] BK %u, BE %u, VI %u, VO %u"
3112 "\n\nReceive[%lu] - "
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003113 "packets %u, dropped %u, unsolict_arp_n_mcast_drp %u, delivered %u, refused %u\n"
Mohit Khanna81418772018-10-30 14:14:46 -07003114 "GRO - agg %u non-agg %u flushes(%u %u) disabled(conc %u low-tput %u)\n",
3115 qdf_system_ticks(),
3116 stats->tx_called,
3117 stats->tx_dropped,
3118 stats->tx_orphaned,
3119 stats->tx_dropped_ac[SME_AC_BK],
3120 stats->tx_dropped_ac[SME_AC_BE],
3121 stats->tx_dropped_ac[SME_AC_VI],
3122 stats->tx_dropped_ac[SME_AC_VO],
3123 stats->tx_classified_ac[SME_AC_BK],
3124 stats->tx_classified_ac[SME_AC_BE],
3125 stats->tx_classified_ac[SME_AC_VI],
3126 stats->tx_classified_ac[SME_AC_VO],
3127 qdf_system_ticks(),
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -08003128 total_rx_pkt, total_rx_dropped,
3129 qdf_atomic_read(&stats->rx_usolict_arp_n_mcast_drp),
3130 total_rx_delv,
Mohit Khanna81418772018-10-30 14:14:46 -07003131 total_rx_refused,
3132 stats->rx_aggregated, stats->rx_non_aggregated,
3133 stats->rx_gro_flushes,
3134 stats->rx_gro_force_flushes,
3135 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_concurrency),
3136 qdf_atomic_read(&hdd_ctx->disable_rx_ol_in_low_tput));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003137
3138 for (i = 0; i < NUM_CPUS; i++) {
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003139 if (stats->rx_packets[i] == 0)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003140 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003141 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna81418772018-10-30 14:14:46 -07003142 "Rx CPU[%d]:"
3143 "packets %u, dropped %u, delivered %u, refused %u\n",
3144 i, stats->rx_packets[i], stats->rx_dropped[i],
3145 stats->rx_delivered[i], stats->rx_refused[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003146 }
3147
3148 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003149 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003150 "\nCurrent status: %s"
3151 "\ntx-flow timer start count %u"
3152 "\npause count %u, unpause count %u",
Jeff Johnson6ced42c2017-10-20 12:48:11 -07003153 (stats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3154 stats->txflow_timer_cnt,
3155 stats->txflow_pause_cnt,
3156 stats->txflow_unpause_cnt);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003157
Leo Changfdb45c32016-10-28 11:09:23 -07003158 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003159 adapter->vdev_id, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003160 *length = len + 1;
3161}
3162
3163/**
Dustin Brownd9322482017-01-09 12:46:03 -08003164 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3165 * @hdd_ctx: The Hdd context owning the stats to be written
3166 * @buffer: The char buffer to write to
3167 * @max_len: The maximum number of chars to write
3168 *
3169 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3170 *
3171 * Return - length of written content, negative number on error
3172 */
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003173#ifdef QCA_SUPPORT_CP_STATS
3174static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
3175 char *buffer, uint16_t max_len)
3176{
3177 int ret;
3178 QDF_STATUS status;
3179 struct suspend_resume_stats *sr_stats;
3180
3181 sr_stats = &hdd_ctx->suspend_resume_stats;
3182 ret = scnprintf(buffer, max_len,
3183 "\n"
3184 "Suspends: %u\n"
3185 "Resumes: %u\n"
3186 "\n"
3187 "Suspend Fail Reasons\n"
3188 "\tIPA: %u\n"
3189 "\tRadar: %u\n"
3190 "\tRoam: %u\n"
3191 "\tScan: %u\n"
3192 "\tInitial Wakeup: %u\n"
3193 "\n",
3194 sr_stats->suspends, sr_stats->resumes,
3195 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3196 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3197 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3198 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3199 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP]);
3200
Dustin Brown05d81302018-09-11 16:49:22 -07003201 status = ucfg_mc_cp_stats_write_wow_stats(hdd_ctx->psoc,
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003202 &buffer[ret], max_len - ret,
3203 &ret);
3204 if (QDF_IS_STATUS_ERROR(status)) {
3205 hdd_err("Failed to get WoW stats");
3206 return qdf_status_to_os_return(status);
3207 }
3208
3209 return ret;
3210}
3211#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003212static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
Dustin Brownd9322482017-01-09 12:46:03 -08003213 char *buffer, uint16_t max_len)
3214{
3215 QDF_STATUS status;
3216 struct suspend_resume_stats *sr_stats;
3217 struct sir_wake_lock_stats wow_stats;
3218
3219 sr_stats = &hdd_ctx->suspend_resume_stats;
3220
3221 status = wma_get_wakelock_stats(&wow_stats);
3222 if (QDF_IS_STATUS_ERROR(status)) {
3223 hdd_err("Failed to get WoW stats");
3224 return qdf_status_to_os_return(status);
3225 }
3226
3227 return scnprintf(buffer, max_len,
3228 "\n"
3229 "Suspends: %u\n"
3230 "Resumes: %u\n"
3231 "\n"
3232 "Suspend Fail Reasons\n"
3233 "\tIPA: %u\n"
3234 "\tRadar: %u\n"
3235 "\tRoam: %u\n"
3236 "\tScan: %u\n"
3237 "\tInitial Wakeup: %u\n"
3238 "\n"
3239 "WoW Wake Reasons\n"
3240 "\tunicast: %u\n"
3241 "\tbroadcast: %u\n"
3242 "\tIPv4 multicast: %u\n"
3243 "\tIPv6 multicast: %u\n"
3244 "\tIPv6 multicast RA: %u\n"
3245 "\tIPv6 multicast NS: %u\n"
3246 "\tIPv6 multicast NA: %u\n"
3247 "\tICMPv4: %u\n"
3248 "\tICMPv6: %u\n"
3249 "\tRSSI Breach: %u\n"
3250 "\tLow RSSI: %u\n"
3251 "\tG-Scan: %u\n"
3252 "\tPNO Complete: %u\n"
3253 "\tPNO Match: %u\n",
3254 sr_stats->suspends,
3255 sr_stats->resumes,
3256 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3257 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3258 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3259 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3260 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP],
3261 wow_stats.wow_ucast_wake_up_count,
3262 wow_stats.wow_bcast_wake_up_count,
3263 wow_stats.wow_ipv4_mcast_wake_up_count,
3264 wow_stats.wow_ipv6_mcast_wake_up_count,
3265 wow_stats.wow_ipv6_mcast_ra_stats,
3266 wow_stats.wow_ipv6_mcast_ns_stats,
3267 wow_stats.wow_ipv6_mcast_na_stats,
3268 wow_stats.wow_icmpv4_count,
3269 wow_stats.wow_icmpv6_count,
3270 wow_stats.wow_rssi_breach_wake_up_count,
3271 wow_stats.wow_low_rssi_wake_up_count,
3272 wow_stats.wow_gscan_wake_up_count,
3273 wow_stats.wow_pno_complete_wake_up_count,
3274 wow_stats.wow_pno_match_wake_up_count);
3275}
Naveen Rawat3ff5cff2018-01-29 14:31:16 -08003276#endif
Dustin Brownd9322482017-01-09 12:46:03 -08003277/**
Govind Singha471e5e2015-10-12 17:11:14 +05303278 * hdd_wlan_list_fw_profile() - Get fw profiling points
3279 * @length: Size of the data copied
3280 * @buffer: Pointer to char buffer.
3281 * @buf_len: Length of the char buffer.
3282 *
3283 * This function called when the "iwpriv wlan0 listProfile" command is given.
3284 * It is used to get the supported profiling points in FW.
3285 *
3286 * Return - none
3287 */
3288void hdd_wlan_list_fw_profile(uint16_t *length,
3289 char *buffer, uint16_t buf_len)
3290{
3291 uint32_t len = 0;
3292
3293 len = scnprintf(buffer, buf_len,
3294 "PROF_CPU_IDLE: %u\n"
3295 "PROF_PPDU_PROC: %u\n"
3296 "PROF_PPDU_POST: %u\n"
3297 "PROF_HTT_TX_INPUT: %u\n"
3298 "PROF_MSDU_ENQ: %u\n"
3299 "PROF_PPDU_POST_HAL: %u\n"
3300 "PROF_COMPUTE_TX_TIME: %u\n",
3301 PROF_CPU_IDLE,
3302 PROF_PPDU_PROC,
3303 PROF_PPDU_POST,
3304 PROF_HTT_TX_INPUT,
3305 PROF_MSDU_ENQ,
3306 PROF_PPDU_POST_HAL,
3307 PROF_COMPUTE_TX_TIME);
3308
3309 *length = len + 1;
3310}
Mohit Khannac9649652018-11-28 18:10:28 -08003311
3312#define HDD_DUMP_STAT_HELP(STAT_ID) \
3313 hdd_nofl_info("%u -- %s", STAT_ID, (# STAT_ID))
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003314/**
3315 * hdd_display_stats_help() - print statistics help
3316 *
3317 * Return: none
3318 */
Jeff Johnsona06efaa2018-04-18 09:43:21 -07003319static void hdd_display_stats_help(void)
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003320{
Nirav Shahe6194ac2018-07-13 11:04:41 +05303321 hdd_nofl_info("iwpriv wlan0 dumpStats [option] - dump statistics");
3322 hdd_nofl_info("iwpriv wlan0 clearStats [option] - clear statistics");
3323 hdd_nofl_info("options:");
Mohit Khannac9649652018-11-28 18:10:28 -08003324 HDD_DUMP_STAT_HELP(CDP_TXRX_PATH_STATS);
3325 HDD_DUMP_STAT_HELP(CDP_TXRX_HIST_STATS);
3326 HDD_DUMP_STAT_HELP(CDP_TXRX_TSO_STATS);
3327 HDD_DUMP_STAT_HELP(CDP_HDD_NETIF_OPER_HISTORY);
3328 HDD_DUMP_STAT_HELP(CDP_DUMP_TX_FLOW_POOL_INFO);
3329 HDD_DUMP_STAT_HELP(CDP_TXRX_DESC_STATS);
3330 HDD_DUMP_STAT_HELP(CDP_HIF_STATS);
3331 HDD_DUMP_STAT_HELP(CDP_NAPI_STATS);
3332 HDD_DUMP_STAT_HELP(CDP_DP_NAPI_STATS);
3333 HDD_DUMP_STAT_HELP(CDP_DP_RX_THREAD_STATS);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003334}
Govind Singha471e5e2015-10-12 17:11:14 +05303335
3336/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003337 * hdd_wlan_dump_stats() - display dump Stats
3338 * @adapter: adapter handle
3339 * @value: value from user
3340 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003341 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003342 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003343int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003344{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003345 int ret = 0;
3346 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003347 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003348
Jeff Johnson0e07ca12018-11-12 21:04:45 -08003349 hdd_debug("%d", value);
3350
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003351 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003352 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003353 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3354 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003355 case CDP_HDD_NETIF_OPER_HISTORY:
Mohit Khannaca4173b2017-09-12 21:52:19 -07003356 wlan_hdd_display_netif_queue_history
3357 (hdd_ctx,
3358 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003359 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003360 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303361 hdd_display_hif_stats();
3362 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003363 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003364 hdd_lro_display_stats(hdd_ctx);
Alok Kumarf28ca242018-05-07 17:51:38 +05303365 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003366 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003367 if (hdd_display_napi_stats()) {
3368 hdd_err("error displaying napi stats");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303369 ret = -EFAULT;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003370 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003371 break;
Mohit Khannac9649652018-11-28 18:10:28 -08003372 case CDP_DP_RX_THREAD_STATS:
3373 dp_txrx_ext_dump_stats(cds_get_context(QDF_MODULE_ID_SOC),
3374 CDP_DP_RX_THREAD_STATS);
3375 break;
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303376 case CDP_DISCONNECT_STATS:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003377 sme_display_disconnect_stats(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003378 adapter->vdev_id);
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303379 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003380 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003381 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003382 value,
3383 QDF_STATS_VERBOSITY_LEVEL_HIGH);
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003384 if (status == QDF_STATUS_E_INVAL) {
3385 hdd_display_stats_help();
Visweswara Tanuku025f5862019-01-08 17:35:33 +05303386 ret = -EINVAL;
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003387 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003388 break;
3389 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003390 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003391}
3392
3393/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003394 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003395 * @adapter: Adapter upon which the IBSS client is active
Jeff Johnson0a082d92019-03-04 12:25:49 -08003396 * @sta_id: Station index of the IBSS peer
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003397 *
3398 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3399 * otherwise an appropriate QDF_STATUS_E_* failure code.
3400 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003401static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnson0a082d92019-03-04 12:25:49 -08003402 uint8_t sta_id)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003403{
3404 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003405 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnson93107ad2019-02-26 08:14:46 -08003406 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson52f19d52019-02-26 08:35:38 -08003407 tSirPeerInfoRspParams *peer_info = &sta_ctx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003408
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003409 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003410 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003411 hdd_get_ibss_peer_info_cb,
Jeff Johnson0a082d92019-03-04 12:25:49 -08003412 false, sta_id);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003413
3414 if (QDF_STATUS_SUCCESS == status) {
3415 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003416
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003417 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003418 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003419 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3420 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003421 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003422 return QDF_STATUS_E_FAILURE;
3423 }
3424
3425 /** Print the peer info */
Jeff Johnson52f19d52019-02-26 08:35:38 -08003426 hdd_debug("peer_info->numIBSSPeers = %d ", peer_info->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003427 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003428 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
Jeff Johnson52f19d52019-02-26 08:35:38 -08003429 uint32_t tx_rate = peer_info->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003430
Jeff Johnson52f19d52019-02-26 08:35:38 -08003431 qdf_mem_copy(mac_addr, peer_info->peerInfoParams[0].
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003432 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003433 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003434 mac_addr, (int)tx_rate,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003435 (int)peer_info->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003436 }
3437 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003438 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003439 }
3440
3441 return status;
3442}
3443
3444/**
3445 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003446 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003447 *
3448 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3449 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3450 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003451static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003452{
3453 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003454 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Jeff Johnson93107ad2019-02-26 08:14:46 -08003455 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson52f19d52019-02-26 08:35:38 -08003456 tSirPeerInfoRspParams *peer_info = &sta_ctx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003457 int i;
3458
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003459 INIT_COMPLETION(adapter->ibss_peer_info_comp);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003460 status = sme_request_ibss_peer_info(mac_handle, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003461 hdd_get_ibss_peer_info_cb,
3462 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003463
3464 if (QDF_STATUS_SUCCESS == status) {
3465 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003466
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003467 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003468 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003469 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3470 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003471 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003472 return QDF_STATUS_E_FAILURE;
3473 }
3474
3475 /** Print the peer info */
Jeff Johnson52f19d52019-02-26 08:35:38 -08003476 hdd_debug("peer_info->numIBSSPeers = %d ",
3477 (int)peer_info->numPeers);
3478 for (i = 0; i < peer_info->numPeers; i++) {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003479 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3480 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003481
Jeff Johnson52f19d52019-02-26 08:35:38 -08003482 tx_rate = peer_info->peerInfoParams[i].txRate;
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003483 qdf_mem_copy(mac_addr,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003484 peer_info->peerInfoParams[i].mac_addr,
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003485 sizeof(mac_addr));
3486
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003487 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003488 mac_addr, (int)tx_rate,
Jeff Johnson52f19d52019-02-26 08:35:38 -08003489 (int)peer_info->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003490 }
3491 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003492 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003493 }
3494
3495 return status;
3496}
3497
3498/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303499 * hdd_get_ldpc() - Get adapter LDPC
3500 * @adapter: adapter being queried
3501 * @value: where to store the value
3502 *
3503 * Return: 0 on success, negative errno on failure
3504 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003505int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303506{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003507 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303508 int ret;
3509
Dustin Brown491d54b2018-03-14 12:39:11 -07003510 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003511 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303512 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
3513 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003514 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303515 } else {
3516 *value = ret;
3517 ret = 0;
3518 }
3519 return ret;
3520}
3521
Jeff Johnson3d278b02017-08-29 14:17:47 -07003522int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303523{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003524 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303525 int ret;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003526 QDF_STATUS status;
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003527 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303528 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303529
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003530 hdd_debug("%d", value);
Jeff Johnson1ca04762018-10-25 10:24:39 -07003531
3532 if (!mac_handle) {
3533 hdd_err("NULL Mac handle");
3534 return -EINVAL;
3535 }
3536
Dustin Brown05d81302018-09-11 16:49:22 -07003537 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc, &ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003538 if (QDF_STATUS_SUCCESS != status) {
3539 hdd_err("Failed to get HT capability info");
3540 return -EIO;
3541 }
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003542
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303543 ht_cap_info.adv_coding_cap = value;
Dustin Brown05d81302018-09-11 16:49:22 -07003544 status = ucfg_mlme_set_ht_cap_info(hdd_ctx->psoc, ht_cap_info);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003545 if (QDF_STATUS_SUCCESS != status) {
3546 hdd_err("Failed to set HT capability info");
3547 return -EIO;
3548 }
Vignesh Viswanathanecd4de72018-11-22 13:02:20 +05303549 status = ucfg_mlme_cfg_set_vht_ldpc_coding_cap(hdd_ctx->psoc, value);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303550 if (QDF_IS_STATUS_ERROR(status)) {
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003551 hdd_err("Failed to set VHT LDPC capability info");
3552 return -EIO;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303553 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003554 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303555 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
3556 value);
3557 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003558 hdd_err("Failed to set LDPC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003559 ret = sme_update_he_ldpc_supp(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokeree43a4582018-05-08 19:54:03 -07003560 if (ret)
3561 hdd_err("Failed to set HE LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303562
3563 return ret;
3564}
3565
3566/**
3567 * hdd_get_tx_stbc() - Get adapter TX STBC
3568 * @adapter: adapter being queried
3569 * @value: where to store the value
3570 *
3571 * Return: 0 on success, negative errno on failure
3572 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003573int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303574{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003575 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303576 int ret;
3577
Dustin Brown491d54b2018-03-14 12:39:11 -07003578 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003579 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303580 WNI_CFG_HT_CAP_INFO_TX_STBC);
3581 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003582 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303583 } else {
3584 *value = ret;
3585 ret = 0;
3586 }
3587
3588 return ret;
3589}
3590
Jeff Johnson3d278b02017-08-29 14:17:47 -07003591int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303592{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003593 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303594 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303595 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303596 QDF_STATUS status;
3597 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303598
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003599 hdd_debug("%d", value);
Jeff Johnson57ff4fa2018-10-25 10:29:47 -07003600
3601 if (!mac_handle) {
3602 hdd_err("NULL Mac handle");
3603 return -EINVAL;
3604 }
3605
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303606 if (value) {
3607 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003608 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303609 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303610 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003611 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303612 return -EIO;
3613 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303614 if (!ht_cap_info.tx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003615 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303616 return -EINVAL;
3617 }
3618 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003619 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303620 WNI_CFG_HT_CAP_INFO_TX_STBC,
3621 value);
3622 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003623 hdd_err("Failed to set TX STBC value");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003624 ret = sme_update_he_tx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003625 if (ret)
3626 hdd_err("Failed to set HE TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303627
3628 return ret;
3629}
3630
3631/**
3632 * hdd_get_rx_stbc() - Get adapter RX STBC
3633 * @adapter: adapter being queried
3634 * @value: where to store the value
3635 *
3636 * Return: 0 on success, negative errno on failure
3637 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003638int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303639{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003640 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303641 int ret;
3642
Dustin Brown491d54b2018-03-14 12:39:11 -07003643 hdd_enter();
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003644 ret = sme_get_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303645 WNI_CFG_HT_CAP_INFO_RX_STBC);
3646 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003647 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303648 } else {
3649 *value = ret;
3650 ret = 0;
3651 }
3652
3653 return ret;
3654}
3655
Jeff Johnson3d278b02017-08-29 14:17:47 -07003656int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303657{
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003658 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303659 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303660 int ret;
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303661 QDF_STATUS status;
3662 struct mlme_ht_capabilities_info ht_cap_info;
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303663
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003664 hdd_debug("%d", value);
Jeff Johnsonb6645852018-10-25 10:35:41 -07003665
3666 if (!mac_handle) {
3667 hdd_err("NULL Mac handle");
3668 return -EINVAL;
3669 }
3670
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303671 if (value) {
3672 /* make sure HT capabilities allow this */
Dustin Brown05d81302018-09-11 16:49:22 -07003673 status = ucfg_mlme_get_ht_cap_info(hdd_ctx->psoc,
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303674 &ht_cap_info);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303675 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003676 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303677 return -EIO;
3678 }
Vignesh Viswanathan78182502018-08-06 15:13:30 +05303679 if (!ht_cap_info.rx_stbc) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003680 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303681 return -EINVAL;
3682 }
3683 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003684 ret = sme_update_ht_config(mac_handle, adapter->vdev_id,
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303685 WNI_CFG_HT_CAP_INFO_RX_STBC,
3686 value);
3687 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003688 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303689
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003690 ret = sme_update_he_rx_stbc_cap(mac_handle, adapter->vdev_id, value);
Kiran Kumar Lokere13dedac2018-02-05 19:51:59 -08003691 if (ret)
3692 hdd_err("Failed to set HE RX STBC value");
3693
Manjeet Singhe80d6d82016-09-02 19:04:41 +05303694 return ret;
3695}
3696
3697/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003698 * iw_get_linkspeed() - Get current link speed ioctl
3699 * @dev: device upon which the ioctl was received
3700 * @info: ioctl request information
3701 * @wrqu: ioctl request data
3702 * @extra: extra ioctl buffer
3703 *
3704 * Return: 0 on success, non-zero on error
3705 */
3706static int __iw_get_linkspeed(struct net_device *dev,
3707 struct iw_request_info *info,
3708 union iwreq_data *wrqu, char *extra)
3709{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003710 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson21451ae2019-03-10 21:54:04 -07003711 char *out_link_speed = (char *)extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003712 int len = sizeof(uint32_t) + 1;
3713 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003714 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08003715 int ret;
3716 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003717
Dustin Brownfdf17c12018-03-14 12:55:34 -07003718 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303719
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003720 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08003721 ret = wlan_hdd_validate_context(hdd_ctx);
3722 if (0 != ret)
3723 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003724
Jeff Johnson441e1f72017-02-07 08:50:49 -08003725 ret = hdd_check_private_wext_control(hdd_ctx, info);
3726 if (0 != ret)
3727 return ret;
3728
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003729 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003730 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08003731 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003732
3733 wrqu->data.length = len;
3734 /* return the linkspeed as a string */
Jeff Johnson21451ae2019-03-10 21:54:04 -07003735 rc = snprintf(out_link_speed, len, "%u", link_speed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003736 if ((rc < 0) || (rc >= len)) {
3737 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07003738 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003739 return -EIO;
3740 }
3741
Dustin Browne74003f2018-03-14 12:51:58 -07003742 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003743 /* a value is being successfully returned */
3744 return 0;
3745}
3746
3747static int iw_get_linkspeed(struct net_device *dev,
3748 struct iw_request_info *info,
3749 union iwreq_data *wrqu, char *extra)
3750{
Dustin Brown389e5072018-11-08 17:10:01 +05303751 int errno;
3752 struct osif_vdev_sync *vdev_sync;
3753
3754 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
3755 if (errno)
3756 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003757
Dustin Brown389e5072018-11-08 17:10:01 +05303758 errno = __iw_get_linkspeed(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003759
Dustin Brown389e5072018-11-08 17:10:01 +05303760 osif_vdev_sync_op_stop(vdev_sync);
3761
3762 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003763}
3764
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003765#ifdef FEATURE_WLM_STATS
3766static void wlan_get_wlm_stats_cb(void *cookie, const char *data)
3767{
3768 struct osif_request *request;
3769 char *priv;
3770
3771 request = osif_request_get(cookie);
3772 if (!request) {
3773 hdd_err("Obsolete request");
3774 return;
3775 }
3776 priv = osif_request_priv(request);
3777 strlcpy(priv, data, WE_MAX_STR_LEN);
3778 osif_request_complete(request);
3779 osif_request_put(request);
3780}
3781
3782static int wlan_get_wlm_stats(struct hdd_adapter *adapter, uint32_t bitmask,
3783 char *response)
3784{
3785 struct osif_request *request;
3786 void *cookie;
3787 int errno;
3788 char *priv;
3789 static const struct osif_request_params params = {
3790 .priv_size = WE_MAX_STR_LEN,
3791 .timeout_ms = 2000,
3792 };
3793
3794 if (!adapter) {
3795 hdd_err("NULL argument");
3796 return -EINVAL;
3797 }
3798 request = osif_request_alloc(&params);
3799 if (!request) {
3800 hdd_err("Request allocation failure");
3801 return -ENOMEM;
3802 }
3803 cookie = osif_request_cookie(request);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08003804 errno = wma_wlm_stats_req(adapter->vdev_id, bitmask,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003805 params.priv_size,
3806 wlan_get_wlm_stats_cb, cookie);
3807 if (errno) {
3808 hdd_err("Request failed be sent, %d", errno);
3809 goto cleanup;
3810 }
3811 errno = osif_request_wait_for_response(request);
3812 if (errno) {
3813 hdd_err("Timeout happened, can't complete the req");
3814 goto cleanup;
3815 }
3816 priv = osif_request_priv(request);
3817 strlcpy(response, priv, params.priv_size);
3818
3819cleanup:
3820 osif_request_put(request);
3821
3822 return errno;
3823}
3824
3825/*
3826 * Due to a limitation in iwpriv the "get_wlm_stats" ioctl is defined
3827 * to take as input a variable-length string as opposed to taking a
3828 * single integer "bitmask" value. Hence we must have a buffer large
3829 * enough to hold a string representing the largest possible
3830 * value. MAX_INT = 2,147,483,647 which can be fit in 10 chars.
3831 * Round up to 12 to hold the trailing NUL and be a multiple of 4.
3832 */
3833#define WLM_USER_DATA_SIZE 12
3834
3835static int __iw_get_wlm_stats(struct net_device *dev,
3836 struct iw_request_info *info,
3837 union iwreq_data *wrqu, char *extra)
3838{
3839 struct iw_point priv_data;
3840 char user_data[WLM_USER_DATA_SIZE] = {0};
3841 uint32_t bitmask = 0;
3842 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
3843 struct hdd_context *hdd_ctx;
3844 int errno;
3845
3846 hdd_enter_dev(dev);
3847
3848 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
3849 errno = wlan_hdd_validate_context(hdd_ctx);
3850 if (errno)
3851 return errno;
3852
3853 if (!capable(CAP_NET_ADMIN)) {
3854 hdd_err("permission check failed");
3855 return -EPERM;
3856 }
3857
3858 /*
3859 * Since this is GETTER iwpriv ioctl, driver needs to
3860 * copy SET data from user space to kernel space.
3861 * Helper function to get iwreq_data with compat handling.
3862 */
3863 if (hdd_priv_get_data(&priv_data, wrqu))
3864 return -EINVAL;
3865
3866 /*
3867 * priv_data.pointer should be pointing to data given
3868 * to iwpriv command.
3869 *
3870 * For example "iwpriv wlan0 get_wlm_stats 1234"
3871 *
3872 * priv_data.pointer should be pointing to "1234"
3873 * priv_data.length should be zero as this GETTER iwpriv ioctl
3874 */
3875 if (!priv_data.pointer) {
3876 hdd_err("NULL data pointer");
3877 return -EINVAL;
3878 }
3879
3880 /*
3881 * ideally driver should have used priv_data.length to copy
3882 * data from priv_data.pointer but this iwpriv IOCTL has been
3883 * declared as GETTER in nature which makes length field zero
3884 * for input arguments but priv_data.pointer still points to
3885 * user's input argument (just doesn't pass the length of the
3886 * argument)
3887 */
3888 if (copy_from_user(user_data, priv_data.pointer,
3889 sizeof(user_data) - 1)) {
3890 hdd_err("failed to copy data from user buffer");
3891 return -EFAULT;
3892 }
3893
3894 /*
3895 * user data is given in ascii, convert ascii to integer
3896 */
3897 if (kstrtou32(user_data, 0, &bitmask)) {
3898 hdd_err("failed to parse input %s", user_data);
3899 return -EFAULT;
3900 }
3901
3902 if (wlan_get_wlm_stats(adapter, bitmask, extra)) {
3903 hdd_err("returning failure");
3904 return -EFAULT;
3905 }
3906 wrqu->data.length = strlen(extra) + 1;
3907
3908 return 0;
3909}
3910
Dustin Brown96b98dd2019-03-06 12:39:37 -08003911static int iw_get_wlm_stats(struct net_device *net_dev,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003912 struct iw_request_info *info,
3913 union iwreq_data *wrqu, char *extra)
3914{
Dustin Brown96b98dd2019-03-06 12:39:37 -08003915 struct osif_vdev_sync *vdev_sync;
3916 int errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003917
Dustin Brown96b98dd2019-03-06 12:39:37 -08003918 errno = osif_vdev_sync_op_start(net_dev, &vdev_sync);
3919 if (errno)
3920 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003921
Dustin Brown96b98dd2019-03-06 12:39:37 -08003922 errno = __iw_get_wlm_stats(net_dev, info, wrqu, extra);
3923
3924 osif_vdev_sync_op_stop(vdev_sync);
3925
3926 return errno;
Krunal Sonif9ba53d2019-01-03 21:44:41 -08003927}
3928#endif /* FEATURE_WLM_STATS */
3929
Jeff Johnsonc1713242018-10-23 13:45:42 -07003930int wlan_hdd_update_phymode(struct hdd_adapter *adapter, int new_phymode)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003931{
Jeff Johnsonc1713242018-10-23 13:45:42 -07003932 struct net_device *net = adapter->dev;
3933 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
3934 mac_handle_t mac_handle = phddctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003935 bool band_24 = false, band_5g = false;
3936 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08003937 struct sme_config_params *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003938 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303939 uint8_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003940 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07003941 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003942 enum band_info curr_band = BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05303943 int retval = 0;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303944 uint8_t band_capability;
3945 QDF_STATUS status;
Wu Gaoed616a12019-01-16 15:19:21 +08003946 uint32_t channel_bonding_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003947
Jeff Johnsonc1713242018-10-23 13:45:42 -07003948 if (!mac_handle)
3949 return -EINVAL;
3950
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003951 old_phymode = sme_get_phy_mode(mac_handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003952
Wu Gaoed616a12019-01-16 15:19:21 +08003953 ucfg_mlme_get_channel_bonding_24ghz(phddctx->psoc,
3954 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003955 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003956 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003957 ch_bond24 = true;
3958
Wu Gaoed616a12019-01-16 15:19:21 +08003959 ucfg_mlme_get_channel_bonding_5ghz(phddctx->psoc,
3960 &channel_bonding_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003961 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Wu Gaoed616a12019-01-16 15:19:21 +08003962 sme_get_cb_phy_state_from_cb_ini_value(channel_bonding_mode))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003963 ch_bond5g = true;
3964
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303965 status = wlan_mlme_get_band_capability(phddctx->psoc, &band_capability);
3966 if (QDF_IS_STATUS_ERROR(status)) {
3967 hdd_err("Failed to get MLME Band capability");
3968 return -EIO;
3969 }
3970
3971 if (band_capability == BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003972 band_24 = band_5g = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303973 else if (band_capability == BAND_2G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003974 band_24 = true;
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05303975 else if (band_capability == BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003976 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003977
Jeff Johnsonc1713242018-10-23 13:45:42 -07003978 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc, &vhtchanwidth);
3979 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07003980 hdd_err("Failed to get channel_width");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303981
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003982 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 -08003983 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
3984
3985 switch (new_phymode) {
3986 case IEEE80211_MODE_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003987 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07003988 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003989 phymode = eCSR_DOT11_MODE_AUTO;
3990 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
3991 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08003992 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003993 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
3994 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07003995 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003996 return -EIO;
3997 }
3998 break;
3999 case IEEE80211_MODE_11A:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004000 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004001 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004002 phymode = eCSR_DOT11_MODE_11a;
4003 hdd_dot11mode = eHDD_DOT11_MODE_11a;
4004 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004005 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004006 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004007 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004008 return -EIO;
4009 }
4010 break;
4011 case IEEE80211_MODE_11B:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004012 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004013 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004014 phymode = eCSR_DOT11_MODE_11b;
4015 hdd_dot11mode = eHDD_DOT11_MODE_11b;
4016 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004017 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004018 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004019 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004020 return -EIO;
4021 }
4022 break;
4023 case IEEE80211_MODE_11G:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004024 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004025 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004026 phymode = eCSR_DOT11_MODE_11g;
4027 hdd_dot11mode = eHDD_DOT11_MODE_11g;
4028 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004029 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004030 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004031 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004032 return -EIO;
4033 }
4034 break;
Jeff Johnson33142e62018-05-06 17:58:36 -07004035 /* UMAC doesn't have option to set MODE_11NA/MODE_11NG as phymode
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004036 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
4037 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
4038 */
4039 case IEEE80211_MODE_11NA_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004040 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004041 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004042 phymode = eCSR_DOT11_MODE_11n;
4043 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4044 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004045 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004046 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004047 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004048 return -EIO;
4049 }
4050 break;
4051 case IEEE80211_MODE_11NA_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004052 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004053 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004054 phymode = eCSR_DOT11_MODE_11n;
4055 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4056 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004057 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004058 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004059 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004060 return -EIO;
4061 }
4062 break;
4063 case IEEE80211_MODE_11NG_HT20:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004064 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004065 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004066 phymode = eCSR_DOT11_MODE_11n;
4067 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4068 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004069 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004070 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004071 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004072 return -EIO;
4073 }
4074 break;
4075 case IEEE80211_MODE_11NG_HT40:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004076 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004077 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004078 phymode = eCSR_DOT11_MODE_11n;
4079 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4080 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004081 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004082 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004083 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004084 return -EIO;
4085 }
4086 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004087 case IEEE80211_MODE_11AC_VHT20:
4088 case IEEE80211_MODE_11AC_VHT40:
4089 case IEEE80211_MODE_11AC_VHT80:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004090 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07004091 phymode = eCSR_DOT11_MODE_11ac;
4092 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
4093 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
4094 if (band_5g && band_24) {
4095 curr_band = BAND_ALL;
4096 break;
4097 } else if (band_5g) {
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004098 curr_band = BAND_5G;
Kiran Kumar Lokereb04f7f82018-03-21 18:54:21 -07004099 break;
4100 } else if (new_phymode != IEEE80211_MODE_11AC_VHT80) {
4101 curr_band = BAND_2G;
4102 break;
4103 }
4104 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
4105 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004106 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004107 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004108 return -EIO;
4109 }
4110 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004111 case IEEE80211_MODE_2G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004112 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004113 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004114 phymode = eCSR_DOT11_MODE_AUTO;
4115 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4116 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004117 curr_band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004118 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004119 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004120 return -EIO;
4121 }
4122 break;
4123 case IEEE80211_MODE_5G_AUTO:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004124 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004125 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004126 phymode = eCSR_DOT11_MODE_AUTO;
4127 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
4128 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
4129 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004130 curr_band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004131 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004132 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004133 return -EIO;
4134 }
4135 break;
4136 case IEEE80211_MODE_11AGN:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004137 sme_set_phy_mode(mac_handle, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07004138 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004139 phymode = eCSR_DOT11_MODE_11n;
4140 hdd_dot11mode = eHDD_DOT11_MODE_11n;
4141 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004142 curr_band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004143 } else {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004144 sme_set_phy_mode(mac_handle, old_phymode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004145 return -EIO;
4146 }
4147 break;
4148 default:
4149 return -EIO;
4150 }
4151
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004152 switch (new_phymode) {
4153 case IEEE80211_MODE_11AC_VHT20:
4154 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4155 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
4156 break;
4157 case IEEE80211_MODE_11AC_VHT40:
4158 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
4159 break;
4160 case IEEE80211_MODE_11AC_VHT80:
4161 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
4162 break;
4163 default:
Jeff Johnsonc1713242018-10-23 13:45:42 -07004164 status = ucfg_mlme_get_vht_channel_width(phddctx->psoc,
4165 &vhtchanwidth);
4166 if (!QDF_IS_STATUS_SUCCESS(status))
Jeff Johnson9516c112018-10-24 12:23:58 -07004167 hdd_err("Failed to get channel_width");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004168 break;
4169 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004170
4171 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304172 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4173 if (!sme_config) {
4174 hdd_err("Failed to allocate memory for sme_config");
4175 return -ENOMEM;
4176 }
4177 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004178 sme_get_config_param(mac_handle, sme_config);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304179 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004180#ifdef QCA_HT_2040_COEX
4181 if (phymode == eCSR_DOT11_MODE_11n &&
4182 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304183 sme_config->csrConfig.obssEnabled = false;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004184 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004185 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004186 eHT_CHAN_HT20, false);
4187 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004188 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304189 retval = -EIO;
4190 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004191 }
4192 } else if (phymode == eCSR_DOT11_MODE_11n &&
4193 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304194 sme_config->csrConfig.obssEnabled = true;
Jeff Johnsonc1713242018-10-23 13:45:42 -07004195 status = sme_set_ht2040_mode(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004196 adapter->vdev_id,
Jeff Johnsonc1713242018-10-23 13:45:42 -07004197 eHT_CHAN_HT20, true);
4198 if (status == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004199 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304200 retval = -EIO;
4201 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004202 }
4203 }
4204#endif
Vignesh Viswanathanf97cc112018-10-03 19:17:07 +05304205 status = ucfg_mlme_set_band_capability(phddctx->psoc,
4206 curr_band);
4207 if (QDF_IS_STATUS_ERROR(status)) {
4208 hdd_err("failed to set MLME band capability");
4209 goto free;
4210 }
4211
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304212 if (curr_band == BAND_2G) {
4213 status = ucfg_mlme_set_11h_enabled(phddctx->psoc, 0);
4214 if (!QDF_IS_STATUS_SUCCESS(status)) {
4215 hdd_err("Failed to set 11h_enable flag");
4216 goto free;
4217 }
4218 }
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08004219 if (curr_band == BAND_2G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304220 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Jeff Johnson3d725772018-04-28 17:20:56 -07004221 else if (curr_band == BAND_5G)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304222 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004223 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304224 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
4225 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004226 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004227 sme_update_config(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004228
4229 phddctx->config->dot11Mode = hdd_dot11mode;
Wu Gaoed616a12019-01-16 15:19:21 +08004230 ucfg_mlme_set_channel_bonding_24ghz(
4231 phddctx->psoc,
4232 sme_config->csrConfig.channelBondingMode24GHz);
4233 ucfg_mlme_set_channel_bonding_5ghz(
4234 phddctx->psoc,
4235 sme_config->csrConfig.channelBondingMode5GHz);
Krunal Sonidf0f8742016-09-26 14:56:31 -07004236 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004237 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304238 retval = -EIO;
4239 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004240 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304241
4242 if (band_5g) {
4243 struct ieee80211_supported_band *band;
4244
Wu Gaoed616a12019-01-16 15:19:21 +08004245 ucfg_mlme_get_channel_bonding_5ghz(
4246 phddctx->psoc, &channel_bonding_mode);
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304247 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
Wu Gaoed616a12019-01-16 15:19:21 +08004248 if (channel_bonding_mode)
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05304249 band->ht_cap.cap |=
4250 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4251 else
4252 band->ht_cap.cap &=
4253 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
4254 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004255
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004256 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004257 phymode, chwidth, curr_band, vhtchanwidth);
4258 }
4259
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05304260free:
4261 if (sme_config)
4262 qdf_mem_free(sme_config);
4263 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004264}
4265
Jeff Johnson011c4502017-10-05 15:25:56 -07004266static int hdd_validate_pdev_reset(int value)
4267{
4268 if ((value < 1) || (value > 5)) {
4269 hdd_warn(" Invalid value %d: Use any one of the below values\n"
4270 " TX_FLUSH = 1\n"
4271 " WARM_RESET = 2\n"
4272 " COLD_RESET = 3\n"
4273 " WARM_RESET_RESTORE_CAL = 4\n"
4274 " COLD_RESET_RESTORE_CAL = 5", value);
4275
4276 return -EINVAL;
4277 }
4278
4279 return 0;
4280}
4281
4282static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
4283{
4284 int ret;
4285
4286 hdd_debug("%d", value);
4287
4288 ret = hdd_validate_pdev_reset(value);
4289 if (ret)
4290 return ret;
4291
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004292 ret = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson011c4502017-10-05 15:25:56 -07004293 WMI_PDEV_PARAM_PDEV_RESET,
4294 value, PDEV_CMD);
4295
4296 return ret;
4297}
4298
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004299static int hdd_we_set_ch_width(struct hdd_adapter *adapter, int ch_width)
4300{
4301 int errno;
4302 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004303 uint32_t bonding_mode;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08004304 struct sme_config_params *sme_config;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004305 mac_handle_t mac_handle;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004306
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004307 mac_handle = hdd_ctx->mac_handle;
4308 if (!mac_handle)
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004309 return -EINVAL;
4310
4311 /* updating channel bonding only on 5Ghz */
4312 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d", ch_width);
4313
4314 switch (ch_width) {
4315 case eHT_CHANNEL_WIDTH_20MHZ:
4316 bonding_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
4317 break;
4318
4319 case eHT_CHANNEL_WIDTH_40MHZ:
4320 case eHT_CHANNEL_WIDTH_80MHZ:
Kiran Kumar Lokere9df090b2019-02-07 18:48:22 -08004321 bonding_mode = 1;
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004322 break;
4323
4324 default:
4325 hdd_err("Invalid channel width 0->20 1->40 2->80");
4326 return -EINVAL;
4327 }
4328
4329 sme_config = qdf_mem_malloc(sizeof(*sme_config));
4330 if (!sme_config) {
4331 hdd_err("failed to allocate memory for sme_config");
4332 return -ENOMEM;
4333 }
4334
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004335 errno = wma_cli_set_command(adapter->vdev_id, WMI_VDEV_PARAM_CHWIDTH,
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004336 ch_width, VDEV_CMD);
4337 if (errno)
4338 goto free_config;
4339
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004340 sme_get_config_param(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004341 sme_config->csrConfig.channelBondingMode5GHz = bonding_mode;
Kiran Kumar Lokere9df090b2019-02-07 18:48:22 -08004342 sme_config->csrConfig.channelBondingMode24GHz = bonding_mode;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004343 sme_update_config(mac_handle, sme_config);
Dustin Brown65a6f0d2018-04-26 10:54:41 -07004344
4345free_config:
4346 qdf_mem_free(sme_config);
4347
4348 return errno;
4349}
4350
Jeff Johnsondeab8572018-11-13 15:29:53 -08004351static int hdd_we_set_11d_state(struct hdd_adapter *adapter, int state_11d)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004352{
Jeff Johnsondeab8572018-11-13 15:29:53 -08004353 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004354 bool enable_11d;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004355 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304356 QDF_STATUS status;
Dustin Brownd90f61a2018-04-26 12:25:58 -07004357
Jeff Johnsoncec6e922018-06-12 16:17:27 -07004358 if (!mac_handle)
Dustin Brownd90f61a2018-04-26 12:25:58 -07004359 return -EINVAL;
4360
4361 switch (state_11d) {
4362 case ENABLE_11D:
4363 enable_11d = true;
4364 break;
4365 case DISABLE_11D:
4366 enable_11d = false;
4367 break;
4368 default:
4369 return -EINVAL;
4370 }
4371
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05304372 status = ucfg_mlme_set_11d_enabled(hdd_ctx->psoc, enable_11d);
4373 if (!QDF_IS_STATUS_SUCCESS(status))
4374 hdd_err("Invalid 11d_enable flag");
Dustin Brownd90f61a2018-04-26 12:25:58 -07004375
Dustin Brownea82d562018-05-23 12:07:16 -07004376 hdd_debug("11D state=%d", enable_11d);
Dustin Brownd90f61a2018-04-26 12:25:58 -07004377
4378 return 0;
4379}
4380
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004381static int hdd_we_set_power(struct hdd_adapter *adapter, int value)
4382{
4383 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4384 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4385
4386 if (!mac_handle)
4387 return -EINVAL;
4388
4389 switch (value) {
4390 case 1:
4391 /* Enable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004392 sme_save_usr_ps_cfg(mac_handle, true);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004393 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004394 SME_PS_ENABLE);
4395 return 0;
4396 case 2:
4397 /* Disable PowerSave */
Kiran Kumar Lokereceeed832018-12-05 18:36:01 -08004398 sme_save_usr_ps_cfg(mac_handle, false);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004399 sme_ps_enable_disable(mac_handle, adapter->vdev_id,
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004400 SME_PS_DISABLE);
4401 return 0;
4402 case 3:
4403 /* Enable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004404 sme_ps_uapsd_enable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004405 return 0;
4406 case 4:
4407 /* Disable UASPD */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004408 sme_ps_uapsd_disable(mac_handle, adapter->vdev_id);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07004409 return 0;
4410 default:
4411 hdd_err("Invalid value %d", value);
4412 return -EINVAL;
4413 }
4414}
4415
Jeff Johnsoneb4368a2018-10-19 13:02:52 -07004416static int hdd_we_set_max_assoc(struct hdd_adapter *adapter, int value)
4417{
4418 struct hdd_context *hdd_ctx;
4419 QDF_STATUS status;
4420
4421 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4422 status = ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, value);
4423 if (QDF_IS_STATUS_ERROR(status))
4424 hdd_err("cfg set failed, value %d status %d", value, status);
4425
4426 return qdf_status_to_os_return(status);
4427}
4428
Jeff Johnson693722c2018-10-19 13:11:16 -07004429static int hdd_we_set_data_inactivity_timeout(struct hdd_adapter *adapter,
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004430 int inactivity_timeout)
Jeff Johnson693722c2018-10-19 13:11:16 -07004431{
4432 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004433 QDF_STATUS status;
Jeff Johnson693722c2018-10-19 13:11:16 -07004434
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004435 status = ucfg_mlme_set_ps_data_inactivity_timeout(hdd_ctx->psoc,
4436 inactivity_timeout);
Jeff Johnson693722c2018-10-19 13:11:16 -07004437
Arif Hussain41cbc1e2018-11-15 05:54:45 -08004438 return qdf_status_to_os_return(status);
Jeff Johnson693722c2018-10-19 13:11:16 -07004439}
4440
Jeff Johnson94511942018-10-19 13:15:22 -07004441static int hdd_we_set_wow_data_inactivity_timeout(struct hdd_adapter *adapter,
4442 int value)
4443{
4444 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4445 mac_handle_t mac_handle = hdd_ctx->mac_handle;
Jeff Johnson94511942018-10-19 13:15:22 -07004446
4447 if (!mac_handle)
4448 return -EINVAL;
4449
Wu Gaoa796d712019-01-07 14:15:32 +08004450 if (!cfg_in_range(CFG_PMO_WOW_DATA_INACTIVITY_TIMEOUT, value)) {
Jeff Johnson94511942018-10-19 13:15:22 -07004451 hdd_err_rl("Invalid value %d", value);
4452 return -EINVAL;
4453 }
4454
Wu Gaoa796d712019-01-07 14:15:32 +08004455 ucfg_pmo_set_wow_data_inactivity_timeout(hdd_ctx->psoc, (uint8_t)value);
Jeff Johnson94511942018-10-19 13:15:22 -07004456
Wu Gaoa796d712019-01-07 14:15:32 +08004457 return 0;
Jeff Johnson94511942018-10-19 13:15:22 -07004458}
4459
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004460static int hdd_we_set_tx_power(struct hdd_adapter *adapter, int value)
4461{
4462 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4463 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4464 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4465 QDF_STATUS status;
4466
4467 if (!mac_handle)
4468 return -EINVAL;
4469
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004470 status = sme_set_tx_power(mac_handle, adapter->vdev_id,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004471 sta_ctx->conn_info.bssid,
Jeff Johnson5d4a6d12018-10-19 13:23:28 -07004472 adapter->device_mode, value);
4473
4474 if (QDF_IS_STATUS_ERROR(status))
4475 hdd_err("cfg set failed, value %d status %d", value, status);
4476
4477 return qdf_status_to_os_return(status);
4478}
4479
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004480static int hdd_we_set_max_tx_power(struct hdd_adapter *adapter, int value)
4481{
4482 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4483 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4484 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4485 QDF_STATUS status;
4486
4487 if (!mac_handle)
4488 return -EINVAL;
4489
4490 status = sme_set_max_tx_power(mac_handle,
Jeff Johnsone04b6992019-02-27 14:06:55 -08004491 sta_ctx->conn_info.bssid,
4492 sta_ctx->conn_info.bssid,
Jeff Johnson5e15ef52018-10-19 15:29:56 -07004493 value);
4494
4495 if (QDF_IS_STATUS_ERROR(status))
4496 hdd_err("cfg set failed, value %d status %d", value, status);
4497
4498 return qdf_status_to_os_return(status);
4499}
4500
Jeff Johnsonf3892b52018-10-23 11:32:04 -07004501static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power)
4502{
4503 QDF_STATUS status;
4504
4505 hdd_debug("power %d dBm", power);
4506 status = sme_set_max_tx_power_per_band(BAND_2G, power);
4507 if (QDF_IS_STATUS_ERROR(status))
4508 hdd_err("cfg set failed, value %d status %d", power, status);
4509
4510 return qdf_status_to_os_return(status);
4511}
4512
Jeff Johnson175004c2018-10-23 12:03:16 -07004513static int hdd_we_set_max_tx_power_5_0(struct hdd_adapter *adapter, int power)
4514{
4515 QDF_STATUS status;
4516
4517 hdd_debug("power %d dBm", power);
4518 status = sme_set_max_tx_power_per_band(BAND_5G, power);
4519 if (QDF_IS_STATUS_ERROR(status))
4520 hdd_err("cfg set failed, value %d status %d", power, status);
4521
4522 return qdf_status_to_os_return(status);
4523}
4524
Jeff Johnson0187c622019-01-04 06:39:44 -08004525#ifdef HASTINGS_BT_WAR
4526
4527/*
4528 * replicate logic:
4529 * iwpriv wlan0 setUnitTestCmd 19 2 23 1 => enable WAR
4530 * iwpriv wlan0 setUnitTestCmd 19 2 23 0 => disable WAR
4531 */
4532
4533#define HASTINGS_WAR_FW_PARAM_ID 23
4534
4535static int hdd_hastings_bt_war_set_fw(struct hdd_context *hdd_ctx,
4536 uint32_t value)
4537{
4538 uint32_t vdev_id = 0; /* not used */
4539 uint32_t module_id = WLAN_MODULE_WAL;
4540 uint32_t arg_count = 2;
4541 uint32_t arg[2] = {HASTINGS_WAR_FW_PARAM_ID, value};
4542 QDF_STATUS status;
4543
4544 status = wma_form_unit_test_cmd_and_send(vdev_id, module_id,
4545 arg_count, arg);
4546
4547 return qdf_status_to_os_return(status);
4548}
4549
4550int hdd_hastings_bt_war_enable_fw(struct hdd_context *hdd_ctx)
4551{
4552 return hdd_hastings_bt_war_set_fw(hdd_ctx, 1);
4553}
4554
4555int hdd_hastings_bt_war_disable_fw(struct hdd_context *hdd_ctx)
4556{
4557 return hdd_hastings_bt_war_set_fw(hdd_ctx, 0);
4558}
4559
4560/* value to restore the config when the WAR is disabled */
4561static uint32_t iface_change_wait_time_checkpoint;
4562static void checkpoint_iface_change_wait_time(struct hdd_context *hdd_ctx)
4563{
4564 struct hdd_config *config = hdd_ctx->config;
4565
4566 /* did we already checkpoint a value ? */
4567 if (iface_change_wait_time_checkpoint)
4568 return;
4569
4570 /* checkpoint current value */
4571 iface_change_wait_time_checkpoint = config->iface_change_wait_time;
4572
4573 /* was the timer enabled when we checkpointed? */
4574 if (iface_change_wait_time_checkpoint)
4575 return;
4576
4577 /* WAR was enabled at boot, use default when disable */
4578 iface_change_wait_time_checkpoint =
4579 cfg_default(CFG_INTERFACE_CHANGE_WAIT);
4580}
4581
4582static int hdd_hastings_war_enable(struct hdd_context *hdd_ctx)
4583{
4584 struct hdd_config *config = hdd_ctx->config;
4585
4586 config->iface_change_wait_time = 0;
4587
4588 return hdd_hastings_bt_war_enable_fw(hdd_ctx);
4589}
4590
4591static int hdd_hastings_war_disable(struct hdd_context *hdd_ctx)
4592{
4593 struct hdd_config *config = hdd_ctx->config;
4594
4595 config->iface_change_wait_time = iface_change_wait_time_checkpoint;
4596
4597 return hdd_hastings_bt_war_disable_fw(hdd_ctx);
4598}
4599
4600static int hdd_we_set_hastings_bt_war(struct hdd_adapter *adapter, int enable)
4601{
4602 int errno;
4603 struct hdd_context *hdd_ctx;
4604
4605 errno = hdd_validate_adapter(adapter);
4606 if (errno)
4607 return errno;
4608
4609 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4610 checkpoint_iface_change_wait_time(hdd_ctx);
4611
4612 return enable ?
4613 hdd_hastings_war_enable(hdd_ctx) :
4614 hdd_hastings_war_disable(hdd_ctx);
4615}
4616#endif
4617
Jeff Johnson5bee39b2018-10-23 12:34:38 -07004618static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level)
4619{
4620 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4621 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4622 QDF_STATUS status;
4623
4624 if (!mac_handle)
4625 return -EINVAL;
4626
4627 hdd_debug("Thermal Mitigation Level %d", level);
4628 status = sme_set_thermal_level(mac_handle, level);
4629 if (QDF_IS_STATUS_ERROR(status))
4630 hdd_err("cfg set failed, value %d status %d", level, status);
4631
4632 return qdf_status_to_os_return(status);
4633}
4634
Jeff Johnson38912642018-10-24 15:01:40 -07004635static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss)
4636{
4637 QDF_STATUS status;
4638
4639 hdd_debug("NSS %d", nss);
4640
4641 if ((nss > 2) || (nss <= 0)) {
4642 hdd_err("Invalid NSS: %d", nss);
4643 return -EINVAL;
4644 }
4645
4646 status = hdd_update_nss(adapter, nss);
4647 if (QDF_IS_STATUS_ERROR(status))
4648 hdd_err("cfg set failed, value %d status %d", nss, status);
4649
4650 return qdf_status_to_os_return(status);
4651}
4652
Jeff Johnsonce996b32018-10-25 10:52:40 -07004653static int hdd_we_set_short_gi(struct hdd_adapter *adapter, int sgi)
4654{
4655 mac_handle_t mac_handle = adapter->hdd_ctx->mac_handle;
4656 int errno;
4657
4658 hdd_debug("Short GI %d", sgi);
4659
4660 if (!mac_handle) {
4661 hdd_err("NULL Mac handle");
4662 return -EINVAL;
4663 }
4664
4665 if (sgi & HDD_AUTO_RATE_SGI)
4666 errno = sme_set_auto_rate_he_sgi(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004667 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004668 sgi);
4669 else
4670 errno = sme_update_ht_config(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004671 adapter->vdev_id,
Jeff Johnsonce996b32018-10-25 10:52:40 -07004672 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
4673 sgi);
4674 if (errno)
4675 hdd_err("cfg set failed, value %d status %d", sgi, errno);
4676
4677 return errno;
4678}
4679
Jeff Johnson71d80382018-10-25 15:45:01 -07004680static int hdd_we_set_rtscts(struct hdd_adapter *adapter, int rtscts)
4681{
4682 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4683 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4684 uint32_t value;
4685 uint32_t rts_threshold_val;
4686 QDF_STATUS status;
4687 int errno;
4688
4689 hdd_debug("RTSCTS %d", rtscts);
4690
4691 if (!mac_handle) {
4692 hdd_err("NULL Mac handle");
4693 return -EINVAL;
4694 }
4695
4696 status = ucfg_mlme_get_rts_threshold(hdd_ctx->psoc,
4697 &rts_threshold_val);
4698 if (QDF_IS_STATUS_ERROR(status)) {
4699 hdd_err("Get rts threshold failed, status %d", status);
4700 return -EINVAL;
4701 }
4702
4703 if ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_RTSCTS_ENABLE) {
4704 value = rts_threshold_val;
4705 } else if (((rtscts & HDD_RTSCTS_EN_MASK) == 0) ||
4706 ((rtscts & HDD_RTSCTS_EN_MASK) == HDD_CTS_ENABLE)) {
4707 value = cfg_max(CFG_RTS_THRESHOLD);
4708 } else {
4709 hdd_err_rl("Invalid value %d", rtscts);
4710 return -EINVAL;
4711 }
4712
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004713 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson71d80382018-10-25 15:45:01 -07004714 WMI_VDEV_PARAM_ENABLE_RTSCTS,
4715 rtscts, VDEV_CMD);
4716 if (errno) {
4717 hdd_err("Failed to set firmware, errno %d", errno);
4718 return errno;
4719 }
4720
4721 status = ucfg_mlme_set_rts_threshold(hdd_ctx->psoc, value);
4722 if (QDF_IS_STATUS_ERROR(status)) {
4723 hdd_err("Set rts threshold failed, status %d", status);
4724 return -EINVAL;
4725 }
4726
4727 return 0;
4728}
4729
Jeff Johnson50b15882018-10-26 10:27:37 -07004730static int hdd_we_set_11n_rate(struct hdd_adapter *adapter, int rate_code)
4731{
4732 uint8_t preamble = 0, nss = 0, rix = 0;
4733 int errno;
4734
4735 hdd_debug("Rate code %d", rate_code);
4736
4737 if (rate_code != 0xff) {
4738 rix = RC_2_RATE_IDX(rate_code);
4739 if (rate_code & 0x80) {
4740 preamble = WMI_RATE_PREAMBLE_HT;
4741 nss = HT_RC_2_STREAMS(rate_code) - 1;
4742 } else {
4743 nss = 0;
4744 rix = RC_2_RATE_IDX(rate_code);
4745 if (rate_code & 0x10) {
4746 preamble = WMI_RATE_PREAMBLE_CCK;
4747 if (rix != 0x3)
4748 /* Enable Short preamble
4749 * always for CCK except 1mbps
4750 */
4751 rix |= 0x4;
4752 } else {
4753 preamble = WMI_RATE_PREAMBLE_OFDM;
4754 }
4755 }
4756 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4757 }
4758
4759 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4760 rate_code, rix, preamble, nss);
4761
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004762 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnson50b15882018-10-26 10:27:37 -07004763 WMI_VDEV_PARAM_FIXED_RATE,
4764 rate_code, VDEV_CMD);
4765 if (errno)
4766 hdd_err("Failed to set firmware, errno %d", errno);
4767
4768 return errno;
4769}
4770
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004771static int hdd_we_set_vht_rate(struct hdd_adapter *adapter, int rate_code)
4772{
4773 uint8_t preamble = 0, nss = 0, rix = 0;
4774 int errno;
4775
4776 hdd_debug("Rate code %d", rate_code);
4777
4778 if (rate_code != 0xff) {
4779 rix = RC_2_RATE_IDX_11AC(rate_code);
4780 preamble = WMI_RATE_PREAMBLE_VHT;
4781 nss = HT_RC_2_STREAMS_11AC(rate_code) - 1;
4782 rate_code = hdd_assemble_rate_code(preamble, nss, rix);
4783 }
4784
4785 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
4786 rate_code, rix, preamble, nss);
4787
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004788 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonbd2c9912018-10-26 12:34:36 -07004789 WMI_VDEV_PARAM_FIXED_RATE,
4790 rate_code, VDEV_CMD);
4791 if (errno)
4792 hdd_err("Failed to set firmware, errno %d", errno);
4793
4794 return errno;
4795}
4796
Jeff Johnson7c433502018-11-12 15:00:52 -08004797static int hdd_we_set_ampdu(struct hdd_adapter *adapter, int ampdu)
4798{
4799 hdd_debug("AMPDU %d", ampdu);
4800
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004801 return wma_cli_set_command(adapter->vdev_id,
Jeff Johnson7c433502018-11-12 15:00:52 -08004802 GEN_VDEV_PARAM_AMPDU,
4803 ampdu, GEN_CMD);
4804}
4805
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004806static int hdd_we_set_amsdu(struct hdd_adapter *adapter, int amsdu)
4807{
4808 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4809 mac_handle_t mac_handle = hdd_ctx->mac_handle;
4810 int errno;
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304811 QDF_STATUS status;
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004812
4813 hdd_debug("AMSDU %d", amsdu);
4814
4815 if (!mac_handle) {
4816 hdd_err("NULL Mac handle");
4817 return -EINVAL;
4818 }
4819
4820 if (amsdu > 1)
4821 sme_set_amsdu(mac_handle, true);
4822 else
4823 sme_set_amsdu(mac_handle, false);
4824
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004825 errno = wma_cli_set_command(adapter->vdev_id,
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004826 GEN_VDEV_PARAM_AMSDU,
4827 amsdu, GEN_CMD);
4828 if (errno) {
4829 hdd_err("Failed to set firmware, errno %d", errno);
4830 return errno;
4831 }
4832
Vignesh Viswanathanddc89e52018-11-02 18:43:42 +05304833 status = ucfg_mlme_set_max_amsdu_num(hdd_ctx->psoc,
4834 amsdu);
4835 if (QDF_IS_STATUS_ERROR(status))
4836 hdd_err("Failed to set Max AMSDU Num to cfg");
Jeff Johnsonfc6480b2018-10-26 12:52:35 -07004837
4838 return 0;
4839}
4840
Jeff Johnsoncb598fd2018-10-29 10:09:07 -07004841static int hdd_we_clear_stats(struct hdd_adapter *adapter, int option)
4842{
4843 hdd_debug("option %d", option);
4844
4845 switch (option) {
4846 case CDP_HDD_STATS:
4847 memset(&adapter->stats, 0, sizeof(adapter->stats));
4848 memset(&adapter->hdd_stats, 0, sizeof(adapter->hdd_stats));
4849 break;
4850 case CDP_TXRX_HIST_STATS:
4851 wlan_hdd_clear_tx_rx_histogram(adapter->hdd_ctx);
4852 break;
4853 case CDP_HDD_NETIF_OPER_HISTORY:
4854 wlan_hdd_clear_netif_queue_history(adapter->hdd_ctx);
4855 break;
4856 case CDP_HIF_STATS:
4857 hdd_clear_hif_stats();
4858 break;
4859 case CDP_NAPI_STATS:
4860 hdd_clear_napi_stats();
4861 break;
4862 default:
4863 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
4864 option);
4865 }
4866
4867 return 0;
4868}
4869
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004870static int hdd_we_set_green_tx_param(struct hdd_adapter *adapter,
4871 green_tx_param id,
4872 const char *id_string,
4873 int value)
4874{
4875 int errno;
4876
4877 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004878 errno = wma_cli_set_command(adapter->vdev_id, id, value, GTX_CMD);
Jeff Johnson1a05fda2018-11-01 07:53:00 -07004879 if (errno)
4880 hdd_err("Failed to set firmware, errno %d", errno);
4881
4882 return errno;
4883}
4884
4885#define hdd_we_set_green_tx_param(adapter, id, value) \
4886 hdd_we_set_green_tx_param(adapter, id, #id, value)
4887
4888static int hdd_we_set_gtx_ht_mcs(struct hdd_adapter *adapter, int value)
4889{
4890 return hdd_we_set_green_tx_param(adapter,
4891 WMI_VDEV_PARAM_GTX_HT_MCS,
4892 value);
4893}
4894
4895static int hdd_we_set_gtx_vht_mcs(struct hdd_adapter *adapter, int value)
4896{
4897 return hdd_we_set_green_tx_param(adapter,
4898 WMI_VDEV_PARAM_GTX_VHT_MCS,
4899 value);
4900}
4901
4902static int hdd_we_set_gtx_usrcfg(struct hdd_adapter *adapter, int value)
4903{
4904 return hdd_we_set_green_tx_param(adapter,
4905 WMI_VDEV_PARAM_GTX_USR_CFG,
4906 value);
4907}
4908
4909static int hdd_we_set_gtx_thre(struct hdd_adapter *adapter, int value)
4910{
4911 return hdd_we_set_green_tx_param(adapter,
4912 WMI_VDEV_PARAM_GTX_THRE,
4913 value);
4914}
4915
4916static int hdd_we_set_gtx_margin(struct hdd_adapter *adapter, int value)
4917{
4918 return hdd_we_set_green_tx_param(adapter,
4919 WMI_VDEV_PARAM_GTX_MARGIN,
4920 value);
4921}
4922
4923static int hdd_we_set_gtx_step(struct hdd_adapter *adapter, int value)
4924{
4925 return hdd_we_set_green_tx_param(adapter,
4926 WMI_VDEV_PARAM_GTX_STEP,
4927 value);
4928}
4929
4930static int hdd_we_set_gtx_mintpc(struct hdd_adapter *adapter, int value)
4931{
4932 return hdd_we_set_green_tx_param(adapter,
4933 WMI_VDEV_PARAM_GTX_MINTPC,
4934 value);
4935}
4936
4937static int hdd_we_set_gtx_bwmask(struct hdd_adapter *adapter, int value)
4938{
4939 return hdd_we_set_green_tx_param(adapter,
4940 WMI_VDEV_PARAM_GTX_BW_MASK,
4941 value);
4942}
4943
Jeff Johnsond0477f22018-10-29 12:26:25 -07004944static int hdd_we_packet_power_save(struct hdd_adapter *adapter,
4945 packet_power_save id,
4946 const char *id_string,
4947 int value)
4948{
4949 int errno;
4950
4951 if (adapter->device_mode != QDF_STA_MODE) {
4952 hdd_err_rl("Not supported in mode %d", adapter->device_mode);
4953 return -EINVAL;
4954 }
4955
4956 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08004957 errno = wma_cli_set_command(adapter->vdev_id, id, value, PPS_CMD);
Jeff Johnsond0477f22018-10-29 12:26:25 -07004958 if (errno)
4959 hdd_err("Failed to set firmware, errno %d", errno);
4960
4961 return errno;
4962}
4963
4964#define hdd_we_packet_power_save(adapter, id, value) \
4965 hdd_we_packet_power_save(adapter, id, #id, value)
4966
4967static int hdd_we_pps_paid_match(struct hdd_adapter *adapter, int value)
4968{
4969 return hdd_we_packet_power_save(adapter,
4970 WMI_VDEV_PPS_PAID_MATCH,
4971 value);
4972}
4973
4974static int hdd_we_pps_gid_match(struct hdd_adapter *adapter, int value)
4975{
4976 return hdd_we_packet_power_save(adapter,
4977 WMI_VDEV_PPS_GID_MATCH,
4978 value);
4979}
4980
4981static int hdd_we_pps_early_tim_clear(struct hdd_adapter *adapter, int value)
4982{
4983 return hdd_we_packet_power_save(adapter,
4984 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
4985 value);
4986}
4987
4988static int hdd_we_pps_early_dtim_clear(struct hdd_adapter *adapter, int value)
4989{
4990 return hdd_we_packet_power_save(adapter,
4991 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
4992 value);
4993}
4994
4995static int hdd_we_pps_eof_pad_delim(struct hdd_adapter *adapter, int value)
4996{
4997 return hdd_we_packet_power_save(adapter,
4998 WMI_VDEV_PPS_EOF_PAD_DELIM,
4999 value);
5000}
5001
5002static int hdd_we_pps_macaddr_mismatch(struct hdd_adapter *adapter, int value)
5003{
5004 return hdd_we_packet_power_save(adapter,
5005 WMI_VDEV_PPS_MACADDR_MISMATCH,
5006 value);
5007}
5008
5009static int hdd_we_pps_delim_crc_fail(struct hdd_adapter *adapter, int value)
5010{
5011 return hdd_we_packet_power_save(adapter,
5012 WMI_VDEV_PPS_DELIM_CRC_FAIL,
5013 value);
5014}
5015
5016static int hdd_we_pps_gid_nsts_zero(struct hdd_adapter *adapter, int value)
5017{
5018 return hdd_we_packet_power_save(adapter,
5019 WMI_VDEV_PPS_GID_NSTS_ZERO,
5020 value);
5021}
5022
5023static int hdd_we_pps_rssi_check(struct hdd_adapter *adapter, int value)
5024{
5025 return hdd_we_packet_power_save(adapter,
5026 WMI_VDEV_PPS_RSSI_CHECK,
5027 value);
5028}
5029
5030static int hdd_we_pps_5g_ebt(struct hdd_adapter *adapter, int value)
5031{
5032 return hdd_we_packet_power_save(adapter,
5033 WMI_VDEV_PPS_5G_EBT,
5034 value);
5035}
5036
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07005037static int hdd_we_set_qpower(struct hdd_adapter *adapter,
5038 enum wmi_sta_powersave_param id,
5039 const char *id_string,
5040 int value)
5041{
5042 int errno;
5043
5044 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005045 errno = wma_cli_set_command(adapter->vdev_id, id, value, QPOWER_CMD);
Jeff Johnsoncc7776d2018-11-02 14:10:38 -07005046 if (errno)
5047 hdd_err("Failed to set firmware, errno %d", errno);
5048
5049 return errno;
5050}
5051
5052#define hdd_we_set_qpower(adapter, id, value) \
5053 hdd_we_set_qpower(adapter, id, #id, value)
5054
5055static int
5056hdd_we_set_qpower_max_pspoll_count(struct hdd_adapter *adapter, int value)
5057{
5058 enum wmi_sta_powersave_param id =
5059 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT;
5060
5061 return hdd_we_set_qpower(adapter, id, value);
5062}
5063
5064static int
5065hdd_we_set_qpower_max_tx_before_wake(struct hdd_adapter *adapter, int value)
5066{
5067 enum wmi_sta_powersave_param id =
5068 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE;
5069
5070 return hdd_we_set_qpower(adapter, id, value);
5071}
5072
5073static int
5074hdd_we_set_qpower_spec_pspoll_wake_interval(struct hdd_adapter *adapter,
5075 int value)
5076{
5077 enum wmi_sta_powersave_param id =
5078 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL;
5079
5080 return hdd_we_set_qpower(adapter, id, value);
5081}
5082
5083static int
5084hdd_we_set_qpower_spec_max_spec_nodata_pspoll(struct hdd_adapter *adapter,
5085 int value)
5086{
5087 enum wmi_sta_powersave_param id =
5088 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL;
5089
5090 return hdd_we_set_qpower(adapter, id, value);
5091}
5092
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005093static int hdd_we_set_pdev(struct hdd_adapter *adapter,
5094 WMI_PDEV_PARAM id,
5095 const char *id_string,
5096 int value)
5097{
5098 int errno;
5099
5100 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005101 errno = wma_cli_set_command(adapter->vdev_id, id, value, PDEV_CMD);
Jeff Johnson5d0e8cd2018-11-07 08:17:05 -08005102 if (errno)
5103 hdd_err("Failed to set firmware, errno %d", errno);
5104
5105 return errno;
5106}
5107
5108#define hdd_we_set_pdev(adapter, id, value) \
5109 hdd_we_set_pdev(adapter, id, #id, value)
5110
5111static int hdd_we_set_ani_en_dis(struct hdd_adapter *adapter, int value)
5112{
5113 return hdd_we_set_pdev(adapter,
5114 WMI_PDEV_PARAM_ANI_ENABLE,
5115 value);
5116}
5117
5118static int hdd_we_set_ani_poll_period(struct hdd_adapter *adapter, int value)
5119{
5120 return hdd_we_set_pdev(adapter,
5121 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
5122 value);
5123}
5124
5125static int hdd_we_set_ani_listen_period(struct hdd_adapter *adapter, int value)
5126{
5127 return hdd_we_set_pdev(adapter,
5128 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
5129 value);
5130}
5131
5132static int hdd_we_set_ani_ofdm_level(struct hdd_adapter *adapter, int value)
5133{
5134 return hdd_we_set_pdev(adapter,
5135 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
5136 value);
5137}
5138
5139static int hdd_we_set_ani_cck_level(struct hdd_adapter *adapter, int value)
5140{
5141 return hdd_we_set_pdev(adapter,
5142 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
5143 value);
5144}
5145
5146static int hdd_we_set_dynamic_bw(struct hdd_adapter *adapter, int value)
5147{
5148 return hdd_we_set_pdev(adapter,
5149 WMI_PDEV_PARAM_DYNAMIC_BW,
5150 value);
5151}
5152
5153static int hdd_we_set_cts_cbw(struct hdd_adapter *adapter, int value)
5154{
5155 return hdd_we_set_pdev(adapter,
5156 WMI_PDEV_PARAM_CTS_CBW,
5157 value);
5158}
5159
5160static int hdd_we_set_tx_chainmask(struct hdd_adapter *adapter, int value)
5161{
5162 int errno;
5163
5164 errno = hdd_we_set_pdev(adapter,
5165 WMI_PDEV_PARAM_TX_CHAIN_MASK,
5166 value);
5167 if (errno)
5168 return errno;
5169
5170 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5171}
5172
5173static int hdd_we_set_rx_chainmask(struct hdd_adapter *adapter, int value)
5174{
5175 int errno;
5176
5177 errno = hdd_we_set_pdev(adapter,
5178 WMI_PDEV_PARAM_RX_CHAIN_MASK,
5179 value);
5180 if (errno)
5181 return errno;
5182
5183 return hdd_set_antenna_mode(adapter, adapter->hdd_ctx, value);
5184}
5185
5186static int hdd_we_set_txpow_2g(struct hdd_adapter *adapter, int value)
5187{
5188 return hdd_we_set_pdev(adapter,
5189 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
5190 value);
5191}
5192
5193static int hdd_we_set_txpow_5g(struct hdd_adapter *adapter, int value)
5194{
5195 return hdd_we_set_pdev(adapter,
5196 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
5197 value);
5198}
5199
Jeff Johnson2e381272018-11-10 09:33:39 -08005200static int hdd_we_set_vdev(struct hdd_adapter *adapter,
5201 int id,
5202 const char *id_string,
5203 int value)
5204{
5205 int errno;
5206
5207 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005208 errno = wma_cli_set_command(adapter->vdev_id, id, value, VDEV_CMD);
Jeff Johnson2e381272018-11-10 09:33:39 -08005209 if (errno)
5210 hdd_err("Failed to set firmware, errno %d", errno);
5211
5212 return errno;
5213}
5214
5215#define hdd_we_set_vdev(adapter, id, value) \
5216 hdd_we_set_vdev(adapter, id, #id, value)
5217
5218static int hdd_we_set_txrx_fwstats(struct hdd_adapter *adapter, int value)
5219{
5220 return hdd_we_set_vdev(adapter,
5221 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
5222 value);
5223}
5224
5225static int hdd_we_txrx_fwstats_reset(struct hdd_adapter *adapter, int value)
5226{
5227 return hdd_we_set_vdev(adapter,
5228 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
5229 value);
5230}
5231
5232static int hdd_we_set_htsmps(struct hdd_adapter *adapter, int value)
5233{
5234 return hdd_we_set_vdev(adapter,
5235 WMI_STA_SMPS_FORCE_MODE_CMDID,
5236 value);
5237}
5238
5239static int hdd_we_set_early_rx_adjust_enable(struct hdd_adapter *adapter,
5240 int value)
5241{
5242 if ((value != 0) && (value != 1))
5243 return -EINVAL;
5244
5245 return hdd_we_set_vdev(adapter,
5246 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
5247 value);
5248}
5249
5250static int hdd_we_set_early_rx_tgt_bmiss_num(struct hdd_adapter *adapter,
5251 int value)
5252{
5253 return hdd_we_set_vdev(adapter,
5254 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
5255 value);
5256}
5257
5258static int hdd_we_set_early_rx_bmiss_sample_cycle(struct hdd_adapter *adapter,
5259 int value)
5260{
5261 return hdd_we_set_vdev(adapter,
5262 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
5263 value);
5264}
5265
5266static int hdd_we_set_early_rx_slop_step(struct hdd_adapter *adapter, int value)
5267{
5268 return hdd_we_set_vdev(adapter,
5269 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
5270 value);
5271}
5272
5273static int hdd_we_set_early_rx_init_slop(struct hdd_adapter *adapter, int value)
5274{
5275 return hdd_we_set_vdev(adapter,
5276 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
5277 value);
5278}
5279
5280static int hdd_we_set_early_rx_adjust_pause(struct hdd_adapter *adapter,
5281 int value)
5282{
5283 if ((value != 0) && (value != 1))
5284 return -EINVAL;
5285
5286 return hdd_we_set_vdev(adapter,
5287 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
5288 value);
5289}
5290
5291static int hdd_we_set_early_rx_drift_sample(struct hdd_adapter *adapter,
5292 int value)
5293{
5294 return hdd_we_set_vdev(adapter,
5295 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
5296 value);
5297}
5298
5299static int hdd_we_set_dcm(struct hdd_adapter *adapter, int value)
5300{
5301 return hdd_we_set_vdev(adapter,
5302 WMI_VDEV_PARAM_HE_DCM,
5303 value);
5304}
5305
5306static int hdd_we_set_range_ext(struct hdd_adapter *adapter, int value)
5307{
5308 return hdd_we_set_vdev(adapter,
5309 WMI_VDEV_PARAM_HE_RANGE_EXT,
5310 value);
5311}
5312
Jeff Johnson22e57f12018-11-10 16:02:00 -08005313static int hdd_we_set_dbg(struct hdd_adapter *adapter,
5314 int id,
5315 const char *id_string,
5316 int value)
5317{
5318 int errno;
5319
5320 hdd_debug("%s %d", id_string, value);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005321 errno = wma_cli_set_command(adapter->vdev_id, id, value, DBG_CMD);
Jeff Johnson22e57f12018-11-10 16:02:00 -08005322 if (errno)
5323 hdd_err("Failed to set firmware, errno %d", errno);
5324
5325 return errno;
5326}
5327
5328#define hdd_we_set_dbg(adapter, id, value) \
5329 hdd_we_set_dbg(adapter, id, #id, value)
5330
5331static int hdd_we_dbglog_log_level(struct hdd_adapter *adapter, int value)
5332{
5333 return hdd_we_set_dbg(adapter,
5334 WMI_DBGLOG_LOG_LEVEL,
5335 value);
5336}
5337
5338static int hdd_we_dbglog_vap_enable(struct hdd_adapter *adapter, int value)
5339{
5340 return hdd_we_set_dbg(adapter,
5341 WMI_DBGLOG_VAP_ENABLE,
5342 value);
5343}
5344
5345static int hdd_we_dbglog_vap_disable(struct hdd_adapter *adapter, int value)
5346{
5347 return hdd_we_set_dbg(adapter,
5348 WMI_DBGLOG_VAP_DISABLE,
5349 value);
5350}
5351
5352static int hdd_we_dbglog_module_enable(struct hdd_adapter *adapter, int value)
5353{
5354 return hdd_we_set_dbg(adapter,
5355 WMI_DBGLOG_MODULE_ENABLE,
5356 value);
5357}
5358
5359static int hdd_we_dbglog_module_disable(struct hdd_adapter *adapter, int value)
5360{
5361 return hdd_we_set_dbg(adapter,
5362 WMI_DBGLOG_MODULE_DISABLE,
5363 value);
5364}
5365
5366static int hdd_we_dbglog_mod_log_level(struct hdd_adapter *adapter, int value)
5367{
5368 return hdd_we_set_dbg(adapter,
5369 WMI_DBGLOG_MOD_LOG_LEVEL,
5370 value);
5371}
5372
5373static int hdd_we_dbglog_type(struct hdd_adapter *adapter, int value)
5374{
5375 return hdd_we_set_dbg(adapter,
5376 WMI_DBGLOG_TYPE,
5377 value);
5378}
5379
5380static int hdd_we_dbglog_report_enable(struct hdd_adapter *adapter, int value)
5381{
5382 return hdd_we_set_dbg(adapter,
5383 WMI_DBGLOG_REPORT_ENABLE,
5384 value);
5385}
5386
5387static int hdd_we_start_fw_profile(struct hdd_adapter *adapter, int value)
5388{
5389 return hdd_we_set_dbg(adapter,
5390 WMI_WLAN_PROFILE_TRIGGER_CMDID,
5391 value);
5392}
5393
Jeff Johnson274a1d62018-11-12 20:31:51 -08005394static int hdd_we_set_channel(struct hdd_adapter *adapter, int channel)
5395{
5396 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5397 QDF_STATUS status;
5398
5399 hdd_debug("Set Channel %d Session ID %d mode %d", channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005400 adapter->vdev_id, adapter->device_mode);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005401
5402 if (!hdd_ctx->mac_handle)
5403 return -EINVAL;
5404
5405 switch (adapter->device_mode) {
5406 case QDF_STA_MODE:
5407 case QDF_P2P_CLIENT_MODE:
5408 /* supported */
5409 break;
5410 default:
5411 hdd_err("change channel not supported for device mode %d",
5412 adapter->device_mode);
5413 return -EINVAL;
5414 }
5415
5416 status = sme_ext_change_channel(hdd_ctx->mac_handle, channel,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005417 adapter->vdev_id);
Jeff Johnson274a1d62018-11-12 20:31:51 -08005418 if (status != QDF_STATUS_SUCCESS)
5419 hdd_err("Error in change channel status %d", status);
5420
5421 return qdf_status_to_os_return(status);
5422}
5423
Jeff Johnson0e07ca12018-11-12 21:04:45 -08005424static int hdd_we_mcc_config_latency(struct hdd_adapter *adapter, int latency)
5425{
5426 hdd_debug("MCC latency %d", latency);
5427
5428 wlan_hdd_set_mcc_latency(adapter, latency);
5429
5430 return 0;
5431}
5432
5433static int hdd_we_mcc_config_quota(struct hdd_adapter *adapter, int quota)
5434{
5435 hdd_debug("MCC quota %dms", quota);
5436
5437 return wlan_hdd_set_mcc_p2p_quota(adapter, quota);
5438}
5439
Jeff Johnson33ec1982018-11-12 21:40:33 -08005440static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value)
5441{
5442 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5443
5444 if (!hdd_ctx->mac_handle)
5445 return -EINVAL;
5446
5447 sme_update_connect_debug(hdd_ctx->mac_handle, value);
5448
5449 return 0;
5450}
5451
Jeff Johnsone50951c2018-11-13 12:20:23 -08005452static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value)
5453{
5454 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5455
5456 hdd_debug("%d", value);
5457
Abhishek Singh935e4772018-11-21 14:14:10 +05305458 if (!hdd_ctx->psoc)
Jeff Johnsone50951c2018-11-13 12:20:23 -08005459 return -EINVAL;
5460
Abhishek Singh935e4772018-11-21 14:14:10 +05305461 if (value)
5462 ucfg_scan_psoc_set_disable(hdd_ctx->psoc, REASON_USER_SPACE);
5463 else
5464 ucfg_scan_psoc_set_enable(hdd_ctx->psoc, REASON_USER_SPACE);
Jeff Johnsone50951c2018-11-13 12:20:23 -08005465
5466 return 0;
5467}
5468
Jeff Johnsond3f1efd2018-11-13 13:26:19 -08005469static int hdd_we_set_conc_system_pref(struct hdd_adapter *adapter,
5470 int preference)
5471{
5472 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5473
5474 hdd_debug("%d", preference);
5475
5476 if (!hdd_ctx->psoc)
5477 return -EINVAL;
5478
5479 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, preference);
5480
5481 return 0;
5482}
5483
Jeff Johnson74696bb2018-11-13 13:30:36 -08005484static int hdd_we_set_11ax_rate(struct hdd_adapter *adapter, int rate)
5485{
5486 return hdd_set_11ax_rate(adapter, rate, NULL);
5487}
5488
Jeff Johnsonb43ec122018-11-13 14:17:08 -08005489static int hdd_we_set_modulated_dtim(struct hdd_adapter *adapter, int value)
5490{
5491 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5492
5493 hdd_debug("%d", value);
5494
5495 if (!hdd_ctx->psoc)
5496 return -EINVAL;
5497
5498 if ((value < cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM)) ||
5499 (value > cfg_max(CFG_PMO_ENABLE_MODULATED_DTIM))) {
5500 hdd_err("Invalid value %d", value);
5501 return -EINVAL;
5502 }
5503
5504 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, value);
5505
5506 return 0;
5507}
5508
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305509#ifdef WLAN_FEATURE_MOTION_DETECTION
5510/**
5511 * hdd_we_motion_det_start_stop - start/stop motion detection
5512 * @adapter: hdd adapter
5513 * @value: start/stop value to set
5514 *
5515 * Return: 0 on success, error on failure
5516 */
5517static int hdd_we_motion_det_start_stop(struct hdd_adapter *adapter, int value)
5518{
5519 struct sme_motion_det_en motion_det;
5520 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5521
5522 if (value < 0 || value > 1) {
5523 hdd_err("Invalid value %d in mt_start", value);
5524 return -EINVAL;
5525 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005526 motion_det.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305527 motion_det.enable = value;
5528
5529 if (!value)
5530 adapter->motion_detection_mode = 0;
5531
5532 sme_motion_det_enable(hdd_ctx->mac_handle, &motion_det);
5533
5534 return 0;
5535}
5536
5537/**
5538 * hdd_we_motion_det_base_line_start_stop - start/stop md baselining
5539 * @adapter: hdd adapter
5540 * @value: start/stop value to set
5541 *
5542 * Return: 0 on success, error on failure
5543 */
5544static int hdd_we_motion_det_base_line_start_stop(struct hdd_adapter *adapter,
5545 int value)
5546{
5547 struct sme_motion_det_base_line_en motion_det_base_line;
5548 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5549
5550 if (value < 0 || value > 1) {
5551 hdd_err("Invalid value %d in mt_bl_start", value);
5552 return -EINVAL;
5553 }
5554
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08005555 motion_det_base_line.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305556 motion_det_base_line.enable = value;
5557 sme_motion_det_base_line_enable(hdd_ctx->mac_handle,
5558 &motion_det_base_line);
5559
5560 return 0;
5561}
5562#endif /* WLAN_FEATURE_MOTION_DETECTION */
5563
Krishna Reddya50d09f2019-02-04 14:55:06 +05305564int wlan_hdd_set_btcoex_mode(struct hdd_adapter *adapter, int value)
5565{
5566 struct coex_config_params coex_cfg_params = {0};
5567
5568 coex_cfg_params.config_type = WMI_COEX_CONFIG_BTC_MODE;
5569 coex_cfg_params.config_arg1 = value;
5570 coex_cfg_params.vdev_id = adapter->vdev_id;
5571
5572 if (value < cfg_min(CFG_BTC_MODE) || value > cfg_max(CFG_BTC_MODE)) {
5573 hdd_err_rl("Invalid value %d", value);
5574 return -EINVAL;
5575 }
5576
5577 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5578 hdd_err_rl("Failed to send coex BTC mode");
5579 return -EINVAL;
5580 }
5581
5582 return 0;
5583}
5584
5585int wlan_hdd_set_btcoex_rssi_threshold(struct hdd_adapter *adapter, int value)
5586{
5587 struct coex_config_params coex_cfg_params = {0};
5588
5589 coex_cfg_params.config_type = WMI_COEX_CONFIG_BT_LOW_RSSI_THRESHOLD;
5590 coex_cfg_params.config_arg1 = value;
5591 coex_cfg_params.vdev_id = adapter->vdev_id;
5592
5593 if (value < cfg_min(CFG_WLAN_LOW_RSSI_THRESHOLD) ||
5594 value > cfg_max(CFG_WLAN_LOW_RSSI_THRESHOLD)) {
5595 hdd_err_rl("Invalid value %d", value);
5596 return -EINVAL;
5597 }
5598
5599 if (QDF_IS_STATUS_ERROR(sme_send_coex_config_cmd(&coex_cfg_params))) {
5600 hdd_err_rl("Failed to send coex BTC RSSI Threshold");
5601 return -EINVAL;
5602 }
5603 return 0;
5604}
Jeff Johnson3ba27322018-11-13 17:58:28 -08005605typedef int (*setint_getnone_fn)(struct hdd_adapter *adapter, int value);
5606static const setint_getnone_fn setint_getnone_cb[] = {
5607 [WE_SET_11D_STATE] = hdd_we_set_11d_state,
5608 [WE_SET_POWER] = hdd_we_set_power,
5609 [WE_SET_MAX_ASSOC] = hdd_we_set_max_assoc,
5610 [WE_SET_DATA_INACTIVITY_TO] = hdd_we_set_data_inactivity_timeout,
5611 [WE_SET_WOW_DATA_INACTIVITY_TO] =
5612 hdd_we_set_wow_data_inactivity_timeout,
5613 [WE_SET_MC_RATE] = wlan_hdd_set_mc_rate,
5614 [WE_SET_TX_POWER] = hdd_we_set_tx_power,
5615 [WE_SET_MAX_TX_POWER] = hdd_we_set_max_tx_power,
5616 [WE_SET_MAX_TX_POWER_2_4] = hdd_we_set_max_tx_power_2_4,
5617 [WE_SET_MAX_TX_POWER_5_0] = hdd_we_set_max_tx_power_5_0,
Jeff Johnson0187c622019-01-04 06:39:44 -08005618#ifdef HASTINGS_BT_WAR
5619 [WE_SET_HASTINGS_BT_WAR] = hdd_we_set_hastings_bt_war,
5620#endif
Jeff Johnson3ba27322018-11-13 17:58:28 -08005621 [WE_SET_TM_LEVEL] = hdd_we_set_tm_level,
5622 [WE_SET_PHYMODE] = wlan_hdd_update_phymode,
5623 [WE_SET_NSS] = hdd_we_set_nss,
5624 [WE_SET_GTX_HT_MCS] = hdd_we_set_gtx_ht_mcs,
5625 [WE_SET_GTX_VHT_MCS] = hdd_we_set_gtx_vht_mcs,
5626 [WE_SET_GTX_USRCFG] = hdd_we_set_gtx_usrcfg,
5627 [WE_SET_GTX_THRE] = hdd_we_set_gtx_thre,
5628 [WE_SET_GTX_MARGIN] = hdd_we_set_gtx_margin,
5629 [WE_SET_GTX_STEP] = hdd_we_set_gtx_step,
5630 [WE_SET_GTX_MINTPC] = hdd_we_set_gtx_mintpc,
5631 [WE_SET_GTX_BWMASK] = hdd_we_set_gtx_bwmask,
5632 [WE_SET_LDPC] = hdd_set_ldpc,
5633 [WE_SET_TX_STBC] = hdd_set_tx_stbc,
5634 [WE_SET_RX_STBC] = hdd_set_rx_stbc,
5635 [WE_SET_SHORT_GI] = hdd_we_set_short_gi,
5636 [WE_SET_RTSCTS] = hdd_we_set_rtscts,
5637 [WE_SET_CHWIDTH] = hdd_we_set_ch_width,
5638 [WE_SET_ANI_EN_DIS] = hdd_we_set_ani_en_dis,
5639 [WE_SET_ANI_POLL_PERIOD] = hdd_we_set_ani_poll_period,
5640 [WE_SET_ANI_LISTEN_PERIOD] = hdd_we_set_ani_listen_period,
5641 [WE_SET_ANI_OFDM_LEVEL] = hdd_we_set_ani_ofdm_level,
5642 [WE_SET_ANI_CCK_LEVEL] = hdd_we_set_ani_cck_level,
5643 [WE_SET_DYNAMIC_BW] = hdd_we_set_dynamic_bw,
5644 [WE_SET_CTS_CBW] = hdd_we_set_cts_cbw,
5645 [WE_SET_11N_RATE] = hdd_we_set_11n_rate,
5646 [WE_SET_VHT_RATE] = hdd_we_set_vht_rate,
5647 [WE_SET_AMPDU] = hdd_we_set_ampdu,
5648 [WE_SET_AMSDU] = hdd_we_set_amsdu,
5649 [WE_SET_TX_CHAINMASK] = hdd_we_set_tx_chainmask,
5650 [WE_SET_RX_CHAINMASK] = hdd_we_set_rx_chainmask,
5651 [WE_SET_TXPOW_2G] = hdd_we_set_txpow_2g,
5652 [WE_SET_TXPOW_5G] = hdd_we_set_txpow_5g,
5653 [WE_DBGLOG_LOG_LEVEL] = hdd_we_dbglog_log_level,
5654 [WE_DBGLOG_VAP_ENABLE] = hdd_we_dbglog_vap_enable,
5655 [WE_DBGLOG_VAP_DISABLE] = hdd_we_dbglog_vap_disable,
5656 [WE_DBGLOG_MODULE_ENABLE] = hdd_we_dbglog_module_enable,
5657 [WE_DBGLOG_MODULE_DISABLE] = hdd_we_dbglog_module_disable,
5658 [WE_DBGLOG_MOD_LOG_LEVEL] = hdd_we_dbglog_mod_log_level,
5659 [WE_DBGLOG_TYPE] = hdd_we_dbglog_type,
5660 [WE_DBGLOG_REPORT_ENABLE] = hdd_we_dbglog_report_enable,
5661 [WE_SET_TXRX_FWSTATS] = hdd_we_set_txrx_fwstats,
5662 [WE_TXRX_FWSTATS_RESET] = hdd_we_txrx_fwstats_reset,
5663 [WE_DUMP_STATS] = hdd_wlan_dump_stats,
5664 [WE_CLEAR_STATS] = hdd_we_clear_stats,
5665 [WE_PPS_PAID_MATCH] = hdd_we_pps_paid_match,
5666 [WE_PPS_GID_MATCH] = hdd_we_pps_gid_match,
5667 [WE_PPS_EARLY_TIM_CLEAR] = hdd_we_pps_early_tim_clear,
5668 [WE_PPS_EARLY_DTIM_CLEAR] = hdd_we_pps_early_dtim_clear,
5669 [WE_PPS_EOF_PAD_DELIM] = hdd_we_pps_eof_pad_delim,
5670 [WE_PPS_MACADDR_MISMATCH] = hdd_we_pps_macaddr_mismatch,
5671 [WE_PPS_DELIM_CRC_FAIL] = hdd_we_pps_delim_crc_fail,
5672 [WE_PPS_GID_NSTS_ZERO] = hdd_we_pps_gid_nsts_zero,
5673 [WE_PPS_RSSI_CHECK] = hdd_we_pps_rssi_check,
5674 [WE_PPS_5G_EBT] = hdd_we_pps_5g_ebt,
5675 [WE_SET_HTSMPS] = hdd_we_set_htsmps,
5676 [WE_SET_QPOWER_MAX_PSPOLL_COUNT] = hdd_we_set_qpower_max_pspoll_count,
5677 [WE_SET_QPOWER_MAX_TX_BEFORE_WAKE] =
5678 hdd_we_set_qpower_max_tx_before_wake,
5679 [WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL] =
5680 hdd_we_set_qpower_spec_pspoll_wake_interval,
5681 [WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL] =
5682 hdd_we_set_qpower_spec_max_spec_nodata_pspoll,
5683 [WE_MCC_CONFIG_LATENCY] = hdd_we_mcc_config_latency,
5684 [WE_MCC_CONFIG_QUOTA] = hdd_we_mcc_config_quota,
5685 [WE_SET_DEBUG_LOG] = hdd_we_set_debug_log,
5686 [WE_SET_EARLY_RX_ADJUST_ENABLE] = hdd_we_set_early_rx_adjust_enable,
5687 [WE_SET_EARLY_RX_TGT_BMISS_NUM] = hdd_we_set_early_rx_tgt_bmiss_num,
5688 [WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE] =
5689 hdd_we_set_early_rx_bmiss_sample_cycle,
5690 [WE_SET_EARLY_RX_SLOP_STEP] = hdd_we_set_early_rx_slop_step,
5691 [WE_SET_EARLY_RX_INIT_SLOP] = hdd_we_set_early_rx_init_slop,
5692 [WE_SET_EARLY_RX_ADJUST_PAUSE] = hdd_we_set_early_rx_adjust_pause,
5693 [WE_SET_EARLY_RX_DRIFT_SAMPLE] = hdd_we_set_early_rx_drift_sample,
5694 [WE_SET_SCAN_DISABLE] = hdd_we_set_scan_disable,
5695 [WE_START_FW_PROFILE] = hdd_we_start_fw_profile,
5696 [WE_SET_CHANNEL] = hdd_we_set_channel,
5697 [WE_SET_CONC_SYSTEM_PREF] = hdd_we_set_conc_system_pref,
5698 [WE_SET_11AX_RATE] = hdd_we_set_11ax_rate,
5699 [WE_SET_DCM] = hdd_we_set_dcm,
5700 [WE_SET_RANGE_EXT] = hdd_we_set_range_ext,
5701 [WE_SET_PDEV_RESET] = hdd_handle_pdev_reset,
5702 [WE_SET_MODULATED_DTIM] = hdd_we_set_modulated_dtim,
Visweswara Tanuku633976b2019-01-07 16:13:12 +05305703#ifdef WLAN_FEATURE_MOTION_DETECTION
5704 [WE_MOTION_DET_START_STOP] = hdd_we_motion_det_start_stop,
5705 [WE_MOTION_DET_BASE_LINE_START_STOP] =
5706 hdd_we_motion_det_base_line_start_stop,
5707#endif /* WLAN_FEATURE_MOTION_DETECTION */
Krishna Reddya50d09f2019-02-04 14:55:06 +05305708 [WE_SET_BTCOEX_MODE] = wlan_hdd_set_btcoex_mode,
5709 [WE_SET_BTCOEX_RSSI_THRESHOLD] = wlan_hdd_set_btcoex_rssi_threshold,
Jeff Johnson3ba27322018-11-13 17:58:28 -08005710};
5711
5712static setint_getnone_fn hdd_get_setint_getnone_cb(int param)
5713{
5714 if (param < 0)
5715 return NULL;
5716
5717 if (param >= QDF_ARRAY_SIZE(setint_getnone_cb))
5718 return NULL;
5719
5720 return setint_getnone_cb[param];
5721}
5722
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005723/**
5724 * iw_setint_getnone() - Generic "set integer" private ioctl handler
5725 * @dev: device upon which the ioctl was received
5726 * @info: ioctl request information
5727 * @wrqu: ioctl request data
5728 * @extra: ioctl extra data
5729 *
5730 * Return: 0 on success, non-zero on error
5731 */
5732static int __iw_setint_getnone(struct net_device *dev,
5733 struct iw_request_info *info,
5734 union iwreq_data *wrqu, char *extra)
5735{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005736 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005737 struct hdd_context *hdd_ctx;
Jeff Johnson3ba27322018-11-13 17:58:28 -08005738 setint_getnone_fn cb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005739 int *value = (int *)extra;
5740 int sub_cmd = value[0];
5741 int set_value = value[1];
5742 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005743
Dustin Brownfdf17c12018-03-14 12:55:34 -07005744 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305745
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005746 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005747 ret = wlan_hdd_validate_context(hdd_ctx);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005748 if (ret)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005749 return ret;
5750
Jeff Johnson441e1f72017-02-07 08:50:49 -08005751 ret = hdd_check_private_wext_control(hdd_ctx, info);
Jeff Johnsondaf2e6a2018-10-19 12:46:35 -07005752 if (ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08005753 return ret;
5754
Jeff Johnson3ba27322018-11-13 17:58:28 -08005755 cb = hdd_get_setint_getnone_cb(sub_cmd);
5756 if (!cb) {
Rajeev Kumard0565362018-03-01 12:02:01 -08005757 hdd_debug("Invalid sub command %d", sub_cmd);
Jeff Johnson3ba27322018-11-13 17:58:28 -08005758 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005759 }
Dustin Brownc88e5962018-04-26 12:32:40 -07005760
Jeff Johnson3ba27322018-11-13 17:58:28 -08005761 ret = cb(adapter, set_value);
5762
Dustin Browne74003f2018-03-14 12:51:58 -07005763 hdd_exit();
Dustin Brownc88e5962018-04-26 12:32:40 -07005764
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005765 return ret;
5766}
5767
5768static int iw_setint_getnone(struct net_device *dev,
5769 struct iw_request_info *info,
5770 union iwreq_data *wrqu,
5771 char *extra)
5772{
Dustin Brown389e5072018-11-08 17:10:01 +05305773 int errno;
5774 struct osif_vdev_sync *vdev_sync;
5775
5776 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5777 if (errno)
5778 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005779
Dustin Brown389e5072018-11-08 17:10:01 +05305780 errno = __iw_setint_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005781
Dustin Brown389e5072018-11-08 17:10:01 +05305782 osif_vdev_sync_op_stop(vdev_sync);
5783
5784 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005785}
5786
5787/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005788 * __iw_setnone_get_threeint() - return three value to up layer.
5789 *
5790 * @dev: pointer of net_device of this wireless card
5791 * @info: meta data about Request sent
5792 * @wrqu: include request info
5793 * @extra: buf used for in/Output
5794 *
5795 * Return: execute result
5796 */
5797static int __iw_setnone_get_threeint(struct net_device *dev,
5798 struct iw_request_info *info,
5799 union iwreq_data *wrqu, char *extra)
5800{
5801 int ret = 0; /* success */
5802 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07005803 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005804 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005805
Dustin Brownfdf17c12018-03-14 12:55:34 -07005806 hdd_enter_dev(dev);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005807 ret = wlan_hdd_validate_context(hdd_ctx);
5808 if (0 != ret)
5809 return ret;
5810
Jeff Johnson441e1f72017-02-07 08:50:49 -08005811 ret = hdd_check_private_wext_control(hdd_ctx, info);
5812 if (0 != ret)
5813 return ret;
5814
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005815 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005816 switch (value[0]) {
5817 case WE_GET_TSF:
5818 ret = hdd_indicate_tsf(adapter, value, 3);
5819 break;
5820 default:
5821 hdd_err("Invalid IOCTL get_value command %d", value[0]);
5822 break;
5823 }
5824 return ret;
5825}
5826
5827/**
5828 * iw_setnone_get_threeint() - return three value to up layer.
5829 *
5830 * @dev: pointer of net_device of this wireless card
5831 * @info: meta data about Request sent
5832 * @wrqu: include request info
5833 * @extra: buf used for in/Output
5834 *
5835 * Return: execute result
5836 */
5837static int iw_setnone_get_threeint(struct net_device *dev,
5838 struct iw_request_info *info,
5839 union iwreq_data *wrqu, char *extra)
5840{
Dustin Brown389e5072018-11-08 17:10:01 +05305841 int errno;
5842 struct osif_vdev_sync *vdev_sync;
5843
5844 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
5845 if (errno)
5846 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005847
Dustin Brown389e5072018-11-08 17:10:01 +05305848 errno = __iw_setnone_get_threeint(dev, info, wrqu, extra);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005849
Dustin Brown389e5072018-11-08 17:10:01 +05305850 osif_vdev_sync_op_stop(vdev_sync);
5851
5852 return errno;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005853}
5854
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005855#ifdef WLAN_UNIT_TEST
Dustin Brown7d038e52018-11-29 14:28:13 -08005856typedef uint32_t (*hdd_ut_callback)(void);
5857
5858struct hdd_ut_entry {
5859 const hdd_ut_callback callback;
5860 const char *name;
5861};
5862
5863struct hdd_ut_entry hdd_ut_entries[] = {
5864 { .name = "dsc", .callback = dsc_unit_test },
Dustin Brown9c49a332019-03-05 11:27:38 -08005865 { .name = "qdf_ht", .callback = qdf_ht_unit_test },
5866 { .name = "qdf_periodic_work",
5867 .callback = qdf_periodic_work_unit_test },
5868 { .name = "qdf_talloc", .callback = qdf_talloc_unit_test },
5869 { .name = "qdf_types", .callback = qdf_types_unit_test },
Dustin Brown7d038e52018-11-29 14:28:13 -08005870};
5871
5872#define hdd_for_each_ut_entry(cursor) \
5873 for (cursor = hdd_ut_entries; \
5874 cursor < hdd_ut_entries + ARRAY_SIZE(hdd_ut_entries); \
5875 cursor++)
5876
5877static struct hdd_ut_entry *hdd_ut_lookup(const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005878{
Dustin Brown7d038e52018-11-29 14:28:13 -08005879 struct hdd_ut_entry *entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005880
Dustin Brown7d038e52018-11-29 14:28:13 -08005881 hdd_for_each_ut_entry(entry) {
5882 if (qdf_str_eq(entry->name, name))
5883 return entry;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005884 }
5885
Dustin Brown7d038e52018-11-29 14:28:13 -08005886 return NULL;
5887}
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005888
Dustin Brown7d038e52018-11-29 14:28:13 -08005889static uint32_t hdd_ut_single(const struct hdd_ut_entry *entry)
5890{
5891 uint32_t errors;
5892
5893 hdd_nofl_info("START: '%s'", entry->name);
5894
5895 errors = entry->callback();
5896 if (errors)
5897 hdd_nofl_err("FAIL: '%s' with %u errors", entry->name, errors);
5898 else
5899 hdd_nofl_info("PASS: '%s'", entry->name);
5900
5901 return errors;
5902}
5903
5904static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
5905{
5906 struct hdd_ut_entry *entry;
5907 uint32_t errors = 0;
5908
5909 hdd_nofl_info("Unit tests begin");
5910
5911 if (!name || !name[0] || qdf_str_eq(name, "all")) {
5912 hdd_for_each_ut_entry(entry)
5913 errors += hdd_ut_single(entry);
5914 } else {
5915 entry = hdd_ut_lookup(name);
5916 if (entry)
5917 errors += hdd_ut_single(entry);
5918 else
5919 hdd_nofl_err("Unit test '%s' not found", name);
5920 }
5921
5922 hdd_nofl_info("Unit tests complete");
5923
5924 return errors ? -EPERM : 0;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005925}
5926#else
Dustin Brown7d038e52018-11-29 14:28:13 -08005927static int hdd_we_unit_test(struct hdd_context *hdd_ctx, const char *name)
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005928{
5929 return -EOPNOTSUPP;
5930}
5931#endif /* WLAN_UNIT_TEST */
5932
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07005933/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005934 * iw_setchar_getnone() - Generic "set string" private ioctl handler
5935 * @dev: device upon which the ioctl was received
5936 * @info: ioctl request information
5937 * @wrqu: ioctl request data
5938 * @extra: ioctl extra data
5939 *
5940 * Return: 0 on success, non-zero on error
5941 */
5942static int __iw_setchar_getnone(struct net_device *dev,
5943 struct iw_request_info *info,
5944 union iwreq_data *wrqu, char *extra)
5945{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005946 int sub_cmd;
5947 int ret;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005948 char *str_arg = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005949 struct hdd_adapter *adapter = (netdev_priv(dev));
5950 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005951 struct iw_point s_priv_data;
Manikandan Mohan06d38d82018-11-26 18:36:58 -08005952 bool neighbor_report_req_support = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005953
Dustin Brownfdf17c12018-03-14 12:55:34 -07005954 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005955
Mukul Sharma34777c62015-11-02 20:22:30 +05305956 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005957 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05305958 return -EPERM;
5959 }
5960
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005961 ret = wlan_hdd_validate_context(hdd_ctx);
5962 if (0 != ret)
5963 return ret;
5964
Jeff Johnson441e1f72017-02-07 08:50:49 -08005965 ret = hdd_check_private_wext_control(hdd_ctx, info);
5966 if (0 != ret)
5967 return ret;
5968
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005969 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005970 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005971 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005972
5973 /* make sure all params are correctly passed to function */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005974 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005975 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005976
5977 sub_cmd = s_priv_data.flags;
5978
5979 /* ODD number is used for set, copy data using copy_from_user */
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005980 str_arg = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005981 s_priv_data.length);
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005982 if (!str_arg) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005983 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005984 return -ENOMEM;
5985 }
5986
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005987 hdd_debug("Received length: %d data: %s",
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07005988 s_priv_data.length, str_arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005989
5990 switch (sub_cmd) {
5991 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005992 hdd_debug("ADD_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305993 if (!hdd_add_wowl_ptrn(adapter, str_arg))
5994 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005995 break;
5996 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005997 hdd_debug("DEL_PTRN");
Visweswara Tanuku16214ff2018-12-14 12:12:58 +05305998 if (!hdd_del_wowl_ptrn(adapter, str_arg))
5999 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006000 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006001 case WE_NEIGHBOR_REPORT_REQUEST:
6002 {
Jeff Johnson84b34332019-03-09 18:21:35 -08006003 tRrmNeighborReq request;
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006004 tRrmNeighborRspCallbackInfo callback;
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05306005 bool rrm_enabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006006
Yeshwanth Sriram Guntuka334aa8d2018-08-20 16:49:15 +05306007 ucfg_wlan_mlme_get_rrm_enabled(hdd_ctx->psoc,
6008 &rrm_enabled);
6009
6010 if (rrm_enabled) {
Jeff Johnson84b34332019-03-09 18:21:35 -08006011 request.neighbor_report_offload = false;
6012 request.no_ssid =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006013 (s_priv_data.length - 1) ? false : true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306014 hdd_debug("Neighbor Request ssid present %d",
Jeff Johnson84b34332019-03-09 18:21:35 -08006015 request.no_ssid);
6016 if (!request.no_ssid) {
6017 request.ssid.length =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006018 (s_priv_data.length - 1) >
6019 32 ? 32 : (s_priv_data.length - 1);
Jeff Johnson84b34332019-03-09 18:21:35 -08006020 qdf_mem_copy(request.ssid.ssId,
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006021 str_arg,
Jeff Johnson84b34332019-03-09 18:21:35 -08006022 request.ssid.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006023 }
6024
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306025 /*
6026 * If 11k offload is supported by FW and enabled
6027 * in the ini, set the offload to true
6028 */
Manikandan Mohan06d38d82018-11-26 18:36:58 -08006029 if (QDF_IS_STATUS_ERROR(
6030 ucfg_fwol_is_neighbor_report_req_supported(
6031 hdd_ctx->psoc, &neighbor_report_req_support)))
6032 hdd_err("Neighbor report req bit get fail");
6033
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306034 if (hdd_ctx->config->is_11k_offload_supported &&
Manikandan Mohan06d38d82018-11-26 18:36:58 -08006035 neighbor_report_req_support) {
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306036 hdd_debug("Neighbor report offloaded to FW");
Jeff Johnson84b34332019-03-09 18:21:35 -08006037 request.neighbor_report_offload = true;
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306038 }
6039
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006040 callback.neighborRspCallback = NULL;
6041 callback.neighborRspCallbackContext = NULL;
6042 callback.timeout = 5000; /* 5 seconds */
Vignesh Viswanathan694e28e2018-01-18 20:53:57 +05306043 sme_neighbor_report_request(
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006044 hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006045 adapter->vdev_id,
Jeff Johnson84b34332019-03-09 18:21:35 -08006046 &request,
Jeff Johnson09bb9cf2019-03-09 18:15:40 -08006047 &callback);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006048 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006049 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006050 ret = -EINVAL;
6051 }
6052 }
6053 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006054 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08006055 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006056 break;
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006057 case WE_UNIT_TEST:
6058 ret = hdd_we_unit_test(hdd_ctx, str_arg);
6059 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006060 default:
6061 {
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006062 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006063 ret = -EINVAL;
6064 break;
6065 }
6066 }
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006067
6068 qdf_mem_free(str_arg);
Dustin Browne74003f2018-03-14 12:51:58 -07006069 hdd_exit();
Dustin Brown0ea8d3b2018-07-06 13:58:49 -07006070
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006071 return ret;
6072}
6073
6074static int iw_setchar_getnone(struct net_device *dev,
6075 struct iw_request_info *info,
6076 union iwreq_data *wrqu, char *extra)
6077{
Dustin Brown389e5072018-11-08 17:10:01 +05306078 int errno;
6079 struct osif_vdev_sync *vdev_sync;
6080
6081 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6082 if (errno)
6083 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006084
Dustin Brown389e5072018-11-08 17:10:01 +05306085 errno = __iw_setchar_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006086
Dustin Brown389e5072018-11-08 17:10:01 +05306087 osif_vdev_sync_op_stop(vdev_sync);
6088
6089 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006090}
6091
6092/**
6093 * iw_setnone_getint() - Generic "get integer" private ioctl handler
6094 * @dev: device upon which the ioctl was received
6095 * @info: ioctl request information
6096 * @wrqu: ioctl request data
6097 * @extra: ioctl extra data
6098 *
6099 * Return: 0 on success, non-zero on error
6100 */
6101static int __iw_setnone_getint(struct net_device *dev,
6102 struct iw_request_info *info,
6103 union iwreq_data *wrqu, char *extra)
6104{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006105 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006106 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006107 int *value = (int *)extra;
6108 int ret;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08006109 struct sme_config_params *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006110 struct hdd_context *hdd_ctx;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306111 QDF_STATUS status;
6112 bool bval = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006113
Dustin Brownfdf17c12018-03-14 12:55:34 -07006114 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306115
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006116 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006117 ret = wlan_hdd_validate_context(hdd_ctx);
6118 if (0 != ret)
6119 return ret;
6120
Jeff Johnson441e1f72017-02-07 08:50:49 -08006121 ret = hdd_check_private_wext_control(hdd_ctx, info);
6122 if (0 != ret)
6123 return ret;
6124
Rajeev Kumar1117fcf2018-02-15 16:25:19 -08006125 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6126 if (!sme_config) {
6127 hdd_err("failed to allocate memory for sme_config");
6128 return -ENOMEM;
6129 }
6130
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006131 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006132 switch (value[0]) {
6133 case WE_GET_11D_STATE:
6134 {
Abhinav Kumard4d6eb72018-12-04 20:30:37 +05306135 status = ucfg_mlme_is_11d_enabled(hdd_ctx->psoc, &bval);
6136 if (!QDF_IS_STATUS_SUCCESS(status))
6137 hdd_err("Invalid 11d_enable flag");
6138 *value = bval;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006139 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006140
6141 break;
6142 }
6143
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006144 case WE_GET_WLAN_DBG:
6145 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306146 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006147 *value = 0;
6148 break;
6149 }
6150 case WE_GET_MAX_ASSOC:
6151 {
Dustin Brown05d81302018-09-11 16:49:22 -07006152 if (ucfg_mlme_set_assoc_sta_limit(hdd_ctx->psoc, *value) !=
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306153 QDF_STATUS_SUCCESS) {
6154 hdd_err("CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006155 ret = -EIO;
6156 }
Bala Venkatesh2fde2c62018-09-11 20:33:24 +05306157
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006158 break;
6159 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006160
6161 case WE_GET_CONCURRENCY_MODE:
6162 {
Dustin Brown05d81302018-09-11 16:49:22 -07006163 *value = policy_mgr_get_concurrency_mode(hdd_ctx->psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006164
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006165 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006166 break;
6167 }
6168
6169 case WE_GET_NSS:
6170 {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006171 sme_get_config_param(mac_handle, sme_config);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306172 status = ucfg_mlme_get_vht_enable2x2(hdd_ctx->psoc, &bval);
6173 if (!QDF_IS_STATUS_SUCCESS(status))
6174 hdd_err("unable to get vht_enable2x2");
6175 *value = (bval == 0) ? 1 : 2;
Dustin Brown05d81302018-09-11 16:49:22 -07006176 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->psoc))
Srinivas Girigowda576b2352017-08-25 14:44:26 -07006177 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006178 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006179 break;
6180 }
6181
6182 case WE_GET_GTX_HT_MCS:
6183 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006184 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006185 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006186 WMI_VDEV_PARAM_GTX_HT_MCS,
6187 GTX_CMD);
6188 break;
6189 }
6190
6191 case WE_GET_GTX_VHT_MCS:
6192 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006193 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006194 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006195 WMI_VDEV_PARAM_GTX_VHT_MCS,
6196 GTX_CMD);
6197 break;
6198 }
6199
6200 case WE_GET_GTX_USRCFG:
6201 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006202 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006203 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006204 WMI_VDEV_PARAM_GTX_USR_CFG,
6205 GTX_CMD);
6206 break;
6207 }
6208
6209 case WE_GET_GTX_THRE:
6210 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006211 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006212 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006213 WMI_VDEV_PARAM_GTX_THRE,
6214 GTX_CMD);
6215 break;
6216 }
6217
6218 case WE_GET_GTX_MARGIN:
6219 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006220 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006221 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006222 WMI_VDEV_PARAM_GTX_MARGIN,
6223 GTX_CMD);
6224 break;
6225 }
6226
6227 case WE_GET_GTX_STEP:
6228 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006229 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006230 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006231 WMI_VDEV_PARAM_GTX_STEP,
6232 GTX_CMD);
6233 break;
6234 }
6235
6236 case WE_GET_GTX_MINTPC:
6237 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006238 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006239 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006240 WMI_VDEV_PARAM_GTX_MINTPC,
6241 GTX_CMD);
6242 break;
6243 }
6244
6245 case WE_GET_GTX_BWMASK:
6246 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006247 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006248 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006249 WMI_VDEV_PARAM_GTX_BW_MASK,
6250 GTX_CMD);
6251 break;
6252 }
6253
6254 case WE_GET_LDPC:
6255 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006256 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006257 break;
6258 }
6259
6260 case WE_GET_TX_STBC:
6261 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006262 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006263 break;
6264 }
6265
6266 case WE_GET_RX_STBC:
6267 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006268 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006269 break;
6270 }
6271
6272 case WE_GET_SHORT_GI:
6273 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006274 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006275 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08006276 WMI_VDEV_PARAM_SGI,
6277 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006278 break;
6279 }
6280
6281 case WE_GET_RTSCTS:
6282 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006283 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006284 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006285 WMI_VDEV_PARAM_ENABLE_RTSCTS,
6286 VDEV_CMD);
6287 break;
6288 }
6289
6290 case WE_GET_CHWIDTH:
6291 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006292 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006293 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006294 WMI_VDEV_PARAM_CHWIDTH,
6295 VDEV_CMD);
6296 break;
6297 }
6298
6299 case WE_GET_ANI_EN_DIS:
6300 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006301 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006302 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006303 WMI_PDEV_PARAM_ANI_ENABLE,
6304 PDEV_CMD);
6305 break;
6306 }
6307
6308 case WE_GET_ANI_POLL_PERIOD:
6309 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006310 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006311 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006312 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
6313 PDEV_CMD);
6314 break;
6315 }
6316
6317 case WE_GET_ANI_LISTEN_PERIOD:
6318 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006319 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006320 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006321 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
6322 PDEV_CMD);
6323 break;
6324 }
6325
6326 case WE_GET_ANI_OFDM_LEVEL:
6327 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006328 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006329 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006330 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
6331 PDEV_CMD);
6332 break;
6333 }
6334
6335 case WE_GET_ANI_CCK_LEVEL:
6336 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006337 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006338 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006339 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
6340 PDEV_CMD);
6341 break;
6342 }
6343
6344 case WE_GET_DYNAMIC_BW:
6345 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006346 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006347 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006348 WMI_PDEV_PARAM_DYNAMIC_BW,
6349 PDEV_CMD);
6350 break;
6351 }
6352
6353 case WE_GET_11N_RATE:
6354 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006355 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006356 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006357 WMI_VDEV_PARAM_FIXED_RATE,
6358 VDEV_CMD);
6359 break;
6360 }
6361
6362 case WE_GET_AMPDU:
6363 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006364 hdd_debug("GET AMPDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006365 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006366 GEN_VDEV_PARAM_AMPDU,
6367 GEN_CMD);
6368 break;
6369 }
6370
6371 case WE_GET_AMSDU:
6372 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006373 hdd_debug("GET AMSDU");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006374 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006375 GEN_VDEV_PARAM_AMSDU,
6376 GEN_CMD);
6377 break;
6378 }
6379
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006380 case WE_GET_ROAM_SYNCH_DELAY:
6381 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006382 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006383 *value = wma_cli_get_command(adapter->vdev_id,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07006384 GEN_VDEV_ROAM_SYNCH_DELAY,
6385 GEN_CMD);
6386 break;
6387 }
6388
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006389 case WE_GET_TX_CHAINMASK:
6390 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006391 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006392 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006393 WMI_PDEV_PARAM_TX_CHAIN_MASK,
6394 PDEV_CMD);
6395 break;
6396 }
6397
6398 case WE_GET_RX_CHAINMASK:
6399 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006400 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006401 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006402 WMI_PDEV_PARAM_RX_CHAIN_MASK,
6403 PDEV_CMD);
6404 break;
6405 }
6406
6407 case WE_GET_TXPOW_2G:
6408 {
Wu Gao5f764082019-01-04 15:54:38 +08006409 uint8_t txpow2g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006410
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006411 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006412 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006413 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
6414 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006415 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow2g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006416 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006417 break;
6418 }
6419
6420 case WE_GET_TXPOW_5G:
6421 {
Wu Gao5f764082019-01-04 15:54:38 +08006422 uint8_t txpow5g = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006423
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006424 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006425 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006426 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
6427 PDEV_CMD);
Wu Gao5f764082019-01-04 15:54:38 +08006428 ucfg_mlme_get_current_tx_power_level(hdd_ctx->psoc, &txpow5g);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006429 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006430 break;
6431 }
6432
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006433 case WE_GET_PPS_PAID_MATCH:
6434 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006435 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006436 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006437 WMI_VDEV_PPS_PAID_MATCH,
6438 PPS_CMD);
6439 break;
6440 }
6441
6442 case WE_GET_PPS_GID_MATCH:
6443 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006444 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006445 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006446 WMI_VDEV_PPS_GID_MATCH,
6447 PPS_CMD);
6448 break;
6449 }
6450
6451 case WE_GET_PPS_EARLY_TIM_CLEAR:
6452 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006453 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006454 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006455 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
6456 PPS_CMD);
6457 break;
6458 }
6459
6460 case WE_GET_PPS_EARLY_DTIM_CLEAR:
6461 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006462 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006463 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006464 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
6465 PPS_CMD);
6466 break;
6467 }
6468
6469 case WE_GET_PPS_EOF_PAD_DELIM:
6470 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006471 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006472 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006473 WMI_VDEV_PPS_EOF_PAD_DELIM,
6474 PPS_CMD);
6475 break;
6476 }
6477
6478 case WE_GET_PPS_MACADDR_MISMATCH:
6479 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006480 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006481 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006482 WMI_VDEV_PPS_MACADDR_MISMATCH,
6483 PPS_CMD);
6484 break;
6485 }
6486
6487 case WE_GET_PPS_DELIM_CRC_FAIL:
6488 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006489 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006490 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006491 WMI_VDEV_PPS_DELIM_CRC_FAIL,
6492 PPS_CMD);
6493 break;
6494 }
6495
6496 case WE_GET_PPS_GID_NSTS_ZERO:
6497 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006498 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006499 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006500 WMI_VDEV_PPS_GID_NSTS_ZERO,
6501 PPS_CMD);
6502 break;
6503 }
6504
6505 case WE_GET_PPS_RSSI_CHECK:
6506 {
6507
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006508 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006509 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006510 WMI_VDEV_PPS_RSSI_CHECK,
6511 PPS_CMD);
6512 break;
6513 }
6514
6515 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
6516 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006517 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006518 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006519 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
6520 QPOWER_CMD);
6521 break;
6522 }
6523
6524 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
6525 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006526 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006527 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006528 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
6529 QPOWER_CMD);
6530 break;
6531 }
6532
6533 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
6534 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006535 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006536 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006537 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
6538 QPOWER_CMD);
6539 break;
6540 }
6541
6542 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
6543 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006544 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006545 *value = wma_cli_get_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006546 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
6547 QPOWER_CMD);
6548 break;
6549 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006550 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006551 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07006552 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006553 case WE_GET_TEMPERATURE:
6554 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006555 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006556 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006557 break;
6558 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006559 case WE_GET_DCM:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006560 hdd_debug("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006561 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07006562 WMI_VDEV_PARAM_HE_DCM,
6563 VDEV_CMD);
6564 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006565 case WE_GET_RANGE_EXT:
Dustin Brown5e89ef82018-03-14 11:50:23 -07006566 hdd_debug("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006567 *value = wma_cli_get_command(adapter->vdev_id,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07006568 WMI_VDEV_PARAM_HE_RANGE_EXT,
6569 VDEV_CMD);
6570 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006571 default:
6572 {
Jeff Johnson99bac312016-06-28 10:38:18 -07006573 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006574 value[0]);
6575 break;
6576 }
6577 }
Dustin Browne74003f2018-03-14 12:51:58 -07006578 hdd_exit();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306579 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006580 return ret;
6581}
6582
6583static int iw_setnone_getint(struct net_device *dev,
6584 struct iw_request_info *info,
6585 union iwreq_data *wrqu, char *extra)
6586{
Dustin Brown389e5072018-11-08 17:10:01 +05306587 int errno;
6588 struct osif_vdev_sync *vdev_sync;
6589
6590 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6591 if (errno)
6592 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006593
Dustin Brown389e5072018-11-08 17:10:01 +05306594 errno = __iw_setnone_getint(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006595
Dustin Brown389e5072018-11-08 17:10:01 +05306596 osif_vdev_sync_op_stop(vdev_sync);
6597
6598 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006599}
6600
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306601static int hdd_set_fwtest(int argc, int cmd, int value)
6602{
6603 struct set_fwtest_params *fw_test;
6604
6605 /* check for max number of arguments */
6606 if (argc > (WMA_MAX_NUM_ARGS) ||
6607 argc != HDD_FWTEST_PARAMS) {
6608 hdd_err("Too Many args %d", argc);
6609 return -EINVAL;
6610 }
6611 /*
6612 * check if number of arguments are 3 then, check
6613 * then set the default value for sounding interval.
6614 */
6615 if (HDD_FWTEST_PARAMS == argc) {
6616 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
6617 value = HDD_FWTEST_SU_DEFAULT_VALUE;
6618 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
6619 value = HDD_FWTEST_MU_DEFAULT_VALUE;
6620 }
6621 /* check sounding interval value should not exceed to max */
6622 if (value > HDD_FWTEST_MAX_VALUE) {
6623 hdd_err("Invalid arguments value should not exceed max: %d",
6624 value);
6625 return -EINVAL;
6626 }
6627 fw_test = qdf_mem_malloc(sizeof(*fw_test));
6628 if (NULL == fw_test) {
6629 hdd_err("qdf_mem_malloc failed for fw_test");
6630 return -ENOMEM;
6631 }
6632 fw_test->arg = cmd;
6633 fw_test->value = value;
6634 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
6635 qdf_mem_free(fw_test);
6636 hdd_err("Not able to post FW_TEST_CMD message to WMA");
6637 return -EINVAL;
6638 }
6639 return 0;
6640}
6641
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006642/**
6643 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
6644 * @dev: device upon which the ioctl was received
6645 * @info: ioctl request information
6646 * @wrqu: ioctl request data
6647 * @extra: ioctl extra data
6648 *
6649 * Return: 0 on success, non-zero on error
6650 */
6651static int __iw_set_three_ints_getnone(struct net_device *dev,
6652 struct iw_request_info *info,
6653 union iwreq_data *wrqu, char *extra)
6654{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006655 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006656 int *value = (int *)extra;
6657 int sub_cmd = value[0];
6658 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08006659 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006660 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08006661 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006662
Dustin Brownfdf17c12018-03-14 12:55:34 -07006663 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306664
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006665 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006666 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07006667 return -EPERM;
6668 }
6669
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006670 ret = wlan_hdd_validate_context(hdd_ctx);
6671 if (0 != ret)
6672 return ret;
6673
Jeff Johnson441e1f72017-02-07 08:50:49 -08006674 ret = hdd_check_private_wext_control(hdd_ctx, info);
6675 if (0 != ret)
6676 return ret;
6677
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006678 switch (sub_cmd) {
6679
6680 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07006681 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
6682 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006683 break;
6684 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05306685 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006686 break;
Himanshu Agarwalad4c0392018-05-08 16:53:36 +05306687
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006688 case WE_SET_DUAL_MAC_SCAN_CONFIG:
6689 hdd_debug("Ioctl to set dual mac scan config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08006690 status =
6691 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
6692 &dual_mac_feature);
6693 if (status != QDF_STATUS_SUCCESS)
6694 hdd_err("can't get dual mac feature val, use def");
6695 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006696 hdd_err("Dual mac feature is disabled from INI");
6697 return -EPERM;
6698 }
6699 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Dustin Brown05d81302018-09-11 16:49:22 -07006700 policy_mgr_set_dual_mac_scan_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08006701 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006702 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05306703 case WE_SET_FW_TEST:
6704 {
6705 ret = hdd_set_fwtest(value[1], value[2], value[3]);
6706 if (ret) {
6707 hdd_err("Not able to set fwtest %d", ret);
6708 return ret;
6709 }
6710 }
6711 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006712 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006713 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006714 break;
6715
6716 }
Dustin Browne74003f2018-03-14 12:51:58 -07006717 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006718 return ret;
6719}
6720
6721int iw_set_three_ints_getnone(struct net_device *dev,
6722 struct iw_request_info *info,
6723 union iwreq_data *wrqu, char *extra)
6724{
Dustin Brown389e5072018-11-08 17:10:01 +05306725 int errno;
6726 struct osif_vdev_sync *vdev_sync;
6727
6728 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
6729 if (errno)
6730 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006731
Dustin Brown389e5072018-11-08 17:10:01 +05306732 errno = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006733
Dustin Brown389e5072018-11-08 17:10:01 +05306734 osif_vdev_sync_op_stop(vdev_sync);
6735
6736 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006737}
6738
6739/**
6740 * hdd_connection_state_string() - Get connection state string
6741 * @connection_state: enum to be converted to a string
6742 *
6743 * Return: the string equivalent of @connection_state
6744 */
6745static const char *
6746hdd_connection_state_string(eConnectionState connection_state)
6747{
6748 switch (connection_state) {
6749 CASE_RETURN_STRING(eConnectionState_NotConnected);
6750 CASE_RETURN_STRING(eConnectionState_Connecting);
6751 CASE_RETURN_STRING(eConnectionState_Associated);
6752 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
6753 CASE_RETURN_STRING(eConnectionState_IbssConnected);
6754 CASE_RETURN_STRING(eConnectionState_Disconnecting);
6755 default:
6756 return "UNKNOWN";
6757 }
6758}
6759
Naveen Rawat910726a2017-03-06 11:42:51 -08006760#if defined(FEATURE_OEM_DATA_SUPPORT)
6761/**
6762 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
6763 * wifi_pos api to get oem data caps
6764 * @dev: net device upon which the request was received
6765 * @info: ioctl request information
6766 * @wrqu: ioctl request data
6767 * @extra: ioctl data payload
6768 *
6769 * Return: 0 for success, negative errno value on failure
6770 */
6771static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6772 struct iw_request_info *info,
6773 union iwreq_data *wrqu, char *extra)
6774{
6775 return iw_get_oem_data_cap(dev, info, wrqu, extra);
6776}
6777#elif defined(WIFI_POS_CONVERGED)
6778static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6779 struct iw_request_info *info,
6780 union iwreq_data *wrqu, char *extra)
6781{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006782 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006783 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08006784
Dustin Brown05d81302018-09-11 16:49:22 -07006785 return os_if_wifi_pos_populate_caps(hdd_ctx->psoc,
Naveen Rawat910726a2017-03-06 11:42:51 -08006786 (struct wifi_pos_driver_caps *)extra);
6787}
6788#else
6789static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
6790 struct iw_request_info *info,
6791 union iwreq_data *wrqu, char *extra)
6792{
6793 return -ENOTSUPP;
6794}
6795#endif
6796
Krunal Soni5e483782018-10-25 15:42:44 -07006797#ifdef WLAN_UNIT_TEST
6798static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6799 struct hdd_adapter *adapter,
6800 char *extra)
6801{
6802 QDF_STATUS status;
6803
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006804 status = sme_get_sta_cxn_info(hdd_ctx->mac_handle, adapter->vdev_id,
Krunal Soni5e483782018-10-25 15:42:44 -07006805 extra, WE_MAX_STR_LEN);
6806 if (status != QDF_STATUS_SUCCESS)
6807 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6808 "\nNo active connection");
6809
6810 return 0;
6811}
6812#else
6813static int hdd_get_sta_cxn_info(struct hdd_context *hdd_ctx,
6814 struct hdd_adapter *adapter,
6815 char *extra)
6816{
6817 qdf_scnprintf(extra, WE_MAX_STR_LEN,
6818 "\nNot supported");
6819 return -ENOTSUPP;
6820}
6821#endif
6822
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006823/**
6824 * iw_get_char_setnone() - Generic "get string" private ioctl handler
6825 * @dev: device upon which the ioctl was received
6826 * @info: ioctl request information
6827 * @wrqu: ioctl request data
6828 * @extra: ioctl extra data
6829 *
6830 * Return: 0 on success, non-zero on error
6831 */
6832static int __iw_get_char_setnone(struct net_device *dev,
6833 struct iw_request_info *info,
6834 union iwreq_data *wrqu, char *extra)
6835{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006836 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006837 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006838 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006839 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006840 int ret;
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05306841 QDF_STATUS status;
6842 uint8_t value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006843
Dustin Brownfdf17c12018-03-14 12:55:34 -07006844 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306845
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006846 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006847 ret = wlan_hdd_validate_context(hdd_ctx);
6848 if (0 != ret)
6849 return ret;
6850
Jeff Johnson441e1f72017-02-07 08:50:49 -08006851 ret = hdd_check_private_wext_control(hdd_ctx, info);
6852 if (0 != ret)
6853 return ret;
6854
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006855 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006856 switch (sub_cmd) {
6857 case WE_WLAN_VERSION:
6858 {
Ryan Hsuaadba072018-04-20 13:01:53 -07006859 wrqu->data.length = hdd_wlan_get_version(hdd_ctx,
6860 WE_MAX_STR_LEN, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006861 break;
6862 }
6863
6864 case WE_GET_STATS:
6865 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006866 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006867 extra, WE_MAX_STR_LEN);
6868 break;
6869 }
6870
Dustin Brownd9322482017-01-09 12:46:03 -08006871 case WE_GET_SUSPEND_RESUME_STATS:
6872 {
6873 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
6874 WE_MAX_STR_LEN);
6875 if (ret >= 0) {
6876 wrqu->data.length = ret;
6877 ret = 0;
6878 }
6879
6880 break;
6881 }
6882
Govind Singha471e5e2015-10-12 17:11:14 +05306883 case WE_LIST_FW_PROFILE:
6884 hdd_wlan_list_fw_profile(&(wrqu->data.length),
6885 extra, WE_MAX_STR_LEN);
6886 break;
6887
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006888 /* The case prints the current state of the HDD, SME, CSR, PE,
6889 * TL it can be extended for WDI Global State as well. And
6890 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
6891 * and P2P_GO have not been added as of now.
6892 */
6893 case WE_GET_STATES:
6894 {
6895 int buf = 0, len = 0;
6896 int adapter_num = 0;
6897 int count = 0, check = 1;
6898
Jeff Johnsond377dce2017-10-04 10:32:42 -07006899 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006900
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006901 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson3d278b02017-08-29 14:17:47 -07006902 struct hdd_adapter *useAdapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006903
6904 /* Print wlan0 or p2p0 states based on the adapter_num
6905 * by using the correct adapter
6906 */
6907 while (adapter_num < 2) {
6908 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006909 useAdapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006910 buf =
6911 scnprintf(extra + len,
6912 WE_MAX_STR_LEN - len,
6913 "\n\n wlan0 States:-");
6914 len += buf;
6915 } else if (P2P_ADAPTER == adapter_num) {
6916 buf =
6917 scnprintf(extra + len,
6918 WE_MAX_STR_LEN - len,
6919 "\n\n p2p0 States:-");
6920 len += buf;
6921
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006922 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006923 buf =
6924 scnprintf(extra + len,
6925 WE_MAX_STR_LEN -
6926 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006927 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006928 len += buf;
6929 break;
6930 }
6931
6932 /* Printing p2p0 states only in the
6933 * case when the device is configured
6934 * as a p2p_client
6935 */
6936 useAdapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07006937 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08006938 QDF_P2P_CLIENT_MODE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006939 if (!useAdapter) {
6940 buf =
6941 scnprintf(extra + len,
6942 WE_MAX_STR_LEN -
6943 len,
6944 "\n Device not configured as P2P_CLIENT.");
6945 len += buf;
6946 break;
6947 }
6948 }
6949
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006950 if (!mac_handle) {
Jeff Johnson2a8a64f2018-04-28 12:31:36 -07006951 buf = scnprintf(extra + len,
6952 WE_MAX_STR_LEN - len,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006953 "\n mac_handle is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006954 len += buf;
6955 break;
6956 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006957 sta_ctx =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006958 WLAN_HDD_GET_STATION_CTX_PTR(useAdapter);
6959
6960
6961 buf =
6962 scnprintf(extra + len, WE_MAX_STR_LEN - len,
6963 "\n HDD Conn State - %s "
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006964 "\n\n SME State:"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006965 "\n Neighbour Roam State - %s"
6966 "\n CSR State - %s"
6967 "\n CSR Substate - %s",
6968 hdd_connection_state_string
Jeff Johnsone7951512019-02-27 10:02:51 -08006969 (sta_ctx->conn_info.conn_state),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006970 mac_trace_get_neighbour_roam_state
6971 (sme_get_neighbor_roam_state
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006972 (mac_handle, useAdapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006973 mac_trace_getcsr_roam_state
6974 (sme_get_current_roam_state
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006975 (mac_handle, useAdapter->vdev_id)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006976 mac_trace_getcsr_roam_sub_state
6977 (sme_get_current_roam_sub_state
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08006978 (mac_handle, useAdapter->vdev_id))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006979 );
6980 len += buf;
6981 adapter_num++;
6982 }
6983
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006984 if (mac_handle) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006985 /* Printing Lim State starting with global lim states */
6986 buf =
6987 scnprintf(extra + len, WE_MAX_STR_LEN - len,
Srinivas Girigowdab9086af2017-10-14 14:41:13 -07006988 "\n\n LIM STATES:-"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006989 "\n Global Sme State - %s "
6990 "\n Global mlm State - %s " "\n",
6991 mac_trace_get_lim_sme_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006992 (sme_get_lim_sme_state(mac_handle)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006993 mac_trace_get_lim_mlm_state
Jeff Johnson71d465a2018-12-05 11:13:30 -08006994 (sme_get_lim_mlm_state(mac_handle))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006995 );
6996 len += buf;
6997
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006998 while (check < 3 && count < 255) {
Jeff Johnsoncec6e922018-06-12 16:17:27 -07006999 if (sme_is_lim_session_valid(mac_handle, count)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007000 buf =
7001 scnprintf(extra + len,
7002 WE_MAX_STR_LEN -
7003 len,
7004 "\n Lim Valid Session %d:-"
7005 "\n PE Sme State - %s "
7006 "\n PE Mlm State - %s "
7007 "\n", check,
7008 mac_trace_get_lim_sme_state
7009 (sme_get_lim_sme_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007010 (mac_handle, count)),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007011 mac_trace_get_lim_mlm_state
7012 (sme_get_lim_mlm_session_state
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007013 (mac_handle, count))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007014 );
7015
7016 len += buf;
7017 check++;
7018 }
7019 count++;
7020 }
7021 }
7022
7023 wrqu->data.length = strlen(extra) + 1;
7024 break;
7025 }
7026
7027 case WE_GET_CFG:
7028 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007029 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007030 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007031 extra,
7032 QCSAP_IOCTL_MAX_STR_LEN);
7033 wrqu->data.length = strlen(extra) + 1;
7034 break;
7035 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007036 case WE_GET_RSSI:
7037 {
7038 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007039
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007040 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007041 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
7042 wrqu->data.length = strlen(extra) + 1;
7043 break;
7044 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007045
7046 case WE_GET_WMM_STATUS:
7047 {
7048 snprintf(extra, WE_MAX_STR_LEN,
7049 "\nDir: 0=up, 1=down, 3=both\n"
7050 "|------------------------|\n"
7051 "|AC | ACM |Admitted| Dir |\n"
7052 "|------------------------|\n"
7053 "|VO | %d | %3s | %d |\n"
7054 "|VI | %d | %3s | %d |\n"
7055 "|BE | %d | %3s | %d |\n"
7056 "|BK | %d | %3s | %d |\n"
7057 "|------------------------|\n",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007058 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007059 ac_status[SME_AC_VO].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007060 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007061 ac_status[SME_AC_VO].
Jeff Johnsona5548972019-03-09 14:22:18 -08007062 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007063 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007064 ac_status[SME_AC_VO].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007065 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007066 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007067 ac_status[SME_AC_VI].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007068 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007069 ac_status[SME_AC_VI].
Jeff Johnsona5548972019-03-09 14:22:18 -08007070 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007071 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007072 ac_status[SME_AC_VI].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007073 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007074 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007075 ac_status[SME_AC_BE].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007076 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007077 ac_status[SME_AC_BE].
Jeff Johnsona5548972019-03-09 14:22:18 -08007078 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007079 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007080 ac_status[SME_AC_BE].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007081 ts_info.direction,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007082 adapter->hdd_wmm_status.
Jeff Johnson30ac84f2019-03-09 13:57:57 -08007083 ac_status[SME_AC_BK].is_access_required,
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007084 adapter->hdd_wmm_status.
Jeff Johnson12e12332019-03-08 23:29:23 -08007085 ac_status[SME_AC_BK].
Jeff Johnsona5548972019-03-09 14:22:18 -08007086 is_access_allowed ? "YES" : "NO",
Jeff Johnson02d14ce2017-10-31 09:08:30 -07007087 adapter->hdd_wmm_status.
Jeff Johnson64d94dd2019-03-09 14:31:14 -08007088 ac_status[SME_AC_BK].tspec.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007089 ts_info.direction);
7090
7091 wrqu->data.length = strlen(extra) + 1;
7092 break;
7093 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07007094
7095 case WE_GET_BA_AGEING_TIMEOUT:
7096 {
7097 uint8_t ac_cat = 4;
Srinivas Girigowda3105e4d2019-02-12 10:06:15 -08007098 uint32_t duration[WME_AC_MAX], i;
Krunal Soni6c3859f2018-06-01 19:57:40 -07007099 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
7100
7101 if (!soc) {
7102 hdd_err("Invalid SOC handle");
7103 break;
7104 }
7105
7106 for (i = 0; i < ac_cat; i++)
7107 cdp_get_ba_timeout(soc, i, &duration[i]);
7108
7109 snprintf(extra, WE_MAX_STR_LEN,
7110 "\n|------------------------------|\n"
7111 "|AC | BA aging timeout duration |\n"
7112 "|--------------------------------|\n"
7113 "|VO | %d |\n"
7114 "|VI | %d |\n"
7115 "|BE | %d |\n"
7116 "|BK | %d |\n"
7117 "|--------------------------------|\n",
7118 duration[3], duration[2], duration[1], duration[0]);
7119
7120 wrqu->data.length = strlen(extra) + 1;
7121 break;
7122 }
7123
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007124 case WE_GET_CHANNEL_LIST:
7125 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307126 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007127 uint8_t i, len;
7128 char *buf;
Wu Gaoaa155142019-01-14 15:09:26 +08007129 uint8_t ubuf[CFG_COUNTRY_CODE_LEN];
7130 uint8_t ubuf_len = CFG_COUNTRY_CODE_LEN;
Srinivas Girigowdac231df62017-03-24 18:27:57 -07007131 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007132
7133 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05307134 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007135 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307136 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007137 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007138 return -EINVAL;
7139 }
7140 buf = extra;
7141 /*
Wu Gao0821b0d2019-01-11 17:31:11 +08007142 * Maximum channels = CFG_VALID_CHANNEL_LIST_LEN.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007143 * Maximum buffer needed = 5 * number of channels.
7144 * Check ifsufficient buffer is available and then
7145 * proceed to fill the buffer.
7146 */
7147 if (WE_MAX_STR_LEN <
Wu Gao0821b0d2019-01-11 17:31:11 +08007148 (5 * CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007149 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007150 return -EINVAL;
7151 }
7152 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
7153 channel_list.num_channels);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007154 if (QDF_STATUS_SUCCESS == sme_get_country_code(mac_handle,
7155 ubuf,
7156 &ubuf_len)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007157 /* Printing Country code in getChannelList */
7158 for (i = 0; i < (ubuf_len - 1); i++)
7159 len += scnprintf(buf + len,
7160 WE_MAX_STR_LEN - len,
7161 "%c", ubuf[i]);
7162 }
7163 for (i = 0; i < channel_list.num_channels; i++) {
7164 len +=
7165 scnprintf(buf + len, WE_MAX_STR_LEN - len,
7166 " %u", channel_list.channels[i]);
7167 }
7168 wrqu->data.length = strlen(extra) + 1;
7169
7170 break;
7171 }
7172#ifdef FEATURE_WLAN_TDLS
7173 case WE_GET_TDLS_PEERS:
7174 {
7175 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007176 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007177 WE_MAX_STR_LEN) + 1;
7178 break;
7179 }
7180#endif
7181#ifdef WLAN_FEATURE_11W
7182 case WE_GET_11W_INFO:
7183 {
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007184 struct csr_roam_profile *roam_profile =
7185 hdd_roam_profile(adapter);
7186
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007187 hdd_debug("WE_GET_11W_ENABLED = %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007188 roam_profile->MFPEnabled);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007189
7190 snprintf(extra, WE_MAX_STR_LEN,
7191 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
7192 "\n Number of Unprotected Disassocs %d"
7193 "\n Number of Unprotected Deauths %d",
Jeff Johnsonf908cd02018-03-16 11:49:50 -07007194 roam_profile->BSSIDs.bssid->bytes[0],
7195 roam_profile->BSSIDs.bssid->bytes[1],
7196 roam_profile->BSSIDs.bssid->bytes[2],
7197 roam_profile->BSSIDs.bssid->bytes[3],
7198 roam_profile->BSSIDs.bssid->bytes[4],
7199 roam_profile->BSSIDs.bssid->bytes[5],
7200 roam_profile->MFPEnabled,
Jeff Johnsondc179f42017-10-21 11:27:26 -07007201 adapter->hdd_stats.hdd_pmf_stats.
7202 num_unprot_disassoc_rx,
7203 adapter->hdd_stats.hdd_pmf_stats.
7204 num_unprot_deauth_rx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007205
7206 wrqu->data.length = strlen(extra) + 1;
7207 break;
7208 }
7209#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007210 case WE_GET_IBSS_STA_INFO:
7211 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07007212 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007213 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007214 int idx = 0;
7215 int length = 0, buf = 0;
7216
Naveen Rawatc45d1622016-07-05 12:20:09 -07007217 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07007218 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnson0a082d92019-03-04 12:25:49 -08007219 sta_ctx->conn_info.sta_id[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007220 buf = snprintf
7221 ((extra + length),
7222 WE_MAX_STR_LEN - length,
7223 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnson0a082d92019-03-04 12:25:49 -08007224 sta_ctx->conn_info.sta_id[idx],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007225 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007226 peer_macaddr[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007227 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007228 peer_macaddr[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007229 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007230 peer_macaddr[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007231 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007232 peer_macaddr[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007233 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007234 peer_macaddr[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07007235 sta_ctx->conn_info.
Jeff Johnson5ec1abf2019-02-27 14:48:24 -08007236 peer_macaddr[idx].bytes[5]
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007237 );
7238 length += buf;
7239 }
7240 }
7241 wrqu->data.length = strlen(extra) + 1;
7242 break;
7243 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007244 case WE_GET_PHYMODE:
7245 {
7246 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007247 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007248 eCsrPhyMode phymode;
Jeff Johnsondbae0172019-03-09 17:01:56 -08007249 enum band_info current_band;
Jeff Johnson46b4f0e2019-03-08 10:48:35 -08007250 struct sme_config_params *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007251
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007252 sme_config = qdf_mem_malloc(sizeof(*sme_config));
7253 if (!sme_config) {
7254 hdd_err("Out of memory");
7255 ret = -ENOMEM;
7256 break;
7257 }
7258
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007259 sme_get_config_param(mac_handle, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007260 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007261 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007262 ch_bond24 = true;
7263
7264 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007265 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007266 ch_bond5g = true;
7267
Dustin Browne9c6b3a2017-01-23 17:17:32 -08007268 qdf_mem_free(sme_config);
7269
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007270 phymode = sme_get_phy_mode(mac_handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307271 if ((QDF_STATUS_SUCCESS !=
Harprit Chhabada5dff30e2019-03-12 17:56:45 -07007272 ucfg_reg_get_band(hddctx->pdev, &current_band))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007273 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007274 return -EIO;
7275 }
7276
7277 switch (phymode) {
7278 case eCSR_DOT11_MODE_AUTO:
7279 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
7280 break;
7281 case eCSR_DOT11_MODE_11n:
7282 case eCSR_DOT11_MODE_11n_ONLY:
Jeff Johnsondbae0172019-03-09 17:01:56 -08007283 if (current_band == BAND_2G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007284 if (ch_bond24)
7285 snprintf(extra, WE_MAX_STR_LEN,
7286 "11NGHT40");
7287 else
7288 snprintf(extra, WE_MAX_STR_LEN,
7289 "11NGHT20");
Jeff Johnsondbae0172019-03-09 17:01:56 -08007290 } else if (current_band == BAND_5G) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007291 if (ch_bond5g)
7292 snprintf(extra, WE_MAX_STR_LEN,
7293 "11NAHT40");
7294 else
7295 snprintf(extra, WE_MAX_STR_LEN,
7296 "11NAHT20");
7297 } else {
7298 snprintf(extra, WE_MAX_STR_LEN, "11N");
7299 }
7300 break;
7301 case eCSR_DOT11_MODE_abg:
7302 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
7303 break;
7304 case eCSR_DOT11_MODE_11a:
7305 snprintf(extra, WE_MAX_STR_LEN, "11A");
7306 break;
7307 case eCSR_DOT11_MODE_11b:
7308 case eCSR_DOT11_MODE_11b_ONLY:
7309 snprintf(extra, WE_MAX_STR_LEN, "11B");
7310 break;
7311 case eCSR_DOT11_MODE_11g:
7312 case eCSR_DOT11_MODE_11g_ONLY:
7313 snprintf(extra, WE_MAX_STR_LEN, "11G");
7314 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007315 case eCSR_DOT11_MODE_11ac:
7316 case eCSR_DOT11_MODE_11ac_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307317 status =
7318 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7319 &value);
7320 if (!QDF_IS_STATUS_SUCCESS(status))
7321 hdd_err("Failed to set channel_width");
7322 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007323 snprintf(extra, WE_MAX_STR_LEN,
7324 "11ACVHT20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307325 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007326 snprintf(extra, WE_MAX_STR_LEN,
7327 "11ACVHT40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307328 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007329 snprintf(extra, WE_MAX_STR_LEN,
7330 "11ACVHT80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307331 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007332 snprintf(extra, WE_MAX_STR_LEN,
7333 "11ACVHT160");
7334 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007335 case eCSR_DOT11_MODE_11ax:
7336 case eCSR_DOT11_MODE_11ax_ONLY:
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307337 status =
7338 ucfg_mlme_get_vht_channel_width(hddctx->psoc,
7339 &value);
7340 if (!QDF_IS_STATUS_SUCCESS(status))
7341 hdd_err("Failed to set channel_width");
7342
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007343 /* currently using vhtChannelWidth */
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307344 if (value == eHT_CHANNEL_WIDTH_20MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007345 snprintf(extra, WE_MAX_STR_LEN,
7346 "11AX_HE_20");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307347 else if (value == eHT_CHANNEL_WIDTH_40MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007348 snprintf(extra, WE_MAX_STR_LEN,
7349 "11AX_HE_40");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307350 else if (value == eHT_CHANNEL_WIDTH_80MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007351 snprintf(extra, WE_MAX_STR_LEN,
7352 "11AX_HE_80");
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05307353 else if (value == eHT_CHANNEL_WIDTH_160MHZ)
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08007354 snprintf(extra, WE_MAX_STR_LEN,
7355 "11AX_HE_160");
7356 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007357 }
7358
7359 wrqu->data.length = strlen(extra) + 1;
7360 break;
7361 }
7362
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007363 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08007364 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007365 case WE_GET_SNR:
7366 {
7367 int8_t s7snr = 0;
7368 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007369 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07007370 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007371
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007372 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007373 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307374 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007375 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05307376
Jeff Johnsond377dce2017-10-04 10:32:42 -07007377 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007378 if (0 == hdd_ctx->config->fEnableSNRMonitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007379 eConnectionState_Associated !=
Jeff Johnsone7951512019-02-27 10:02:51 -08007380 sta_ctx->conn_info.conn_state) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007381 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -07007382 hdd_ctx->config->fEnableSNRMonitoring,
Jeff Johnsone7951512019-02-27 10:02:51 -08007383 sta_ctx->conn_info.conn_state);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007384 return -ENONET;
7385 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007386 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007387 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
7388 wrqu->data.length = strlen(extra) + 1;
7389 break;
7390 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007391
Krunal Soni5e483782018-10-25 15:42:44 -07007392 case WE_GET_STA_CXN_INFO:
7393 ret = hdd_get_sta_cxn_info(hdd_ctx, adapter, extra);
7394 wrqu->data.length = strlen(extra) + 1;
7395 break;
7396
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007397 default:
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007398 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007399 break;
7400 }
Dustin Brownd9322482017-01-09 12:46:03 -08007401
Dustin Browne74003f2018-03-14 12:51:58 -07007402 hdd_exit();
Dustin Brownd9322482017-01-09 12:46:03 -08007403 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007404}
7405
7406static int iw_get_char_setnone(struct net_device *dev,
7407 struct iw_request_info *info,
7408 union iwreq_data *wrqu, char *extra)
7409{
Dustin Brown389e5072018-11-08 17:10:01 +05307410 int errno;
7411 struct osif_vdev_sync *vdev_sync;
7412
7413 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7414 if (errno)
7415 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007416
Dustin Brown389e5072018-11-08 17:10:01 +05307417 errno = __iw_get_char_setnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007418
Dustin Brown389e5072018-11-08 17:10:01 +05307419 osif_vdev_sync_op_stop(vdev_sync);
7420
7421 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007422}
7423
7424/**
7425 * iw_setnone_getnone() - Generic "action" private ioctl handler
7426 * @dev: device upon which the ioctl was received
7427 * @info: ioctl request information
7428 * @wrqu: ioctl request data
7429 * @extra: ioctl extra data
7430 *
7431 * Return: 0 on success, non-zero on error
7432 */
7433static int __iw_setnone_getnone(struct net_device *dev,
7434 struct iw_request_info *info,
7435 union iwreq_data *wrqu, char *extra)
7436{
Jeff Johnson3d278b02017-08-29 14:17:47 -07007437 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007438 struct hdd_context *hdd_ctx;
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007439 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007440 int ret;
7441 int sub_cmd;
7442
Dustin Brownfdf17c12018-03-14 12:55:34 -07007443 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307444
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007445 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007446 ret = wlan_hdd_validate_context(hdd_ctx);
7447 if (0 != ret)
7448 return ret;
7449
Jeff Johnson441e1f72017-02-07 08:50:49 -08007450 ret = hdd_check_private_wext_control(hdd_ctx, info);
7451 if (0 != ret)
7452 return ret;
7453
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007454#ifdef CONFIG_COMPAT
7455 /* this ioctl is a special case where a sub-ioctl is used and both
7456 * the number of get and set args is 0. in this specific case the
7457 * logic in iwpriv places the sub_cmd in the data.flags portion of
7458 * the iwreq. unfortunately the location of this field will be
7459 * different between 32-bit and 64-bit userspace, and the standard
7460 * compat support in the kernel does not handle this case. so we
7461 * need to explicitly handle it here.
7462 */
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -07007463 if (in_compat_syscall()) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007464 struct compat_iw_point *compat_iw_point =
7465 (struct compat_iw_point *)&wrqu->data;
7466 sub_cmd = compat_iw_point->flags;
7467 } else {
7468 sub_cmd = wrqu->data.flags;
7469 }
7470#else
7471 sub_cmd = wrqu->data.flags;
7472#endif
7473
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007474 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007475 switch (sub_cmd) {
Govind Singha471e5e2015-10-12 17:11:14 +05307476 case WE_GET_FW_PROFILE_DATA:
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007477 ret = wma_cli_set_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05307478 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
7479 0, DBG_CMD);
7480 break;
7481
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007482 case WE_IBSS_GET_PEER_INFO_ALL:
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007483 hdd_wlan_get_ibss_peer_info_all(adapter);
7484 break;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007485
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007486 case WE_SET_REASSOC_TRIGGER:
7487 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07007488 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307489 tSirMacAddr bssid;
Jeff Johnson29c78672019-02-26 21:05:53 -08007490 uint32_t roam_id = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307491 uint8_t operating_ch =
Jeff Johnson8626e932019-02-27 18:35:22 -08007492 adapter->session.station.conn_info.channel;
Jeff Johnson9ff16952019-02-26 20:58:44 -08007493 tCsrRoamModifyProfileFields mod_fields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007494
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007495 sme_get_modify_profile_fields(mac_handle, adapter->vdev_id,
Jeff Johnson9ff16952019-02-26 20:58:44 -08007496 &mod_fields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307497 if (roaming_offload_enabled(hdd_ctx)) {
7498 qdf_mem_copy(bssid,
Jeff Johnsone04b6992019-02-27 14:06:55 -08007499 &adapter->session.station.conn_info.bssid,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307500 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08007501 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307502 bssid, operating_ch);
7503 } else {
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007504 sme_roam_reassoc(mac_handle, adapter->vdev_id,
Jeff Johnson29c78672019-02-26 21:05:53 -08007505 NULL, mod_fields, &roam_id, 1);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05307506 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007507 return 0;
7508 }
7509
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007510 case WE_STOP_OBSS_SCAN:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007511 /*
7512 * 1.OBSS Scan is mandatory while operating in 2.4GHz
7513 * 2.OBSS scan is stopped by Firmware during the disassociation
7514 * 3.OBSS stop comamnd is added for debugging purpose
7515 */
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007516 if (!mac_handle) {
7517 hdd_err("mac_handle context is NULL");
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08007518 return -EINVAL;
7519 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007520 sme_ht40_stop_obss_scan(mac_handle, adapter->vdev_id);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007521 break;
7522
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007523 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007524 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007525 break;
7526 }
Dustin Browne74003f2018-03-14 12:51:58 -07007527 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007528 return ret;
7529}
7530
7531static int iw_setnone_getnone(struct net_device *dev,
7532 struct iw_request_info *info,
7533 union iwreq_data *wrqu, char *extra)
7534{
Dustin Brown389e5072018-11-08 17:10:01 +05307535 int errno;
7536 struct osif_vdev_sync *vdev_sync;
7537
7538 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
7539 if (errno)
7540 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007541
Dustin Brown389e5072018-11-08 17:10:01 +05307542 errno = __iw_setnone_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007543
Dustin Brown389e5072018-11-08 17:10:01 +05307544 osif_vdev_sync_op_stop(vdev_sync);
7545
7546 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007547}
7548
Krunal Sonia6e505b2017-01-12 12:25:18 -08007549#ifdef MPC_UT_FRAMEWORK
Liangwei Dong509c3472018-05-30 07:05:59 -04007550static void
7551hdd_policy_mgr_set_hw_mode_ut(struct hdd_context *hdd_ctx,
7552 struct hdd_adapter *adapter, int cmd)
7553{
7554 enum hw_mode_ss_config mac0_ss;
7555 enum hw_mode_bandwidth mac0_bw;
7556 enum hw_mode_ss_config mac1_ss;
7557 enum hw_mode_bandwidth mac1_bw;
7558 enum hw_mode_mac_band_cap mac0_band_cap;
7559 enum hw_mode_dbs_capab dbs;
7560
7561 switch (cmd) {
7562 case 0:
7563 hdd_debug("set hw mode for single mac");
7564 mac0_ss = HW_MODE_SS_2x2;
7565 mac0_bw = HW_MODE_80_MHZ;
7566 mac1_ss = HW_MODE_SS_0x0;
7567 mac1_bw = HW_MODE_BW_NONE;
7568 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7569 dbs = HW_MODE_DBS_NONE;
7570 break;
7571 case 1:
7572 hdd_debug("set hw mode for dual mac");
7573 mac0_ss = HW_MODE_SS_1x1;
7574 mac0_bw = HW_MODE_80_MHZ;
7575 mac1_ss = HW_MODE_SS_1x1;
7576 mac1_bw = HW_MODE_40_MHZ;
7577 mac0_band_cap = HW_MODE_MAC_BAND_NONE;
7578 dbs = HW_MODE_DBS;
7579 break;
7580 case 2:
7581 hdd_debug("set hw mode for 2x2 5g + 1x1 2g");
7582 mac0_ss = HW_MODE_SS_2x2;
7583 mac0_bw = HW_MODE_80_MHZ;
7584 mac1_ss = HW_MODE_SS_1x1;
7585 mac1_bw = HW_MODE_40_MHZ;
7586 mac0_band_cap = HW_MODE_MAC_BAND_5G;
7587 dbs = HW_MODE_DBS;
7588 break;
7589 case 3:
7590 hdd_debug("set hw mode for 2x2 2g + 1x1 5g");
7591 mac0_ss = HW_MODE_SS_2x2;
7592 mac0_bw = HW_MODE_40_MHZ;
7593 mac1_ss = HW_MODE_SS_1x1;
7594 mac1_bw = HW_MODE_40_MHZ;
7595 mac0_band_cap = HW_MODE_MAC_BAND_2G;
7596 dbs = HW_MODE_DBS;
7597 break;
7598 default:
7599 hdd_err("unknown cmd %d", cmd);
7600 return;
7601 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007602 policy_mgr_pdev_set_hw_mode(hdd_ctx->psoc, adapter->vdev_id,
Liangwei Dong509c3472018-05-30 07:05:59 -04007603 mac0_ss, mac0_bw, mac1_ss, mac1_bw,
7604 mac0_band_cap, dbs, HW_MODE_AGILE_DFS_NONE,
7605 HW_MODE_SBS_NONE,
7606 POLICY_MGR_UPDATE_REASON_UT, PM_NOP);
7607}
7608
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007609static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007610 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007611{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08007612 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08007613 case WE_POLICY_MANAGER_CLIST_CMD:
7614 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007615 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307616 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307617 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7618 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7619 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7620 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307621 return 0;
7622 }
Dustin Brown05d81302018-09-11 16:49:22 -07007623 policy_mgr_incr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007624 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7625 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007626 }
7627 break;
7628
7629 case WE_POLICY_MANAGER_DLIST_CMD:
7630 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007631 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307632 if ((apps_args[0] < 0) || (apps_args[1] < 0)) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307633 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307634 return 0;
7635 }
Dustin Brown05d81302018-09-11 16:49:22 -07007636 policy_mgr_decr_connection_count_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007637 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007638 }
7639 break;
7640
7641 case WE_POLICY_MANAGER_ULIST_CMD:
7642 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007643 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307644 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307645 (apps_args[2] < 0) || (apps_args[3] < 0) ||
7646 (apps_args[4] < 0) || (apps_args[5] < 0) ||
7647 (apps_args[6] < 0) || (apps_args[7] < 0)) {
7648 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307649 return 0;
7650 }
Dustin Brown05d81302018-09-11 16:49:22 -07007651 policy_mgr_update_connection_info_utfw(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007652 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
7653 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007654 }
7655 break;
7656
7657 case WE_POLICY_MANAGER_DBS_CMD:
7658 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007659 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007660 if (apps_args[0] == 0)
7661 wma_set_dbs_capability_ut(0);
7662 else
7663 wma_set_dbs_capability_ut(1);
7664
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007665 if (apps_args[1] >= PM_THROUGHPUT &&
7666 apps_args[1] <= PM_LATENCY) {
Liangwei Dong509c3472018-05-30 07:05:59 -04007667 hdd_debug("setting system pref to [%d]\n",
7668 apps_args[1]);
Krunal Sonie71838d2018-09-27 10:45:05 -07007669 ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc,
7670 apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007671 }
7672 }
7673 break;
7674
7675 case WE_POLICY_MANAGER_PCL_CMD:
7676 {
7677 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
7678 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
7679 uint32_t pcl_len = 0, i = 0;
7680
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007681 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007682
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307683 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307684 hdd_err("Invalid input param received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307685 return 0;
7686 }
Dustin Brown05d81302018-09-11 16:49:22 -07007687 policy_mgr_get_pcl(hdd_ctx->psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08007688 pcl, &pcl_len,
7689 weight_list, QDF_ARRAY_SIZE(weight_list));
Liangwei Dong509c3472018-05-30 07:05:59 -04007690 hdd_debug("PCL list for role[%d] is {", apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007691 for (i = 0 ; i < pcl_len; i++)
Liangwei Dong509c3472018-05-30 07:05:59 -04007692 hdd_debug(" %d, ", pcl[i]);
7693 hdd_debug("}--------->\n");
Krunal Sonia6e505b2017-01-12 12:25:18 -08007694 }
7695 break;
7696
7697 case WE_POLICY_SET_HW_MODE_CMD:
7698 {
Liangwei Dong509c3472018-05-30 07:05:59 -04007699 hdd_debug("pm_set_hw_mode cmd %d", apps_args[0]);
7700 hdd_policy_mgr_set_hw_mode_ut(hdd_ctx, adapter, apps_args[0]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007701 }
7702 break;
7703
7704 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
7705 {
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07007706 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307707 if (apps_args[0] < 0) {
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307708 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307709 return 0;
7710 }
Tushnim Bhattacharyyadfbce702018-03-27 12:46:48 -07007711 policy_mgr_current_connections_update(
Dustin Brown05d81302018-09-11 16:49:22 -07007712 hdd_ctx->psoc,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007713 adapter->vdev_id, apps_args[0],
Tushnim Bhattacharyya3b99f4b2018-03-26 14:19:24 -07007714 POLICY_MGR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007715 }
7716 break;
7717
7718 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
7719 {
7720 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007721
Dustin Brown5e89ef82018-03-14 11:50:23 -07007722 hdd_debug("<iwpriv wlan0 pm_query_allow> is called");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307723 if ((apps_args[0] < 0) || (apps_args[1] < 0) ||
Pragaspathi Thilagarajc81ad0e2018-05-22 14:02:41 +05307724 (apps_args[2] < 0)) {
7725 hdd_err("Invalid input params received for the IOCTL");
Pragaspathi Thilagaraj1e5420a2018-04-24 14:32:56 +05307726 return 0;
7727 }
Dustin Brown05d81302018-09-11 16:49:22 -07007728 allow = policy_mgr_allow_concurrency(hdd_ctx->psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08007729 apps_args[0], apps_args[1], apps_args[2]);
Liangwei Dong509c3472018-05-30 07:05:59 -04007730 hdd_debug("allow %d {0 = don't allow, 1 = allow}", allow);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007731 }
7732 break;
7733
7734 case WE_POLICY_MANAGER_SCENARIO_CMD:
7735 {
7736 clean_report(hdd_ctx);
7737 if (apps_args[0] == 1) {
7738 wlan_hdd_one_connection_scenario(hdd_ctx);
7739 } else if (apps_args[0] == 2) {
7740 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007741 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007742 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007743 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007744 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007745 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007746 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007747 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007748 } else if (apps_args[0] == 3) {
7749 /* MCC on same band with 2x2 same mac*/
7750 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007751 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007752 /* MCC on diff band with 2x2 same mac*/
7753 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007754 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007755 /* MCC on diff band with 1x1 diff mac */
7756 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007757 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007758 /* MCC on diff band with 1x1 same mac */
7759 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007760 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007761 /* SCC on same band with 2x2 same mac */
7762 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007763 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007764 /* SCC on same band with 1x1 same mac */
7765 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007766 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007767 /* MCC on same band with 2x2 same mac */
7768 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007769 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007770 /* MCC on same band with 1x1 same mac */
7771 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007772 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007773 }
7774 print_report(hdd_ctx);
7775 }
7776 break;
7777 }
7778 return 0;
7779}
7780#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007781static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07007782 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08007783{
7784 return 0;
7785}
7786#endif
7787
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007788/**
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007789 * hdd_ch_avoid_unit_cmd - unit test ch avoidance
7790 * @hdd_ctx: hdd_context
7791 * @num_args: input args number
7792 * @apps_args: args data ptr
7793 *
7794 * This is to inject a ch avoid event to do unit test SAP chan avoidance.
7795 *
7796 * Return: void
7797 */
7798#if WLAN_DEBUG
7799static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7800 int num_args, int *apps_args)
7801{
7802 struct ch_avoid_ind_type ch_avoid;
7803 int cnt = 0, i;
7804
7805 if (num_args < 2 || num_args > CH_AVOID_MAX_RANGE * 2 ||
7806 num_args % 2 != 0)
7807 return;
7808 hdd_info("simulate ch avoid num_args %d", num_args);
7809 for (i = 0; i < num_args && i < CH_AVOID_MAX_RANGE * 2; i++) {
7810 ch_avoid.avoid_freq_range[cnt].start_freq =
7811 apps_args[i];
7812 ch_avoid.avoid_freq_range[cnt].end_freq =
7813 apps_args[++i];
7814
7815 hdd_info("simulate ch avoid [%d %d]",
7816 ch_avoid.avoid_freq_range[cnt].start_freq,
7817 ch_avoid.avoid_freq_range[cnt].end_freq);
7818 cnt++;
7819 }
7820 ch_avoid.ch_avoid_range_cnt = cnt;
Dustin Brown05d81302018-09-11 16:49:22 -07007821 ucfg_reg_unit_simulate_ch_avoid(hdd_ctx->psoc, &ch_avoid);
Liangwei Dong2a7f2912018-02-07 17:08:17 +08007822}
7823#else
7824static void hdd_ch_avoid_unit_cmd(struct hdd_context *hdd_ctx,
7825 int num_args, int *apps_args)
7826{
7827}
7828#endif
7829/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007830 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
7831 * @dev: device upon which the ioctl was received
7832 * @info: ioctl request information
7833 * @wrqu: ioctl request data
7834 * @extra: ioctl extra data
7835 *
7836 * This is an SSR-protected generic handler for private ioctls which
7837 * take multiple arguments. Note that this implementation is also
7838 * somewhat unique in that it is shared by both STA-mode and SAP-mode
7839 * interfaces.
7840 *
7841 * Return: 0 on success, non-zero on error
7842 */
7843static int __iw_set_var_ints_getnone(struct net_device *dev,
7844 struct iw_request_info *info,
7845 union iwreq_data *wrqu, char *extra)
7846{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007847 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007848 mac_handle_t mac_handle;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07007849 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007850 int sub_cmd;
7851 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007852 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007853 int ret, num_args;
chenguoaa7c90c2018-05-24 17:08:47 +08007854 void *soc = NULL;
7855 struct cdp_pdev *pdev = NULL;
7856 struct cdp_vdev *vdev = NULL;
7857 struct cdp_txrx_stats_req req = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007858
Dustin Brownfdf17c12018-03-14 12:55:34 -07007859 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307860
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007861 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007862 ret = wlan_hdd_validate_context(hdd_ctx);
7863 if (0 != ret)
7864 return ret;
7865
Jeff Johnson441e1f72017-02-07 08:50:49 -08007866 ret = hdd_check_private_wext_control(hdd_ctx, info);
7867 if (0 != ret)
7868 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007869
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007870 mac_handle = hdd_ctx->mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007871 sub_cmd = wrqu->data.flags;
7872 num_args = wrqu->data.length;
7873
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007874 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007875
7876 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007877 case WE_IBSS_GET_PEER_INFO:
7878 {
7879 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007880 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08007881 }
7882 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007883
7884 case WE_P2P_NOA_CMD:
7885 {
Jeff Johnson156cd082019-03-10 21:49:54 -07007886 struct p2p_app_set_ps p2p_noa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007887
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007888 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08007889 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
Dustin Brown458027c2018-10-19 12:26:27 -07007890 qdf_opmode_str(adapter->device_mode),
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007891 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08007892 return -EINVAL;
7893 }
7894
Jeff Johnson156cd082019-03-10 21:49:54 -07007895 p2p_noa.opp_ps = apps_args[0];
7896 p2p_noa.ctWindow = apps_args[1];
7897 p2p_noa.duration = apps_args[2];
7898 p2p_noa.interval = apps_args[3];
7899 p2p_noa.count = apps_args[4];
7900 p2p_noa.single_noa_duration = apps_args[5];
7901 p2p_noa.psSelection = apps_args[6];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007902
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007903 hdd_debug("P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d interval %d count %d single noa duration %d PsSelection %x",
Jeff Johnson99bac312016-06-28 10:38:18 -07007904 apps_args[0], apps_args[1], apps_args[2],
7905 apps_args[3], apps_args[4],
7906 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007907
Jeff Johnson156cd082019-03-10 21:49:54 -07007908 hdd_set_p2p_ps(dev, &p2p_noa);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007909
7910 }
7911 break;
7912
7913 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
7914 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007915 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07007916 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307917 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007918 }
7919 break;
7920
7921 case WE_MTRACE_DUMP_CMD:
7922 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007923 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07007924 apps_args[0], apps_args[1],
7925 apps_args[2], apps_args[3]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007926 qdf_trace_dump_all((void *)mac_handle, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007927 apps_args[1], apps_args[2],
7928 apps_args[3]);
7929
7930 }
7931 break;
7932
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007933 case WE_POLICY_MANAGER_CINFO_CMD:
7934 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007935 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007936 uint32_t i = 0, len = 0;
7937
Krunal Sonia6e505b2017-01-12 12:25:18 -08007938 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007939 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08007940 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007941 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07007942 pr_info("|table_index[%d]\t\t\n", i);
7943 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
7944 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
7945 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
7946 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
7947 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
7948 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
7949 pr_info("+--------------------------+\n");
7950 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007951 }
7952 }
7953 break;
7954
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007955 case WE_UNIT_TEST_CMD:
7956 {
Krunal Soniaadaa272017-10-04 16:42:55 -07007957 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007958
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007959 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
7960 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007961 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007962 return -EINVAL;
7963 }
Sourav Mohapatraea7210b2018-11-16 16:58:52 +05307964 if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05307965 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07007966 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007967 return -EINVAL;
7968 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08007969 status = sme_send_unit_test_cmd(adapter->vdev_id,
Krunal Soniaadaa272017-10-04 16:42:55 -07007970 apps_args[0],
7971 apps_args[1],
7972 &apps_args[2]);
7973 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07007974 hdd_err("sme_send_unit_test_cmd returned %d", status);
7975 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007976 }
7977 }
7978 break;
7979#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
7980 case WE_LED_FLASHING_PARAM:
7981 {
7982 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007983
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007984 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007985 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007986 return -EINVAL;
7987 }
7988 for (i = 0; i < num_args; i++) {
7989 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007990 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007991 return -EINVAL;
7992 }
7993 }
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007994 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007995 0, apps_args[0], apps_args[1]);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07007996 sme_set_led_flashing(mac_handle,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007997 1, apps_args[2], apps_args[3]);
7998 }
7999 break;
8000#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05308001 case WE_SET_PKTLOG:
8002 {
8003 int ret;
8004
8005 if (num_args < 1 || num_args > 2) {
8006 hdd_err("pktlog: either 1 or 2 parameters are required");
8007 return -EINVAL;
8008 }
8009
8010 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
8011 apps_args[1]);
8012 if (ret)
8013 return ret;
8014 break;
8015 }
Manjeet Singhf82ed072016-07-08 11:40:00 +05308016 case WE_MAC_PWR_DEBUG_CMD:
8017 {
8018 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Manjeet Singhf82ed072016-07-08 11:40:00 +05308019 int i, j;
8020
8021 if (num_args < 3) {
8022 hdd_err("number of arguments can't be null %d",
8023 num_args);
8024 return -EINVAL;
8025 }
8026 if (num_args - 3 != apps_args[2]) {
8027 hdd_err("arg list of size %d doesn't match num_args %d",
8028 num_args-3, apps_args[2]);
8029 return -EINVAL;
8030 }
8031 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
8032 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
8033 hdd_err("Invalid MODULE ID %d", apps_args[1]);
8034 return -EINVAL;
8035 }
8036 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
8037 hdd_err("Too Many args %d", apps_args[2]);
8038 return -EINVAL;
8039 }
8040 mac_pwr_dbg_args.pdev_id = apps_args[0];
8041 mac_pwr_dbg_args.module_id = apps_args[1];
8042 mac_pwr_dbg_args.num_args = apps_args[2];
8043
8044 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
8045 mac_pwr_dbg_args.args[i] = apps_args[j];
8046
8047 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008048 sme_process_mac_pwr_dbg_cmd(mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008049 adapter->vdev_id,
Manjeet Singhf82ed072016-07-08 11:40:00 +05308050 &mac_pwr_dbg_args)) {
8051 return -EINVAL;
8052 }
8053 }
8054 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08008055 case WE_POLICY_MANAGER_CLIST_CMD:
8056 case WE_POLICY_MANAGER_DLIST_CMD:
8057 case WE_POLICY_MANAGER_ULIST_CMD:
8058 case WE_POLICY_MANAGER_DBS_CMD:
8059 case WE_POLICY_MANAGER_PCL_CMD:
8060 case WE_POLICY_SET_HW_MODE_CMD:
8061 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
8062 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
8063 case WE_POLICY_MANAGER_SCENARIO_CMD:
8064 {
Krunal Soni3de68532018-09-05 12:16:58 -07008065 if (!hdd_ctx->config->is_unit_test_framework_enabled) {
8066 hdd_warn_rl("UT framework is disabled");
8067 return -EINVAL;
8068 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008069 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Soni3de68532018-09-05 12:16:58 -07008070 sub_cmd, apps_args);
Krunal Sonia6e505b2017-01-12 12:25:18 -08008071 }
8072 break;
Liangwei Dong2a7f2912018-02-07 17:08:17 +08008073 case WE_SET_CHAN_AVOID:
8074 {
8075 hdd_ch_avoid_unit_cmd(hdd_ctx, num_args, apps_args);
8076 }
8077 break;
chenguoaa7c90c2018-05-24 17:08:47 +08008078 case WE_SET_TXRX_STATS:
8079 {
8080 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008081 adapter->vdev_id);
chenguoaa7c90c2018-05-24 17:08:47 +08008082
8083 if (ret != 0) {
8084 hdd_err("Invalid handles");
8085 break;
8086 }
8087
8088 req.stats = apps_args[0];
8089 /* default value of secondary parameter is 0(mac_id) */
8090 req.mac_id = apps_args[1];
8091
8092 hdd_debug("WE_SET_TXRX_STATS stats cmd: %d mac_id: %d",
8093 req.stats, req.mac_id);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008094 if (apps_args[0] == CDP_TXRX_STATS_28) {
Jeff Johnson457c2422019-02-27 13:56:04 -08008095 if (sta_ctx->conn_info.is_authenticated) {
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008096 hdd_debug("ap mac addr: %pM",
Jeff Johnsone04b6992019-02-27 14:06:55 -08008097 (void *)&sta_ctx->conn_info.bssid);
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008098 req.peer_addr =
Jeff Johnsone04b6992019-02-27 14:06:55 -08008099 (char *)&sta_ctx->conn_info.bssid;
Venkata Sharath Chandra Manchala43cb55c2018-03-14 00:04:22 -07008100 }
8101 }
chenguoaa7c90c2018-05-24 17:08:47 +08008102 ret = cdp_txrx_stats_request(soc, vdev, &req);
8103 break;
8104 }
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308105#ifdef WLAN_FEATURE_MOTION_DETECTION
8106 case WE_MOTION_DET_CONFIG_PARAM:
8107 {
8108 struct sme_motion_det_cfg motion_det_cfg;
8109
8110 if (num_args != 15) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308111 hdd_err_rl("mt_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308112 return -EINVAL;
8113 }
8114
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008115 motion_det_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308116 motion_det_cfg.time_t1 = apps_args[0];
8117 motion_det_cfg.time_t2 = apps_args[1];
8118 motion_det_cfg.n1 = apps_args[2];
8119 motion_det_cfg.n2 = apps_args[3];
8120 motion_det_cfg.time_t1_gap = apps_args[4];
8121 motion_det_cfg.time_t2_gap = apps_args[5];
8122 motion_det_cfg.coarse_K = apps_args[6];
8123 motion_det_cfg.fine_K = apps_args[7];
8124 motion_det_cfg.coarse_Q = apps_args[8];
8125 motion_det_cfg.fine_Q = apps_args[9];
8126 motion_det_cfg.md_coarse_thr_high = apps_args[10];
8127 motion_det_cfg.md_fine_thr_high = apps_args[11];
8128 motion_det_cfg.md_coarse_thr_low = apps_args[12];
8129 motion_det_cfg.md_fine_thr_low = apps_args[13];
8130 adapter->motion_detection_mode = apps_args[14];
8131 sme_motion_det_config(hdd_ctx->mac_handle, &motion_det_cfg);
8132 }
8133 break;
8134 case WE_MOTION_DET_BASE_LINE_CONFIG_PARAM:
8135 {
8136 struct sme_motion_det_base_line_cfg motion_det_base_line_cfg;
8137
8138 if (num_args != 4) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308139 hdd_err_rl("mt_bl_config: Invalid no of args");
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308140 return -EINVAL;
8141 }
8142
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008143 motion_det_base_line_cfg.vdev_id = adapter->vdev_id;
Visweswara Tanuku633976b2019-01-07 16:13:12 +05308144 motion_det_base_line_cfg.bl_time_t = apps_args[0];
8145 motion_det_base_line_cfg.bl_packet_gap = apps_args[1];
8146 motion_det_base_line_cfg.bl_n = apps_args[2];
8147 motion_det_base_line_cfg.bl_num_meas = apps_args[3];
8148 sme_motion_det_base_line_config(hdd_ctx->mac_handle,
8149 &motion_det_base_line_cfg);
8150 }
8151 break;
8152#endif /* WLAN_FEATURE_MOTION_DETECTION */
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308153#ifdef FW_THERMAL_THROTTLE_SUPPORT
8154 case WE_SET_THERMAL_THROTTLE_CFG:
8155 {
8156 QDF_STATUS status;
8157
8158 if (num_args != 7) {
Visweswara Tanuku6488a1c2019-02-13 14:15:26 +05308159 hdd_err_rl("set_thermal_cfg: Invalid no of args");
Visweswara Tanuku025f5862019-01-08 17:35:33 +05308160 return -EINVAL;
8161 }
8162
8163 /* Check for valid inputs */
8164 if (apps_args[0] < 0 || apps_args[0] > 1 || apps_args[1] < 0 ||
8165 apps_args[2] < 0 || apps_args[2] > 100 ||
8166 apps_args[3] < 0 || apps_args[3] > 3 || apps_args[4] < 0 ||
8167 apps_args[5] < 0 || apps_args[6] < 0 ||
8168 apps_args[5] <= apps_args[4])
8169 return -EINVAL;
8170
8171 status = sme_set_thermal_throttle_cfg(hdd_ctx->mac_handle,
8172 apps_args[0],
8173 apps_args[1],
8174 apps_args[2],
8175 apps_args[3],
8176 apps_args[6]);
8177 if (QDF_IS_STATUS_ERROR(status))
8178 return qdf_status_to_os_return(status);
8179
8180 if (!apps_args[6]) {
8181 status = sme_set_thermal_mgmt(hdd_ctx->mac_handle,
8182 apps_args[4],
8183 apps_args[5]);
8184 if (QDF_IS_STATUS_ERROR(status))
8185 return qdf_status_to_os_return(status);
8186 }
8187 break;
8188 }
8189#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008190 default:
8191 {
Jeff Johnson99bac312016-06-28 10:38:18 -07008192 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008193 }
8194 break;
8195 }
Dustin Browne74003f2018-03-14 12:51:58 -07008196 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008197 return 0;
8198}
8199
8200/**
8201 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
8202 * @dev: pointer to net_device structure
8203 * @info: pointer to iw_request_info structure
8204 * @wrqu: pointer to iwreq_data
8205 * @extra; extra
8206 *
8207 * Return: 0 on success, error number otherwise
8208 *
8209 */
8210static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
8211 struct iw_request_info *info,
8212 union iwreq_data *wrqu, char *extra)
8213{
8214 union iwreq_data u_priv_wrqu;
8215 int apps_args[MAX_VAR_ARGS] = {0};
Dustin Brown389e5072018-11-08 17:10:01 +05308216 int errno, num_args;
8217 struct osif_vdev_sync *vdev_sync;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008218
Mukul Sharma64a70e82015-11-02 20:05:09 +05308219 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008220 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05308221 return -EPERM;
8222 }
8223
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008224 /* Helper function to get iwreq_data with compat handling. */
8225 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
8226 return -EINVAL;
8227
8228 if (NULL == u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008229 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008230 return -EINVAL;
8231 }
8232
8233 num_args = u_priv_wrqu.data.length;
8234 if (num_args > MAX_VAR_ARGS)
8235 num_args = MAX_VAR_ARGS;
8236
8237 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
Dustin Brown389e5072018-11-08 17:10:01 +05308238 sizeof(int) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008239 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008240 return -EFAULT;
8241 }
8242
Dustin Brown389e5072018-11-08 17:10:01 +05308243 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8244 if (errno)
8245 return errno;
8246
Dustin Brown389e5072018-11-08 17:10:01 +05308247 errno = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
8248 (char *)&apps_args);
Dustin Brown389e5072018-11-08 17:10:01 +05308249
8250 osif_vdev_sync_op_stop(vdev_sync);
8251
8252 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008253}
8254
8255/**
8256 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
8257 * @dev: device upon which the ioctl was received
8258 * @info: ioctl request information
8259 * @wrqu: ioctl request data
8260 * @extra: ioctl extra data
8261 *
8262 * This is a generic handler for private ioctls which take multiple
8263 * arguments. Note that this implementation is also somewhat unique
8264 * in that it is shared by both STA-mode and SAP-mode interfaces.
8265 *
8266 * Return: 0 on success, non-zero on error
8267 */
8268int iw_set_var_ints_getnone(struct net_device *dev,
8269 struct iw_request_info *info,
8270 union iwreq_data *wrqu, char *extra)
8271{
Dustin Brown389e5072018-11-08 17:10:01 +05308272 int errno;
8273 struct osif_vdev_sync *vdev_sync;
8274
8275 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8276 if (errno)
8277 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008278
Dustin Brown389e5072018-11-08 17:10:01 +05308279 errno = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
Dustin Brown389e5072018-11-08 17:10:01 +05308280
8281 osif_vdev_sync_op_stop(vdev_sync);
8282
8283 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008284}
8285
8286/**
8287 * iw_add_tspec - Add TSpec private ioctl handler
8288 * @dev: device upon which the ioctl was received
8289 * @info: ioctl request information
8290 * @wrqu: ioctl request data
8291 * @extra: ioctl extra data
8292 *
8293 * Return: 0 on success, non-zero on error
8294 */
8295static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
8296 union iwreq_data *wrqu, char *extra)
8297{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008298 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008299 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008300 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008301 int params[HDD_WLAN_WMM_PARAM_COUNT];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008302 struct sme_qos_wmmtspecinfo tspec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008303 uint32_t handle;
8304 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008305 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008306 int ret;
8307
Dustin Brownfdf17c12018-03-14 12:55:34 -07008308 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308309
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008310 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008311 ret = wlan_hdd_validate_context(hdd_ctx);
8312 if (0 != ret)
8313 return ret;
8314
Jeff Johnson441e1f72017-02-07 08:50:49 -08008315 ret = hdd_check_private_wext_control(hdd_ctx, info);
8316 if (0 != ret)
8317 return ret;
8318
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008319 /* make sure the application is sufficiently priviledged */
8320 /* note that the kernel will do this for "set" ioctls, but since */
8321 /* this ioctl wants to return status to user space it must be */
8322 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008323 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008324 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008325
8326 /* we must be associated in order to add a tspec */
Jeff Johnsone7951512019-02-27 10:02:51 -08008327 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008328 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008329 return 0;
8330 }
8331 /* since we are defined to be a "get" ioctl, and since the number */
8332 /* of params exceeds the number of params that wireless extensions */
8333 /* will pass down in the iwreq_data, we must copy the "set" params. */
8334 /* We must handle the compat for iwreq_data in 32U/64K environment. */
8335
8336 /* helper function to get iwreq_data with compat handling. */
8337 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008338 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008339 return 0;
8340 }
8341 /* make sure all params are correctly passed to function */
8342 if ((NULL == s_priv_data.pointer) ||
8343 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
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 /* from user space ourselves */
8348 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
8349 /* hmmm, can't get them */
8350 return -EIO;
8351 }
8352 /* clear the tspec */
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008353 memset(&tspec, 0, sizeof(tspec));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008354
8355 /* validate the handle */
8356 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8357 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8358 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008359 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008360 return 0;
8361 }
8362 /* validate the TID */
8363 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
8364 /* out of range */
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 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008368 tspec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008369
8370 /* validate the direction */
8371 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
8372 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008373 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008374 break;
8375
8376 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008377 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008378 break;
8379
8380 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008381 tspec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008382 break;
8383
8384 default:
8385 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008386 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008387 return 0;
8388 }
8389
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008390 tspec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008391
8392 /* validate the user priority */
8393 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
8394 /* out of range */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008395 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008396 return 0;
8397 }
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008398 tspec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
8399 if (0 > tspec.ts_info.up || SME_QOS_WMM_UP_MAX < tspec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008400 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008401 return 0;
8402 }
8403
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008404 hdd_debug("TS_INFO PSB %d UP %d !!!",
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008405 tspec.ts_info.psb, tspec.ts_info.up);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008406
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008407 tspec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
8408 tspec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
8409 tspec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
8410 tspec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
8411 tspec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
8412 tspec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
8413 tspec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
8414 tspec.surplus_bw_allowance =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008415 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008416 tspec.min_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008417 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008418 tspec.max_service_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008419 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008420 tspec.suspension_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008421 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008422 tspec.inactivity_interval =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008423 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
8424
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008425 tspec.ts_info.burst_size_defn =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008426 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
8427
8428 /* validate the ts info ack policy */
8429 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
Abhinav Kumarab576712018-11-05 14:32:49 +05308430 case TS_INFO_ACK_POLICY_NORMAL_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008431 tspec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008432 break;
8433
Abhinav Kumarab576712018-11-05 14:32:49 +05308434 case TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008435 tspec.ts_info.ack_policy =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008436 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
8437 break;
8438
8439 default:
8440 /* unknown */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008441 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008442 return 0;
8443 }
8444
Jeff Johnsonc3f37e32019-03-09 18:03:22 -08008445 *wmm_status = hdd_wmm_addts(adapter, handle, &tspec);
Dustin Browne74003f2018-03-14 12:51:58 -07008446 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008447 return 0;
8448}
8449
8450static int iw_add_tspec(struct net_device *dev,
8451 struct iw_request_info *info,
8452 union iwreq_data *wrqu, char *extra)
8453{
Dustin Brown389e5072018-11-08 17:10:01 +05308454 int errno;
8455 struct osif_vdev_sync *vdev_sync;
8456
8457 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8458 if (errno)
8459 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008460
Dustin Brown389e5072018-11-08 17:10:01 +05308461 errno = __iw_add_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008462
Dustin Brown389e5072018-11-08 17:10:01 +05308463 osif_vdev_sync_op_stop(vdev_sync);
8464
8465 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008466}
8467
8468/**
8469 * iw_del_tspec - Delete TSpec private ioctl handler
8470 * @dev: device upon which the ioctl was received
8471 * @info: ioctl request information
8472 * @wrqu: ioctl request data
8473 * @extra: ioctl extra data
8474 *
8475 * Return: 0 on success, non-zero on error
8476 */
8477static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
8478 union iwreq_data *wrqu, char *extra)
8479{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008480 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008481 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008482 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008483 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008484 uint32_t handle;
8485 int ret;
8486
Dustin Brownfdf17c12018-03-14 12:55:34 -07008487 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308488
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008489 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008490 ret = wlan_hdd_validate_context(hdd_ctx);
8491 if (0 != ret)
8492 return ret;
8493
Jeff Johnson441e1f72017-02-07 08:50:49 -08008494 ret = hdd_check_private_wext_control(hdd_ctx, info);
8495 if (0 != ret)
8496 return ret;
8497
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008498 /* make sure the application is sufficiently priviledged */
8499 /* note that the kernel will do this for "set" ioctls, but since */
8500 /* this ioctl wants to return status to user space it must be */
8501 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008502 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008503 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008504
8505 /* although we are defined to be a "get" ioctl, the params we require */
8506 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8507 /* is no need to copy the params from user space */
8508
8509 /* validate the handle */
8510 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8511 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8512 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008513 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008514 return 0;
8515 }
8516
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008517 *wmm_status = hdd_wmm_delts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008518 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008519 return 0;
8520}
8521
8522static int iw_del_tspec(struct net_device *dev,
8523 struct iw_request_info *info,
8524 union iwreq_data *wrqu, char *extra)
8525{
Dustin Brown389e5072018-11-08 17:10:01 +05308526 int errno;
8527 struct osif_vdev_sync *vdev_sync;
8528
8529 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8530 if (errno)
8531 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008532
Dustin Brown389e5072018-11-08 17:10:01 +05308533 errno = __iw_del_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008534
Dustin Brown389e5072018-11-08 17:10:01 +05308535 osif_vdev_sync_op_stop(vdev_sync);
8536
8537 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008538}
8539
8540/**
8541 * iw_get_tspec - Get TSpec private ioctl handler
8542 * @dev: device upon which the ioctl was received
8543 * @info: ioctl request information
8544 * @wrqu: ioctl request data
8545 * @extra: ioctl extra data
8546 *
8547 * Return: 0 on success, non-zero on error
8548 */
8549static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
8550 union iwreq_data *wrqu, char *extra)
8551{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008552 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008553 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008554 int *params = (int *)extra;
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008555 hdd_wlan_wmm_status_e *wmm_status = (hdd_wlan_wmm_status_e *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008556 uint32_t handle;
8557 int ret;
8558
Dustin Brownfdf17c12018-03-14 12:55:34 -07008559 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308560
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008561 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008562 ret = wlan_hdd_validate_context(hdd_ctx);
8563 if (0 != ret)
8564 return ret;
8565
Jeff Johnson441e1f72017-02-07 08:50:49 -08008566 ret = hdd_check_private_wext_control(hdd_ctx, info);
8567 if (0 != ret)
8568 return ret;
8569
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008570 /* although we are defined to be a "get" ioctl, the params we require */
8571 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
8572 /* is no need to copy the params from user space */
8573
8574 /* validate the handle */
8575 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
8576 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
8577 /* that one is reserved */
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008578 *wmm_status = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008579 return 0;
8580 }
8581
Jeff Johnsonb7c419b2019-03-09 17:15:47 -08008582 *wmm_status = hdd_wmm_checkts(adapter, handle);
Dustin Browne74003f2018-03-14 12:51:58 -07008583 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008584 return 0;
8585}
8586
8587static int iw_get_tspec(struct net_device *dev,
8588 struct iw_request_info *info,
8589 union iwreq_data *wrqu, char *extra)
8590{
Dustin Brown389e5072018-11-08 17:10:01 +05308591 int errno;
8592 struct osif_vdev_sync *vdev_sync;
8593
8594 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8595 if (errno)
8596 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008597
Dustin Brown389e5072018-11-08 17:10:01 +05308598 errno = __iw_get_tspec(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008599
Dustin Brown389e5072018-11-08 17:10:01 +05308600 osif_vdev_sync_op_stop(vdev_sync);
8601
8602 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008603}
8604
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008605/**
8606 * iw_set_fties - Set FT IEs private ioctl handler
8607 * @dev: device upon which the ioctl was received
8608 * @info: ioctl request information
8609 * @wrqu: ioctl request data
8610 * @extra: ioctl extra data
8611 *
8612 * Each time the supplicant has the auth_request or reassoc request
8613 * IEs ready they are pushed to the driver. The driver will in turn
8614 * use it to send out the auth req and reassoc req for 11r FT Assoc.
8615 *
8616 * Return: 0 on success, non-zero on error
8617 */
8618static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
8619 union iwreq_data *wrqu, char *extra)
8620{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008621 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07008622 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008623 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008624 int ret;
8625
Dustin Brownfdf17c12018-03-14 12:55:34 -07008626 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308627
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008628 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008629 ret = wlan_hdd_validate_context(hdd_ctx);
8630 if (0 != ret)
8631 return ret;
8632
Jeff Johnson441e1f72017-02-07 08:50:49 -08008633 ret = hdd_check_private_wext_control(hdd_ctx, info);
8634 if (0 != ret)
8635 return ret;
8636
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008637 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008638 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008639 return -EINVAL;
8640 }
8641 if (wrqu->data.pointer == NULL) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008642 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008643 return -EINVAL;
8644 }
8645 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsone7951512019-02-27 10:02:51 -08008646 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008647 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008648 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008649 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008650 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008651 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008652
8653 /* Pass the received FT IEs to SME */
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008654 sme_set_ft_ies(hdd_ctx->mac_handle, adapter->vdev_id,
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008655 extra, wrqu->data.length);
Dustin Browne74003f2018-03-14 12:51:58 -07008656 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008657 return 0;
8658}
8659
8660static int iw_set_fties(struct net_device *dev,
8661 struct iw_request_info *info,
8662 union iwreq_data *wrqu, char *extra)
8663{
Dustin Brown389e5072018-11-08 17:10:01 +05308664 int errno;
8665 struct osif_vdev_sync *vdev_sync;
8666
8667 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8668 if (errno)
8669 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008670
Dustin Brown389e5072018-11-08 17:10:01 +05308671 errno = __iw_set_fties(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008672
Dustin Brown389e5072018-11-08 17:10:01 +05308673 osif_vdev_sync_op_stop(vdev_sync);
8674
8675 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008676}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008677
Dustin Brown0cbc7572016-12-16 13:54:40 -08008678/**
8679 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
8680 * @dev: device upon which the ioctl was received
8681 * @info: ioctl request information
8682 * @wrqu: ioctl request data
8683 * @extra: ioctl extra data
8684 *
Dustin Brown860566f2017-01-31 15:24:43 -08008685 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
8686 * time being to provide guidance in migrating to standard APIs.
8687 *
Dustin Brown0cbc7572016-12-16 13:54:40 -08008688 * Return: 0 on success, non-zero on error
8689 */
8690static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
8691 struct iw_request_info *info,
8692 union iwreq_data *wrqu,
8693 char *extra)
8694{
Dustin Brown860566f2017-01-31 15:24:43 -08008695 hdd_err("\n"
8696 "setMCBCFilter is obsolete. Use the following instead:\n"
8697 "Configure multicast filtering via the ‘ip’ command.\n"
8698 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
8699 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
8700 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
8701 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
8702 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07008703 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -08008704}
8705
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008706/**
8707 * iw_set_host_offload - Set host offload ioctl handler
8708 * @dev: device upon which the ioctl was received
8709 * @info: ioctl request information
8710 * @wrqu: ioctl request data
8711 * @extra: ioctl extra data
8712 *
8713 * Return: 0 on success, non-zero on error
8714 */
8715static int __iw_set_host_offload(struct net_device *dev,
8716 struct iw_request_info *info,
8717 union iwreq_data *wrqu, char *extra)
8718{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008719 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008720 struct host_offload_req *user_request =
8721 (struct host_offload_req *) extra;
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008722 struct sir_host_offload_req offload_request;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008723 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008724 int ret;
8725
Dustin Brownfdf17c12018-03-14 12:55:34 -07008726 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308727
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008728 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008729 ret = wlan_hdd_validate_context(hdd_ctx);
8730 if (0 != ret)
8731 return ret;
8732
Jeff Johnson441e1f72017-02-07 08:50:49 -08008733 ret = hdd_check_private_wext_control(hdd_ctx, info);
8734 if (0 != ret)
8735 return ret;
8736
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008737 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008738 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008739 return -EINVAL;
8740 }
8741
8742 /* Debug display of request components. */
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008743 switch (user_request->offloadType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008744 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008745 hdd_debug("Host offload request: ARP reply");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008746 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008747 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008748 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008749 break;
8750 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008751 hdd_debug(" BC Filtering enable");
Jeff Johnson00052dd2018-04-29 19:19:06 -07008752 /* fallthrough */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008753 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008754 hdd_debug(" ARP offload enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008755 hdd_debug(" IP address: %pI4",
8756 user_request->params.hostIpv4Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008757 }
8758 break;
8759
8760 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008761 hdd_debug("Host offload request: neighbor discovery");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008762 switch (user_request->enableOrDisable) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008763 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008764 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008765 break;
8766 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008767 hdd_debug(" enable");
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008768 hdd_debug(" IP address: %pI6c",
8769 user_request->params.hostIpv6Addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008770 }
8771 }
8772
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008773 qdf_mem_zero(&offload_request, sizeof(offload_request));
Jeff Johnson18a8ebd2019-03-09 17:38:30 -08008774 offload_request.offloadType = user_request->offloadType;
8775 offload_request.enableOrDisable = user_request->enableOrDisable;
8776 qdf_mem_copy(&offload_request.params, &user_request->params,
8777 sizeof(user_request->params));
8778 qdf_mem_copy(&offload_request.bssid, &user_request->bssId.bytes,
Hanumanth Reddy Pothula8fcade52017-12-01 13:49:40 +05308779 QDF_MAC_ADDR_SIZE);
8780
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308781 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008782 sme_set_host_offload(hdd_ctx->mac_handle,
Jeff Johnsonfdc68da2019-03-09 17:27:13 -08008783 adapter->vdev_id, &offload_request)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008784 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008785 return -EINVAL;
8786 }
Dustin Browne74003f2018-03-14 12:51:58 -07008787 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008788 return 0;
8789}
8790
8791static int iw_set_host_offload(struct net_device *dev,
8792 struct iw_request_info *info,
8793 union iwreq_data *wrqu, char *extra)
8794{
Dustin Brown389e5072018-11-08 17:10:01 +05308795 int errno;
8796 struct osif_vdev_sync *vdev_sync;
8797
8798 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8799 if (errno)
8800 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008801
Dustin Brown389e5072018-11-08 17:10:01 +05308802 errno = __iw_set_host_offload(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008803
Dustin Brown389e5072018-11-08 17:10:01 +05308804 osif_vdev_sync_op_stop(vdev_sync);
8805
8806 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008807}
8808
8809/**
8810 * iw_set_keepalive_params - Set keepalive params ioctl handler
8811 * @dev: device upon which the ioctl was received
8812 * @info: ioctl request information
8813 * @wrqu: ioctl request data
8814 * @extra: ioctl extra data
8815 *
8816 * Return: 0 on success, non-zero on error
8817 */
8818static int __iw_set_keepalive_params(struct net_device *dev,
8819 struct iw_request_info *info,
8820 union iwreq_data *wrqu, char *extra)
8821{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008822 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson562ccad2019-02-06 22:10:24 -08008823 struct keep_alive_req *request = (struct keep_alive_req *)extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008824 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008825 int ret;
8826
Dustin Brownfdf17c12018-03-14 12:55:34 -07008827 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308828
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008829 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008830 ret = wlan_hdd_validate_context(hdd_ctx);
8831 if (0 != ret)
8832 return ret;
8833
Jeff Johnson441e1f72017-02-07 08:50:49 -08008834 ret = hdd_check_private_wext_control(hdd_ctx, info);
8835 if (0 != ret)
8836 return ret;
8837
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008838 if (wrqu->data.length != sizeof(*request)) {
8839 hdd_err("Invalid length %d", wrqu->data.length);
8840 return -EINVAL;
8841 }
8842
Wu Gao93816212018-08-31 16:49:54 +08008843 if (request->timePeriod > cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008844 hdd_err("Value of timePeriod %d exceed Max limit %d",
8845 request->timePeriod,
Wu Gao93816212018-08-31 16:49:54 +08008846 cfg_max(CFG_INFRA_STA_KEEP_ALIVE_PERIOD));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008847 return -EINVAL;
8848 }
8849
8850 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008851 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Jeff Johnson562ccad2019-02-06 22:10:24 -08008852 request->timePeriod, sizeof(struct keep_alive_req));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008853
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008854 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008855 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008856 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008857 break;
8858
8859 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008860 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008861
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008862 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008863 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
8864 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008865
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008866 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008867 request->destIpv4Addr[0], request->destIpv4Addr[1],
8868 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008869
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008870 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -08008871 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008872 break;
8873 }
8874
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008875 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008876
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308877 if (QDF_STATUS_SUCCESS !=
Jeff Johnsoncec6e922018-06-12 16:17:27 -07008878 sme_set_keep_alive(hdd_ctx->mac_handle,
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08008879 adapter->vdev_id, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -08008880 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008881 return -EINVAL;
8882 }
Dustin Browne74003f2018-03-14 12:51:58 -07008883 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008884 return 0;
8885}
8886
8887static int iw_set_keepalive_params(struct net_device *dev,
8888 struct iw_request_info *info,
8889 union iwreq_data *wrqu,
8890 char *extra)
8891{
Dustin Brown389e5072018-11-08 17:10:01 +05308892 int errno;
8893 struct osif_vdev_sync *vdev_sync;
8894
8895 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
8896 if (errno)
8897 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008898
Dustin Brown389e5072018-11-08 17:10:01 +05308899 errno = __iw_set_keepalive_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008900
Dustin Brown389e5072018-11-08 17:10:01 +05308901 osif_vdev_sync_op_stop(vdev_sync);
8902
8903 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008904}
8905
8906#ifdef WLAN_FEATURE_PACKET_FILTERING
8907/**
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308908 * validate_packet_filter_params_size() - Validate the size of the params rcvd
8909 * @priv_data: Pointer to the priv data from user space
8910 * @request: Pointer to the struct containing the copied data from user space
8911 *
8912 * Return: False on invalid length, true otherwise
8913 */
8914static bool validate_packet_filter_params_size(struct pkt_filter_cfg *request,
8915 uint16_t length)
8916{
8917 int max_params_size, rcvd_params_size;
8918
8919 max_params_size = HDD_MAX_CMP_PER_PACKET_FILTER *
8920 sizeof(struct pkt_filter_param_cfg);
8921
8922 if (length < sizeof(struct pkt_filter_cfg) - max_params_size) {
8923 hdd_err("Less than minimum number of arguments needed");
8924 return false;
8925 }
8926
8927 rcvd_params_size = request->num_params *
8928 sizeof(struct pkt_filter_param_cfg);
8929
8930 if (length != sizeof(struct pkt_filter_cfg) -
8931 max_params_size + rcvd_params_size) {
8932 hdd_err("Arguments do not match the number of params provided");
8933 return false;
8934 }
8935
8936 return true;
8937}
8938
8939/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008940 * __iw_set_packet_filter_params() - set packet filter parameters in target
8941 * @dev: Pointer to netdev
8942 * @info: Pointer to iw request info
8943 * @wrqu: Pointer to data
8944 * @extra: Pointer to extra data
8945 *
8946 * Return: 0 on success, non-zero on error
8947 */
8948static int __iw_set_packet_filter_params(struct net_device *dev,
8949 struct iw_request_info *info,
8950 union iwreq_data *wrqu, char *extra)
8951{
8952 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008953 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008954 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008955 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008956 struct pkt_filter_cfg *request = NULL;
8957
Mukul Sharma472382f2015-11-02 20:16:31 +05308958 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008959 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +05308960 return -EPERM;
8961 }
8962
Dustin Brownfdf17c12018-03-14 12:55:34 -07008963 hdd_enter_dev(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308964
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008965 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
8966 ret = wlan_hdd_validate_context(hdd_ctx);
8967 if (0 != ret)
8968 return ret;
8969
Jeff Johnson441e1f72017-02-07 08:50:49 -08008970 ret = hdd_check_private_wext_control(hdd_ctx, info);
8971 if (0 != ret)
8972 return ret;
8973
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008974 if (hdd_priv_get_data(&priv_data, wrqu)) {
8975 hdd_err("failed to get priv data");
8976 return -EINVAL;
8977 }
8978
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308979 if ((NULL == priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07008980 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008981 priv_data.pointer, priv_data.length);
8982 return -EINVAL;
8983 }
8984
Arun Khandavalli75d246b2017-08-07 19:46:06 +05308985 if (adapter->device_mode != QDF_STA_MODE) {
8986 hdd_err("Packet filter not supported for this mode :%d",
8987 adapter->device_mode);
8988 return -ENOTSUPP;
8989 }
8990
Mukul Sharmabe846bb2017-05-09 17:41:52 +05308991 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
8992 hdd_err("Packet filter not supported in disconnected state");
8993 return -ENOTSUPP;
8994 }
8995
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008996 /* copy data using copy_from_user */
8997 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
8998 priv_data.length);
Sourav Mohapatra69d07802018-05-31 17:09:05 +05308999
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009000 if (NULL == request) {
9001 hdd_err("mem_alloc_copy_from_user_helper fail");
9002 return -ENOMEM;
9003 }
9004
Sourav Mohapatra69d07802018-05-31 17:09:05 +05309005 if (!validate_packet_filter_params_size(request, priv_data.length)) {
9006 hdd_err("Invalid priv data length %d", priv_data.length);
9007 qdf_mem_free(request);
9008 return -EINVAL;
9009 }
9010
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05309011 if (request->filter_action == HDD_RCV_FILTER_SET)
9012 hdd_ctx->user_configured_pkt_filter_rules |=
9013 1 << request->filter_id;
9014 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
9015 hdd_ctx->user_configured_pkt_filter_rules &=
9016 ~(1 << request->filter_id);
9017
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009018 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->vdev_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009019
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07009020 qdf_mem_free(request);
Dustin Browne74003f2018-03-14 12:51:58 -07009021 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009022 return ret;
9023}
9024
9025/**
9026 * iw_set_packet_filter_params() - set packet filter parameters in target
9027 * @dev: Pointer to netdev
9028 * @info: Pointer to iw request info
9029 * @wrqu: Pointer to data
9030 * @extra: Pointer to extra data
9031 *
9032 * Return: 0 on success, non-zero on error
9033 */
9034static int iw_set_packet_filter_params(struct net_device *dev,
9035 struct iw_request_info *info,
9036 union iwreq_data *wrqu, char *extra)
9037{
Dustin Brown389e5072018-11-08 17:10:01 +05309038 int errno;
9039 struct osif_vdev_sync *vdev_sync;
9040
9041 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9042 if (errno)
9043 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009044
Dustin Brown389e5072018-11-08 17:10:01 +05309045 errno = __iw_set_packet_filter_params(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009046
Dustin Brown389e5072018-11-08 17:10:01 +05309047 osif_vdev_sync_op_stop(vdev_sync);
9048
9049 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009050}
9051#endif
9052
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009053#ifdef QCA_SUPPORT_CP_STATS
9054static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
9055{
9056 return wlan_hdd_get_station_stats(adapter);
9057}
9058#else /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08009059struct hdd_statistics_priv {
9060 tCsrSummaryStatsInfo summary_stats;
9061 tCsrGlobalClassAStatsInfo class_a_stats;
9062 tCsrGlobalClassDStatsInfo class_d_stats;
9063};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009064
Jeff Johnsond37833f2018-03-07 14:22:44 -08009065/**
9066 * hdd_statistics_cb() - "Get statistics" callback function
Jeff Johnsonced658b2018-03-08 09:54:01 -08009067 * @stats: statistics payload
9068 * @context: opaque context originally passed to SME. HDD always passes
9069 * a cookie for the request context
Jeff Johnsond37833f2018-03-07 14:22:44 -08009070 *
9071 * Return: None
9072 */
Jeff Johnsonced658b2018-03-08 09:54:01 -08009073static void hdd_statistics_cb(void *stats, void *context)
Jeff Johnsond37833f2018-03-07 14:22:44 -08009074{
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009075 struct osif_request *request;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009076 struct hdd_statistics_priv *priv;
9077 tCsrSummaryStatsInfo *summary_stats;
9078 tCsrGlobalClassAStatsInfo *class_a_stats;
9079 tCsrGlobalClassDStatsInfo *class_d_stats;
Jeff Johnsond37833f2018-03-07 14:22:44 -08009080
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009081 request = osif_request_get(context);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009082 if (!request) {
9083 hdd_err("Obsolete request");
9084 return;
Jeff Johnsond37833f2018-03-07 14:22:44 -08009085 }
9086
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009087 priv = osif_request_priv(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009088
9089 summary_stats = (tCsrSummaryStatsInfo *)stats;
9090 priv->summary_stats = *summary_stats;
9091
9092 class_a_stats = (tCsrGlobalClassAStatsInfo *)(summary_stats + 1);
9093 priv->class_a_stats = *class_a_stats;
9094
9095 class_d_stats = (tCsrGlobalClassDStatsInfo *)(class_a_stats + 1);
9096 priv->class_d_stats = *class_d_stats;
9097
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009098 osif_request_complete(request);
9099 osif_request_put(request);
Jeff Johnsond37833f2018-03-07 14:22:44 -08009100}
9101
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009102static int hdd_get_wlan_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009103{
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009104 int ret = 0;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009105 void *cookie;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009106 QDF_STATUS status;
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009107 struct osif_request *request;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009108 struct hdd_station_ctx *sta_ctx;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009109 struct hdd_statistics_priv *priv;
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009110 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009111 static const struct osif_request_params params = {
Jeff Johnsonced658b2018-03-08 09:54:01 -08009112 .priv_size = sizeof(*priv),
9113 .timeout_ms = WLAN_WAIT_TIME_STATS,
9114 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009115
Jeff Johnsonced658b2018-03-08 09:54:01 -08009116 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009117 request = osif_request_alloc(&params);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009118 if (!request) {
9119 hdd_warn("request allocation failed");
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009120 return -EINVAL;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009121 }
9122
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009123 cookie = osif_request_cookie(request);
Jeff Johnsoncec6e922018-06-12 16:17:27 -07009124 status = sme_get_statistics(hdd_ctx->mac_handle, eCSR_HDD,
Jeff Johnsonced658b2018-03-08 09:54:01 -08009125 SME_SUMMARY_STATS |
9126 SME_GLOBAL_CLASSA_STATS |
9127 SME_GLOBAL_CLASSD_STATS,
9128 hdd_statistics_cb,
Jeff Johnson0a082d92019-03-04 12:25:49 -08009129 sta_ctx->conn_info.sta_id[0],
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009130 cookie, adapter->vdev_id);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009131
9132 if (QDF_STATUS_SUCCESS != status) {
9133 hdd_warn("Unable to retrieve SME statistics");
9134 goto put_request;
9135 }
9136
9137 /* request was sent -- wait for the response */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009138 ret = osif_request_wait_for_response(request);
Jeff Johnsonced658b2018-03-08 09:54:01 -08009139 if (ret) {
9140 hdd_err("Failed to wait for statistics, errno %d", ret);
9141 goto put_request;
9142 }
9143
9144 /* update the adapter cache with the fresh results */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009145 priv = osif_request_priv(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009146 adapter->hdd_stats.summary_stat = priv->summary_stats;
9147 adapter->hdd_stats.class_a_stat = priv->class_a_stats;
9148 adapter->hdd_stats.class_d_stat = priv->class_d_stats;
Jeff Johnsonced658b2018-03-08 09:54:01 -08009149
9150put_request:
9151 /*
9152 * either we never sent a request, we sent a request and
9153 * received a response or we sent a request and timed out.
9154 * regardless we are done with the request.
9155 */
Jeff Johnsonf1a99ea2018-06-28 13:27:01 -07009156 osif_request_put(request);
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009157 return ret;
9158}
9159#endif /* QCA_SUPPORT_CP_STATS */
Jeff Johnsonced658b2018-03-08 09:54:01 -08009160
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009161static int __iw_get_statistics(struct net_device *dev,
9162 struct iw_request_info *info,
9163 union iwreq_data *wrqu, char *extra)
9164{
9165 int ret;
9166 char *p;
9167 int tlen;
9168 struct hdd_station_ctx *sta_ctx;
9169 tCsrSummaryStatsInfo *summary_stats;
9170 tCsrGlobalClassAStatsInfo *class_a_stats;
9171 tCsrGlobalClassDStatsInfo *class_d_stats;
9172 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
9173 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9174
9175 hdd_enter_dev(dev);
9176
9177 ret = wlan_hdd_validate_context(hdd_ctx);
9178 if (0 != ret)
9179 return ret;
9180
9181 ret = hdd_check_private_wext_control(hdd_ctx, info);
9182 if (0 != ret)
9183 return ret;
9184
9185 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsone7951512019-02-27 10:02:51 -08009186 if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) {
Naveen Rawatfa2a1002018-05-17 16:06:37 -07009187 wrqu->data.length = 0;
9188 return 0;
9189 }
9190
9191 hdd_get_wlan_stats(adapter);
9192
9193 summary_stats = &(adapter->hdd_stats.summary_stat);
9194 class_a_stats = &(adapter->hdd_stats.class_a_stat);
9195 class_d_stats = &(adapter->hdd_stats.class_d_stat);
9196
Jeff Johnsonced658b2018-03-08 09:54:01 -08009197 p = extra;
9198 tlen = 0;
9199
9200 FILL_TLV(p, WLAN_STATS_RETRY_CNT,
9201 sizeof(summary_stats->retry_cnt),
9202 &(summary_stats->retry_cnt[0]), tlen);
9203
9204 FILL_TLV(p, WLAN_STATS_MUL_RETRY_CNT,
9205 sizeof(summary_stats->multiple_retry_cnt),
9206 &(summary_stats->multiple_retry_cnt[0]), tlen);
9207
9208 FILL_TLV(p, WLAN_STATS_TX_FRM_CNT,
9209 sizeof(summary_stats->tx_frm_cnt),
9210 &(summary_stats->tx_frm_cnt[0]), tlen);
9211
9212 FILL_TLV(p, WLAN_STATS_RX_FRM_CNT,
9213 sizeof(summary_stats->rx_frm_cnt),
9214 &(summary_stats->rx_frm_cnt), tlen);
9215
9216 FILL_TLV(p, WLAN_STATS_FRM_DUP_CNT,
9217 sizeof(summary_stats->frm_dup_cnt),
9218 &(summary_stats->frm_dup_cnt), tlen);
9219
9220 FILL_TLV(p, WLAN_STATS_FAIL_CNT,
9221 sizeof(summary_stats->fail_cnt),
9222 &(summary_stats->fail_cnt[0]), tlen);
9223
9224 FILL_TLV(p, WLAN_STATS_RTS_FAIL_CNT,
9225 sizeof(summary_stats->rts_fail_cnt),
9226 &(summary_stats->rts_fail_cnt), tlen);
9227
9228 FILL_TLV(p, WLAN_STATS_ACK_FAIL_CNT,
9229 sizeof(summary_stats->ack_fail_cnt),
9230 &(summary_stats->ack_fail_cnt), tlen);
9231
9232 FILL_TLV(p, WLAN_STATS_RTS_SUC_CNT,
9233 sizeof(summary_stats->rts_succ_cnt),
9234 &(summary_stats->rts_succ_cnt), tlen);
9235
9236 FILL_TLV(p, WLAN_STATS_RX_DISCARD_CNT,
9237 sizeof(summary_stats->rx_discard_cnt),
9238 &(summary_stats->rx_discard_cnt), tlen);
9239
9240 FILL_TLV(p, WLAN_STATS_RX_ERROR_CNT,
9241 sizeof(summary_stats->rx_error_cnt),
9242 &(summary_stats->rx_error_cnt), tlen);
9243
9244 FILL_TLV(p, WLAN_STATS_TX_BYTE_CNT,
9245 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9246 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9247
9248 FILL_TLV(p, WLAN_STATS_RX_BYTE_CNT,
9249 sizeof(class_d_stats->rx_byte_cnt),
9250 &(class_d_stats->rx_byte_cnt), tlen);
9251
9252 FILL_TLV(p, WLAN_STATS_RX_RATE,
9253 sizeof(class_d_stats->rx_rate),
9254 &(class_d_stats->rx_rate), tlen);
9255
9256 /* Transmit rate, in units of 500 kbit/sec */
9257 FILL_TLV(p, WLAN_STATS_TX_RATE,
9258 sizeof(class_a_stats->tx_rate),
9259 &(class_a_stats->tx_rate), tlen);
9260
9261 FILL_TLV(p, WLAN_STATS_RX_UC_BYTE_CNT,
9262 sizeof(class_d_stats->rx_uc_byte_cnt[0]),
9263 &(class_d_stats->rx_uc_byte_cnt[0]), tlen);
9264 FILL_TLV(p, WLAN_STATS_RX_MC_BYTE_CNT,
9265 sizeof(class_d_stats->rx_mc_byte_cnt),
9266 &(class_d_stats->rx_mc_byte_cnt), tlen);
9267 FILL_TLV(p, WLAN_STATS_RX_BC_BYTE_CNT,
9268 sizeof(class_d_stats->rx_bc_byte_cnt),
9269 &(class_d_stats->rx_bc_byte_cnt), tlen);
9270 FILL_TLV(p, WLAN_STATS_TX_UC_BYTE_CNT,
9271 sizeof(class_d_stats->tx_uc_byte_cnt[0]),
9272 &(class_d_stats->tx_uc_byte_cnt[0]), tlen);
9273 FILL_TLV(p, WLAN_STATS_TX_MC_BYTE_CNT,
9274 sizeof(class_d_stats->tx_mc_byte_cnt),
9275 &(class_d_stats->tx_mc_byte_cnt), tlen);
9276 FILL_TLV(p, WLAN_STATS_TX_BC_BYTE_CNT,
9277 sizeof(class_d_stats->tx_bc_byte_cnt),
9278 &(class_d_stats->tx_bc_byte_cnt), tlen);
9279
9280 wrqu->data.length = tlen;
9281
Dustin Browne74003f2018-03-14 12:51:58 -07009282 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009283
9284 return 0;
9285}
9286
9287static int iw_get_statistics(struct net_device *dev,
9288 struct iw_request_info *info,
9289 union iwreq_data *wrqu, char *extra)
9290{
Dustin Brown389e5072018-11-08 17:10:01 +05309291 int errno;
9292 struct osif_vdev_sync *vdev_sync;
9293
9294 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9295 if (errno)
9296 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009297
Dustin Brown389e5072018-11-08 17:10:01 +05309298 errno = __iw_get_statistics(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009299
Dustin Brown389e5072018-11-08 17:10:01 +05309300 osif_vdev_sync_op_stop(vdev_sync);
9301
9302 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009303}
9304
9305#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009306/*Max Len for PNO notification*/
9307#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +05309308static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
9309 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009310{
Abhishek Singh0481d662017-04-11 18:20:11 +05309311 struct vdev_osif_priv *osif_priv;
9312 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009313 union iwreq_data wrqu;
9314 char buf[MAX_PNO_NOTIFY_LEN + 1];
9315
Abhishek Singh0481d662017-04-11 18:20:11 +05309316 wlan_vdev_obj_lock(vdev);
9317 osif_priv = wlan_vdev_get_ospriv(vdev);
9318 wlan_vdev_obj_unlock(vdev);
9319 if (!osif_priv) {
9320 hdd_err("osif_priv is null");
9321 return;
9322 }
9323
9324 wdev = osif_priv->wdev;
9325 if (!wdev) {
9326 hdd_err("wdev is null");
9327 return;
9328 }
9329
9330 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009331
9332 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +05309333 qdf_mem_zero(&wrqu, sizeof(wrqu));
9334 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009335
9336 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +05309337 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009338
9339 wrqu.data.pointer = buf;
9340 wrqu.data.length = strlen(buf);
9341
9342 /* send the event */
9343
Abhishek Singh0481d662017-04-11 18:20:11 +05309344 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009345}
9346
9347/**
9348 * __iw_set_pno() - Preferred Network Offload ioctl handler
9349 * @dev: device upon which the ioctl was received
9350 * @info: ioctl request information
9351 * @wrqu: ioctl request data
9352 * @extra: ioctl extra data
9353 *
9354 * This function parses a Preferred Network Offload command
9355 * Input is string based and expected to be of the form:
9356 *
9357 * <enable(1) | disable(0)>
9358 * when enabling:
9359 * <number of networks>
9360 * for each network:
9361 * <ssid_len> <ssid> <authentication> <encryption>
9362 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -07009363 * <scan_time (seconds)>
9364 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009365 * <suspend mode>
9366 *
9367 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -07009368 * 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 -08009369 *
9370 * this translates into:
9371 * -----------------------------
9372 * enable PNO
9373 * 2 networks
9374 * Network 1:
9375 * test - with authentication type 0 and encryption type 0,
9376 * search on 3 channels: 1 6 and 11,
9377 * SSID bcast type is unknown (directed probe will be sent if
9378 * AP not found) and must meet -40dBm RSSI
9379 * Network 2:
9380 * test2 - with authentication type 4 and encryption type 4,
9381 * search on 6 channels 1, 2, 3, 4, 5 and 6
9382 * bcast type is non-bcast (directed probe will be sent)
9383 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009384 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -07009385 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009386 */
9387static int __iw_set_pno(struct net_device *dev,
9388 struct iw_request_info *info,
9389 union iwreq_data *wrqu, char *extra)
9390{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009391 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009392 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +05309393 uint8_t value;
9394 struct wlan_objmgr_vdev *vdev;
9395 struct wlan_objmgr_psoc *psoc;
9396 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009397 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309398 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +05309399 uint8_t i, j, params;
9400 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309401 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009402
9403 /* request is a large struct, so we make it static to avoid
9404 * stack overflow. This API is only invoked via ioctl, so it
9405 * is serialized by the kernel rtnl_lock and hence does not
9406 * need to be reentrant
9407 */
Abhishek Singh0481d662017-04-11 18:20:11 +05309408 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009409
Dustin Brownfdf17c12018-03-14 12:55:34 -07009410 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009411
9412 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9413 ret = wlan_hdd_validate_context(hdd_ctx);
9414 if (ret)
9415 return ret;
9416
Jeff Johnson441e1f72017-02-07 08:50:49 -08009417 ret = hdd_check_private_wext_control(hdd_ctx, info);
9418 if (0 != ret)
9419 return ret;
9420
Dustin Brown07901ec2018-09-07 11:02:41 -07009421 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->pdev,
9422 dev->dev_addr,
9423 WLAN_LEGACY_MAC_ID);
Abhishek Singh0481d662017-04-11 18:20:11 +05309424 if (!vdev) {
9425 hdd_err("vdev object is NULL");
9426 return -EIO;
9427 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009428
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309429 /* making sure argument string ends with '\0' */
9430 len = (wrqu->data.length + 1);
9431 data = qdf_mem_malloc(len);
9432 if (!data) {
9433 hdd_err("fail to allocate memory %zu", len);
9434 return -EINVAL;
9435 }
9436 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309437 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009438
Hanumanth Reddy Pothula3048c932018-05-15 12:43:39 +05309439 hdd_debug("PNO data len %d data %s", wrqu->data.length, data);
9440
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309441 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009442 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309443 ret = -EINVAL;
9444 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009445 }
9446
Abhishek Singh0481d662017-04-11 18:20:11 +05309447 if (!value) {
9448 status = ucfg_scan_pno_stop(vdev);
9449 if (QDF_IS_STATUS_ERROR(status)) {
9450 hdd_err("Failed to disabled PNO");
9451 ret = -EINVAL;
9452 } else {
9453 hdd_debug("PNO scan disabled");
9454 }
9455 goto exit;
9456 }
9457
9458 if (ucfg_scan_get_pno_in_progress(vdev)) {
9459 hdd_debug("pno is already in progress");
9460 ret = -EBUSY;
9461 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009462 }
9463
9464 ptr += offset;
9465
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309466 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009467 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309468 ret = -EINVAL;
9469 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009470 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309471 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009472
Abhishek Singh0481d662017-04-11 18:20:11 +05309473 hdd_debug("PNO enable networks count %d offset %d",
9474 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009475
Abhishek Singh0481d662017-04-11 18:20:11 +05309476 if ((0 == req.networks_cnt) ||
9477 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009478 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +05309479 req.networks_cnt);
9480 ret = -EINVAL;
9481 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009482 }
9483
9484 ptr += offset;
9485
Abhishek Singh0481d662017-04-11 18:20:11 +05309486 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009487
Abhishek Singh0481d662017-04-11 18:20:11 +05309488 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009489
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309490 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309491 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009492 &offset);
9493
9494 if (1 != params) {
9495 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309496 ret = -EINVAL;
9497 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009498 }
9499
Abhishek Singh0481d662017-04-11 18:20:11 +05309500 if ((0 == req.networks_list[i].ssid.length) ||
9501 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009502 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309503 req.networks_list[i].ssid.length, i);
9504 ret = -EINVAL;
9505 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009506 }
9507
9508 /* Advance to SSID */
9509 ptr += offset;
9510
Abhishek Singh0481d662017-04-11 18:20:11 +05309511 memcpy(req.networks_list[i].ssid.ssid, ptr,
9512 req.networks_list[i].ssid.length);
9513 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009514
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309515 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309516 &(req.networks_list[i].authentication),
9517 &(req.networks_list[i].encryption),
9518 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009519 &offset);
9520
9521 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009522 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309523 ret = -EINVAL;
9524 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009525 }
9526
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009527 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309528 req.networks_list[i].ssid.length,
9529 req.networks_list[i].ssid.length,
9530 req.networks_list[i].ssid.ssid,
9531 req.networks_list[i].authentication,
9532 req.networks_list[i].encryption,
9533 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009534
9535 /* Advance to channel list */
9536 ptr += offset;
9537
Abhishek Singh0481d662017-04-11 18:20:11 +05309538 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
9539 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009540 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +05309541 ret = -EINVAL;
9542 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009543 }
9544
Abhishek Singh0481d662017-04-11 18:20:11 +05309545 if (0 != req.networks_list[i].channel_cnt) {
9546 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009547 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309548 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +05309549 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009550 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009551 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309552 ret = -EINVAL;
9553 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009554 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309555 if (!IS_CHANNEL_VALID(value)) {
9556 hdd_err("invalid channel: %hhu", value);
9557 ret = -EINVAL;
9558 goto exit;
9559 }
Abhishek Singh0481d662017-04-11 18:20:11 +05309560 req.networks_list[i].channels[j] =
9561 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009562 /* Advance to next channel number */
9563 ptr += offset;
9564 }
9565 }
9566
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309567 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309568 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009569 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009570 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009571 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309572 ret = -EINVAL;
9573 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009574 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309575 if (req.networks_list[i].bc_new_type > 2) {
9576 hdd_err("invalid bcast nw type: %u",
9577 req.networks_list[i].bc_new_type);
9578 ret = -EINVAL;
9579 goto exit;
9580 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009581
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009582 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309583 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009584
9585 /* Advance to rssi Threshold */
9586 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309587 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +05309588 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009589 &offset)) {
9590 hdd_err("PNO rssi threshold input is not valid %s",
9591 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +05309592 ret = -EINVAL;
9593 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009594 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009595 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +05309596 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009597 /* Advance to next network */
9598 ptr += offset;
9599 } /* For ucNetworkCount */
9600
Abhishek Singh0481d662017-04-11 18:20:11 +05309601 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309602 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +05309603 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -07009604 ptr += offset;
9605 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309606 if (req.fast_scan_period == 0) {
9607 hdd_err("invalid fast scan period %u",
9608 req.fast_scan_period);
9609 ret = -EINVAL;
9610 goto exit;
9611 }
Dustin Brown43e87292016-10-10 10:38:25 -07009612
Abhishek Singh0481d662017-04-11 18:20:11 +05309613 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309614 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -07009615 &offset) > 0)
9616 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +05309617 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -07009618
Dustin Brown07901ec2018-09-07 11:02:41 -07009619 wlan_pdev_obj_lock(hdd_ctx->pdev);
9620 psoc = wlan_pdev_get_psoc(hdd_ctx->pdev);
9621 wlan_pdev_obj_unlock(hdd_ctx->pdev);
Abhishek Singh0481d662017-04-11 18:20:11 +05309622 ucfg_scan_register_pno_cb(psoc,
9623 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009624
Abhishek Singh0481d662017-04-11 18:20:11 +05309625 ucfg_scan_get_pno_def_params(vdev, &req);
9626 status = ucfg_scan_pno_start(vdev, &req);
9627 if (QDF_IS_STATUS_ERROR(status)) {
9628 hdd_err("Failed to enable PNO");
9629 ret = -EINVAL;
9630 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009631
Abhishek Singh0481d662017-04-11 18:20:11 +05309632exit:
9633 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009634
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +05309635 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +05309636 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009637}
9638
9639static int iw_set_pno(struct net_device *dev,
9640 struct iw_request_info *info,
9641 union iwreq_data *wrqu, char *extra)
9642{
Dustin Brown389e5072018-11-08 17:10:01 +05309643 int errno;
9644 struct osif_vdev_sync *vdev_sync;
9645
9646 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9647 if (errno)
9648 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009649
Dustin Brown389e5072018-11-08 17:10:01 +05309650 errno = __iw_set_pno(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009651
Dustin Brown389e5072018-11-08 17:10:01 +05309652 osif_vdev_sync_op_stop(vdev_sync);
9653
9654 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009655}
9656#endif /* FEATURE_WLAN_SCAN_PNO */
9657
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009658static int __iw_set_band_config(struct net_device *dev,
9659 struct iw_request_info *info,
9660 union iwreq_data *wrqu, char *extra)
9661{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009662 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009663 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08009664 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009665 int *value = (int *)extra;
9666
Dustin Brownfdf17c12018-03-14 12:55:34 -07009667 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009668
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309669 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009670 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +05309671 return -EPERM;
9672 }
9673
Jeff Johnson441e1f72017-02-07 08:50:49 -08009674 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
9675 ret = hdd_check_private_wext_control(hdd_ctx, info);
9676 if (0 != ret)
9677 return ret;
9678
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07009679 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009680}
9681
9682static int iw_set_band_config(struct net_device *dev,
9683 struct iw_request_info *info,
9684 union iwreq_data *wrqu, char *extra)
9685{
Dustin Brown389e5072018-11-08 17:10:01 +05309686 int errno;
9687 struct osif_vdev_sync *vdev_sync;
9688
9689 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9690 if (errno)
9691 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009692
Dustin Brown389e5072018-11-08 17:10:01 +05309693 errno = __iw_set_band_config(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009694
Dustin Brown389e5072018-11-08 17:10:01 +05309695 osif_vdev_sync_op_stop(vdev_sync);
9696
9697 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009698}
9699
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009700static int printk_adapter(void *priv, const char *fmt, ...)
9701{
9702 int ret;
9703 va_list args;
9704
9705 va_start(args, fmt);
9706 ret = vprintk(fmt, args);
9707 ret += printk("\n");
9708 va_end(args);
9709
9710 return ret;
9711}
9712
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009713static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
9714{
9715 qdf_abstract_print *print = &printk_adapter;
9716
9717 switch (log_id) {
9718 case HTC_CREDIT_HISTORY_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009719 cds_print_htc_credit_history(count, print, NULL);
9720 break;
9721 case COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009722 wma_print_wmi_cmd_log(count, print, NULL);
9723 break;
9724 case COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009725 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
9726 break;
9727 case MGMT_COMMAND_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009728 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
9729 break;
9730 case MGMT_COMMAND_TX_CMP_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009731 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
9732 break;
9733 case EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009734 wma_print_wmi_event_log(count, print, NULL);
9735 break;
9736 case RX_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009737 wma_print_wmi_rx_event_log(count, print, NULL);
9738 break;
9739 case MGMT_EVENT_LOG:
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009740 wma_print_wmi_mgmt_event_log(count, print, NULL);
9741 break;
9742 default:
9743 print(NULL, "Invalid Log Id %d", log_id);
9744 break;
9745 }
9746}
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009747
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009748#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
9749int hdd_crash_inject(struct hdd_adapter *adapter, uint32_t v1, uint32_t v2)
9750{
9751 struct hdd_context *hdd_ctx;
9752 int ret;
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309753 bool crash_inject;
9754 QDF_STATUS status;
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009755
9756 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
9757 v1, v2);
9758 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
9759 v1, v2);
9760 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309761
Vignesh Viswanathana1f3a1a2018-10-04 13:10:46 +05309762 status = ucfg_mlme_get_crash_inject(hdd_ctx->psoc, &crash_inject);
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309763 if (QDF_IS_STATUS_ERROR(status)) {
9764 hdd_err("Failed to get crash inject ini config");
9765 return 0;
9766 }
9767
9768 if (!crash_inject) {
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009769 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
9770 return 0;
9771 }
Vignesh Viswanathana851d752018-10-03 19:44:38 +05309772
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009773 if (v1 == 3) {
9774 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
9775 return 0;
9776 }
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009777 ret = wma_cli_set2_command(adapter->vdev_id,
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009778 GEN_PARAM_CRASH_INJECT,
9779 v1, v2, GEN_CMD);
9780 return ret;
9781}
9782#endif
9783
Nirav Shahd21a2e32018-04-20 16:34:43 +05309784#ifdef CONFIG_DP_TRACE
9785void hdd_set_dump_dp_trace(uint16_t cmd_type, uint16_t count)
9786{
9787 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
9788 cmd_type, count);
9789 if (cmd_type == DUMP_DP_TRACE)
9790 qdf_dp_trace_dump_all(count, QDF_TRACE_DEFAULT_PDEV_ID);
9791 else if (cmd_type == ENABLE_DP_TRACE_LIVE_MODE)
9792 qdf_dp_trace_enable_live_mode();
9793 else if (cmd_type == CLEAR_DP_TRACE_BUFFER)
9794 qdf_dp_trace_clear_buffer();
9795 else if (cmd_type == DISABLE_DP_TRACE_LIVE_MODE)
9796 qdf_dp_trace_disable_live_mode();
9797}
9798#endif
9799
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009800static int __iw_set_two_ints_getnone(struct net_device *dev,
9801 struct iw_request_info *info,
9802 union iwreq_data *wrqu, char *extra)
9803{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009804 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009805 int *value = (int *)extra;
9806 int sub_cmd = value[0];
9807 int ret;
Krunal Sonidf29bc42018-11-15 13:26:29 -08009808 uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009809 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Krunal Sonidf29bc42018-11-15 13:26:29 -08009810 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009811
Dustin Brownfdf17c12018-03-14 12:55:34 -07009812 hdd_enter_dev(dev);
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009813
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009814 ret = wlan_hdd_validate_context(hdd_ctx);
9815 if (0 != ret)
9816 return ret;
9817
Jeff Johnson441e1f72017-02-07 08:50:49 -08009818 ret = hdd_check_private_wext_control(hdd_ctx, info);
9819 if (0 != ret)
9820 return ret;
9821
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009822 switch (sub_cmd) {
9823 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009824 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009825 ret = wma_cli_set_command(adapter->vdev_id,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009826 WMI_STA_SMPS_PARAM_CMDID,
9827 value[1] << WMA_SMPS_PARAM_VALUE_S
9828 | value[2],
9829 VDEV_CMD);
9830 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009831 case WE_SET_FW_CRASH_INJECT:
Jeff Johnsondf5d7792018-04-14 15:58:24 -07009832 ret = hdd_crash_inject(adapter, value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009833 break;
Govind Singha471e5e2015-10-12 17:11:14 +05309834 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -07009835 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309836 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009837 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309838 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
9839 value[1], value[2], DBG_CMD);
9840 break;
9841 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -07009842 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +05309843 value[1], value[2]);
Jeff Johnsonc5b56bb2019-02-04 14:08:48 -08009844 ret = wma_cli_set2_command(adapter->vdev_id,
Govind Singha471e5e2015-10-12 17:11:14 +05309845 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
9846 value[1], value[2], DBG_CMD);
9847 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009848 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
9849 hdd_debug("Ioctl to set dual fw mode config");
Krunal Sonidf29bc42018-11-15 13:26:29 -08009850 status =
9851 ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
9852 &dual_mac_feature);
9853 if (status != QDF_STATUS_SUCCESS)
9854 hdd_err("can't get dual mac feature val, use def");
9855 if (dual_mac_feature == DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009856 hdd_err("Dual mac feature is disabled from INI");
9857 return -EPERM;
9858 }
9859 hdd_debug("%d %d", value[1], value[2]);
Dustin Brown05d81302018-09-11 16:49:22 -07009860 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->psoc,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009861 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009862 break;
9863 case WE_DUMP_DP_TRACE_LEVEL:
Nirav Shahd21a2e32018-04-20 16:34:43 +05309864 hdd_set_dump_dp_trace(value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009865 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009866 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009867 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07009868 break;
Rajeev Kumar15b40a22018-04-12 11:45:24 -07009869 case WE_SET_WLAN_SUSPEND:
Dustin Brown54096432017-02-23 13:00:44 -08009870 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
9871 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009872 break;
9873 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -07009874 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -07009875 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -07009876 case WE_LOG_BUFFER: {
9877 int log_id = value[1];
9878 uint32_t count = value[2] < 0 ? 0 : value[2];
9879
9880 hdd_ioctl_log_buffer(log_id, count);
9881
9882 break;
9883 }
Krunal Soni6c3859f2018-06-01 19:57:40 -07009884 case WE_SET_BA_AGEING_TIMEOUT:
9885 {
9886 void *soc = cds_get_context(QDF_MODULE_ID_SOC);
9887
9888 if (!soc) {
9889 hdd_err("Invalid handles");
9890 break;
9891 }
9892 cdp_set_ba_timeout(soc, value[1], value[2]);
9893 break;
9894 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009895 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07009896 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009897 break;
9898 }
9899
9900 return ret;
9901}
9902
9903static int iw_set_two_ints_getnone(struct net_device *dev,
9904 struct iw_request_info *info,
9905 union iwreq_data *wrqu, char *extra)
9906{
Dustin Brown389e5072018-11-08 17:10:01 +05309907 int errno;
9908 struct osif_vdev_sync *vdev_sync;
9909
9910 errno = osif_vdev_sync_op_start(dev, &vdev_sync);
9911 if (errno)
9912 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009913
Dustin Brown389e5072018-11-08 17:10:01 +05309914 errno = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009915
Dustin Brown389e5072018-11-08 17:10:01 +05309916 osif_vdev_sync_op_stop(vdev_sync);
9917
9918 return errno;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009919}
9920
9921/* Define the Wireless Extensions to the Linux Network Device structure */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009922
9923static const iw_handler we_private[] = {
9924
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009925 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
9926 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
9927 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009928 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9929 iw_set_three_ints_getnone,
9930 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009931 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009932 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9933 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009934 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
9935 iw_setnone_get_threeint,
Nirav Shaheb017be2018-02-15 11:20:58 +05309936#ifdef WLAN_FEATURE_FIPS
Jeff Johnson6fa1e012017-04-05 06:40:53 -07009937 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Nirav Shaheb017be2018-02-15 11:20:58 +05309938#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009939 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
9940 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
9941 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009942 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009943 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
9944 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
9945 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
9946 iw_set_keepalive_params,
9947#ifdef WLAN_FEATURE_PACKET_FILTERING
9948 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
9949 iw_set_packet_filter_params,
9950#endif
9951#ifdef FEATURE_WLAN_SCAN_PNO
9952 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
9953#endif
9954 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -08009955 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
9956 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009957 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
Krunal Sonif9ba53d2019-01-03 21:44:41 -08009958#ifdef FEATURE_WLM_STATS
9959 [WLAN_GET_WLM_STATS - SIOCIWFIRSTPRIV] = iw_get_wlm_stats,
9960#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009961 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
9962 iw_set_two_ints_getnone,
9963 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
9964 iw_set_dot11p_channel_sched,
9965};
9966
9967/*Maximum command length can be only 15 */
9968static const struct iw_priv_args we_private_args[] = {
9969
9970 /* handlers for main ioctl */
9971 {WLAN_PRIV_SET_INT_GET_NONE,
9972 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9973 0,
9974 ""},
9975
9976 /* handlers for sub-ioctl */
9977 {WE_SET_11D_STATE,
9978 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9979 0,
9980 "set11Dstate"},
9981
9982 {WE_WOWL,
9983 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9984 0,
9985 "wowl"},
9986
9987 {WE_SET_POWER,
9988 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9989 0,
9990 "setPower"},
9991
9992 {WE_SET_MAX_ASSOC,
9993 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9994 0,
9995 "setMaxAssoc"},
9996
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009997 {WE_SET_SCAN_DISABLE,
9998 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
9999 0,
10000 "scan_disable"},
10001
10002 {WE_SET_DATA_INACTIVITY_TO,
10003 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10004 0,
10005 "inactivityTO"},
10006
Mukul Sharmaed92f2f2017-04-20 00:06:28 +053010007 {WE_SET_WOW_DATA_INACTIVITY_TO,
10008 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10009 0,
10010 "wow_ito"},
10011
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010012 {WE_SET_MAX_TX_POWER,
10013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10014 0,
10015 "setMaxTxPower"},
10016
10017 {WE_SET_TX_POWER,
10018 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10019 0,
10020 "setTxPower"},
10021
10022 {WE_SET_MC_RATE,
10023 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10024 0,
10025 "setMcRate"},
10026
10027 {WE_SET_MAX_TX_POWER_2_4,
10028 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10029 0,
10030 "setTxMaxPower2G"},
10031
10032 {WE_SET_MAX_TX_POWER_5_0,
10033 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10034 0,
10035 "setTxMaxPower5G"},
10036
Nirav Shahbb8e47c2018-05-17 16:56:41 +053010037#ifndef REMOVE_PKT_LOG
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080010038 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +053010039 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080010040 0,
10041 "pktlog"},
Nirav Shahbb8e47c2018-05-17 16:56:41 +053010042#endif
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080010043
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010044 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
10045 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -080010046 * will support both
10047 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010048 {WE_SET_MAX_TX_POWER,
10049 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10050 0,
10051 "setTxMaxPower"},
10052
Jeff Johnson0187c622019-01-04 06:39:44 -080010053#ifdef HASTINGS_BT_WAR
10054 {WE_SET_HASTINGS_BT_WAR,
10055 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10056 0,
10057 "hastings_bt_war"},
10058#endif
10059
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010060 {WE_SET_TM_LEVEL,
10061 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10062 0,
10063 "setTmLevel"},
10064
10065 {WE_SET_PHYMODE,
10066 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10067 0,
10068 "setphymode"},
10069
10070 {WE_SET_NSS,
10071 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10072 0,
10073 "nss"},
10074
10075 {WE_SET_LDPC,
10076 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10077 0,
10078 "ldpc"},
10079
10080 {WE_SET_TX_STBC,
10081 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10082 0,
10083 "tx_stbc"},
10084
10085 {WE_SET_RX_STBC,
10086 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10087 0,
10088 "rx_stbc"},
10089
10090 {WE_SET_SHORT_GI,
10091 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10092 0,
10093 "shortgi"},
10094
10095 {WE_SET_RTSCTS,
10096 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10097 0,
10098 "enablertscts"},
10099
10100 {WE_SET_CHWIDTH,
10101 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10102 0,
10103 "chwidth"},
10104
10105 {WE_SET_ANI_EN_DIS,
10106 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10107 0,
10108 "anienable"},
10109
10110 {WE_SET_ANI_POLL_PERIOD,
10111 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10112 0,
10113 "aniplen"},
10114
10115 {WE_SET_ANI_LISTEN_PERIOD,
10116 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10117 0,
10118 "anilislen"},
10119
10120 {WE_SET_ANI_OFDM_LEVEL,
10121 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10122 0,
10123 "aniofdmlvl"},
10124
10125 {WE_SET_ANI_CCK_LEVEL,
10126 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10127 0,
10128 "aniccklvl"},
10129
10130 {WE_SET_DYNAMIC_BW,
10131 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10132 0,
10133 "cwmenable"},
10134
10135 {WE_SET_CTS_CBW,
10136 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10137 0,
10138 "cts_cbw" },
10139
10140 {WE_SET_GTX_HT_MCS,
10141 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10142 0,
10143 "gtxHTMcs"},
10144
10145 {WE_SET_GTX_VHT_MCS,
10146 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10147 0,
10148 "gtxVHTMcs"},
10149
10150 {WE_SET_GTX_USRCFG,
10151 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10152 0,
10153 "gtxUsrCfg"},
10154
10155 {WE_SET_GTX_THRE,
10156 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10157 0,
10158 "gtxThre"},
10159
10160 {WE_SET_GTX_MARGIN,
10161 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10162 0,
10163 "gtxMargin"},
10164
10165 {WE_SET_GTX_STEP,
10166 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10167 0,
10168 "gtxStep"},
10169
10170 {WE_SET_GTX_MINTPC,
10171 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10172 0,
10173 "gtxMinTpc"},
10174
10175 {WE_SET_GTX_BWMASK,
10176 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10177 0,
10178 "gtxBWMask"},
10179
10180 {WE_SET_TX_CHAINMASK,
10181 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10182 0,
10183 "txchainmask"},
10184
10185 {WE_SET_RX_CHAINMASK,
10186 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10187 0,
10188 "rxchainmask"},
10189
10190 {WE_SET_11N_RATE,
10191 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10192 0,
10193 "set11NRates"},
10194
10195 {WE_SET_VHT_RATE,
10196 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10197 0,
10198 "set11ACRates"},
10199
10200 {WE_SET_AMPDU,
10201 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10202 0,
10203 "ampdu"},
10204
10205 {WE_SET_AMSDU,
10206 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10207 0,
10208 "amsdu"},
10209
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010210 {WE_SET_TXPOW_2G,
10211 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10212 0,
10213 "txpow2g"},
10214
10215 {WE_SET_TXPOW_5G,
10216 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10217 0,
10218 "txpow5g"},
10219
Wen Gong99768902018-04-25 12:07:49 +080010220#ifdef FEATURE_FW_LOG_PARSING
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010221 /* Sub-cmds DBGLOG specific commands */
10222 {WE_DBGLOG_LOG_LEVEL,
10223 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10224 0,
10225 "dl_loglevel"},
10226
10227 {WE_DBGLOG_VAP_ENABLE,
10228 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10229 0,
10230 "dl_vapon"},
10231
10232 {WE_DBGLOG_VAP_DISABLE,
10233 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10234 0,
10235 "dl_vapoff"},
10236
10237 {WE_DBGLOG_MODULE_ENABLE,
10238 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10239 0,
10240 "dl_modon"},
10241
10242 {WE_DBGLOG_MODULE_DISABLE,
10243 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10244 0,
10245 "dl_modoff"},
10246
10247 {WE_DBGLOG_MOD_LOG_LEVEL,
10248 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10249 0,
10250 "dl_mod_loglevel"},
10251
10252 {WE_DBGLOG_TYPE,
10253 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10254 0,
10255 "dl_type"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010256
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010257 {WE_DBGLOG_REPORT_ENABLE,
10258 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10259 0,
10260 "dl_report"},
Wen Gong99768902018-04-25 12:07:49 +080010261#endif /* FEATURE_FW_LOG_PARSING */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010262
10263 {WE_SET_TXRX_FWSTATS,
10264 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10265 0,
10266 "txrx_fw_stats"},
10267
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010268 {WE_SET_TXRX_STATS,
chenguoaa7c90c2018-05-24 17:08:47 +080010269 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080010270 0,
10271 "txrx_stats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010272#ifdef FW_THERMAL_THROTTLE_SUPPORT
10273 {WE_SET_THERMAL_THROTTLE_CFG,
10274 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10275 0,
10276 "set_thermal_cfg"},
10277#endif /* FW_THERMAL_THROTTLE_SUPPORT */
Krishna Reddya50d09f2019-02-04 14:55:06 +053010278 {WE_SET_BTCOEX_MODE,
10279 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10280 0, "set_btc_mode" },
10281 {WE_SET_BTCOEX_RSSI_THRESHOLD,
10282 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10283 0, "set_btc_rssi" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010284 {WE_TXRX_FWSTATS_RESET,
10285 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10286 0,
10287 "txrx_fw_st_rst"},
10288
10289 {WE_PPS_PAID_MATCH,
10290 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10291 0, "paid_match"},
10292
10293 {WE_PPS_GID_MATCH,
10294 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10295 0, "gid_match"},
10296
10297 {WE_PPS_EARLY_TIM_CLEAR,
10298 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10299 0, "tim_clear"},
10300
10301 {WE_PPS_EARLY_DTIM_CLEAR,
10302 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10303 0, "dtim_clear"},
10304
10305 {WE_PPS_EOF_PAD_DELIM,
10306 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10307 0, "eof_delim"},
10308
10309 {WE_PPS_MACADDR_MISMATCH,
10310 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10311 0, "mac_match"},
10312
10313 {WE_PPS_DELIM_CRC_FAIL,
10314 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10315 0, "delim_fail"},
10316
10317 {WE_PPS_GID_NSTS_ZERO,
10318 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10319 0, "nsts_zero"},
10320
10321 {WE_PPS_RSSI_CHECK,
10322 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10323 0, "rssi_chk"},
10324
10325 {WE_PPS_5G_EBT,
10326 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10327 0, "5g_ebt"},
10328
10329 {WE_SET_HTSMPS,
10330 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10331 0, "htsmps"},
10332
10333 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
10334 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10335 0, "set_qpspollcnt"},
10336
10337 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
10338 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10339 0, "set_qtxwake"},
10340
10341 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10342 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10343 0, "set_qwakeintv"},
10344
10345 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10346 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10347 0, "set_qnodatapoll"},
10348
10349 /* handlers for MCC time quota and latency sub ioctls */
10350 {WE_MCC_CONFIG_LATENCY,
10351 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10352 0, "setMccLatency"},
10353
10354 {WE_MCC_CONFIG_QUOTA,
10355 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10356 0, "setMccQuota"},
10357
10358 {WE_SET_DEBUG_LOG,
10359 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10360 0, "setDbgLvl"},
10361
10362 /* handlers for early_rx power save */
10363 {WE_SET_EARLY_RX_ADJUST_ENABLE,
10364 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10365 0, "erx_enable"},
10366
10367 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
10368 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10369 0, "erx_bmiss_val"},
10370
10371 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
10372 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10373 0, "erx_bmiss_smpl"},
10374
10375 {WE_SET_EARLY_RX_SLOP_STEP,
10376 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10377 0, "erx_slop_step"},
10378
10379 {WE_SET_EARLY_RX_INIT_SLOP,
10380 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10381 0, "erx_init_slop"},
10382
10383 {WE_SET_EARLY_RX_ADJUST_PAUSE,
10384 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10385 0, "erx_adj_pause"},
10386
10387 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
10388 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10389 0, "erx_dri_sample"},
10390
10391 {WE_DUMP_STATS,
10392 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10393 0, "dumpStats"},
10394
10395 {WE_CLEAR_STATS,
10396 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10397 0, "clearStats"},
10398
Govind Singha471e5e2015-10-12 17:11:14 +053010399 {WE_START_FW_PROFILE,
10400 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10401 0, "startProfile"},
10402
Abhishek Singh1bdb1572015-10-16 16:24:19 +053010403 {WE_SET_CHANNEL,
10404 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10405 0, "setChanChange" },
10406
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +053010407 {WE_SET_CONC_SYSTEM_PREF,
10408 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10409 0, "setConcSysPref" },
10410
Jeff Johnson011c4502017-10-05 15:25:56 -070010411 {WE_SET_PDEV_RESET,
10412 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10413 0, "pdev_reset" },
10414
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010415 {WE_SET_MODULATED_DTIM,
Kiran Kumar Lokere08195ef2018-01-17 19:25:15 -080010416 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10417 0, "setModDTIM" },
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053010418
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010419 {WLAN_PRIV_SET_NONE_GET_INT,
10420 0,
10421 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10422 ""},
10423
10424 /* handlers for sub-ioctl */
10425 {WE_GET_11D_STATE,
10426 0,
10427 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10428 "get11Dstate"},
10429
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010430 {WE_GET_WLAN_DBG,
10431 0,
10432 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10433 "getwlandbg"},
10434
10435 {WE_GET_MAX_ASSOC,
10436 0,
10437 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10438 "getMaxAssoc"},
10439
10440 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010441 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10442 "getAutoChannel"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010443
10444 {WE_GET_CONCURRENCY_MODE,
10445 0,
10446 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10447 "getconcurrency"},
10448
10449 {WE_GET_NSS,
10450 0,
10451 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10452 "get_nss"},
10453
10454 {WE_GET_LDPC,
10455 0,
10456 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10457 "get_ldpc"},
10458
10459 {WE_GET_TX_STBC,
10460 0,
10461 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10462 "get_tx_stbc"},
10463
10464 {WE_GET_RX_STBC,
10465 0,
10466 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10467 "get_rx_stbc"},
10468
10469 {WE_GET_SHORT_GI,
10470 0,
10471 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10472 "get_shortgi"},
10473
10474 {WE_GET_RTSCTS,
10475 0,
10476 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10477 "get_rtscts"},
10478
10479 {WE_GET_CHWIDTH,
10480 0,
10481 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10482 "get_chwidth"},
10483
10484 {WE_GET_ANI_EN_DIS,
10485 0,
10486 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10487 "get_anienable"},
10488
10489 {WE_GET_ANI_POLL_PERIOD,
10490 0,
10491 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10492 "get_aniplen"},
10493
10494 {WE_GET_ANI_LISTEN_PERIOD,
10495 0,
10496 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10497 "get_anilislen"},
10498
10499 {WE_GET_ANI_OFDM_LEVEL,
10500 0,
10501 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10502 "get_aniofdmlvl"},
10503
10504 {WE_GET_ANI_CCK_LEVEL,
10505 0,
10506 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10507 "get_aniccklvl"},
10508
10509 {WE_GET_DYNAMIC_BW,
10510 0,
10511 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10512 "get_cwmenable"},
10513
10514 {WE_GET_GTX_HT_MCS,
10515 0,
10516 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10517 "get_gtxHTMcs"},
10518
10519 {WE_GET_GTX_VHT_MCS,
10520 0,
10521 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10522 "get_gtxVHTMcs"},
10523
10524 {WE_GET_GTX_USRCFG,
10525 0,
10526 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10527 "get_gtxUsrCfg"},
10528
10529 {WE_GET_GTX_THRE,
10530 0,
10531 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10532 "get_gtxThre"},
10533
10534 {WE_GET_GTX_MARGIN,
10535 0,
10536 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10537 "get_gtxMargin"},
10538
10539 {WE_GET_GTX_STEP,
10540 0,
10541 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10542 "get_gtxStep"},
10543
10544 {WE_GET_GTX_MINTPC,
10545 0,
10546 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10547 "get_gtxMinTpc"},
10548
10549 {WE_GET_GTX_BWMASK,
10550 0,
10551 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10552 "get_gtxBWMask"},
10553
10554 {WE_GET_TX_CHAINMASK,
10555 0,
10556 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10557 "get_txchainmask"},
10558
10559 {WE_GET_RX_CHAINMASK,
10560 0,
10561 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10562 "get_rxchainmask"},
10563
10564 {WE_GET_11N_RATE,
10565 0,
10566 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10567 "get_11nrate"},
10568
10569 {WE_GET_AMPDU,
10570 0,
10571 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10572 "get_ampdu"},
10573
10574 {WE_GET_AMSDU,
10575 0,
10576 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10577 "get_amsdu"},
10578
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010579 {WE_GET_TXPOW_2G,
10580 0,
10581 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10582 "get_txpow2g"},
10583
10584 {WE_GET_TXPOW_5G,
10585 0,
10586 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10587 "get_txpow5g"},
10588
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010589 {WE_GET_PPS_PAID_MATCH,
10590 0,
10591 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10592 "get_paid_match"},
10593
10594 {WE_GET_PPS_GID_MATCH,
10595 0,
10596 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10597 "get_gid_match"},
10598
10599 {WE_GET_PPS_EARLY_TIM_CLEAR,
10600 0,
10601 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10602 "get_tim_clear"},
10603
10604 {WE_GET_PPS_EARLY_DTIM_CLEAR,
10605 0,
10606 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10607 "get_dtim_clear"},
10608
10609 {WE_GET_PPS_EOF_PAD_DELIM,
10610 0,
10611 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10612 "get_eof_delim"},
10613
10614 {WE_GET_PPS_MACADDR_MISMATCH,
10615 0,
10616 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10617 "get_mac_match"},
10618
10619 {WE_GET_PPS_DELIM_CRC_FAIL,
10620 0,
10621 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10622 "get_delim_fail"},
10623
10624 {WE_GET_PPS_GID_NSTS_ZERO,
10625 0,
10626 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10627 "get_nsts_zero"},
10628
10629 {WE_GET_PPS_RSSI_CHECK,
10630 0,
10631 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10632 "get_rssi_chk"},
10633
10634 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
10635 0,
10636 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10637 "get_qpspollcnt"},
10638
10639 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
10640 0,
10641 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10642 "get_qtxwake"},
10643
10644 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
10645 0,
10646 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10647 "get_qwakeintv"},
10648
10649 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
10650 0,
10651 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10652 "get_qnodatapoll"},
10653
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010654 {WE_CAP_TSF,
10655 0,
10656 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10657 "cap_tsf"},
10658
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010659 {WE_GET_TEMPERATURE,
10660 0,
10661 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10662 "get_temp"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010663
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070010664 {WE_GET_DCM,
10665 0,
10666 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10667 "get_dcm"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010668
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070010669 {WE_GET_RANGE_EXT,
10670 0,
10671 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10672 "get_range_ext"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010673
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010674 /* handlers for main ioctl */
10675 {WLAN_PRIV_SET_CHAR_GET_NONE,
10676 IW_PRIV_TYPE_CHAR | 512,
10677 0,
10678 ""},
10679
10680 /* handlers for sub-ioctl */
10681 {WE_WOWL_ADD_PTRN,
10682 IW_PRIV_TYPE_CHAR | 512,
10683 0,
10684 "wowlAddPtrn"},
10685
10686 {WE_WOWL_DEL_PTRN,
10687 IW_PRIV_TYPE_CHAR | 512,
10688 0,
10689 "wowlDelPtrn"},
10690
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010691 /* handlers for sub-ioctl */
10692 {WE_NEIGHBOR_REPORT_REQUEST,
10693 IW_PRIV_TYPE_CHAR | 512,
10694 0,
10695 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080010696
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010697 {WE_SET_AP_WPS_IE,
10698 IW_PRIV_TYPE_CHAR | 512,
10699 0,
10700 "set_ap_wps_ie"},
10701
Dustin Brown0ea8d3b2018-07-06 13:58:49 -070010702#ifdef WLAN_UNIT_TEST
10703 {WE_UNIT_TEST,
10704 IW_PRIV_TYPE_CHAR | 512,
10705 0,
10706 "unit_test"},
10707#endif
10708
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010709 /* handlers for main ioctl */
10710 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
10711 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10712 0,
10713 ""},
10714
10715 /* handlers for sub-ioctl */
10716 {WE_SET_WLAN_DBG,
10717 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10718 0,
10719 "setwlandbg"},
10720
Nirav Shahd21a2e32018-04-20 16:34:43 +053010721#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010722 /* handlers for sub-ioctl */
10723 {WE_SET_DP_TRACE,
10724 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10725 0,
10726 "set_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053010727#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010728
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053010729 {WE_SET_FW_TEST,
10730 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10731 0, "fw_test"},
10732
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010733 /* handlers for main ioctl */
10734 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
10735 0,
10736 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010737 ""},
10738
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070010739 {WE_GET_TSF,
10740 0,
10741 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010742 "get_tsf"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010743
10744 {WE_SET_DUAL_MAC_SCAN_CONFIG,
10745 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
10746 0,
10747 "set_scan_cfg"},
10748
10749 /* handlers for main ioctl */
10750 {WLAN_PRIV_GET_CHAR_SET_NONE,
10751 0,
10752 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10753 ""},
10754
10755 /* handlers for sub-ioctl */
10756 {WE_WLAN_VERSION,
10757 0,
10758 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10759 "version"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010760
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010761 {WE_GET_STATS,
10762 0,
10763 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10764 "getStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010765
Dustin Brownd9322482017-01-09 12:46:03 -080010766 {WE_GET_SUSPEND_RESUME_STATS,
10767 0,
10768 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10769 "getSuspendStats"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010770
Govind Singha471e5e2015-10-12 17:11:14 +053010771 {WE_LIST_FW_PROFILE,
10772 0,
10773 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10774 "listProfile"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010775
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010776 {WE_GET_STATES,
10777 0,
10778 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10779 "getHostStates"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010780
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010781 {WE_GET_CFG,
10782 0,
10783 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10784 "getConfig"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010785
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010786 {WE_GET_RSSI,
10787 0,
10788 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10789 "getRSSI"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010790
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010791 {WE_GET_WMM_STATUS,
10792 0,
10793 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10794 "getWmmStatus"},
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010795
10796 {WE_GET_CHANNEL_LIST,
10797 0,
10798 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10799 "getChannelList"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010800#ifdef FEATURE_WLAN_TDLS
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010801 {WE_GET_TDLS_PEERS,
10802 0,
10803 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10804 "getTdlsPeers"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010805#endif
10806#ifdef WLAN_FEATURE_11W
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010807 {WE_GET_11W_INFO,
10808 0,
10809 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10810 "getPMFInfo"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010811#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010812 {WE_GET_STA_CXN_INFO,
10813 0,
10814 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10815 "get_cxn_info" },
Krunal Soni5e483782018-10-25 15:42:44 -070010816
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010817 {WE_GET_IBSS_STA_INFO,
10818 0,
10819 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10820 "getIbssSTAs"},
10821
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010822 {WE_GET_PHYMODE,
10823 0,
10824 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10825 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010826#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010827 {WE_GET_OEM_DATA_CAP,
10828 0,
10829 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10830 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080010831#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010832 {WE_GET_SNR,
10833 0,
10834 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10835 "getSNR"},
10836
Krunal Soni6c3859f2018-06-01 19:57:40 -070010837 {WE_GET_BA_AGEING_TIMEOUT,
10838 0,
10839 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
10840 "get_ba_timeout"},
10841
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010842 /* handlers for main ioctl */
10843 {WLAN_PRIV_SET_NONE_GET_NONE,
10844 0,
10845 0,
10846 ""},
10847
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010848 /* handlers for sub-ioctl */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010849 {WE_IBSS_GET_PEER_INFO_ALL,
10850 0,
10851 0,
10852 "ibssPeerInfoAll"},
10853
Govind Singha471e5e2015-10-12 17:11:14 +053010854 {WE_GET_FW_PROFILE_DATA,
10855 0,
10856 0,
10857 "getProfileData"},
10858
10859 {WE_SET_REASSOC_TRIGGER,
10860 0,
10861 0,
10862 "reassoc"},
10863
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010864 {WE_STOP_OBSS_SCAN,
10865 0,
10866 0,
10867 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010868 /* handlers for main ioctl */
10869 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
10870 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10871 0,
10872 ""},
10873
10874 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010875 {WE_IBSS_GET_PEER_INFO,
10876 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10877 0,
10878 "ibssPeerInfo"},
10879
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010880#ifdef TRACE_RECORD
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010881 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010882 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
10883 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10884 0,
10885 "setdumplog"},
10886
10887 {WE_MTRACE_DUMP_CMD,
10888 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10889 0,
10890 "dumplog"},
Rachit Kankane0baf6e72018-01-19 15:01:50 +053010891#endif
Krunal Sonia6e505b2017-01-12 12:25:18 -080010892
10893 {WE_POLICY_MANAGER_CINFO_CMD,
10894 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10895 0,
10896 "pm_cinfo"},
10897
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010898#ifdef MPC_UT_FRAMEWORK
10899 {WE_POLICY_MANAGER_CLIST_CMD,
10900 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10901 0,
10902 "pm_clist"},
10903
10904 {WE_POLICY_MANAGER_DLIST_CMD,
10905 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10906 0,
10907 "pm_dlist"},
10908
10909 {WE_POLICY_MANAGER_DBS_CMD,
10910 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10911 0,
10912 "pm_dbs"},
10913
10914 {WE_POLICY_MANAGER_PCL_CMD,
10915 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10916 0,
10917 "pm_pcl"},
10918
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010919 {WE_POLICY_MANAGER_ULIST_CMD,
10920 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10921 0,
10922 "pm_ulist"},
10923
10924 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
10925 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10926 0,
10927 "pm_query_action"},
10928
10929 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
10930 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10931 0,
10932 "pm_query_allow"},
10933
10934 {WE_POLICY_MANAGER_SCENARIO_CMD,
10935 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10936 0,
10937 "pm_run_scenario"},
10938
10939 {WE_POLICY_SET_HW_MODE_CMD,
10940 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10941 0,
10942 "pm_set_hw_mode"},
10943#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010944 {WE_UNIT_TEST_CMD,
10945 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10946 0,
10947 "setUnitTestCmd"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010948
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010949 {WE_MAC_PWR_DEBUG_CMD,
10950 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10951 0,
10952 "halPwrDebug"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010953#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10954 {WE_LED_FLASHING_PARAM,
10955 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10956 0,
10957 "gpio_control"},
10958#endif
Liangwei Dong2a7f2912018-02-07 17:08:17 +080010959#ifdef WLAN_DEBUG
10960 {WE_SET_CHAN_AVOID,
10961 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
10962 0,
10963 "ch_avoid"},
10964#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010965 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070010966 {WLAN_PRIV_FIPS_TEST,
10967 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10968 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10969 "fips_test"},
10970
10971 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010972 {WLAN_PRIV_ADD_TSPEC,
10973 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
10974 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10975 "addTspec"},
10976
10977 /* handlers for main ioctl */
10978 {WLAN_PRIV_DEL_TSPEC,
10979 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10980 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10981 "delTspec"},
10982
10983 /* handlers for main ioctl */
10984 {WLAN_PRIV_GET_TSPEC,
10985 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10986 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
10987 "getTspec"},
10988
10989 /* handlers for main ioctl - host offload */
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010990 {WLAN_PRIV_SET_HOST_OFFLOAD,
10991 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
10992 0,
10993 "setHostOffload"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010994
Visweswara Tanuku025f5862019-01-08 17:35:33 +053010995 {WLAN_GET_WLAN_STATISTICS,
10996 0,
10997 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
10998 "getWlanStats"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010999
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011000 {WLAN_SET_KEEPALIVE_PARAMS,
Jeff Johnson562ccad2019-02-06 22:10:24 -080011001 IW_PRIV_TYPE_BYTE | sizeof(struct keep_alive_req) |
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011002 IW_PRIV_SIZE_FIXED,
11003 0,
11004 "setKeepAlive"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011005#ifdef WLAN_FEATURE_PACKET_FILTERING
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011006 {WLAN_SET_PACKET_FILTER_PARAMS,
11007 IW_PRIV_TYPE_BYTE |
11008 sizeof(struct pkt_filter_cfg),
11009 0,
11010 "setPktFilter"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011011#endif
11012#ifdef FEATURE_WLAN_SCAN_PNO
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011013 {WLAN_SET_PNO,
11014 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
11015 0,
11016 "setpno"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011017#endif
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011018 {WLAN_SET_BAND_CONFIG,
11019 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11020 0,
11021 "SETBAND"},
Dustin Brown0cbc7572016-12-16 13:54:40 -080011022
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011023 {WLAN_PRIV_SET_MCBC_FILTER,
11024 0,
11025 0,
11026 "setMCBCFilter"},
11027
11028 {WLAN_GET_LINK_SPEED,
11029 IW_PRIV_TYPE_CHAR | 18,
11030 IW_PRIV_TYPE_CHAR | 5,
11031 "getLinkSpeed"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011032
Krunal Sonif9ba53d2019-01-03 21:44:41 -080011033#ifdef FEATURE_WLM_STATS
11034 {WLAN_GET_WLM_STATS,
11035 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
11036 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
11037 "get_wlm_stats"},
11038#endif
11039
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011040 /* handlers for main ioctl */
11041 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
11042 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
11043 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011044 ""},
11045
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011046 {WE_SET_SMPS_PARAM,
11047 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011048 0, "set_smps_param"},
11049
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011050 {WLAN_SET_DOT11P_CHANNEL_SCHED,
11051 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011052 0, "set_dot11p" },
11053
Jeff Johnsondf5d7792018-04-14 15:58:24 -070011054#ifdef CONFIG_WLAN_DEBUG_CRASH_INJECT
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011055 {WE_SET_FW_CRASH_INJECT,
11056 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011057 0, "crash_inject"},
11058
Jeff Johnsondf5d7792018-04-14 15:58:24 -070011059#endif
Rachit Kankaneb1035622018-01-24 18:41:35 +053011060#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
Dustin Brown8d2d0f52017-04-03 17:02:08 -070011061 {WE_LOG_BUFFER,
11062 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011063 0, "log_buffer"},
11064
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011065#endif
Krunal Soni6c3859f2018-06-01 19:57:40 -070011066 {WE_SET_BA_AGEING_TIMEOUT,
11067 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011068 0, "set_ba_timeout"},
11069
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011070#ifdef WLAN_SUSPEND_RESUME_TEST
11071 {WE_SET_WLAN_SUSPEND,
11072 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011073 0, "wlan_suspend"},
11074
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011075 {WE_SET_WLAN_RESUME,
11076 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011077 0, "wlan_resume"},
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011078#endif
Govind Singha471e5e2015-10-12 17:11:14 +053011079 {WE_ENABLE_FW_PROFILE,
11080 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011081 0, "enableProfile"},
11082
Govind Singha471e5e2015-10-12 17:11:14 +053011083 {WE_SET_FW_PROFILE_HIST_INTVL,
11084 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011085 0, "set_hist_intvl"},
11086
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011087 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
11088 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011089 0, "set_fw_mode_cfg"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053011090#ifdef CONFIG_DP_TRACE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011091 {WE_DUMP_DP_TRACE_LEVEL,
11092 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011093 0, "dump_dp_trace"},
Nirav Shahd21a2e32018-04-20 16:34:43 +053011094#endif
Nirav Shah73713f72018-05-17 14:50:41 +053011095#ifdef FEATURE_MONITOR_MODE_SUPPORT
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011096 {WE_SET_MON_MODE_CHAN,
11097 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011098 0, "setMonChan"},
Nirav Shah73713f72018-05-17 14:50:41 +053011099#endif
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070011100 {WE_GET_ROAM_SYNCH_DELAY,
11101 0,
11102 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011103 "hostroamdelay"},
11104
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080011105 {WE_SET_11AX_RATE,
11106 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11107 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011108 "set_11ax_rate"},
11109
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070011110 {WE_SET_DCM,
11111 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11112 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011113 "enable_dcm"},
11114
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070011115 {WE_SET_RANGE_EXT,
11116 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11117 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011118 "range_ext"},
11119
Naveen Rawatc921c7b2017-06-13 17:29:51 -070011120 {WLAN_PRIV_SET_FTIES,
11121 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
11122 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011123 "set_ft_ies"},
11124
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011125#ifdef WLAN_FEATURE_MOTION_DETECTION
11126 {WE_MOTION_DET_START_STOP,
11127 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11128 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011129 "mt_start"},
11130
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011131 {WE_MOTION_DET_BASE_LINE_START_STOP,
11132 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11133 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011134 "mt_bl_start"},
11135
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011136 {WE_MOTION_DET_CONFIG_PARAM,
11137 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
11138 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011139 "mt_config"},
11140
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011141 {WE_MOTION_DET_BASE_LINE_CONFIG_PARAM,
11142 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
11143 0,
Visweswara Tanuku025f5862019-01-08 17:35:33 +053011144 "mt_bl_config"},
Visweswara Tanuku633976b2019-01-07 16:13:12 +053011145#endif /* WLAN_FEATURE_MOTION_DETECTION */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011146};
11147
11148const struct iw_handler_def we_handler_def = {
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070011149 .num_standard = 0,
Anurag Chouhan6d760662016-02-20 16:05:43 +053011150 .num_private = QDF_ARRAY_SIZE(we_private),
11151 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011152
Jeff Johnsoneefd3be2018-03-22 06:41:12 -070011153 .standard = NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011154 .private = (iw_handler *) we_private,
11155 .private_args = we_private_args,
11156 .get_wireless_stats = NULL,
11157};
11158
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011159void hdd_register_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011160{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011161 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011162
Dustin Browne7e71d32018-05-11 16:00:08 -070011163 dev->wireless_handlers = &we_handler_def;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011164
Dustin Browne74003f2018-03-14 12:51:58 -070011165 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011166}
11167
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011168void hdd_unregister_wext(struct net_device *dev)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011169{
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011170 hdd_enter_dev(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011171
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011172 rtnl_lock();
11173 dev->wireless_handlers = NULL;
11174 rtnl_unlock();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011175
Jeff Johnson7f2c5912018-03-23 11:42:28 -070011176 hdd_exit();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011177}