blob: cb5293013ff0a6fca7becb05b8cfa1297ee6df8a [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Dustin Brownd9322482017-01-09 12:46:03 -08002 * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/**
29 * DOC: wlan_hdd_wext.c
30 *
31 * Linux Wireless Extensions Implementation
32 */
33
34#include <linux/version.h>
35#include <linux/module.h>
36#include <linux/kernel.h>
37#include <linux/init.h>
38#include <linux/wireless.h>
39#include <mac_trace.h>
40#include <wlan_hdd_includes.h>
41#include <cds_api.h>
Rajeev Kumarea95edd2017-01-11 20:49:36 -080042#include "scheduler_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080043#include <net/arp.h>
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080044#include <cdp_txrx_cmn.h>
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070045#include <cdp_txrx_stats.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080046#include "sir_params.h"
47#include "csr_api.h"
48#include "csr_inside_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080049#include "sme_rrm_internal.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080050#include <ani_global.h>
51#include "dot11f.h"
52#include <wlan_hdd_wowl.h>
53#include <wlan_hdd_cfg.h>
54#include <wlan_hdd_wmm.h>
55#include "utils_api.h"
56#include "wlan_hdd_p2p.h"
57#ifdef FEATURE_WLAN_TDLS
58#include "wlan_hdd_tdls.h"
59#endif
60
61#include "cds_ieee80211_common.h"
62#include "ol_if_athvar.h"
63#include "dbglog_host.h"
64#include "wma.h"
65
66#include "wlan_hdd_power.h"
67#include "qwlan_version.h"
68#include "wlan_hdd_host_offload.h"
69
70#include <linux/wireless.h>
71#include <net/cfg80211.h>
72
73#include "wlan_hdd_misc.h"
74
75#include "qc_sap_ioctl.h"
76#include "sme_api.h"
77#include "wma_types.h"
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053078#include "qdf_trace.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079#include "wlan_hdd_assoc.h"
80#include "wlan_hdd_ioctl.h"
81#include "wlan_hdd_scan.h"
82#include "sme_power_save_api.h"
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080083#include "wlan_policy_mgr_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080084#include "wlan_hdd_conc_ut.h"
Jeff Johnson6fa1e012017-04-05 06:40:53 -070085#include "wlan_hdd_fips.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070086#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080087#include "wlan_hdd_ocb.h"
88#include "wlan_hdd_napi.h"
Dhanashri Atreb08959a2016-03-01 17:28:03 -080089#include "cdp_txrx_flow_ctrl_legacy.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070090#include "wlan_hdd_nan_datapath.h"
Nirav Shahbf1b0332016-05-25 14:27:39 +053091#include "wlan_hdd_stats.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070092#ifdef WLAN_SUSPEND_RESUME_TEST
93#include "wlan_hdd_driver_ops.h"
94#include "hif.h"
Rajeev Kumar9bb2e852016-09-24 12:29:25 -070095#include "pld_common.h"
Rajeev Kumara78a0a42016-07-13 19:28:20 -070096#endif
Dhanashri Atree7d442a2016-07-14 18:20:29 -070097#include "wlan_hdd_lro.h"
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +053098#include "cds_utils.h"
Jeff Johnsona6ace5b2017-01-23 07:11:02 -080099#include "wlan_hdd_request_manager.h"
Naveen Rawat910726a2017-03-06 11:42:51 -0800100#include "os_if_wifi_pos.h"
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -0800101#include <cdp_txrx_stats.h>
102#include <cds_api.h>
Abhishek Singh0481d662017-04-11 18:20:11 +0530103#include <wlan_osif_priv.h>
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -0700104#include "wlan_hdd_regulatory.h"
105#include "wlan_reg_ucfg_api.h"
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +0530106#include "wlan_hdd_packet_filter_api.h"
Abhishek Singh0481d662017-04-11 18:20:11 +0530107
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800108#define HDD_FINISH_ULA_TIME_OUT 800
109#define HDD_SET_MCBC_FILTERS_TO_FW 1
110#define HDD_DELETE_MCBC_FILTERS_FROM_FW 0
111
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800112/* To Validate Channel against the Frequency and Vice-Versa */
Srinivas Girigowda48592672017-03-25 14:58:44 -0700113static const struct ccp_freq_chan_map freq_chan_map[] = {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800114 {2412, 1}, {2417, 2}, {2422, 3}, {2427, 4}, {2432, 5}, {2437, 6},
115 {2442, 7}, {2447, 8}, {2452, 9}, {2457, 10}, {2462, 11}, {2467, 12},
116 {2472, 13}, {2484, 14}, {4920, 240}, {4940, 244}, {4960, 248},
117 {4980, 252}, {5040, 208}, {5060, 212}, {5080, 216}, {5180, 36},
118 {5200, 40}, {5220, 44}, {5240, 48}, {5260, 52}, {5280, 56},
119 {5300, 60}, {5320, 64}, {5500, 100}, {5520, 104}, {5540, 108},
120 {5560, 112}, {5580, 116}, {5600, 120}, {5620, 124}, {5640, 128},
121 {5660, 132}, {5680, 136}, {5700, 140}, {5720, 144}, {5745, 149},
122 {5765, 153}, {5785, 157}, {5805, 161}, {5825, 165}, {5852, 170},
123 {5855, 171}, {5860, 172}, {5865, 173}, {5870, 174}, {5875, 175},
124 {5880, 176}, {5885, 177}, {5890, 178}, {5895, 179}, {5900, 180},
125 {5905, 181}, {5910, 182}, {5915, 183}, {5920, 184} };
126
Srinivas Girigowdafba82a02017-03-24 21:26:35 -0700127#define FREQ_CHAN_MAP_TABLE_SIZE QDF_ARRAY_SIZE(freq_chan_map)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800128
129/* Private ioctls and their sub-ioctls */
130#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
131#define WE_SET_11D_STATE 1
132#define WE_WOWL 2
133#define WE_SET_POWER 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530134/*
135 * <ioctl>
136 * setMaxAssoc - Sets the maximum number of associated stations
137 *
138 * @INPUT: 1 to 32
139 *
140 * @OUTPUT: None
141 *
142 * This IOTCL sets the maximum number of associated stations
143 *
144 * @E.g: iwpriv wlan0 setMaxAssoc <value>
145 *
146 * Supported Feature: STA
147 *
148 * Usage: Internal/External
149 *
150 * </ioctl>
151 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800152#define WE_SET_MAX_ASSOC 4
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +0530153/*
154 * <ioctl>
155 * scan_diable - Disable scan
156 *
157 * @INPUT: set_value
158 *
159 * @OUTPUT: None
160 *
161 * This IOCTL is used to set disable scan
162 *
163 * @E.g: iwpriv wlan0 scan_disable 1
164 *
165 * Supported Feature: Scan
166 *
167 * Usage: Internal/External
168 *
169 * </ioctl>
170 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800171#define WE_SET_SCAN_DISABLE 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530172/*
173 * <ioctl>
174 * inactivityTO - sets the timeout value for inactivity data while
175 * in power save mode
176 *
177 * @INPUT: int1…..int255
178 *
179 * @OUTPUT: None
180 *
181 * This IOCTL set the timeout value for inactivity data in power save mode
182 *
183 * @E.g: iwpriv wlan0 inactivityTO 20
184 *
185 * Supported Feature: STA
186 *
187 * Usage: Internal/External
188 *
189 * </ioctl>
190 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800191#define WE_SET_DATA_INACTIVITY_TO 6
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530192/*
193 * <ioctl>
194 * setMaxTxPower - Dynamically sets the maximum transmission power
195 *
196 * @INPUT: Transmission power in dBm
197 *
198 * @OUTPUT: None
199 *
200 * This IOCTL dynamically sets the maximum transmission power
201 * This setting does not persist over reboots
202 *
203 * @E.g: iwpriv wlan0 setMaxTxPower <value in db)
204 *
205 * Supported Feature: STA
206 *
207 * Usage: Internal/External
208 *
209 * </ioctl>
210 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800211#define WE_SET_MAX_TX_POWER 7
212#define WE_SET_HIGHER_DTIM_TRANSITION 8
213#define WE_SET_TM_LEVEL 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530214/*
215 * <ioctl>
216 * setphymode - Set the phymode dynamically
217 *
218 * @INPUT: 0 IEEE80211_MODE_AUTO to 22 IEEE80211_MODE_11AGN
219 *
220 * @OUTPUT: None
221 *
222 * This IOCTL sets the phymode dynamically
223 *
224 * @E.g: iwpriv wlan0 setphymode 10
225 *
226 * Supported Feature: STA
227 *
228 * Usage: Internal/External
229 *
230 * </ioctl>
231 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800232#define WE_SET_PHYMODE 10
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530233/*
234 * <ioctl>
235 * nss - Set the number of spatial streams
236 *
237 * @INPUT: int1…..int3
238 *
239 * @OUTPUT: None
240 *
241 * This IOCTL sets the number of spatial streams. Supported values are 1 and 2
242 *
243 * @E.g: iwpriv wlan0 nss 2
244 *
245 * Supported Feature: STA
246 *
247 * Usage: Internal/External
248 *
249 * </ioctl>
250 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800251#define WE_SET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530252/*
253 * <ioctl>
254 * ldpc - Enables or disables LDPC
255 *
256 * @INPUT: 0 – Disable, 1 - Enable
257 *
258 * @OUTPUT: None
259 *
260 * This IOCTL enables or disables LDPC
261 *
262 * @E.g: iwpriv wlan0 ldpc 1
263 *
264 * Supported Feature: STA
265 *
266 * Usage: Internal/External
267 *
268 * </ioctl>
269 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800270#define WE_SET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530271/*
272 * <ioctl>
273 * tx_stbc - Enables or disables tx_stbc
274 *
275 * @INPUT: Int 0 – Disable, 1 - Enable
276 *
277 * @OUTPUT: None
278 *
279 * This IOTCL used to enables or disables tx_stbc
280 *
281 * @E.g: iwpriv wlan0 tx_stbc <value>
282 *
283 * Supported Feature: STA
284 *
285 * Usage: Internal/External
286 *
287 * </ioctl>
288 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800289#define WE_SET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530290/*
291 * <ioctl>
292 * rx_stbc - Set the rx_stbc parameter
293 *
294 * @INPUT: Int 0 – Disable, 1 - Enable
295 *
296 * @OUTPUT: None
297 *
298 * This IOTCL used to set rx_stbc parameter
299 *
300 * @E.g: iwpriv wlan0 rx_stbc <value>
301 *
302 * Supported Feature: STA
303 *
304 * Usage: Internal/External
305 *
306 * </ioctl>
307 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800308#define WE_SET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530309/*
310 * <ioctl>
311 * shortgi - Enables or disables a short-guard interval
312 *
313 * @INPUT: Int 0 – Disable, 1 - Enable
314 *
315 * @OUTPUT: None
316 *
317 * This IOCTL enables or disables a short-guard interval.
318 *
319 * @E.g: iwpriv wlan0 shortgi <value>
320 *
321 * Supported Feature: STA
322 *
323 * Usage: Internal/External
324 *
325 * </ioctl>
326 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800327#define WE_SET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530328/*
329 * <ioctl>
330 * enablertscts - enables or disables rts/cts.
331 *
332 * @INPUT: 1-Enable , 0-Disable
333 *
334 * @OUTPUT: None
335 *
336 * This IOCTL enables or disables rts/cts.
337 *
338 * @E.g: iwpriv wlan0 enablertscts <value>
339 *
340 * Supported Feature: STA
341 *
342 * Usage: Internal/External
343 *
344 * </ioctl>
345 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800346#define WE_SET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530347/*
348 * <ioctl>
349 * chwidth - Set the channel bandwidth
350 *
351 * @INPUT: 0-20mhz to 3-160mhz
352 *
353 * @OUTPUT: None
354 *
355 * This IOTCL used to set the channel bandwidth
356 *
357 * @E.g: iwpriv wlan0 chwidth 1
358 *
359 * Supported Feature: STA
360 *
361 * Usage: Internal/External
362 *
363 * </ioctl>
364 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800365#define WE_SET_CHWIDTH 17
366#define WE_SET_ANI_EN_DIS 18
367#define WE_SET_ANI_POLL_PERIOD 19
368#define WE_SET_ANI_LISTEN_PERIOD 20
369#define WE_SET_ANI_OFDM_LEVEL 21
370#define WE_SET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530371/*
372 * <ioctl>
373 * cwmenable - Enables or disables the dynamic channel bandwidth
374 *
375 * @INPUT: 0-Disable, 1-Enable
376 *
377 * @OUTPUT: None
378 *
379 * This IOTCL used to enables or disables the dynamic channel bandwidth
380 *
381 * @E.g: iwpriv wlan0 cwmenable <value>
382 *
383 * Supported Feature: STA
384 *
385 * Usage: Internal/External
386 *
387 * </ioctl>
388 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800389#define WE_SET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530390/*
391 * <ioctl>
392 * txchainmask - This IOCTL sets the current Tx chain mask
393 *
394 * @INPUT: Mask Value
395 *
396 * @OUTPUT: None
397 *
398 * This IOCTL sets the current Tx chain mask
399 *
400 * @E.g: iwpriv wlan0 txchainmask 1
401 *
402 * Supported Feature: STA
403 *
404 * Usage: Internal/External
405 *
406 * </ioctl>
407 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800408#define WE_SET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530409/*
410 * <ioctl>
411 * rxchainmask - Sets the current Rx chain mask
412 *
413 * @INPUT: Mask Value
414 *
415 * @OUTPUT: None
416 *
417 * This IOCTL sets the current Rx chain mask. This command is the
418 * equivalent to setting in gSetRxChainmask1x1 in WCNSS_qcom_cfg.ini.
419 *
420 * @E.g: iwpriv wlan0 rxchainmask <value>
421 *
422 * Supported Feature: STA
423 *
424 * Usage: Internal/External
425 *
426 * </ioctl>
427 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800428#define WE_SET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530429/*
430 * <ioctl>
431 * set11NRates - Fixes the Tx data rate of the 11N mode.
432 *
433 * @INPUT: 0x1b to 0x8f
434 *
435 * @OUTPUT: None
436 *
437 * This IOCTL fixes the Tx data rate of the 11N mode.
438 *
439 * @E.g: iwpriv wlan0 set11NRates 0x85
440 *
441 * Supported Feature: STA
442 *
443 * Usage: Internal/External
444 *
445 * </ioctl>
446 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800447#define WE_SET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530448/*
449 * <ioctl>
450 * ampdu - Set the the maximum subframe of ampdu
451 *
452 * @INPUT: int 1 to int 63
453 *
454 * @OUTPUT: None
455 *
456 * This IOCTL sets the maximum subframe of ampdu.
457 *
458 * @E.g: iwpriv wlan0 ampdu 9
459 *
460 * Supported Feature: STA
461 *
462 * Usage: Internal/External
463 *
464 * </ioctl>
465 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800466#define WE_SET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530467/*
468 * <ioctl>
469 * amsdu - Sets the maximum subframe of amsdu.
470 *
471 * @INPUT: int 1 to int 31
472 *
473 * @OUTPUT: None
474 *
475 * This IOCTL sets the maximum subframe of amsdu.
476 *
477 * @E.g: iwpriv wlan0 amsdu 9
478 *
479 * Supported Feature: STA
480 *
481 * Usage: Internal/External
482 *
483 * </ioctl>
484 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800485#define WE_SET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530486/*
487 * <ioctl>
488 * txpow2g - current 2 GHz Tx power setting
489 *
490 * @INPUT: Tx power in dBm
491 *
492 * @OUTPUT: None
493 *
494 * This IOTCL used to set 2 ghz tx power
495 *
496 * @E.g: iwpriv wlan0 txpow2g
497 *
498 * Supported Feature: STA
499 *
500 * Usage: Internal/External
501 *
502 * </ioctl>
503 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800504#define WE_SET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530505/*
506 * <ioctl>
507 * txpow5g - Current 5 GHz tx power setting
508 *
509 * @INPUT: Tx power in dBm
510 *
511 * @OUTPUT: None
512 *
513 * This IOTCL used to set the 5 ghz txpower
514 *
515 * @E.g: iwpriv wlan0 txpow5g
516 *
517 * Supported Feature: STA
518 *
519 * Usage: Internal/External
520 *
521 * </ioctl>
522 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800523#define WE_SET_TXPOW_5G 30
524/* Private ioctl for firmware debug log */
525#define WE_DBGLOG_LOG_LEVEL 31
526#define WE_DBGLOG_VAP_ENABLE 32
527#define WE_DBGLOG_VAP_DISABLE 33
528#define WE_DBGLOG_MODULE_ENABLE 34
529#define WE_DBGLOG_MODULE_DISABLE 35
530#define WE_DBGLOG_MOD_LOG_LEVEL 36
531#define WE_DBGLOG_TYPE 37
532#define WE_SET_TXRX_FWSTATS 38
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530533/*
534 * <ioctl>
535 * set11ACRates - Fixes the Tx data rate of 11AC
536 *
537 * @INPUT: 0x1 to 0x9
538 *
539 * @OUTPUT: None
540 *
541 * This IOCTL fixes the Tx data rate of 11AC.
542 *
543 * @E.g: iwpriv wlan0 set11ACRates 0x9
544 *
545 * Supported Feature: STA
546 *
547 * Usage: Internal/External
548 *
549 * </ioctl>
550 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800551#define WE_SET_VHT_RATE 39
552#define WE_DBGLOG_REPORT_ENABLE 40
553#define WE_TXRX_FWSTATS_RESET 41
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530554/*
555 * <ioctl>
556 * setTxMaxPower2G - Set the maximum transmit power for the 2.4-GHz band
557 *
558 * @INPUT: Transmission power in dBm
559 *
560 * @OUTPUT: None
561 *
562 * This IOCTL sets the maximum transmit power for the 2.4-GHz band
563 * This setting does not persist over reboots
564 *
565 * @E.g: iwpriv wlan0 setTxMaxPower2G 10
566 *
567 * Supported Feature: STA
568 *
569 * Usage: Internal/External
570 *
571 * </ioctl>
572 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800573#define WE_SET_MAX_TX_POWER_2_4 42
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530574/*
575 * <ioctl>
576 * setTxMaxPower5G - Set the maximum transmit power for the 5-GHz band
577 *
578 * @INPUT: Transmission power in dBm
579 *
580 * @OUTPUT: None
581 *
582 * This IOCTL sets the maximum transmit power for the 5-GHz band
583 * This setting does not persist over reboots
584 *
585 * @E.g: iwpriv wlan0 setTxMaxPower5G 10
586 *
587 * Supported Feature: STA
588 *
589 * Usage: Internal/External
590 *
591 * </ioctl>
592 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800593#define WE_SET_MAX_TX_POWER_5_0 43
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -0800594#define WE_SET_PKTLOG 44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800595/* Private ioctl for packet powe save */
596#define WE_PPS_PAID_MATCH 45
597#define WE_PPS_GID_MATCH 46
598#define WE_PPS_EARLY_TIM_CLEAR 47
599#define WE_PPS_EARLY_DTIM_CLEAR 48
600#define WE_PPS_EOF_PAD_DELIM 49
601#define WE_PPS_MACADDR_MISMATCH 50
602#define WE_PPS_DELIM_CRC_FAIL 51
603#define WE_PPS_GID_NSTS_ZERO 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530604/*
605 * <ioctl>
606 * rssi_chk - Chek the rssi
607 *
608 * @INPUT: One argument as input
609 *
610 * @OUTPUT: rssi
611 * wlan0 rssi_chk:56
612 *
613 * This IOTCL used to chek rssi
614 *
615 * @E.g: iwpriv wlan0 rssi_chk <value>
616 *
617 * Supported Feature: STA
618 *
619 * Usage: Internal/External
620 *
621 * </ioctl>
622 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800623#define WE_PPS_RSSI_CHECK 53
Agrawal Ashishbafaff12016-12-27 17:43:08 +0530624/*
625 * <ioctl>
626 * setAutoChannel - set ACS enable/disable
627 *
628 * @INPUT: None
629 *
630 * @OUTPUT: None
631 *
632 * This IOCTL is used to set SAP ACS eanble/disable
633 *
634 * @E.g: iwpriv wlan0 setAutoChannel 0
635 *
636 * Supported Feature: SAP
637 *
638 * Usage: Internal/External
639 *
640 * </ioctl>
641 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800642#define WE_SET_SAP_AUTO_CHANNEL_SELECTION 54
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530643/*
644 * <ioctl>
645 * htsmps - Sets the htsmps
646 *
647 * @INPUT: Atleast one int argument
648 *
649 * @OUTPUT: None
650 *
651 * This IOTCL used to set htsmps
652 *
653 * @E.g: iwpriv wlan0 htsmps <value>
654 *
655 * Supported Feature: STA
656 *
657 * Usage: Internal/External
658 *
659 * </ioctl>
660 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800661#define WE_SET_HTSMPS 55
662/* Private ioctl for QPower */
663#define WE_SET_QPOWER_MAX_PSPOLL_COUNT 56
664#define WE_SET_QPOWER_MAX_TX_BEFORE_WAKE 57
665#define WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 58
666#define WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 59
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530667/*
668 * <ioctl>
669 * burst_enable - Enables or disables the burst feature
670 *
671 * @INPUT: 0-Disable, 1-Enable
672 *
673 * @OUTPUT: None
674 *
675 * This IOCTL enables or disables the burst feature.
676 *
677 * @E.g: iwpriv wlan0 burst_enable 0
678 *
679 * Supported Feature: STA
680 *
681 * Usage: Internal/External
682 *
683 * </ioctl>
684 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800685#define WE_SET_BURST_ENABLE 60
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530686/*
687 * <ioctl>
688 * burst_dur - Enables or disables the burst feature
689 *
690 * @INPUT: int 1…..int 8191 in microseconds
691 *
692 * @OUTPUT: None
693 *
694 * This IOCTL sets the burst duration.
695 *
696 * @E.g: iwpriv wlan0 burst_dur <value>
697 *
698 * Supported Feature: STA
699 *
700 * Usage: Internal/External
701 *
702 * </ioctl>
703 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800704#define WE_SET_BURST_DUR 61
705/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530706/*
707 * <ioctl>
708 * gtxHTMcs - Set the tx HTM value
709 *
710 * @INPUT: Atleast one int orgument
711 *
712 * @OUTPUT: None
713 *
714 * This IOTCL sets htm tx value
715 *
716 * @E.g: iwpriv wlan0 gtxHTMcs <value>
717 *
718 * Supported Feature: STA
719 *
720 * Usage: Internal/External
721 *
722 * </ioctl>
723 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800724#define WE_SET_GTX_HT_MCS 62
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530725/*
726 * <ioctl>
727 * gtxVHTMcs - Set gtxVHTMcs value
728 *
729 * @INPUT: Atleast one int argument
730 *
731 * @OUTPUT: None
732 *
733 * This IOTCL used to set gtxVHTMcs value
734 *
735 * @E.g: iwpriv wlan0 gtxVHTMcs <value>
736 *
737 * Supported Feature: STA
738 *
739 * Usage: Internal/External
740 *
741 * </ioctl>
742 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800743#define WE_SET_GTX_VHT_MCS 63
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530744/*
745 * <ioctl>
746 * gtxUsrCfg - Host request for GTX mask
747 *
748 * @INPUT: Atleast one int orgument
749 *
750 * @OUTPUT: None
751 *
752 * This IOTCL used send the host request for GTX mask
753 *
754 * @E.g: iwpriv wlan0 gtxUsrCfg <value>
755 *
756 * Supported Feature: STA
757 *
758 * Usage: Internal/External
759 *
760 * </ioctl>
761 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800762#define WE_SET_GTX_USRCFG 64
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530763/*
764 * <ioctl>
765 * gtxThre - Set the tx threshold
766 *
767 * @INPUT: Atleast one int argument
768 *
769 * @OUTPUT: None
770 *
771 * This IOTCL used to set tx threshold
772 *
773 * @E.g: iwpriv wlan0 gtxThre <value>
774 *
775 * Supported Feature: STA
776 *
777 * Usage: Internal/External
778 *
779 * </ioctl>
780 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800781#define WE_SET_GTX_THRE 65
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530782/*
783 * <ioctl>
784 * gtxMargin - Set the gtxMargin
785 *
786 * @INPUT: 1 to 32
787 *
788 * @OUTPUT: None
789 *
790 * This IOTCL use dto set gtxMargin
791 *
792 * @E.g: iwpriv wlan0 gtxMargini <value>
793 *
794 * Supported Feature: STA
795 *
796 * Usage: Internal/External
797 *
798 * </ioctl>
799 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800800#define WE_SET_GTX_MARGIN 66
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530801/*
802 * <ioctl>
803 * gtxStep - Set the gtxStep
804 *
805 * @INPUT: None
806 *
807 * @OUTPUT: None
808 *
809 * This IOTCL used to sets gtxStep
810 *
811 * @E.g: iwpriv wlan0 gtxStep <value>
812 *
813 * Supported Feature: STA
814 *
815 * Usage: Internal/External
816 *
817 * </ioctl>
818 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800819#define WE_SET_GTX_STEP 67
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530820/*
821 * <ioctl>
822 * gtxMinTpc - Sets the gtxMinTpc
823 *
824 * @INPUT: Atleast one int argument
825 *
826 * @OUTPUT: None
827 *
828 * This IOTCL sets the tx MinTpc
829 *
830 * @E.g: iwpriv wlan0 gtxMinTpc <value>
831 *
832 * Supported Feature: STA
833 *
834 * Usage: Internal/External
835 *
836 * </ioctl>
837 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800838#define WE_SET_GTX_MINTPC 68
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530839/*
840 * <ioctl>
841 * gtxBWMask - Sets the BW mask (20/40/80/160 Mhz)
842 *
843 * @INPUT: Mask value
844 *
845 * @OUTPUT: None
846 *
847 * This IOTCL used to set gtxBWMask
848 *
849 * @E.g: iwpriv wlan0 gtxBWMask <value>
850 *
851 * Supported Feature: STA
852 *
853 * Usage: Internal/External
854 *
855 * </ioctl>
856 */
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530857
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530858#define WE_SET_GTX_BWMASK 69
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530859/*
860 * <ioctl>
861 * setMccLatency - Sets the MCC latency value during STA-P2P concurrency
862 *
863 * @INPUT: set_value
864 *
865 * @OUTPUT: None
866 *
867 * This IOCTL is used to set the MCC latency value in milliseconds
868 * during STA-P2P concurrency.
869 *
870 * If 0ms latency is provided, then FW will set to a default.
871 * Otherwise, latency must be at least 30ms.
872 *
873 * @E.g: iwpriv wlan0 setMccLatency 40
874 *
875 *
876 * Supported Feature: Concurrency
877 *
878 * Usage: Internal/External
879 *
880 * </ioctl>
881 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800882#define WE_MCC_CONFIG_LATENCY 70
Nitesh Shahc87a7a82016-12-14 11:37:55 +0530883
884/*
885 * <ioctl>
886 * setMccQuota- Set the quota for P2P cases
887 *
888 * @INPUT: set_value [0,100]
889 *
890 * @OUTPUT: None
891 *
892 * This IOCTL is used to set the quota in milliseconds for P2P_GO/STA.
893 *
894 * Currently used to set time quota for 2 MCC vdevs/adapters using
895 * (operating channel, quota) for each mode.
896 * The info is provided run time using iwpriv command:
897 * iwpriv <wlan0 | p2p0> setMccQuota <quota in ms>.
898 * Note: the quota provided in command is for the same mode in cmd.
899 * HDD checks if MCC mode is active, gets the second mode and its
900 * operating chan.
901 * Quota for the 2nd role is calculated as 100 - quota of first mode.
902 *
903 * @E.g: iwpriv wlan0 setMccQuota 50
904 * iwpriv p2p0 setMccQuota 50
905 *
906 * Supported Feature: Concurrency
907 *
908 * Usage: Internal/External
909 *
910 * </ioctl>
911 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800912#define WE_MCC_CONFIG_QUOTA 71
913/* Private IOCTL for debug connection issues */
914#define WE_SET_DEBUG_LOG 72
915#ifdef WE_SET_TX_POWER
916#undef WE_SET_TX_POWER
917#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530918/*
919 * <ioctl>
920 * setTxPower - Set the current transmit power
921 *
922 * @INPUT: Transmission power in dBm
923 *
924 * @OUTPUT: None
925 *
926 * This IOCTL sets the current transmit power.
927 * This setting does not persist over reboots.
928 *
929 * @E.g: iwpriv wlan0 setTxPower 10
930 *
931 * Supported Feature: STA
932 *
933 * Usage: Internal/External
934 *
935 * </ioctl>
936 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800937#define WE_SET_TX_POWER 74
938/* Private ioctl for earlyrx power save feature */
939#define WE_SET_EARLY_RX_ADJUST_ENABLE 75
940#define WE_SET_EARLY_RX_TGT_BMISS_NUM 76
941#define WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE 77
942#define WE_SET_EARLY_RX_SLOP_STEP 78
943#define WE_SET_EARLY_RX_INIT_SLOP 79
944#define WE_SET_EARLY_RX_ADJUST_PAUSE 80
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530945/*
946 * <ioctl>
947 * setMcRate - Set the data rate for multicast data
948 *
949 * @INPUT: 1 to 32
950 *
951 * @OUTPUT: None
952 *
953 * This IOCTL sets the data rate for multicast data. Note that this command
954 * is allowed only in STA, IBSS, or QCMobileAP mode
955 *
956 * @E.g: iwpriv wlan0 setMcRate <value>
957 *
958 * Supported Feature: STA
959 *
960 * Usage: Internal/External
961 *
962 * </ioctl>
963 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800964#define WE_SET_MC_RATE 81
965#define WE_SET_EARLY_RX_DRIFT_SAMPLE 82
966/* Private ioctl for packet power save */
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530967/*
968 * <ioctl>
969 * 5g_ebt - Sets the 5g_ebt
970 *
971 * @INPUT: <value>
972 *
973 * @OUTPUT: None
974 *
975 * This IOTCL used to set 5g_ebt
976 *
977 * @E.g: iwpriv wlan0 5g_ebt <value>
978 *
979 * Supported Feature: STA
980 *
981 * Usage: Internal/External
982 *
983 * </ioctl>
984 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800985#define WE_PPS_5G_EBT 83
Sen, Devendra9ca8c432017-02-23 15:10:26 +0530986/*
987 * <ioctl>
988 * cts_cbw - Set CTS channel BW for dynamic BW adjustment
989 *
990 * @INPUT: 20 t0 160
991 *
992 * @OUTPUT: None
993 *
994 * This IOTCL used to set CTS channel BW for dynamic BW adjustment
995 *
996 * @E.g: iwpriv wlan0 cts_cbw <value>
997 *
998 * Supported Feature: STA
999 *
1000 * Usage: Internal/External
1001 *
1002 * </ioctl>
1003 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001004#define WE_SET_CTS_CBW 84
1005#define WE_DUMP_STATS 85
1006#define WE_CLEAR_STATS 86
Govind Singha471e5e2015-10-12 17:11:14 +05301007/* Private sub ioctl for starting/stopping the profiling */
1008#define WE_START_FW_PROFILE 87
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301009
Abhishek Singh3c507012016-12-01 11:15:42 +05301010/*
1011 * <ioctl>
1012 * setChanChange - Initiate channel change
1013 *
1014 * @INPUT: channel number to switch to.
1015 *
1016 * @OUTPUT: None
1017 *
1018 * This IOCTL is used to initiate a channel change.
1019 * If called on STA/CLI interface it will send the
1020 * ECSA action frame to the connected SAP/GO asking to
1021 * initiate the ECSA, if supported.
1022 * If called on SAP/GO interface it will initiate
1023 * ECSA and ask connected peers to move to new channel.
1024 *
1025 * @E.g: iwpriv wlan0 setChanChange <channel>
1026 * iwpriv wlan0 setChanChange 1
1027 *
1028 * Supported Feature: ECSA
1029 *
1030 * Usage: Internal/External
1031 *
1032 * </ioctl>
1033 */
Abhishek Singh1bdb1572015-10-16 16:24:19 +05301034#define WE_SET_CHANNEL 88
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05301035#define WE_SET_CONC_SYSTEM_PREF 89
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08001036#define WE_SET_TXRX_STATS 90
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001037
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08001038/*
1039 * <ioctl>
1040 * set_11ax_rate - set 11ax rates to FW
1041 *
1042 * @INPUT: rate code
1043 *
1044 * @OUTPUT: None
1045 *
1046 * This IOCTL fixes the Tx data rate of 11AX.
1047 *
1048 * @E.g: iwpriv wlan0 set_11ax_rate <rate code>
1049 *
1050 * Supported Feature: STA/SAP
1051 *
1052 * Usage: Internal
1053 *
1054 * </ioctl>
1055 */
1056#define WE_SET_11AX_RATE 91
1057
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001058/*
1059 * <ioctl>
1060 * enable_dcm - enable Dual Carrier Modulation(DCM)
1061 *
1062 * @INPUT: 0/1
1063 *
1064 * @OUTPUT: None
1065 *
1066 * This IOCTL enables/disables DCM.
1067 *
1068 * @E.g: iwpriv wlan0 enable_dcm <0/1>
1069 *
1070 * Supported Feature: STA/SAP
1071 *
1072 * Usage: Internal
1073 *
1074 * </ioctl>
1075 */
1076#define WE_SET_DCM 92
1077
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001078/*
1079 * <ioctl>
1080 * enable_range_ext - enable Range extension
1081 *
1082 * @INPUT: 0/1
1083 *
1084 * @OUTPUT: None
1085 *
1086 * This IOCTL enables/disables Range extension.
1087 *
1088 * @E.g: iwpriv wlan0 enable_range_ext <0/1>
1089 *
1090 * Supported Feature: STA/SAP
1091 *
1092 * Usage: Internal
1093 *
1094 * </ioctl>
1095 */
1096#define WE_SET_RANGE_EXT 93
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001097
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301098/*
1099 * <ioctl>
1100 * wow_ito - sets the timeout value for inactivity data while
1101 * in power save mode during wow
1102 *
1103 * @INPUT: int
1104 *
1105 * @OUTPUT: None
1106 *
1107 * This IOCTL set the timeout value for inactivity data in power save mode
1108 *
1109 * @E.g: iwpriv wlan0 wow_ito 20
1110 *
1111 * Supported Feature: STA
1112 *
1113 * Usage: External
1114 *
1115 * </ioctl>
Jeff Johnsondcf84ce2017-10-05 09:26:24 -07001116 */
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301117#define WE_SET_WOW_DATA_INACTIVITY_TO 94
1118
Jeff Johnson011c4502017-10-05 15:25:56 -07001119/*
1120 * <ioctl>
1121 * pdev_reset - reset the pdev
1122 *
1123 * @INPUT: Reset command to initiate:
1124 * TX_FLUSH = 1
1125 * WARM_RESET = 2
1126 * COLD_RESET = 3
1127 * WARM_RESET_RESTORE_CAL = 4
1128 * COLD_RESET_RESTORE_CAL = 5
1129 *
1130 * @OUTPUT: None
1131 *
1132 * This IOCTL is used to reset the pdev. The primary use is
1133 * for internal testing. It is not expected that this will
1134 * be used on a production device.
1135 *
1136 * @E.g: iwpriv wlan0 pdev_reset <command>
1137 * iwpriv wlan0 pdev_reset 1
1138 *
1139 * Supported Feature: None
1140 *
1141 * Usage: Internal
1142 *
1143 * </ioctl>
1144 */
1145#define WE_SET_PDEV_RESET 95
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05301146
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05301147/*
1148 * setModDTIM - Change Modulated DTIM
1149 *
1150 * @INPUT: set_value.
1151 *
1152 * @OUTPUT: None
1153 *
1154 * This IOCTL is used to change modulated DTIM
1155 * value without WIFI OFF/ON.
1156 *
1157 * @E.g: iwpriv wlan0 setModDTIM <value>
1158 * iwpriv wlan0 setModDTIM 2
1159 *
1160 * Supported Feature: N/A
1161 *
1162 * Usage: Internal/External
1163 *
1164 * </ioctl>
1165 */
1166#define WE_SET_MODULATED_DTIM 96
1167
1168
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001169/* Private ioctls and their sub-ioctls */
1170#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
1171#define WE_GET_11D_STATE 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001172#define WE_SET_SAP_CHANNELS 3
1173#define WE_GET_WLAN_DBG 4
1174#define WE_GET_MAX_ASSOC 6
1175/* 7 is unused */
1176#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
Nitesh Shahc87a7a82016-12-14 11:37:55 +05301177
1178/*
1179 * <ioctl>
1180 * getconcurrency - Get concurrency mode
1181 *
1182 * @INPUT: None
1183 *
1184 * @OUTPUT: It shows concurrency value
1185 * Bit 0:STA 1:SAP 2:P2P_Client 3:P2P_GO
1186 * 4:FTM 5:IBSS 6:Monitor 7:P2P_Device
1187 * 8:OCB 9:EPPING 10:QVIT 11:NDI
1188 *
1189 * This IOCTL is used to retrieve concurrency mode.
1190 *
1191 * @E.g: iwpriv wlan0 getconcurrency
1192 * wlan0 getconcurrency:5
1193 * Above value shows STA+P2P_Client
1194 *
1195 * Supported Feature: Concurrency
1196 *
1197 * Usage: Internal/External
1198 *
1199 * </ioctl>
1200 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001201#define WE_GET_CONCURRENCY_MODE 9
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301202/*
1203 * <ioctl>
1204 * get_nss - Get the number of spatial STBC streams (NSS)
1205 *
1206 * @INPUT: None
1207 *
1208 * @OUTPUT: NSS
1209 * wlan0 get_nss:2
1210 *
1211 * This IOTCL used to get the number of spatial STBC streams
1212 *
1213 * @E.g: iwpriv wlan0 get_nss
1214 *
1215 * Supported Feature: STA
1216 *
1217 * Usage: Internal/External
1218 *
1219 * </ioctl>
1220 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001221#define WE_GET_NSS 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301222/*
1223 * <ioctl>
1224 * get_ldpc - This IOCTL gets the low density parity check (LDPC)
1225 *
1226 * @INPUT: None
1227 *
1228 * @OUTPUT: ldpc
1229 * wlan0 get_ldpc:1
1230 *
1231 * This IOTCL used to gets the low density parity check (LDPC)
1232 *
1233 * @E.g: iwpriv wlan0 get_ldpc
1234 *
1235 * Supported Feature: STA
1236 *
1237 * Usage: Internal/External
1238 *
1239 * </ioctl>
1240 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001241#define WE_GET_LDPC 12
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301242/*
1243 * <ioctl>
1244 * get_tx_stbc - Get the value of the current Tx space time block code (STBC)
1245 *
1246 * @INPUT: None
1247 *
1248 * @OUTPUT: TXSTBC
1249 * wlan0 get_tx_stbc:1
1250 *
1251 * This IOTCL get the value of the current Tx space time block code (STBC)
1252 *
1253 * @E.g: iwpriv wlan0 get_tx_stbc
1254 *
1255 * Supported Feature: STA
1256 *
1257 * Usage: Internal/External
1258 *
1259 * </ioctl>
1260 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001261#define WE_GET_TX_STBC 13
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301262/*
1263 * <ioctl>
1264 * get_rx_stbc - Gets the value of the current Rx STBC
1265 *
1266 * @INPUT: None
1267 *
1268 * @OUTPUT: Rx STBC
1269 * wlan0 get_rx_stbc:1
1270 *
1271 * This IOTCL used to get the value of the current Rx STBC
1272 *
1273 * @E.g: iwpriv wlan0 get_rx_stbc
1274 *
1275 * Supported Feature: STA
1276 *
1277 * Usage: Internal/External
1278 *
1279 * </ioctl>
1280 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001281#define WE_GET_RX_STBC 14
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301282/*
1283 * <ioctl>
1284 * get_shortgi - Get the value of the current short GI setting
1285 *
1286 * @INPUT: None
1287 *
1288 * @OUTPUT: Enable/disable of shortgi
1289 * wlan0 get_shortgi:1
1290 *
1291 * This IOCTL gets the value of the current short GI setting
1292 *
1293 * @E.g: iwpriv wlan0 get_shortgi
1294 *
1295 * Supported Feature: STA
1296 *
1297 * Usage: Internal/External
1298 *
1299 * </ioctl>
1300 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001301#define WE_GET_SHORT_GI 15
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301302/*
1303 * <ioctl>
1304 * get_rtscts - Get the value of the current RTS/CTS setting.
1305 *
1306 * @INPUT: None
1307 *
1308 * @OUTPUT: Enable/disable of RTS/CTS
1309 * wlan0 get_rtscts:33
1310 *
1311 * This IOTCL get the value of the current RTS/CTS setting.
1312 *
1313 * @E.g: iwpriv wlan0 get_rtscts
1314 *
1315 * Supported Feature: STA
1316 *
1317 * Usage: Internal/External
1318 *
1319 * </ioctl>
1320 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001321#define WE_GET_RTSCTS 16
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301322/*
1323 * <ioctl>
1324 * get_chwidth - Get the current channel width setting
1325 *
1326 * @INPUT: None
1327 *
1328 * @OUTPUT: channel width
1329 * wlan0 get_chwidth:0
1330 *
1331 * This IOTCL get the current channel width setting.
1332 *
1333 * @E.g: iwpriv wlan0 get_chwidth
1334 *
1335 * Supported Feature: STA
1336 *
1337 * Usage: Internal/External
1338 *
1339 * </ioctl>
1340 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001341#define WE_GET_CHWIDTH 17
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301342/*
1343 * <ioctl>
1344 * get_anienable - Get the anienable
1345 *
1346 * @INPUT: None
1347 *
1348 * @OUTPUT:
1349 * wlan0 get_anienable:0
1350 *
1351 * This IOTCL get the anienable
1352 *
1353 * @E.g: iwpriv wlan0 get_anienable
1354 *
1355 * Supported Feature: STA
1356 *
1357 * Usage: Internal/External
1358 *
1359 * </ioctl>
1360 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001361#define WE_GET_ANI_EN_DIS 18
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301362/*
1363 * <ioctl>
1364 * get_aniplen - Get the aniplen
1365 *
1366 * @INPUT: None
1367 *
1368 * @OUTPUT:
1369 * wlan0 get_aniplen:0
1370 *
1371 * This IOTCL get the aniplen
1372 *
1373 * @E.g: iwpriv wlan0 get_aniplen
1374 *
1375 * Supported Feature: STA
1376 *
1377 * Usage: Internal/External
1378 *
1379 * </ioctl>
1380 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001381#define WE_GET_ANI_POLL_PERIOD 19
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301382/*
1383 * <ioctl>
1384 * get_anilislen- Get the anilislen
1385 *
1386 * @INPUT: None
1387 *
1388 * @OUTPUT:
1389 * wlan0 get_anilislen:0
1390 *
1391 * This IOTCL used to get anilislen
1392 *
1393 * @E.g: iwpriv wlan0 get_anilislen
1394 *
1395 * Supported Feature: STA
1396 *
1397 * Usage: Internal/External
1398 *
1399 * </ioctl>
1400 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001401#define WE_GET_ANI_LISTEN_PERIOD 20
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301402/*
1403 * <ioctl>
1404 * get_aniofdmlvl - Get the OFDM level
1405 *
1406 * @INPUT: None
1407 *
1408 * @OUTPUT: OFDM
1409 * wlan0 get_aniofdmlvl:0
1410 *
1411 * This IOTCL used to get ofdm level
1412 *
1413 * @E.g: iwpriv wlan0 get_aniofdmlvl
1414 *
1415 * Supported Feature: STA
1416 *
1417 * Usage: Internal/External
1418 *
1419 * </ioctl>
1420 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001421#define WE_GET_ANI_OFDM_LEVEL 21
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301422/*
1423 * <ioctl>
1424 * get_aniccklvl - Get the cck level
1425 *
1426 * @INPUT: None
1427 *
1428 * @OUTPUT:
1429 * wlan0 get_aniccklvl:0
1430 *
1431 * This IOTCL used to get cck level
1432 *
1433 * @E.g: iwpriv wlan0 get_aniccklvl
1434 *
1435 * Supported Feature: STA
1436 *
1437 * Usage: Internal/External
1438 *
1439 * </ioctl>
1440 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001441#define WE_GET_ANI_CCK_LEVEL 22
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301442/*
1443 * <ioctl>
1444 * get_cwmenable - Get the value of the dynamic channel bandwidth setting
1445 *
1446 * @INPUT: None
1447 *
1448 * @OUTPUT: Enable/disable dynamic channel bandwidth
1449 * wlan0 get_cwmenable:0
1450 *
1451 * This IOTCL get the value of the dynamic channel bandwidth setting
1452 *
1453 * @E.g: iwpriv wlan0 get_cwmenable
1454 *
1455 * Supported Feature: STA
1456 *
1457 * Usage: Internal/External
1458 *
1459 * </ioctl>
1460 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001461#define WE_GET_DYNAMIC_BW 23
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301462/*
1463 * <ioctl>
1464 * get_txchainmask - Get the txchainmask that was set
1465 *
1466 * @INPUT: None
1467 *
1468 * @OUTPUT: txchainmask
1469 * wlan0 get_txchainmask:1
1470 *
1471 * This IOCTL gets the txchainmask that was set
1472 * This command is useful if it was previously set
1473 *
1474 * @E.g: iwpriv wlan0 get_txchainmask
1475 *
1476 * Supported Feature: STA
1477 *
1478 * Usage: Internal/External
1479 *
1480 * </ioctl>
1481 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001482#define WE_GET_TX_CHAINMASK 24
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301483/*
1484 * <ioctl>
1485 * get_rxchainmask - Get the rxchainmask that was set
1486 *
1487 * @INPUT: None
1488 *
1489 * @OUTPUT: rxchainmask
1490 * wlan0 get_rxchainmask:1
1491 *
1492 * This IOCTL gets the rxchainmask that was set
1493 * This command is useful only if it was previously set.
1494 *
1495 * @E.g: iwpriv wlan0 get_rxchainmask
1496 *
1497 * Supported Feature: STA
1498 *
1499 * Usage: Internal/External
1500 *
1501 * </ioctl>
1502 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001503#define WE_GET_RX_CHAINMASK 25
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301504/*
1505 * <ioctl>
1506 * get_11nrate - Get the fixed Tx data rate
1507 *
1508 * @INPUT: None
1509 *
1510 * @OUTPUT: Using this command does not return the same value as set
1511 * wlan0 get_11nrate:0
1512 *
1513 * This IOCTL gets the fixed Tx data rate
1514 * This command is useful only if setting the fixed Tx rate.
1515 *
1516 * @E.g: iwpriv wlan0 get_11nrate
1517 *
1518 * Supported Feature: STA
1519 *
1520 * Usage: Internal/External
1521 *
1522 * </ioctl>
1523 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001524#define WE_GET_11N_RATE 26
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301525/*
1526 * <ioctl>
1527 * get_ampdu - Get the maximum subframe of ampdu
1528 *
1529 * @INPUT: None
1530 *
1531 * @OUTPUT: Maximum subframe of ampdu
1532 * wlan0 get_ampdu:1
1533 *
1534 * This IOCTL gets the maximum subframe of ampdu
1535 * This command is useful only if setting ampdu.
1536 *
1537 * @E.g: iwpriv wlan0 get_ampdu
1538 *
1539 * Supported Feature: STA
1540 *
1541 * Usage: Internal/External
1542 *
1543 * </ioctl>
1544 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001545#define WE_GET_AMPDU 27
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301546/*
1547 * <ioctl>
1548 * get_amsdu - Get the maximum subframe of amsdu
1549 *
1550 * @INPUT: None
1551 *
1552 * @OUTPUT: Maximum subframe of amsdu
1553 * wlan0 get_amsdu:1
1554 *
1555 * This IOCTL gets the maximum subframe of amsdu.
1556 * This command is useful only if setting amsdu
1557 *
1558 * @E.g: iwpriv wlan0 get_amsdu
1559 *
1560 * Supported Feature: STA
1561 *
1562 * Usage: Internal/External
1563 *
1564 * </ioctl>
1565 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001566#define WE_GET_AMSDU 28
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301567/*
1568 * <ioctl>
1569 * get_txpow2g - Get the current 2 GHz Tx power setting
1570 *
1571 * @INPUT: None
1572 *
1573 * @OUTPUT: Tx Power in dbm
1574 * wlan0 get_txpow2g:0
1575 *
1576 * This IOCTL gets the current 2 GHz Tx power setting
1577 * This command is useful if setting Tx power
1578 *
1579 * @E.g: iwpriv wlan0 get_txpow2g
1580 *
1581 * Supported Feature: STA
1582 *
1583 * Usage: Internal/External
1584 *
1585 * </ioctl>
1586 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001587#define WE_GET_TXPOW_2G 29
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301588/*
1589 * <ioctl>
1590 * get_txpow5g - Get the current 5 GHz Tx power setting
1591 *
1592 * @INPUT: None
1593 *
1594 * @OUTPUT: Tx Power in dbm
1595 * wlan0 get_txpow5g:0
1596 *
1597 * This IOCTL gets the current 5 GHz Tx power setting
1598 * This command is useful if setting Tx power
1599 *
1600 * @E.g: iwpriv wlan0 get_txpow5g
1601 *
1602 * Supported Feature: STA
1603 *
1604 * Usage: Internal/External
1605 *
1606 * </ioctl>
1607 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001608#define WE_GET_TXPOW_5G 30
Rajeev Kumar1bcfd632015-12-07 11:38:51 -08001609/* 31 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001610#define WE_GET_PPS_PAID_MATCH 32
1611#define WE_GET_PPS_GID_MATCH 33
1612#define WE_GET_PPS_EARLY_TIM_CLEAR 34
1613#define WE_GET_PPS_EARLY_DTIM_CLEAR 35
1614#define WE_GET_PPS_EOF_PAD_DELIM 36
1615#define WE_GET_PPS_MACADDR_MISMATCH 37
1616#define WE_GET_PPS_DELIM_CRC_FAIL 38
1617#define WE_GET_PPS_GID_NSTS_ZERO 39
1618#define WE_GET_PPS_RSSI_CHECK 40
1619/* Private ioctl for QPower */
1620#define WE_GET_QPOWER_MAX_PSPOLL_COUNT 41
1621#define WE_GET_QPOWER_MAX_TX_BEFORE_WAKE 42
1622#define WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL 43
1623#define WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL 44
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301624/*
1625 * <ioctl>
1626 * get_burst_en - Enables or disables the burst feature
1627 *
1628 * @INPUT: None
1629 *
1630 * @OUTPUT: Enable/disable of burst feature
1631 * wlan0 get_burst_en:1
1632 *
1633 * This IOCTL enables or disables the burst feature
1634 *
1635 * @E.g: iwpriv wlan0 get_burst_en
1636 *
1637 * Supported Feature:STA
1638 *
1639 * Usage: Internal/External
1640 *
1641 * </ioctl>
1642 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001643#define WE_GET_BURST_ENABLE 45
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301644/*
1645 * <ioctl>
1646 * get_burst_dur - Get the burst duration
1647 *
1648 * @INPUT: None
1649 *
1650 * @OUTPUT: Duration in microseconds
1651 * wlan0 get_burst_dur:8160
1652 *
1653 * This IOCTL gets the burst duration
1654 * This command is useful if setting burst enable
1655 *
1656 * @E.g: iwpriv wlan0 get_burst_dur
1657 *
1658 * Supported Feature: STA
1659 *
1660 * Usage: Internal/External
1661 *
1662 * </ioctl>
1663 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001664#define WE_GET_BURST_DUR 46
1665/* GTX Commands */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301666/*
1667 * <ioctl>
1668 * get_gtxHTMcs - Get the tx HTM
1669 *
1670 * @INPUT: None
1671 *
1672 * @OUTPUT: HTM
1673 * wlan0 get_gtxHTMcs:32896
1674 *
1675 * This IOTCL used to get HTM
1676 *
1677 * @E.g: iwpriv wlan0 get_gtxHTMcs
1678 *
1679 * Supported Feature: STA
1680 *
1681 * Usage: Internal/External
1682 *
1683 * </ioctl>
1684 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001685#define WE_GET_GTX_HT_MCS 47
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301686/*
1687 * <ioctl>
1688 * get_gtxVHTMcs - Get the VHTM
1689 *
1690 * @INPUT: None
1691 *
1692 * @OUTPUT: VHTM
1693 * wlan0 get_gtxVHTMcs:524800
1694 *
1695 * This IOTCL used to get the VHTM
1696 *
1697 * @E.g: iwpriv wlan0 get_gtxVHTMcs
1698 *
1699 * Supported Feature: STA
1700 *
1701 * Usage: Internal/External
1702 *
1703 * </ioctl>
1704 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001705#define WE_GET_GTX_VHT_MCS 48
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301706/*
1707 * <ioctl>
1708 * get_gtxUsrCfg - Get the tx cfg
1709 *
1710 * @INPUT: None
1711 *
1712 * @OUTPUT: TXCFG
1713 * wlan0 get_gtxUsrCfg:32
1714 *
1715 * This IOTCL used to get the tx cfg
1716 *
1717 * @E.g: iwpriv wlan0 get_gtxUsrCfg
1718 *
1719 * Supported Feature: STA
1720 *
1721 * Usage: Internal/External
1722 *
1723 * </ioctl>
1724 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001725#define WE_GET_GTX_USRCFG 49
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301726/*
1727 * <ioctl>
1728 * get_gtxThre - Get the tx threshold
1729 *
1730 * @INPUT: None
1731 *
1732 * @OUTPUT: Threshold
1733 * wlan0 get_gtxThre:3
1734 *
1735 * This IOCTL is used to get tx threshold
1736 *
1737 * @E.g: iwpriv wlan0 get_gtxThre
1738 *
1739 * Supported Feature: STA
1740 *
1741 * Usage: Internal/External
1742 *
1743 * </ioctl>
1744 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001745#define WE_GET_GTX_THRE 50
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301746/*
1747 * <ioctl>
1748 * get_gtxMargin - Get the tx margin
1749 *
1750 * @INPUT: None
1751 *
1752 * @OUTPUT: GTXMARGIN
1753 * wlan0 get_gtxMargin:2
1754 *
1755 * This IOCTL is used to set tx margin
1756 *
1757 * @E.g: iwpriv wlan0 get_gtxMargin
1758 *
1759 * Supported Feature: STA
1760 *
1761 * Usage: Internal/External
1762 *
1763 * </ioctl>
1764 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001765#define WE_GET_GTX_MARGIN 51
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301766/*
1767 * <ioctl>
1768 * get_gtxStep - Get the tx step
1769 *
1770 * @INPUT: None
1771 *
1772 * @OUTPUT: GTXSTEP
1773 * wlan0 get_gtxStep:0
1774 *
1775 * This IOCTL is used to get the gtx step
1776 *
1777 * @E.g: iwpriv wlan0 get_gtxStep
1778 *
1779 * Supported Feature: STA
1780 *
1781 * Usage: Internal/External
1782 *
1783 * </ioctl>
1784 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001785#define WE_GET_GTX_STEP 52
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301786/*
1787 * <ioctl>
1788 * get_gtxMinTpc - Get the tx miminum tpc
1789 *
1790 * @INPUT: None
1791 *
1792 * @OUTPUT: TPC
1793 * wlan0 get_gtxMinTpc:0
1794 *
1795 * This IOCTL is used to get tx miminum tpc
1796 *
1797 * @E.g: iwpriv wlan0 get_gtxMinTpc
1798 *
1799 * Supported Feature: STA
1800 *
1801 * Usage: Internal/External
1802 *
1803 * </ioctl>
1804 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001805#define WE_GET_GTX_MINTPC 53
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301806/*
1807 * <ioctl>
1808 * get_gtxBWMask - Get the tx BW MASK
1809 *
1810 * @INPUT: None
1811 *
1812 * @OUTPUT: MASK
1813 * wlan0 get_gtxBWMask:15
1814 *
1815 * This IOCTL is used get gtx bw mask
1816 *
1817 * @E.g: iwpriv wlan0 get_gtxBWMask
1818 *
1819 * Supported Feature: STA
1820 *
1821 * Usage: Internal/External
1822 *
1823 * </ioctl>
1824 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001825#define WE_GET_GTX_BWMASK 54
1826#define WE_GET_TEMPERATURE 56
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001827#define WE_CAP_TSF 58
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07001828#define WE_GET_ROAM_SYNCH_DELAY 59
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001829
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07001830/*
1831 * <ioctl>
1832 * get_dcm - Get dcm enablement value
1833 *
1834 * @INPUT: None
1835 *
1836 * @OUTPUT: 0/1
1837 * wlan0 get_dcm
1838 *
1839 * This IOCTL is used get dcm value
1840 *
1841 * Supported Feature: STA/SAP
1842 *
1843 * Usage: Internal
1844 *
1845 * </ioctl>
1846 */
1847#define WE_GET_DCM 60
1848
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07001849/*
1850 * <ioctl>
1851 * get_dcm - Get range extension enablement value
1852 *
1853 * @INPUT: None
1854 *
1855 * @OUTPUT: 0/1
1856 * wlan0 get_range_ext
1857 *
1858 * This IOCTL is used get range_extension value
1859 *
1860 * Supported Feature: STA/SAP
1861 *
1862 * Usage: Internal
1863 *
1864 * </ioctl>
1865 */
1866#define WE_GET_RANGE_EXT 61
1867
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001868/* Private ioctls and their sub-ioctls */
1869#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
1870
1871/* Private ioctls and their sub-ioctls */
1872#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
1873#define WE_WOWL_ADD_PTRN 1
1874#define WE_WOWL_DEL_PTRN 2
Sreelakshmi Konamkided64d72017-02-23 10:39:26 +05301875/*
1876 * <ioctl>
1877 * neighbor - Send neighbor report request
1878 *
1879 * @INPUT: string
1880 *
1881 * @OUTPUT: None
1882 *
1883 * This IOCTL create a Neighbor report request and send it to peer
1884 *
1885 * @E.g: iwpriv wlan0 neighbor "SSID"
1886 *
1887 * Supported Feature: 11k
1888 *
1889 * Usage: Internal/External
1890 *
1891 * </ioctl>
1892 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001893#define WE_NEIGHBOR_REPORT_REQUEST 3
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301894/*
1895 * <ioctl>
1896 * set_ap_wps_ie - Set the P2P IE of the probe response
1897 *
1898 * @INPUT: string
1899 *
1900 * @OUTPUT: None
1901 *
1902 * This IOCTL sets the P2P IE of the probe response
1903 *
1904 * @E.g: iwpriv wlan0 set_ap_wps_ie abcd
1905 *
1906 * Supported Feature: STA
1907 *
1908 * Usage: Internal/External
1909 *
1910 * </ioctl>
1911 */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07001912#define WE_SET_AP_WPS_IE 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001913#define WE_SET_CONFIG 5
1914
1915/* Private ioctls and their sub-ioctls */
1916#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
1917#define WE_SET_WLAN_DBG 1
1918#define WE_SET_DP_TRACE 2
1919#define WE_SET_SAP_CHANNELS 3
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05301920#define WE_SET_FW_TEST 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001921
1922/* Private ioctls and their sub-ioctls */
1923#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
1924#define WE_WLAN_VERSION 1
1925#define WE_GET_STATS 2
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301926/*
1927 * <ioctl>
1928 * getConfig - gets the values of all configurations listed in WCNSS
1929 *
1930 * @INPUT: None
1931 *
1932 * @OUTPUT: Current configuration to the sys log
1933 * wlan0 getConfig: WLAN configuration written to system log
1934 *
1935 * This IOCTL gets the values of all configurations listed in WCNSS
1936 *
1937 * @E.g: iwpriv wlan0 getConfig
1938 *
1939 * Supported Feature: STA
1940 *
1941 * Usage: Internal/External
1942 *
1943 * </ioctl>
1944 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001945#define WE_GET_CFG 3
1946#define WE_GET_WMM_STATUS 4
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301947/*
1948 * <ioctl>
1949 * getChannelList - Get the available channel list while in QCMobileAP
1950 *
1951 * @INPUT: None
1952 *
1953 * @OUTPUT: Channel list
1954 * wlan0 getChannelList:36 US 1..165
1955 *
1956 * This IOCTL gets the available channel list while in QCMobileAP
1957 *
1958 * @E.g: iwpriv wlan0 getChannelList
1959 *
1960 * Supported Feature: STA
1961 *
1962 * Usage: Internal/External
1963 *
1964 * </ioctl>
1965 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001966#define WE_GET_CHANNEL_LIST 5
Sen, Devendra9ca8c432017-02-23 15:10:26 +05301967/*
1968 * <ioctl>
1969 * getRSSI - Get the Received Signal Strength Indicator
1970 *
1971 * @INPUT: None
1972 *
1973 * @OUTPUT: RSSI
1974 * wlan0 getRSSI:rsssi=-32
1975 *
1976 * This IOCTL gets the Received Signal Strength Indicator (RSSI)
1977 *
1978 * @E.g: iwpriv wlan0 getRSSI
1979 *
1980 * Supported Feature: STA
1981 *
1982 * Usage: Internal/External
1983 *
1984 * </ioctl>
1985 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001986#define WE_GET_RSSI 6
Dustin Brownd9322482017-01-09 12:46:03 -08001987
1988/*
1989 * <ioctl>
1990 * getSuspendStats - Get suspend/resume stats
1991 *
1992 * @INPUT: None
1993 *
1994 * @OUTPUT: character string containing formatted suspend/resume stats
1995 *
1996 * This ioctl is used to get suspend/resume stats formatted for display.
1997 * Currently it includes suspend/resume counts, wow wake up reasons, and
1998 * suspend fail reasons.
1999 *
2000 * @E.g: iwpriv wlan0 getSuspendStats
2001 * iwpriv wlan0 getSuspendStats
2002 *
2003 * Supported Feature: suspend/resume
2004 *
2005 * Usage: Internal
2006 *
2007 * </ioctl>
2008 */
2009#define WE_GET_SUSPEND_RESUME_STATS 7
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002010#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302011/*
2012 * <ioctl>
2013 * getTdlsPeers - Get all TDLS peers.
2014 *
2015 * @INPUT: None
2016 *
2017 * @OUTPUT: Returns the MAC address of all the TDLS peers
2018 * wlan0 getTdlsPeers:
2019 * MAC Id cap up RSSI
2020 * ---------------------------------
2021 * 00:0a:f5:0e:bd:18 2 Y Y -44
2022 * 00:0a:f5:bf:0e:12 0 N N 0
2023 *
2024 * This IOCTL is used to get all TDLS peers.
2025 *
2026 * @E.g: iwpriv wlan0 getTdlsPeers
2027 *
2028 * Supported Feature: TDLS
2029 *
2030 * Usage: Internal/External
2031 *
2032 * </ioctl>
2033 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002034#define WE_GET_TDLS_PEERS 8
2035#endif
2036#ifdef WLAN_FEATURE_11W
Abhishek Singh2f810492016-12-01 11:39:39 +05302037/*
2038 * <ioctl>
2039 * getPMFInfo - get the PMF info of the connected session
2040 *
2041 * @INPUT: None
2042 *
2043 * @OUTPUT:
2044 * wlan0 getPMFInfo:
2045 * BSSID E4:F4:C6:0A:E0:36, Is PMF Assoc? 0
2046 * Number of Unprotected Disassocs 0
2047 * Number of Unprotected Deauths 0
2048 *
2049 * This IOCTL is used to get the PMF stats/status of the current
2050 * connection.
2051 *
2052 * @e.g:iwpriv wlan0 getPMFInfo
2053 *
2054 * Supported Feature: PMF
2055 *
2056 * Usage: Internal/External
2057 *
2058 * </ioctl>
2059 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002060#define WE_GET_11W_INFO 9
2061#endif
2062#define WE_GET_STATES 10
Abhishek Singh49b654e2016-12-01 16:11:17 +05302063/*
2064 * <ioctl>
2065 * getIbssSTAs - get ibss sta info
2066 *
2067 * @INPUT: None
2068 *
2069 * @OUTPUT: Give the MAC of the IBSS STA
2070 * wlan0 getIbssSTAs:
2071 * 1 .8c:fd:f0:01:9c:bf
2072 *
2073 * This IOCTL is used to get ibss sta info
2074 *
2075 * @E.g: iwpriv wlan0 getIbssSTAs
2076 *
2077 * Supported Feature: IBSS
2078 *
2079 * Usage: Internal/External
2080 *
2081 * </ioctl>
2082 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002083#define WE_GET_IBSS_STA_INFO 11
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302084/*
2085 * <ioctl>
2086 * getphymode - Get the current phymode.
2087 *
2088 * @INPUT: None
2089 *
2090 * @OUTPUT: In phymode
2091 * wlan0 getphymode:AUTO MODE
2092 *
2093 * This IOCTL used to gets the current phymode.
2094 *
2095 * @E.g: iwpriv wlan0 getphymode
2096 *
2097 * Supported Feature: STA
2098 *
2099 * Usage: Internal/External
2100 *
2101 * </ioctl>
2102 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002103#define WE_GET_PHYMODE 12
Naveen Rawat910726a2017-03-06 11:42:51 -08002104
2105/*
2106 * <ioctl>
2107 * getOemDataCap - Get the oem data caps.
2108 *
2109 * @INPUT: None
2110 *
2111 * @OUTPUT: oem data capability
2112 *
2113 * This IOCTL used to gets the current oem data cap.
2114 *
2115 * @E.g: iwpriv wlan0 getOemDataCap
2116 *
2117 * Usage: Internal/External
2118 *
2119 * </ioctl>
2120 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002121#define WE_GET_OEM_DATA_CAP 13
Naveen Rawat910726a2017-03-06 11:42:51 -08002122
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302123/*
2124 * <ioctl>
2125 * getSNR - Enable SNR Monitoring
2126 *
2127 * @INPUT: None
2128 *
2129 * @OUTPUT: Signal strength/ratio
2130 * wlan0 getSNR:1
2131 *
2132 * This IOCTL is used to get ibss sta info
2133 *
2134 * @E.g: iwpriv wlan0 getSNR
2135 *
2136 * Supported Feature: STA
2137 *
2138 * Usage: Internal/External
2139 *
2140 * </ioctl>
2141 */
Naveen Rawat910726a2017-03-06 11:42:51 -08002142
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002143#define WE_GET_SNR 14
Govind Singha471e5e2015-10-12 17:11:14 +05302144#define WE_LIST_FW_PROFILE 15
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002145
2146/* Private ioctls and their sub-ioctls */
2147#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
Selvaraj, Sridharf7939832017-03-25 16:59:50 +05302148
2149/*
2150 * <ioctl>
2151 * reassoc - Trigger STA re-association to the connected AP
2152 *
2153 * @INPUT: None
2154 *
2155 * @OUTPUT: None
2156 *
2157 * This IOCTL is used to trigger STA reassociation to the connected AP.
2158 *
2159 * @E.g: iwpriv wlan0 reassoc
2160 *
2161 * Supported Feature: Roaming
2162 *
2163 * Usage: Internal
2164 *
2165 * </ioctl>
2166 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002167#define WE_SET_REASSOC_TRIGGER 8
Abhishek Singh49b654e2016-12-01 16:11:17 +05302168/*
2169 * <ioctl>
2170 * ibssPeerInfoAll - Print the ibss peers's MAC, rate and RSSI
2171 *
2172 * @INPUT: None
2173 *
2174 * @OUTPUT: print ibss peer in info logs
2175 * pPeerInfo->numIBSSPeers = 1
2176 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2177 *
2178 * This IOCTL is used to rint the ibss peers's MAC, rate and RSSI
2179 * in info logs
2180 *
2181 * @E.g: iwpriv wlan0 ibssPeerInfoAll
2182 *
2183 * Supported Feature: IBSS
2184 *
2185 * Usage: Internal/External
2186 *
2187 * </ioctl>
2188 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002189#define WE_IBSS_GET_PEER_INFO_ALL 10
Rajeev Kumarf4390fa2016-12-22 13:17:33 -08002190/* Sub ioctls 11 to 16 are not used */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002191#define WE_GET_RECOVERY_STAT 17
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002192#define WE_GET_FW_PROFILE_DATA 18
yeshwanth sriram guntukabdfe4352017-02-16 14:44:31 +05302193/*
2194 * <ioctl>
2195 * stop_obss_scan - Stop obss scan
2196 *
2197 * @INPUT: None
2198 *
2199 * @OUTPUT: None
2200 *
2201 * This IOCTL is used to stop obss scan
2202 *
2203 * @E.g: iwpriv wlan0 stop_obss_scan
2204 *
2205 * Supported Feature: Scan
2206 *
2207 * Usage: Internal/External
2208 *
2209 * </ioctl>
2210 */
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08002211#define WE_STOP_OBSS_SCAN 19
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002212
2213/* Private ioctls and their sub-ioctls */
2214#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
2215
2216#define WE_P2P_NOA_CMD 2
Manjeet Singhf82ed072016-07-08 11:40:00 +05302217/* subcommands 3 is unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002218
Manjeet Singhf82ed072016-07-08 11:40:00 +05302219#define WE_MAC_PWR_DEBUG_CMD 4
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002220
2221#ifdef FEATURE_WLAN_TDLS
Nitesh Shah5dfb99e2016-12-10 14:19:46 +05302222/*
2223 * <ioctl>
2224 * setTdlsConfig - Set TDLS configuration parameters.
2225 *
2226 * @INPUT: 11 TDLS configuration parameters
2227 * @args[0]: tdls: [0..2]
2228 * @args[1]: tx_period_t: [1000..4294967295UL]
2229 * @args[2]: tx_packet_n: [0..4294967295UL]
2230 * @args[3]: [discovery_period is not used anymore]
2231 * @args[4]: discovery_tries_n: [1..100]
2232 * @args[5]: [idle_timeout is not used anymore]
2233 * @args[6]: idle_packet_n: [0..40000]
2234 * @args[7]: [rssi_hysteresis is not used anymore]
2235 * @args[8]: rssi_trigger_threshold: [-120..0]
2236 * @args[9]: rssi_teardown_threshold: [-120..0]
2237 * @args[10]: rssi_delta: [-30..0]
2238 *
2239 * @OUTPUT: None
2240 *
2241 * This IOCTL is used to set the TDLS configuration parameters.
2242 *
2243 * @E.g: iwpriv wlan0 setTdlsConfig tdls tx_period_t tx_packet_n
2244 * discovery_period discovery_tries_n idle_timeout
2245 * idle_packet_n rssi_hysteresis rssi_trigger_threshold
2246 * rssi_teardown_threshold rssi_delta
2247 * iwpriv wlan0 setTdlsConfig 1 1500 40 1 5 1 5 0 -70 -70 -10
2248 *
2249 * Supported Feature: TDLS
2250 *
2251 * Usage: Internal/External
2252 *
2253 * </ioctl>
2254 */
2255
2256
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002257#define WE_TDLS_CONFIG_PARAMS 5
2258#endif
Abhishek Singh49b654e2016-12-01 16:11:17 +05302259/*
2260 * <ioctl>
2261 * ibssPeerInfo - Print the ibss peers's MAC, rate and RSSI
2262 *
2263 * @INPUT: staid
2264 *
2265 * @OUTPUT: print ibss peer corresponding to staid in info logs
2266 * PEER ADDR : 8c:fd:f0:01:9c:bf TxRate: 1 Mbps RSSI: -35
2267 *
2268 * This IOCTL is used to print the specific ibss peers's MAC,
2269 * rate and RSSI in info logs
2270 *
2271 * @E.g: iwpriv wlan0 ibssPeerInfo <sta_id>
2272 * iwpriv wlan0 ibssPeerInfo 0
2273 *
2274 * Supported Feature: IBSS
2275 *
2276 * Usage: Internal/External
2277 *
2278 * </ioctl>
2279 */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002280#define WE_IBSS_GET_PEER_INFO 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002281#define WE_UNIT_TEST_CMD 7
2282
2283#define WE_MTRACE_DUMP_CMD 8
2284#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
2285
2286
2287#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
2288#define WE_LED_FLASHING_PARAM 10
2289#endif
2290
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302291/*
2292 * <ioctl>
2293 * pm_clist - Increments the index value of the concurrent connection list
2294 * and update with the input parameters provided.
2295 *
2296 * @INPUT: Following 8 arguments:
2297 * @vdev_id: vdev id
2298 * @tx_streams: TX streams
2299 * @rx_streams: RX streams
2300 * @chain_mask: Chain mask
2301 * @type: vdev_type
2302 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2303 * @sub_type: vdev_subtype
2304 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2305 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2306 * @channel: Channel
2307 * @mac: Mac id
2308 *
2309 * @OUTPUT: None
2310 *
2311 * This IOCTL is used to increments the index value of the concurrent connection
2312 * list and update with the input parameters provided.
2313 *
2314 * @E.g: iwpriv wlan0 pm_clist vdev_id tx_streams rx_streams chain_mask type
2315 * sub_type channel mac
2316 * iwpriv wlan0 pm_clist 1 2 2 1 2 3 10 1
2317 *
2318 * Supported Feature: DBS
2319 *
2320 * Usage: Internal/External
2321 *
2322 * </ioctl>
2323 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002324#define WE_POLICY_MANAGER_CLIST_CMD 11
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302325
2326/*
2327 * <ioctl>
2328 * pm_dlist - Delete the index from the concurrent connection list that is
2329 * present in the given vdev_id.
2330 *
2331 * @INPUT: delete_all, vdev_id
2332 * @delete_all: delete all indices
2333 * @vdev_id: vdev id
2334 *
2335 * @OUTPUT: None
2336 *
2337 * This IOCTL is used to delete the index from the concurrent connection list
2338 * that is present in the given vdev_id.
2339 *
2340 * @E.g: iwpriv wlan0 pm_dlist delete_all vdev_id
2341 * iwpriv wlan0 pm_dlist 0 1
2342 *
2343 * Supported Feature: DBS
2344 *
2345 * Usage: Internal/External
2346 *
2347 * </ioctl>
2348 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002349#define WE_POLICY_MANAGER_DLIST_CMD 12
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302350
2351/*
2352 * <ioctl>
2353 * pm_dbs - Set dbs capability and system preference
2354 *
2355 * @INPUT: dbs, system_pref
2356 * @dbs: Value of DBS capability to be set
2357 * @system_pref: System preference
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002358 * 0:PM_THROUGHPUT 1: PM_POWERSAVE 2: PM_LATENCY
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302359 *
2360 * @OUTPUT: None
2361 *
2362 * This IOCTL is used to set dbs capability and system preference.
2363 *
2364 * @E.g: iwpriv wlan0 pm_dbs dbs system_pref
2365 * iwpriv wlan0 pm_dbs 1 0
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_DBS_CMD 13
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302374
2375/*
2376 * <ioctl>
2377 * pm_pcl - Set pcl for concurrency mode.
2378 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002379 * @INPUT: policy_mgr_con_mode
2380 * @policy_mgr_con_mode: concurrency mode for PCL table
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302381 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2382 *
2383 * @OUTPUT: None
2384 *
2385 * This IOCTL is used to set pcl for concurrency mode.
2386 *
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08002387 * @E.g: iwpriv wlan0 pm_pcl policy_mgr_con_mode
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302388 * iwpriv wlan0 pm_pcl 0
2389 *
2390 * Supported Feature: DBS
2391 *
2392 * Usage: Internal/External
2393 *
2394 * </ioctl>
2395 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002396#define WE_POLICY_MANAGER_PCL_CMD 14
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302397
2398/*
2399 * <ioctl>
2400 * pm_cinfo - Shows the concurrent connection list.
2401 *
2402 * @INPUT: None
2403 *
2404 * @OUTPUT: None
2405 *
2406 * This IOCTL is used to show the concurrent connection list.
2407 *
2408 * @E.g: iwpriv wlan0 pm_cinfo
2409 *
2410 * Supported Feature: DBS
2411 *
2412 * Usage: Internal/External
2413 *
2414 * </ioctl>
2415 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002416#define WE_POLICY_MANAGER_CINFO_CMD 15
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302417
2418/*
2419 * <ioctl>
2420 * pm_ulist - Updates the index value of the concurrent connection list
2421 * with the input parameters provided.
2422 *
2423 * @INPUT: Following 8 arguments:
2424 * @vdev_id: vdev id
2425 * @tx_streams: TX streams
2426 * @rx_streams: RX streams
2427 * @chain_mask: Chain mask
2428 * @type: vdev_type
2429 * AP:1 STA:2 IBSS:3 Monitor:4 NAN:5 OCB:6 NDI:7
2430 * @sub_type: vdev_subtype
2431 * P2P_Device:1 P2P_Client:2 P2P_GO:3
2432 * Proxy_STA:4 Mesh:5 Mesh_11s:6
2433 * @channel: Channel
2434 * @mac: Mac id
2435 *
2436 * @OUTPUT: None
2437 *
2438 * This IOCTL is used to updates the index value of the concurrent
2439 * connection list with the input parameters provided.
2440 *
2441 * @E.g: iwpriv wlan0 pm_ulist vdev_id tx_streams rx_streams chain_mask type
2442 * sub_type channel mac
2443 * iwpriv wlan0 pm_ulist 1 2 2 1 2 3 10 1
2444 *
2445 * Supported Feature: DBS
2446 *
2447 * Usage: Internal/External
2448 *
2449 * </ioctl>
2450 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002451#define WE_POLICY_MANAGER_ULIST_CMD 16
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302452
2453/*
2454 * <ioctl>
2455 * pm_query_action - Initiate actions needed on current connections as
2456 * per the channel provided.
2457 *
2458 * @INPUT: channel
2459 * @channel: Channel on which new connection will be.
2460 *
2461 * @OUTPUT: None
2462 *
2463 * This IOCTL is used to initiate actions needed on current connections
2464 * as per the channel provided.
2465 *
2466 * @E.g: iwpriv wlan0 pm_query_action channel
2467 * iwpriv wlan0 pm_query_action 6
2468 *
2469 * Supported Feature: DBS
2470 *
2471 * Usage: Internal/External
2472 *
2473 * </ioctl>
2474 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002475#define WE_POLICY_MANAGER_QUERY_ACTION_CMD 17
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302476
2477/*
2478 * <ioctl>
2479 * pm_query_allow - Checks for allowed concurrency combination
2480 *
2481 * @INPUT: mode, channel, bandwidth
2482 * @mode: new connection mode
2483 * 0:STA 1:SAP 2:P2P_Client 3:P2P_GO 4:IBSS
2484 * @channel: channel on which new connection is coming up
2485 * @bandwidth: Bandwidth requested by the connection
2486 * 0:None 1:5MHz 2:10MHz 3:20MHz
2487 * 4:40MHz 5:80MHz 6:80+80MHz 7:160MHz
2488 *
2489 * @OUTPUT: None
2490 *
2491 * This IOCTL is used to checks for allowed concurrency combination.
2492 *
2493 * @E.g: iwpriv wlan0 pm_query_allow mode channel bandwidth
2494 * iwpriv wlan0 pm_query_allow 0 6 4
2495 *
2496 * Supported Feature: DBS
2497 *
2498 * Usage: Internal/External
2499 *
2500 * </ioctl>
2501 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002502#define WE_POLICY_MANAGER_QUERY_ALLOW_CMD 18
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302503
2504/*
2505 * <ioctl>
2506 * pm_run_scenario - Create scenario with number of connections provided.
2507 *
2508 * @INPUT: num_of_conn
2509 * @num_of_conn: the number of connections (values: 1~3)
2510 *
2511 * @OUTPUT: None
2512 *
2513 * This IOCTL is used to create scenario with the number of connections
2514 * provided.
2515 *
2516 * @E.g: iwpriv wlan0 pm_run_scenario num_of_conn
2517 * iwpriv wlan0 pm_run_scenario 1
2518 *
2519 * Supported Feature: DBS
2520 *
2521 * Usage: Internal/External
2522 *
2523 * </ioctl>
2524 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002525#define WE_POLICY_MANAGER_SCENARIO_CMD 19
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302526
2527/*
2528 * <ioctl>
2529 * pm_set_hw_mode - Set hardware for single/dual mac.
2530 *
2531 * @INPUT: hw_mode
2532 * 0:single mac 1:dual mac
2533 *
2534 * @OUTPUT: None
2535 *
2536 * This IOCTL is used to set hardware for single/dual mac.
2537 *
2538 * @E.g: iwpriv wlan0 pm_set_hw_mode hw_mode
2539 * iwpriv wlan0 pm_set_hw_mode 1
2540 *
2541 * Supported Feature: DBS
2542 *
2543 * Usage: Internal/External
2544 *
2545 * </ioctl>
2546 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002547#define WE_POLICY_SET_HW_MODE_CMD 20
2548
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302549/*
2550 * <ioctl>
2551 * set_scan_cfg - Set dual MAC scan config parameters.
2552 *
2553 * @INPUT: dbs, dbs_plus_agile_scan, single_mac_scan_with_dbs
2554 * @dbs: Value of DBS bit
2555 * @dbs_plus_agile_scan: Value of DBS plus agile scan bit
2556 * @single_mac_scan_with_dbs: Value of Single MAC scan with DBS
2557 *
2558 * @OUTPUT: None
2559 *
2560 * This IOCTL is used to set the dual MAC scan config.
2561 *
2562 * @E.g: iwpriv wlan0 set_scan_cfg dbs dbs_plus_agile_scan
2563 * single_mac_scan_with_dbs
2564 * iwpriv wlan0 set_scan_cfg 1 0 1
2565 *
2566 * Supported Feature: DBS
2567 *
2568 * Usage: Internal/External
2569 *
2570 * </ioctl>
2571 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002572#define WE_SET_DUAL_MAC_SCAN_CONFIG 21
Nitesh Shahf9503dd2016-12-15 20:26:07 +05302573
2574/*
2575 * <ioctl>
2576 * set_fw_mode_cfg - Sets the dual mac FW mode config
2577 *
2578 * @INPUT: dbs, dfs
2579 * @dbs: DBS bit
2580 * @dfs: Agile DFS bit
2581 *
2582 * @OUTPUT: None
2583 *
2584 * This IOCTL is used to set the dual mac FW mode config.
2585 *
2586 * @E.g: iwpriv wlan0 set_fw_mode_cfg dbs dfs
2587 * iwpriv wlan0 set_fw_mode_cfg 1 1
2588 *
2589 * Supported Feature: DBS
2590 *
2591 * Usage: Internal/External
2592 *
2593 * </ioctl>
2594 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002595#define WE_SET_DUAL_MAC_FW_MODE_CONFIG 22
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -07002596#define WE_SET_MON_MODE_CHAN 23
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002597
2598#ifdef FEATURE_WLAN_TDLS
2599#undef MAX_VAR_ARGS
2600#define MAX_VAR_ARGS 11
2601#else
2602#undef MAX_VAR_ARGS
2603#define MAX_VAR_ARGS 9
2604#endif
2605
Jeff Johnson6fa1e012017-04-05 06:40:53 -07002606/*
2607 * <ioctl>
2608 * fips_test - Perform a FIPS test
2609 *
2610 * @INPUT: Binary representation of the following packed structure
2611 *
2612 * @OUTPUT: Binary representation of the following packed structure
2613 *
2614 * This IOCTL is used to perform FIPS certification testing
2615 *
2616 * @E.g: iwpriv wlan0 fips_test <test vector>
2617 *
2618 * iwpriv wlan0 fips_test <tbd>
2619 *
2620 * Supported Feature: FIPS
2621 *
2622 * Usage: Internal
2623 *
2624 * </ioctl>
2625 */
2626#define WLAN_PRIV_FIPS_TEST (SIOCIWFIRSTPRIV + 8)
2627
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002628/* Private ioctls (with no sub-ioctls) */
2629/* note that they must be odd so that they have "get" semantics */
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302630/*
2631 * <ioctl>
2632 * addTspec - Add TSPEC for each AC
2633 *
2634 * @INPUT: 19 TSPEC params
2635 * @[arg0]: handle
2636 * @[arg1]: tid
2637 * @[arg2]: dir
2638 * @[arg3]: psb
2639 * @[arg4]: up
2640 * @[arg5]: nomMsduSize
2641 * @[arg6]: maxMsduSize
2642 * @[arg7]: minDataRate
2643 * @[arg8]: meanDataRate
2644 * @[arg9]: peakDataRate
2645 * @[arg10]: maxBurstSize
2646 * @[arg11]: minPhyRate
2647 * @[arg12]: sba
2648 * @[arg13]: minServiceIntv
2649 * @[arg14]: suspendIntv
2650 * @[arg15]: burstSizeDefn
2651 * @[arg16]: ackPolicy
2652 * @[arg17]: inactivityPeriod
2653 * @[arg18]: maxServiceIntv
2654 *
2655 * @OUTPUT: Success/Failure
2656 *
2657 * This IOCTL is used to add TSPEC for each AC.
2658 *
2659 * @E.g: iwpriv wlan0 addTspec <handle> <tid> <dir> <psb> <up> <nomMsduSize>
2660 * <maxMsduSize> <minDataRate> <meanDataRate>
2661 * <peakDataRate> <maxBurstSize> <minPhyRate>
2662 * <sba> <minServiceIntv> <suspendIntv>
2663 * <burstSizeDefn> <ackPolicy> <inactivityPeriod>
2664 * <maxServiceIntv>
2665 * iwpriv wlan0 addTspec 7001 6 2 1 6 0x80D0 0x80D0 0x14500 0x14500 0x14500
2666 * 0 0x5B8D80 0x2001 20 2000 0 0 0 2000
2667 * wlan0 addTspec:3
2668 *
2669 * Supported Feature: WMM
2670 *
2671 * Usage: Internal/External
2672 *
2673 * </ioctl>
2674 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002675#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302676/*
2677 * <ioctl>
2678 * delTspec - Delete TSPEC entry for each AC
2679 *
2680 * @INPUT: 1 TSPEC param
2681 * @[arg0]: handle
2682 *
2683 * @OUTPUT: Success/Failure
2684 *
2685 * This IOCTL is used to delete TSPEC entry for each AC.
2686 *
2687 * @E.g: iwpriv wlan0 delTspec <handle>
2688 * iwpriv wlan0 delTspec 7001
2689 * wlan0 delTspec:16
2690 *
2691 * Supported Feature: WMM
2692 *
2693 * Usage: Internal/External
2694 *
2695 * </ioctl>
2696 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002697#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
Sreelakshmi Konamki9be8d412017-03-01 10:29:08 +05302698/*
2699 * <ioctl>
2700 * getTspec - Get TSPEC entry for each AC
2701 *
2702 * @INPUT: 1 TSPEC param
2703 * @[arg0]: handle
2704 *
2705 * @OUTPUT: Success/Failure
2706 *
2707 * This IOCTL is used to get TSPEC entry for each AC.
2708 *
2709 * @E.g: iwpriv wlan0 getTspec <handle>
2710 * iwpriv wlan0 getTspec 7001
2711 * wlan0 delTspec:18
2712 *
2713 * Supported Feature: WMM
2714 *
2715 * Usage: Internal/External
2716 *
2717 * </ioctl>
2718 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002719#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
2720
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002721/* (SIOCIWFIRSTPRIV + 10) is currently unused */
2722/* (SIOCIWFIRSTPRIV + 12) is currently unused */
2723/* (SIOCIWFIRSTPRIV + 14) is currently unused */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07002724#define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15)
2725#define WE_GET_TSF 1
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002726/* (SIOCIWFIRSTPRIV + 16) is currently unused */
2727/* (SIOCIWFIRSTPRIV + 17) is currently unused */
2728/* (SIOCIWFIRSTPRIV + 19) is currently unused */
2729
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002730#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002731
2732/* Private ioctl for setting the host offload feature */
2733#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
2734
2735/* Private ioctl to get the statistics */
2736#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
2737
2738/* Private ioctl to set the Keep Alive Params */
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302739/*
2740 * <ioctl>
2741 * setKeepAlive - Set the keep alive feature
2742 *
2743 * @INPUT: 28 bytes of information in the order of packet type, time period
2744 * host IPv4 address, destination IPv4 address, destination MAC address, bssID
2745 *
2746 * @OUTPUT: None
2747 *
2748 * This IOCTL sets the keep alive feature to send either NULL
2749 * or unsolicited ARP response packets
2750 *
2751 * @E.g: iwpriv wlan0 setKeepAlive
2752 *
2753 * Supported Feature: STA
2754 *
2755 * Usage: Internal/External
2756 *
2757 * </ioctl>
2758 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002759#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
2760
2761#ifdef WLAN_FEATURE_PACKET_FILTERING
2762/* Private ioctl to set the packet filtering params */
2763#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
2764#endif
2765
2766
2767#ifdef FEATURE_WLAN_SCAN_PNO
2768/* Private ioctl to get the statistics */
2769#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
2770#endif
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302771/*
2772 * <ioctl>
2773 * SETBAND - Set the operational band
2774 *
2775 * @INPUT: 0 to Auto, 1 to 5 GHz and 2 to 2.4 GHz
2776 *
2777 * @OUTPUT: None
2778 *
2779 * This IOCTL Set the operational band If the new band is different from the
2780 * current operational band, it aborts the pending scan requests, flushes
2781 * the existing scan results, and then change * the band capability
2782 *
2783 * @E.g: iwpriv wlan0 SETBAND <value>
2784 *
2785 * Supported Feature: STA
2786 *
2787 * Usage: Internal/External
2788 *
2789 * </ioctl>
2790 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002791#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25)
2792
Dustin Brown0cbc7572016-12-16 13:54:40 -08002793#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
Dustin Brown860566f2017-01-31 15:24:43 -08002794/* (SIOCIWFIRSTPRIV + 27) is currently unused */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002795
2796/* Private ioctls and their sub-ioctls */
2797#define WLAN_PRIV_SET_TWO_INT_GET_NONE (SIOCIWFIRSTPRIV + 28)
2798#define WE_SET_SMPS_PARAM 1
Srinivas Girigowda6147c582016-10-18 12:26:15 -07002799#ifdef WLAN_DEBUG
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002800#define WE_SET_FW_CRASH_INJECT 2
2801#endif
2802#define WE_DUMP_DP_TRACE_LEVEL 3
Govind Singha471e5e2015-10-12 17:11:14 +05302803/* Private sub ioctl for enabling and setting histogram interval of profiling */
2804#define WE_ENABLE_FW_PROFILE 4
2805#define WE_SET_FW_PROFILE_HIST_INTVL 5
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002806
Rajeev Kumar9bb2e852016-09-24 12:29:25 -07002807/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002808#define WE_SET_WLAN_SUSPEND 6
2809#define WE_SET_WLAN_RESUME 7
Rajeev Kumara78a0a42016-07-13 19:28:20 -07002810
Dustin Brown8d2d0f52017-04-03 17:02:08 -07002811/*
2812 * <ioctl>
2813 * log_buffer - prints host/target related communication logs via dmesg
2814 *
2815 * @INPUT: Log Id, Count
2816 *
2817 * Log Id:
2818 * 0) HTC_CREDIT_HISTORY_LOG
2819 * 1) COMMAND_LOG,
2820 * 2) COMMAND_TX_CMP_LOG,
2821 * 3) MGMT_COMMAND_LOG,
2822 * 4) MGMT_COMMAND_TX_CMP_LOG,
2823 * 5) EVENT_LOG,
2824 * 6) RX_EVENT_LOG,
2825 * 7) MGMT_EVENT_LOG
2826 *
2827 * @OUTPUT: None
2828 *
2829 * @E.g:
2830 * # print up to 10 of the most recent records from HTC Credit History
2831 * iwpriv wlan0 log_buffer 0 10
2832 * # print up to 3 of the most recent records from Event Log
2833 * iwpriv wlan0 log_buffer 5 3
2834 *
2835 * Supported Feature: WLAN Trace
2836 *
2837 * Usage: Internal/External
2838 *
2839 * </ioctl>
2840 */
2841#define WE_LOG_BUFFER 8
2842
2843enum host_target_comm_log {
2844 HTC_CREDIT_HISTORY_LOG = 0,
2845 COMMAND_LOG,
2846 COMMAND_TX_CMP_LOG,
2847 MGMT_COMMAND_LOG,
2848 MGMT_COMMAND_TX_CMP_LOG,
2849 EVENT_LOG,
2850 RX_EVENT_LOG,
2851 MGMT_EVENT_LOG
2852};
2853
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002854/* (SIOCIWFIRSTPRIV + 29) is currently unused */
2855
2856/* 802.11p IOCTL */
2857#define WLAN_SET_DOT11P_CHANNEL_SCHED (SIOCIWFIRSTPRIV + 30)
2858
Sen, Devendra9ca8c432017-02-23 15:10:26 +05302859/*
2860 * <ioctl>
2861 * getLinkSpeed - Gets the current link speed in Mbps
2862 *
2863 * @INPUT: None
2864 *
2865 * @OUTPUT: linkspeed in mbps
2866 * wlan0 getLinkSpeed:7
2867 *
2868 * This IOCTL is used get the current link speed in Mbps
2869 *
2870 * @E.g: iwpriv wlan0 getLinkSpeed
2871 *
2872 * Supported Feature: STA
2873 *
2874 * Usage: Internal/External
2875 *
2876 * </ioctl>
2877 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002878#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
2879
2880#define WLAN_STATS_INVALID 0
2881#define WLAN_STATS_RETRY_CNT 1
2882#define WLAN_STATS_MUL_RETRY_CNT 2
2883#define WLAN_STATS_TX_FRM_CNT 3
2884#define WLAN_STATS_RX_FRM_CNT 4
2885#define WLAN_STATS_FRM_DUP_CNT 5
2886#define WLAN_STATS_FAIL_CNT 6
2887#define WLAN_STATS_RTS_FAIL_CNT 7
2888#define WLAN_STATS_ACK_FAIL_CNT 8
2889#define WLAN_STATS_RTS_SUC_CNT 9
2890#define WLAN_STATS_RX_DISCARD_CNT 10
2891#define WLAN_STATS_RX_ERROR_CNT 11
2892#define WLAN_STATS_TX_BYTE_CNT 12
2893
2894#define WLAN_STATS_RX_BYTE_CNT 13
2895#define WLAN_STATS_RX_RATE 14
2896#define WLAN_STATS_TX_RATE 15
2897
2898#define WLAN_STATS_RX_UC_BYTE_CNT 16
2899#define WLAN_STATS_RX_MC_BYTE_CNT 17
2900#define WLAN_STATS_RX_BC_BYTE_CNT 18
2901#define WLAN_STATS_TX_UC_BYTE_CNT 19
2902#define WLAN_STATS_TX_MC_BYTE_CNT 20
2903#define WLAN_STATS_TX_BC_BYTE_CNT 21
2904
2905#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
2906 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) { \
2907 *__p++ = __type; \
2908 *__p++ = __size; \
2909 memcpy(__p, __val, __size); \
2910 __p += __size; \
2911 __tlen += __size + 2; \
2912 } else { \
Jeff Johnson99bac312016-06-28 10:38:18 -07002913 hdd_err("FILL_TLV Failed!!!"); \
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002914 } \
2915 } while (0)
2916
2917#define VERSION_VALUE_MAX_LEN 32
2918
2919#define TX_PER_TRACKING_DEFAULT_RATIO 5
2920#define TX_PER_TRACKING_MAX_RATIO 10
2921#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
2922
2923#define WLAN_ADAPTER 0
2924#define P2P_ADAPTER 1
2925
2926/**
2927 * mem_alloc_copy_from_user_helper - copy from user helper
2928 * @wrqu_data: wireless extensions request data
2929 * @len: length of @wrqu_data
2930 *
2931 * Helper function to allocate buffer and copy user data.
2932 *
2933 * Return: On success return a pointer to a kernel buffer containing a
2934 * copy of the userspace data (with an additional NUL character
2935 * appended for safety). On failure return %NULL.
2936 */
2937void *mem_alloc_copy_from_user_helper(const __user void *wrqu_data, size_t len)
2938{
2939 u8 *ptr = NULL;
2940
2941 /* in order to protect the code, an extra byte is post
2942 * appended to the buffer and the null termination is added.
2943 * However, when allocating (len+1) byte of memory, we need to
2944 * make sure that there is no uint overflow when doing
2945 * addition. In theory check len < UINT_MAX protects the uint
2946 * overflow. For wlan private ioctl, the buffer size is much
2947 * less than UINT_MAX, as a good guess, now, it is assumed
2948 * that the private command buffer size is no greater than 4K
2949 * (4096 bytes). So we use 4096 as the upper boundary for now.
2950 */
2951 if (len > MAX_USER_COMMAND_SIZE) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08002952 hdd_err("Invalid length: %zu max: %u",
2953 len, MAX_USER_COMMAND_SIZE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002954 return NULL;
2955 }
2956
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002957 ptr = qdf_mem_malloc(len + 1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002958 if (NULL == ptr) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002959 hdd_err("unable to allocate memory");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002960 return NULL;
2961 }
2962
2963 if (copy_from_user(ptr, wrqu_data, len)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07002964 hdd_err("failed to copy data to user buffer");
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07002965 qdf_mem_free(ptr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002966 return NULL;
2967 }
2968 ptr[len] = '\0';
2969 return ptr;
2970}
2971
2972/**
2973 * hdd_priv_get_data() - Get pointer to ioctl private data
2974 * @p_priv_data: pointer to iw_point struct to be filled
2975 * @wrqu: Pointer to IOCTL Data received from userspace
2976 *
2977 * Helper function to get compatible struct iw_point passed to ioctl
2978 *
2979 * Return - 0 if p_priv_data successfully filled, error otherwise
2980 */
2981int hdd_priv_get_data(struct iw_point *p_priv_data, union iwreq_data *wrqu)
2982{
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002983 if ((NULL == p_priv_data) || (NULL == wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002984 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07002985
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002986#ifdef CONFIG_COMPAT
2987 if (is_compat_task()) {
2988 struct compat_iw_point *p_compat_priv_data;
2989
2990 /* Compat task:
2991 * typecast to compat structure and copy the members.
2992 */
2993 p_compat_priv_data = (struct compat_iw_point *)&wrqu->data;
2994
2995 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
2996 p_priv_data->length = p_compat_priv_data->length;
2997 p_priv_data->flags = p_compat_priv_data->flags;
2998 } else {
2999#endif /* #ifdef CONFIG_COMPAT */
3000
3001 /* Non compat task: directly copy the structure. */
3002 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
3003
3004#ifdef CONFIG_COMPAT
3005 }
3006#endif /* #ifdef CONFIG_COMPAT */
3007
3008 return 0;
3009}
3010
Jeff Johnson441e1f72017-02-07 08:50:49 -08003011static int hdd_check_wext_control(enum hdd_wext_control wext_control,
3012 struct iw_request_info *info)
3013{
3014 switch (wext_control) {
3015 default:
3016 case hdd_wext_disabled:
3017 hdd_err("Rejecting disabled ioctl %x", info->cmd);
3018 return -ENOTSUPP;
3019 case hdd_wext_deprecated:
3020 hdd_warn("Using deprecated ioctl %x", info->cmd);
3021 return 0;
3022 case hdd_wext_enabled:
3023 return 0;
3024 }
3025}
3026
Jeff Johnson82797b62017-08-11 15:31:27 -07003027int hdd_check_standard_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08003028 struct iw_request_info *info)
3029{
3030 return hdd_check_wext_control(hdd_ctx->config->standard_wext_control,
3031 info);
3032}
3033
Jeff Johnson82797b62017-08-11 15:31:27 -07003034int hdd_check_private_wext_control(struct hdd_context *hdd_ctx,
Jeff Johnson441e1f72017-02-07 08:50:49 -08003035 struct iw_request_info *info)
3036{
3037 return hdd_check_wext_control(hdd_ctx->config->private_wext_control,
3038 info);
3039}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003040
3041/**
3042 * hdd_wlan_get_stats() - Get txrx stats in SAP mode
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003043 * @adapter: Pointer to the hdd adapter.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003044 * @length: Size of the data copied
3045 * @buffer: Pointer to char buffer.
3046 * @buf_len: Length of the char buffer.
3047 *
3048 * This function called when the "iwpriv wlan0 get_stats" command is given.
3049 * It used to collect the txrx stats when the device is configured in SAP mode.
3050 *
3051 * Return - none
3052 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003053void hdd_wlan_get_stats(struct hdd_adapter *adapter, uint16_t *length,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003054 char *buffer, uint16_t buf_len)
3055{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003056 struct hdd_tx_rx_stats *pStats = &adapter->hdd_stats.hddTxRxStats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003057 uint32_t len = 0;
3058 uint32_t total_rx_pkt = 0, total_rx_dropped = 0;
3059 uint32_t total_rx_delv = 0, total_rx_refused = 0;
3060 int i = 0;
3061
3062 for (; i < NUM_CPUS; i++) {
3063 total_rx_pkt += pStats->rxPackets[i];
3064 total_rx_dropped += pStats->rxDropped[i];
3065 total_rx_delv += pStats->rxDelivered[i];
3066 total_rx_refused += pStats->rxRefused[i];
3067 }
3068
3069 len = scnprintf(buffer, buf_len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003070 "\nTransmit[%lu] - "
Mohit Khannad0b63f52017-02-18 18:05:52 -08003071 "called %u, dropped %u orphan %u,"
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003072 "\n[dropped] BK %u, BE %u, VI %u, VO %u"
3073 "\n[classified] BK %u, BE %u, VI %u, VO %u"
3074 "\n\nReceive[%lu] - "
3075 "packets %u, dropped %u, delivered %u, refused %u"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003076 "\n",
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003077 qdf_system_ticks(),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003078 pStats->txXmitCalled,
3079 pStats->txXmitDropped,
Mohit Khannad0b63f52017-02-18 18:05:52 -08003080 pStats->txXmitOrphaned,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003081
3082 pStats->txXmitDroppedAC[SME_AC_BK],
3083 pStats->txXmitDroppedAC[SME_AC_BE],
3084 pStats->txXmitDroppedAC[SME_AC_VI],
3085 pStats->txXmitDroppedAC[SME_AC_VO],
3086
3087 pStats->txXmitClassifiedAC[SME_AC_BK],
3088 pStats->txXmitClassifiedAC[SME_AC_BE],
3089 pStats->txXmitClassifiedAC[SME_AC_VI],
3090 pStats->txXmitClassifiedAC[SME_AC_VO],
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003091 qdf_system_ticks(),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003092 total_rx_pkt, total_rx_dropped, total_rx_delv, total_rx_refused
3093 );
3094
3095 for (i = 0; i < NUM_CPUS; i++) {
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003096 if (pStats->rxPackets[i] == 0)
3097 continue;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003098 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003099 "Rx CPU[%d]:"
3100 "packets %u, dropped %u, delivered %u, refused %u\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003101 i, pStats->rxPackets[i], pStats->rxDropped[i],
3102 pStats->rxDelivered[i], pStats->rxRefused[i]);
3103 }
3104
3105 len += scnprintf(buffer + len, buf_len - len,
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003106 "\nTX_FLOW"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003107 "\nCurrent status: %s"
3108 "\ntx-flow timer start count %u"
3109 "\npause count %u, unpause count %u",
3110 (pStats->is_txflow_paused == true ? "PAUSED" : "UNPAUSED"),
3111 pStats->txflow_timer_cnt,
3112 pStats->txflow_pause_cnt,
3113 pStats->txflow_unpause_cnt);
3114
Leo Changfdb45c32016-10-28 11:09:23 -07003115 len += cdp_stats(cds_get_context(QDF_MODULE_ID_SOC),
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003116 adapter->sessionId, &buffer[len], (buf_len - len));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003117 *length = len + 1;
3118}
3119
3120/**
Dustin Brownd9322482017-01-09 12:46:03 -08003121 * wlan_hdd_write_suspend_resume_stats() - Writes suspend/resume stats to buffer
3122 * @hdd_ctx: The Hdd context owning the stats to be written
3123 * @buffer: The char buffer to write to
3124 * @max_len: The maximum number of chars to write
3125 *
3126 * This assumes hdd_ctx has already been validated, and buffer is not NULL.
3127 *
3128 * Return - length of written content, negative number on error
3129 */
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003130static int wlan_hdd_write_suspend_resume_stats(struct hdd_context *hdd_ctx,
Dustin Brownd9322482017-01-09 12:46:03 -08003131 char *buffer, uint16_t max_len)
3132{
3133 QDF_STATUS status;
3134 struct suspend_resume_stats *sr_stats;
3135 struct sir_wake_lock_stats wow_stats;
3136
3137 sr_stats = &hdd_ctx->suspend_resume_stats;
3138
3139 status = wma_get_wakelock_stats(&wow_stats);
3140 if (QDF_IS_STATUS_ERROR(status)) {
3141 hdd_err("Failed to get WoW stats");
3142 return qdf_status_to_os_return(status);
3143 }
3144
3145 return scnprintf(buffer, max_len,
3146 "\n"
3147 "Suspends: %u\n"
3148 "Resumes: %u\n"
3149 "\n"
3150 "Suspend Fail Reasons\n"
3151 "\tIPA: %u\n"
3152 "\tRadar: %u\n"
3153 "\tRoam: %u\n"
3154 "\tScan: %u\n"
3155 "\tInitial Wakeup: %u\n"
3156 "\n"
3157 "WoW Wake Reasons\n"
3158 "\tunicast: %u\n"
3159 "\tbroadcast: %u\n"
3160 "\tIPv4 multicast: %u\n"
3161 "\tIPv6 multicast: %u\n"
3162 "\tIPv6 multicast RA: %u\n"
3163 "\tIPv6 multicast NS: %u\n"
3164 "\tIPv6 multicast NA: %u\n"
3165 "\tICMPv4: %u\n"
3166 "\tICMPv6: %u\n"
3167 "\tRSSI Breach: %u\n"
3168 "\tLow RSSI: %u\n"
3169 "\tG-Scan: %u\n"
3170 "\tPNO Complete: %u\n"
3171 "\tPNO Match: %u\n",
3172 sr_stats->suspends,
3173 sr_stats->resumes,
3174 sr_stats->suspend_fail[SUSPEND_FAIL_IPA],
3175 sr_stats->suspend_fail[SUSPEND_FAIL_RADAR],
3176 sr_stats->suspend_fail[SUSPEND_FAIL_ROAM],
3177 sr_stats->suspend_fail[SUSPEND_FAIL_SCAN],
3178 sr_stats->suspend_fail[SUSPEND_FAIL_INITIAL_WAKEUP],
3179 wow_stats.wow_ucast_wake_up_count,
3180 wow_stats.wow_bcast_wake_up_count,
3181 wow_stats.wow_ipv4_mcast_wake_up_count,
3182 wow_stats.wow_ipv6_mcast_wake_up_count,
3183 wow_stats.wow_ipv6_mcast_ra_stats,
3184 wow_stats.wow_ipv6_mcast_ns_stats,
3185 wow_stats.wow_ipv6_mcast_na_stats,
3186 wow_stats.wow_icmpv4_count,
3187 wow_stats.wow_icmpv6_count,
3188 wow_stats.wow_rssi_breach_wake_up_count,
3189 wow_stats.wow_low_rssi_wake_up_count,
3190 wow_stats.wow_gscan_wake_up_count,
3191 wow_stats.wow_pno_complete_wake_up_count,
3192 wow_stats.wow_pno_match_wake_up_count);
3193}
3194
3195/**
Govind Singha471e5e2015-10-12 17:11:14 +05303196 * hdd_wlan_list_fw_profile() - Get fw profiling points
3197 * @length: Size of the data copied
3198 * @buffer: Pointer to char buffer.
3199 * @buf_len: Length of the char buffer.
3200 *
3201 * This function called when the "iwpriv wlan0 listProfile" command is given.
3202 * It is used to get the supported profiling points in FW.
3203 *
3204 * Return - none
3205 */
3206void hdd_wlan_list_fw_profile(uint16_t *length,
3207 char *buffer, uint16_t buf_len)
3208{
3209 uint32_t len = 0;
3210
3211 len = scnprintf(buffer, buf_len,
3212 "PROF_CPU_IDLE: %u\n"
3213 "PROF_PPDU_PROC: %u\n"
3214 "PROF_PPDU_POST: %u\n"
3215 "PROF_HTT_TX_INPUT: %u\n"
3216 "PROF_MSDU_ENQ: %u\n"
3217 "PROF_PPDU_POST_HAL: %u\n"
3218 "PROF_COMPUTE_TX_TIME: %u\n",
3219 PROF_CPU_IDLE,
3220 PROF_PPDU_PROC,
3221 PROF_PPDU_POST,
3222 PROF_HTT_TX_INPUT,
3223 PROF_MSDU_ENQ,
3224 PROF_PPDU_POST_HAL,
3225 PROF_COMPUTE_TX_TIME);
3226
3227 *length = len + 1;
3228}
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003229/**
3230 * hdd_display_stats_help() - print statistics help
3231 *
3232 * Return: none
3233 */
3234void hdd_display_stats_help(void)
3235{
3236 hdd_err("iwpriv wlan0 dumpStats [option] - dump statistics");
3237 hdd_err("iwpriv wlan0 clearStats [option] - clear statistics");
3238 hdd_err("options:");
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003239 hdd_err(" 1 -- TXRX PATH statistics");
3240 hdd_err(" 2 -- TXRX HIST statistics");
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003241 hdd_err(" 3 -- TSO statistics");
3242 hdd_err(" 4 -- Network queue statistics");
3243 hdd_err(" 5 -- Flow control statistics");
3244 hdd_err(" 6 -- Per Layer statistics");
3245 hdd_err(" 7 -- Copy engine interrupt statistics");
3246 hdd_err(" 8 -- LRO statistics");
3247 hdd_err(" 9 -- NAPI statistics");
3248}
Govind Singha471e5e2015-10-12 17:11:14 +05303249
3250/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003251 * hdd_wlan_dump_stats() - display dump Stats
3252 * @adapter: adapter handle
3253 * @value: value from user
3254 *
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003255 * Return: 0 => success, error code on failure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003256 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07003257int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003258{
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003259 int ret = 0;
3260 QDF_STATUS status;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003261 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003262
3263 switch (value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003264 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003265 wlan_hdd_display_tx_rx_histogram(hdd_ctx);
3266 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003267 case CDP_HDD_NETIF_OPER_HISTORY:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003268 wlan_hdd_display_netif_queue_history(hdd_ctx);
3269 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003270 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05303271 hdd_display_hif_stats();
3272 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003273 case CDP_LRO_STATS:
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003274 hdd_lro_display_stats(hdd_ctx);
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07003275 case CDP_NAPI_STATS:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003276 if (hdd_display_napi_stats()) {
3277 hdd_err("error displaying napi stats");
3278 ret = EFAULT;
3279 }
Dhanashri Atree7d442a2016-07-14 18:20:29 -07003280 break;
Vignesh Viswanathan66c951d2017-09-06 12:23:42 +05303281 case CDP_DISCONNECT_STATS:
3282 sme_display_disconnect_stats(WLAN_HDD_GET_HAL_CTX(adapter),
3283 adapter->sessionId);
3284 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003285 default:
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003286 status = cdp_display_stats(cds_get_context(QDF_MODULE_ID_SOC),
3287 value);
3288 if (status == QDF_STATUS_E_INVAL) {
3289 hdd_display_stats_help();
3290 ret = EINVAL;
3291 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003292 break;
3293 }
Mohit Khanna3e2115b2016-10-11 13:18:29 -07003294 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003295}
3296
3297/**
3298 * hdd_wlan_get_version() - Get driver version information
Arun Khandavallia96c2c02016-05-17 19:15:34 +05303299 * @hdd_ctx: Global HDD context
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003300 * @wrqu: Pointer to IOCTL REQUEST Data.
3301 * @extra: Pointer to destination buffer
3302 *
3303 * This function is used to get Wlan Driver, Firmware, & Hardware
3304 * Version information. If @wrqu and @extra are specified, then the
3305 * version string is returned. Otherwise it is simply printed to the
3306 * kernel log.
3307 *
3308 * Return: none
3309 */
Jeff Johnson6d38ab82017-08-28 11:36:27 -07003310void hdd_wlan_get_version(struct hdd_context *hdd_ctx, union iwreq_data *wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003311 char *extra)
3312{
Arun Khandavallia96c2c02016-05-17 19:15:34 +05303313 tSirVersionString wcnss_sw_version;
3314 const char *swversion;
3315 const char *hwversion;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07003316 uint32_t msp_id = 0, mspid = 0, siid = 0, crmid = 0, sub_id = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003317
Arun Khandavallia96c2c02016-05-17 19:15:34 +05303318 if (!hdd_ctx) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003319 hdd_err("Invalid context, HDD context is null");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003320 goto error;
3321 }
3322
Arun Khandavallia96c2c02016-05-17 19:15:34 +05303323 snprintf(wcnss_sw_version, sizeof(wcnss_sw_version), "%08x",
3324 hdd_ctx->target_fw_version);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003325
Arun Khandavallia96c2c02016-05-17 19:15:34 +05303326 swversion = wcnss_sw_version;
3327 msp_id = (hdd_ctx->target_fw_version & 0xf0000000) >> 28;
3328 mspid = (hdd_ctx->target_fw_version & 0xf000000) >> 24;
3329 siid = (hdd_ctx->target_fw_version & 0xf00000) >> 20;
3330 crmid = hdd_ctx->target_fw_version & 0x7fff;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07003331 sub_id = (hdd_ctx->target_fw_vers_ext & 0xf0000000) >> 28;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003332
Arun Khandavallia96c2c02016-05-17 19:15:34 +05303333 hwversion = hdd_ctx->target_hw_name;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003334
3335 if (wrqu && extra) {
3336 wrqu->data.length =
3337 scnprintf(extra, WE_MAX_STR_LEN,
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07003338 "Host SW:%s, FW:%d.%d.%d.%d.%d, HW:%s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003339 QWLAN_VERSIONSTR,
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07003340 msp_id, mspid, siid, crmid,
3341 sub_id, hwversion);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003342 } else {
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07003343 pr_info("Host SW:%s, FW:%d.%d.%d.%d.%d, HW:%s\n",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003344 QWLAN_VERSIONSTR,
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07003345 msp_id, mspid, siid, crmid, sub_id, hwversion);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003346 }
3347error:
3348 return;
3349}
3350
3351/**
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003352 * hdd_wlan_get_ibss_mac_addr_from_staid() - Get IBSS MAC address
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003353 * @adapter: Adapter upon which the IBSS client is active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003354 * @staIdx: Station index of the IBSS peer
3355 *
3356 * Return: a pointer to the MAC address of the IBSS peer if the peer is
3357 * found, otherwise %NULL.
3358 */
3359struct qdf_mac_addr *
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003360hdd_wlan_get_ibss_mac_addr_from_staid(struct hdd_adapter *adapter,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003361 uint8_t staIdx)
3362{
3363 uint8_t idx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07003364 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003365
Naveen Rawatc45d1622016-07-05 12:20:09 -07003366 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07003367 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07003368 sta_ctx->conn_info.staId[idx] &&
3369 staIdx == sta_ctx->conn_info.staId[idx]) {
3370 return &sta_ctx->conn_info.peerMacAddress[idx];
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003371 }
3372 }
3373 return NULL;
3374}
3375
3376/**
3377 * hdd_wlan_get_ibss_peer_info() - Print IBSS peer information
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003378 * @adapter: Adapter upon which the IBSS client is active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003379 * @staIdx: Station index of the IBSS peer
3380 *
3381 * Return: QDF_STATUS_STATUS if the peer was found and displayed,
3382 * otherwise an appropriate QDF_STATUS_E_* failure code.
3383 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003384static QDF_STATUS hdd_wlan_get_ibss_peer_info(struct hdd_adapter *adapter,
Jeff Johnsonaf2a0932016-10-05 14:52:57 -07003385 uint8_t staIdx)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003386{
3387 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003388 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
3389 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003390 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003391
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003392 INIT_COMPLETION(adapter->ibss_peer_info_comp);
3393 status = sme_request_ibss_peer_info(hHal, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003394 hdd_get_ibss_peer_info_cb,
3395 false, staIdx);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003396
3397 if (QDF_STATUS_SUCCESS == status) {
3398 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003399
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003400 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003401 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003402 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3403 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003404 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003405 return QDF_STATUS_E_FAILURE;
3406 }
3407
3408 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003409 hdd_debug("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numPeers);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003410 {
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003411 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3412 uint32_t tx_rate = pPeerInfo->peerInfoParams[0].txRate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003413
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003414 qdf_mem_copy(mac_addr, pPeerInfo->peerInfoParams[0].
3415 mac_addr, sizeof(mac_addr));
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003416 hdd_debug("PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003417 mac_addr, (int)tx_rate,
3418 (int)pPeerInfo->peerInfoParams[0].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003419 }
3420 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003421 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003422 }
3423
3424 return status;
3425}
3426
3427/**
3428 * hdd_wlan_get_ibss_peer_info_all() - Print all IBSS peers
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003429 * @adapter: Adapter upon which the IBSS clients are active
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003430 *
3431 * Return: QDF_STATUS_STATUS if the peer information was retrieved and
3432 * displayed, otherwise an appropriate QDF_STATUS_E_* failure code.
3433 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003434static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(struct hdd_adapter *adapter)
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003435{
3436 QDF_STATUS status = QDF_STATUS_E_FAILURE;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003437 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
3438 struct hdd_station_ctx *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003439 tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003440 int i;
3441
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003442 INIT_COMPLETION(adapter->ibss_peer_info_comp);
3443 status = sme_request_ibss_peer_info(hHal, adapter,
Prakash Dhavali4c2a9fe2016-12-02 16:01:08 -08003444 hdd_get_ibss_peer_info_cb,
3445 true, 0xFF);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003446
3447 if (QDF_STATUS_SUCCESS == status) {
3448 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003449
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003450 rc = wait_for_completion_timeout
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003451 (&adapter->ibss_peer_info_comp,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003452 msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT));
3453 if (!rc) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003454 hdd_err("failed wait on ibss_peer_info_comp");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003455 return QDF_STATUS_E_FAILURE;
3456 }
3457
3458 /** Print the peer info */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003459 hdd_debug("pPeerInfo->numIBSSPeers = %d ",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003460 (int)pPeerInfo->numPeers);
3461 for (i = 0; i < pPeerInfo->numPeers; i++) {
3462 uint8_t mac_addr[QDF_MAC_ADDR_SIZE];
3463 uint32_t tx_rate;
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003464
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003465 tx_rate = pPeerInfo->peerInfoParams[i].txRate;
3466 qdf_mem_copy(mac_addr,
3467 pPeerInfo->peerInfoParams[i].mac_addr,
3468 sizeof(mac_addr));
3469
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003470 hdd_debug(" PEER ADDR : %pM TxRate: %d Mbps RSSI: %d",
Rajeev Kumar94c9b452016-03-24 12:58:47 -07003471 mac_addr, (int)tx_rate,
3472 (int)pPeerInfo->peerInfoParams[i].rssi);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003473 }
3474 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07003475 hdd_warn("Warning: sme_request_ibss_peer_info Request failed");
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08003476 }
3477
3478 return status;
3479}
3480
3481/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003482 * hdd_wlan_get_freq() - Convert channel to frequency
3483 * @channel: channel to be converted
3484 * @pfreq: where to store the frequency
3485 *
3486 * Return: 1 on success, otherwise a negative errno
3487 */
3488int hdd_wlan_get_freq(uint32_t channel, uint32_t *pfreq)
3489{
3490 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07003491
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003492 if (channel > 0) {
3493 for (i = 0; i < FREQ_CHAN_MAP_TABLE_SIZE; i++) {
3494 if (channel == freq_chan_map[i].chan) {
3495 *pfreq = freq_chan_map[i].freq;
3496 return 1;
3497 }
3498 }
3499 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003500 hdd_err("Invalid channel no=%d!!", channel);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003501 return -EINVAL;
3502}
3503
Jeff Johnsona5444942017-01-23 13:11:08 -08003504struct rssi_priv {
3505 int8_t rssi;
3506};
3507
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003508/**
3509 * hdd_get_rssi_cb() - "Get RSSI" callback function
3510 * @rssi: Current RSSI of the station
Jeff Johnsona5444942017-01-23 13:11:08 -08003511 * @sta_id: ID of the station
3512 * @context: opaque context originally passed to SME. HDD always passes
3513 * a cookie for the request context
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003514 *
3515 * Return: None
3516 */
Jeff Johnsona5444942017-01-23 13:11:08 -08003517static void hdd_get_rssi_cb(int8_t rssi, uint32_t sta_id, void *context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003518{
Jeff Johnsona5444942017-01-23 13:11:08 -08003519 struct hdd_request *request;
3520 struct rssi_priv *priv;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003521
Jeff Johnsona5444942017-01-23 13:11:08 -08003522 request = hdd_request_get(context);
3523 if (!request) {
3524 hdd_err("Obsolete request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003525 return;
3526 }
3527
Jeff Johnsona5444942017-01-23 13:11:08 -08003528 priv = hdd_request_priv(request);
3529 priv->rssi = rssi;
3530 hdd_request_complete(request);
3531 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003532}
3533
3534/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003535 * wlan_hdd_get_rssi() - Get the current RSSI
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003536 * @adapter: adapter upon which the measurement is requested
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003537 * @rssi_value: pointer to where the RSSI should be returned
3538 *
Anurag Chouhanf04e84f2016-03-03 10:12:12 +05303539 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003540 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003541QDF_STATUS wlan_hdd_get_rssi(struct hdd_adapter *adapter, int8_t *rssi_value)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003542{
Jeff Johnsonce2ee982017-09-03 09:27:35 -07003543 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07003544 struct hdd_station_ctx *sta_ctx;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303545 QDF_STATUS hstatus;
Jeff Johnsona5444942017-01-23 13:11:08 -08003546 int ret;
3547 void *cookie;
3548 struct hdd_request *request;
3549 struct rssi_priv *priv;
3550 static const struct hdd_request_params params = {
3551 .priv_size = sizeof(*priv),
3552 .timeout_ms = WLAN_WAIT_TIME_STATS,
3553 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003554
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003555 if (NULL == adapter) {
3556 hdd_err("Invalid context, adapter");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303557 return QDF_STATUS_E_FAULT;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003558 }
Hanumanth Reddy Pothula2a8a7402017-07-03 14:06:11 +05303559 if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) {
Prashanth Bhatta9e143052015-12-04 11:56:47 -08003560 hdd_err("Recovery in Progress. State: 0x%x Ignore!!!",
3561 cds_get_driver_state());
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003562 /* return a cached value */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003563 *rssi_value = adapter->rssi;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303564 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003565 }
3566
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003567 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsond377dce2017-10-04 10:32:42 -07003568 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003569
Jeff Johnsond377dce2017-10-04 10:32:42 -07003570 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003571 hdd_debug("Not associated!, rssi on disconnect %d",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003572 adapter->rssi_on_disconnect);
3573 *rssi_value = adapter->rssi_on_disconnect;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303574 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003575 }
3576
Jeff Johnsond377dce2017-10-04 10:32:42 -07003577 if (sta_ctx->hdd_ReassocScenario) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08003578 hdd_debug("Roaming in progress, return cached RSSI");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003579 *rssi_value = adapter->rssi;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303580 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003581 }
3582
Jeff Johnsona5444942017-01-23 13:11:08 -08003583 request = hdd_request_alloc(&params);
3584 if (!request) {
3585 hdd_err("Request allocation failure, return cached RSSI");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003586 *rssi_value = adapter->rssi;
Jeff Johnsona5444942017-01-23 13:11:08 -08003587 return QDF_STATUS_SUCCESS;
3588 }
3589 cookie = hdd_request_cookie(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003590
Jeff Johnsonce2ee982017-09-03 09:27:35 -07003591 hstatus = sme_get_rssi(hdd_ctx->hHal, hdd_get_rssi_cb,
Jeff Johnsond377dce2017-10-04 10:32:42 -07003592 sta_ctx->conn_info.staId[0],
3593 sta_ctx->conn_info.bssId, adapter->rssi,
Jeff Johnson8bd23352017-09-26 11:39:24 -07003594 cookie);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303595 if (QDF_STATUS_SUCCESS != hstatus) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003596 hdd_err("Unable to retrieve RSSI");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003597 /* we'll returned a cached value below */
3598 } else {
3599 /* request was sent -- wait for the response */
Jeff Johnsona5444942017-01-23 13:11:08 -08003600 ret = hdd_request_wait_for_response(request);
3601 if (ret) {
3602 hdd_warn("SME timed out while retrieving RSSI");
3603 /* we'll returned a cached value below */
3604 } else {
3605 /* update the adapter with the fresh results */
3606 priv = hdd_request_priv(request);
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303607 /*
3608 * update rssi only if its valid else return previous
3609 * valid rssi.
3610 */
3611 if (priv->rssi)
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003612 adapter->rssi = priv->rssi;
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303613
3614 /*
3615 * for new connection there might be no valid previous
3616 * RSSI.
3617 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003618 if (!adapter->rssi) {
3619 hdd_get_rssi_snr_by_bssid(adapter,
Jeff Johnsond377dce2017-10-04 10:32:42 -07003620 sta_ctx->conn_info.bssId.bytes,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003621 &adapter->rssi, NULL);
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303622 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003623 }
3624 }
3625
Jeff Johnsona5444942017-01-23 13:11:08 -08003626 /*
3627 * either we never sent a request, we sent a request and
3628 * received a response or we sent a request and timed out.
3629 * regardless we are done with the request.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003630 */
Jeff Johnsona5444942017-01-23 13:11:08 -08003631 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003632
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003633 *rssi_value = adapter->rssi;
Rajeev Kumar Sirasanagandla5bacf7f2017-05-10 15:31:40 +05303634 hdd_debug("RSSI = %d", *rssi_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003635
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303636 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003637}
3638
Jeff Johnson002cb972017-01-23 14:59:07 -08003639struct snr_priv {
3640 int8_t snr;
3641};
3642
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003643/**
Jeff Johnson8eaff302017-01-23 11:03:31 -08003644 * hdd_get_snr_cb() - "Get SNR" callback function
3645 * @snr: Current SNR of the station
Jeff Johnson002cb972017-01-23 14:59:07 -08003646 * @sta_id: ID of the station
3647 * @context: opaque context originally passed to SME. HDD always passes
3648 * a cookie for the request context
Jeff Johnson8eaff302017-01-23 11:03:31 -08003649 *
3650 * Return: None
3651 */
Jeff Johnson002cb972017-01-23 14:59:07 -08003652static void hdd_get_snr_cb(int8_t snr, uint32_t sta_id, void *context)
Jeff Johnson8eaff302017-01-23 11:03:31 -08003653{
Jeff Johnson002cb972017-01-23 14:59:07 -08003654 struct hdd_request *request;
3655 struct snr_priv *priv;
Jeff Johnson8eaff302017-01-23 11:03:31 -08003656
Jeff Johnson002cb972017-01-23 14:59:07 -08003657 request = hdd_request_get(context);
3658 if (!request) {
3659 hdd_err("Obsolete request");
Jeff Johnson8eaff302017-01-23 11:03:31 -08003660 return;
3661 }
3662
Jeff Johnson002cb972017-01-23 14:59:07 -08003663 /* propagate response back to requesting thread */
3664 priv = hdd_request_priv(request);
3665 priv->snr = snr;
3666 hdd_request_complete(request);
3667 hdd_request_put(request);
Jeff Johnson8eaff302017-01-23 11:03:31 -08003668}
3669
3670/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003671 * wlan_hdd_get_snr() - Get the current SNR
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003672 * @adapter: adapter upon which the measurement is requested
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003673 * @snr: pointer to where the SNR should be returned
3674 *
Anurag Chouhanf04e84f2016-03-03 10:12:12 +05303675 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003676 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003677QDF_STATUS wlan_hdd_get_snr(struct hdd_adapter *adapter, int8_t *snr)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003678{
Jeff Johnsonce2ee982017-09-03 09:27:35 -07003679 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07003680 struct hdd_station_ctx *sta_ctx;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303681 QDF_STATUS hstatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003682 int valid;
Jeff Johnson002cb972017-01-23 14:59:07 -08003683 int ret;
3684 void *cookie;
3685 struct hdd_request *request;
3686 struct snr_priv *priv;
3687 static const struct hdd_request_params params = {
3688 .priv_size = sizeof(*priv),
3689 .timeout_ms = WLAN_WAIT_TIME_STATS,
3690 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003691
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303692 ENTER();
3693
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003694 if (NULL == adapter) {
3695 hdd_err("Invalid context, adapter");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303696 return QDF_STATUS_E_FAULT;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003697 }
3698
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003699 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003700
Jeff Johnsonce2ee982017-09-03 09:27:35 -07003701 valid = wlan_hdd_validate_context(hdd_ctx);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303702 if (0 != valid)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303703 return QDF_STATUS_E_FAULT;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003704
Jeff Johnsond377dce2017-10-04 10:32:42 -07003705 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003706
Jeff Johnson002cb972017-01-23 14:59:07 -08003707 request = hdd_request_alloc(&params);
3708 if (!request) {
3709 hdd_err("Request allocation failure");
3710 return QDF_STATUS_E_FAULT;
3711 }
3712 cookie = hdd_request_cookie(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003713
Jeff Johnsonce2ee982017-09-03 09:27:35 -07003714 hstatus = sme_get_snr(hdd_ctx->hHal, hdd_get_snr_cb,
Jeff Johnsond377dce2017-10-04 10:32:42 -07003715 sta_ctx->conn_info.staId[0],
3716 sta_ctx->conn_info.bssId, cookie);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303717 if (QDF_STATUS_SUCCESS != hstatus) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003718 hdd_err("Unable to retrieve RSSI");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003719 /* we'll returned a cached value below */
3720 } else {
3721 /* request was sent -- wait for the response */
Jeff Johnson002cb972017-01-23 14:59:07 -08003722 ret = hdd_request_wait_for_response(request);
3723 if (ret) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003724 hdd_err("SME timed out while retrieving SNR");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003725 /* we'll now returned a cached value below */
Jeff Johnson002cb972017-01-23 14:59:07 -08003726 } else {
3727 /* update the adapter with the fresh results */
3728 priv = hdd_request_priv(request);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003729 adapter->snr = priv->snr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003730 }
3731 }
3732
Jeff Johnson002cb972017-01-23 14:59:07 -08003733 /*
3734 * either we never sent a request, we sent a request and
3735 * received a response or we sent a request and timed out.
3736 * regardless we are done with the request.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003737 */
Jeff Johnson002cb972017-01-23 14:59:07 -08003738 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003739
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003740 *snr = adapter->snr;
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05303741 EXIT();
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303742 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003743}
3744
Jeff Johnsone50427c2017-01-26 10:54:49 -08003745struct linkspeed_priv {
3746 tSirLinkSpeedInfo linkspeed_info;
3747};
3748
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003749static void
Jeff Johnsone50427c2017-01-26 10:54:49 -08003750hdd_get_link_speed_cb(tSirLinkSpeedInfo *linkspeed_info, void *context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003751{
Jeff Johnsone50427c2017-01-26 10:54:49 -08003752 struct hdd_request *request;
3753 struct linkspeed_priv *priv;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003754
Jeff Johnsone50427c2017-01-26 10:54:49 -08003755 if (!linkspeed_info) {
3756 hdd_err("NULL linkspeed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003757 return;
3758 }
3759
Jeff Johnsone50427c2017-01-26 10:54:49 -08003760 request = hdd_request_get(context);
3761 if (!request) {
3762 hdd_err("Obsolete request");
3763 return;
3764 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003765
Jeff Johnsone50427c2017-01-26 10:54:49 -08003766 priv = hdd_request_priv(request);
3767 priv->linkspeed_info = *linkspeed_info;
3768 hdd_request_complete(request);
3769 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003770}
3771
Jeff Johnson3d278b02017-08-29 14:17:47 -07003772int wlan_hdd_get_linkspeed_for_peermac(struct hdd_adapter *adapter,
Jeff Johnsone50427c2017-01-26 10:54:49 -08003773 struct qdf_mac_addr *mac_address,
3774 uint32_t *linkspeed)
3775{
3776 int ret;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05303777 QDF_STATUS status;
Jeff Johnsone50427c2017-01-26 10:54:49 -08003778 void *cookie;
3779 tSirLinkSpeedInfo *linkspeed_info;
3780 struct hdd_request *request;
3781 struct linkspeed_priv *priv;
3782 static const struct hdd_request_params params = {
3783 .priv_size = sizeof(*priv),
3784 .timeout_ms = WLAN_WAIT_TIME_STATS,
3785 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003786
Jeff Johnsone50427c2017-01-26 10:54:49 -08003787 if ((!adapter) || (!linkspeed)) {
3788 hdd_err("NULL argument");
3789 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003790 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003791
Jeff Johnsone50427c2017-01-26 10:54:49 -08003792 request = hdd_request_alloc(&params);
3793 if (!request) {
3794 hdd_err("Request allocation failure");
3795 ret = -ENOMEM;
3796 goto return_cached_value;
3797 }
3798
3799 cookie = hdd_request_cookie(request);
3800 priv = hdd_request_priv(request);
3801
3802 linkspeed_info = &priv->linkspeed_info;
3803 qdf_copy_macaddr(&linkspeed_info->peer_macaddr, mac_address);
3804 status = sme_get_link_speed(WLAN_HDD_GET_HAL_CTX(adapter),
3805 linkspeed_info,
3806 cookie, hdd_get_link_speed_cb);
3807 if (QDF_IS_STATUS_ERROR(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003808 hdd_err("Unable to retrieve statistics for link speed");
Jeff Johnsone50427c2017-01-26 10:54:49 -08003809 ret = qdf_status_to_os_return(status);
3810 goto cleanup;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003811 }
Jeff Johnsone50427c2017-01-26 10:54:49 -08003812 ret = hdd_request_wait_for_response(request);
3813 if (ret) {
3814 hdd_err("SME timed out while retrieving link speed");
3815 goto cleanup;
3816 }
3817 adapter->estimated_linkspeed = linkspeed_info->estLinkSpeed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003818
Jeff Johnsone50427c2017-01-26 10:54:49 -08003819cleanup:
3820 /*
3821 * either we never sent a request, we sent a request and
3822 * received a response or we sent a request and timed out.
3823 * regardless we are done with the request.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003824 */
Jeff Johnsone50427c2017-01-26 10:54:49 -08003825 hdd_request_put(request);
3826
3827return_cached_value:
3828 *linkspeed = adapter->estimated_linkspeed;
3829
3830 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003831}
3832
Jeff Johnson4e632672017-10-03 11:40:51 -07003833int wlan_hdd_get_link_speed(struct hdd_adapter *adapter, uint32_t *link_speed)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003834{
Jeff Johnson4e632672017-10-03 11:40:51 -07003835 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson40dae4e2017-08-29 14:00:25 -07003836 struct hdd_station_ctx *hdd_stactx =
Jeff Johnson4e632672017-10-03 11:40:51 -07003837 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003838 int ret;
3839
3840 ret = wlan_hdd_validate_context(hddctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05303841 if (ret)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003842 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003843
Nitesh Shah4e2d5eb2016-09-06 19:45:13 +05303844 /* Linkspeed is allowed only for P2P mode */
Jeff Johnson4e632672017-10-03 11:40:51 -07003845 if (adapter->device_mode != QDF_P2P_CLIENT_MODE) {
Nitesh Shah4e2d5eb2016-09-06 19:45:13 +05303846 hdd_err("Link Speed is not allowed in Device mode %s(%d)",
Jeff Johnson4e632672017-10-03 11:40:51 -07003847 hdd_device_mode_to_string(adapter->device_mode),
3848 adapter->device_mode);
Nitesh Shah4e2d5eb2016-09-06 19:45:13 +05303849 return -ENOTSUPP;
3850 }
3851
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003852 if (eConnectionState_Associated != hdd_stactx->conn_info.connState) {
3853 /* we are not connected so we don't have a classAstats */
3854 *link_speed = 0;
3855 } else {
Anurag Chouhan6d760662016-02-20 16:05:43 +05303856 struct qdf_mac_addr bssid;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003857
Anurag Chouhanc5548422016-02-24 18:33:27 +05303858 qdf_copy_macaddr(&bssid, &hdd_stactx->conn_info.bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003859
Jeff Johnson4e632672017-10-03 11:40:51 -07003860 ret = wlan_hdd_get_linkspeed_for_peermac(adapter, &bssid,
Jeff Johnsone50427c2017-01-26 10:54:49 -08003861 link_speed);
3862 if (ret) {
Jeff Johnson99bac312016-06-28 10:38:18 -07003863 hdd_err("Unable to retrieve SME linkspeed");
Jeff Johnsone50427c2017-01-26 10:54:49 -08003864 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003865 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003866 /* linkspeed in units of 500 kbps */
3867 *link_speed = (*link_speed) / 500;
3868 }
3869 return 0;
3870}
3871
Will Huang496b36c2017-07-11 16:38:50 +08003872struct peer_rssi_priv {
3873 struct sir_peer_sta_info peer_sta_info;
3874};
3875
3876/**
3877 * hdd_get_peer_rssi_cb() - get peer station's rssi callback
3878 * @sta_rssi: pointer of peer information
3879 * @context: get rssi callback context
3880 *
3881 * This function will fill rssi information to rssi priv
3882 * adapter
3883 *
3884 */
3885static void hdd_get_peer_rssi_cb(struct sir_peer_info_resp *sta_rssi,
3886 void *context)
3887{
3888 struct hdd_request *request;
3889 struct peer_rssi_priv *priv;
3890 struct sir_peer_info *rssi_info;
3891 uint8_t peer_num;
3892
3893 if ((!sta_rssi) || (!context)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07003894 hdd_err("Bad param, sta_rssi [%pK] context [%pK]",
Will Huang496b36c2017-07-11 16:38:50 +08003895 sta_rssi, context);
3896 return;
3897 }
3898
3899 request = hdd_request_get(context);
3900 if (!request) {
3901 hdd_err("Obsolete request");
3902 return;
3903 }
3904
3905 priv = hdd_request_priv(request);
3906
3907 peer_num = sta_rssi->count;
3908 rssi_info = sta_rssi->info;
3909
3910 hdd_debug("%d peers", peer_num);
3911
3912 if (peer_num > MAX_PEER_STA) {
3913 hdd_warn("Exceed max peer sta to handle one time %d", peer_num);
3914 peer_num = MAX_PEER_STA;
3915 }
3916
3917 qdf_mem_copy(priv->peer_sta_info.info, rssi_info,
3918 peer_num * sizeof(*rssi_info));
3919 priv->peer_sta_info.sta_num = peer_num;
3920
3921 hdd_request_complete(request);
3922 hdd_request_put(request);
3923}
3924
Jeff Johnson3d278b02017-08-29 14:17:47 -07003925int wlan_hdd_get_peer_rssi(struct hdd_adapter *adapter,
Will Huang496b36c2017-07-11 16:38:50 +08003926 struct qdf_mac_addr *macaddress,
3927 struct sir_peer_sta_info *peer_sta_info)
3928{
3929 QDF_STATUS status;
3930 void *cookie;
3931 int ret;
3932 struct sir_peer_info_req rssi_req;
3933 struct hdd_request *request;
3934 struct peer_rssi_priv *priv;
3935 static const struct hdd_request_params params = {
3936 .priv_size = sizeof(*priv),
3937 .timeout_ms = WLAN_WAIT_TIME_STATS,
3938 };
3939
3940 if (!adapter || !macaddress || !peer_sta_info) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07003941 hdd_err("adapter [%pK], macaddress [%pK], peer_sta_info[%pK]",
Will Huang496b36c2017-07-11 16:38:50 +08003942 adapter, macaddress, peer_sta_info);
3943 return -EFAULT;
3944 }
3945
3946 request = hdd_request_alloc(&params);
3947 if (!request) {
3948 hdd_err("Request allocation failure");
3949 return -ENOMEM;
3950 }
3951
3952 cookie = hdd_request_cookie(request);
3953 priv = hdd_request_priv(request);
3954
3955 qdf_mem_copy(&rssi_req.peer_macaddr, macaddress,
3956 QDF_MAC_ADDR_SIZE);
3957 rssi_req.sessionid = adapter->sessionId;
3958 status = sme_get_peer_info(WLAN_HDD_GET_HAL_CTX(adapter),
3959 rssi_req,
3960 cookie,
3961 hdd_get_peer_rssi_cb);
3962 if (status != QDF_STATUS_SUCCESS) {
3963 hdd_err("Unable to retrieve statistics for rssi");
3964 ret = -EFAULT;
3965 } else {
3966 ret = hdd_request_wait_for_response(request);
3967 if (ret) {
3968 hdd_err("SME timed out while retrieving rssi");
3969 ret = -EFAULT;
3970 } else {
3971 *peer_sta_info = priv->peer_sta_info;
3972 ret = 0;
3973 }
3974 }
3975
3976 hdd_request_put(request);
3977
3978 return ret;
3979}
3980
3981struct peer_info_priv {
3982 struct sir_peer_sta_ext_info peer_sta_ext_info;
3983};
3984
3985/**
3986 * wlan_hdd_get_peer_info_cb() - get peer info callback
3987 * @sta_info: pointer of peer information
3988 * @context: get peer info callback context
3989 *
3990 * This function will fill stats info to peer info priv
3991 *
3992 */
3993static void wlan_hdd_get_peer_info_cb(struct sir_peer_info_ext_resp *sta_info,
3994 void *context)
3995{
3996 struct hdd_request *request;
3997 struct peer_info_priv *priv;
3998 uint8_t sta_num;
3999
4000 if ((!sta_info) || (!context)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07004001 hdd_err("Bad param, sta_info [%pK] context [%pK]",
Will Huang496b36c2017-07-11 16:38:50 +08004002 sta_info, context);
4003 return;
4004 }
4005
4006 if (!sta_info->count) {
4007 hdd_err("Fail to get remote peer info");
4008 return;
4009 }
4010
4011 if (sta_info->count > MAX_PEER_STA) {
4012 hdd_warn("Exceed max peer number %d", sta_info->count);
4013 sta_num = MAX_PEER_STA;
4014 } else {
4015 sta_num = sta_info->count;
4016 }
4017
4018 request = hdd_request_get(context);
4019 if (!request) {
4020 hdd_err("Obsolete request");
4021 return;
4022 }
4023
4024 priv = hdd_request_priv(request);
4025
4026 priv->peer_sta_ext_info.sta_num = sta_num;
4027 qdf_mem_copy(&priv->peer_sta_ext_info.info,
4028 sta_info->info,
4029 sta_num * sizeof(sta_info->info[0]));
4030
4031 hdd_request_complete(request);
4032 hdd_request_put(request);
4033}
4034
Jeff Johnson3d278b02017-08-29 14:17:47 -07004035int wlan_hdd_get_peer_info(struct hdd_adapter *adapter,
Will Huang496b36c2017-07-11 16:38:50 +08004036 struct qdf_mac_addr macaddress,
4037 struct sir_peer_info_ext *peer_info_ext)
4038{
4039 QDF_STATUS status;
4040 void *cookie;
4041 int ret;
4042 struct sir_peer_info_ext_req peer_info_req;
4043 struct hdd_request *request;
4044 struct peer_info_priv *priv;
4045 static const struct hdd_request_params params = {
4046 .priv_size = sizeof(*priv),
4047 .timeout_ms = WLAN_WAIT_TIME_STATS,
4048 };
4049
4050 if (!adapter) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004051 hdd_err("adapter is NULL");
Will Huang496b36c2017-07-11 16:38:50 +08004052 return -EFAULT;
4053 }
4054
4055 request = hdd_request_alloc(&params);
4056 if (!request) {
4057 hdd_err("Request allocation failure");
4058 return -ENOMEM;
4059 }
4060
4061 cookie = hdd_request_cookie(request);
4062 priv = hdd_request_priv(request);
4063
4064 qdf_mem_copy(&peer_info_req.peer_macaddr, &macaddress,
4065 QDF_MAC_ADDR_SIZE);
4066 peer_info_req.sessionid = adapter->sessionId;
4067 peer_info_req.reset_after_request = 0;
4068 status = sme_get_peer_info_ext(WLAN_HDD_GET_HAL_CTX(adapter),
4069 &peer_info_req,
4070 cookie,
4071 wlan_hdd_get_peer_info_cb);
4072 if (status != QDF_STATUS_SUCCESS) {
4073 hdd_err("Unable to retrieve statistics for peer info");
4074 ret = -EFAULT;
4075 } else {
4076 ret = hdd_request_wait_for_response(request);
4077 if (ret) {
4078 hdd_err("SME timed out while retrieving peer info");
4079 ret = -EFAULT;
4080 } else {
4081 /* only support one peer by now */
4082 *peer_info_ext = priv->peer_sta_ext_info.info[0];
4083 ret = 0;
4084 }
4085 }
4086
4087 hdd_request_put(request);
4088
4089 return ret;
4090}
4091
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004092/**
4093 * hdd_statistics_cb() - "Get statistics" callback function
4094 * @pStats: statistics payload
4095 * @pContext: opaque context originally passed to SME. HDD always passes
4096 * a pointer to an adapter
4097 *
4098 * Return: None
4099 */
Jeff Johnsonaf2a0932016-10-05 14:52:57 -07004100static void hdd_statistics_cb(void *pStats, void *pContext)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004101{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004102 struct hdd_adapter *adapter = (struct hdd_adapter *) pContext;
Jeff Johnson07f94742017-08-14 15:55:40 -07004103 struct hdd_stats *pStatsCache = NULL;
Jeff Johnson2a722002017-09-30 20:02:35 -07004104 struct hdd_wext_state *pWextState;
Anurag Chouhance0dc992016-02-16 18:18:03 +05304105 QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004106
4107 tCsrSummaryStatsInfo *pSummaryStats = NULL;
4108 tCsrGlobalClassAStatsInfo *pClassAStats = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004109 tCsrGlobalClassDStatsInfo *pClassDStats = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004110
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004111 if (adapter != NULL)
4112 pStatsCache = &adapter->hdd_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004113
4114 pSummaryStats = (tCsrSummaryStatsInfo *) pStats;
4115 pClassAStats = (tCsrGlobalClassAStatsInfo *) (pSummaryStats + 1);
Jeff Johnsonf2dac4f2017-03-16 11:41:31 -07004116 pClassDStats = (tCsrGlobalClassDStatsInfo *) (pClassAStats + 1);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004117
4118 if (pStatsCache != NULL) {
4119 /* copy the stats into the cache we keep in the
4120 * adapter instance structure
4121 */
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304122 qdf_mem_copy(&pStatsCache->summary_stat, pSummaryStats,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004123 sizeof(pStatsCache->summary_stat));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304124 qdf_mem_copy(&pStatsCache->ClassA_stat, pClassAStats,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004125 sizeof(pStatsCache->ClassA_stat));
Anurag Chouhan600c3a02016-03-01 10:33:54 +05304126 qdf_mem_copy(&pStatsCache->ClassD_stat, pClassDStats,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004127 sizeof(pStatsCache->ClassD_stat));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004128 }
4129
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004130 if (adapter) {
4131 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Anurag Chouhanf04e84f2016-03-03 10:12:12 +05304132 qdf_status = qdf_event_set(&pWextState->hdd_qdf_event);
Anurag Chouhance0dc992016-02-16 18:18:03 +05304133 if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004134 hdd_err("qdf_event_set failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004135 return;
4136 }
4137 }
4138}
4139
4140/**
4141 * hdd_clear_roam_profile_ie() - Clear Roam Profile IEs
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004142 * @adapter: adapter who's IEs are to be cleared
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004143 *
4144 * Return: None
4145 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004146void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004147{
Jeff Johnson731bc322017-10-14 19:53:44 -07004148 struct hdd_station_ctx *sta_ctx;
Jeff Johnson2a722002017-09-30 20:02:35 -07004149 struct hdd_wext_state *pWextState =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004150 WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07004151
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07004152 ENTER();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004153
4154 /* clear WPA/RSN/WSC IE information in the profile */
4155 pWextState->roamProfile.nWPAReqIELength = 0;
4156 pWextState->roamProfile.pWPAReqIE = (uint8_t *) NULL;
4157 pWextState->roamProfile.nRSNReqIELength = 0;
4158 pWextState->roamProfile.pRSNReqIE = (uint8_t *) NULL;
4159
4160#ifdef FEATURE_WLAN_WAPI
4161 pWextState->roamProfile.nWAPIReqIELength = 0;
4162 pWextState->roamProfile.pWAPIReqIE = (uint8_t *) NULL;
4163#endif
4164
4165 pWextState->roamProfile.bWPSAssociation = false;
4166 pWextState->roamProfile.bOSENAssociation = false;
4167 pWextState->roamProfile.pAddIEScan = (uint8_t *) NULL;
4168 pWextState->roamProfile.nAddIEScanLength = 0;
4169 pWextState->roamProfile.pAddIEAssoc = (uint8_t *) NULL;
4170 pWextState->roamProfile.nAddIEAssocLength = 0;
4171
4172 pWextState->roamProfile.EncryptionType.numEntries = 1;
4173 pWextState->roamProfile.EncryptionType.encryptionType[0]
4174 = eCSR_ENCRYPT_TYPE_NONE;
4175
4176 pWextState->roamProfile.mcEncryptionType.numEntries = 1;
4177 pWextState->roamProfile.mcEncryptionType.encryptionType[0]
4178 = eCSR_ENCRYPT_TYPE_NONE;
4179
4180 pWextState->roamProfile.AuthType.numEntries = 1;
4181 pWextState->roamProfile.AuthType.authType[0] =
4182 eCSR_AUTH_TYPE_OPEN_SYSTEM;
4183
Abhishek Singh3c9910e2017-01-06 17:56:47 +05304184 qdf_mem_zero(pWextState->roamProfile.bssid_hint.bytes,
4185 QDF_MAC_ADDR_SIZE);
4186
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004187#ifdef WLAN_FEATURE_11W
4188 pWextState->roamProfile.MFPEnabled = false;
4189 pWextState->roamProfile.MFPRequired = 0;
4190 pWextState->roamProfile.MFPCapable = 0;
4191#endif
4192
4193 pWextState->authKeyMgmt = 0;
4194
Yingying Tang3cc6b792016-10-20 17:00:37 +08004195 qdf_mem_zero(pWextState->roamProfile.Keys.KeyLength, CSR_MAX_NUM_KEY);
4196
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004197#ifdef FEATURE_WLAN_WAPI
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004198 adapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_OPEN;
4199 adapter->wapi_info.nWapiMode = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004200#endif
4201
Jeff Johnson731bc322017-10-14 19:53:44 -07004202 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
4203 qdf_zero_macaddr(&sta_ctx->requested_bssid);
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07004204 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004205}
4206
4207/**
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304208 * hdd_get_ldpc() - Get adapter LDPC
4209 * @adapter: adapter being queried
4210 * @value: where to store the value
4211 *
4212 * Return: 0 on success, negative errno on failure
4213 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07004214int hdd_get_ldpc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304215{
4216 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
4217 int ret;
4218
4219 ENTER();
4220 ret = sme_get_ht_config(hal, adapter->sessionId,
4221 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING);
4222 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004223 hdd_err("Failed to get LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304224 } else {
4225 *value = ret;
4226 ret = 0;
4227 }
4228 return ret;
4229}
4230
4231/**
4232 * hdd_set_ldpc() - Set adapter LDPC
4233 * @adapter: adapter being modified
4234 * @value: new LDPC value
4235 *
4236 * Return: 0 on success, negative errno on failure
4237 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07004238int hdd_set_ldpc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304239{
4240 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
4241 int ret;
4242
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004243 hdd_debug("%d", value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304244 if (value) {
4245 /* make sure HT capabilities allow this */
4246 QDF_STATUS status;
4247 uint32_t cfg_value;
4248 union {
4249 uint16_t cfg_value16;
4250 tSirMacHTCapabilityInfo ht_cap_info;
4251 } u;
4252
4253 status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value);
4254 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004255 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304256 return -EIO;
4257 }
4258 u.cfg_value16 = cfg_value & 0xFFFF;
4259 if (!u.ht_cap_info.advCodingCap) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004260 hdd_err("LDCP not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304261 return -EINVAL;
4262 }
4263 }
4264
4265 ret = sme_update_ht_config(hal, adapter->sessionId,
4266 WNI_CFG_HT_CAP_INFO_ADVANCE_CODING,
4267 value);
4268 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004269 hdd_err("Failed to set LDPC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304270
4271 return ret;
4272}
4273
4274/**
4275 * hdd_get_tx_stbc() - Get adapter TX STBC
4276 * @adapter: adapter being queried
4277 * @value: where to store the value
4278 *
4279 * Return: 0 on success, negative errno on failure
4280 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07004281int hdd_get_tx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304282{
4283 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
4284 int ret;
4285
4286 ENTER();
4287 ret = sme_get_ht_config(hal, adapter->sessionId,
4288 WNI_CFG_HT_CAP_INFO_TX_STBC);
4289 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004290 hdd_err("Failed to get TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304291 } else {
4292 *value = ret;
4293 ret = 0;
4294 }
4295
4296 return ret;
4297}
4298
4299/**
4300 * hdd_set_tx_stbc() - Set adapter TX STBC
4301 * @adapter: adapter being modified
4302 * @value: new TX STBC value
4303 *
4304 * Return: 0 on success, negative errno on failure
4305 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07004306int hdd_set_tx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304307{
4308 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
4309 int ret;
4310
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004311 hdd_debug("%d", value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304312 if (value) {
4313 /* make sure HT capabilities allow this */
4314 QDF_STATUS status;
4315 uint32_t cfg_value;
4316 union {
4317 uint16_t cfg_value16;
4318 tSirMacHTCapabilityInfo ht_cap_info;
4319 } u;
4320
4321 status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value);
4322 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004323 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304324 return -EIO;
4325 }
4326 u.cfg_value16 = cfg_value & 0xFFFF;
4327 if (!u.ht_cap_info.txSTBC) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004328 hdd_err("TX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304329 return -EINVAL;
4330 }
4331 }
4332 ret = sme_update_ht_config(hal, adapter->sessionId,
4333 WNI_CFG_HT_CAP_INFO_TX_STBC,
4334 value);
4335 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004336 hdd_err("Failed to set TX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304337
4338 return ret;
4339}
4340
4341/**
4342 * hdd_get_rx_stbc() - Get adapter RX STBC
4343 * @adapter: adapter being queried
4344 * @value: where to store the value
4345 *
4346 * Return: 0 on success, negative errno on failure
4347 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07004348int hdd_get_rx_stbc(struct hdd_adapter *adapter, int *value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304349{
4350 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
4351 int ret;
4352
4353 ENTER();
4354 ret = sme_get_ht_config(hal, adapter->sessionId,
4355 WNI_CFG_HT_CAP_INFO_RX_STBC);
4356 if (ret < 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004357 hdd_err("Failed to get RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304358 } else {
4359 *value = ret;
4360 ret = 0;
4361 }
4362
4363 return ret;
4364}
4365
4366/**
4367 * hdd_set_rx_stbc() - Set adapter RX STBC
4368 * @adapter: adapter being modified
4369 * @value: new RX STBC value
4370 *
4371 * Return: 0 on success, negative errno on failure
4372 */
Jeff Johnson3d278b02017-08-29 14:17:47 -07004373int hdd_set_rx_stbc(struct hdd_adapter *adapter, int value)
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304374{
4375 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
4376 int ret;
4377
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004378 hdd_debug("%d", value);
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304379 if (value) {
4380 /* make sure HT capabilities allow this */
4381 QDF_STATUS status;
4382 uint32_t cfg_value;
4383 union {
4384 uint16_t cfg_value16;
4385 tSirMacHTCapabilityInfo ht_cap_info;
4386 } u;
4387
4388 status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value);
4389 if (QDF_STATUS_SUCCESS != status) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004390 hdd_err("Failed to get HT capability info");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304391 return -EIO;
4392 }
4393 u.cfg_value16 = cfg_value & 0xFFFF;
4394 if (!u.ht_cap_info.rxSTBC) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004395 hdd_warn("RX STBC not supported");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304396 return -EINVAL;
4397 }
4398 }
4399 ret = sme_update_ht_config(hal, adapter->sessionId,
4400 WNI_CFG_HT_CAP_INFO_RX_STBC,
4401 value);
4402 if (ret)
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004403 hdd_err("Failed to set RX STBC value");
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304404
4405 return ret;
4406}
4407
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08004408int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate)
4409{
4410 int set_value;
4411
4412 if (sme_is_feature_supported_by_fw(DOT11AX))
4413 set_value = WMI_ASSEMBLE_RATECODE_V1(rate, nss, preamble);
4414 else
4415 set_value = (preamble << 6) | (nss << 4) | rate;
4416
4417 return set_value;
4418}
4419
Jeff Johnson3d278b02017-08-29 14:17:47 -07004420int hdd_set_11ax_rate(struct hdd_adapter *adapter, int set_value,
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08004421 struct sap_Config *sap_config)
4422{
4423 uint8_t preamble = 0, nss = 0, rix = 0;
4424 int ret;
4425
4426 if (!sap_config) {
4427 if (!sme_is_feature_supported_by_fw(DOT11AX)) {
4428 hdd_err("Target does not support 11ax");
4429 return -EIO;
4430 }
4431 } else if (sap_config->SapHw_mode != eCSR_DOT11_MODE_11ax &&
4432 sap_config->SapHw_mode != eCSR_DOT11_MODE_11ax_ONLY) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07004433 hdd_err("Invalid hw mode, SAP hw_mode= 0x%x, ch = %d",
4434 sap_config->SapHw_mode, sap_config->channel);
4435 return -EIO;
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08004436 }
4437
4438 if (set_value != 0xff) {
4439 rix = RC_2_RATE_IDX_11AX(set_value);
4440 preamble = WMI_RATE_PREAMBLE_HE;
4441 nss = HT_RC_2_STREAMS_11AX(set_value);
4442
4443 set_value = hdd_assemble_rate_code(preamble, nss, rix);
4444 }
4445
4446 hdd_notice("SET_11AX_RATE val %d rix %d preamble %x nss %d",
4447 set_value, rix, preamble, nss);
4448
4449 ret = wma_cli_set_command(adapter->sessionId,
4450 WMI_VDEV_PARAM_FIXED_RATE,
4451 set_value, VDEV_CMD);
4452
4453 return ret;
4454}
4455
Manjeet Singhe80d6d82016-09-02 19:04:41 +05304456/**
Krishna Kumaar Natarajanf1581df2017-02-21 13:42:08 -08004457 * hdd_get_aid_rc() - Get AID and rate code passed from user
4458 * @aid: pointer to AID
4459 * @rc: pointer to rate code
4460 * @set_value: value passed from user
4461 *
4462 * If target is 11ax capable, set_value will have AID left shifted 16 bits
4463 * and 16 bits for rate code. If the target is not 11ax capable, rate code
4464 * will only be 8 bits.
4465 *
4466 * Return: None
4467 */
4468static void hdd_get_aid_rc(uint8_t *aid, uint16_t *rc, int set_value)
4469{
4470 uint8_t rc_bits;
4471
4472 if (sme_is_feature_supported_by_fw(DOT11AX))
4473 rc_bits = 16;
4474 else
4475 rc_bits = 8;
4476
4477 *aid = set_value >> rc_bits;
4478 *rc = set_value & ((1 << (rc_bits + 1)) - 1);
4479}
4480
Jeff Johnson3d278b02017-08-29 14:17:47 -07004481int hdd_set_peer_rate(struct hdd_adapter *adapter, int set_value)
Krishna Kumaar Natarajanf1581df2017-02-21 13:42:08 -08004482{
4483 uint8_t aid, *peer_mac;
4484 uint16_t rc;
4485 QDF_STATUS status;
4486
4487 if (adapter->device_mode != QDF_SAP_MODE) {
4488 hdd_err("Invalid devicde mode - %d", adapter->device_mode);
4489 return -EINVAL;
4490 }
4491
4492 hdd_get_aid_rc(&aid, &rc, set_value);
4493
4494 if ((adapter->aStaInfo[aid].isUsed) &&
4495 (OL_TXRX_PEER_STATE_CONN == adapter->aStaInfo[aid].tlSTAState)) {
4496 peer_mac =
4497 (uint8_t *)&(adapter->aStaInfo[aid].macAddrSTA.bytes[0]);
4498 hdd_info("Peer AID: %d MAC_ADDR: "MAC_ADDRESS_STR,
4499 aid, MAC_ADDR_ARRAY(peer_mac));
4500 } else {
4501 hdd_err("No matching peer found for AID: %d", aid);
4502 return -EINVAL;
4503 }
4504
4505 status = sme_set_peer_param(peer_mac, WMI_PEER_PARAM_FIXED_RATE,
4506 rc, adapter->sessionId);
4507 if (status != QDF_STATUS_SUCCESS) {
4508 hdd_err("Failed to set peer fixed rate - status: %d", status);
4509 return -EIO;
4510 }
4511
4512 return 0;
4513}
4514
4515/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004516 * __iw_set_commit() - SIOCSIWCOMMIT ioctl handler
4517 * @dev: device upon which the ioctl was received
4518 * @info: ioctl request information
4519 * @wrqu: ioctl request data
4520 * @extra: ioctl extra data
4521 *
4522 * Return: 0 on success, non-zero on error
4523 */
4524static int __iw_set_commit(struct net_device *dev, struct iw_request_info *info,
4525 union iwreq_data *wrqu, char *extra)
4526{
Jeff Johnson3d278b02017-08-29 14:17:47 -07004527 struct hdd_adapter *adapter;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07004528 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004529 int ret;
4530
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08004531 ENTER_DEV(dev);
4532
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004533 adapter = WLAN_HDD_GET_PRIV_PTR(dev);
4534 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4535 ret = wlan_hdd_validate_context(hdd_ctx);
4536 if (0 != ret)
4537 return ret;
4538
Jeff Johnson441e1f72017-02-07 08:50:49 -08004539 ret = hdd_check_standard_wext_control(hdd_ctx, info);
4540 if (0 != ret)
4541 return ret;
4542
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004543 /* Do nothing for now */
4544 return 0;
4545}
4546
4547/**
4548 * iw_set_commit() - SSR wrapper function for __iw_set_commit
4549 * @dev: pointer to net_device
4550 * @info: pointer to iw_request_info
4551 * @wrqu: pointer to iwreq_data
4552 * @extra: extra
4553 *
4554 * Return: 0 on success, error number otherwise
4555 */
Jeff Johnsonaf2a0932016-10-05 14:52:57 -07004556static int iw_set_commit(struct net_device *dev, struct iw_request_info *info,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004557 union iwreq_data *wrqu, char *extra)
4558{
4559 int ret;
4560
4561 cds_ssr_protect(__func__);
4562 ret = __iw_set_commit(dev, info, wrqu, extra);
4563 cds_ssr_unprotect(__func__);
4564
4565 return ret;
4566}
4567
4568/**
4569 * __iw_get_name() - SIOCGIWNAME ioctl handler
4570 * @dev: device upon which the ioctl was received
4571 * @info: ioctl request information
4572 * @wrqu: ioctl request data
4573 * @extra: ioctl extra data
4574 *
4575 * Return: 0 on success, non-zero on error
4576 */
4577static int __iw_get_name(struct net_device *dev,
4578 struct iw_request_info *info, char *wrqu, char *extra)
4579{
Jeff Johnson3d278b02017-08-29 14:17:47 -07004580 struct hdd_adapter *adapter;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07004581 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004582 int ret;
4583
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08004584 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004585
4586 adapter = WLAN_HDD_GET_PRIV_PTR(dev);
4587 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
4588 ret = wlan_hdd_validate_context(hdd_ctx);
4589 if (0 != ret)
4590 return ret;
4591
Jeff Johnson441e1f72017-02-07 08:50:49 -08004592 ret = hdd_check_standard_wext_control(hdd_ctx, info);
4593 if (0 != ret)
4594 return ret;
4595
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004596 strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ);
4597 EXIT();
4598 return 0;
4599}
4600
4601/**
4602 * __iw_get_name() - SSR wrapper for __iw_get_name
4603 * @dev: pointer to net_device
4604 * @info: pointer to iw_request_info
4605 * @wrqu: pointer to iwreq_data
4606 * @extra: extra
4607 *
4608 * Return: 0 on success, error number otherwise
4609 */
4610static int iw_get_name(struct net_device *dev,
4611 struct iw_request_info *info,
4612 char *wrqu, char *extra)
4613{
4614 int ret;
4615
4616 cds_ssr_protect(__func__);
4617 ret = __iw_get_name(dev, info, wrqu, extra);
4618 cds_ssr_unprotect(__func__);
4619
4620 return ret;
4621}
4622
4623/**
4624 * __iw_set_mode() - ioctl handler
4625 * @dev: device upon which the ioctl was received
4626 * @info: ioctl request information
4627 * @wrqu: ioctl request data
4628 * @extra: ioctl extra data
4629 *
4630 * Return: 0 on success, non-zero on error
4631 */
4632static int __iw_set_mode(struct net_device *dev,
4633 struct iw_request_info *info,
4634 union iwreq_data *wrqu, char *extra)
4635{
Jeff Johnson2a722002017-09-30 20:02:35 -07004636 struct hdd_wext_state *pWextState;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004637 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07004638 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004639 tCsrRoamProfile *pRoamProfile;
4640 eCsrRoamBssType LastBSSType;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004641 struct hdd_config *pConfig;
4642 struct wireless_dev *wdev;
4643 int ret;
4644
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08004645 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004646
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004647 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004648 ret = wlan_hdd_validate_context(hdd_ctx);
4649 if (0 != ret)
4650 return ret;
4651
Jeff Johnson441e1f72017-02-07 08:50:49 -08004652 ret = hdd_check_standard_wext_control(hdd_ctx, info);
4653 if (0 != ret)
4654 return ret;
4655
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004656 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004657 wdev = dev->ieee80211_ptr;
4658 pRoamProfile = &pWextState->roamProfile;
4659 LastBSSType = pRoamProfile->BSSType;
4660
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004661 hdd_debug("Old Bss type = %d", LastBSSType);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004662
4663 switch (wrqu->mode) {
4664 case IW_MODE_ADHOC:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004665 hdd_debug("Setting AP Mode as IW_MODE_ADHOC");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004666 pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS;
4667 /* Set the phymode correctly for IBSS. */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004668 pConfig = (WLAN_HDD_GET_CTX(adapter))->config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004669 pWextState->roamProfile.phyMode =
4670 hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004671 adapter->device_mode = QDF_IBSS_MODE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004672 wdev->iftype = NL80211_IFTYPE_ADHOC;
4673 break;
4674 case IW_MODE_INFRA:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004675 hdd_debug("Setting AP Mode as IW_MODE_INFRA");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004676 pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
4677 wdev->iftype = NL80211_IFTYPE_STATION;
4678 break;
4679 case IW_MODE_AUTO:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004680 hdd_debug("Setting AP Mode as IW_MODE_AUTO");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004681 pRoamProfile->BSSType = eCSR_BSS_TYPE_ANY;
4682 break;
4683 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07004684 hdd_err("Unknown AP Mode value %d", wrqu->mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004685 return -EOPNOTSUPP;
4686 }
4687
4688 if (LastBSSType != pRoamProfile->BSSType) {
4689 /* the BSS mode changed. We need to issue disconnect
4690 * if connected or in IBSS disconnect state
4691 */
Jeff Johnson9eeed0a2016-10-03 15:04:57 -07004692 if (hdd_conn_is_connected
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004693 (WLAN_HDD_GET_STATION_CTX_PTR(adapter))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004694 || (eCSR_BSS_TYPE_START_IBSS == LastBSSType)) {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304695 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004696 /* need to issue a disconnect to CSR. */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004697 INIT_COMPLETION(adapter->disconnect_comp_var);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304698 qdf_status =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004699 sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(adapter),
4700 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004701 eCSR_DISCONNECT_REASON_IBSS_LEAVE);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304702 if (QDF_STATUS_SUCCESS == qdf_status) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004703 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004704
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004705 rc = wait_for_completion_timeout(&adapter->
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004706 disconnect_comp_var,
4707 msecs_to_jiffies
4708 (WLAN_WAIT_TIME_DISCONNECT));
4709 if (!rc)
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004710 hdd_err("disconnect_comp_var failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004711 }
4712 }
4713 }
4714
4715 EXIT();
4716 return 0;
4717}
4718
4719/**
4720 * iw_set_mode() - SSR wrapper for __iw_set_mode()
4721 * @dev: pointer to net_device
4722 * @info: pointer to iw_request_info
4723 * @wrqu: pointer to iwreq_data
4724 * @extra: pointer to extra ioctl payload
4725 *
4726 * Return: 0 on success, error number otherwise
4727 */
4728static int iw_set_mode(struct net_device *dev, struct iw_request_info *info,
4729 union iwreq_data *wrqu, char *extra)
4730{
4731 int ret;
4732
4733 cds_ssr_protect(__func__);
4734 ret = __iw_set_mode(dev, info, wrqu, extra);
4735 cds_ssr_unprotect(__func__);
4736
4737 return ret;
4738}
4739
4740/**
4741 * __iw_get_mode() - SIOCGIWMODE ioctl handler
4742 * @dev: device upon which the ioctl was received
4743 * @info: ioctl request information
4744 * @wrqu: ioctl request data
4745 * @extra: ioctl extra data
4746 *
4747 * Return: 0 on success, non-zero on error
4748 */
4749static int
4750__iw_get_mode(struct net_device *dev, struct iw_request_info *info,
4751 union iwreq_data *wrqu, char *extra)
4752{
Jeff Johnson2a722002017-09-30 20:02:35 -07004753 struct hdd_wext_state *pWextState;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004754 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07004755 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004756 int ret;
4757
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08004758 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004759
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004760 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004761 ret = wlan_hdd_validate_context(hdd_ctx);
4762 if (0 != ret)
4763 return ret;
4764
Jeff Johnson441e1f72017-02-07 08:50:49 -08004765 ret = hdd_check_standard_wext_control(hdd_ctx, info);
4766 if (0 != ret)
4767 return ret;
4768
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004769 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004770
4771 switch (pWextState->roamProfile.BSSType) {
4772 case eCSR_BSS_TYPE_INFRASTRUCTURE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004773 hdd_debug("returns IW_MODE_INFRA");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004774 wrqu->mode = IW_MODE_INFRA;
4775 break;
4776 case eCSR_BSS_TYPE_IBSS:
4777 case eCSR_BSS_TYPE_START_IBSS:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004778 hdd_debug("returns IW_MODE_ADHOC");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004779 wrqu->mode = IW_MODE_ADHOC;
4780 break;
4781 case eCSR_BSS_TYPE_ANY:
4782 default:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004783 hdd_debug("returns IW_MODE_AUTO");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004784 wrqu->mode = IW_MODE_AUTO;
4785 break;
4786 }
4787
4788 EXIT();
4789 return 0;
4790}
4791
4792/**
4793 * iw_get_mode() - SSR wrapper for __iw_get_mode()
4794 * @dev: pointer to net_device
4795 * @info: pointer to iw_request_info
4796 * @wrqu: pointer to iwreq_data
4797 * @extra: pointer to extra ioctl payload
4798 *
4799 * Return: 0 on success, error number otherwise
4800 */
4801static int iw_get_mode(struct net_device *dev, struct iw_request_info *info,
4802 union iwreq_data *wrqu, char *extra)
4803{
4804 int ret;
4805
4806 cds_ssr_protect(__func__);
4807 ret = __iw_get_mode(dev, info, wrqu, extra);
4808 cds_ssr_unprotect(__func__);
4809
4810 return ret;
4811}
4812
4813/**
4814 * __iw_set_freq() - SIOCSIWFREQ ioctl handler
4815 * @dev: device upon which the ioctl was received
4816 * @info: ioctl request information
4817 * @wrqu: ioctl request data
4818 * @extra: ioctl extra data
4819 *
4820 * Return: 0 on success, non-zero on error
4821 */
4822static int __iw_set_freq(struct net_device *dev, struct iw_request_info *info,
4823 union iwreq_data *wrqu, char *extra)
4824{
4825 uint32_t numChans = 0;
4826 uint8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN];
4827 uint32_t indx = 0;
4828 int ret;
Jeff Johnson2a722002017-09-30 20:02:35 -07004829 struct hdd_wext_state *pWextState;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004830 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07004831 struct hdd_context *hdd_ctx;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004832 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Jeff Johnsond377dce2017-10-04 10:32:42 -07004833 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004834 tCsrRoamProfile *pRoamProfile;
4835
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08004836 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004837
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004838 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004839 ret = wlan_hdd_validate_context(hdd_ctx);
4840 if (0 != ret)
4841 return ret;
4842
Jeff Johnson441e1f72017-02-07 08:50:49 -08004843 ret = hdd_check_standard_wext_control(hdd_ctx, info);
4844 if (0 != ret)
4845 return ret;
4846
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004847 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004848
4849 pRoamProfile = &pWextState->roamProfile;
4850
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004851 /* Link is up then return cant set channel */
Jeff Johnsond377dce2017-10-04 10:32:42 -07004852 if (eConnectionState_IbssConnected == sta_ctx->conn_info.connState ||
4853 eConnectionState_Associated == sta_ctx->conn_info.connState) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004854 hdd_debug("IBSS Associated");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004855 return -EOPNOTSUPP;
4856 }
4857
4858 /* Settings by Frequency as input */
4859 if ((wrqu->freq.e == 1) && (wrqu->freq.m >= (uint32_t) 2.412e8) &&
4860 (wrqu->freq.m <= (uint32_t) 5.825e8)) {
4861 uint32_t freq = wrqu->freq.m / 100000;
4862
4863 while ((indx < FREQ_CHAN_MAP_TABLE_SIZE)
4864 && (freq != freq_chan_map[indx].freq))
4865 indx++;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004866 if (indx >= FREQ_CHAN_MAP_TABLE_SIZE)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004867 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004868
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004869 wrqu->freq.e = 0;
4870 wrqu->freq.m = freq_chan_map[indx].chan;
4871
4872 }
4873
4874 if (wrqu->freq.e == 0) {
4875 if ((wrqu->freq.m < WNI_CFG_CURRENT_CHANNEL_STAMIN) ||
4876 (wrqu->freq.m > WNI_CFG_CURRENT_CHANNEL_STAMAX)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004877 hdd_debug("Channel %d is not in range[%d to %d]",
Jeff Johnson99bac312016-06-28 10:38:18 -07004878 wrqu->freq.m,
4879 WNI_CFG_CURRENT_CHANNEL_STAMIN,
4880 WNI_CFG_CURRENT_CHANNEL_STAMAX);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004881 return -EINVAL;
4882 }
4883
4884 numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN;
4885
4886 if (sme_cfg_get_str(hHal, WNI_CFG_VALID_CHANNEL_LIST,
4887 validChan, &numChans) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05304888 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004889 hdd_err("WNI_CFG_VALID_CHANNEL_LIST failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004890 return -EIO;
4891 }
4892
4893 for (indx = 0; indx < numChans; indx++) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004894 if (wrqu->freq.m == validChan[indx])
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004895 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004896 }
4897 } else {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004898 return -EINVAL;
4899 }
4900
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004901 if (indx >= numChans)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004902 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004903
4904 /* Set the Operational Channel */
4905 numChans = pRoamProfile->ChannelInfo.numOfChannels = 1;
Jeff Johnsond377dce2017-10-04 10:32:42 -07004906 sta_ctx->conn_info.operationChannel = wrqu->freq.m;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004907 pRoamProfile->ChannelInfo.ChannelList =
Jeff Johnsond377dce2017-10-04 10:32:42 -07004908 &sta_ctx->conn_info.operationChannel;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004909
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08004910 hdd_debug("pRoamProfile->operationChannel = %d", wrqu->freq.m);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004911
4912 EXIT();
4913
4914 return ret;
4915}
4916
4917/**
4918 * iw_set_freq() - SSR wrapper for __iw_set_freq()
4919 * @dev: pointer to net_device
4920 * @info: pointer to iw_request_info
4921 * @wrqu: pointer to iwreq_data
4922 * @extra: pointer to extra ioctl payload
4923 *
4924 * Return: 0 on success, error number otherwise
4925 */
4926static int iw_set_freq(struct net_device *dev, struct iw_request_info *info,
4927 union iwreq_data *wrqu, char *extra)
4928{
4929 int ret;
4930
4931 cds_ssr_protect(__func__);
4932 ret = __iw_set_freq(dev, info, wrqu, extra);
4933 cds_ssr_unprotect(__func__);
4934
4935 return ret;
4936}
4937
4938/**
4939 * __iw_get_freq() - SIOCGIWFREQ ioctl handler
4940 * @dev: device upon which the ioctl was received
4941 * @info: ioctl request information
4942 * @wrqu: ioctl request data
4943 * @extra: ioctl extra data
4944 *
4945 * Return: 0 on success, non-zero on error
4946 */
4947static int __iw_get_freq(struct net_device *dev, struct iw_request_info *info,
4948 struct iw_freq *fwrq, char *extra)
4949{
4950 uint32_t status = false, channel = 0, freq = 0;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004951 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004952 tHalHandle hHal;
Jeff Johnson2a722002017-09-30 20:02:35 -07004953 struct hdd_wext_state *pWextState;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004954 tCsrRoamProfile *pRoamProfile;
Jeff Johnsond377dce2017-10-04 10:32:42 -07004955 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07004956 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004957 int ret;
4958
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08004959 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004960
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004961 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004962 ret = wlan_hdd_validate_context(hdd_ctx);
4963 if (0 != ret)
4964 return ret;
4965
Jeff Johnson441e1f72017-02-07 08:50:49 -08004966 ret = hdd_check_standard_wext_control(hdd_ctx, info);
4967 if (0 != ret)
4968 return ret;
4969
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004970 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
4971 hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004972
4973 pRoamProfile = &pWextState->roamProfile;
4974
Jeff Johnsond377dce2017-10-04 10:32:42 -07004975 if (sta_ctx->conn_info.connState == eConnectionState_Associated) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07004976 if (sme_get_operation_channel(hHal, &channel,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004977 adapter->sessionId) != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07004978 hdd_err("failed to get operating channel %u",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07004979 adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004980 return -EIO;
Jeff Johnson68755312017-02-10 11:46:55 -08004981 }
Jeff Johnson68755312017-02-10 11:46:55 -08004982 status = hdd_wlan_get_freq(channel, &freq);
4983 if (true == status) {
4984 /* Set Exponent parameter as 6 (MHZ)
4985 * in struct iw_freq iwlist & iwconfig
4986 * command shows frequency into proper
4987 * format (2.412 GHz instead of 246.2
4988 * MHz)
4989 */
4990 fwrq->m = freq;
4991 fwrq->e = MHZ;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004992 }
4993 } else {
4994 /* Set Exponent parameter as 6 (MHZ) in struct iw_freq
4995 * iwlist & iwconfig command shows frequency into proper
4996 * format (2.412 GHz instead of 246.2 MHz)
4997 */
4998 fwrq->m = 0;
4999 fwrq->e = MHZ;
5000 }
5001 return 0;
5002}
5003
5004/**
5005 * iw_get_freq() - SSR wrapper for __iw_get_freq()
5006 * @dev: pointer to net_device
5007 * @info: pointer to iw_request_info
5008 * @fwrq: pointer to frequency data
5009 * @extra: pointer to extra ioctl payload
5010 *
5011 * Return: 0 on success, error number otherwise
5012 */
5013static int iw_get_freq(struct net_device *dev, struct iw_request_info *info,
5014 struct iw_freq *fwrq, char *extra)
5015{
5016 int ret;
5017
5018 cds_ssr_protect(__func__);
5019 ret = __iw_get_freq(dev, info, fwrq, extra);
5020 cds_ssr_unprotect(__func__);
5021
5022 return ret;
5023}
5024
5025/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005026 * __iw_get_range() - SIOCGIWRANGE ioctl handler
5027 * @dev: device upon which the ioctl was received
5028 * @info: ioctl request information
5029 * @wrqu: ioctl request data
5030 * @extra: ioctl extra data
5031 *
5032 * Return: 0 on success, non-zero on error
5033 */
5034static int __iw_get_range(struct net_device *dev, struct iw_request_info *info,
5035 union iwreq_data *wrqu, char *extra)
5036{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005037 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
5038 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005039 struct iw_range *range = (struct iw_range *)extra;
5040
5041 uint8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN];
5042
5043 uint32_t num_channels = sizeof(channels);
5044 uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN];
5045 uint32_t a_len;
5046 uint32_t b_len;
5047 uint32_t active_phy_mode = 0;
5048 uint8_t index = 0, i;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005049 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005050 int ret;
5051
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005052 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005053
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005054 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005055 ret = wlan_hdd_validate_context(hdd_ctx);
5056 if (0 != ret)
5057 return ret;
5058
Jeff Johnson441e1f72017-02-07 08:50:49 -08005059 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5060 if (0 != ret)
5061 return ret;
5062
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005063 wrqu->data.length = sizeof(struct iw_range);
5064 memset(range, 0, sizeof(struct iw_range));
5065
5066
5067 /*Get the phy mode */
5068 if (sme_cfg_get_int(hHal,
5069 WNI_CFG_DOT11_MODE,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305070 &active_phy_mode) == QDF_STATUS_SUCCESS) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005071 hdd_debug("active_phy_mode = %d", active_phy_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005072
5073 if (active_phy_mode == WNI_CFG_DOT11_MODE_11A
5074 || active_phy_mode == WNI_CFG_DOT11_MODE_11G) {
5075 /*Get the supported rates for 11G band */
5076 a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
5077 if (sme_cfg_get_str(hHal,
5078 WNI_CFG_SUPPORTED_RATES_11A,
5079 supp_rates,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305080 &a_len) == QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005081 if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005082 a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005083
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005084 for (i = 0; i < a_len; i++) {
5085 range->bitrate[i] =
5086 ((supp_rates[i] & 0x7F) / 2) *
5087 1000000;
5088 }
5089 range->num_bitrates = a_len;
5090 } else {
5091 return -EIO;
5092 }
5093 } else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B) {
5094 /*Get the supported rates for 11B band */
5095 b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
5096 if (sme_cfg_get_str(hHal,
5097 WNI_CFG_SUPPORTED_RATES_11B,
5098 supp_rates,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305099 &b_len) == QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005100 if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005101 b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005102
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005103 for (i = 0; i < b_len; i++) {
5104 range->bitrate[i] =
5105 ((supp_rates[i] & 0x7F) / 2) *
5106 1000000;
5107 }
5108 range->num_bitrates = b_len;
5109 } else {
5110 return -EIO;
5111 }
5112 }
5113 }
5114
5115 range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX;
5116 range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN;
5117 range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX;
5118
5119 range->encoding_size[0] = 5;
5120 range->encoding_size[1] = 13;
5121 range->num_encoding_sizes = 2;
5122 range->max_encoding_tokens = MAX_WEP_KEYS;
5123
5124 /* we support through Wireless Extensions 22 */
5125 range->we_version_compiled = WIRELESS_EXT;
5126 range->we_version_source = 22;
5127
5128 /*Supported Channels and Frequencies */
5129 if (sme_cfg_get_str
5130 ((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305131 &num_channels) != QDF_STATUS_SUCCESS) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005132 hdd_err("Failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005133 return -EIO;
5134 }
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005135 if (num_channels > IW_MAX_FREQUENCIES)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005136 num_channels = IW_MAX_FREQUENCIES;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005137
5138 range->num_channels = num_channels;
5139 range->num_frequency = num_channels;
5140
5141 for (index = 0; index < num_channels; index++) {
5142 uint32_t frq_indx = 0;
5143
5144 range->freq[index].i = channels[index];
5145 while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE) {
5146 if (channels[index] == freq_chan_map[frq_indx].chan) {
5147 range->freq[index].m =
5148 freq_chan_map[frq_indx].freq * 100000;
5149 range->freq[index].e = 1;
5150 break;
5151 }
5152 frq_indx++;
5153 }
5154 }
5155
5156 /* Event capability (kernel + driver) */
5157 range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
5158 IW_EVENT_CAPA_MASK(SIOCGIWAP) |
5159 IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
5160 range->event_capa[1] = IW_EVENT_CAPA_K_1;
5161
5162 /*Encryption capability */
5163 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
5164 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
5165
5166 /* Txpower capability */
5167 range->txpower_capa = IW_TXPOW_MWATT;
5168
5169 /*Scanning capability */
5170#if WIRELESS_EXT >= 22
5171 range->scan_capa =
5172 IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL;
5173#endif
5174
5175 EXIT();
5176 return 0;
5177}
5178
5179/**
5180 * iw_get_range() - SSR wrapper for __iw_get_range()
5181 * @dev: pointer to net_device
5182 * @info: pointer to iw_request_info
5183 * @wrqu: pointer to iwreq_data
5184 * @extra: pointer to extra ioctl payload
5185 *
5186 * Return: 0 on success, error number otherwise
5187 */
5188static int iw_get_range(struct net_device *dev, struct iw_request_info *info,
5189 union iwreq_data *wrqu, char *extra)
5190{
5191 int ret;
5192
5193 cds_ssr_protect(__func__);
5194 ret = __iw_get_range(dev, info, wrqu, extra);
5195 cds_ssr_unprotect(__func__);
5196
5197 return ret;
5198}
5199
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005200struct class_a_stats {
5201 tCsrGlobalClassAStatsInfo class_a_stats;
5202};
5203
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005204/**
5205 * hdd_get_class_a_statistics_cb() - Get Class A stats callback function
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005206 * @stats: pointer to Class A stats
5207 * @context: user context originally registered with SME (always the
5208 * cookie from the request context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005209 *
5210 * Return: None
5211 */
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005212static void hdd_get_class_a_statistics_cb(void *stats, void *context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005213{
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005214 struct hdd_request *request;
5215 struct class_a_stats *priv;
5216 tCsrGlobalClassAStatsInfo *returned_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005217
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005218 ENTER();
5219 if ((NULL == stats) || (NULL == context)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07005220 hdd_err("Bad param, stats [%pK] context [%pK]",
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005221 stats, context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005222 return;
5223 }
5224
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005225 request = hdd_request_get(context);
5226 if (!request) {
5227 hdd_err("Obsolete request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005228 return;
5229 }
5230
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005231 returned_stats = stats;
5232 priv = hdd_request_priv(request);
5233 priv->class_a_stats = *returned_stats;
5234 hdd_request_complete(request);
5235 hdd_request_put(request);
5236 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005237}
5238
5239/**
5240 * wlan_hdd_get_class_astats() - Get Class A statistics
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005241 * @adapter: adapter for which statistics are desired
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005242 *
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305243 * Return: QDF_STATUS_SUCCESS if adapter's Class A statistics were updated
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005244 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005245QDF_STATUS wlan_hdd_get_class_astats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005246{
Jeff Johnsond377dce2017-10-04 10:32:42 -07005247 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305248 QDF_STATUS hstatus;
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005249 int ret;
5250 void *cookie;
5251 struct hdd_request *request;
5252 struct class_a_stats *priv;
5253 static const struct hdd_request_params params = {
5254 .priv_size = sizeof(*priv),
5255 .timeout_ms = WLAN_WAIT_TIME_STATS,
5256 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005257
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005258 if (NULL == adapter) {
5259 hdd_err("adapter is NULL");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305260 return QDF_STATUS_E_FAULT;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005261 }
Hanumanth Reddy Pothula2a8a7402017-07-03 14:06:11 +05305262 if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005263 hdd_debug("Recovery in Progress. State: 0x%x Ignore!!!",
Prashanth Bhatta9e143052015-12-04 11:56:47 -08005264 cds_get_driver_state());
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305265 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005266 }
5267
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005268 request = hdd_request_alloc(&params);
5269 if (!request) {
5270 hdd_err("Request allocation failure");
5271 return QDF_STATUS_E_NOMEM;
5272 }
5273 cookie = hdd_request_cookie(request);
5274
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005275 /* query only for Class A statistics (which include link speed) */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005276 hstatus = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005277 eCSR_HDD, SME_GLOBAL_CLASSA_STATS,
5278 hdd_get_class_a_statistics_cb,
Jeff Johnsond377dce2017-10-04 10:32:42 -07005279 sta_ctx->conn_info.staId[0],
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005280 cookie, adapter->sessionId);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305281 if (QDF_STATUS_SUCCESS != hstatus) {
Archana Ramachandran31b5b652016-09-21 15:37:58 -07005282 hdd_warn("Unable to retrieve Class A statistics");
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005283 goto return_cached_results;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005284 }
5285
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005286 /* request was sent -- wait for the response */
5287 ret = hdd_request_wait_for_response(request);
5288 if (ret) {
5289 hdd_warn("SME timed out while retrieving Class A statistics");
5290 goto return_cached_results;
5291 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005292
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005293 /* update the adapter with the fresh results */
5294 priv = hdd_request_priv(request);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005295 adapter->hdd_stats.ClassA_stat = priv->class_a_stats;
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005296
5297return_cached_results:
5298 /*
5299 * either we never sent a request, we sent a request and
5300 * received a response or we sent a request and timed out.
5301 * regardless we are done with the request.
5302 */
5303 hdd_request_put(request);
5304
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305305 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005306}
5307
Jeff Johnsondda167c2017-01-23 10:37:57 -08005308struct station_stats {
5309 tCsrSummaryStatsInfo summary_stats;
5310 tCsrGlobalClassAStatsInfo class_a_stats;
5311 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
5312};
5313
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005314/**
5315 * hdd_get_station_statistics_cb() - Get stats callback function
Jeff Johnsondda167c2017-01-23 10:37:57 -08005316 * @stats: pointer to combined station stats
5317 * @context: user context originally registered with SME (always the
5318 * cookie from the request context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005319 *
5320 * Return: None
5321 */
Jeff Johnsondda167c2017-01-23 10:37:57 -08005322static void hdd_get_station_statistics_cb(void *stats, void *context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005323{
Jeff Johnsondda167c2017-01-23 10:37:57 -08005324 struct hdd_request *request;
5325 struct station_stats *priv;
5326 tCsrSummaryStatsInfo *summary_stats;
5327 tCsrGlobalClassAStatsInfo *class_a_stats;
Himanshu Agarwal37e42412016-07-21 14:35:09 +05305328 struct csr_per_chain_rssi_stats_info *per_chain_rssi_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005329
Jeff Johnsondda167c2017-01-23 10:37:57 -08005330 if ((NULL == stats) || (NULL == context)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07005331 hdd_err("Bad param, pStats [%pK] pContext [%pK]",
Jeff Johnsondda167c2017-01-23 10:37:57 -08005332 stats, context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005333 return;
5334 }
5335
Jeff Johnsondda167c2017-01-23 10:37:57 -08005336 request = hdd_request_get(context);
5337 if (!request) {
5338 hdd_err("Obsolete request");
5339 return;
5340 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005341
Jeff Johnsondda167c2017-01-23 10:37:57 -08005342 summary_stats = (tCsrSummaryStatsInfo *) stats;
5343 class_a_stats = (tCsrGlobalClassAStatsInfo *) (summary_stats + 1);
Himanshu Agarwal37e42412016-07-21 14:35:09 +05305344 per_chain_rssi_stats = (struct csr_per_chain_rssi_stats_info *)
Jeff Johnsondda167c2017-01-23 10:37:57 -08005345 (class_a_stats + 1);
5346 priv = hdd_request_priv(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005347
5348 /* copy over the stats. do so as a struct copy */
Jeff Johnsondda167c2017-01-23 10:37:57 -08005349 priv->summary_stats = *summary_stats;
5350 priv->class_a_stats = *class_a_stats;
5351 priv->per_chain_rssi_stats = *per_chain_rssi_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005352
Jeff Johnsondda167c2017-01-23 10:37:57 -08005353 hdd_request_complete(request);
5354 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005355}
5356
5357/**
5358 * wlan_hdd_get_station_stats() - Get station statistics
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005359 * @adapter: adapter for which statistics are desired
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005360 *
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305361 * Return: QDF_STATUS_SUCCESS if adapter's statistics were updated
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005362 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005363QDF_STATUS wlan_hdd_get_station_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005364{
Jeff Johnsond377dce2017-10-04 10:32:42 -07005365 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Dustin Brown0f5260d2017-06-12 16:17:38 -07005366 QDF_STATUS status;
5367 int errno;
Jeff Johnsondda167c2017-01-23 10:37:57 -08005368 void *cookie;
5369 struct hdd_request *request;
5370 struct station_stats *priv;
5371 static const struct hdd_request_params params = {
5372 .priv_size = sizeof(*priv),
5373 .timeout_ms = WLAN_WAIT_TIME_STATS,
5374 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005375
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005376 if (NULL == adapter) {
5377 hdd_err("adapter is NULL");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305378 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005379 }
5380
Jeff Johnsondda167c2017-01-23 10:37:57 -08005381 request = hdd_request_alloc(&params);
5382 if (!request) {
5383 hdd_err("Request allocation failure");
5384 return QDF_STATUS_E_NOMEM;
5385 }
5386 cookie = hdd_request_cookie(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005387
5388 /* query only for Summary & Class A statistics */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005389 status = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter),
Dustin Brown0f5260d2017-06-12 16:17:38 -07005390 eCSR_HDD,
5391 SME_SUMMARY_STATS |
5392 SME_GLOBAL_CLASSA_STATS |
5393 SME_PER_CHAIN_RSSI_STATS,
5394 hdd_get_station_statistics_cb,
Jeff Johnsond377dce2017-10-04 10:32:42 -07005395 sta_ctx->conn_info.staId[0],
Dustin Brown0f5260d2017-06-12 16:17:38 -07005396 cookie,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005397 adapter->sessionId);
Dustin Brown0f5260d2017-06-12 16:17:38 -07005398 if (QDF_IS_STATUS_ERROR(status)) {
5399 hdd_err("Failed to retrieve statistics, status %d", status);
5400 goto put_request;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005401 }
5402
Dustin Brown0f5260d2017-06-12 16:17:38 -07005403 /* request was sent -- wait for the response */
5404 errno = hdd_request_wait_for_response(request);
5405 if (errno) {
5406 hdd_err("Failed to wait for statistics, errno %d", errno);
5407 goto put_request;
5408 }
5409
5410 /* update the adapter with the fresh results */
5411 priv = hdd_request_priv(request);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005412 adapter->hdd_stats.summary_stat = priv->summary_stats;
5413 adapter->hdd_stats.ClassA_stat = priv->class_a_stats;
5414 adapter->hdd_stats.per_chain_rssi_stats = priv->per_chain_rssi_stats;
Dustin Brown0f5260d2017-06-12 16:17:38 -07005415
5416put_request:
Jeff Johnsondda167c2017-01-23 10:37:57 -08005417 /*
5418 * either we never sent a request, we sent a request and
5419 * received a response or we sent a request and timed out.
5420 * regardless we are done with the request.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005421 */
Jeff Johnsondda167c2017-01-23 10:37:57 -08005422 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005423
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005424 /* either callback updated adapter stats or it has cached data */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305425 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005426}
5427
5428/**
5429 * iw_get_linkspeed() - Get current link speed ioctl
5430 * @dev: device upon which the ioctl was received
5431 * @info: ioctl request information
5432 * @wrqu: ioctl request data
5433 * @extra: extra ioctl buffer
5434 *
5435 * Return: 0 on success, non-zero on error
5436 */
5437static int __iw_get_linkspeed(struct net_device *dev,
5438 struct iw_request_info *info,
5439 union iwreq_data *wrqu, char *extra)
5440{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005441 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005442 char *pLinkSpeed = (char *)extra;
5443 int len = sizeof(uint32_t) + 1;
5444 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005445 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08005446 int ret;
5447 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005448
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08005449 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305450
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005451 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08005452 ret = wlan_hdd_validate_context(hdd_ctx);
5453 if (0 != ret)
5454 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005455
Jeff Johnson441e1f72017-02-07 08:50:49 -08005456 ret = hdd_check_private_wext_control(hdd_ctx, info);
5457 if (0 != ret)
5458 return ret;
5459
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005460 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005461 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08005462 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005463
5464 wrqu->data.length = len;
5465 /* return the linkspeed as a string */
5466 rc = snprintf(pLinkSpeed, len, "%u", link_speed);
5467 if ((rc < 0) || (rc >= len)) {
5468 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07005469 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005470 return -EIO;
5471 }
5472
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05305473 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005474 /* a value is being successfully returned */
5475 return 0;
5476}
5477
5478static int iw_get_linkspeed(struct net_device *dev,
5479 struct iw_request_info *info,
5480 union iwreq_data *wrqu, char *extra)
5481{
5482 int ret;
5483
5484 cds_ssr_protect(__func__);
5485 ret = __iw_get_linkspeed(dev, info, wrqu, extra);
5486 cds_ssr_unprotect(__func__);
5487
5488 return ret;
5489}
5490
5491/**
5492 * wlan_hdd_change_country_code_callback() - Change country code callback
5493 * @context: opaque context originally passed to SME. All functions
5494 * which use this callback pass the adapter upon which the country
5495 * code change is active
5496 *
5497 * This function is registered as the callback function when
5498 * sme_change_country_code() is invoked. Callers of
5499 * sme_change_country_code() subsequently wait for the adapter's
5500 * @change_country_code completion variable, so all this function
5501 * needs to do is set that completion variable so that execution can
5502 * continue.
5503 *
5504 * Return: none
5505 */
5506void wlan_hdd_change_country_code_callback(void *context)
5507{
5508
Jeff Johnson3d278b02017-08-29 14:17:47 -07005509 struct hdd_adapter *adapter = context;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005510
5511 if (adapter && (WLAN_HDD_ADAPTER_MAGIC == adapter->magic))
5512 complete(&adapter->change_country_code);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005513}
5514
5515/**
5516 * __iw_set_nick() - SIOCSIWNICKN ioctl handler
5517 * @dev: device upon which the ioctl was received
5518 * @info: ioctl request information
5519 * @wrqu: ioctl request data
5520 * @extra: ioctl extra data
5521 *
5522 * Return: 0 on success, non-zero on error
5523 */
5524static int __iw_set_nick(struct net_device *dev,
5525 struct iw_request_info *info,
5526 union iwreq_data *wrqu, char *extra)
5527{
Jeff Johnson3d278b02017-08-29 14:17:47 -07005528 struct hdd_adapter *adapter;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005529 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005530 int ret;
5531
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005532 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005533
5534 adapter = WLAN_HDD_GET_PRIV_PTR(dev);
5535 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5536 ret = wlan_hdd_validate_context(hdd_ctx);
5537 if (0 != ret)
5538 return ret;
5539
Jeff Johnson441e1f72017-02-07 08:50:49 -08005540 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5541 if (0 != ret)
5542 return ret;
5543
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005544 return 0;
5545}
5546
5547/**
5548 * iw_set_nick() - SSR wrapper for __iw_set_nick
5549 * @dev: pointer to net_device
5550 * @info: pointer to iw_request_info
5551 * @wrqu: pointer to iwreq_data
5552 * @extra: extra
5553 *
5554 * Return: 0 on success, error number otherwise
5555 */
5556static int iw_set_nick(struct net_device *dev,
5557 struct iw_request_info *info,
5558 union iwreq_data *wrqu, char *extra)
5559{
5560 int ret;
5561
5562 cds_ssr_protect(__func__);
5563 ret = __iw_set_nick(dev, info, wrqu, extra);
5564 cds_ssr_unprotect(__func__);
5565
5566 return ret;
5567}
5568
5569/**
5570 * __iw_get_nick() - SIOCGIWNICKN ioctl handler
5571 * @dev: device upon which the ioctl was received
5572 * @info: ioctl request information
5573 * @wrqu: ioctl request data
5574 * @extra: ioctl extra data
5575 *
5576 * Return: 0 on success, non-zero on error
5577 */
5578static int __iw_get_nick(struct net_device *dev,
5579 struct iw_request_info *info,
5580 union iwreq_data *wrqu, char *extra)
5581{
Jeff Johnson3d278b02017-08-29 14:17:47 -07005582 struct hdd_adapter *adapter;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005583 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005584 int ret;
5585
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005586 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005587
5588 adapter = WLAN_HDD_GET_PRIV_PTR(dev);
5589 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5590 ret = wlan_hdd_validate_context(hdd_ctx);
5591 if (0 != ret)
5592 return ret;
5593
Jeff Johnson441e1f72017-02-07 08:50:49 -08005594 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5595 if (0 != ret)
5596 return ret;
5597
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005598 return 0;
5599}
5600
5601/**
5602 * iw_get_nick() - SSR wrapper for __iw_get_nick
5603 * @dev: pointer to net_device
5604 * @info: pointer to iw_request_info
5605 * @wrqu: pointer to iwreq_data
5606 * @extra: extra
5607 *
5608 * Return: 0 on success, error number otherwise
5609 */
5610static int iw_get_nick(struct net_device *dev,
5611 struct iw_request_info *info,
5612 union iwreq_data *wrqu, char *extra)
5613{
5614 int ret;
5615
5616 cds_ssr_protect(__func__);
5617 ret = __iw_get_nick(dev, info, wrqu, extra);
5618 cds_ssr_unprotect(__func__);
5619
5620 return ret;
5621}
5622
5623/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005624 * __iw_set_mlme() - SIOCSIWMLME ioctl handler
5625 * @dev: device upon which the ioctl was received
5626 * @info: ioctl request information
5627 * @wrqu: ioctl request data
5628 * @extra: ioctl extra data
5629 *
5630 * Return: 0 on success, non-zero on error
5631 */
5632static int __iw_set_mlme(struct net_device *dev,
5633 struct iw_request_info *info,
5634 union iwreq_data *wrqu, char *extra)
5635{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005636 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07005637 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005638 struct iw_mlme *mlme = (struct iw_mlme *)extra;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305639 QDF_STATUS status = QDF_STATUS_SUCCESS;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005640 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005641 int ret;
5642
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005643 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005644
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005645 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005646 ret = wlan_hdd_validate_context(hdd_ctx);
5647 if (0 != ret)
5648 return ret;
5649
Jeff Johnson441e1f72017-02-07 08:50:49 -08005650 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5651 if (0 != ret)
5652 return ret;
5653
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005654 /* reason_code is unused. By default it is set to
5655 * eCSR_DISCONNECT_REASON_UNSPECIFIED
5656 */
5657 switch (mlme->cmd) {
5658 case IW_MLME_DISASSOC:
5659 case IW_MLME_DEAUTH:
5660
Jeff Johnsond377dce2017-10-04 10:32:42 -07005661 if (sta_ctx->conn_info.connState ==
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005662 eConnectionState_Associated) {
5663 eCsrRoamDisconnectReason reason =
5664 eCSR_DISCONNECT_REASON_UNSPECIFIED;
5665
5666 if (mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE)
5667 reason = eCSR_DISCONNECT_REASON_MIC_ERROR;
5668
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005669 INIT_COMPLETION(adapter->disconnect_comp_var);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005670 status =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005671 sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(adapter),
5672 adapter->sessionId, reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005673
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305674 if (QDF_STATUS_SUCCESS == status) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005675 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005676
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005677 rc = wait_for_completion_timeout(&adapter->
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005678 disconnect_comp_var,
5679 msecs_to_jiffies
5680 (WLAN_WAIT_TIME_DISCONNECT));
5681 if (!rc)
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005682 hdd_err("disconnect_comp_var failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005683 } else
Jeff Johnson99bac312016-06-28 10:38:18 -07005684 hdd_err("%d Command Disassociate/Deauthenticate : csr_roam_disconnect failure returned %d",
5685 (int)mlme->cmd, (int)status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005686
5687 /* Resetting authKeyMgmt */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005688 (WLAN_HDD_GET_WEXT_STATE_PTR(adapter))->authKeyMgmt =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005689 0;
5690
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07005691 hdd_debug("Disabling queues");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005692 wlan_hdd_netif_queue_control(adapter,
Himanshu Agarwal865201d2017-04-12 15:45:31 +05305693 WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005694 WLAN_CONTROL_PATH);
5695
5696 } else {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005697 hdd_warn("%d Command Disassociate/Deauthenticate called but station is not in associated state",
Jeff Johnson99bac312016-06-28 10:38:18 -07005698 (int)mlme->cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005699 }
5700 break;
5701 default:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005702 hdd_err("Unexpected cmd: %d", (int)mlme->cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005703 return -EINVAL;
5704 } /* end of switch */
5705
5706 EXIT();
5707
5708 return status;
5709
5710}
5711
5712/**
5713 * iw_set_mlme() - SSR wrapper for __iw_set_mlme()
5714 * @dev: pointer to net_device
5715 * @info: pointer to iw_request_info
5716 * @wrqu: pointer to iwreq_data
5717 * @extra: pointer to extra ioctl payload
5718 *
5719 * Return: 0 on success, error number otherwise
5720 */
5721static int iw_set_mlme(struct net_device *dev, struct iw_request_info *info,
5722 union iwreq_data *wrqu, char *extra)
5723{
5724 int ret;
5725
5726 cds_ssr_protect(__func__);
5727 ret = __iw_set_mlme(dev, info, wrqu, extra);
5728 cds_ssr_unprotect(__func__);
5729
5730 return ret;
5731}
5732
5733/**
5734 * wlan_hdd_update_phymode() - handle change in PHY mode
5735 * @net: device upon which PHY mode change was received
5736 * @hal: umac handle for the driver
5737 * @new_phymode: new PHY mode for the device
5738 * @phddctx: pointer to the HDD context
5739 *
5740 * This function is called when the device is set to a new PHY mode.
5741 * It takes a holistic look at the desired PHY mode along with the
5742 * configured capabilities of the driver and the reported capabilities
5743 * of the hardware in order to correctly configure all PHY-related
5744 * parameters.
5745 *
5746 * Return: 0 on success, negative errno value on error
5747 */
5748int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal,
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005749 int new_phymode, struct hdd_context *phddctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005750{
5751#ifdef QCA_HT_2040_COEX
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005752 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305753 QDF_STATUS halStatus = QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005754#endif
5755 bool band_24 = false, band_5g = false;
5756 bool ch_bond24 = false, ch_bond5g = false;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305757 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005758 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005759 uint32_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005760 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07005761 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005762 eCsrBand curr_band = eCSR_BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305763 int retval = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005764
5765 old_phymode = sme_get_phy_mode(hal);
5766
5767 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
5768 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
5769 nChannelBondingMode24GHz))
5770 ch_bond24 = true;
5771
5772 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
5773 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
5774 nChannelBondingMode5GHz))
5775 ch_bond5g = true;
5776
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005777 if (phddctx->config->nBandCapability == eCSR_BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005778 band_24 = band_5g = true;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005779 else if (phddctx->config->nBandCapability == eCSR_BAND_24)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005780 band_24 = true;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005781 else if (phddctx->config->nBandCapability == eCSR_BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005782 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005783
5784 vhtchanwidth = phddctx->config->vhtChannelWidth;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005785 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 -08005786 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
5787
5788 switch (new_phymode) {
5789 case IEEE80211_MODE_AUTO:
5790 sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005791 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005792 phymode = eCSR_DOT11_MODE_AUTO;
5793 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
5794 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
5795 curr_band = eCSR_BAND_ALL;
5796 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
5797 } else {
5798 sme_set_phy_mode(hal, old_phymode);
5799 return -EIO;
5800 }
5801 break;
5802 case IEEE80211_MODE_11A:
5803 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005804 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005805 phymode = eCSR_DOT11_MODE_11a;
5806 hdd_dot11mode = eHDD_DOT11_MODE_11a;
5807 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
5808 curr_band = eCSR_BAND_5G;
5809 } else {
5810 sme_set_phy_mode(hal, old_phymode);
5811 return -EIO;
5812 }
5813 break;
5814 case IEEE80211_MODE_11B:
5815 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005816 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005817 phymode = eCSR_DOT11_MODE_11b;
5818 hdd_dot11mode = eHDD_DOT11_MODE_11b;
5819 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
5820 curr_band = eCSR_BAND_24;
5821 } else {
5822 sme_set_phy_mode(hal, old_phymode);
5823 return -EIO;
5824 }
5825 break;
5826 case IEEE80211_MODE_11G:
5827 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005828 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005829 phymode = eCSR_DOT11_MODE_11g;
5830 hdd_dot11mode = eHDD_DOT11_MODE_11g;
5831 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
5832 curr_band = eCSR_BAND_24;
5833 } else {
5834 sme_set_phy_mode(hal, old_phymode);
5835 return -EIO;
5836 }
5837 break;
5838 /* UMAC doesnt have option to set MODE_11NA/MODE_11NG as phymode
5839 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
5840 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
5841 */
5842 case IEEE80211_MODE_11NA_HT20:
5843 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005844 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005845 phymode = eCSR_DOT11_MODE_11n;
5846 hdd_dot11mode = eHDD_DOT11_MODE_11n;
5847 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
5848 curr_band = eCSR_BAND_5G;
5849 } else {
5850 sme_set_phy_mode(hal, old_phymode);
5851 return -EIO;
5852 }
5853 break;
5854 case IEEE80211_MODE_11NA_HT40:
5855 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005856 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005857 phymode = eCSR_DOT11_MODE_11n;
5858 hdd_dot11mode = eHDD_DOT11_MODE_11n;
5859 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
5860 curr_band = eCSR_BAND_5G;
5861 } else {
5862 sme_set_phy_mode(hal, old_phymode);
5863 return -EIO;
5864 }
5865 break;
5866 case IEEE80211_MODE_11NG_HT20:
5867 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005868 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005869 phymode = eCSR_DOT11_MODE_11n;
5870 hdd_dot11mode = eHDD_DOT11_MODE_11n;
5871 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
5872 curr_band = eCSR_BAND_24;
5873 } else {
5874 sme_set_phy_mode(hal, old_phymode);
5875 return -EIO;
5876 }
5877 break;
5878 case IEEE80211_MODE_11NG_HT40:
5879 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005880 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005881 phymode = eCSR_DOT11_MODE_11n;
5882 hdd_dot11mode = eHDD_DOT11_MODE_11n;
5883 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
5884 curr_band = eCSR_BAND_24;
5885 } else {
5886 sme_set_phy_mode(hal, old_phymode);
5887 return -EIO;
5888 }
5889 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005890 case IEEE80211_MODE_11AC_VHT20:
5891 case IEEE80211_MODE_11AC_VHT40:
5892 case IEEE80211_MODE_11AC_VHT80:
5893 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005894 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005895 phymode = eCSR_DOT11_MODE_11ac;
5896 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
5897 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
5898 curr_band = eCSR_BAND_5G;
5899 } else {
5900 sme_set_phy_mode(hal, old_phymode);
5901 return -EIO;
5902 }
5903 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005904 case IEEE80211_MODE_2G_AUTO:
5905 sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005906 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005907 phymode = eCSR_DOT11_MODE_AUTO;
5908 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
5909 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
5910 curr_band = eCSR_BAND_24;
5911 } else {
5912 sme_set_phy_mode(hal, old_phymode);
5913 return -EIO;
5914 }
5915 break;
5916 case IEEE80211_MODE_5G_AUTO:
5917 sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005918 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005919 phymode = eCSR_DOT11_MODE_AUTO;
5920 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
5921 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
5922 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
5923 curr_band = eCSR_BAND_5G;
5924 } else {
5925 sme_set_phy_mode(hal, old_phymode);
5926 return -EIO;
5927 }
5928 break;
5929 case IEEE80211_MODE_11AGN:
5930 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07005931 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005932 phymode = eCSR_DOT11_MODE_11n;
5933 hdd_dot11mode = eHDD_DOT11_MODE_11n;
5934 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
5935 curr_band = eCSR_BAND_ALL;
5936 } else {
5937 sme_set_phy_mode(hal, old_phymode);
5938 return -EIO;
5939 }
5940 break;
5941 default:
5942 return -EIO;
5943 }
5944
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005945 switch (new_phymode) {
5946 case IEEE80211_MODE_11AC_VHT20:
5947 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
5948 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
5949 break;
5950 case IEEE80211_MODE_11AC_VHT40:
5951 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
5952 break;
5953 case IEEE80211_MODE_11AC_VHT80:
5954 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
5955 break;
5956 default:
5957 vhtchanwidth = phddctx->config->vhtChannelWidth;
5958 break;
5959 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005960
5961 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305962 sme_config = qdf_mem_malloc(sizeof(*sme_config));
5963 if (!sme_config) {
5964 hdd_err("Failed to allocate memory for sme_config");
5965 return -ENOMEM;
5966 }
5967 qdf_mem_zero(sme_config, sizeof(*sme_config));
5968 sme_get_config_param(hal, sme_config);
5969 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005970#ifdef QCA_HT_2040_COEX
5971 if (phymode == eCSR_DOT11_MODE_11n &&
5972 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305973 sme_config->csrConfig.obssEnabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005974 halStatus = sme_set_ht2040_mode(hal,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005975 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005976 eHT_CHAN_HT20, false);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305977 if (halStatus == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005978 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305979 retval = -EIO;
5980 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005981 }
5982 } else if (phymode == eCSR_DOT11_MODE_11n &&
5983 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305984 sme_config->csrConfig.obssEnabled = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005985 halStatus = sme_set_ht2040_mode(hal,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005986 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005987 eHT_CHAN_HT20, true);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305988 if (halStatus == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005989 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305990 retval = -EIO;
5991 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005992 }
5993 }
5994#endif
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305995 sme_config->csrConfig.eBand = curr_band;
5996 sme_config->csrConfig.bandCapability = curr_band;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005997 if (curr_band == eCSR_BAND_24)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05305998 sme_config->csrConfig.Is11hSupportEnabled = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005999 else
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306000 sme_config->csrConfig.Is11hSupportEnabled =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006001 phddctx->config->Is11hSupportEnabled;
6002 if (curr_band == eCSR_BAND_24)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306003 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006004 else if (curr_band == eCSR_BAND_24)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306005 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006006 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306007 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
6008 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006009 }
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306010 sme_config->csrConfig.nVhtChannelWidth = vhtchanwidth;
6011 sme_update_config(hal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006012
6013 phddctx->config->dot11Mode = hdd_dot11mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006014 phddctx->config->nChannelBondingMode24GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306015 sme_config->csrConfig.channelBondingMode24GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006016 phddctx->config->nChannelBondingMode5GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306017 sme_config->csrConfig.channelBondingMode5GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006018 phddctx->config->vhtChannelWidth = vhtchanwidth;
Krunal Sonidf0f8742016-09-26 14:56:31 -07006019 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006020 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306021 retval = -EIO;
6022 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006023 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05306024
6025 if (band_5g) {
6026 struct ieee80211_supported_band *band;
6027
6028 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
6029 if (phddctx->config->nChannelBondingMode5GHz)
6030 band->ht_cap.cap |=
6031 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
6032 else
6033 band->ht_cap.cap &=
6034 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
6035 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006036
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006037 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006038 phymode, chwidth, curr_band, vhtchanwidth);
6039 }
6040
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306041free:
6042 if (sme_config)
6043 qdf_mem_free(sme_config);
6044 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006045}
6046
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006047struct temperature_priv {
6048 int temperature;
6049};
6050
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006051/**
6052 * hdd_get_temperature_cb() - "Get Temperature" callback function
6053 * @temperature: measured temperature
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006054 * @context: callback context
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006055 *
6056 * This function is passed to sme_get_temperature() as the callback
6057 * function to be invoked when the temperature measurement is
6058 * available.
6059 *
6060 * Return: None
6061 */
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006062static void hdd_get_temperature_cb(int temperature, void *context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006063{
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006064 struct hdd_request *request;
6065 struct temperature_priv *priv;
6066
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006067 ENTER();
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006068
6069 request = hdd_request_get(context);
6070 if (!request) {
6071 hdd_err("Obsolete request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006072 return;
6073 }
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006074
6075 priv = hdd_request_priv(request);
6076 priv->temperature = temperature;
6077 hdd_request_complete(request);
6078 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006079 EXIT();
6080}
6081
6082/**
6083 * wlan_hdd_get_temperature() - get current device temperature
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006084 * @adapter: device upon which the request was made
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006085 * @temperature: pointer to where the temperature is to be returned
6086 *
6087 * Return: 0 if a temperature value (either current or cached) was
6088 * returned, otherwise a negative errno is returned.
6089 *
6090 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006091int wlan_hdd_get_temperature(struct hdd_adapter *adapter, int *temperature)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006092{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306093 QDF_STATUS status;
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006094 int ret;
6095 void *cookie;
6096 struct hdd_request *request;
6097 struct temperature_priv *priv;
6098 static const struct hdd_request_params params = {
6099 .priv_size = sizeof(*priv),
6100 .timeout_ms = WLAN_WAIT_TIME_STATS,
6101 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006102
6103 ENTER();
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006104 if (NULL == adapter) {
6105 hdd_err("adapter is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006106 return -EPERM;
6107 }
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006108
6109 request = hdd_request_alloc(&params);
6110 if (!request) {
6111 hdd_err("Request allocation failure");
6112 return -ENOMEM;
6113 }
6114 cookie = hdd_request_cookie(request);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006115 status = sme_get_temperature(WLAN_HDD_GET_HAL_CTX(adapter),
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006116 cookie, hdd_get_temperature_cb);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306117 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006118 hdd_err("Unable to retrieve temperature");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006119 } else {
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006120 ret = hdd_request_wait_for_response(request);
6121 if (ret) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006122 hdd_err("SME timed out while retrieving temperature");
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006123 } else {
6124 /* update the adapter with the fresh results */
6125 priv = hdd_request_priv(request);
6126 if (priv->temperature)
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006127 adapter->temperature = priv->temperature;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006128 }
6129 }
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006130
6131 /*
6132 * either we never sent a request, we sent a request and
6133 * received a response or we sent a request and timed out.
6134 * regardless we are done with the request.
6135 */
6136 hdd_request_put(request);
6137
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006138 *temperature = adapter->temperature;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006139 EXIT();
6140 return 0;
6141}
6142
Jeff Johnson011c4502017-10-05 15:25:56 -07006143static int hdd_validate_pdev_reset(int value)
6144{
6145 if ((value < 1) || (value > 5)) {
6146 hdd_warn(" Invalid value %d: Use any one of the below values\n"
6147 " TX_FLUSH = 1\n"
6148 " WARM_RESET = 2\n"
6149 " COLD_RESET = 3\n"
6150 " WARM_RESET_RESTORE_CAL = 4\n"
6151 " COLD_RESET_RESTORE_CAL = 5", value);
6152
6153 return -EINVAL;
6154 }
6155
6156 return 0;
6157}
6158
6159static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
6160{
6161 int ret;
6162
6163 hdd_debug("%d", value);
6164
6165 ret = hdd_validate_pdev_reset(value);
6166 if (ret)
6167 return ret;
6168
6169 ret = wma_cli_set_command(adapter->sessionId,
6170 WMI_PDEV_PARAM_PDEV_RESET,
6171 value, PDEV_CMD);
6172
6173 return ret;
6174}
6175
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006176/**
6177 * iw_setint_getnone() - Generic "set integer" private ioctl handler
6178 * @dev: device upon which the ioctl was received
6179 * @info: ioctl request information
6180 * @wrqu: ioctl request data
6181 * @extra: ioctl extra data
6182 *
6183 * Return: 0 on success, non-zero on error
6184 */
6185static int __iw_setint_getnone(struct net_device *dev,
6186 struct iw_request_info *info,
6187 union iwreq_data *wrqu, char *extra)
6188{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006189 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
6190 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Jeff Johnsond377dce2017-10-04 10:32:42 -07006191 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006192 struct hdd_context *hdd_ctx;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306193 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006194 int *value = (int *)extra;
6195 int sub_cmd = value[0];
6196 int set_value = value[1];
6197 int ret;
6198 int enable_pbm, enable_mp;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306199 QDF_STATUS status;
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08006200 void *soc = NULL;
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08006201 struct cdp_pdev *pdev = NULL;
6202 struct cdp_vdev *vdev = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006203
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08006204 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306205
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006206 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006207 ret = wlan_hdd_validate_context(hdd_ctx);
6208 if (0 != ret)
6209 return ret;
6210
Jeff Johnson441e1f72017-02-07 08:50:49 -08006211 ret = hdd_check_private_wext_control(hdd_ctx, info);
6212 if (0 != ret)
6213 return ret;
6214
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306215 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6216 if (!sme_config) {
6217 hdd_err("failed to allocate memory for sme_config");
6218 return -ENOMEM;
6219 }
6220 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnson441e1f72017-02-07 08:50:49 -08006221
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006222 switch (sub_cmd) {
6223 case WE_SET_11D_STATE:
6224 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306225 if (((ENABLE_11D == set_value)
6226 || (DISABLE_11D == set_value)) && hHal) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006227
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306228 sme_get_config_param(hHal, sme_config);
6229 sme_config->csrConfig.Is11dSupportEnabled =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006230 (bool) set_value;
6231
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006232 hdd_debug("11D state=%d!!",
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306233 sme_config->csrConfig.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006234 Is11dSupportEnabled);
6235
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306236 sme_update_config(hHal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006237 } else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306238 ret = -EINVAL;
6239 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006240 }
6241 break;
6242 }
6243
6244 case WE_WOWL:
6245 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306246 if (!hHal)
6247 return -EINVAL;
6248
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006249 switch (set_value) {
6250 case 0x00:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006251 hdd_exit_wowl(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006252 break;
6253 case 0x01:
6254 case 0x02:
6255 case 0x03:
6256 enable_mp = (set_value & 0x01) ? 1 : 0;
6257 enable_pbm = (set_value & 0x02) ? 1 : 0;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006258 hdd_debug("magic packet ? = %s pattern byte matching ? = %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006259 (enable_mp ? "YES" : "NO"),
6260 (enable_pbm ? "YES" : "NO"));
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006261 hdd_enter_wowl(adapter, enable_mp, enable_pbm);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006262 break;
6263 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006264 hdd_err("Invalid arg %d in WE_WOWL IOCTL",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006265 set_value);
6266 ret = -EINVAL;
6267 break;
6268 }
6269
6270 break;
6271 }
6272 case WE_SET_POWER:
6273 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306274 if (!hHal)
6275 return -EINVAL;
6276
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006277 switch (set_value) {
6278 case 1:
6279 /* Enable PowerSave */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006280 sme_ps_enable_disable(hHal, adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006281 SME_PS_ENABLE);
6282 break;
6283 case 2:
6284 /* Disable PowerSave */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006285 sme_ps_enable_disable(hHal, adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006286 SME_PS_DISABLE);
6287 break;
6288 case 3: /* Enable UASPD */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006289 sme_ps_uapsd_enable(hHal, adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006290 break;
6291 case 4: /* Disable UASPD */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006292 sme_ps_uapsd_disable(hHal, adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006293 break;
6294 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07006295 hdd_err("Invalid arg %d in WE_SET_POWER IOCTL",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006296 set_value);
6297 ret = -EINVAL;
6298 break;
6299 }
6300 break;
6301 }
6302
6303 case WE_SET_MAX_ASSOC:
6304 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306305 if (!hHal)
6306 return -EINVAL;
6307
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006308 if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) ||
6309 (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) {
6310 ret = -EINVAL;
6311 } else if (sme_cfg_set_int(hHal, WNI_CFG_ASSOC_STA_LIMIT,
6312 set_value)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306313 != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006314 hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006315 ret = -EIO;
6316 }
6317 break;
6318 }
6319
6320 case WE_SET_SAP_AUTO_CHANNEL_SELECTION:
6321 if (set_value == 0 || set_value == 1)
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006322 (WLAN_HDD_GET_CTX(adapter))->config->force_sap_acs =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006323 set_value;
6324 else
6325 ret = -EINVAL;
6326 break;
6327
6328 case WE_SET_DATA_INACTIVITY_TO:
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306329 if (!hHal)
6330 return -EINVAL;
6331
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006332 if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) ||
6333 (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) ||
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006334 (sme_cfg_set_int((WLAN_HDD_GET_CTX(adapter))->hHal,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006335 WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306336 set_value) == QDF_STATUS_E_FAILURE)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006337 hdd_err("WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006338 ret = -EINVAL;
6339 }
6340 break;
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05306341 case WE_SET_WOW_DATA_INACTIVITY_TO:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306342 if (!hHal) {
6343 ret = -EINVAL;
6344 goto free;
6345 }
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05306346
6347 if ((set_value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) ||
6348 (set_value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX) ||
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006349 (sme_cfg_set_int((WLAN_HDD_GET_CTX(adapter))->hHal,
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05306350 WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT,
6351 set_value) == QDF_STATUS_E_FAILURE)) {
6352 hdd_err("WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT fail");
6353 ret = -EINVAL;
6354 }
6355 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006356 case WE_SET_MC_RATE:
6357 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306358 if (!hHal)
6359 return -EINVAL;
6360
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006361 ret = wlan_hdd_set_mc_rate(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006362 break;
6363 }
6364 case WE_SET_TX_POWER:
6365 {
Anurag Chouhan6d760662016-02-20 16:05:43 +05306366 struct qdf_mac_addr bssid;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006367
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306368 if (!hHal)
6369 return -EINVAL;
6370
Jeff Johnsond377dce2017-10-04 10:32:42 -07006371 qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006372 if (sme_set_tx_power
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006373 (hHal, adapter->sessionId, bssid,
6374 adapter->device_mode,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306375 set_value) != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006376 hdd_err("Setting tx power failed");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306377 ret = -EIO;
6378 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006379 }
6380 break;
6381 }
6382 case WE_SET_MAX_TX_POWER:
6383 {
Anurag Chouhan6d760662016-02-20 16:05:43 +05306384 struct qdf_mac_addr bssid;
6385 struct qdf_mac_addr selfMac;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006386
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306387 if (!hHal)
6388 return -EINVAL;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006389
6390 hdd_debug("Setting maximum tx power %d dBm",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006391 set_value);
Jeff Johnsond377dce2017-10-04 10:32:42 -07006392 qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId);
6393 qdf_copy_macaddr(&selfMac, &sta_ctx->conn_info.bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006394
6395 if (sme_set_max_tx_power(hHal, bssid, selfMac, set_value)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306396 != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006397 hdd_err("Setting maximum tx power failed");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306398 ret = -EIO;
6399 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006400 }
6401
6402 break;
6403 }
6404 case WE_SET_MAX_TX_POWER_2_4:
6405 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006406 hdd_debug("Setting maximum tx power %d dBm for 2.4 GHz band",
Jeff Johnson99bac312016-06-28 10:38:18 -07006407 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006408 if (sme_set_max_tx_power_per_band(eCSR_BAND_24, set_value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306409 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006410 hdd_err("Setting max tx power failed for 2.4 GHz band");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306411 ret = -EIO;
6412 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006413 }
6414
6415 break;
6416 }
6417 case WE_SET_MAX_TX_POWER_5_0:
6418 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006419 hdd_debug("Setting maximum tx power %d dBm for 5.0 GHz band",
Jeff Johnson99bac312016-06-28 10:38:18 -07006420 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006421 if (sme_set_max_tx_power_per_band(eCSR_BAND_5G, set_value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306422 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006423 hdd_err("Setting max tx power failed for 5.0 GHz band");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306424 ret = -EIO;
6425 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006426 }
6427
6428 break;
6429 }
6430 case WE_SET_HIGHER_DTIM_TRANSITION:
6431 {
6432 if (!((set_value == false) || (set_value == true))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006433 hdd_err("Dynamic DTIM Incorrect data:%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006434 set_value);
6435 ret = -EINVAL;
6436 } else {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006437 if (adapter->higherDtimTransition != set_value) {
6438 adapter->higherDtimTransition =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006439 set_value;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006440 hdd_debug("higherDtimTransition set to :%d",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006441 adapter->higherDtimTransition);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006442 }
6443 }
6444
6445 break;
6446 }
6447
6448 case WE_SET_TM_LEVEL:
6449 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306450 if (!hHal)
6451 return -EINVAL;
6452
6453 hdd_notice("Set Thermal Mitigation Level %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006454 (void)sme_set_thermal_level(hHal, set_value);
6455 break;
6456 }
6457
6458 case WE_SET_PHYMODE:
6459 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006460 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson4f7f7c62017-10-05 08:53:41 -07006461
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306462 if (!hHal)
6463 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006464
6465 ret =
6466 wlan_hdd_update_phymode(dev, hHal, set_value,
6467 phddctx);
6468 break;
6469 }
6470
6471 case WE_SET_NSS:
6472 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306473 if (!hHal)
6474 return -EINVAL;
6475
6476 hdd_notice("Set NSS = %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006477 if ((set_value > 2) || (set_value <= 0)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006478 hdd_err("NSS greater than 2 not supported");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006479 ret = -EINVAL;
6480 } else {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306481 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006482 hdd_update_nss(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006483 set_value))
6484 ret = -EINVAL;
6485 }
6486 break;
6487 }
6488
6489 case WE_SET_GTX_HT_MCS:
6490 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006491 hdd_debug("WMI_VDEV_PARAM_GTX_HT_MCS %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006492 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006493 WMI_VDEV_PARAM_GTX_HT_MCS,
6494 set_value, GTX_CMD);
6495 break;
6496 }
6497
6498 case WE_SET_GTX_VHT_MCS:
6499 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006500 hdd_debug("WMI_VDEV_PARAM_GTX_VHT_MCS %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006501 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006502 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006503 WMI_VDEV_PARAM_GTX_VHT_MCS,
6504 set_value, GTX_CMD);
6505 break;
6506 }
6507
6508 case WE_SET_GTX_USRCFG:
6509 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006510 hdd_debug("WMI_VDEV_PARAM_GTX_USR_CFG %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006511 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006512 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006513 WMI_VDEV_PARAM_GTX_USR_CFG,
6514 set_value, GTX_CMD);
6515 break;
6516 }
6517
6518 case WE_SET_GTX_THRE:
6519 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006520 hdd_debug("WMI_VDEV_PARAM_GTX_THRE %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006521 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006522 WMI_VDEV_PARAM_GTX_THRE,
6523 set_value, GTX_CMD);
6524 break;
6525 }
6526
6527 case WE_SET_GTX_MARGIN:
6528 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006529 hdd_debug("WMI_VDEV_PARAM_GTX_MARGIN %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006530 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006531 WMI_VDEV_PARAM_GTX_MARGIN,
6532 set_value, GTX_CMD);
6533 break;
6534 }
6535
6536 case WE_SET_GTX_STEP:
6537 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006538 hdd_debug("WMI_VDEV_PARAM_GTX_STEP %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006539 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006540 WMI_VDEV_PARAM_GTX_STEP,
6541 set_value, GTX_CMD);
6542 break;
6543 }
6544
6545 case WE_SET_GTX_MINTPC:
6546 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006547 hdd_debug("WMI_VDEV_PARAM_GTX_MINTPC %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006548 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006549 WMI_VDEV_PARAM_GTX_MINTPC,
6550 set_value, GTX_CMD);
6551 break;
6552 }
6553
6554 case WE_SET_GTX_BWMASK:
6555 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006556 hdd_debug("WMI_VDEV_PARAM_GTX_BWMASK %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006557 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006558 WMI_VDEV_PARAM_GTX_BW_MASK,
6559 set_value, GTX_CMD);
6560 break;
6561 }
6562
6563 case WE_SET_LDPC:
6564 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306565 if (!hHal)
6566 return -EINVAL;
6567
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006568 ret = hdd_set_ldpc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006569 break;
6570 }
6571
6572 case WE_SET_TX_STBC:
6573 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306574 if (!hHal)
6575 return -EINVAL;
6576
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006577 ret = hdd_set_tx_stbc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006578 break;
6579 }
6580
6581 case WE_SET_RX_STBC:
6582 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306583 if (!hHal)
6584 return -EINVAL;
6585
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006586 ret = hdd_set_rx_stbc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006587 break;
6588 }
6589
6590 case WE_SET_SHORT_GI:
6591 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306592 if (!hHal)
6593 return -EINVAL;
6594
6595 hdd_notice("WMI_VDEV_PARAM_SGI val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006596 ret = sme_update_ht_config(hHal, adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006597 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
6598 set_value);
6599 if (ret)
Jeff Johnson99bac312016-06-28 10:38:18 -07006600 hdd_err("Failed to set ShortGI value");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006601 break;
6602 }
6603
6604 case WE_SET_RTSCTS:
6605 {
6606 uint32_t value;
6607
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306608 if (!hHal)
6609 return -EINVAL;
6610
6611 hdd_notice("WMI_VDEV_PARAM_ENABLE_RTSCTS val 0x%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006612 set_value);
6613
6614 if ((set_value & HDD_RTSCTS_EN_MASK) ==
6615 HDD_RTSCTS_ENABLE)
6616 value =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006617 (WLAN_HDD_GET_CTX(adapter))->config->
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006618 RTSThreshold;
6619 else if (((set_value & HDD_RTSCTS_EN_MASK) == 0)
6620 || ((set_value & HDD_RTSCTS_EN_MASK) ==
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306621 HDD_CTS_ENABLE)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006622 value = WNI_CFG_RTS_THRESHOLD_STAMAX;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306623 } else {
6624 ret = -EIO;
6625 goto free;
6626 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006627
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006628 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006629 WMI_VDEV_PARAM_ENABLE_RTSCTS,
6630 set_value, VDEV_CMD);
6631 if (!ret) {
6632 if (sme_cfg_set_int
6633 (hHal, WNI_CFG_RTS_THRESHOLD, value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306634 QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006635 hdd_err("FAILED TO SET RTSCTS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306636 ret = -EIO;
6637 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006638 }
6639 }
6640
6641 break;
6642 }
6643
6644 case WE_SET_CHWIDTH:
6645 {
6646 bool chwidth = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006647 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson4f7f7c62017-10-05 08:53:41 -07006648
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05306649 if (!hHal)
6650 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006651
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006652 /*updating channel bonding only on 5Ghz */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006653 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006654 set_value);
6655 if (set_value > eHT_CHANNEL_WIDTH_80MHZ) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006656 hdd_err("Invalid channel width 0->20 1->40 2->80");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306657 ret = -EINVAL;
6658 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006659 }
6660
6661 if ((WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
6662 csr_convert_cb_ini_value_to_phy_cb_state(phddctx->config->
6663 nChannelBondingMode5GHz)))
6664 chwidth = true;
6665
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306666 sme_get_config_param(hHal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006667 switch (set_value) {
6668 case eHT_CHANNEL_WIDTH_20MHZ:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306669 sme_config->csrConfig.channelBondingMode5GHz =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006670 WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
6671 break;
6672 case eHT_CHANNEL_WIDTH_40MHZ:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306673 if (chwidth) {
6674 sme_config->csrConfig.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006675 channelBondingMode5GHz =
6676 phddctx->config->
6677 nChannelBondingMode5GHz;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306678 } else {
6679 ret = -EINVAL;
6680 goto free;
6681 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006682
6683 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006684 case eHT_CHANNEL_WIDTH_80MHZ:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306685 if (chwidth) {
6686 sme_config->csrConfig.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006687 channelBondingMode5GHz =
6688 phddctx->config->
6689 nChannelBondingMode5GHz;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306690 } else {
6691 ret = -EINVAL;
6692 goto free;
6693 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006694
6695 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006696
6697 default:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306698 ret = -EINVAL;
6699 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006700 }
6701
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006702 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006703 WMI_VDEV_PARAM_CHWIDTH,
6704 set_value, VDEV_CMD);
6705 if (!ret)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306706 sme_update_config(hHal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006707
6708 break;
6709 }
6710
6711 case WE_SET_ANI_EN_DIS:
6712 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006713 hdd_debug("WMI_PDEV_PARAM_ANI_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006714 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006715 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006716 WMI_PDEV_PARAM_ANI_ENABLE,
6717 set_value, PDEV_CMD);
6718 break;
6719 }
6720
6721 case WE_SET_ANI_POLL_PERIOD:
6722 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006723 hdd_debug("WMI_PDEV_PARAM_ANI_POLL_PERIOD val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006724 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006725 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006726 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
6727 set_value, PDEV_CMD);
6728 break;
6729 }
6730
6731 case WE_SET_ANI_LISTEN_PERIOD:
6732 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006733 hdd_debug("WMI_PDEV_PARAM_ANI_LISTEN_PERIOD val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006734 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006735 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006736 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
6737 set_value, PDEV_CMD);
6738 break;
6739 }
6740
6741 case WE_SET_ANI_OFDM_LEVEL:
6742 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006743 hdd_debug("WMI_PDEV_PARAM_ANI_OFDM_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006744 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006745 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006746 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
6747 set_value, PDEV_CMD);
6748 break;
6749 }
6750
6751 case WE_SET_ANI_CCK_LEVEL:
6752 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006753 hdd_debug("WMI_PDEV_PARAM_ANI_CCK_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006754 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006755 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006756 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
6757 set_value, PDEV_CMD);
6758 break;
6759 }
6760
6761 case WE_SET_DYNAMIC_BW:
6762 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006763 hdd_debug("WMI_PDEV_PARAM_DYNAMIC_BW val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006764 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006765 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006766 WMI_PDEV_PARAM_DYNAMIC_BW,
6767 set_value, PDEV_CMD);
6768 break;
6769 }
6770
6771 case WE_SET_CTS_CBW:
6772 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006773 hdd_debug("WE_SET_CTS_CBW val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006774 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006775 WMI_PDEV_PARAM_CTS_CBW,
6776 set_value, PDEV_CMD);
6777 break;
6778 }
6779
6780 case WE_SET_11N_RATE:
6781 {
6782 uint8_t preamble = 0, nss = 0, rix = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006783
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006784 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006785 set_value);
6786
6787 if (set_value != 0xff) {
6788 rix = RC_2_RATE_IDX(set_value);
6789 if (set_value & 0x80) {
6790 preamble = WMI_RATE_PREAMBLE_HT;
6791 nss = HT_RC_2_STREAMS(set_value) - 1;
6792 } else {
6793 nss = 0;
6794 rix = RC_2_RATE_IDX(set_value);
6795 if (set_value & 0x10) {
6796 preamble =
6797 WMI_RATE_PREAMBLE_CCK;
6798 if (rix != 0x3)
6799 /* Enable Short
6800 * preamble always for
6801 * CCK except 1mbps
6802 */
6803 rix |= 0x4;
6804 } else {
6805 preamble =
6806 WMI_RATE_PREAMBLE_OFDM;
6807 }
6808 }
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08006809 set_value = hdd_assemble_rate_code(preamble, nss, rix);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006810 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006811 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006812 set_value, rix, preamble, nss);
6813
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006814 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006815 WMI_VDEV_PARAM_FIXED_RATE,
6816 set_value, VDEV_CMD);
6817 break;
6818 }
6819
6820 case WE_SET_VHT_RATE:
6821 {
6822 uint8_t preamble = 0, nss = 0, rix = 0;
6823
6824 if (set_value != 0xff) {
6825 rix = RC_2_RATE_IDX_11AC(set_value);
6826 preamble = WMI_RATE_PREAMBLE_VHT;
6827 nss = HT_RC_2_STREAMS_11AC(set_value) - 1;
6828
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08006829 set_value = hdd_assemble_rate_code(preamble, nss, rix);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006830 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006831 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006832 set_value, rix, preamble, nss);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006833 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006834 WMI_VDEV_PARAM_FIXED_RATE,
6835 set_value, VDEV_CMD);
6836 break;
6837 }
6838
6839 case WE_SET_AMPDU:
6840 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006841 hdd_debug("SET AMPDU val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006842 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006843 GEN_VDEV_PARAM_AMPDU,
6844 set_value, GEN_CMD);
6845 break;
6846 }
6847
6848 case WE_SET_AMSDU:
6849 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006850 hdd_debug("SET AMSDU val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006851 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006852 GEN_VDEV_PARAM_AMSDU,
6853 set_value, GEN_CMD);
Deepak Dhamdhere612392c2016-08-28 02:56:51 -07006854 /* Update the stored ini value */
6855 if (!ret)
6856 hdd_ctx->config->max_amsdu_num = set_value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006857 break;
6858 }
6859
6860 case WE_SET_BURST_ENABLE:
6861 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006862 hdd_debug("SET Burst enable val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006863 if ((set_value == 0) || (set_value == 1)) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006864 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006865 WMI_PDEV_PARAM_BURST_ENABLE,
6866 set_value, PDEV_CMD);
6867 } else
6868 ret = -EINVAL;
6869 break;
6870 }
6871 case WE_SET_BURST_DUR:
6872 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006873 hdd_debug("SET Burst duration val %d", set_value);
Jeff Johnsonda5ee772016-08-04 17:18:47 -07006874 if ((set_value > 0) && (set_value <= 102400))
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006875 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006876 WMI_PDEV_PARAM_BURST_DUR,
6877 set_value, PDEV_CMD);
6878 else
6879 ret = -EINVAL;
6880 break;
6881 }
6882
6883 case WE_SET_TX_CHAINMASK:
6884 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006885 hdd_debug("WMI_PDEV_PARAM_TX_CHAIN_MASK val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006886 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006887 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006888 WMI_PDEV_PARAM_TX_CHAIN_MASK,
6889 set_value, PDEV_CMD);
6890 break;
6891 }
6892
6893 case WE_SET_RX_CHAINMASK:
6894 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006895 hdd_debug("WMI_PDEV_PARAM_RX_CHAIN_MASK val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006896 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006897 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006898 WMI_PDEV_PARAM_RX_CHAIN_MASK,
6899 set_value, PDEV_CMD);
6900 break;
6901 }
6902
6903 case WE_SET_TXPOW_2G:
6904 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006905 hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT2G val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006906 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006907 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006908 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
6909 set_value, PDEV_CMD);
6910 break;
6911 }
6912
6913 case WE_SET_TXPOW_5G:
6914 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006915 hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT5G val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006916 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006917 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006918 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
6919 set_value, PDEV_CMD);
6920 break;
6921 }
6922
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006923 /* Firmware debug log */
6924 case WE_DBGLOG_LOG_LEVEL:
6925 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006926 hdd_debug("WE_DBGLOG_LOG_LEVEL val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006927 hdd_ctx->fw_log_settings.dl_loglevel = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006928 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006929 WMI_DBGLOG_LOG_LEVEL,
6930 set_value, DBG_CMD);
6931 break;
6932 }
6933
6934 case WE_DBGLOG_VAP_ENABLE:
6935 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006936 hdd_debug("WE_DBGLOG_VAP_ENABLE val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006937 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006938 WMI_DBGLOG_VAP_ENABLE,
6939 set_value, DBG_CMD);
6940 break;
6941 }
6942
6943 case WE_DBGLOG_VAP_DISABLE:
6944 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006945 hdd_debug("WE_DBGLOG_VAP_DISABLE val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006946 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006947 WMI_DBGLOG_VAP_DISABLE,
6948 set_value, DBG_CMD);
6949 break;
6950 }
6951
6952 case WE_DBGLOG_MODULE_ENABLE:
6953 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006954 hdd_debug("WE_DBGLOG_MODULE_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006955 set_value);
6956 hdd_ctx->fw_log_settings.enable = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006957 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006958 WMI_DBGLOG_MODULE_ENABLE,
6959 set_value, DBG_CMD);
6960 break;
6961 }
6962
6963 case WE_DBGLOG_MODULE_DISABLE:
6964 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006965 hdd_debug("WE_DBGLOG_MODULE_DISABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006966 set_value);
6967 hdd_ctx->fw_log_settings.enable = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006968 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006969 WMI_DBGLOG_MODULE_DISABLE,
6970 set_value, DBG_CMD);
6971 break;
6972 }
6973 case WE_DBGLOG_MOD_LOG_LEVEL:
6974 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006975 hdd_debug("WE_DBGLOG_MOD_LOG_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006976 set_value);
6977
6978 if (hdd_ctx->fw_log_settings.index >= MAX_MOD_LOGLEVEL)
6979 hdd_ctx->fw_log_settings.index = 0;
6980
6981 hdd_ctx->fw_log_settings.
6982 dl_mod_loglevel[hdd_ctx->fw_log_settings.index] =
6983 set_value;
6984 hdd_ctx->fw_log_settings.index++;
6985
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006986 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006987 WMI_DBGLOG_MOD_LOG_LEVEL,
6988 set_value, DBG_CMD);
6989 break;
6990 }
6991
6992 case WE_DBGLOG_TYPE:
6993 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006994 hdd_debug("WE_DBGLOG_TYPE val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006995 hdd_ctx->fw_log_settings.dl_type = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006996 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006997 WMI_DBGLOG_TYPE,
6998 set_value, DBG_CMD);
6999 break;
7000 }
7001 case WE_DBGLOG_REPORT_ENABLE:
7002 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007003 hdd_debug("WE_DBGLOG_REPORT_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007004 set_value);
7005 hdd_ctx->fw_log_settings.dl_report = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007006 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007007 WMI_DBGLOG_REPORT_ENABLE,
7008 set_value, DBG_CMD);
7009 break;
7010 }
7011
7012 case WE_SET_TXRX_FWSTATS:
7013 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007014 hdd_debug("WE_SET_TXRX_FWSTATS val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007015 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007016 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
7017 set_value, VDEV_CMD);
7018 break;
7019 }
7020
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007021 case WE_SET_TXRX_STATS:
7022 {
7023 hdd_notice("WE_SET_TXRX_STATS val %d", set_value);
7024 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007025 adapter->sessionId);
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007026
Venkata Sharath Chandra Manchalabcdfdb12017-03-29 19:25:45 -07007027 if (ret != 0) {
7028 QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
7029 "Invalid handles");
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007030 break;
Venkata Sharath Chandra Manchalabcdfdb12017-03-29 19:25:45 -07007031 }
7032 ret = cdp_txrx_stats(soc, vdev, set_value);
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007033 break;
7034 }
7035
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007036 case WE_TXRX_FWSTATS_RESET:
7037 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007038 hdd_debug("WE_TXRX_FWSTATS_RESET val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007039 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007040 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
7041 set_value, VDEV_CMD);
7042 break;
7043 }
7044
7045 case WE_DUMP_STATS:
7046 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007047 hdd_debug("WE_DUMP_STATS val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007048 ret = hdd_wlan_dump_stats(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007049 break;
7050 }
7051
7052 case WE_CLEAR_STATS:
7053 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007054 hdd_debug("WE_CLEAR_STATS val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007055 switch (set_value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07007056 case CDP_HDD_STATS:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007057 memset(&adapter->stats, 0, sizeof(adapter->stats));
7058 memset(&adapter->hdd_stats, 0,
7059 sizeof(adapter->hdd_stats));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007060 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07007061 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007062 wlan_hdd_clear_tx_rx_histogram(hdd_ctx);
7063 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07007064 case CDP_HDD_NETIF_OPER_HISTORY:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007065 wlan_hdd_clear_netif_queue_history(hdd_ctx);
7066 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07007067 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05307068 hdd_clear_hif_stats();
7069 break;
Yun Park1027e8c2017-10-13 15:17:37 -07007070 case CDP_NAPI_STATS:
7071 hdd_clear_napi_stats();
7072 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007073 default:
Leo Changfdb45c32016-10-28 11:09:23 -07007074 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
7075 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007076 }
7077 break;
7078 }
7079
7080 case WE_PPS_PAID_MATCH:
7081 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007082 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307083 ret = -EINVAL;
7084 goto free;
7085 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007086
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007087 hdd_debug("WMI_VDEV_PPS_PAID_MATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007088 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007089 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007090 WMI_VDEV_PPS_PAID_MATCH,
7091 set_value, PPS_CMD);
7092 break;
7093 }
7094
7095 case WE_PPS_GID_MATCH:
7096 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007097 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307098 ret = -EINVAL;
7099 goto free;
7100 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007101 hdd_debug("WMI_VDEV_PPS_GID_MATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007102 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007103 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007104 WMI_VDEV_PPS_GID_MATCH,
7105 set_value, PPS_CMD);
7106 break;
7107 }
7108
7109 case WE_PPS_EARLY_TIM_CLEAR:
7110 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007111 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307112 ret = -EINVAL;
7113 goto free;
7114 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007115 hdd_debug(" WMI_VDEV_PPS_EARLY_TIM_CLEAR val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007116 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007117 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007118 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
7119 set_value, PPS_CMD);
7120 break;
7121 }
7122
7123 case WE_PPS_EARLY_DTIM_CLEAR:
7124 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007125 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307126 ret = -EINVAL;
7127 goto free;
7128 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007129 hdd_debug("WMI_VDEV_PPS_EARLY_DTIM_CLEAR val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007130 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007131 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007132 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
7133 set_value, PPS_CMD);
7134 break;
7135 }
7136
7137 case WE_PPS_EOF_PAD_DELIM:
7138 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007139 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307140 ret = -EINVAL;
7141 goto free;
7142 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007143 hdd_debug("WMI_VDEV_PPS_EOF_PAD_DELIM val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007144 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007145 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007146 WMI_VDEV_PPS_EOF_PAD_DELIM,
7147 set_value, PPS_CMD);
7148 break;
7149 }
7150
7151 case WE_PPS_MACADDR_MISMATCH:
7152 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007153 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307154 ret = -EINVAL;
7155 goto free;
7156 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007157 hdd_debug("WMI_VDEV_PPS_MACADDR_MISMATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007158 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007159 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007160 WMI_VDEV_PPS_MACADDR_MISMATCH,
7161 set_value, PPS_CMD);
7162 break;
7163 }
7164
7165 case WE_PPS_DELIM_CRC_FAIL:
7166 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007167 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307168 ret = -EINVAL;
7169 goto free;
7170 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007171 hdd_debug("WMI_VDEV_PPS_DELIM_CRC_FAIL val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007172 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007173 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007174 WMI_VDEV_PPS_DELIM_CRC_FAIL,
7175 set_value, PPS_CMD);
7176 break;
7177 }
7178
7179 case WE_PPS_GID_NSTS_ZERO:
7180 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007181 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307182 ret = -EINVAL;
7183 goto free;
7184 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007185 hdd_debug("WMI_VDEV_PPS_GID_NSTS_ZERO val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007186 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007187 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007188 WMI_VDEV_PPS_GID_NSTS_ZERO,
7189 set_value, PPS_CMD);
7190 break;
7191 }
7192
7193 case WE_PPS_RSSI_CHECK:
7194 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007195 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307196 ret = -EINVAL;
7197 goto free;
7198 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007199 hdd_debug("WMI_VDEV_PPS_RSSI_CHECK val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007200 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007201 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007202 WMI_VDEV_PPS_RSSI_CHECK,
7203 set_value, PPS_CMD);
7204 break;
7205 }
7206
7207 case WE_PPS_5G_EBT:
7208 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007209 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307210 ret = -EINVAL;
7211 goto free;
7212 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007213
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007214 hdd_debug("WMI_VDEV_PPS_5G_EBT val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007215 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007216 WMI_VDEV_PPS_5G_EBT,
7217 set_value, PPS_CMD);
7218 break;
7219 }
7220
7221 case WE_SET_HTSMPS:
7222 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007223 hdd_debug("WE_SET_HTSMPS val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007224 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007225 WMI_STA_SMPS_FORCE_MODE_CMDID,
7226 set_value, VDEV_CMD);
7227 break;
7228 }
7229
7230 case WE_SET_QPOWER_MAX_PSPOLL_COUNT:
7231 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007232 hdd_debug("WE_SET_QPOWER_MAX_PSPOLL_COUNT val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007233 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007234 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007235 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
7236 set_value, QPOWER_CMD);
7237 break;
7238 }
7239
7240 case WE_SET_QPOWER_MAX_TX_BEFORE_WAKE:
7241 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007242 hdd_debug("WE_SET_QPOWER_MAX_TX_BEFORE_WAKE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007243 set_value);
7244 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007245 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007246 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
7247 set_value, QPOWER_CMD);
7248 break;
7249 }
7250
7251 case WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
7252 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007253 hdd_debug("WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007254 set_value);
7255 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007256 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007257 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
7258 set_value, QPOWER_CMD);
7259 break;
7260 }
7261
7262 case WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
7263 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007264 hdd_debug("WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007265 set_value);
7266 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007267 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007268 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
7269 set_value, QPOWER_CMD);
7270 break;
7271 }
7272
7273 case WE_MCC_CONFIG_LATENCY:
7274 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007275 wlan_hdd_set_mcc_latency(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007276 break;
7277 }
7278
7279 case WE_MCC_CONFIG_QUOTA:
7280 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007281 hdd_debug("iwpriv cmd to set MCC quota with val %dms",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007282 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007283 ret = wlan_hdd_set_mcc_p2p_quota(adapter,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007284 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007285 break;
7286 }
7287 case WE_SET_DEBUG_LOG:
7288 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007289 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson4f7f7c62017-10-05 08:53:41 -07007290
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307291 if (!hHal)
7292 return -EINVAL;
7293
Nirav Shah1da77682016-05-03 20:16:39 +05307294
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007295 hdd_ctx->config->gEnableDebugLog = set_value;
7296 sme_update_connect_debug(hdd_ctx->hHal, set_value);
7297 break;
7298 }
7299 case WE_SET_EARLY_RX_ADJUST_ENABLE:
7300 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007301 hdd_debug("SET early_rx enable val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007302 if ((set_value == 0) || (set_value == 1))
7303 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007304 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007305 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
7306 set_value, VDEV_CMD);
7307 else
7308 ret = -EINVAL;
7309 break;
7310 }
7311 case WE_SET_EARLY_RX_TGT_BMISS_NUM:
7312 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007313 hdd_debug("SET early_rx bmiss val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007314 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007315 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
7316 set_value, VDEV_CMD);
7317 break;
7318 }
7319 case WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE:
7320 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007321 hdd_debug("SET early_rx bmiss sample cycle %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007322 set_value);
7323 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007324 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007325 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
7326 set_value, VDEV_CMD);
7327 break;
7328 }
7329 case WE_SET_EARLY_RX_SLOP_STEP:
7330 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007331 hdd_debug("SET early_rx bmiss slop step val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007332 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007333 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007334 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
7335 set_value, VDEV_CMD);
7336 break;
7337 }
7338 case WE_SET_EARLY_RX_INIT_SLOP:
7339 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007340 hdd_debug("SET early_rx init slop step val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007341 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007342 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007343 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
7344 set_value, VDEV_CMD);
7345 break;
7346 }
7347 case WE_SET_EARLY_RX_ADJUST_PAUSE:
7348 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007349 hdd_debug("SET early_rx adjust pause %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007350 if ((set_value == 0) || (set_value == 1))
7351 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007352 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007353 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
7354 set_value, VDEV_CMD);
7355 else
7356 ret = -EINVAL;
7357 break;
7358 }
7359 case WE_SET_EARLY_RX_DRIFT_SAMPLE:
7360 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007361 hdd_debug("SET early_rx drift sample %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007362 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007363 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
7364 set_value, VDEV_CMD);
7365 break;
7366 }
7367 case WE_SET_SCAN_DISABLE:
7368 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307369 if (!hHal)
7370 return -EINVAL;
7371
7372 hdd_notice("SET SCAN DISABLE %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007373 sme_set_scan_disable(WLAN_HDD_GET_HAL_CTX(adapter), set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007374 break;
7375 }
Govind Singha471e5e2015-10-12 17:11:14 +05307376 case WE_START_FW_PROFILE:
7377 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007378 hdd_debug("WE_START_FW_PROFILE %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007379 ret = wma_cli_set_command(adapter->sessionId,
Govind Singha471e5e2015-10-12 17:11:14 +05307380 WMI_WLAN_PROFILE_TRIGGER_CMDID,
7381 set_value, DBG_CMD);
7382 break;
7383 }
Abhishek Singh1bdb1572015-10-16 16:24:19 +05307384 case WE_SET_CHANNEL:
7385 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007386 hdd_debug("Set Channel %d Session ID %d mode %d", set_value,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007387 adapter->sessionId, adapter->device_mode);
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307388 if (!hHal)
7389 return -EINVAL;
7390
Abhishek Singh1bdb1572015-10-16 16:24:19 +05307391
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007392 if ((QDF_STA_MODE == adapter->device_mode) ||
7393 (QDF_P2P_CLIENT_MODE == adapter->device_mode)) {
Abhishek Singh1bdb1572015-10-16 16:24:19 +05307394
7395 status = sme_ext_change_channel(hHal,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007396 set_value, adapter->sessionId);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307397 if (status != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007398 hdd_err("Error in change channel status %d",
Abhishek Singh1bdb1572015-10-16 16:24:19 +05307399 status);
7400 ret = -EINVAL;
7401 }
7402 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07007403 hdd_err("change channel not supported for device mode %d",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007404 adapter->device_mode);
Abhishek Singh1bdb1572015-10-16 16:24:19 +05307405 ret = -EINVAL;
7406 }
7407 break;
7408 }
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05307409 case WE_SET_CONC_SYSTEM_PREF:
7410 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007411 hdd_debug("New preference: %d", set_value);
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05307412 if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) &&
7413 (set_value <= CFG_CONC_SYSTEM_PREF_MAX))) {
7414 hdd_err("Invalid system preference %d", set_value);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307415 ret = -EINVAL;
7416 goto free;
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05307417 }
Abhishek Singh1bdb1572015-10-16 16:24:19 +05307418
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05307419 /* hdd_ctx, hdd_ctx->config are already checked for null */
7420 hdd_ctx->config->conc_system_pref = set_value;
7421 break;
7422 }
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08007423 case WE_SET_11AX_RATE:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007424 ret = hdd_set_11ax_rate(adapter, set_value, NULL);
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08007425 break;
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07007426 case WE_SET_DCM:
7427 hdd_notice("Set WMI_VDEV_PARAM_HE_DCM: %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007428 ret = wma_cli_set_command(adapter->sessionId,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07007429 WMI_VDEV_PARAM_HE_DCM, set_value,
7430 VDEV_CMD);
7431 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07007432 case WE_SET_RANGE_EXT:
7433 hdd_notice("Set WMI_VDEV_PARAM_HE_RANGE_EXT: %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007434 ret = wma_cli_set_command(adapter->sessionId,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07007435 WMI_VDEV_PARAM_HE_RANGE_EXT,
7436 set_value, VDEV_CMD);
7437 break;
Jeff Johnson011c4502017-10-05 15:25:56 -07007438 case WE_SET_PDEV_RESET:
7439 ret = hdd_handle_pdev_reset(adapter, set_value);
7440 break;
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05307441 case WE_SET_MODULATED_DTIM:
7442 {
7443 if ((set_value < CFG_ENABLE_MODULATED_DTIM_MIN) ||
7444 (set_value > CFG_ENABLE_MODULATED_DTIM_MAX)) {
7445 hdd_err("Invalid gEnableModuleDTIM value %d",
7446 set_value);
7447 return -EINVAL;
7448 } else {
7449 hdd_ctx->config->enableModulatedDTIM = set_value;
7450 }
7451 break;
7452 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007453 default:
Jeff Johnson011c4502017-10-05 15:25:56 -07007454 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007455 ret = -EINVAL;
7456 break;
7457 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307458 EXIT();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307459free:
7460 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007461 return ret;
7462}
7463
7464static int iw_setint_getnone(struct net_device *dev,
7465 struct iw_request_info *info,
7466 union iwreq_data *wrqu,
7467 char *extra)
7468{
7469 int ret;
7470
7471 cds_ssr_protect(__func__);
7472 ret = __iw_setint_getnone(dev, info, wrqu, extra);
7473 cds_ssr_unprotect(__func__);
7474
7475 return ret;
7476}
7477
7478/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07007479 * __iw_setnone_get_threeint() - return three value to up layer.
7480 *
7481 * @dev: pointer of net_device of this wireless card
7482 * @info: meta data about Request sent
7483 * @wrqu: include request info
7484 * @extra: buf used for in/Output
7485 *
7486 * Return: execute result
7487 */
7488static int __iw_setnone_get_threeint(struct net_device *dev,
7489 struct iw_request_info *info,
7490 union iwreq_data *wrqu, char *extra)
7491{
7492 int ret = 0; /* success */
7493 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07007494 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007495 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07007496
7497 ENTER_DEV(dev);
7498 ret = wlan_hdd_validate_context(hdd_ctx);
7499 if (0 != ret)
7500 return ret;
7501
Jeff Johnson441e1f72017-02-07 08:50:49 -08007502 ret = hdd_check_private_wext_control(hdd_ctx, info);
7503 if (0 != ret)
7504 return ret;
7505
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007506 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07007507 switch (value[0]) {
7508 case WE_GET_TSF:
7509 ret = hdd_indicate_tsf(adapter, value, 3);
7510 break;
7511 default:
7512 hdd_err("Invalid IOCTL get_value command %d", value[0]);
7513 break;
7514 }
7515 return ret;
7516}
7517
7518/**
7519 * iw_setnone_get_threeint() - return three value to up layer.
7520 *
7521 * @dev: pointer of net_device of this wireless card
7522 * @info: meta data about Request sent
7523 * @wrqu: include request info
7524 * @extra: buf used for in/Output
7525 *
7526 * Return: execute result
7527 */
7528static int iw_setnone_get_threeint(struct net_device *dev,
7529 struct iw_request_info *info,
7530 union iwreq_data *wrqu, char *extra)
7531{
7532 int ret;
7533
7534 cds_ssr_protect(__func__);
7535 ret = __iw_setnone_get_threeint(dev, info, wrqu, extra);
7536 cds_ssr_unprotect(__func__);
7537
7538 return ret;
7539}
7540
7541/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007542 * iw_setchar_getnone() - Generic "set string" private ioctl handler
7543 * @dev: device upon which the ioctl was received
7544 * @info: ioctl request information
7545 * @wrqu: ioctl request data
7546 * @extra: ioctl extra data
7547 *
7548 * Return: 0 on success, non-zero on error
7549 */
7550static int __iw_setchar_getnone(struct net_device *dev,
7551 struct iw_request_info *info,
7552 union iwreq_data *wrqu, char *extra)
7553{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307554 QDF_STATUS vstatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007555 int sub_cmd;
7556 int ret;
7557 char *pBuffer = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007558 struct hdd_adapter *adapter = (netdev_priv(dev));
7559 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007560 struct hdd_config *pConfig = hdd_ctx->config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007561 struct iw_point s_priv_data;
7562
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08007563 ENTER_DEV(dev);
7564
Mukul Sharma34777c62015-11-02 20:22:30 +05307565 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007566 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05307567 return -EPERM;
7568 }
7569
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007570 ret = wlan_hdd_validate_context(hdd_ctx);
7571 if (0 != ret)
7572 return ret;
7573
Jeff Johnson441e1f72017-02-07 08:50:49 -08007574 ret = hdd_check_private_wext_control(hdd_ctx, info);
7575 if (0 != ret)
7576 return ret;
7577
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007578 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007579 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007580 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007581
7582 /* make sure all params are correctly passed to function */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007583 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007584 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007585
7586 sub_cmd = s_priv_data.flags;
7587
7588 /* ODD number is used for set, copy data using copy_from_user */
7589 pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
7590 s_priv_data.length);
7591 if (NULL == pBuffer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007592 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007593 return -ENOMEM;
7594 }
7595
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007596 hdd_debug("Received length: %d data: %s",
7597 s_priv_data.length, pBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007598
7599 switch (sub_cmd) {
7600 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007601 hdd_debug("ADD_PTRN");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007602 hdd_add_wowl_ptrn(adapter, pBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007603 break;
7604 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007605 hdd_debug("DEL_PTRN");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007606 hdd_del_wowl_ptrn(adapter, pBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007607 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007608 case WE_NEIGHBOR_REPORT_REQUEST:
7609 {
7610 tRrmNeighborReq neighborReq;
7611 tRrmNeighborRspCallbackInfo callbackInfo;
7612
7613 if (pConfig->fRrmEnable) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007614 hdd_debug("Neighbor Request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007615 neighborReq.no_ssid =
7616 (s_priv_data.length - 1) ? false : true;
7617 if (!neighborReq.no_ssid) {
7618 neighborReq.ssid.length =
7619 (s_priv_data.length - 1) >
7620 32 ? 32 : (s_priv_data.length - 1);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05307621 qdf_mem_copy(neighborReq.ssid.ssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007622 pBuffer,
7623 neighborReq.ssid.length);
7624 }
7625
7626 callbackInfo.neighborRspCallback = NULL;
7627 callbackInfo.neighborRspCallbackContext = NULL;
7628 callbackInfo.timeout = 5000; /* 5 seconds */
7629 sme_neighbor_report_request(WLAN_HDD_GET_HAL_CTX
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007630 (adapter),
7631 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007632 &neighborReq,
7633 &callbackInfo);
7634 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007635 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007636 ret = -EINVAL;
7637 }
7638 }
7639 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007640 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08007641 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007642 break;
7643 case WE_SET_CONFIG:
7644 vstatus = hdd_execute_global_config_command(hdd_ctx, pBuffer);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007645 if (QDF_STATUS_SUCCESS != vstatus)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007646 ret = -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007647
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007648 break;
7649 default:
7650 {
Jeff Johnson99bac312016-06-28 10:38:18 -07007651 hdd_err("Invalid sub command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007652 sub_cmd);
7653 ret = -EINVAL;
7654 break;
7655 }
7656 }
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07007657 qdf_mem_free(pBuffer);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307658 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007659 return ret;
7660}
7661
7662static int iw_setchar_getnone(struct net_device *dev,
7663 struct iw_request_info *info,
7664 union iwreq_data *wrqu, char *extra)
7665{
7666 int ret;
7667
7668 cds_ssr_protect(__func__);
7669 ret = __iw_setchar_getnone(dev, info, wrqu, extra);
7670 cds_ssr_unprotect(__func__);
7671
7672 return ret;
7673}
7674
7675/**
7676 * iw_setnone_getint() - Generic "get integer" private ioctl handler
7677 * @dev: device upon which the ioctl was received
7678 * @info: ioctl request information
7679 * @wrqu: ioctl request data
7680 * @extra: ioctl extra data
7681 *
7682 * Return: 0 on success, non-zero on error
7683 */
7684static int __iw_setnone_getint(struct net_device *dev,
7685 struct iw_request_info *info,
7686 union iwreq_data *wrqu, char *extra)
7687{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007688 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
7689 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007690 int *value = (int *)extra;
7691 int ret;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307692 tSmeConfigParams *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007693 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007694
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307695 sme_config = qdf_mem_malloc(sizeof(*sme_config));
7696 if (!sme_config) {
7697 hdd_err("failed to allocate memory for sme_config");
7698 return -ENOMEM;
7699 }
7700 qdf_mem_zero(sme_config, sizeof(*sme_config));
7701
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08007702 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307703
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007704 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007705 ret = wlan_hdd_validate_context(hdd_ctx);
7706 if (0 != ret)
7707 return ret;
7708
Jeff Johnson441e1f72017-02-07 08:50:49 -08007709 ret = hdd_check_private_wext_control(hdd_ctx, info);
7710 if (0 != ret)
7711 return ret;
7712
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007713 switch (value[0]) {
7714 case WE_GET_11D_STATE:
7715 {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307716 sme_get_config_param(hHal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007717
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307718 *value = sme_config->csrConfig.Is11dSupportEnabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007719
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007720 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007721
7722 break;
7723 }
7724
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007725 case WE_GET_WLAN_DBG:
7726 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05307727 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007728 *value = 0;
7729 break;
7730 }
7731 case WE_GET_MAX_ASSOC:
7732 {
7733 if (sme_cfg_get_int
7734 (hHal, WNI_CFG_ASSOC_STA_LIMIT,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307735 (uint32_t *) value) != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007736 hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007737 ret = -EIO;
7738 }
7739 break;
7740 }
7741 case WE_GET_SAP_AUTO_CHANNEL_SELECTION:
7742 *value = (WLAN_HDD_GET_CTX(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007743 adapter))->config->force_sap_acs;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007744 break;
7745
7746 case WE_GET_CONCURRENCY_MODE:
7747 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08007748 *value = policy_mgr_get_concurrency_mode(hdd_ctx->hdd_psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007749
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007750 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007751 break;
7752 }
7753
7754 case WE_GET_NSS:
7755 {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307756 sme_get_config_param(hHal, sme_config);
7757 *value = (sme_config->csrConfig.enable2x2 == 0) ? 1 : 2;
Srinivas Girigowda576b2352017-08-25 14:44:26 -07007758 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->hdd_psoc))
7759 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007760 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007761 break;
7762 }
7763
7764 case WE_GET_GTX_HT_MCS:
7765 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007766 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007767 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007768 WMI_VDEV_PARAM_GTX_HT_MCS,
7769 GTX_CMD);
7770 break;
7771 }
7772
7773 case WE_GET_GTX_VHT_MCS:
7774 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007775 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007776 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007777 WMI_VDEV_PARAM_GTX_VHT_MCS,
7778 GTX_CMD);
7779 break;
7780 }
7781
7782 case WE_GET_GTX_USRCFG:
7783 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007784 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007785 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007786 WMI_VDEV_PARAM_GTX_USR_CFG,
7787 GTX_CMD);
7788 break;
7789 }
7790
7791 case WE_GET_GTX_THRE:
7792 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007793 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007794 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007795 WMI_VDEV_PARAM_GTX_THRE,
7796 GTX_CMD);
7797 break;
7798 }
7799
7800 case WE_GET_GTX_MARGIN:
7801 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007802 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007803 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007804 WMI_VDEV_PARAM_GTX_MARGIN,
7805 GTX_CMD);
7806 break;
7807 }
7808
7809 case WE_GET_GTX_STEP:
7810 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007811 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007812 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007813 WMI_VDEV_PARAM_GTX_STEP,
7814 GTX_CMD);
7815 break;
7816 }
7817
7818 case WE_GET_GTX_MINTPC:
7819 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007820 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007821 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007822 WMI_VDEV_PARAM_GTX_MINTPC,
7823 GTX_CMD);
7824 break;
7825 }
7826
7827 case WE_GET_GTX_BWMASK:
7828 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007829 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007830 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007831 WMI_VDEV_PARAM_GTX_BW_MASK,
7832 GTX_CMD);
7833 break;
7834 }
7835
7836 case WE_GET_LDPC:
7837 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007838 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007839 break;
7840 }
7841
7842 case WE_GET_TX_STBC:
7843 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007844 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007845 break;
7846 }
7847
7848 case WE_GET_RX_STBC:
7849 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007850 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007851 break;
7852 }
7853
7854 case WE_GET_SHORT_GI:
7855 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007856 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007857 *value = wma_cli_get_command(adapter->sessionId,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08007858 WMI_VDEV_PARAM_SGI,
7859 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007860 break;
7861 }
7862
7863 case WE_GET_RTSCTS:
7864 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007865 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007866 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007867 WMI_VDEV_PARAM_ENABLE_RTSCTS,
7868 VDEV_CMD);
7869 break;
7870 }
7871
7872 case WE_GET_CHWIDTH:
7873 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007874 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007875 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007876 WMI_VDEV_PARAM_CHWIDTH,
7877 VDEV_CMD);
7878 break;
7879 }
7880
7881 case WE_GET_ANI_EN_DIS:
7882 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007883 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007884 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007885 WMI_PDEV_PARAM_ANI_ENABLE,
7886 PDEV_CMD);
7887 break;
7888 }
7889
7890 case WE_GET_ANI_POLL_PERIOD:
7891 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007892 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007893 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007894 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
7895 PDEV_CMD);
7896 break;
7897 }
7898
7899 case WE_GET_ANI_LISTEN_PERIOD:
7900 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007901 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007902 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007903 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
7904 PDEV_CMD);
7905 break;
7906 }
7907
7908 case WE_GET_ANI_OFDM_LEVEL:
7909 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007910 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007911 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007912 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
7913 PDEV_CMD);
7914 break;
7915 }
7916
7917 case WE_GET_ANI_CCK_LEVEL:
7918 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007919 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007920 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007921 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
7922 PDEV_CMD);
7923 break;
7924 }
7925
7926 case WE_GET_DYNAMIC_BW:
7927 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007928 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007929 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007930 WMI_PDEV_PARAM_DYNAMIC_BW,
7931 PDEV_CMD);
7932 break;
7933 }
7934
7935 case WE_GET_11N_RATE:
7936 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007937 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007938 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007939 WMI_VDEV_PARAM_FIXED_RATE,
7940 VDEV_CMD);
7941 break;
7942 }
7943
7944 case WE_GET_AMPDU:
7945 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007946 hdd_debug("GET AMPDU");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007947 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007948 GEN_VDEV_PARAM_AMPDU,
7949 GEN_CMD);
7950 break;
7951 }
7952
7953 case WE_GET_AMSDU:
7954 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007955 hdd_debug("GET AMSDU");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007956 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007957 GEN_VDEV_PARAM_AMSDU,
7958 GEN_CMD);
7959 break;
7960 }
7961
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07007962 case WE_GET_ROAM_SYNCH_DELAY:
7963 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007964 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007965 *value = wma_cli_get_command(adapter->sessionId,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07007966 GEN_VDEV_ROAM_SYNCH_DELAY,
7967 GEN_CMD);
7968 break;
7969 }
7970
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007971 case WE_GET_BURST_ENABLE:
7972 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007973 hdd_debug("GET Burst enable value");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007974 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007975 WMI_PDEV_PARAM_BURST_ENABLE,
7976 PDEV_CMD);
7977 break;
7978 }
7979 case WE_GET_BURST_DUR:
7980 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007981 hdd_debug("GET Burst Duration value");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007982 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007983 WMI_PDEV_PARAM_BURST_DUR,
7984 PDEV_CMD);
7985 break;
7986 }
7987
7988 case WE_GET_TX_CHAINMASK:
7989 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007990 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007991 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007992 WMI_PDEV_PARAM_TX_CHAIN_MASK,
7993 PDEV_CMD);
7994 break;
7995 }
7996
7997 case WE_GET_RX_CHAINMASK:
7998 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007999 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008000 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008001 WMI_PDEV_PARAM_RX_CHAIN_MASK,
8002 PDEV_CMD);
8003 break;
8004 }
8005
8006 case WE_GET_TXPOW_2G:
8007 {
8008 uint32_t txpow2g = 0;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008009 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008010
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008011 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008012 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008013 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
8014 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308015 if (QDF_STATUS_SUCCESS !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008016 sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL,
8017 &txpow2g)) {
8018 return -EIO;
8019 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008020 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008021 break;
8022 }
8023
8024 case WE_GET_TXPOW_5G:
8025 {
8026 uint32_t txpow5g = 0;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008027 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008028
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008029 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008030 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008031 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
8032 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308033 if (QDF_STATUS_SUCCESS !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008034 sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL,
8035 &txpow5g)) {
8036 return -EIO;
8037 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008038 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008039 break;
8040 }
8041
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008042 case WE_GET_PPS_PAID_MATCH:
8043 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008044 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008045 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008046 WMI_VDEV_PPS_PAID_MATCH,
8047 PPS_CMD);
8048 break;
8049 }
8050
8051 case WE_GET_PPS_GID_MATCH:
8052 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008053 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008054 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008055 WMI_VDEV_PPS_GID_MATCH,
8056 PPS_CMD);
8057 break;
8058 }
8059
8060 case WE_GET_PPS_EARLY_TIM_CLEAR:
8061 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008062 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008063 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008064 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
8065 PPS_CMD);
8066 break;
8067 }
8068
8069 case WE_GET_PPS_EARLY_DTIM_CLEAR:
8070 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008071 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008072 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008073 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
8074 PPS_CMD);
8075 break;
8076 }
8077
8078 case WE_GET_PPS_EOF_PAD_DELIM:
8079 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008080 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008081 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008082 WMI_VDEV_PPS_EOF_PAD_DELIM,
8083 PPS_CMD);
8084 break;
8085 }
8086
8087 case WE_GET_PPS_MACADDR_MISMATCH:
8088 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008089 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008090 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008091 WMI_VDEV_PPS_MACADDR_MISMATCH,
8092 PPS_CMD);
8093 break;
8094 }
8095
8096 case WE_GET_PPS_DELIM_CRC_FAIL:
8097 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008098 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008099 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008100 WMI_VDEV_PPS_DELIM_CRC_FAIL,
8101 PPS_CMD);
8102 break;
8103 }
8104
8105 case WE_GET_PPS_GID_NSTS_ZERO:
8106 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008107 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008108 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008109 WMI_VDEV_PPS_GID_NSTS_ZERO,
8110 PPS_CMD);
8111 break;
8112 }
8113
8114 case WE_GET_PPS_RSSI_CHECK:
8115 {
8116
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008117 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008118 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008119 WMI_VDEV_PPS_RSSI_CHECK,
8120 PPS_CMD);
8121 break;
8122 }
8123
8124 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
8125 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008126 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008127 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008128 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
8129 QPOWER_CMD);
8130 break;
8131 }
8132
8133 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
8134 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008135 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008136 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008137 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
8138 QPOWER_CMD);
8139 break;
8140 }
8141
8142 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
8143 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008144 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008145 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008146 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
8147 QPOWER_CMD);
8148 break;
8149 }
8150
8151 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
8152 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008153 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008154 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008155 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
8156 QPOWER_CMD);
8157 break;
8158 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07008159 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008160 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07008161 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008162 case WE_GET_TEMPERATURE:
8163 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008164 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008165 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008166 break;
8167 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07008168 case WE_GET_DCM:
8169 hdd_notice("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008170 *value = wma_cli_get_command(adapter->sessionId,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07008171 WMI_VDEV_PARAM_HE_DCM,
8172 VDEV_CMD);
8173 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07008174 case WE_GET_RANGE_EXT:
8175 hdd_notice("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008176 *value = wma_cli_get_command(adapter->sessionId,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07008177 WMI_VDEV_PARAM_HE_RANGE_EXT,
8178 VDEV_CMD);
8179 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008180 default:
8181 {
Jeff Johnson99bac312016-06-28 10:38:18 -07008182 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008183 value[0]);
8184 break;
8185 }
8186 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308187 EXIT();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308188 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008189 return ret;
8190}
8191
8192static int iw_setnone_getint(struct net_device *dev,
8193 struct iw_request_info *info,
8194 union iwreq_data *wrqu, char *extra)
8195{
8196 int ret;
8197
8198 cds_ssr_protect(__func__);
8199 ret = __iw_setnone_getint(dev, info, wrqu, extra);
8200 cds_ssr_unprotect(__func__);
8201
8202 return ret;
8203}
8204
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05308205static int hdd_set_fwtest(int argc, int cmd, int value)
8206{
8207 struct set_fwtest_params *fw_test;
8208
8209 /* check for max number of arguments */
8210 if (argc > (WMA_MAX_NUM_ARGS) ||
8211 argc != HDD_FWTEST_PARAMS) {
8212 hdd_err("Too Many args %d", argc);
8213 return -EINVAL;
8214 }
8215 /*
8216 * check if number of arguments are 3 then, check
8217 * then set the default value for sounding interval.
8218 */
8219 if (HDD_FWTEST_PARAMS == argc) {
8220 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
8221 value = HDD_FWTEST_SU_DEFAULT_VALUE;
8222 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
8223 value = HDD_FWTEST_MU_DEFAULT_VALUE;
8224 }
8225 /* check sounding interval value should not exceed to max */
8226 if (value > HDD_FWTEST_MAX_VALUE) {
8227 hdd_err("Invalid arguments value should not exceed max: %d",
8228 value);
8229 return -EINVAL;
8230 }
8231 fw_test = qdf_mem_malloc(sizeof(*fw_test));
8232 if (NULL == fw_test) {
8233 hdd_err("qdf_mem_malloc failed for fw_test");
8234 return -ENOMEM;
8235 }
8236 fw_test->arg = cmd;
8237 fw_test->value = value;
8238 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
8239 qdf_mem_free(fw_test);
8240 hdd_err("Not able to post FW_TEST_CMD message to WMA");
8241 return -EINVAL;
8242 }
8243 return 0;
8244}
8245
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008246/**
8247 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
8248 * @dev: device upon which the ioctl was received
8249 * @info: ioctl request information
8250 * @wrqu: ioctl request data
8251 * @extra: ioctl extra data
8252 *
8253 * Return: 0 on success, non-zero on error
8254 */
8255static int __iw_set_three_ints_getnone(struct net_device *dev,
8256 struct iw_request_info *info,
8257 union iwreq_data *wrqu, char *extra)
8258{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008259 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008260 int *value = (int *)extra;
8261 int sub_cmd = value[0];
8262 int ret;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008263 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008264
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08008265 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308266
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07008267 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008268 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07008269 return -EPERM;
8270 }
8271
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008272 ret = wlan_hdd_validate_context(hdd_ctx);
8273 if (0 != ret)
8274 return ret;
8275
Jeff Johnson441e1f72017-02-07 08:50:49 -08008276 ret = hdd_check_private_wext_control(hdd_ctx, info);
8277 if (0 != ret)
8278 return ret;
8279
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008280 switch (sub_cmd) {
8281
8282 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07008283 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
8284 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008285 break;
8286 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05308287 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008288 break;
8289
8290 /* value[3] the acs band is not required as start and end channels are
8291 * enough but this cmd is maintained under set three ints for historic
8292 * reasons.
8293 */
8294 case WE_SET_SAP_CHANNELS:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008295 if (wlan_hdd_validate_operation_channel(adapter, value[1]) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308296 QDF_STATUS_SUCCESS ||
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008297 wlan_hdd_validate_operation_channel(adapter,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308298 value[2]) != QDF_STATUS_SUCCESS) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008299 ret = -EINVAL;
8300 } else {
8301 hdd_ctx->config->force_sap_acs_st_ch = value[1];
8302 hdd_ctx->config->force_sap_acs_end_ch = value[2];
8303 }
8304 break;
8305 case WE_SET_DUAL_MAC_SCAN_CONFIG:
8306 hdd_debug("Ioctl to set dual mac scan config");
Tushnim Bhattacharyya49ed8ab2017-05-26 18:20:10 -07008307 if (hdd_ctx->config->dual_mac_feature_disable ==
8308 DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008309 hdd_err("Dual mac feature is disabled from INI");
8310 return -EPERM;
8311 }
8312 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08008313 policy_mgr_set_dual_mac_scan_config(hdd_ctx->hdd_psoc,
8314 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008315 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05308316 case WE_SET_FW_TEST:
8317 {
8318 ret = hdd_set_fwtest(value[1], value[2], value[3]);
8319 if (ret) {
8320 hdd_err("Not able to set fwtest %d", ret);
8321 return ret;
8322 }
8323 }
8324 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008325 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07008326 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008327 break;
8328
8329 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308330 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008331 return ret;
8332}
8333
8334int iw_set_three_ints_getnone(struct net_device *dev,
8335 struct iw_request_info *info,
8336 union iwreq_data *wrqu, char *extra)
8337{
8338 int ret;
8339
8340 cds_ssr_protect(__func__);
8341 ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
8342 cds_ssr_unprotect(__func__);
8343
8344 return ret;
8345}
8346
8347/**
8348 * hdd_connection_state_string() - Get connection state string
8349 * @connection_state: enum to be converted to a string
8350 *
8351 * Return: the string equivalent of @connection_state
8352 */
8353static const char *
8354hdd_connection_state_string(eConnectionState connection_state)
8355{
8356 switch (connection_state) {
8357 CASE_RETURN_STRING(eConnectionState_NotConnected);
8358 CASE_RETURN_STRING(eConnectionState_Connecting);
8359 CASE_RETURN_STRING(eConnectionState_Associated);
8360 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
8361 CASE_RETURN_STRING(eConnectionState_IbssConnected);
8362 CASE_RETURN_STRING(eConnectionState_Disconnecting);
8363 default:
8364 return "UNKNOWN";
8365 }
8366}
8367
Naveen Rawat910726a2017-03-06 11:42:51 -08008368#if defined(FEATURE_OEM_DATA_SUPPORT)
8369/**
8370 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
8371 * wifi_pos api to get oem data caps
8372 * @dev: net device upon which the request was received
8373 * @info: ioctl request information
8374 * @wrqu: ioctl request data
8375 * @extra: ioctl data payload
8376 *
8377 * Return: 0 for success, negative errno value on failure
8378 */
8379static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
8380 struct iw_request_info *info,
8381 union iwreq_data *wrqu, char *extra)
8382{
8383 return iw_get_oem_data_cap(dev, info, wrqu, extra);
8384}
8385#elif defined(WIFI_POS_CONVERGED)
8386static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
8387 struct iw_request_info *info,
8388 union iwreq_data *wrqu, char *extra)
8389{
Jeff Johnson3d278b02017-08-29 14:17:47 -07008390 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008391 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08008392
8393 return os_if_wifi_pos_populate_caps(hdd_ctx->hdd_psoc,
8394 (struct wifi_pos_driver_caps *)extra);
8395}
8396#else
8397static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
8398 struct iw_request_info *info,
8399 union iwreq_data *wrqu, char *extra)
8400{
8401 return -ENOTSUPP;
8402}
8403#endif
8404
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008405/**
8406 * iw_get_char_setnone() - Generic "get string" private ioctl handler
8407 * @dev: device upon which the ioctl was received
8408 * @info: ioctl request information
8409 * @wrqu: ioctl request data
8410 * @extra: ioctl extra data
8411 *
8412 * Return: 0 on success, non-zero on error
8413 */
8414static int __iw_get_char_setnone(struct net_device *dev,
8415 struct iw_request_info *info,
8416 union iwreq_data *wrqu, char *extra)
8417{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008418 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008419 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008420 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008421 int ret;
8422#ifdef WLAN_FEATURE_11W
Jeff Johnson2a722002017-09-30 20:02:35 -07008423 struct hdd_wext_state *pWextState;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008424#endif
8425
8426#ifdef WLAN_FEATURE_11W
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008427 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008428#endif
8429
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08008430 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308431
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008432 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008433 ret = wlan_hdd_validate_context(hdd_ctx);
8434 if (0 != ret)
8435 return ret;
8436
Jeff Johnson441e1f72017-02-07 08:50:49 -08008437 ret = hdd_check_private_wext_control(hdd_ctx, info);
8438 if (0 != ret)
8439 return ret;
8440
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008441 switch (sub_cmd) {
8442 case WE_WLAN_VERSION:
8443 {
Arun Khandavallia96c2c02016-05-17 19:15:34 +05308444 hdd_wlan_get_version(hdd_ctx, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008445 break;
8446 }
8447
8448 case WE_GET_STATS:
8449 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008450 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008451 extra, WE_MAX_STR_LEN);
8452 break;
8453 }
8454
Dustin Brownd9322482017-01-09 12:46:03 -08008455 case WE_GET_SUSPEND_RESUME_STATS:
8456 {
8457 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
8458 WE_MAX_STR_LEN);
8459 if (ret >= 0) {
8460 wrqu->data.length = ret;
8461 ret = 0;
8462 }
8463
8464 break;
8465 }
8466
Govind Singha471e5e2015-10-12 17:11:14 +05308467 case WE_LIST_FW_PROFILE:
8468 hdd_wlan_list_fw_profile(&(wrqu->data.length),
8469 extra, WE_MAX_STR_LEN);
8470 break;
8471
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008472 /* The case prints the current state of the HDD, SME, CSR, PE,
8473 * TL it can be extended for WDI Global State as well. And
8474 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
8475 * and P2P_GO have not been added as of now.
8476 */
8477 case WE_GET_STATES:
8478 {
8479 int buf = 0, len = 0;
8480 int adapter_num = 0;
8481 int count = 0, check = 1;
8482
8483 tHalHandle hHal = NULL;
8484 tpAniSirGlobal pMac = NULL;
Jeff Johnsond377dce2017-10-04 10:32:42 -07008485 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008486
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008487 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson3d278b02017-08-29 14:17:47 -07008488 struct hdd_adapter *useAdapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008489
8490 /* Print wlan0 or p2p0 states based on the adapter_num
8491 * by using the correct adapter
8492 */
8493 while (adapter_num < 2) {
8494 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008495 useAdapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008496 buf =
8497 scnprintf(extra + len,
8498 WE_MAX_STR_LEN - len,
8499 "\n\n wlan0 States:-");
8500 len += buf;
8501 } else if (P2P_ADAPTER == adapter_num) {
8502 buf =
8503 scnprintf(extra + len,
8504 WE_MAX_STR_LEN - len,
8505 "\n\n p2p0 States:-");
8506 len += buf;
8507
Jeff Johnsonce2ee982017-09-03 09:27:35 -07008508 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008509 buf =
8510 scnprintf(extra + len,
8511 WE_MAX_STR_LEN -
8512 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07008513 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008514 len += buf;
8515 break;
8516 }
8517
8518 /* Printing p2p0 states only in the
8519 * case when the device is configured
8520 * as a p2p_client
8521 */
8522 useAdapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07008523 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08008524 QDF_P2P_CLIENT_MODE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008525 if (!useAdapter) {
8526 buf =
8527 scnprintf(extra + len,
8528 WE_MAX_STR_LEN -
8529 len,
8530 "\n Device not configured as P2P_CLIENT.");
8531 len += buf;
8532 break;
8533 }
8534 }
8535
8536 hHal = WLAN_HDD_GET_HAL_CTX(useAdapter);
8537 if (!hHal) {
8538 buf =
8539 scnprintf(extra + len,
8540 WE_MAX_STR_LEN - len,
8541 "\n pMac is NULL");
8542 len += buf;
8543 break;
8544 }
8545 pMac = PMAC_STRUCT(hHal);
8546 if (!pMac) {
8547 buf =
8548 scnprintf(extra + len,
8549 WE_MAX_STR_LEN - len,
8550 "\n pMac is NULL");
8551 len += buf;
8552 break;
8553 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07008554 sta_ctx =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008555 WLAN_HDD_GET_STATION_CTX_PTR(useAdapter);
8556
8557
8558 buf =
8559 scnprintf(extra + len, WE_MAX_STR_LEN - len,
8560 "\n HDD Conn State - %s "
8561 "\n \n SME State:"
8562 "\n Neighbour Roam State - %s"
8563 "\n CSR State - %s"
8564 "\n CSR Substate - %s",
8565 hdd_connection_state_string
Jeff Johnsond377dce2017-10-04 10:32:42 -07008566 (sta_ctx->conn_info.connState),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008567 mac_trace_get_neighbour_roam_state
8568 (sme_get_neighbor_roam_state
8569 (hHal, useAdapter->sessionId)),
8570 mac_trace_getcsr_roam_state
8571 (sme_get_current_roam_state
8572 (hHal, useAdapter->sessionId)),
8573 mac_trace_getcsr_roam_sub_state
8574 (sme_get_current_roam_sub_state
8575 (hHal, useAdapter->sessionId))
8576 );
8577 len += buf;
8578 adapter_num++;
8579 }
8580
Mukul Sharma81661ae2015-10-30 20:26:02 +05308581 if (hHal) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008582 /* Printing Lim State starting with global lim states */
8583 buf =
8584 scnprintf(extra + len, WE_MAX_STR_LEN - len,
8585 "\n \n LIM STATES:-"
8586 "\n Global Sme State - %s "
8587 "\n Global mlm State - %s " "\n",
8588 mac_trace_get_lim_sme_state
8589 (sme_get_lim_sme_state(hHal)),
8590 mac_trace_get_lim_mlm_state
8591 (sme_get_lim_sme_state(hHal))
8592 );
8593 len += buf;
8594
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008595 while (check < 3 && count < 255) {
8596 if (sme_is_lim_session_valid(hHal, count)) {
8597 buf =
8598 scnprintf(extra + len,
8599 WE_MAX_STR_LEN -
8600 len,
8601 "\n Lim Valid Session %d:-"
8602 "\n PE Sme State - %s "
8603 "\n PE Mlm State - %s "
8604 "\n", check,
8605 mac_trace_get_lim_sme_state
8606 (sme_get_lim_sme_session_state
8607 (hHal, count)),
8608 mac_trace_get_lim_mlm_state
8609 (sme_get_lim_mlm_session_state
8610 (hHal, count))
8611 );
8612
8613 len += buf;
8614 check++;
8615 }
8616 count++;
8617 }
8618 }
8619
8620 wrqu->data.length = strlen(extra) + 1;
8621 break;
8622 }
8623
8624 case WE_GET_CFG:
8625 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008626 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008627 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008628 extra,
8629 QCSAP_IOCTL_MAX_STR_LEN);
8630 wrqu->data.length = strlen(extra) + 1;
8631 break;
8632 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008633 case WE_GET_RSSI:
8634 {
8635 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008636
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008637 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008638 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
8639 wrqu->data.length = strlen(extra) + 1;
8640 break;
8641 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008642
8643 case WE_GET_WMM_STATUS:
8644 {
8645 snprintf(extra, WE_MAX_STR_LEN,
8646 "\nDir: 0=up, 1=down, 3=both\n"
8647 "|------------------------|\n"
8648 "|AC | ACM |Admitted| Dir |\n"
8649 "|------------------------|\n"
8650 "|VO | %d | %3s | %d |\n"
8651 "|VI | %d | %3s | %d |\n"
8652 "|BE | %d | %3s | %d |\n"
8653 "|BK | %d | %3s | %d |\n"
8654 "|------------------------|\n",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008655 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008656 wmmAcStatus[SME_AC_VO].wmmAcAccessRequired,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008657 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008658 wmmAcStatus[SME_AC_VO].
8659 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008660 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008661 wmmAcStatus[SME_AC_VO].wmmAcTspecInfo.
8662 ts_info.direction,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008663 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008664 wmmAcStatus[SME_AC_VI].wmmAcAccessRequired,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008665 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008666 wmmAcStatus[SME_AC_VI].
8667 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008668 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008669 wmmAcStatus[SME_AC_VI].wmmAcTspecInfo.
8670 ts_info.direction,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008671 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008672 wmmAcStatus[SME_AC_BE].wmmAcAccessRequired,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008673 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008674 wmmAcStatus[SME_AC_BE].
8675 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008676 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008677 wmmAcStatus[SME_AC_BE].wmmAcTspecInfo.
8678 ts_info.direction,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008679 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008680 wmmAcStatus[SME_AC_BK].wmmAcAccessRequired,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008681 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008682 wmmAcStatus[SME_AC_BK].
8683 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008684 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008685 wmmAcStatus[SME_AC_BK].wmmAcTspecInfo.
8686 ts_info.direction);
8687
8688 wrqu->data.length = strlen(extra) + 1;
8689 break;
8690 }
8691 case WE_GET_CHANNEL_LIST:
8692 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308693 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008694 uint8_t i, len;
8695 char *buf;
8696 uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN];
8697 uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008698 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008699
Srinivas Girigowdac231df62017-03-24 18:27:57 -07008700 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008701
8702 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05308703 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008704 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308705 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008706 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008707 return -EINVAL;
8708 }
8709 buf = extra;
8710 /*
8711 * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN.
8712 * Maximum buffer needed = 5 * number of channels.
8713 * Check ifsufficient buffer is available and then
8714 * proceed to fill the buffer.
8715 */
8716 if (WE_MAX_STR_LEN <
8717 (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008718 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008719 return -EINVAL;
8720 }
8721 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
8722 channel_list.num_channels);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308723 if (QDF_STATUS_SUCCESS == sme_get_country_code(hdd_ctx->hHal,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008724 ubuf, &ubuf_len)) {
8725 /* Printing Country code in getChannelList */
8726 for (i = 0; i < (ubuf_len - 1); i++)
8727 len += scnprintf(buf + len,
8728 WE_MAX_STR_LEN - len,
8729 "%c", ubuf[i]);
8730 }
8731 for (i = 0; i < channel_list.num_channels; i++) {
8732 len +=
8733 scnprintf(buf + len, WE_MAX_STR_LEN - len,
8734 " %u", channel_list.channels[i]);
8735 }
8736 wrqu->data.length = strlen(extra) + 1;
8737
8738 break;
8739 }
8740#ifdef FEATURE_WLAN_TDLS
8741 case WE_GET_TDLS_PEERS:
8742 {
8743 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008744 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008745 WE_MAX_STR_LEN) + 1;
8746 break;
8747 }
8748#endif
8749#ifdef WLAN_FEATURE_11W
8750 case WE_GET_11W_INFO:
8751 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008752 hdd_debug("WE_GET_11W_ENABLED = %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008753 pWextState->roamProfile.MFPEnabled);
8754
8755 snprintf(extra, WE_MAX_STR_LEN,
8756 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
8757 "\n Number of Unprotected Disassocs %d"
8758 "\n Number of Unprotected Deauths %d",
8759 pWextState->roamProfile.BSSIDs.bssid->bytes[0],
8760 pWextState->roamProfile.BSSIDs.bssid->bytes[1],
8761 pWextState->roamProfile.BSSIDs.bssid->bytes[2],
8762 pWextState->roamProfile.BSSIDs.bssid->bytes[3],
8763 pWextState->roamProfile.BSSIDs.bssid->bytes[4],
8764 pWextState->roamProfile.BSSIDs.bssid->bytes[5],
8765 pWextState->roamProfile.MFPEnabled,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008766 adapter->hdd_stats.hddPmfStats.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008767 numUnprotDisassocRx,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008768 adapter->hdd_stats.hddPmfStats.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008769 numUnprotDeauthRx);
8770
8771 wrqu->data.length = strlen(extra) + 1;
8772 break;
8773 }
8774#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08008775 case WE_GET_IBSS_STA_INFO:
8776 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07008777 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008778 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08008779 int idx = 0;
8780 int length = 0, buf = 0;
8781
Naveen Rawatc45d1622016-07-05 12:20:09 -07008782 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07008783 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07008784 sta_ctx->conn_info.staId[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08008785 buf = snprintf
8786 ((extra + length),
8787 WE_MAX_STR_LEN - length,
8788 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnsond377dce2017-10-04 10:32:42 -07008789 sta_ctx->conn_info.staId[idx],
8790 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08008791 peerMacAddress[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07008792 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08008793 peerMacAddress[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07008794 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08008795 peerMacAddress[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07008796 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08008797 peerMacAddress[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07008798 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08008799 peerMacAddress[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07008800 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08008801 peerMacAddress[idx].bytes[5]
8802 );
8803 length += buf;
8804 }
8805 }
8806 wrqu->data.length = strlen(extra) + 1;
8807 break;
8808 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008809 case WE_GET_PHYMODE:
8810 {
8811 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008812 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
8813 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008814 eCsrPhyMode phymode;
8815 eCsrBand currBand;
Dustin Browne9c6b3a2017-01-23 17:17:32 -08008816 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008817
Dustin Browne9c6b3a2017-01-23 17:17:32 -08008818 sme_config = qdf_mem_malloc(sizeof(*sme_config));
8819 if (!sme_config) {
8820 hdd_err("Out of memory");
8821 ret = -ENOMEM;
8822 break;
8823 }
8824
8825 sme_get_config_param(hal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008826 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08008827 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008828 ch_bond24 = true;
8829
8830 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08008831 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008832 ch_bond5g = true;
8833
Dustin Browne9c6b3a2017-01-23 17:17:32 -08008834 qdf_mem_free(sme_config);
8835
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008836 phymode = sme_get_phy_mode(hal);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308837 if ((QDF_STATUS_SUCCESS !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008838 sme_get_freq_band(hal, &currBand))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008839 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008840 return -EIO;
8841 }
8842
8843 switch (phymode) {
8844 case eCSR_DOT11_MODE_AUTO:
8845 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
8846 break;
8847 case eCSR_DOT11_MODE_11n:
8848 case eCSR_DOT11_MODE_11n_ONLY:
8849 if (currBand == eCSR_BAND_24) {
8850 if (ch_bond24)
8851 snprintf(extra, WE_MAX_STR_LEN,
8852 "11NGHT40");
8853 else
8854 snprintf(extra, WE_MAX_STR_LEN,
8855 "11NGHT20");
8856 } else if (currBand == eCSR_BAND_5G) {
8857 if (ch_bond5g)
8858 snprintf(extra, WE_MAX_STR_LEN,
8859 "11NAHT40");
8860 else
8861 snprintf(extra, WE_MAX_STR_LEN,
8862 "11NAHT20");
8863 } else {
8864 snprintf(extra, WE_MAX_STR_LEN, "11N");
8865 }
8866 break;
8867 case eCSR_DOT11_MODE_abg:
8868 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
8869 break;
8870 case eCSR_DOT11_MODE_11a:
8871 snprintf(extra, WE_MAX_STR_LEN, "11A");
8872 break;
8873 case eCSR_DOT11_MODE_11b:
8874 case eCSR_DOT11_MODE_11b_ONLY:
8875 snprintf(extra, WE_MAX_STR_LEN, "11B");
8876 break;
8877 case eCSR_DOT11_MODE_11g:
8878 case eCSR_DOT11_MODE_11g_ONLY:
8879 snprintf(extra, WE_MAX_STR_LEN, "11G");
8880 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008881 case eCSR_DOT11_MODE_11ac:
8882 case eCSR_DOT11_MODE_11ac_ONLY:
8883 if (hddctx->config->vhtChannelWidth ==
8884 eHT_CHANNEL_WIDTH_20MHZ)
8885 snprintf(extra, WE_MAX_STR_LEN,
8886 "11ACVHT20");
8887 else if (hddctx->config->vhtChannelWidth ==
8888 eHT_CHANNEL_WIDTH_40MHZ)
8889 snprintf(extra, WE_MAX_STR_LEN,
8890 "11ACVHT40");
8891 else if (hddctx->config->vhtChannelWidth ==
8892 eHT_CHANNEL_WIDTH_80MHZ)
8893 snprintf(extra, WE_MAX_STR_LEN,
8894 "11ACVHT80");
8895 else if (hddctx->config->vhtChannelWidth ==
8896 eHT_CHANNEL_WIDTH_160MHZ)
8897 snprintf(extra, WE_MAX_STR_LEN,
8898 "11ACVHT160");
8899 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08008900 case eCSR_DOT11_MODE_11ax:
8901 case eCSR_DOT11_MODE_11ax_ONLY:
8902 /* currently using vhtChannelWidth */
8903 if (hddctx->config->vhtChannelWidth ==
8904 eHT_CHANNEL_WIDTH_20MHZ)
8905 snprintf(extra, WE_MAX_STR_LEN,
8906 "11AX_HE_20");
8907 else if (hddctx->config->vhtChannelWidth ==
8908 eHT_CHANNEL_WIDTH_40MHZ)
8909 snprintf(extra, WE_MAX_STR_LEN,
8910 "11AX_HE_40");
8911 else if (hddctx->config->vhtChannelWidth ==
8912 eHT_CHANNEL_WIDTH_80MHZ)
8913 snprintf(extra, WE_MAX_STR_LEN,
8914 "11AX_HE_80");
8915 else if (hddctx->config->vhtChannelWidth ==
8916 eHT_CHANNEL_WIDTH_160MHZ)
8917 snprintf(extra, WE_MAX_STR_LEN,
8918 "11AX_HE_160");
8919 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008920 }
8921
8922 wrqu->data.length = strlen(extra) + 1;
8923 break;
8924 }
8925
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008926 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08008927 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008928 case WE_GET_SNR:
8929 {
8930 int8_t s7snr = 0;
8931 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07008932 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07008933 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008934
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008935 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07008936 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05308937 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008938 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05308939
Jeff Johnsond377dce2017-10-04 10:32:42 -07008940 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07008941 if (0 == hdd_ctx->config->fEnableSNRMonitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008942 eConnectionState_Associated !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07008943 sta_ctx->conn_info.connState) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008944 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -07008945 hdd_ctx->config->fEnableSNRMonitoring,
Jeff Johnsond377dce2017-10-04 10:32:42 -07008946 sta_ctx->conn_info.connState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008947 return -ENONET;
8948 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008949 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008950 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
8951 wrqu->data.length = strlen(extra) + 1;
8952 break;
8953 }
8954 default:
8955 {
Jeff Johnson99bac312016-06-28 10:38:18 -07008956 hdd_err("Invalid IOCTL command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008957 sub_cmd);
8958 break;
8959 }
8960 }
Dustin Brownd9322482017-01-09 12:46:03 -08008961
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308962 EXIT();
Dustin Brownd9322482017-01-09 12:46:03 -08008963 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008964}
8965
8966static int iw_get_char_setnone(struct net_device *dev,
8967 struct iw_request_info *info,
8968 union iwreq_data *wrqu, char *extra)
8969{
8970 int ret;
8971
8972 cds_ssr_protect(__func__);
8973 ret = __iw_get_char_setnone(dev, info, wrqu, extra);
8974 cds_ssr_unprotect(__func__);
8975
8976 return ret;
8977}
8978
8979/**
8980 * iw_setnone_getnone() - Generic "action" private ioctl handler
8981 * @dev: device upon which the ioctl was received
8982 * @info: ioctl request information
8983 * @wrqu: ioctl request data
8984 * @extra: ioctl extra data
8985 *
8986 * Return: 0 on success, non-zero on error
8987 */
8988static int __iw_setnone_getnone(struct net_device *dev,
8989 struct iw_request_info *info,
8990 union iwreq_data *wrqu, char *extra)
8991{
Jeff Johnson3d278b02017-08-29 14:17:47 -07008992 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008993 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008994 int ret;
8995 int sub_cmd;
8996
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08008997 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308998
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08008999 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009000 ret = wlan_hdd_validate_context(hdd_ctx);
9001 if (0 != ret)
9002 return ret;
9003
Jeff Johnson441e1f72017-02-07 08:50:49 -08009004 ret = hdd_check_private_wext_control(hdd_ctx, info);
9005 if (0 != ret)
9006 return ret;
9007
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009008#ifdef CONFIG_COMPAT
9009 /* this ioctl is a special case where a sub-ioctl is used and both
9010 * the number of get and set args is 0. in this specific case the
9011 * logic in iwpriv places the sub_cmd in the data.flags portion of
9012 * the iwreq. unfortunately the location of this field will be
9013 * different between 32-bit and 64-bit userspace, and the standard
9014 * compat support in the kernel does not handle this case. so we
9015 * need to explicitly handle it here.
9016 */
9017 if (is_compat_task()) {
9018 struct compat_iw_point *compat_iw_point =
9019 (struct compat_iw_point *)&wrqu->data;
9020 sub_cmd = compat_iw_point->flags;
9021 } else {
9022 sub_cmd = wrqu->data.flags;
9023 }
9024#else
9025 sub_cmd = wrqu->data.flags;
9026#endif
9027
9028 switch (sub_cmd) {
9029 case WE_GET_RECOVERY_STAT:
9030 {
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009031 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009032
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009033 sme_get_recovery_stats(hal);
9034 break;
9035 }
9036
Govind Singha471e5e2015-10-12 17:11:14 +05309037 case WE_GET_FW_PROFILE_DATA:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009038 ret = wma_cli_set_command(adapter->sessionId,
Govind Singha471e5e2015-10-12 17:11:14 +05309039 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
9040 0, DBG_CMD);
9041 break;
9042
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009043 case WE_IBSS_GET_PEER_INFO_ALL:
9044 {
9045 hdd_wlan_get_ibss_peer_info_all(adapter);
9046 break;
9047 }
9048
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009049 case WE_SET_REASSOC_TRIGGER:
9050 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07009051 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009052
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009053 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05309054 tSirMacAddr bssid;
Krunal Sonibfd05492017-10-03 15:48:37 -07009055 uint32_t roamId = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05309056 uint8_t operating_ch =
9057 adapter->sessionCtx.station.conn_info.operationChannel;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009058 tCsrRoamModifyProfileFields modProfileFields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009059
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009060 sme_get_modify_profile_fields(hHal, adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009061 &modProfileFields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05309062 if (roaming_offload_enabled(hdd_ctx)) {
9063 qdf_mem_copy(bssid,
9064 &adapter->sessionCtx.station.conn_info.bssId,
9065 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -08009066 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05309067 bssid, operating_ch);
9068 } else {
9069 sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId,
9070 NULL, modProfileFields, &roamId, 1);
9071 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009072 return 0;
9073 }
9074
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009075 case WE_STOP_OBSS_SCAN:
9076 {
9077 /*
9078 * 1.OBSS Scan is mandatory while operating in 2.4GHz
9079 * 2.OBSS scan is stopped by Firmware during the disassociation
9080 * 3.OBSS stop comamnd is added for debugging purpose
9081 */
9082 tHalHandle hal;
9083
9084 hal = WLAN_HDD_GET_HAL_CTX(adapter);
9085 if (hal == NULL) {
9086 hdd_err("hal context is NULL");
9087 return -EINVAL;
9088 }
9089 sme_ht40_stop_obss_scan(hal, adapter->sessionId);
9090 }
9091 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009092 default:
9093 {
Jeff Johnson99bac312016-06-28 10:38:18 -07009094 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009095 break;
9096 }
9097 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309098 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009099 return ret;
9100}
9101
9102static int iw_setnone_getnone(struct net_device *dev,
9103 struct iw_request_info *info,
9104 union iwreq_data *wrqu, char *extra)
9105{
9106 int ret;
9107
9108 cds_ssr_protect(__func__);
9109 ret = __iw_setnone_getnone(dev, info, wrqu, extra);
9110 cds_ssr_unprotect(__func__);
9111
9112 return ret;
9113}
9114
Krunal Sonia6e505b2017-01-12 12:25:18 -08009115#ifdef MPC_UT_FRAMEWORK
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009116static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07009117 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08009118{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -08009119 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08009120 case WE_POLICY_MANAGER_CLIST_CMD:
9121 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009122 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009123 policy_mgr_incr_connection_count_utfw(hdd_ctx->hdd_psoc,
9124 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
9125 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009126 }
9127 break;
9128
9129 case WE_POLICY_MANAGER_DLIST_CMD:
9130 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009131 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009132 policy_mgr_decr_connection_count_utfw(hdd_ctx->hdd_psoc,
9133 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009134 }
9135 break;
9136
9137 case WE_POLICY_MANAGER_ULIST_CMD:
9138 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009139 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009140 policy_mgr_update_connection_info_utfw(hdd_ctx->hdd_psoc,
9141 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
9142 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009143 }
9144 break;
9145
9146 case WE_POLICY_MANAGER_DBS_CMD:
9147 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009148 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08009149 if (apps_args[0] == 0)
9150 wma_set_dbs_capability_ut(0);
9151 else
9152 wma_set_dbs_capability_ut(1);
9153
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009154 if (apps_args[1] >= PM_THROUGHPUT &&
9155 apps_args[1] <= PM_LATENCY) {
Krunal Sonia6e505b2017-01-12 12:25:18 -08009156 pr_info("setting system pref to [%d]\n", apps_args[1]);
9157 hdd_ctx->config->conc_system_pref = apps_args[1];
9158 }
9159 }
9160 break;
9161
9162 case WE_POLICY_MANAGER_PCL_CMD:
9163 {
9164 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
9165 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
9166 uint32_t pcl_len = 0, i = 0;
9167
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07009168 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -08009169
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009170 policy_mgr_get_pcl(hdd_ctx->hdd_psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -08009171 pcl, &pcl_len,
9172 weight_list, QDF_ARRAY_SIZE(weight_list));
9173 pr_info("PCL list for role[%d] is {", apps_args[0]);
9174 for (i = 0 ; i < pcl_len; i++)
9175 pr_info(" %d, ", pcl[i]);
9176 pr_info("}--------->\n");
9177 }
9178 break;
9179
9180 case WE_POLICY_SET_HW_MODE_CMD:
9181 {
9182 if (apps_args[0] == 0) {
9183 hdd_err("set hw mode for single mac");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009184 policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08009185 adapter->sessionId,
9186 HW_MODE_SS_2x2,
9187 HW_MODE_80_MHZ,
9188 HW_MODE_SS_0x0, HW_MODE_BW_NONE,
9189 HW_MODE_DBS_NONE,
9190 HW_MODE_AGILE_DFS_NONE,
9191 HW_MODE_SBS_NONE,
9192 SIR_UPDATE_REASON_UT);
9193 } else if (apps_args[0] == 1) {
9194 hdd_err("set hw mode for dual mac");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009195 policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08009196 adapter->sessionId,
9197 HW_MODE_SS_1x1,
9198 HW_MODE_80_MHZ,
9199 HW_MODE_SS_1x1, HW_MODE_40_MHZ,
9200 HW_MODE_DBS,
9201 HW_MODE_AGILE_DFS_NONE,
9202 HW_MODE_SBS_NONE,
9203 SIR_UPDATE_REASON_UT);
9204 }
9205 }
9206 break;
9207
9208 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
9209 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009210 enum policy_mgr_conc_next_action action;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009211
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07009212 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009213 action = policy_mgr_current_connections_update(
9214 hdd_ctx->hdd_psoc,
9215 adapter->sessionId, apps_args[0],
9216 SIR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009217 pr_info("next action is %d {HDD_NOP = 0, HDD_DBS, HDD_DBS_DOWNGRADE, HDD_MCC, HDD_MCC_UPGRADE}", action);
9218 }
9219 break;
9220
9221 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
9222 {
9223 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009224
9225 hdd_notice("<iwpriv wlan0 pm_query_allow> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009226 allow = policy_mgr_allow_concurrency(hdd_ctx->hdd_psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -08009227 apps_args[0], apps_args[1], apps_args[2]);
9228 pr_info("allow %d {0 = don't allow, 1 = allow}", allow);
9229 }
9230 break;
9231
9232 case WE_POLICY_MANAGER_SCENARIO_CMD:
9233 {
9234 clean_report(hdd_ctx);
9235 if (apps_args[0] == 1) {
9236 wlan_hdd_one_connection_scenario(hdd_ctx);
9237 } else if (apps_args[0] == 2) {
9238 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009239 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009240 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009241 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009242 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009243 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009244 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009245 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009246 } else if (apps_args[0] == 3) {
9247 /* MCC on same band with 2x2 same mac*/
9248 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009249 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009250 /* MCC on diff band with 2x2 same mac*/
9251 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009252 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009253 /* MCC on diff band with 1x1 diff mac */
9254 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009255 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009256 /* MCC on diff band with 1x1 same mac */
9257 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009258 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009259 /* SCC on same band with 2x2 same mac */
9260 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009261 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009262 /* SCC on same band with 1x1 same mac */
9263 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009264 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009265 /* MCC on same band with 2x2 same mac */
9266 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009267 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009268 /* MCC on same band with 1x1 same mac */
9269 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009270 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009271 }
9272 print_report(hdd_ctx);
9273 }
9274 break;
9275 }
9276 return 0;
9277}
9278#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009279static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -07009280 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -08009281{
9282 return 0;
9283}
9284#endif
9285
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009286/**
9287 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
9288 * @dev: device upon which the ioctl was received
9289 * @info: ioctl request information
9290 * @wrqu: ioctl request data
9291 * @extra: ioctl extra data
9292 *
9293 * This is an SSR-protected generic handler for private ioctls which
9294 * take multiple arguments. Note that this implementation is also
9295 * somewhat unique in that it is shared by both STA-mode and SAP-mode
9296 * interfaces.
9297 *
9298 * Return: 0 on success, non-zero on error
9299 */
9300static int __iw_set_var_ints_getnone(struct net_device *dev,
9301 struct iw_request_info *info,
9302 union iwreq_data *wrqu, char *extra)
9303{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009304 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
9305 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009306 int sub_cmd;
9307 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009308 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009309 int ret, num_args;
9310
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009311 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309312
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009313 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009314 ret = wlan_hdd_validate_context(hdd_ctx);
9315 if (0 != ret)
9316 return ret;
9317
Jeff Johnson441e1f72017-02-07 08:50:49 -08009318 ret = hdd_check_private_wext_control(hdd_ctx, info);
9319 if (0 != ret)
9320 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009321
9322 sub_cmd = wrqu->data.flags;
9323 num_args = wrqu->data.length;
9324
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009325 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009326
9327 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009328 case WE_IBSS_GET_PEER_INFO:
9329 {
9330 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009331 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009332 }
9333 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009334
9335 case WE_P2P_NOA_CMD:
9336 {
Srinivas Girigowda5d5fdc52017-03-24 22:30:57 -07009337 struct p2p_app_set_ps p2pNoA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009338
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009339 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -08009340 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
9341 hdd_device_mode_to_string(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009342 adapter->device_mode),
9343 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -08009344 return -EINVAL;
9345 }
9346
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009347 p2pNoA.opp_ps = apps_args[0];
9348 p2pNoA.ctWindow = apps_args[1];
9349 p2pNoA.duration = apps_args[2];
9350 p2pNoA.interval = apps_args[3];
9351 p2pNoA.count = apps_args[4];
9352 p2pNoA.single_noa_duration = apps_args[5];
9353 p2pNoA.psSelection = apps_args[6];
9354
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009355 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 -07009356 apps_args[0], apps_args[1], apps_args[2],
9357 apps_args[3], apps_args[4],
9358 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009359
9360 hdd_set_p2p_ps(dev, &p2pNoA);
9361
9362 }
9363 break;
9364
9365 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
9366 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009367 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -07009368 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05309369 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009370 }
9371 break;
9372
9373 case WE_MTRACE_DUMP_CMD:
9374 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009375 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -07009376 apps_args[0], apps_args[1],
9377 apps_args[2], apps_args[3]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05309378 qdf_trace_dump_all((void *)hHal, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009379 apps_args[1], apps_args[2],
9380 apps_args[3]);
9381
9382 }
9383 break;
9384
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009385 case WE_POLICY_MANAGER_CINFO_CMD:
9386 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009387 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009388 uint32_t i = 0, len = 0;
9389
Krunal Sonia6e505b2017-01-12 12:25:18 -08009390 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009391 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -08009392 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009393 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -07009394 pr_info("|table_index[%d]\t\t\n", i);
9395 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
9396 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
9397 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
9398 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
9399 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
9400 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
9401 pr_info("+--------------------------+\n");
9402 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009403 }
9404 }
9405 break;
9406
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009407
9408#ifdef FEATURE_WLAN_TDLS
9409 case WE_TDLS_CONFIG_PARAMS:
9410 {
Jeff Johnsona0ce1022017-10-01 20:09:16 -07009411 struct hdd_tdls_config_params tdlsParams;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009412
9413 tdlsParams.tdls = apps_args[0];
9414 tdlsParams.tx_period_t = apps_args[1];
9415 tdlsParams.tx_packet_n = apps_args[2];
9416 /* ignore args[3] as discovery_period is not used anymore */
9417 tdlsParams.discovery_tries_n = apps_args[4];
9418 /* ignore args[5] as idle_timeout is not used anymore */
9419 tdlsParams.idle_packet_n = apps_args[6];
9420 /* ignore args[7] as rssi_hysteresis is not used anymore */
9421 tdlsParams.rssi_trigger_threshold = apps_args[8];
9422 tdlsParams.rssi_teardown_threshold = apps_args[9];
9423 tdlsParams.rssi_delta = apps_args[10];
9424
9425 wlan_hdd_tdls_set_params(dev, &tdlsParams);
9426 }
9427 break;
9428#endif
9429 case WE_UNIT_TEST_CMD:
9430 {
Krunal Soniaadaa272017-10-04 16:42:55 -07009431 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009432
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009433 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
9434 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07009435 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009436 return -EINVAL;
9437 }
Krunal Soniaadaa272017-10-04 16:42:55 -07009438 if ((apps_args[1] >= (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +05309439 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -07009440 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009441 return -EINVAL;
9442 }
Krunal Soniaadaa272017-10-04 16:42:55 -07009443 status = sme_send_unit_test_cmd(adapter->sessionId,
9444 apps_args[0],
9445 apps_args[1],
9446 &apps_args[2]);
9447 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -07009448 hdd_err("sme_send_unit_test_cmd returned %d", status);
9449 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009450 }
9451 }
9452 break;
9453#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
9454 case WE_LED_FLASHING_PARAM:
9455 {
9456 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009457
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009458 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009459 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009460 return -EINVAL;
9461 }
9462 for (i = 0; i < num_args; i++) {
9463 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009464 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009465 return -EINVAL;
9466 }
9467 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009468 sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009469 0, apps_args[0], apps_args[1]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009470 sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009471 1, apps_args[2], apps_args[3]);
9472 }
9473 break;
9474#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +05309475 case WE_SET_PKTLOG:
9476 {
9477 int ret;
9478
9479 if (num_args < 1 || num_args > 2) {
9480 hdd_err("pktlog: either 1 or 2 parameters are required");
9481 return -EINVAL;
9482 }
9483
9484 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
9485 apps_args[1]);
9486 if (ret)
9487 return ret;
9488 break;
9489 }
9490
Manjeet Singhf82ed072016-07-08 11:40:00 +05309491 case WE_MAC_PWR_DEBUG_CMD:
9492 {
9493 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009494 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
Manjeet Singhf82ed072016-07-08 11:40:00 +05309495 int i, j;
9496
9497 if (num_args < 3) {
9498 hdd_err("number of arguments can't be null %d",
9499 num_args);
9500 return -EINVAL;
9501 }
9502 if (num_args - 3 != apps_args[2]) {
9503 hdd_err("arg list of size %d doesn't match num_args %d",
9504 num_args-3, apps_args[2]);
9505 return -EINVAL;
9506 }
9507 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
9508 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
9509 hdd_err("Invalid MODULE ID %d", apps_args[1]);
9510 return -EINVAL;
9511 }
9512 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
9513 hdd_err("Too Many args %d", apps_args[2]);
9514 return -EINVAL;
9515 }
9516 mac_pwr_dbg_args.pdev_id = apps_args[0];
9517 mac_pwr_dbg_args.module_id = apps_args[1];
9518 mac_pwr_dbg_args.num_args = apps_args[2];
9519
9520 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
9521 mac_pwr_dbg_args.args[i] = apps_args[j];
9522
9523 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009524 sme_process_mac_pwr_dbg_cmd(hal, adapter->sessionId,
Manjeet Singhf82ed072016-07-08 11:40:00 +05309525 &mac_pwr_dbg_args)) {
9526 return -EINVAL;
9527 }
9528 }
9529 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -08009530 case WE_POLICY_MANAGER_CLIST_CMD:
9531 case WE_POLICY_MANAGER_DLIST_CMD:
9532 case WE_POLICY_MANAGER_ULIST_CMD:
9533 case WE_POLICY_MANAGER_DBS_CMD:
9534 case WE_POLICY_MANAGER_PCL_CMD:
9535 case WE_POLICY_SET_HW_MODE_CMD:
9536 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
9537 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
9538 case WE_POLICY_MANAGER_SCENARIO_CMD:
9539 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009540 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Sonia6e505b2017-01-12 12:25:18 -08009541 sub_cmd, apps_args);
9542 }
9543 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009544 default:
9545 {
Jeff Johnson99bac312016-06-28 10:38:18 -07009546 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009547 }
9548 break;
9549 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309550 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009551 return 0;
9552}
9553
9554/**
9555 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
9556 * @dev: pointer to net_device structure
9557 * @info: pointer to iw_request_info structure
9558 * @wrqu: pointer to iwreq_data
9559 * @extra; extra
9560 *
9561 * Return: 0 on success, error number otherwise
9562 *
9563 */
9564static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
9565 struct iw_request_info *info,
9566 union iwreq_data *wrqu, char *extra)
9567{
9568 union iwreq_data u_priv_wrqu;
9569 int apps_args[MAX_VAR_ARGS] = {0};
9570 int ret, num_args;
9571
Mukul Sharma64a70e82015-11-02 20:05:09 +05309572 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009573 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +05309574 return -EPERM;
9575 }
9576
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009577 /* Helper function to get iwreq_data with compat handling. */
9578 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
9579 return -EINVAL;
9580
9581 if (NULL == u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009582 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009583 return -EINVAL;
9584 }
9585
9586 num_args = u_priv_wrqu.data.length;
9587 if (num_args > MAX_VAR_ARGS)
9588 num_args = MAX_VAR_ARGS;
9589
9590 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
9591 (sizeof(int)) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009592 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009593 return -EFAULT;
9594 }
9595
9596 cds_ssr_protect(__func__);
9597 ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
9598 (char *)&apps_args);
9599 cds_ssr_unprotect(__func__);
9600 return ret;
9601}
9602
9603/**
9604 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
9605 * @dev: device upon which the ioctl was received
9606 * @info: ioctl request information
9607 * @wrqu: ioctl request data
9608 * @extra: ioctl extra data
9609 *
9610 * This is a generic handler for private ioctls which take multiple
9611 * arguments. Note that this implementation is also somewhat unique
9612 * in that it is shared by both STA-mode and SAP-mode interfaces.
9613 *
9614 * Return: 0 on success, non-zero on error
9615 */
9616int iw_set_var_ints_getnone(struct net_device *dev,
9617 struct iw_request_info *info,
9618 union iwreq_data *wrqu, char *extra)
9619{
9620 int ret;
9621
9622 cds_ssr_protect(__func__);
9623 ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
9624 cds_ssr_unprotect(__func__);
9625 return ret;
9626}
9627
9628/**
9629 * iw_add_tspec - Add TSpec private ioctl handler
9630 * @dev: device upon which the ioctl was received
9631 * @info: ioctl request information
9632 * @wrqu: ioctl request data
9633 * @extra: ioctl extra data
9634 *
9635 * Return: 0 on success, non-zero on error
9636 */
9637static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
9638 union iwreq_data *wrqu, char *extra)
9639{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009640 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07009641 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009642 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
9643 int params[HDD_WLAN_WMM_PARAM_COUNT];
Abhishek Singh12be60f2017-08-11 13:52:42 +05309644 struct sme_qos_wmmtspecinfo tSpec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009645 uint32_t handle;
9646 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009647 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009648 int ret;
9649
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009650 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309651
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009652 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009653 ret = wlan_hdd_validate_context(hdd_ctx);
9654 if (0 != ret)
9655 return ret;
9656
Jeff Johnson441e1f72017-02-07 08:50:49 -08009657 ret = hdd_check_private_wext_control(hdd_ctx, info);
9658 if (0 != ret)
9659 return ret;
9660
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009661 /* make sure the application is sufficiently priviledged */
9662 /* note that the kernel will do this for "set" ioctls, but since */
9663 /* this ioctl wants to return status to user space it must be */
9664 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009665 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009666 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009667
9668 /* we must be associated in order to add a tspec */
Jeff Johnsond377dce2017-10-04 10:32:42 -07009669 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009670 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9671 return 0;
9672 }
9673 /* since we are defined to be a "get" ioctl, and since the number */
9674 /* of params exceeds the number of params that wireless extensions */
9675 /* will pass down in the iwreq_data, we must copy the "set" params. */
9676 /* We must handle the compat for iwreq_data in 32U/64K environment. */
9677
9678 /* helper function to get iwreq_data with compat handling. */
9679 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
9680 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9681 return 0;
9682 }
9683 /* make sure all params are correctly passed to function */
9684 if ((NULL == s_priv_data.pointer) ||
9685 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
9686 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9687 return 0;
9688 }
9689 /* from user space ourselves */
9690 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
9691 /* hmmm, can't get them */
9692 return -EIO;
9693 }
9694 /* clear the tspec */
9695 memset(&tSpec, 0, sizeof(tSpec));
9696
9697 /* validate the handle */
9698 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
9699 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
9700 /* that one is reserved */
9701 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9702 return 0;
9703 }
9704 /* validate the TID */
9705 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
9706 /* out of range */
9707 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9708 return 0;
9709 }
9710 tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
9711
9712 /* validate the direction */
9713 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
9714 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
9715 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
9716 break;
9717
9718 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
9719 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
9720 break;
9721
9722 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
9723 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
9724 break;
9725
9726 default:
9727 /* unknown */
9728 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9729 return 0;
9730 }
9731
9732 tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
9733
9734 /* validate the user priority */
9735 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
9736 /* out of range */
9737 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9738 return 0;
9739 }
9740 tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
9741 if (0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009742 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009743 return 0;
9744 }
9745
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009746 hdd_debug("TS_INFO PSB %d UP %d !!!",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009747 tSpec.ts_info.psb, tSpec.ts_info.up);
9748
9749 tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
9750 tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
9751 tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
9752 tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
9753 tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
9754 tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
9755 tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
9756 tSpec.surplus_bw_allowance =
9757 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
9758 tSpec.min_service_interval =
9759 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
9760 tSpec.max_service_interval =
9761 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
9762 tSpec.suspension_interval =
9763 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
9764 tSpec.inactivity_interval =
9765 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
9766
9767 tSpec.ts_info.burst_size_defn =
9768 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
9769
9770 /* validate the ts info ack policy */
9771 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
9772 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK:
9773 tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
9774 break;
9775
9776 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
9777 tSpec.ts_info.ack_policy =
9778 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
9779 break;
9780
9781 default:
9782 /* unknown */
9783 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9784 return 0;
9785 }
9786
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009787 *pStatus = hdd_wmm_addts(adapter, handle, &tSpec);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309788 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009789 return 0;
9790}
9791
9792static int iw_add_tspec(struct net_device *dev,
9793 struct iw_request_info *info,
9794 union iwreq_data *wrqu, char *extra)
9795{
9796 int ret;
9797
9798 cds_ssr_protect(__func__);
9799 ret = __iw_add_tspec(dev, info, wrqu, extra);
9800 cds_ssr_unprotect(__func__);
9801
9802 return ret;
9803}
9804
9805/**
9806 * iw_del_tspec - Delete TSpec private ioctl handler
9807 * @dev: device upon which the ioctl was received
9808 * @info: ioctl request information
9809 * @wrqu: ioctl request data
9810 * @extra: ioctl extra data
9811 *
9812 * Return: 0 on success, non-zero on error
9813 */
9814static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
9815 union iwreq_data *wrqu, char *extra)
9816{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009817 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009818 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009819 int *params = (int *)extra;
9820 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
9821 uint32_t handle;
9822 int ret;
9823
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009824 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309825
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009826 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009827 ret = wlan_hdd_validate_context(hdd_ctx);
9828 if (0 != ret)
9829 return ret;
9830
Jeff Johnson441e1f72017-02-07 08:50:49 -08009831 ret = hdd_check_private_wext_control(hdd_ctx, info);
9832 if (0 != ret)
9833 return ret;
9834
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009835 /* make sure the application is sufficiently priviledged */
9836 /* note that the kernel will do this for "set" ioctls, but since */
9837 /* this ioctl wants to return status to user space it must be */
9838 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009839 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009840 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009841
9842 /* although we are defined to be a "get" ioctl, the params we require */
9843 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
9844 /* is no need to copy the params from user space */
9845
9846 /* validate the handle */
9847 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
9848 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
9849 /* that one is reserved */
9850 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9851 return 0;
9852 }
9853
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009854 *pStatus = hdd_wmm_delts(adapter, handle);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309855 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009856 return 0;
9857}
9858
9859static int iw_del_tspec(struct net_device *dev,
9860 struct iw_request_info *info,
9861 union iwreq_data *wrqu, char *extra)
9862{
9863 int ret;
9864
9865 cds_ssr_protect(__func__);
9866 ret = __iw_del_tspec(dev, info, wrqu, extra);
9867 cds_ssr_unprotect(__func__);
9868
9869 return ret;
9870}
9871
9872/**
9873 * iw_get_tspec - Get TSpec private ioctl handler
9874 * @dev: device upon which the ioctl was received
9875 * @info: ioctl request information
9876 * @wrqu: ioctl request data
9877 * @extra: ioctl extra data
9878 *
9879 * Return: 0 on success, non-zero on error
9880 */
9881static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
9882 union iwreq_data *wrqu, char *extra)
9883{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009884 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009885 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009886 int *params = (int *)extra;
9887 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
9888 uint32_t handle;
9889 int ret;
9890
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009891 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309892
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009893 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009894 ret = wlan_hdd_validate_context(hdd_ctx);
9895 if (0 != ret)
9896 return ret;
9897
Jeff Johnson441e1f72017-02-07 08:50:49 -08009898 ret = hdd_check_private_wext_control(hdd_ctx, info);
9899 if (0 != ret)
9900 return ret;
9901
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009902 /* although we are defined to be a "get" ioctl, the params we require */
9903 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
9904 /* is no need to copy the params from user space */
9905
9906 /* validate the handle */
9907 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
9908 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
9909 /* that one is reserved */
9910 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
9911 return 0;
9912 }
9913
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009914 *pStatus = hdd_wmm_checkts(adapter, handle);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309915 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009916 return 0;
9917}
9918
9919static int iw_get_tspec(struct net_device *dev,
9920 struct iw_request_info *info,
9921 union iwreq_data *wrqu, char *extra)
9922{
9923 int ret;
9924
9925 cds_ssr_protect(__func__);
9926 ret = __iw_get_tspec(dev, info, wrqu, extra);
9927 cds_ssr_unprotect(__func__);
9928
9929 return ret;
9930}
9931
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009932/**
9933 * iw_set_fties - Set FT IEs private ioctl handler
9934 * @dev: device upon which the ioctl was received
9935 * @info: ioctl request information
9936 * @wrqu: ioctl request data
9937 * @extra: ioctl extra data
9938 *
9939 * Each time the supplicant has the auth_request or reassoc request
9940 * IEs ready they are pushed to the driver. The driver will in turn
9941 * use it to send out the auth req and reassoc req for 11r FT Assoc.
9942 *
9943 * Return: 0 on success, non-zero on error
9944 */
9945static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
9946 union iwreq_data *wrqu, char *extra)
9947{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009948 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07009949 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009950 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009951 int ret;
9952
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009953 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309954
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009955 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009956 ret = wlan_hdd_validate_context(hdd_ctx);
9957 if (0 != ret)
9958 return ret;
9959
Jeff Johnson441e1f72017-02-07 08:50:49 -08009960 ret = hdd_check_private_wext_control(hdd_ctx, info);
9961 if (0 != ret)
9962 return ret;
9963
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009964 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009965 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009966 return -EINVAL;
9967 }
9968 if (wrqu->data.pointer == NULL) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009969 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009970 return -EINVAL;
9971 }
9972 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsond377dce2017-10-04 10:32:42 -07009973 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009974 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009975 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009976 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009977 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009978 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009979
9980 /* Pass the received FT IEs to SME */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009981 sme_set_ft_ies(WLAN_HDD_GET_HAL_CTX(adapter), adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009982 extra, wrqu->data.length);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309983 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009984 return 0;
9985}
9986
9987static int iw_set_fties(struct net_device *dev,
9988 struct iw_request_info *info,
9989 union iwreq_data *wrqu, char *extra)
9990{
9991 int ret;
9992
9993 cds_ssr_protect(__func__);
9994 ret = __iw_set_fties(dev, info, wrqu, extra);
9995 cds_ssr_unprotect(__func__);
9996
9997 return ret;
9998}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009999
Dustin Brown0cbc7572016-12-16 13:54:40 -080010000/**
10001 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
10002 * @dev: device upon which the ioctl was received
10003 * @info: ioctl request information
10004 * @wrqu: ioctl request data
10005 * @extra: ioctl extra data
10006 *
Dustin Brown860566f2017-01-31 15:24:43 -080010007 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
10008 * time being to provide guidance in migrating to standard APIs.
10009 *
Dustin Brown0cbc7572016-12-16 13:54:40 -080010010 * Return: 0 on success, non-zero on error
10011 */
10012static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
10013 struct iw_request_info *info,
10014 union iwreq_data *wrqu,
10015 char *extra)
10016{
Dustin Brown860566f2017-01-31 15:24:43 -080010017 hdd_err("\n"
10018 "setMCBCFilter is obsolete. Use the following instead:\n"
10019 "Configure multicast filtering via the ‘ip’ command.\n"
10020 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
10021 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
10022 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
10023 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
10024 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -070010025 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -080010026}
10027
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010028/**
10029 * iw_set_host_offload - Set host offload ioctl handler
10030 * @dev: device upon which the ioctl was received
10031 * @info: ioctl request information
10032 * @wrqu: ioctl request data
10033 * @extra: ioctl extra data
10034 *
10035 * Return: 0 on success, non-zero on error
10036 */
10037static int __iw_set_host_offload(struct net_device *dev,
10038 struct iw_request_info *info,
10039 union iwreq_data *wrqu, char *extra)
10040{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010041 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Srinivas Girigowda077143e2017-03-25 10:47:27 -070010042 struct host_offload_req *pRequest = (struct host_offload_req *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010043 tSirHostOffloadReq offloadRequest;
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010044 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010045 int ret;
10046
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010047 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010048
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010049 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010050 ret = wlan_hdd_validate_context(hdd_ctx);
10051 if (0 != ret)
10052 return ret;
10053
Jeff Johnson441e1f72017-02-07 08:50:49 -080010054 ret = hdd_check_private_wext_control(hdd_ctx, info);
10055 if (0 != ret)
10056 return ret;
10057
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010058 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010059 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010060 return -EINVAL;
10061 }
10062
10063 /* Debug display of request components. */
10064 switch (pRequest->offloadType) {
10065 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010066 hdd_debug("Host offload request: ARP reply");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010067 switch (pRequest->enableOrDisable) {
10068 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010069 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010070 break;
10071 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010072 hdd_debug(" BC Filtering enable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010073 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010074 hdd_debug(" ARP offload enable");
10075 hdd_debug(" IP address: %d.%d.%d.%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010076 pRequest->params.hostIpv4Addr[0],
10077 pRequest->params.hostIpv4Addr[1],
10078 pRequest->params.hostIpv4Addr[2],
10079 pRequest->params.hostIpv4Addr[3]);
10080 }
10081 break;
10082
10083 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010084 hdd_debug("Host offload request: neighbor discovery");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010085 switch (pRequest->enableOrDisable) {
10086 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010087 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010088 break;
10089 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010090 hdd_debug(" enable");
10091 hdd_debug(" IP address: %x:%x:%x:%x:%x:%x:%x:%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010092 *(uint16_t *) (pRequest->params.hostIpv6Addr),
10093 *(uint16_t *) (pRequest->params.hostIpv6Addr +
10094 2),
10095 *(uint16_t *) (pRequest->params.hostIpv6Addr +
10096 4),
10097 *(uint16_t *) (pRequest->params.hostIpv6Addr +
10098 6),
10099 *(uint16_t *) (pRequest->params.hostIpv6Addr +
10100 8),
10101 *(uint16_t *) (pRequest->params.hostIpv6Addr +
10102 10),
10103 *(uint16_t *) (pRequest->params.hostIpv6Addr +
10104 12),
10105 *(uint16_t *) (pRequest->params.hostIpv6Addr +
10106 14));
10107 }
10108 }
10109
10110 /* Execute offload request. The reason that we can copy the
10111 * request information from the ioctl structure to the SME
10112 * structure is that they are laid out exactly the same.
10113 * Otherwise, each piece of information would have to be
10114 * copied individually.
10115 */
10116 memcpy(&offloadRequest, pRequest, wrqu->data.length);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053010117 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010118 sme_set_host_offload(WLAN_HDD_GET_HAL_CTX(adapter),
10119 adapter->sessionId, &offloadRequest)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010120 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010121 return -EINVAL;
10122 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010123 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010124 return 0;
10125}
10126
10127static int iw_set_host_offload(struct net_device *dev,
10128 struct iw_request_info *info,
10129 union iwreq_data *wrqu, char *extra)
10130{
10131 int ret;
10132
10133 cds_ssr_protect(__func__);
10134 ret = __iw_set_host_offload(dev, info, wrqu, extra);
10135 cds_ssr_unprotect(__func__);
10136
10137 return ret;
10138}
10139
10140/**
10141 * iw_set_keepalive_params - Set keepalive params ioctl handler
10142 * @dev: device upon which the ioctl was received
10143 * @info: ioctl request information
10144 * @wrqu: ioctl request data
10145 * @extra: ioctl extra data
10146 *
10147 * Return: 0 on success, non-zero on error
10148 */
10149static int __iw_set_keepalive_params(struct net_device *dev,
10150 struct iw_request_info *info,
10151 union iwreq_data *wrqu, char *extra)
10152{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010153 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080010154 tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010155 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010156 int ret;
10157
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010158 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010159
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010160 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010161 ret = wlan_hdd_validate_context(hdd_ctx);
10162 if (0 != ret)
10163 return ret;
10164
Jeff Johnson441e1f72017-02-07 08:50:49 -080010165 ret = hdd_check_private_wext_control(hdd_ctx, info);
10166 if (0 != ret)
10167 return ret;
10168
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080010169 if (wrqu->data.length != sizeof(*request)) {
10170 hdd_err("Invalid length %d", wrqu->data.length);
10171 return -EINVAL;
10172 }
10173
10174 if (request->timePeriod > WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX) {
10175 hdd_err("Value of timePeriod %d exceed Max limit %d",
10176 request->timePeriod,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010177 WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX);
10178 return -EINVAL;
10179 }
10180
10181 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010182 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080010183 request->timePeriod, sizeof(tSirKeepAliveReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010184
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080010185 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010186 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010187 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010188 break;
10189
10190 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010191 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010192
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010193 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080010194 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
10195 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010196
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010197 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080010198 request->destIpv4Addr[0], request->destIpv4Addr[1],
10199 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010200
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010201 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -080010202 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010203 break;
10204 }
10205
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010206 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010207
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053010208 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010209 sme_set_keep_alive(WLAN_HDD_GET_HAL_CTX(adapter),
10210 adapter->sessionId, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080010211 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010212 return -EINVAL;
10213 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010214 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010215 return 0;
10216}
10217
10218static int iw_set_keepalive_params(struct net_device *dev,
10219 struct iw_request_info *info,
10220 union iwreq_data *wrqu,
10221 char *extra)
10222{
10223 int ret;
10224
10225 cds_ssr_protect(__func__);
10226 ret = __iw_set_keepalive_params(dev, info, wrqu, extra);
10227 cds_ssr_unprotect(__func__);
10228
10229 return ret;
10230}
10231
10232#ifdef WLAN_FEATURE_PACKET_FILTERING
10233/**
10234 * wlan_hdd_set_filter() - Set packet filter
10235 * @hdd_ctx: Global HDD context
10236 * @request: Packet filter request struct
10237 * @sessionId: Target session for the request
10238 *
10239 * Return: 0 on success, non-zero on error
10240 */
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +053010241int wlan_hdd_set_filter(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010242 struct pkt_filter_cfg *request,
10243 uint8_t sessionId)
10244{
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010245 struct pmo_rcv_pkt_fltr_cfg *pmo_set_pkt_fltr_req = NULL;
10246 struct pmo_rcv_pkt_fltr_clear_param *pmo_clr_pkt_fltr_param = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010247 int i = 0;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010248 QDF_STATUS status = QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010249
10250 if (hdd_ctx->config->disablePacketFilter) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010251 hdd_warn("Packet filtering disabled in ini");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010252 return 0;
10253 }
10254
10255 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010256 hdd_debug("Packet Filter Request : FA %d params %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010257 request->filter_action, request->num_params);
10258
10259 switch (request->filter_action) {
10260 case HDD_RCV_FILTER_SET:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010261 hdd_debug("Set Packet Filter Request for Id: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010262 request->filter_id);
10263
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010264 pmo_set_pkt_fltr_req =
10265 qdf_mem_malloc(sizeof(*pmo_set_pkt_fltr_req));
10266 if (!pmo_set_pkt_fltr_req) {
Mukul Sharmad75a6672017-06-22 15:40:53 +053010267 hdd_err("unable to allocate pmo_set_pkt_fltr_req");
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010268 return QDF_STATUS_E_NOMEM;
10269 }
10270
10271 pmo_set_pkt_fltr_req->filter_id = request->filter_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010272 if (request->num_params >= HDD_MAX_CMP_PER_PACKET_FILTER) {
10273 hdd_err("Number of Params exceed Max limit %d",
10274 request->num_params);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010275 status = QDF_STATUS_E_INVAL;
10276 goto out;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010277 }
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010278 pmo_set_pkt_fltr_req->num_params = request->num_params;
10279 pmo_set_pkt_fltr_req->coalesce_time = 0;
Srinivas Girigowdabbbecad2017-06-28 16:01:48 -070010280 pmo_set_pkt_fltr_req->filter_type = PMO_RCV_FILTER_TYPE_FILTER_PKT;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010281 for (i = 0; i < request->num_params; i++) {
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010282 pmo_set_pkt_fltr_req->params_data[i].protocol_layer =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010283 request->params_data[i].protocol_layer;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010284 pmo_set_pkt_fltr_req->params_data[i].compare_flag =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010285 request->params_data[i].compare_flag;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010286 pmo_set_pkt_fltr_req->params_data[i].data_offset =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010287 request->params_data[i].data_offset;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010288 pmo_set_pkt_fltr_req->params_data[i].data_length =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010289 request->params_data[i].data_length;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010290 pmo_set_pkt_fltr_req->params_data[i].reserved = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010291
Dustin Brown4d1e8462016-12-14 12:12:24 -080010292 if (request->params_data[i].data_offset >
10293 SIR_MAX_FILTER_TEST_DATA_OFFSET) {
10294 hdd_err("Invalid data offset %u for param %d (max = %d)",
10295 request->params_data[i].data_offset,
10296 i,
10297 SIR_MAX_FILTER_TEST_DATA_OFFSET);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010298 status = QDF_STATUS_E_INVAL;
10299 goto out;
Dustin Brown4d1e8462016-12-14 12:12:24 -080010300 }
10301
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010302 if (request->params_data[i].data_length >
10303 SIR_MAX_FILTER_TEST_DATA_LEN) {
10304 hdd_err("Error invalid data length %d",
10305 request->params_data[i].data_length);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010306 status = QDF_STATUS_E_INVAL;
10307 goto out;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010308 }
10309
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010310 hdd_debug("Proto %d Comp Flag %d Filter Type %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010311 request->params_data[i].protocol_layer,
10312 request->params_data[i].compare_flag,
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010313 pmo_set_pkt_fltr_req->filter_type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010314
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010315 hdd_debug("Data Offset %d Data Len %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010316 request->params_data[i].data_offset,
10317 request->params_data[i].data_length);
10318
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010319 if (sizeof(
10320 pmo_set_pkt_fltr_req->params_data[i].compare_data)
Rajeev Kumarf5b6da22016-04-15 13:24:03 -070010321 < (request->params_data[i].data_length)) {
10322 hdd_err("Error invalid data length %d",
10323 request->params_data[i].data_length);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010324 status = QDF_STATUS_E_INVAL;
10325 goto out;
Rajeev Kumarf5b6da22016-04-15 13:24:03 -070010326 }
10327
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010328 memcpy(
10329 &pmo_set_pkt_fltr_req->params_data[i].compare_data,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010330 request->params_data[i].compare_data,
10331 request->params_data[i].data_length);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010332 memcpy(&pmo_set_pkt_fltr_req->params_data[i].data_mask,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010333 request->params_data[i].data_mask,
10334 request->params_data[i].data_length);
10335
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010336 hdd_debug("CData %d CData %d CData %d CData %d CData %d CData %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010337 request->params_data[i].compare_data[0],
10338 request->params_data[i].compare_data[1],
10339 request->params_data[i].compare_data[2],
10340 request->params_data[i].compare_data[3],
10341 request->params_data[i].compare_data[4],
10342 request->params_data[i].compare_data[5]);
10343
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010344 hdd_debug("MData %d MData %d MData %d MData %d MData %d MData %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010345 request->params_data[i].data_mask[0],
10346 request->params_data[i].data_mask[1],
10347 request->params_data[i].data_mask[2],
10348 request->params_data[i].data_mask[3],
10349 request->params_data[i].data_mask[4],
10350 request->params_data[i].data_mask[5]);
10351 }
10352
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053010353 if (QDF_STATUS_SUCCESS !=
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010354 pmo_ucfg_set_pkt_filter(hdd_ctx->hdd_psoc,
10355 pmo_set_pkt_fltr_req,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010356 sessionId)) {
10357 hdd_err("Failure to execute Set Filter");
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010358 status = QDF_STATUS_E_INVAL;
10359 goto out;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010360 }
10361
10362 break;
10363
10364 case HDD_RCV_FILTER_CLEAR:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010365 hdd_debug("Clear Packet Filter Request for Id: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010366 request->filter_id);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010367
10368 pmo_clr_pkt_fltr_param = qdf_mem_malloc(
10369 sizeof(*pmo_clr_pkt_fltr_param));
10370 if (!pmo_clr_pkt_fltr_param) {
10371 hdd_err("unable to allocate pmo_clr_pkt_fltr_param");
10372 return QDF_STATUS_E_NOMEM;
10373 }
10374
10375 pmo_clr_pkt_fltr_param->filter_id = request->filter_id;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053010376 if (QDF_STATUS_SUCCESS !=
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010377 pmo_ucfg_clear_pkt_filter(hdd_ctx->hdd_psoc,
10378 pmo_clr_pkt_fltr_param,
10379 sessionId)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010380 hdd_err("Failure to execute Clear Filter");
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010381 status = QDF_STATUS_E_INVAL;
10382 goto out;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010383 }
10384 break;
10385
10386 default:
10387 hdd_err("Packet Filter Request: Invalid %d",
10388 request->filter_action);
10389 return -EINVAL;
10390 }
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053010391
10392out:
10393 if (pmo_set_pkt_fltr_req)
10394 qdf_mem_free(pmo_set_pkt_fltr_req);
10395 if (pmo_clr_pkt_fltr_param)
10396 qdf_mem_free(pmo_clr_pkt_fltr_param);
10397
10398 return status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010399}
10400
10401/**
10402 * __iw_set_packet_filter_params() - set packet filter parameters in target
10403 * @dev: Pointer to netdev
10404 * @info: Pointer to iw request info
10405 * @wrqu: Pointer to data
10406 * @extra: Pointer to extra data
10407 *
10408 * Return: 0 on success, non-zero on error
10409 */
10410static int __iw_set_packet_filter_params(struct net_device *dev,
10411 struct iw_request_info *info,
10412 union iwreq_data *wrqu, char *extra)
10413{
10414 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010415 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010416 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -070010417 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010418 struct pkt_filter_cfg *request = NULL;
10419
Mukul Sharma472382f2015-11-02 20:16:31 +053010420 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010421 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +053010422 return -EPERM;
10423 }
10424
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010425 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010426
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010427 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
10428 ret = wlan_hdd_validate_context(hdd_ctx);
10429 if (0 != ret)
10430 return ret;
10431
Jeff Johnson441e1f72017-02-07 08:50:49 -080010432 ret = hdd_check_private_wext_control(hdd_ctx, info);
10433 if (0 != ret)
10434 return ret;
10435
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010436 if (hdd_priv_get_data(&priv_data, wrqu)) {
10437 hdd_err("failed to get priv data");
10438 return -EINVAL;
10439 }
10440
10441 if ((NULL == priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -070010442 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010443 priv_data.pointer, priv_data.length);
10444 return -EINVAL;
10445 }
10446
Arun Khandavalli75d246b2017-08-07 19:46:06 +053010447 if (adapter->device_mode != QDF_STA_MODE) {
10448 hdd_err("Packet filter not supported for this mode :%d",
10449 adapter->device_mode);
10450 return -ENOTSUPP;
10451 }
10452
Mukul Sharmabe846bb2017-05-09 17:41:52 +053010453 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
10454 hdd_err("Packet filter not supported in disconnected state");
10455 return -ENOTSUPP;
10456 }
10457
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010458 /* copy data using copy_from_user */
10459 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
10460 priv_data.length);
10461 if (NULL == request) {
10462 hdd_err("mem_alloc_copy_from_user_helper fail");
10463 return -ENOMEM;
10464 }
10465
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +053010466 if (request->filter_action == HDD_RCV_FILTER_SET)
10467 hdd_ctx->user_configured_pkt_filter_rules |=
10468 1 << request->filter_id;
10469 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
10470 hdd_ctx->user_configured_pkt_filter_rules &=
10471 ~(1 << request->filter_id);
10472
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010473 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->sessionId);
10474
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -070010475 qdf_mem_free(request);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010476 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010477 return ret;
10478}
10479
10480/**
10481 * iw_set_packet_filter_params() - set packet filter parameters in target
10482 * @dev: Pointer to netdev
10483 * @info: Pointer to iw request info
10484 * @wrqu: Pointer to data
10485 * @extra: Pointer to extra data
10486 *
10487 * Return: 0 on success, non-zero on error
10488 */
10489static int iw_set_packet_filter_params(struct net_device *dev,
10490 struct iw_request_info *info,
10491 union iwreq_data *wrqu, char *extra)
10492{
10493 int ret;
10494
10495 cds_ssr_protect(__func__);
10496 ret = __iw_set_packet_filter_params(dev, info, wrqu, extra);
10497 cds_ssr_unprotect(__func__);
10498
10499 return ret;
10500}
10501#endif
10502
10503
10504static int __iw_get_statistics(struct net_device *dev,
10505 struct iw_request_info *info,
10506 union iwreq_data *wrqu, char *extra)
10507{
10508
Anurag Chouhance0dc992016-02-16 18:18:03 +053010509 QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053010510 QDF_STATUS status = QDF_STATUS_SUCCESS;
Jeff Johnson2a722002017-09-30 20:02:35 -070010511 struct hdd_wext_state *pWextState;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010512 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
10513 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010514 char *p = extra;
10515 int tlen = 0;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010516 tCsrSummaryStatsInfo *pStats = &(adapter->hdd_stats.summary_stat);
10517 tCsrGlobalClassAStatsInfo *aStats = &(adapter->hdd_stats.ClassA_stat);
10518 tCsrGlobalClassDStatsInfo *dStats = &(adapter->hdd_stats.ClassD_stat);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010519 int ret;
10520
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010521 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010522
10523 ret = wlan_hdd_validate_context(hdd_ctx);
10524 if (0 != ret)
10525 return ret;
10526
Jeff Johnson441e1f72017-02-07 08:50:49 -080010527 ret = hdd_check_private_wext_control(hdd_ctx, info);
10528 if (0 != ret)
10529 return ret;
10530
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010531 if (eConnectionState_Associated !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010532 (WLAN_HDD_GET_STATION_CTX_PTR(adapter))->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010533
10534 wrqu->txpower.value = 0;
10535 } else {
10536 status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD,
10537 SME_SUMMARY_STATS |
10538 SME_GLOBAL_CLASSA_STATS |
Jeff Johnsondfe89512017-03-10 15:50:00 -080010539 SME_GLOBAL_CLASSD_STATS,
Naveen Rawatd0ca4412017-06-16 14:19:19 -070010540 hdd_statistics_cb,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010541 (WLAN_HDD_GET_STATION_CTX_PTR
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010542 (adapter))->conn_info.staId[0],
10543 adapter, adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010544
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053010545 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010546 hdd_err("Unable to retrieve SME statistics");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010547 return -EINVAL;
10548 }
10549
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010550 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010551
Anurag Chouhance0dc992016-02-16 18:18:03 +053010552 qdf_status =
Anurag Chouhanf04e84f2016-03-03 10:12:12 +053010553 qdf_wait_single_event(&pWextState->hdd_qdf_event,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010554 WLAN_WAIT_TIME_STATS);
Anurag Chouhance0dc992016-02-16 18:18:03 +053010555 if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010556 hdd_err("SME timeout while retrieving statistics");
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070010557 /* Remove the SME statistics list by
10558 * passing NULL in callback argument
10559 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010560 status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD,
10561 SME_SUMMARY_STATS |
10562 SME_GLOBAL_CLASSA_STATS |
Jeff Johnsondfe89512017-03-10 15:50:00 -080010563 SME_GLOBAL_CLASSD_STATS,
Naveen Rawatd0ca4412017-06-16 14:19:19 -070010564 NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010565 (WLAN_HDD_GET_STATION_CTX_PTR
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010566 (adapter))->conn_info.
10567 staId[0], adapter,
10568 adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010569
10570 return -EINVAL;
10571 }
10572 FILL_TLV(p, (uint8_t) WLAN_STATS_RETRY_CNT,
10573 (uint8_t) sizeof(pStats->retry_cnt),
10574 (char *)&(pStats->retry_cnt[0]), tlen);
10575
10576 FILL_TLV(p, (uint8_t) WLAN_STATS_MUL_RETRY_CNT,
10577 (uint8_t) sizeof(pStats->multiple_retry_cnt),
10578 (char *)&(pStats->multiple_retry_cnt[0]), tlen);
10579
10580 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_FRM_CNT,
10581 (uint8_t) sizeof(pStats->tx_frm_cnt),
10582 (char *)&(pStats->tx_frm_cnt[0]), tlen);
10583
10584 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_FRM_CNT,
10585 (uint8_t) sizeof(pStats->rx_frm_cnt),
10586 (char *)&(pStats->rx_frm_cnt), tlen);
10587
10588 FILL_TLV(p, (uint8_t) WLAN_STATS_FRM_DUP_CNT,
10589 (uint8_t) sizeof(pStats->frm_dup_cnt),
10590 (char *)&(pStats->frm_dup_cnt), tlen);
10591
10592 FILL_TLV(p, (uint8_t) WLAN_STATS_FAIL_CNT,
10593 (uint8_t) sizeof(pStats->fail_cnt),
10594 (char *)&(pStats->fail_cnt[0]), tlen);
10595
10596 FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_FAIL_CNT,
10597 (uint8_t) sizeof(pStats->rts_fail_cnt),
10598 (char *)&(pStats->rts_fail_cnt), tlen);
10599
10600 FILL_TLV(p, (uint8_t) WLAN_STATS_ACK_FAIL_CNT,
10601 (uint8_t) sizeof(pStats->ack_fail_cnt),
10602 (char *)&(pStats->ack_fail_cnt), tlen);
10603
10604 FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_SUC_CNT,
10605 (uint8_t) sizeof(pStats->rts_succ_cnt),
10606 (char *)&(pStats->rts_succ_cnt), tlen);
10607
10608 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_DISCARD_CNT,
10609 (uint8_t) sizeof(pStats->rx_discard_cnt),
10610 (char *)&(pStats->rx_discard_cnt), tlen);
10611
10612 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_ERROR_CNT,
10613 (uint8_t) sizeof(pStats->rx_error_cnt),
10614 (char *)&(pStats->rx_error_cnt), tlen);
10615
10616 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BYTE_CNT,
10617 (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]),
10618 (char *)&(dStats->tx_uc_byte_cnt[0]), tlen);
10619
10620 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BYTE_CNT,
10621 (uint8_t) sizeof(dStats->rx_byte_cnt),
10622 (char *)&(dStats->rx_byte_cnt), tlen);
10623
10624 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_RATE,
10625 (uint8_t) sizeof(dStats->rx_rate),
10626 (char *)&(dStats->rx_rate), tlen);
10627
10628 /* Transmit rate, in units of 500 kbit/sec */
10629 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_RATE,
10630 (uint8_t) sizeof(aStats->tx_rate),
10631 (char *)&(aStats->tx_rate), tlen);
10632
10633 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_UC_BYTE_CNT,
10634 (uint8_t) sizeof(dStats->rx_uc_byte_cnt[0]),
10635 (char *)&(dStats->rx_uc_byte_cnt[0]), tlen);
10636 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_MC_BYTE_CNT,
10637 (uint8_t) sizeof(dStats->rx_mc_byte_cnt),
10638 (char *)&(dStats->rx_mc_byte_cnt), tlen);
10639 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BC_BYTE_CNT,
10640 (uint8_t) sizeof(dStats->rx_bc_byte_cnt),
10641 (char *)&(dStats->rx_bc_byte_cnt), tlen);
10642 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_UC_BYTE_CNT,
10643 (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]),
10644 (char *)&(dStats->tx_uc_byte_cnt[0]), tlen);
10645 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_MC_BYTE_CNT,
10646 (uint8_t) sizeof(dStats->tx_mc_byte_cnt),
10647 (char *)&(dStats->tx_mc_byte_cnt), tlen);
10648 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BC_BYTE_CNT,
10649 (uint8_t) sizeof(dStats->tx_bc_byte_cnt),
10650 (char *)&(dStats->tx_bc_byte_cnt), tlen);
10651
10652 wrqu->data.length = tlen;
10653
10654 }
10655
10656 EXIT();
10657
10658 return 0;
10659}
10660
10661static int iw_get_statistics(struct net_device *dev,
10662 struct iw_request_info *info,
10663 union iwreq_data *wrqu, char *extra)
10664{
10665 int ret;
10666
10667 cds_ssr_protect(__func__);
10668 ret = __iw_get_statistics(dev, info, wrqu, extra);
10669 cds_ssr_unprotect(__func__);
10670
10671 return ret;
10672}
10673
10674#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010675/*Max Len for PNO notification*/
10676#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +053010677static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
10678 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010679{
Abhishek Singh0481d662017-04-11 18:20:11 +053010680 struct vdev_osif_priv *osif_priv;
10681 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010682 union iwreq_data wrqu;
10683 char buf[MAX_PNO_NOTIFY_LEN + 1];
10684
Abhishek Singh0481d662017-04-11 18:20:11 +053010685 wlan_vdev_obj_lock(vdev);
10686 osif_priv = wlan_vdev_get_ospriv(vdev);
10687 wlan_vdev_obj_unlock(vdev);
10688 if (!osif_priv) {
10689 hdd_err("osif_priv is null");
10690 return;
10691 }
10692
10693 wdev = osif_priv->wdev;
10694 if (!wdev) {
10695 hdd_err("wdev is null");
10696 return;
10697 }
10698
10699 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010700
10701 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +053010702 qdf_mem_zero(&wrqu, sizeof(wrqu));
10703 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010704
10705 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +053010706 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010707
10708 wrqu.data.pointer = buf;
10709 wrqu.data.length = strlen(buf);
10710
10711 /* send the event */
10712
Abhishek Singh0481d662017-04-11 18:20:11 +053010713 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010714}
10715
10716/**
10717 * __iw_set_pno() - Preferred Network Offload ioctl handler
10718 * @dev: device upon which the ioctl was received
10719 * @info: ioctl request information
10720 * @wrqu: ioctl request data
10721 * @extra: ioctl extra data
10722 *
10723 * This function parses a Preferred Network Offload command
10724 * Input is string based and expected to be of the form:
10725 *
10726 * <enable(1) | disable(0)>
10727 * when enabling:
10728 * <number of networks>
10729 * for each network:
10730 * <ssid_len> <ssid> <authentication> <encryption>
10731 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -070010732 * <scan_time (seconds)>
10733 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010734 * <suspend mode>
10735 *
10736 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -070010737 * 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 -080010738 *
10739 * this translates into:
10740 * -----------------------------
10741 * enable PNO
10742 * 2 networks
10743 * Network 1:
10744 * test - with authentication type 0 and encryption type 0,
10745 * search on 3 channels: 1 6 and 11,
10746 * SSID bcast type is unknown (directed probe will be sent if
10747 * AP not found) and must meet -40dBm RSSI
10748 * Network 2:
10749 * test2 - with authentication type 4 and encryption type 4,
10750 * search on 6 channels 1, 2, 3, 4, 5 and 6
10751 * bcast type is non-bcast (directed probe will be sent)
10752 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010753 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -070010754 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010755 */
10756static int __iw_set_pno(struct net_device *dev,
10757 struct iw_request_info *info,
10758 union iwreq_data *wrqu, char *extra)
10759{
Jeff Johnson3d278b02017-08-29 14:17:47 -070010760 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010761 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +053010762 uint8_t value;
10763 struct wlan_objmgr_vdev *vdev;
10764 struct wlan_objmgr_psoc *psoc;
10765 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010766 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010767 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +053010768 uint8_t i, j, params;
10769 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010770 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010771
10772 /* request is a large struct, so we make it static to avoid
10773 * stack overflow. This API is only invoked via ioctl, so it
10774 * is serialized by the kernel rtnl_lock and hence does not
10775 * need to be reentrant
10776 */
Abhishek Singh0481d662017-04-11 18:20:11 +053010777 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010778
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010779 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010780
10781 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
10782 ret = wlan_hdd_validate_context(hdd_ctx);
10783 if (ret)
10784 return ret;
10785
Jeff Johnson441e1f72017-02-07 08:50:49 -080010786 ret = hdd_check_private_wext_control(hdd_ctx, info);
10787 if (0 != ret)
10788 return ret;
10789
Abhishek Singh0481d662017-04-11 18:20:11 +053010790 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->hdd_pdev,
10791 dev->dev_addr, WLAN_LEGACY_MAC_ID);
10792 if (!vdev) {
10793 hdd_err("vdev object is NULL");
10794 return -EIO;
10795 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010796
Abhishek Singh0481d662017-04-11 18:20:11 +053010797 hdd_debug("PNO data len %d data %s", wrqu->data.length, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010798
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010799 /* making sure argument string ends with '\0' */
10800 len = (wrqu->data.length + 1);
10801 data = qdf_mem_malloc(len);
10802 if (!data) {
10803 hdd_err("fail to allocate memory %zu", len);
10804 return -EINVAL;
10805 }
10806 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010807 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010808
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010809 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010810 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053010811 ret = -EINVAL;
10812 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010813 }
10814
Abhishek Singh0481d662017-04-11 18:20:11 +053010815 if (!value) {
10816 status = ucfg_scan_pno_stop(vdev);
10817 if (QDF_IS_STATUS_ERROR(status)) {
10818 hdd_err("Failed to disabled PNO");
10819 ret = -EINVAL;
10820 } else {
10821 hdd_debug("PNO scan disabled");
10822 }
10823 goto exit;
10824 }
10825
10826 if (ucfg_scan_get_pno_in_progress(vdev)) {
10827 hdd_debug("pno is already in progress");
10828 ret = -EBUSY;
10829 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010830 }
10831
10832 ptr += offset;
10833
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010834 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010835 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053010836 ret = -EINVAL;
10837 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010838 }
Abhishek Singh0481d662017-04-11 18:20:11 +053010839 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010840
Abhishek Singh0481d662017-04-11 18:20:11 +053010841 hdd_debug("PNO enable networks count %d offset %d",
10842 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010843
Abhishek Singh0481d662017-04-11 18:20:11 +053010844 if ((0 == req.networks_cnt) ||
10845 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010846 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +053010847 req.networks_cnt);
10848 ret = -EINVAL;
10849 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010850 }
10851
10852 ptr += offset;
10853
Abhishek Singh0481d662017-04-11 18:20:11 +053010854 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010855
Abhishek Singh0481d662017-04-11 18:20:11 +053010856 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010857
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010858 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +053010859 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010860 &offset);
10861
10862 if (1 != params) {
10863 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053010864 ret = -EINVAL;
10865 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010866 }
10867
Abhishek Singh0481d662017-04-11 18:20:11 +053010868 if ((0 == req.networks_list[i].ssid.length) ||
10869 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010870 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +053010871 req.networks_list[i].ssid.length, i);
10872 ret = -EINVAL;
10873 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010874 }
10875
10876 /* Advance to SSID */
10877 ptr += offset;
10878
Abhishek Singh0481d662017-04-11 18:20:11 +053010879 memcpy(req.networks_list[i].ssid.ssid, ptr,
10880 req.networks_list[i].ssid.length);
10881 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010882
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010883 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +053010884 &(req.networks_list[i].authentication),
10885 &(req.networks_list[i].encryption),
10886 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010887 &offset);
10888
10889 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010890 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053010891 ret = -EINVAL;
10892 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010893 }
10894
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010895 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +053010896 req.networks_list[i].ssid.length,
10897 req.networks_list[i].ssid.length,
10898 req.networks_list[i].ssid.ssid,
10899 req.networks_list[i].authentication,
10900 req.networks_list[i].encryption,
10901 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010902
10903 /* Advance to channel list */
10904 ptr += offset;
10905
Abhishek Singh0481d662017-04-11 18:20:11 +053010906 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
10907 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010908 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +053010909 ret = -EINVAL;
10910 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010911 }
10912
Abhishek Singh0481d662017-04-11 18:20:11 +053010913 if (0 != req.networks_list[i].channel_cnt) {
10914 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010915 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010916 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +053010917 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070010918 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010919 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053010920 ret = -EINVAL;
10921 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010922 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010923 if (!IS_CHANNEL_VALID(value)) {
10924 hdd_err("invalid channel: %hhu", value);
10925 ret = -EINVAL;
10926 goto exit;
10927 }
Abhishek Singh0481d662017-04-11 18:20:11 +053010928 req.networks_list[i].channels[j] =
10929 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010930 /* Advance to next channel number */
10931 ptr += offset;
10932 }
10933 }
10934
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010935 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +053010936 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010937 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070010938 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010939 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053010940 ret = -EINVAL;
10941 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010942 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010943 if (req.networks_list[i].bc_new_type > 2) {
10944 hdd_err("invalid bcast nw type: %u",
10945 req.networks_list[i].bc_new_type);
10946 ret = -EINVAL;
10947 goto exit;
10948 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010949
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010950 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +053010951 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010952
10953 /* Advance to rssi Threshold */
10954 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010955 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +053010956 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010957 &offset)) {
10958 hdd_err("PNO rssi threshold input is not valid %s",
10959 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053010960 ret = -EINVAL;
10961 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010962 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010963 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +053010964 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010965 /* Advance to next network */
10966 ptr += offset;
10967 } /* For ucNetworkCount */
10968
Abhishek Singh0481d662017-04-11 18:20:11 +053010969 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010970 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +053010971 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -070010972 ptr += offset;
10973 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010974 if (req.fast_scan_period == 0) {
10975 hdd_err("invalid fast scan period %u",
10976 req.fast_scan_period);
10977 ret = -EINVAL;
10978 goto exit;
10979 }
Dustin Brown43e87292016-10-10 10:38:25 -070010980
Abhishek Singh0481d662017-04-11 18:20:11 +053010981 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053010982 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -070010983 &offset) > 0)
10984 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +053010985 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -070010986
Abhishek Singh0481d662017-04-11 18:20:11 +053010987 wlan_pdev_obj_lock(hdd_ctx->hdd_pdev);
10988 psoc = wlan_pdev_get_psoc(hdd_ctx->hdd_pdev);
10989 wlan_pdev_obj_unlock(hdd_ctx->hdd_pdev);
10990 ucfg_scan_register_pno_cb(psoc,
10991 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010992
Abhishek Singh0481d662017-04-11 18:20:11 +053010993 ucfg_scan_get_pno_def_params(vdev, &req);
10994 status = ucfg_scan_pno_start(vdev, &req);
10995 if (QDF_IS_STATUS_ERROR(status)) {
10996 hdd_err("Failed to enable PNO");
10997 ret = -EINVAL;
10998 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010999
Abhishek Singh0481d662017-04-11 18:20:11 +053011000exit:
11001 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011002
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011003 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +053011004 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011005}
11006
11007static int iw_set_pno(struct net_device *dev,
11008 struct iw_request_info *info,
11009 union iwreq_data *wrqu, char *extra)
11010{
11011 int ret;
11012
11013 cds_ssr_protect(__func__);
11014 ret = __iw_set_pno(dev, info, wrqu, extra);
11015 cds_ssr_unprotect(__func__);
11016
11017 return ret;
11018}
11019#endif /* FEATURE_WLAN_SCAN_PNO */
11020
11021/* Common function to SetBand */
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011022int hdd_reg_set_band(struct net_device *dev, u8 ui_band)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011023{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011024 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
11025 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011026 enum band_info band;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011027
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053011028 QDF_STATUS status;
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011029 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011030 hdd_adapter_list_node_t *pAdapterNode, *pNext;
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011031 enum band_info currBand;
11032 enum band_info connectedBand;
11033 long lrc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011034
11035 pAdapterNode = NULL;
11036 pNext = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011037 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011038
11039 switch (ui_band) {
11040 case WLAN_HDD_UI_BAND_AUTO:
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011041 band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011042 break;
11043 case WLAN_HDD_UI_BAND_5_GHZ:
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011044 band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011045 break;
11046 case WLAN_HDD_UI_BAND_2_4_GHZ:
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011047 band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011048 break;
11049 default:
Jeff Johnson99bac312016-06-28 10:38:18 -070011050 hdd_err("Invalid band value %u", ui_band);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011051 return -EINVAL;
11052 }
11053
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011054 hdd_debug("change band to %u", band);
11055
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011056 if ((band == BAND_2G && hdd_ctx->config->nBandCapability == 2) ||
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +053011057 (band == BAND_5G && hdd_ctx->config->nBandCapability == 1) ||
11058 (band == BAND_ALL && hdd_ctx->config->nBandCapability != 0)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070011059 hdd_err("band value %u violate INI settings %u",
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011060 band, hdd_ctx->config->nBandCapability);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011061 return -EIO;
11062 }
11063
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011064 if (band == BAND_ALL) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011065 hdd_debug("Auto band received. Setting band same as ini value %d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011066 hdd_ctx->config->nBandCapability);
11067 band = hdd_ctx->config->nBandCapability;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011068 }
11069
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011070 if (QDF_STATUS_SUCCESS != ucfg_reg_get_curr_band(hdd_ctx->hdd_pdev,
Amar Singhal58b45ef2017-08-01 13:43:54 -070011071 &currBand)) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011072 hdd_debug("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011073 return -EIO;
11074 }
11075
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011076 if (currBand == band)
11077 return 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011078
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011079 hdd_ctx->curr_band = band;
Amar Singhal58b45ef2017-08-01 13:43:54 -070011080
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011081 /* Change band request received.
11082 * Abort pending scan requests, flush the existing scan results,
11083 * and change the band capability
11084 */
11085 hdd_debug("Current band value = %u, new setting %u ",
11086 currBand, band);
11087
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011088 status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011089 while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011090 adapter = pAdapterNode->adapter;
11091 hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011092 wlan_abort_scan(hdd_ctx->hdd_pdev, INVAL_PDEV_ID,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011093 adapter->sessionId, INVALID_SCAN_ID, false);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011094 connectedBand = hdd_conn_get_connected_band(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011095 WLAN_HDD_GET_STATION_CTX_PTR(adapter));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011096
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011097 /* Handling is done only for STA and P2P */
11098 if (band != BAND_ALL &&
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011099 ((adapter->device_mode == QDF_STA_MODE) ||
11100 (adapter->device_mode == QDF_P2P_CLIENT_MODE)) &&
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011101 (hdd_conn_is_connected(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011102 WLAN_HDD_GET_STATION_CTX_PTR(adapter)))
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011103 && (connectedBand != band)) {
11104 status = QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011105
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011106 /* STA already connected on current
11107 * band, So issue disconnect first,
11108 * then change the band
11109 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011110
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011111 hdd_debug("STA (Device mode %s(%d)) connected in band %u, Changing band to %u, Issuing Disconnect",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011112 hdd_device_mode_to_string(adapter->device_mode),
11113 adapter->device_mode, currBand, band);
11114 INIT_COMPLETION(adapter->disconnect_comp_var);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011115
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011116 status = sme_roam_disconnect(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011117 WLAN_HDD_GET_HAL_CTX(adapter),
11118 adapter->sessionId,
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011119 eCSR_DISCONNECT_REASON_UNSPECIFIED);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011120
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011121 if (QDF_STATUS_SUCCESS != status) {
11122 hdd_err("sme_roam_disconnect failure, status: %d",
Jeff Johnson99bac312016-06-28 10:38:18 -070011123 (int)status);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011124 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011125 }
11126
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011127 lrc = wait_for_completion_timeout(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011128 &adapter->disconnect_comp_var,
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011129 msecs_to_jiffies(
11130 WLAN_WAIT_TIME_DISCONNECT));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011131
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011132 if (lrc == 0) {
11133 hdd_err("Timeout while waiting for csr_roam_disconnect");
11134 return -ETIMEDOUT;
11135 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011136 }
11137
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011138 sme_scan_flush_result(hHal);
11139
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011140 status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011141 pAdapterNode = pNext;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011142 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011143
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011144 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011145 ucfg_reg_set_band(hdd_ctx->hdd_pdev, band)) {
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011146 hdd_err("Failed to set the band value to %u",
11147 band);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011148 return -EINVAL;
11149 }
11150
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011151 return 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011152}
11153
11154static int __iw_set_band_config(struct net_device *dev,
11155 struct iw_request_info *info,
11156 union iwreq_data *wrqu, char *extra)
11157{
Jeff Johnson3d278b02017-08-29 14:17:47 -070011158 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -070011159 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -080011160 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011161 int *value = (int *)extra;
11162
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080011163 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011164
Mukul Sharmaa5fe1982015-11-02 19:28:14 +053011165 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070011166 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +053011167 return -EPERM;
11168 }
11169
Jeff Johnson441e1f72017-02-07 08:50:49 -080011170 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
11171 ret = hdd_check_private_wext_control(hdd_ctx, info);
11172 if (0 != ret)
11173 return ret;
11174
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011175 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011176}
11177
11178static int iw_set_band_config(struct net_device *dev,
11179 struct iw_request_info *info,
11180 union iwreq_data *wrqu, char *extra)
11181{
11182 int ret;
11183
11184 cds_ssr_protect(__func__);
11185 ret = __iw_set_band_config(dev, info, wrqu, extra);
11186 cds_ssr_unprotect(__func__);
11187
11188 return ret;
11189}
11190
Arunk Khandavalli062fb032017-10-04 12:18:15 +053011191int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011192 uint32_t bandwidth)
11193{
Jeff Johnson6d38ab82017-08-28 11:36:27 -070011194 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson40dae4e2017-08-29 14:00:25 -070011195 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011196 struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info;
11197 QDF_STATUS status;
11198 tHalHandle hal_hdl = hdd_ctx->hHal;
11199 struct qdf_mac_addr bssid;
11200 tCsrRoamProfile roam_profile;
Amar Singhal5cccafe2017-02-15 12:42:58 -080011201 struct ch_params ch_params;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011202
11203 if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) {
11204 hdd_err("Not supported, device is not in monitor mode");
11205 return -EINVAL;
11206 }
11207
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011208 hdd_debug("Set monitor mode Channel %d", chan);
Hong Shie531d1f2016-11-14 14:08:03 +080011209 qdf_mem_zero(&roam_profile, sizeof(roam_profile));
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011210 roam_profile.ChannelInfo.ChannelList = &ch_info->channel;
11211 roam_profile.ChannelInfo.numOfChannels = 1;
11212 roam_profile.phyMode = ch_info->phy_mode;
11213 roam_profile.ch_params.ch_width = bandwidth;
Naveen Rawatc77e6e72016-08-05 15:19:03 -070011214 hdd_select_cbmode(adapter, chan, &roam_profile.ch_params);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011215
11216 qdf_mem_copy(bssid.bytes, adapter->macAddressCurrent.bytes,
11217 QDF_MAC_ADDR_SIZE);
11218
11219 ch_params.ch_width = bandwidth;
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -070011220 wlan_reg_set_channel_params(hdd_ctx->hdd_pdev, chan, 0, &ch_params);
Manjunathappa Prakashc4dc9382017-03-07 18:50:33 -080011221 if (ch_params.ch_width == CH_WIDTH_INVALID) {
11222 hdd_err("Invalid capture channel or bandwidth for a country");
11223 return -EINVAL;
11224 }
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -070011225
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011226 status = sme_roam_channel_change_req(hal_hdl, bssid, &ch_params,
11227 &roam_profile);
11228 if (status) {
11229 hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode",
11230 status);
11231 }
11232
Arunk Khandavalli062fb032017-10-04 12:18:15 +053011233 adapter->mon_chan = chan;
11234 adapter->mon_bandwidth = bandwidth;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011235 return qdf_status_to_os_return(status);
11236}
11237
Dustin Brown8d2d0f52017-04-03 17:02:08 -070011238static int printk_adapter(void *priv, const char *fmt, ...)
11239{
11240 int ret;
11241 va_list args;
11242
11243 va_start(args, fmt);
11244 ret = vprintk(fmt, args);
11245 ret += printk("\n");
11246 va_end(args);
11247
11248 return ret;
11249}
11250
11251#ifdef WMI_INTERFACE_EVENT_LOGGING
11252static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
11253{
11254 qdf_abstract_print *print = &printk_adapter;
11255
11256 switch (log_id) {
11257 case HTC_CREDIT_HISTORY_LOG:
11258 print(NULL, "HTC Credit History (count %u)", count);
11259 cds_print_htc_credit_history(count, print, NULL);
11260 break;
11261 case COMMAND_LOG:
11262 print(NULL, "Command Log (count %u)", count);
11263 wma_print_wmi_cmd_log(count, print, NULL);
11264 break;
11265 case COMMAND_TX_CMP_LOG:
11266 print(NULL, "Command Tx Complete Log (count %u)", count);
11267 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
11268 break;
11269 case MGMT_COMMAND_LOG:
11270 print(NULL, "Management Command Log (count %u)", count);
11271 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
11272 break;
11273 case MGMT_COMMAND_TX_CMP_LOG:
11274 print(NULL, "Management Command Tx Complete Log (count %u)",
11275 count);
11276 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
11277 break;
11278 case EVENT_LOG:
11279 print(NULL, "Event Log (count %u)", count);
11280 wma_print_wmi_event_log(count, print, NULL);
11281 break;
11282 case RX_EVENT_LOG:
11283 print(NULL, "Rx Event Log (count %u)", count);
11284 wma_print_wmi_rx_event_log(count, print, NULL);
11285 break;
11286 case MGMT_EVENT_LOG:
11287 print(NULL, "Management Event Log (count %u)", count);
11288 wma_print_wmi_mgmt_event_log(count, print, NULL);
11289 break;
11290 default:
11291 print(NULL, "Invalid Log Id %d", log_id);
11292 break;
11293 }
11294}
11295#else
11296static inline void hdd_ioctl_log_buffer(int log_id, uint32_t count)
11297{
11298}
11299#endif /* WMI_INTERFACE_EVENT_LOGGING */
11300
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011301static int __iw_set_two_ints_getnone(struct net_device *dev,
11302 struct iw_request_info *info,
11303 union iwreq_data *wrqu, char *extra)
11304{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011305 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011306 int *value = (int *)extra;
11307 int sub_cmd = value[0];
11308 int ret;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011309 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011310
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080011311 ENTER_DEV(dev);
11312
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011313 ret = wlan_hdd_validate_context(hdd_ctx);
11314 if (0 != ret)
11315 return ret;
11316
Jeff Johnson441e1f72017-02-07 08:50:49 -080011317 ret = hdd_check_private_wext_control(hdd_ctx, info);
11318 if (0 != ret)
11319 return ret;
11320
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011321 switch (sub_cmd) {
11322 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011323 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011324 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011325 WMI_STA_SMPS_PARAM_CMDID,
11326 value[1] << WMA_SMPS_PARAM_VALUE_S
11327 | value[2],
11328 VDEV_CMD);
11329 break;
Srinivas Girigowda6147c582016-10-18 12:26:15 -070011330#ifdef WLAN_DEBUG
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011331 case WE_SET_FW_CRASH_INJECT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011332 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011333 value[1], value[2]);
DARAM SUDHA7e7e91b2015-05-29 11:38:47 +053011334 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
11335 value[1], value[2]);
SaidiReddy Yenugacc733af2016-11-09 17:45:42 +053011336 if (!hdd_ctx->config->crash_inject_enabled) {
11337 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
11338 return 0;
11339 }
Yue Ma06152352017-06-20 18:08:58 -070011340 if (value[1] == 3) {
Anurag Chouhan4085ff72017-10-05 18:09:56 +053011341 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
Yue Ma06152352017-06-20 18:08:58 -070011342 return 0;
11343 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011344 ret = wma_cli_set2_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011345 GEN_PARAM_CRASH_INJECT,
11346 value[1], value[2], GEN_CMD);
11347 break;
11348#endif
Govind Singha471e5e2015-10-12 17:11:14 +053011349 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -070011350 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +053011351 value[1], value[2]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011352 ret = wma_cli_set2_command(adapter->sessionId,
Govind Singha471e5e2015-10-12 17:11:14 +053011353 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
11354 value[1], value[2], DBG_CMD);
11355 break;
11356 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -070011357 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +053011358 value[1], value[2]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011359 ret = wma_cli_set2_command(adapter->sessionId,
Govind Singha471e5e2015-10-12 17:11:14 +053011360 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
11361 value[1], value[2], DBG_CMD);
11362 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011363 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
11364 hdd_debug("Ioctl to set dual fw mode config");
Tushnim Bhattacharyya49ed8ab2017-05-26 18:20:10 -070011365 if (hdd_ctx->config->dual_mac_feature_disable ==
11366 DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011367 hdd_err("Dual mac feature is disabled from INI");
11368 return -EPERM;
11369 }
11370 hdd_debug("%d %d", value[1], value[2]);
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080011371 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->hdd_psoc,
11372 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011373 break;
11374 case WE_DUMP_DP_TRACE_LEVEL:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011375 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011376 value[1], value[2]);
11377 if (value[1] == DUMP_DP_TRACE)
Venkata Sharath Chandra Manchala0b9fc632017-05-15 14:35:15 -070011378 qdf_dp_trace_dump_all(value[2],
11379 QDF_TRACE_DEFAULT_PDEV_ID);
Nirav Shah0d58a7e2016-04-26 22:54:12 +053011380 else if (value[1] == ENABLE_DP_TRACE_LIVE_MODE)
11381 qdf_dp_trace_enable_live_mode();
Nirav Shahda008342016-05-17 18:50:40 +053011382 else if (value[1] == CLEAR_DP_TRACE_BUFFER)
11383 qdf_dp_trace_clear_buffer();
Mohit Khannaf8f96822017-05-17 17:11:59 -070011384 else if (value[1] == DISABLE_DP_TRACE_LIVE_MODE)
11385 qdf_dp_trace_disable_live_mode();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011386 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011387 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011388 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070011389 break;
Dustin Brown54096432017-02-23 13:00:44 -080011390 case WE_SET_WLAN_SUSPEND: {
Dustin Brown3ed3e9b2017-03-23 12:57:58 -070011391 hdd_info("STA unit-test suspend(%d, %d)", value[1], value[2]);
Dustin Brown54096432017-02-23 13:00:44 -080011392 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
11393 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011394 break;
Dustin Brown54096432017-02-23 13:00:44 -080011395 }
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011396 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -070011397 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -070011398 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -070011399 case WE_LOG_BUFFER: {
11400 int log_id = value[1];
11401 uint32_t count = value[2] < 0 ? 0 : value[2];
11402
11403 hdd_ioctl_log_buffer(log_id, count);
11404
11405 break;
11406 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011407 default:
Jeff Johnson99bac312016-06-28 10:38:18 -070011408 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011409 break;
11410 }
11411
11412 return ret;
11413}
11414
11415static int iw_set_two_ints_getnone(struct net_device *dev,
11416 struct iw_request_info *info,
11417 union iwreq_data *wrqu, char *extra)
11418{
11419 int ret;
11420
11421 cds_ssr_protect(__func__);
11422 ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
11423 cds_ssr_unprotect(__func__);
11424
11425 return ret;
11426}
11427
11428/* Define the Wireless Extensions to the Linux Network Device structure */
11429/* A number of these routines are NULL (meaning they are not implemented.) */
11430
11431static const iw_handler we_handler[] = {
11432 (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */
11433 (iw_handler) iw_get_name, /* SIOCGIWNAME */
11434 (iw_handler) NULL, /* SIOCSIWNWID */
11435 (iw_handler) NULL, /* SIOCGIWNWID */
11436 (iw_handler) iw_set_freq, /* SIOCSIWFREQ */
11437 (iw_handler) iw_get_freq, /* SIOCGIWFREQ */
11438 (iw_handler) iw_set_mode, /* SIOCSIWMODE */
11439 (iw_handler) iw_get_mode, /* SIOCGIWMODE */
11440 (iw_handler) NULL, /* SIOCSIWSENS */
11441 (iw_handler) NULL, /* SIOCGIWSENS */
11442 (iw_handler) NULL, /* SIOCSIWRANGE */
11443 (iw_handler) iw_get_range, /* SIOCGIWRANGE */
11444 (iw_handler) NULL, /* SIOCSIWPRIV */
11445 (iw_handler) NULL, /* SIOCGIWPRIV */
11446 (iw_handler) NULL, /* SIOCSIWSTATS */
11447 (iw_handler) NULL, /* SIOCGIWSTATS */
11448 (iw_handler) NULL, /* SIOCSIWSPY */
11449 (iw_handler) NULL, /* SIOCGIWSPY */
11450 (iw_handler) NULL, /* SIOCSIWTHRSPY */
11451 (iw_handler) NULL, /* SIOCGIWTHRSPY */
11452 (iw_handler) iw_set_ap_address, /* SIOCSIWAP */
11453 (iw_handler) iw_get_ap_address, /* SIOCGIWAP */
11454 (iw_handler) iw_set_mlme, /* SIOCSIWMLME */
11455 (iw_handler) NULL, /* SIOCGIWAPLIST */
Sandeep Puligillad0004212017-02-26 18:34:56 -080011456 (iw_handler) NULL, /* SIOCSIWSCAN */
11457 (iw_handler) NULL, /* SIOCGIWSCAN */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011458 (iw_handler) iw_set_essid, /* SIOCSIWESSID */
11459 (iw_handler) iw_get_essid, /* SIOCGIWESSID */
11460 (iw_handler) iw_set_nick, /* SIOCSIWNICKN */
11461 (iw_handler) iw_get_nick, /* SIOCGIWNICKN */
11462 (iw_handler) NULL, /* -- hole -- */
11463 (iw_handler) NULL, /* -- hole -- */
Jeff Johnson64b26982017-10-15 15:48:38 -070011464 (iw_handler) NULL, /* SIOCSIWRATE */
Jeff Johnson7b5b8e72017-10-15 15:41:00 -070011465 (iw_handler) NULL, /* SIOCGIWRATE */
Jeff Johnsonf2316482017-10-15 14:57:02 -070011466 (iw_handler) NULL, /* SIOCSIWRTS */
Jeff Johnsona95d5ca2017-10-15 14:49:45 -070011467 (iw_handler) NULL, /* SIOCGIWRTS */
Jeff Johnson40d70102017-10-15 14:39:01 -070011468 (iw_handler) NULL, /* SIOCSIWFRAG */
Jeff Johnson75956d32017-10-15 13:53:36 -070011469 (iw_handler) NULL, /* SIOCGIWFRAG */
Jeff Johnson744676f2017-10-15 12:56:16 -070011470 (iw_handler) NULL, /* SIOCSIWTXPOW */
Jeff Johnson918d35e2017-10-15 12:50:26 -070011471 (iw_handler) NULL, /* SIOCGIWTXPOW */
Jeff Johnsond8995042017-10-15 12:45:45 -070011472 (iw_handler) NULL, /* SIOCSIWRETRY */
Jeff Johnson00367e22017-10-15 12:40:15 -070011473 (iw_handler) NULL, /* SIOCGIWRETRY */
Jeff Johnson140e07a2017-10-15 12:32:29 -070011474 (iw_handler) NULL, /* SIOCSIWENCODE */
Jeff Johnsone84e8d02017-10-15 12:22:58 -070011475 (iw_handler) NULL, /* SIOCGIWENCODE */
Jeff Johnson955e0582017-10-15 11:56:52 -070011476 (iw_handler) NULL, /* SIOCSIWPOWER */
Jeff Johnson330d8dc2017-10-15 11:43:13 -070011477 (iw_handler) NULL, /* SIOCGIWPOWER */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011478 (iw_handler) NULL, /* -- hole -- */
11479 (iw_handler) NULL, /* -- hole -- */
Jeff Johnson4bcdafa2017-10-15 11:33:42 -070011480 (iw_handler) NULL, /* SIOCSIWGENIE */
Jeff Johnsonf6562c62017-10-15 11:24:05 -070011481 (iw_handler) NULL, /* SIOCGIWGENIE */
Jeff Johnson079f7de2017-10-15 11:04:08 -070011482 (iw_handler) NULL, /* SIOCSIWAUTH */
Jeff Johnson4139b822017-10-15 10:55:03 -070011483 (iw_handler) NULL, /* SIOCGIWAUTH */
Jeff Johnson5b300822017-10-15 10:44:40 -070011484 (iw_handler) NULL, /* SIOCSIWENCODEEXT */
Jeff Johnson6b747052017-10-15 10:29:04 -070011485 (iw_handler) NULL, /* SIOCGIWENCODEEXT */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011486 (iw_handler) NULL, /* SIOCSIWPMKSA */
11487};
11488
11489static const iw_handler we_private[] = {
11490
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070011491 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
11492 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
11493 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011494 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
11495 iw_set_three_ints_getnone,
11496 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070011497 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011498 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
11499 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070011500 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
11501 iw_setnone_get_threeint,
Jeff Johnson6fa1e012017-04-05 06:40:53 -070011502 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011503 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
11504 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
11505 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011506 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011507 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
11508 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
11509 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
11510 iw_set_keepalive_params,
11511#ifdef WLAN_FEATURE_PACKET_FILTERING
11512 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
11513 iw_set_packet_filter_params,
11514#endif
11515#ifdef FEATURE_WLAN_SCAN_PNO
11516 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
11517#endif
11518 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -080011519 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
11520 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011521 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
11522 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
11523 iw_set_two_ints_getnone,
11524 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
11525 iw_set_dot11p_channel_sched,
11526};
11527
11528/*Maximum command length can be only 15 */
11529static const struct iw_priv_args we_private_args[] = {
11530
11531 /* handlers for main ioctl */
11532 {WLAN_PRIV_SET_INT_GET_NONE,
11533 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11534 0,
11535 ""},
11536
11537 /* handlers for sub-ioctl */
11538 {WE_SET_11D_STATE,
11539 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11540 0,
11541 "set11Dstate"},
11542
11543 {WE_WOWL,
11544 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11545 0,
11546 "wowl"},
11547
11548 {WE_SET_POWER,
11549 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11550 0,
11551 "setPower"},
11552
11553 {WE_SET_MAX_ASSOC,
11554 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11555 0,
11556 "setMaxAssoc"},
11557
11558 {WE_SET_SAP_AUTO_CHANNEL_SELECTION,
11559 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
11560 "setAutoChannel" },
11561
11562 {WE_SET_SCAN_DISABLE,
11563 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11564 0,
11565 "scan_disable"},
11566
11567 {WE_SET_DATA_INACTIVITY_TO,
11568 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11569 0,
11570 "inactivityTO"},
11571
Mukul Sharmaed92f2f2017-04-20 00:06:28 +053011572 {WE_SET_WOW_DATA_INACTIVITY_TO,
11573 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11574 0,
11575 "wow_ito"},
11576
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011577 {WE_SET_MAX_TX_POWER,
11578 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11579 0,
11580 "setMaxTxPower"},
11581
11582 {WE_SET_TX_POWER,
11583 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11584 0,
11585 "setTxPower"},
11586
11587 {WE_SET_MC_RATE,
11588 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11589 0,
11590 "setMcRate"},
11591
11592 {WE_SET_MAX_TX_POWER_2_4,
11593 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11594 0,
11595 "setTxMaxPower2G"},
11596
11597 {WE_SET_MAX_TX_POWER_5_0,
11598 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11599 0,
11600 "setTxMaxPower5G"},
11601
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080011602 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +053011603 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080011604 0,
11605 "pktlog"},
11606
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011607 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
11608 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -080011609 * will support both
11610 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011611 {WE_SET_MAX_TX_POWER,
11612 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11613 0,
11614 "setTxMaxPower"},
11615
11616 /* set Higher DTIM Transition (DTIM1 to DTIM3)
Jeff Johnson3bb7c732017-01-12 08:40:17 -080011617 * 1 = enable and 0 = disable
11618 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011619 {
11620 WE_SET_HIGHER_DTIM_TRANSITION,
11621 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11622 0,
11623 "setHDtimTransn"
11624 },
11625
11626 {WE_SET_TM_LEVEL,
11627 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11628 0,
11629 "setTmLevel"},
11630
11631 {WE_SET_PHYMODE,
11632 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11633 0,
11634 "setphymode"},
11635
11636 {WE_SET_NSS,
11637 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11638 0,
11639 "nss"},
11640
11641 {WE_SET_LDPC,
11642 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11643 0,
11644 "ldpc"},
11645
11646 {WE_SET_TX_STBC,
11647 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11648 0,
11649 "tx_stbc"},
11650
11651 {WE_SET_RX_STBC,
11652 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11653 0,
11654 "rx_stbc"},
11655
11656 {WE_SET_SHORT_GI,
11657 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11658 0,
11659 "shortgi"},
11660
11661 {WE_SET_RTSCTS,
11662 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11663 0,
11664 "enablertscts"},
11665
11666 {WE_SET_CHWIDTH,
11667 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11668 0,
11669 "chwidth"},
11670
11671 {WE_SET_ANI_EN_DIS,
11672 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11673 0,
11674 "anienable"},
11675
11676 {WE_SET_ANI_POLL_PERIOD,
11677 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11678 0,
11679 "aniplen"},
11680
11681 {WE_SET_ANI_LISTEN_PERIOD,
11682 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11683 0,
11684 "anilislen"},
11685
11686 {WE_SET_ANI_OFDM_LEVEL,
11687 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11688 0,
11689 "aniofdmlvl"},
11690
11691 {WE_SET_ANI_CCK_LEVEL,
11692 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11693 0,
11694 "aniccklvl"},
11695
11696 {WE_SET_DYNAMIC_BW,
11697 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11698 0,
11699 "cwmenable"},
11700
11701 {WE_SET_CTS_CBW,
11702 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11703 0,
11704 "cts_cbw" },
11705
11706 {WE_SET_GTX_HT_MCS,
11707 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11708 0,
11709 "gtxHTMcs"},
11710
11711 {WE_SET_GTX_VHT_MCS,
11712 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11713 0,
11714 "gtxVHTMcs"},
11715
11716 {WE_SET_GTX_USRCFG,
11717 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11718 0,
11719 "gtxUsrCfg"},
11720
11721 {WE_SET_GTX_THRE,
11722 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11723 0,
11724 "gtxThre"},
11725
11726 {WE_SET_GTX_MARGIN,
11727 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11728 0,
11729 "gtxMargin"},
11730
11731 {WE_SET_GTX_STEP,
11732 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11733 0,
11734 "gtxStep"},
11735
11736 {WE_SET_GTX_MINTPC,
11737 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11738 0,
11739 "gtxMinTpc"},
11740
11741 {WE_SET_GTX_BWMASK,
11742 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11743 0,
11744 "gtxBWMask"},
11745
11746 {WE_SET_TX_CHAINMASK,
11747 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11748 0,
11749 "txchainmask"},
11750
11751 {WE_SET_RX_CHAINMASK,
11752 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11753 0,
11754 "rxchainmask"},
11755
11756 {WE_SET_11N_RATE,
11757 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11758 0,
11759 "set11NRates"},
11760
11761 {WE_SET_VHT_RATE,
11762 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11763 0,
11764 "set11ACRates"},
11765
11766 {WE_SET_AMPDU,
11767 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11768 0,
11769 "ampdu"},
11770
11771 {WE_SET_AMSDU,
11772 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11773 0,
11774 "amsdu"},
11775
11776 {WE_SET_BURST_ENABLE,
11777 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11778 0,
11779 "burst_enable"},
11780
11781 {WE_SET_BURST_DUR,
11782 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11783 0,
11784 "burst_dur"},
11785
11786 {WE_SET_TXPOW_2G,
11787 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11788 0,
11789 "txpow2g"},
11790
11791 {WE_SET_TXPOW_5G,
11792 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11793 0,
11794 "txpow5g"},
11795
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011796 /* Sub-cmds DBGLOG specific commands */
11797 {WE_DBGLOG_LOG_LEVEL,
11798 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11799 0,
11800 "dl_loglevel"},
11801
11802 {WE_DBGLOG_VAP_ENABLE,
11803 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11804 0,
11805 "dl_vapon"},
11806
11807 {WE_DBGLOG_VAP_DISABLE,
11808 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11809 0,
11810 "dl_vapoff"},
11811
11812 {WE_DBGLOG_MODULE_ENABLE,
11813 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11814 0,
11815 "dl_modon"},
11816
11817 {WE_DBGLOG_MODULE_DISABLE,
11818 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11819 0,
11820 "dl_modoff"},
11821
11822 {WE_DBGLOG_MOD_LOG_LEVEL,
11823 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11824 0,
11825 "dl_mod_loglevel"},
11826
11827 {WE_DBGLOG_TYPE,
11828 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11829 0,
11830 "dl_type"},
11831 {WE_DBGLOG_REPORT_ENABLE,
11832 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11833 0,
11834 "dl_report"},
11835
11836 {WE_SET_TXRX_FWSTATS,
11837 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11838 0,
11839 "txrx_fw_stats"},
11840
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080011841 {WE_SET_TXRX_STATS,
11842 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11843 0,
11844 "txrx_stats"},
11845
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011846 {WE_TXRX_FWSTATS_RESET,
11847 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11848 0,
11849 "txrx_fw_st_rst"},
11850
11851 {WE_PPS_PAID_MATCH,
11852 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11853 0, "paid_match"},
11854
11855 {WE_PPS_GID_MATCH,
11856 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11857 0, "gid_match"},
11858
11859 {WE_PPS_EARLY_TIM_CLEAR,
11860 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11861 0, "tim_clear"},
11862
11863 {WE_PPS_EARLY_DTIM_CLEAR,
11864 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11865 0, "dtim_clear"},
11866
11867 {WE_PPS_EOF_PAD_DELIM,
11868 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11869 0, "eof_delim"},
11870
11871 {WE_PPS_MACADDR_MISMATCH,
11872 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11873 0, "mac_match"},
11874
11875 {WE_PPS_DELIM_CRC_FAIL,
11876 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11877 0, "delim_fail"},
11878
11879 {WE_PPS_GID_NSTS_ZERO,
11880 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11881 0, "nsts_zero"},
11882
11883 {WE_PPS_RSSI_CHECK,
11884 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11885 0, "rssi_chk"},
11886
11887 {WE_PPS_5G_EBT,
11888 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11889 0, "5g_ebt"},
11890
11891 {WE_SET_HTSMPS,
11892 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11893 0, "htsmps"},
11894
11895 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
11896 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11897 0, "set_qpspollcnt"},
11898
11899 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
11900 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11901 0, "set_qtxwake"},
11902
11903 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
11904 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11905 0, "set_qwakeintv"},
11906
11907 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
11908 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11909 0, "set_qnodatapoll"},
11910
11911 /* handlers for MCC time quota and latency sub ioctls */
11912 {WE_MCC_CONFIG_LATENCY,
11913 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11914 0, "setMccLatency"},
11915
11916 {WE_MCC_CONFIG_QUOTA,
11917 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11918 0, "setMccQuota"},
11919
11920 {WE_SET_DEBUG_LOG,
11921 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11922 0, "setDbgLvl"},
11923
11924 /* handlers for early_rx power save */
11925 {WE_SET_EARLY_RX_ADJUST_ENABLE,
11926 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11927 0, "erx_enable"},
11928
11929 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
11930 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11931 0, "erx_bmiss_val"},
11932
11933 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
11934 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11935 0, "erx_bmiss_smpl"},
11936
11937 {WE_SET_EARLY_RX_SLOP_STEP,
11938 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11939 0, "erx_slop_step"},
11940
11941 {WE_SET_EARLY_RX_INIT_SLOP,
11942 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11943 0, "erx_init_slop"},
11944
11945 {WE_SET_EARLY_RX_ADJUST_PAUSE,
11946 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11947 0, "erx_adj_pause"},
11948
11949 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
11950 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11951 0, "erx_dri_sample"},
11952
11953 {WE_DUMP_STATS,
11954 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11955 0, "dumpStats"},
11956
11957 {WE_CLEAR_STATS,
11958 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11959 0, "clearStats"},
11960
Govind Singha471e5e2015-10-12 17:11:14 +053011961 {WE_START_FW_PROFILE,
11962 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11963 0, "startProfile"},
11964
Abhishek Singh1bdb1572015-10-16 16:24:19 +053011965 {WE_SET_CHANNEL,
11966 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11967 0, "setChanChange" },
11968
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +053011969 {WE_SET_CONC_SYSTEM_PREF,
11970 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11971 0, "setConcSysPref" },
11972
Jeff Johnson011c4502017-10-05 15:25:56 -070011973 {WE_SET_PDEV_RESET,
11974 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11975 0, "pdev_reset" },
11976
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053011977 {WE_SET_MODULATED_DTIM,
11978 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11979 0, "setModDTIM" },
11980
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011981 {WLAN_PRIV_SET_NONE_GET_INT,
11982 0,
11983 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11984 ""},
11985
11986 /* handlers for sub-ioctl */
11987 {WE_GET_11D_STATE,
11988 0,
11989 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11990 "get11Dstate"},
11991
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011992 {WE_GET_WLAN_DBG,
11993 0,
11994 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
11995 "getwlandbg"},
11996
11997 {WE_GET_MAX_ASSOC,
11998 0,
11999 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12000 "getMaxAssoc"},
12001
12002 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
12003 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12004 "getAutoChannel" },
12005
12006 {WE_GET_CONCURRENCY_MODE,
12007 0,
12008 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12009 "getconcurrency"},
12010
12011 {WE_GET_NSS,
12012 0,
12013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12014 "get_nss"},
12015
12016 {WE_GET_LDPC,
12017 0,
12018 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12019 "get_ldpc"},
12020
12021 {WE_GET_TX_STBC,
12022 0,
12023 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12024 "get_tx_stbc"},
12025
12026 {WE_GET_RX_STBC,
12027 0,
12028 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12029 "get_rx_stbc"},
12030
12031 {WE_GET_SHORT_GI,
12032 0,
12033 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12034 "get_shortgi"},
12035
12036 {WE_GET_RTSCTS,
12037 0,
12038 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12039 "get_rtscts"},
12040
12041 {WE_GET_CHWIDTH,
12042 0,
12043 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12044 "get_chwidth"},
12045
12046 {WE_GET_ANI_EN_DIS,
12047 0,
12048 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12049 "get_anienable"},
12050
12051 {WE_GET_ANI_POLL_PERIOD,
12052 0,
12053 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12054 "get_aniplen"},
12055
12056 {WE_GET_ANI_LISTEN_PERIOD,
12057 0,
12058 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12059 "get_anilislen"},
12060
12061 {WE_GET_ANI_OFDM_LEVEL,
12062 0,
12063 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12064 "get_aniofdmlvl"},
12065
12066 {WE_GET_ANI_CCK_LEVEL,
12067 0,
12068 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12069 "get_aniccklvl"},
12070
12071 {WE_GET_DYNAMIC_BW,
12072 0,
12073 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12074 "get_cwmenable"},
12075
12076 {WE_GET_GTX_HT_MCS,
12077 0,
12078 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12079 "get_gtxHTMcs"},
12080
12081 {WE_GET_GTX_VHT_MCS,
12082 0,
12083 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12084 "get_gtxVHTMcs"},
12085
12086 {WE_GET_GTX_USRCFG,
12087 0,
12088 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12089 "get_gtxUsrCfg"},
12090
12091 {WE_GET_GTX_THRE,
12092 0,
12093 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12094 "get_gtxThre"},
12095
12096 {WE_GET_GTX_MARGIN,
12097 0,
12098 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12099 "get_gtxMargin"},
12100
12101 {WE_GET_GTX_STEP,
12102 0,
12103 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12104 "get_gtxStep"},
12105
12106 {WE_GET_GTX_MINTPC,
12107 0,
12108 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12109 "get_gtxMinTpc"},
12110
12111 {WE_GET_GTX_BWMASK,
12112 0,
12113 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12114 "get_gtxBWMask"},
12115
12116 {WE_GET_TX_CHAINMASK,
12117 0,
12118 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12119 "get_txchainmask"},
12120
12121 {WE_GET_RX_CHAINMASK,
12122 0,
12123 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12124 "get_rxchainmask"},
12125
12126 {WE_GET_11N_RATE,
12127 0,
12128 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12129 "get_11nrate"},
12130
12131 {WE_GET_AMPDU,
12132 0,
12133 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12134 "get_ampdu"},
12135
12136 {WE_GET_AMSDU,
12137 0,
12138 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12139 "get_amsdu"},
12140
12141 {WE_GET_BURST_ENABLE,
12142 0,
12143 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12144 "get_burst_en"},
12145
12146 {WE_GET_BURST_DUR,
12147 0,
12148 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12149 "get_burst_dur"},
12150
12151 {WE_GET_TXPOW_2G,
12152 0,
12153 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12154 "get_txpow2g"},
12155
12156 {WE_GET_TXPOW_5G,
12157 0,
12158 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12159 "get_txpow5g"},
12160
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012161 {WE_GET_PPS_PAID_MATCH,
12162 0,
12163 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12164 "get_paid_match"},
12165
12166 {WE_GET_PPS_GID_MATCH,
12167 0,
12168 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12169 "get_gid_match"},
12170
12171 {WE_GET_PPS_EARLY_TIM_CLEAR,
12172 0,
12173 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12174 "get_tim_clear"},
12175
12176 {WE_GET_PPS_EARLY_DTIM_CLEAR,
12177 0,
12178 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12179 "get_dtim_clear"},
12180
12181 {WE_GET_PPS_EOF_PAD_DELIM,
12182 0,
12183 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12184 "get_eof_delim"},
12185
12186 {WE_GET_PPS_MACADDR_MISMATCH,
12187 0,
12188 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12189 "get_mac_match"},
12190
12191 {WE_GET_PPS_DELIM_CRC_FAIL,
12192 0,
12193 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12194 "get_delim_fail"},
12195
12196 {WE_GET_PPS_GID_NSTS_ZERO,
12197 0,
12198 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12199 "get_nsts_zero"},
12200
12201 {WE_GET_PPS_RSSI_CHECK,
12202 0,
12203 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12204 "get_rssi_chk"},
12205
12206 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
12207 0,
12208 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12209 "get_qpspollcnt"},
12210
12211 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
12212 0,
12213 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12214 "get_qtxwake"},
12215
12216 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
12217 0,
12218 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12219 "get_qwakeintv"},
12220
12221 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
12222 0,
12223 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12224 "get_qnodatapoll"},
12225
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070012226 {WE_CAP_TSF,
12227 0,
12228 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12229 "cap_tsf"},
12230
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012231 {WE_GET_TEMPERATURE,
12232 0,
12233 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12234 "get_temp"},
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070012235 {WE_GET_DCM,
12236 0,
12237 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12238 "get_dcm"},
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070012239 {WE_GET_RANGE_EXT,
12240 0,
12241 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12242 "get_range_ext"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012243 /* handlers for main ioctl */
12244 {WLAN_PRIV_SET_CHAR_GET_NONE,
12245 IW_PRIV_TYPE_CHAR | 512,
12246 0,
12247 ""},
12248
12249 /* handlers for sub-ioctl */
12250 {WE_WOWL_ADD_PTRN,
12251 IW_PRIV_TYPE_CHAR | 512,
12252 0,
12253 "wowlAddPtrn"},
12254
12255 {WE_WOWL_DEL_PTRN,
12256 IW_PRIV_TYPE_CHAR | 512,
12257 0,
12258 "wowlDelPtrn"},
12259
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012260 /* handlers for sub-ioctl */
12261 {WE_NEIGHBOR_REPORT_REQUEST,
12262 IW_PRIV_TYPE_CHAR | 512,
12263 0,
12264 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080012265
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012266 {WE_SET_AP_WPS_IE,
12267 IW_PRIV_TYPE_CHAR | 512,
12268 0,
12269 "set_ap_wps_ie"},
12270
12271 {WE_SET_CONFIG,
12272 IW_PRIV_TYPE_CHAR | 512,
12273 0,
12274 "setConfig"},
12275
12276 /* handlers for main ioctl */
12277 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
12278 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
12279 0,
12280 ""},
12281
12282 /* handlers for sub-ioctl */
12283 {WE_SET_WLAN_DBG,
12284 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
12285 0,
12286 "setwlandbg"},
12287
12288 /* handlers for sub-ioctl */
12289 {WE_SET_DP_TRACE,
12290 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
12291 0,
12292 "set_dp_trace"},
12293
12294 {WE_SET_SAP_CHANNELS,
12295 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
12296 0,
12297 "setsapchannels"},
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053012298
12299 {WE_SET_FW_TEST,
12300 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
12301 0, "fw_test"},
12302
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070012303 /* handlers for main ioctl */
12304 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
12305 0,
12306 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
12307 "" },
12308 {WE_GET_TSF,
12309 0,
12310 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
12311 "get_tsf" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012312
12313 {WE_SET_DUAL_MAC_SCAN_CONFIG,
12314 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
12315 0,
12316 "set_scan_cfg"},
12317
12318 /* handlers for main ioctl */
12319 {WLAN_PRIV_GET_CHAR_SET_NONE,
12320 0,
12321 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12322 ""},
12323
12324 /* handlers for sub-ioctl */
12325 {WE_WLAN_VERSION,
12326 0,
12327 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12328 "version"},
12329 {WE_GET_STATS,
12330 0,
12331 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12332 "getStats"},
Dustin Brownd9322482017-01-09 12:46:03 -080012333 {WE_GET_SUSPEND_RESUME_STATS,
12334 0,
12335 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12336 "getSuspendStats"},
Govind Singha471e5e2015-10-12 17:11:14 +053012337 {WE_LIST_FW_PROFILE,
12338 0,
12339 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12340 "listProfile"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012341 {WE_GET_STATES,
12342 0,
12343 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12344 "getHostStates"},
12345 {WE_GET_CFG,
12346 0,
12347 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12348 "getConfig"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012349 {WE_GET_RSSI,
12350 0,
12351 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12352 "getRSSI"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012353 {WE_GET_WMM_STATUS,
12354 0,
12355 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12356 "getWmmStatus"},
12357 {
12358 WE_GET_CHANNEL_LIST,
12359 0,
12360 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12361 "getChannelList"
12362 },
12363#ifdef FEATURE_WLAN_TDLS
12364 {
12365 WE_GET_TDLS_PEERS,
12366 0,
12367 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12368 "getTdlsPeers"
12369 },
12370#endif
12371#ifdef WLAN_FEATURE_11W
12372 {
12373 WE_GET_11W_INFO,
12374 0,
12375 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12376 "getPMFInfo"
12377 },
12378#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080012379 {
12380 WE_GET_IBSS_STA_INFO,
12381 0,
12382 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12383 "getIbssSTAs"
12384 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012385 {WE_GET_PHYMODE,
12386 0,
12387 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12388 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080012389#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012390 {WE_GET_OEM_DATA_CAP,
12391 0,
12392 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12393 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080012394#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012395 {WE_GET_SNR,
12396 0,
12397 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12398 "getSNR"},
12399
12400 /* handlers for main ioctl */
12401 {WLAN_PRIV_SET_NONE_GET_NONE,
12402 0,
12403 0,
12404 ""},
12405
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080012406 /* handlers for sub-ioctl */
12407 {
12408 WE_IBSS_GET_PEER_INFO_ALL,
12409 0,
12410 0,
12411 "ibssPeerInfoAll"
12412 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012413 {WE_GET_RECOVERY_STAT,
12414 0,
12415 0,
12416 "getRecoverStat"},
Govind Singha471e5e2015-10-12 17:11:14 +053012417
12418 {WE_GET_FW_PROFILE_DATA,
12419 0,
12420 0,
12421 "getProfileData"},
12422
12423 {WE_SET_REASSOC_TRIGGER,
12424 0,
12425 0,
12426 "reassoc"},
12427
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080012428 {WE_STOP_OBSS_SCAN,
12429 0,
12430 0,
12431 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012432 /* handlers for main ioctl */
12433 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
12434 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12435 0,
12436 ""},
12437
12438 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080012439 {WE_IBSS_GET_PEER_INFO,
12440 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12441 0,
12442 "ibssPeerInfo"},
12443
12444 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012445 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
12446 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12447 0,
12448 "setdumplog"},
12449
12450 {WE_MTRACE_DUMP_CMD,
12451 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12452 0,
12453 "dumplog"},
Krunal Sonia6e505b2017-01-12 12:25:18 -080012454
12455 {WE_POLICY_MANAGER_CINFO_CMD,
12456 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12457 0,
12458 "pm_cinfo"},
12459
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012460#ifdef MPC_UT_FRAMEWORK
12461 {WE_POLICY_MANAGER_CLIST_CMD,
12462 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12463 0,
12464 "pm_clist"},
12465
12466 {WE_POLICY_MANAGER_DLIST_CMD,
12467 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12468 0,
12469 "pm_dlist"},
12470
12471 {WE_POLICY_MANAGER_DBS_CMD,
12472 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12473 0,
12474 "pm_dbs"},
12475
12476 {WE_POLICY_MANAGER_PCL_CMD,
12477 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12478 0,
12479 "pm_pcl"},
12480
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012481 {WE_POLICY_MANAGER_ULIST_CMD,
12482 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12483 0,
12484 "pm_ulist"},
12485
12486 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
12487 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12488 0,
12489 "pm_query_action"},
12490
12491 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
12492 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12493 0,
12494 "pm_query_allow"},
12495
12496 {WE_POLICY_MANAGER_SCENARIO_CMD,
12497 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12498 0,
12499 "pm_run_scenario"},
12500
12501 {WE_POLICY_SET_HW_MODE_CMD,
12502 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12503 0,
12504 "pm_set_hw_mode"},
12505#endif
12506#ifdef FEATURE_WLAN_TDLS
12507 /* handlers for sub ioctl */
12508 {
12509 WE_TDLS_CONFIG_PARAMS,
12510 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12511 0,
12512 "setTdlsConfig"
12513 },
12514#endif
12515 {
12516 WE_UNIT_TEST_CMD,
12517 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12518 0,
12519 "setUnitTestCmd"
12520 },
Manjeet Singhf82ed072016-07-08 11:40:00 +053012521 {
12522 WE_MAC_PWR_DEBUG_CMD,
12523 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12524 0,
12525 "halPwrDebug"
12526 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012527
12528#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
12529 {WE_LED_FLASHING_PARAM,
12530 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
12531 0,
12532 "gpio_control"},
12533#endif
12534 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070012535 {WLAN_PRIV_FIPS_TEST,
12536 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
12537 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
12538 "fips_test"},
12539
12540 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012541 {WLAN_PRIV_ADD_TSPEC,
12542 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
12543 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12544 "addTspec"},
12545
12546 /* handlers for main ioctl */
12547 {WLAN_PRIV_DEL_TSPEC,
12548 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12549 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12550 "delTspec"},
12551
12552 /* handlers for main ioctl */
12553 {WLAN_PRIV_GET_TSPEC,
12554 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12555 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12556 "getTspec"},
12557
12558 /* handlers for main ioctl - host offload */
12559 {
12560 WLAN_PRIV_SET_HOST_OFFLOAD,
Srinivas Girigowda077143e2017-03-25 10:47:27 -070012561 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012562 0,
12563 "setHostOffload"
12564 }
12565 ,
12566
12567 {
12568 WLAN_GET_WLAN_STATISTICS,
12569 0,
12570 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
12571 "getWlanStats"
12572 }
12573 ,
12574
12575 {
12576 WLAN_SET_KEEPALIVE_PARAMS,
Mahesh A Saptasagar72d2e4b2016-04-20 12:44:17 +053012577 IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) |
12578 IW_PRIV_SIZE_FIXED,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012579 0,
12580 "setKeepAlive"
12581 }
12582 ,
12583#ifdef WLAN_FEATURE_PACKET_FILTERING
12584 {
12585 WLAN_SET_PACKET_FILTER_PARAMS,
Hanumanth Reddy Pothulab3ef4162016-10-25 15:13:26 +053012586 IW_PRIV_TYPE_BYTE |
12587 sizeof(struct pkt_filter_cfg),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012588 0,
12589 "setPktFilter"
12590 }
12591 ,
12592#endif
12593#ifdef FEATURE_WLAN_SCAN_PNO
12594 {
12595 WLAN_SET_PNO,
12596 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
12597 0,
12598 "setpno"
12599 }
12600 ,
12601#endif
12602 {
12603 WLAN_SET_BAND_CONFIG,
12604 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12605 0,
12606 "SETBAND"
12607 }
12608 ,
12609 {
Dustin Brown0cbc7572016-12-16 13:54:40 -080012610 WLAN_PRIV_SET_MCBC_FILTER,
Dustin Brown860566f2017-01-31 15:24:43 -080012611 0,
Dustin Brown0cbc7572016-12-16 13:54:40 -080012612 0,
12613 "setMCBCFilter"
12614 }
12615 ,
Dustin Brown0cbc7572016-12-16 13:54:40 -080012616
12617 {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012618 WLAN_GET_LINK_SPEED,
12619 IW_PRIV_TYPE_CHAR | 18,
12620 IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed"
12621 }
12622 ,
12623
12624 /* handlers for main ioctl */
12625 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
12626 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12627 0,
12628 ""}
12629 ,
12630 {WE_SET_SMPS_PARAM,
12631 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12632 0, "set_smps_param"}
12633 ,
12634 {WLAN_SET_DOT11P_CHANNEL_SCHED,
12635 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
12636 0, "set_dot11p" }
12637 ,
Srinivas Girigowda6147c582016-10-18 12:26:15 -070012638#ifdef WLAN_DEBUG
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012639 {WE_SET_FW_CRASH_INJECT,
12640 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12641 0, "crash_inject"}
12642 ,
Dustin Brown8d2d0f52017-04-03 17:02:08 -070012643 {WE_LOG_BUFFER,
12644 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12645 0, "log_buffer"}
12646 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012647#endif
Rajeev Kumara78a0a42016-07-13 19:28:20 -070012648#ifdef WLAN_SUSPEND_RESUME_TEST
12649 {WE_SET_WLAN_SUSPEND,
12650 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12651 0, "wlan_suspend"}
12652 ,
12653 {WE_SET_WLAN_RESUME,
12654 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12655 0, "wlan_resume"}
12656 ,
12657#endif
Govind Singha471e5e2015-10-12 17:11:14 +053012658 {WE_ENABLE_FW_PROFILE,
12659 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12660 0, "enableProfile"}
12661 ,
12662 {WE_SET_FW_PROFILE_HIST_INTVL,
12663 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12664 0, "set_hist_intvl"}
12665 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012666 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
12667 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12668 0, "set_fw_mode_cfg"}
12669 ,
12670 {WE_DUMP_DP_TRACE_LEVEL,
12671 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12672 0, "dump_dp_trace"}
12673 ,
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012674 {WE_SET_MON_MODE_CHAN,
12675 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
12676 0, "setMonChan"}
12677 ,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070012678
12679 {WE_GET_ROAM_SYNCH_DELAY,
12680 0,
12681 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12682 "hostroamdelay"}
12683 ,
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080012684 {WE_SET_11AX_RATE,
12685 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12686 0,
12687 "set_11ax_rate"}
12688 ,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070012689 {WE_SET_DCM,
12690 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12691 0,
12692 "enable_dcm"}
12693 ,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070012694 {WE_SET_RANGE_EXT,
12695 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12696 0,
12697 "enable_range_ext"}
12698 ,
Naveen Rawatc921c7b2017-06-13 17:29:51 -070012699
12700 {WLAN_PRIV_SET_FTIES,
12701 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
12702 0,
12703 "set_ft_ies"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012704};
12705
12706const struct iw_handler_def we_handler_def = {
Anurag Chouhan6d760662016-02-20 16:05:43 +053012707 .num_standard = QDF_ARRAY_SIZE(we_handler),
12708 .num_private = QDF_ARRAY_SIZE(we_private),
12709 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012710
12711 .standard = (iw_handler *) we_handler,
12712 .private = (iw_handler *) we_private,
12713 .private_args = we_private_args,
12714 .get_wireless_stats = NULL,
12715};
12716
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070012717/* hdd_set_wext() - configures bss parameters
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012718 * @adapter: handle to adapter context
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070012719 *
12720 * Returns: none
12721 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012722static int hdd_set_wext(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012723{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012724 struct hdd_wext_state *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Jeff Johnsond377dce2017-10-04 10:32:42 -070012725 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012726
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070012727 ENTER();
12728
12729 if (!pwextBuf) {
12730 hdd_err("ERROR: pwextBuf is NULL");
12731 return QDF_STATUS_E_FAILURE;
12732 }
12733
Jeff Johnsond377dce2017-10-04 10:32:42 -070012734 if (!sta_ctx) {
12735 hdd_err("ERROR: sta_ctx is NULL");
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070012736 return QDF_STATUS_E_FAILURE;
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070012737 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012738
12739 /* Now configure the roaming profile links. To SSID and bssid. */
12740 pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0;
Jeff Johnsond377dce2017-10-04 10:32:42 -070012741 pwextBuf->roamProfile.SSIDs.SSIDList = &sta_ctx->conn_info.SSID;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012742
12743 pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0;
Jeff Johnsond377dce2017-10-04 10:32:42 -070012744 pwextBuf->roamProfile.BSSIDs.bssid = &sta_ctx->conn_info.bssId;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012745
12746 /*Set the numOfChannels to zero to scan all the channels */
12747 pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0;
12748 pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL;
12749
12750 /* Default is no encryption */
12751 pwextBuf->roamProfile.EncryptionType.numEntries = 1;
12752 pwextBuf->roamProfile.EncryptionType.encryptionType[0] =
12753 eCSR_ENCRYPT_TYPE_NONE;
12754
12755 pwextBuf->roamProfile.mcEncryptionType.numEntries = 1;
12756 pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] =
12757 eCSR_ENCRYPT_TYPE_NONE;
12758
12759 pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
12760
12761 /* Default is no authentication */
12762 pwextBuf->roamProfile.AuthType.numEntries = 1;
12763 pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
12764
12765 pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_AUTO;
Jeff Johnsonce4a8342017-10-14 13:12:22 -070012766 sta_ctx->wpa_versions = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012767
12768 /*Set the default scan mode */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012769 adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012770
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012771 hdd_clear_roam_profile_ie(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012772
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070012773 EXIT();
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053012774 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012775
12776}
12777
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053012778#ifdef WLAN_FEATURE_FILS_SK
Jeff Johnson2a722002017-09-30 20:02:35 -070012779static void hdd_initialize_fils_info(struct hdd_wext_state *pwextBuf)
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053012780{
12781 pwextBuf->roamProfile.fils_con_info = NULL;
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +053012782 pwextBuf->roamProfile.hlp_ie = NULL;
12783 pwextBuf->roamProfile.hlp_ie_len = 0;
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053012784}
12785#else
Jeff Johnson2a722002017-09-30 20:02:35 -070012786static void hdd_initialize_fils_info(struct hdd_wext_state *pwextBuf)
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053012787{ }
12788#endif
12789
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070012790/**
12791 * hdd_register_wext() - register wext context
12792 * @dev: net device handle
12793 *
12794 * Registers wext interface context for a given net device
12795 *
12796 * Returns: 0 on success, errno on failure
12797 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012798int hdd_register_wext(struct net_device *dev)
12799{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012800 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
12801 struct hdd_wext_state *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Anurag Chouhance0dc992016-02-16 18:18:03 +053012802 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012803
12804 ENTER();
12805
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070012806 if (!pwextBuf) {
12807 hdd_err(FL("ERROR: pwextBuf is NULL"));
12808 return QDF_STATUS_E_FAILURE;
12809 }
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070012810
12811 /* Zero the memory. This zeros the profile structure */
Jeff Johnson2a722002017-09-30 20:02:35 -070012812 memset(pwextBuf, 0, sizeof(struct hdd_wext_state));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012813
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012814 status = hdd_set_wext(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012815
Anurag Chouhance0dc992016-02-16 18:18:03 +053012816 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070012817 hdd_err("ERROR: hdd_set_wext failed!!");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053012818 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012819 }
12820
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070012821 status = qdf_event_create(&pwextBuf->hdd_qdf_event);
12822 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070012823 hdd_err("ERROR: HDD qdf event init failed!!");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053012824 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012825 }
12826
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053012827 hdd_initialize_fils_info(pwextBuf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012828 /* Register as a wireless device */
12829 dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def;
12830
12831 EXIT();
12832 return 0;
12833}
12834
12835int hdd_unregister_wext(struct net_device *dev)
12836{
Jeff Johnson36e74c42017-09-18 08:15:42 -070012837 hdd_debug("dev(%pK)", dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012838
12839 if (dev != NULL) {
12840 rtnl_lock();
12841 dev->wireless_handlers = NULL;
12842 rtnl_unlock();
12843 }
12844
12845 return 0;
12846}