blob: 85805b513f1754cf01f8c73ef0eca9191bf49971 [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/**
5026 * __iw_get_tx_power() - SIOCGIWTXPOW 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_tx_power(struct net_device *dev,
5035 struct iw_request_info *info,
5036 union iwreq_data *wrqu, char *extra)
5037{
5038
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005039 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
5040 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsond377dce2017-10-04 10:32:42 -07005041 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005042 int ret;
5043
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005044 ENTER_DEV(dev);
5045
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005046 ret = wlan_hdd_validate_context(hdd_ctx);
5047 if (0 != ret)
5048 return ret;
5049
Jeff Johnson441e1f72017-02-07 08:50:49 -08005050 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5051 if (0 != ret)
5052 return ret;
5053
Jeff Johnsond377dce2017-10-04 10:32:42 -07005054 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005055 wrqu->txpower.value = 0;
5056 return 0;
5057 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005058 wlan_hdd_get_class_astats(adapter);
5059 wrqu->txpower.value = adapter->hdd_stats.ClassA_stat.max_pwr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005060
5061 return 0;
5062}
5063
5064/**
5065 * iw_get_tx_power() - SSR wrapper for __iw_get_tx_power()
5066 * @dev: pointer to net_device
5067 * @info: pointer to iw_request_info
5068 * @wrqu: pointer to iwreq_data
5069 * @extra: pointer to extra ioctl payload
5070 *
5071 * Return: 0 on success, error number otherwise
5072 */
5073static int iw_get_tx_power(struct net_device *dev,
5074 struct iw_request_info *info,
5075 union iwreq_data *wrqu, char *extra)
5076{
5077 int ret;
5078
5079 cds_ssr_protect(__func__);
5080 ret = __iw_get_tx_power(dev, info, wrqu, extra);
5081 cds_ssr_unprotect(__func__);
5082
5083 return ret;
5084}
5085
5086/**
5087 * __iw_set_tx_power() - SIOCSIWTXPOW ioctl handler
5088 * @dev: device upon which the ioctl was received
5089 * @info: ioctl request information
5090 * @wrqu: ioctl request data
5091 * @extra: ioctl extra data
5092 *
5093 * Return: 0 on success, non-zero on error
5094 */
5095static int __iw_set_tx_power(struct net_device *dev,
5096 struct iw_request_info *info,
5097 union iwreq_data *wrqu, char *extra)
5098{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005099 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
5100 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005101 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005102 int ret;
5103
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005104 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005105
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005106 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005107 ret = wlan_hdd_validate_context(hdd_ctx);
5108 if (0 != ret)
5109 return ret;
5110
Jeff Johnson441e1f72017-02-07 08:50:49 -08005111 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5112 if (0 != ret)
5113 return ret;
5114
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005115 if (sme_cfg_set_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305116 wrqu->txpower.value) != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005117 hdd_err("WNI_CFG_CURRENT_TX_POWER_LEVEL failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005118 return -EIO;
5119 }
5120
5121 EXIT();
5122
5123 return 0;
5124}
5125
5126/**
5127 * iw_set_tx_power() - SSR wrapper for __iw_set_tx_power()
5128 * @dev: pointer to net_device
5129 * @info: pointer to iw_request_info
5130 * @wrqu: pointer to iwreq_data
5131 * @extra: pointer to extra ioctl payload
5132 *
5133 * Return: 0 on success, error number otherwise
5134 */
5135static int iw_set_tx_power(struct net_device *dev,
5136 struct iw_request_info *info,
5137 union iwreq_data *wrqu, char *extra)
5138{
5139 int ret;
5140
5141 cds_ssr_protect(__func__);
5142 ret = __iw_set_tx_power(dev, info, wrqu, extra);
5143 cds_ssr_unprotect(__func__);
5144
5145 return ret;
5146}
5147
5148/**
5149 * __iw_get_bitrate() - SIOCGIWRATE ioctl handler
5150 * @dev: device upon which the ioctl was received
5151 * @info: ioctl request information
5152 * @wrqu: ioctl request data
5153 * @extra: ioctl extra data
5154 *
5155 * Return: 0 on success, non-zero on error
5156 */
5157static int __iw_get_bitrate(struct net_device *dev,
5158 struct iw_request_info *info,
5159 union iwreq_data *wrqu, char *extra)
5160{
Jeff Johnsonf25ac102017-02-07 09:16:02 -08005161 QDF_STATUS status;
Jeff Johnson2a722002017-09-30 20:02:35 -07005162 struct hdd_wext_state *pWextState;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005163 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07005164 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005165 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005166 int ret;
5167
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005168 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005169
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005170 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005171 ret = wlan_hdd_validate_context(hdd_ctx);
5172 if (0 != ret)
5173 return ret;
5174
Jeff Johnson441e1f72017-02-07 08:50:49 -08005175 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5176 if (0 != ret)
5177 return ret;
5178
Jeff Johnsond377dce2017-10-04 10:32:42 -07005179 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005180 wrqu->bitrate.value = 0;
5181 } else {
5182 status =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005183 sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005184 eCSR_HDD,
5185 SME_SUMMARY_STATS |
5186 SME_GLOBAL_CLASSA_STATS |
Jeff Johnsondfe89512017-03-10 15:50:00 -08005187 SME_GLOBAL_CLASSD_STATS,
Naveen Rawatd0ca4412017-06-16 14:19:19 -07005188 hdd_statistics_cb,
Jeff Johnsond377dce2017-10-04 10:32:42 -07005189 sta_ctx->conn_info.staId[0],
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005190 adapter, adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005191
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305192 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005193 hdd_err("Unable to retrieve statistics");
Jeff Johnsonf25ac102017-02-07 09:16:02 -08005194 return qdf_status_to_os_return(status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005195 }
5196
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005197 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005198
Jeff Johnsonf25ac102017-02-07 09:16:02 -08005199 status =
Anurag Chouhanf04e84f2016-03-03 10:12:12 +05305200 qdf_wait_single_event(&pWextState->hdd_qdf_event,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005201 WLAN_WAIT_TIME_STATS);
5202
Jeff Johnsonf25ac102017-02-07 09:16:02 -08005203 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005204 hdd_err("SME timeout while retrieving statistics");
Jeff Johnsonf25ac102017-02-07 09:16:02 -08005205 return qdf_status_to_os_return(status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005206 }
5207
5208 wrqu->bitrate.value =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005209 adapter->hdd_stats.ClassA_stat.tx_rate * 500 * 1000;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005210 }
5211
5212 EXIT();
5213
Jeff Johnsonf25ac102017-02-07 09:16:02 -08005214 return 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005215}
5216
5217/**
5218 * iw_get_bitrate() - SSR wrapper for __iw_get_bitrate()
5219 * @dev: pointer to net_device
5220 * @info: pointer to iw_request_info
5221 * @wrqu: pointer to iwreq_data
5222 * @extra: pointer to extra ioctl payload
5223 *
5224 * Return: 0 on success, error number otherwise
5225 */
5226static int iw_get_bitrate(struct net_device *dev,
5227 struct iw_request_info *info,
5228 union iwreq_data *wrqu, char *extra)
5229{
5230 int ret;
5231
5232 cds_ssr_protect(__func__);
5233 ret = __iw_get_bitrate(dev, info, wrqu, extra);
5234 cds_ssr_unprotect(__func__);
5235
5236 return ret;
5237}
5238
5239/**
5240 * __iw_set_bitrate() - SIOCSIWRATE ioctl handler
5241 * @dev: device upon which the ioctl was received
5242 * @info: ioctl request information
5243 * @wrqu: ioctl request data
5244 * @extra: ioctl extra data
5245 *
5246 * Return: 0 on success, non-zero on error
5247 */
5248static int __iw_set_bitrate(struct net_device *dev,
5249 struct iw_request_info *info,
5250 union iwreq_data *wrqu, char *extra)
5251{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005252 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson2a722002017-09-30 20:02:35 -07005253 struct hdd_wext_state *pWextState;
Jeff Johnsond377dce2017-10-04 10:32:42 -07005254 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005255 uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN];
5256 uint32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
5257 uint32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
5258 uint32_t i, rate;
5259 uint32_t valid_rate = false, active_phy_mode = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005260 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005261 int ret;
5262
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005263 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005264
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005265 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005266 ret = wlan_hdd_validate_context(hdd_ctx);
5267 if (0 != ret)
5268 return ret;
5269
Jeff Johnson441e1f72017-02-07 08:50:49 -08005270 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5271 if (0 != ret)
5272 return ret;
5273
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005274 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005275
Jeff Johnsond377dce2017-10-04 10:32:42 -07005276 if (eConnectionState_Associated != sta_ctx->conn_info.connState)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005277 return -ENXIO;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005278
5279 rate = wrqu->bitrate.value;
5280
5281 if (rate == -1) {
5282 rate = WNI_CFG_FIXED_RATE_AUTO;
5283 valid_rate = true;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005284 } else if (sme_cfg_get_int(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005285 WNI_CFG_DOT11_MODE,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305286 &active_phy_mode) == QDF_STATUS_SUCCESS) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005287 if (active_phy_mode == WNI_CFG_DOT11_MODE_11A
5288 || active_phy_mode == WNI_CFG_DOT11_MODE_11G
5289 || active_phy_mode == WNI_CFG_DOT11_MODE_11B) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005290 if ((sme_cfg_get_str(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005291 WNI_CFG_SUPPORTED_RATES_11A, supp_rates,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305292 &a_len) == QDF_STATUS_SUCCESS)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005293 &&
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005294 (sme_cfg_get_str(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005295 WNI_CFG_SUPPORTED_RATES_11B, supp_rates,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305296 &b_len) == QDF_STATUS_SUCCESS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005297 for (i = 0; i < (b_len + a_len); ++i) {
5298 /* supported rates returned is double
5299 * the actual rate so we divide it by 2
5300 */
5301 if ((supp_rates[i] & 0x7F) / 2 ==
5302 rate) {
5303 valid_rate = true;
5304 rate = i +
5305 WNI_CFG_FIXED_RATE_1MBPS;
5306 break;
5307 }
5308 }
5309 }
5310 }
5311 }
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005312 if (valid_rate != true)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005313 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005314
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005315 if (sme_cfg_set_int(WLAN_HDD_GET_HAL_CTX(adapter),
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305316 WNI_CFG_FIXED_RATE, rate) != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005317 hdd_err("failed to set ini parameter, WNI_CFG_FIXED_RATE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005318 return -EIO;
5319 }
5320 return 0;
5321}
5322
5323/**
5324 * iw_set_bitrate() - SSR wrapper for __iw_set_bitrate()
5325 * @dev: pointer to net_device
5326 * @info: pointer to iw_request_info
5327 * @wrqu: pointer to iwreq_data
5328 * @extra: pointer to extra ioctl payload
5329 *
5330 * Return: 0 on success, error number otherwise
5331 */
5332static int iw_set_bitrate(struct net_device *dev,
5333 struct iw_request_info *info,
5334 union iwreq_data *wrqu, char *extra)
5335{
5336 int ret;
5337
5338 cds_ssr_protect(__func__);
5339 ret = __iw_set_bitrate(dev, info, wrqu, extra);
5340 cds_ssr_unprotect(__func__);
5341
5342 return ret;
5343}
5344
5345/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005346 * __iw_get_rts_threshold() - SIOCGIWRTS ioctl handler
5347 * @dev: device upon which the ioctl was received
5348 * @info: ioctl request information
5349 * @wrqu: ioctl request data
5350 * @extra: ioctl extra data
5351 *
5352 * Return: 0 on success, non-zero on error
5353 */
5354static int __iw_get_rts_threshold(struct net_device *dev,
5355 struct iw_request_info *info,
5356 union iwreq_data *wrqu, char *extra)
5357{
Jeff Johnson3d278b02017-08-29 14:17:47 -07005358 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson5b907622017-02-07 10:00:37 -08005359 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
5360 uint32_t threshold = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005361 struct hdd_context *hdd_ctx;
Jeff Johnson5b907622017-02-07 10:00:37 -08005362 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005363
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005364 ENTER_DEV(dev);
5365
Jeff Johnson5b907622017-02-07 10:00:37 -08005366 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5367 ret = wlan_hdd_validate_context(hdd_ctx);
5368 if (0 != ret)
5369 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005370
Jeff Johnson441e1f72017-02-07 08:50:49 -08005371 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5372 if (0 != ret)
5373 return ret;
5374
Jeff Johnson5b907622017-02-07 10:00:37 -08005375 if (QDF_STATUS_SUCCESS !=
5376 sme_cfg_get_int(hal, WNI_CFG_RTS_THRESHOLD, &threshold)) {
5377 hdd_warn("failed to get ini parameter, WNI_CFG_RTS_THRESHOLD");
5378 return -EIO;
5379 }
5380 wrqu->rts.value = threshold;
5381
5382 hdd_notice("Rts-Threshold=%d!!", wrqu->rts.value);
5383
5384 EXIT();
5385
5386 return 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005387}
5388
5389/**
5390 * __iw_set_rts_threshold() - SIOCSIWRTS ioctl handler
5391 * @dev: device upon which the ioctl was received
5392 * @info: ioctl request information
5393 * @wrqu: ioctl request data
5394 * @extra: ioctl extra data
5395 *
5396 * Return: 0 on success, non-zero on error
5397 */
5398static int __iw_set_rts_threshold(struct net_device *dev,
5399 struct iw_request_info *info,
5400 union iwreq_data *wrqu, char *extra)
5401{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005402 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
5403 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005404 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005405 int ret;
5406
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005407 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005408
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005409 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005410 ret = wlan_hdd_validate_context(hdd_ctx);
5411 if (0 != ret)
5412 return ret;
5413
Jeff Johnson441e1f72017-02-07 08:50:49 -08005414 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5415 if (0 != ret)
5416 return ret;
5417
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005418 if (wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN
5419 || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX) {
5420 return -EINVAL;
5421 }
5422
5423 if (sme_cfg_set_int(hHal, WNI_CFG_RTS_THRESHOLD, wrqu->rts.value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305424 QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07005425 hdd_err("failed to set ini parameter, WNI_CFG_RTS_THRESHOLD");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005426 return -EIO;
5427 }
5428
5429 EXIT();
5430
5431 return 0;
5432}
5433
5434/**
5435 * iw_get_rts_threshold() - SSR wrapper for __iw_get_rts_threshold()
5436 * @dev: pointer to net_device
5437 * @info: pointer to iw_request_info
5438 * @wrqu: pointer to iwreq_data
5439 * @extra: pointer to extra ioctl payload
5440 *
5441 * Return: 0 on success, error number otherwise
5442 */
Jeff Johnson5b907622017-02-07 10:00:37 -08005443int iw_get_rts_threshold(struct net_device *dev,
5444 struct iw_request_info *info,
5445 union iwreq_data *wrqu, char *extra)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005446{
5447 int ret;
5448
5449 cds_ssr_protect(__func__);
5450 ret = __iw_get_rts_threshold(dev, info, wrqu, extra);
5451 cds_ssr_unprotect(__func__);
5452
5453 return ret;
5454}
5455
5456/**
5457 * iw_set_rts_threshold() - SSR wrapper for __iw_set_rts_threshold()
5458 * @dev: pointer to net_device
5459 * @info: pointer to iw_request_info
5460 * @wrqu: pointer to iwreq_data
5461 * @extra: pointer to extra ioctl payload
5462 *
5463 * Return: 0 on success, error number otherwise
5464 */
5465static int iw_set_rts_threshold(struct net_device *dev,
5466 struct iw_request_info *info,
5467 union iwreq_data *wrqu, char *extra)
5468{
5469 int ret;
5470
5471 cds_ssr_protect(__func__);
5472 ret = __iw_set_rts_threshold(dev, info, wrqu, extra);
5473 cds_ssr_unprotect(__func__);
5474
5475 return ret;
5476}
5477
5478/**
5479 * __iw_get_frag_threshold() - SIOCGIWFRAG ioctl handler
5480 * @dev: device upon which the ioctl was received
5481 * @info: ioctl request information
5482 * @wrqu: ioctl request data
5483 * @extra: ioctl extra data
5484 *
5485 * Return: 0 on success, non-zero on error
5486 */
5487static int __iw_get_frag_threshold(struct net_device *dev,
5488 struct iw_request_info *info,
5489 union iwreq_data *wrqu, char *extra)
5490{
Jeff Johnson3d278b02017-08-29 14:17:47 -07005491 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson5b907622017-02-07 10:00:37 -08005492 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
5493 uint32_t threshold = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005494 struct hdd_context *hdd_ctx;
Jeff Johnson5b907622017-02-07 10:00:37 -08005495 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005496
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005497 ENTER_DEV(dev);
5498
Jeff Johnson5b907622017-02-07 10:00:37 -08005499 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
5500 ret = wlan_hdd_validate_context(hdd_ctx);
5501 if (0 != ret)
5502 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005503
Jeff Johnson441e1f72017-02-07 08:50:49 -08005504 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5505 if (0 != ret)
5506 return ret;
5507
Jeff Johnson5b907622017-02-07 10:00:37 -08005508 if (sme_cfg_get_int(hal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold)
5509 != QDF_STATUS_SUCCESS) {
5510 hdd_warn("failed to get ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD");
5511 return -EIO;
5512 }
5513 wrqu->frag.value = threshold;
5514
5515 hdd_notice("Frag-Threshold=%d!!", wrqu->frag.value);
5516
5517 EXIT();
5518
5519 return 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005520}
5521
5522/**
5523 * iw_get_frag_threshold() - SSR wrapper for __iw_get_frag_threshold()
5524 * @dev: pointer to net_device
5525 * @info: pointer to iw_request_info
5526 * @wrqu: pointer to iwreq_data
5527 * @extra: pointer to extra ioctl payload
5528 *
5529 * Return: 0 on success, error number otherwise
5530 */
Jeff Johnson5b907622017-02-07 10:00:37 -08005531int iw_get_frag_threshold(struct net_device *dev,
5532 struct iw_request_info *info,
5533 union iwreq_data *wrqu, char *extra)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005534{
5535 int ret;
5536
5537 cds_ssr_protect(__func__);
5538 ret = __iw_get_frag_threshold(dev, info, wrqu, extra);
5539 cds_ssr_unprotect(__func__);
5540
5541 return ret;
5542}
5543
5544/**
5545 * __iw_set_frag_threshold() - SIOCSIWFRAG ioctl handler
5546 * @dev: device upon which the ioctl was received
5547 * @info: ioctl request information
5548 * @wrqu: ioctl request data
5549 * @extra: ioctl extra data
5550 *
5551 * Return: 0 on success, non-zero on error
5552 */
5553static int __iw_set_frag_threshold(struct net_device *dev,
5554 struct iw_request_info *info,
5555 union iwreq_data *wrqu, char *extra)
5556{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005557 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
5558 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005559 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005560 int ret;
5561
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005562 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005563
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005564 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005565 ret = wlan_hdd_validate_context(hdd_ctx);
5566 if (0 != ret)
5567 return ret;
5568
Jeff Johnson441e1f72017-02-07 08:50:49 -08005569 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5570 if (0 != ret)
5571 return ret;
5572
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005573 if (wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN
5574 || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX) {
5575 return -EINVAL;
5576 }
5577
5578 if (sme_cfg_set_int
5579 (hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, wrqu->frag.value)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305580 != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005581 hdd_err("WNI_CFG_FRAGMENTATION_THRESHOLD failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005582 return -EIO;
5583 }
5584
5585 EXIT();
5586
5587 return 0;
5588}
5589
5590/**
5591 * iw_set_frag_threshold() - SSR wrapper for __iw_set_frag_threshold()
5592 * @dev: pointer to net_device
5593 * @info: pointer to iw_request_info
5594 * @wrqu: pointer to iwreq_data
5595 * @extra: pointer to extra ioctl payload
5596 *
5597 * Return: 0 on success, error number otherwise
5598 */
5599static int iw_set_frag_threshold(struct net_device *dev,
5600 struct iw_request_info *info,
5601 union iwreq_data *wrqu, char *extra)
5602{
5603 int ret;
5604
5605 cds_ssr_protect(__func__);
5606 ret = __iw_set_frag_threshold(dev, info, wrqu, extra);
5607 cds_ssr_unprotect(__func__);
5608
5609 return ret;
5610}
5611
5612/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005613 * __iw_get_range() - SIOCGIWRANGE ioctl handler
5614 * @dev: device upon which the ioctl was received
5615 * @info: ioctl request information
5616 * @wrqu: ioctl request data
5617 * @extra: ioctl extra data
5618 *
5619 * Return: 0 on success, non-zero on error
5620 */
5621static int __iw_get_range(struct net_device *dev, struct iw_request_info *info,
5622 union iwreq_data *wrqu, char *extra)
5623{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005624 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
5625 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005626 struct iw_range *range = (struct iw_range *)extra;
5627
5628 uint8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN];
5629
5630 uint32_t num_channels = sizeof(channels);
5631 uint8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN];
5632 uint32_t a_len;
5633 uint32_t b_len;
5634 uint32_t active_phy_mode = 0;
5635 uint8_t index = 0, i;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07005636 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005637 int ret;
5638
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08005639 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005640
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005641 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005642 ret = wlan_hdd_validate_context(hdd_ctx);
5643 if (0 != ret)
5644 return ret;
5645
Jeff Johnson441e1f72017-02-07 08:50:49 -08005646 ret = hdd_check_standard_wext_control(hdd_ctx, info);
5647 if (0 != ret)
5648 return ret;
5649
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005650 wrqu->data.length = sizeof(struct iw_range);
5651 memset(range, 0, sizeof(struct iw_range));
5652
5653
5654 /*Get the phy mode */
5655 if (sme_cfg_get_int(hHal,
5656 WNI_CFG_DOT11_MODE,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305657 &active_phy_mode) == QDF_STATUS_SUCCESS) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005658 hdd_debug("active_phy_mode = %d", active_phy_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005659
5660 if (active_phy_mode == WNI_CFG_DOT11_MODE_11A
5661 || active_phy_mode == WNI_CFG_DOT11_MODE_11G) {
5662 /*Get the supported rates for 11G band */
5663 a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
5664 if (sme_cfg_get_str(hHal,
5665 WNI_CFG_SUPPORTED_RATES_11A,
5666 supp_rates,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305667 &a_len) == QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005668 if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005669 a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005670
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005671 for (i = 0; i < a_len; i++) {
5672 range->bitrate[i] =
5673 ((supp_rates[i] & 0x7F) / 2) *
5674 1000000;
5675 }
5676 range->num_bitrates = a_len;
5677 } else {
5678 return -EIO;
5679 }
5680 } else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B) {
5681 /*Get the supported rates for 11B band */
5682 b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
5683 if (sme_cfg_get_str(hHal,
5684 WNI_CFG_SUPPORTED_RATES_11B,
5685 supp_rates,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305686 &b_len) == QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005687 if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005688 b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005689
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005690 for (i = 0; i < b_len; i++) {
5691 range->bitrate[i] =
5692 ((supp_rates[i] & 0x7F) / 2) *
5693 1000000;
5694 }
5695 range->num_bitrates = b_len;
5696 } else {
5697 return -EIO;
5698 }
5699 }
5700 }
5701
5702 range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX;
5703 range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN;
5704 range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX;
5705
5706 range->encoding_size[0] = 5;
5707 range->encoding_size[1] = 13;
5708 range->num_encoding_sizes = 2;
5709 range->max_encoding_tokens = MAX_WEP_KEYS;
5710
5711 /* we support through Wireless Extensions 22 */
5712 range->we_version_compiled = WIRELESS_EXT;
5713 range->we_version_source = 22;
5714
5715 /*Supported Channels and Frequencies */
5716 if (sme_cfg_get_str
5717 ((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305718 &num_channels) != QDF_STATUS_SUCCESS) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005719 hdd_err("Failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005720 return -EIO;
5721 }
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07005722 if (num_channels > IW_MAX_FREQUENCIES)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005723 num_channels = IW_MAX_FREQUENCIES;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005724
5725 range->num_channels = num_channels;
5726 range->num_frequency = num_channels;
5727
5728 for (index = 0; index < num_channels; index++) {
5729 uint32_t frq_indx = 0;
5730
5731 range->freq[index].i = channels[index];
5732 while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE) {
5733 if (channels[index] == freq_chan_map[frq_indx].chan) {
5734 range->freq[index].m =
5735 freq_chan_map[frq_indx].freq * 100000;
5736 range->freq[index].e = 1;
5737 break;
5738 }
5739 frq_indx++;
5740 }
5741 }
5742
5743 /* Event capability (kernel + driver) */
5744 range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
5745 IW_EVENT_CAPA_MASK(SIOCGIWAP) |
5746 IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
5747 range->event_capa[1] = IW_EVENT_CAPA_K_1;
5748
5749 /*Encryption capability */
5750 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
5751 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
5752
5753 /* Txpower capability */
5754 range->txpower_capa = IW_TXPOW_MWATT;
5755
5756 /*Scanning capability */
5757#if WIRELESS_EXT >= 22
5758 range->scan_capa =
5759 IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL;
5760#endif
5761
5762 EXIT();
5763 return 0;
5764}
5765
5766/**
5767 * iw_get_range() - SSR wrapper for __iw_get_range()
5768 * @dev: pointer to net_device
5769 * @info: pointer to iw_request_info
5770 * @wrqu: pointer to iwreq_data
5771 * @extra: pointer to extra ioctl payload
5772 *
5773 * Return: 0 on success, error number otherwise
5774 */
5775static int iw_get_range(struct net_device *dev, struct iw_request_info *info,
5776 union iwreq_data *wrqu, char *extra)
5777{
5778 int ret;
5779
5780 cds_ssr_protect(__func__);
5781 ret = __iw_get_range(dev, info, wrqu, extra);
5782 cds_ssr_unprotect(__func__);
5783
5784 return ret;
5785}
5786
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005787struct class_a_stats {
5788 tCsrGlobalClassAStatsInfo class_a_stats;
5789};
5790
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005791/**
5792 * hdd_get_class_a_statistics_cb() - Get Class A stats callback function
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005793 * @stats: pointer to Class A stats
5794 * @context: user context originally registered with SME (always the
5795 * cookie from the request context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005796 *
5797 * Return: None
5798 */
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005799static void hdd_get_class_a_statistics_cb(void *stats, void *context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005800{
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005801 struct hdd_request *request;
5802 struct class_a_stats *priv;
5803 tCsrGlobalClassAStatsInfo *returned_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005804
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005805 ENTER();
5806 if ((NULL == stats) || (NULL == context)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07005807 hdd_err("Bad param, stats [%pK] context [%pK]",
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005808 stats, context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005809 return;
5810 }
5811
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005812 request = hdd_request_get(context);
5813 if (!request) {
5814 hdd_err("Obsolete request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005815 return;
5816 }
5817
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005818 returned_stats = stats;
5819 priv = hdd_request_priv(request);
5820 priv->class_a_stats = *returned_stats;
5821 hdd_request_complete(request);
5822 hdd_request_put(request);
5823 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005824}
5825
5826/**
5827 * wlan_hdd_get_class_astats() - Get Class A statistics
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005828 * @adapter: adapter for which statistics are desired
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005829 *
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305830 * Return: QDF_STATUS_SUCCESS if adapter's Class A statistics were updated
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005831 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005832QDF_STATUS wlan_hdd_get_class_astats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005833{
Jeff Johnsond377dce2017-10-04 10:32:42 -07005834 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305835 QDF_STATUS hstatus;
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005836 int ret;
5837 void *cookie;
5838 struct hdd_request *request;
5839 struct class_a_stats *priv;
5840 static const struct hdd_request_params params = {
5841 .priv_size = sizeof(*priv),
5842 .timeout_ms = WLAN_WAIT_TIME_STATS,
5843 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005844
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005845 if (NULL == adapter) {
5846 hdd_err("adapter is NULL");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305847 return QDF_STATUS_E_FAULT;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005848 }
Hanumanth Reddy Pothula2a8a7402017-07-03 14:06:11 +05305849 if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08005850 hdd_debug("Recovery in Progress. State: 0x%x Ignore!!!",
Prashanth Bhatta9e143052015-12-04 11:56:47 -08005851 cds_get_driver_state());
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305852 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005853 }
5854
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005855 request = hdd_request_alloc(&params);
5856 if (!request) {
5857 hdd_err("Request allocation failure");
5858 return QDF_STATUS_E_NOMEM;
5859 }
5860 cookie = hdd_request_cookie(request);
5861
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005862 /* query only for Class A statistics (which include link speed) */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005863 hstatus = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005864 eCSR_HDD, SME_GLOBAL_CLASSA_STATS,
5865 hdd_get_class_a_statistics_cb,
Jeff Johnsond377dce2017-10-04 10:32:42 -07005866 sta_ctx->conn_info.staId[0],
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005867 cookie, adapter->sessionId);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305868 if (QDF_STATUS_SUCCESS != hstatus) {
Archana Ramachandran31b5b652016-09-21 15:37:58 -07005869 hdd_warn("Unable to retrieve Class A statistics");
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005870 goto return_cached_results;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005871 }
5872
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005873 /* request was sent -- wait for the response */
5874 ret = hdd_request_wait_for_response(request);
5875 if (ret) {
5876 hdd_warn("SME timed out while retrieving Class A statistics");
5877 goto return_cached_results;
5878 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005879
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005880 /* update the adapter with the fresh results */
5881 priv = hdd_request_priv(request);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005882 adapter->hdd_stats.ClassA_stat = priv->class_a_stats;
Jeff Johnsona6ace5b2017-01-23 07:11:02 -08005883
5884return_cached_results:
5885 /*
5886 * either we never sent a request, we sent a request and
5887 * received a response or we sent a request and timed out.
5888 * regardless we are done with the request.
5889 */
5890 hdd_request_put(request);
5891
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305892 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005893}
5894
Jeff Johnsondda167c2017-01-23 10:37:57 -08005895struct station_stats {
5896 tCsrSummaryStatsInfo summary_stats;
5897 tCsrGlobalClassAStatsInfo class_a_stats;
5898 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
5899};
5900
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005901/**
5902 * hdd_get_station_statistics_cb() - Get stats callback function
Jeff Johnsondda167c2017-01-23 10:37:57 -08005903 * @stats: pointer to combined station stats
5904 * @context: user context originally registered with SME (always the
5905 * cookie from the request context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005906 *
5907 * Return: None
5908 */
Jeff Johnsondda167c2017-01-23 10:37:57 -08005909static void hdd_get_station_statistics_cb(void *stats, void *context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005910{
Jeff Johnsondda167c2017-01-23 10:37:57 -08005911 struct hdd_request *request;
5912 struct station_stats *priv;
5913 tCsrSummaryStatsInfo *summary_stats;
5914 tCsrGlobalClassAStatsInfo *class_a_stats;
Himanshu Agarwal37e42412016-07-21 14:35:09 +05305915 struct csr_per_chain_rssi_stats_info *per_chain_rssi_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005916
Jeff Johnsondda167c2017-01-23 10:37:57 -08005917 if ((NULL == stats) || (NULL == context)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -07005918 hdd_err("Bad param, pStats [%pK] pContext [%pK]",
Jeff Johnsondda167c2017-01-23 10:37:57 -08005919 stats, context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005920 return;
5921 }
5922
Jeff Johnsondda167c2017-01-23 10:37:57 -08005923 request = hdd_request_get(context);
5924 if (!request) {
5925 hdd_err("Obsolete request");
5926 return;
5927 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005928
Jeff Johnsondda167c2017-01-23 10:37:57 -08005929 summary_stats = (tCsrSummaryStatsInfo *) stats;
5930 class_a_stats = (tCsrGlobalClassAStatsInfo *) (summary_stats + 1);
Himanshu Agarwal37e42412016-07-21 14:35:09 +05305931 per_chain_rssi_stats = (struct csr_per_chain_rssi_stats_info *)
Jeff Johnsondda167c2017-01-23 10:37:57 -08005932 (class_a_stats + 1);
5933 priv = hdd_request_priv(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005934
5935 /* copy over the stats. do so as a struct copy */
Jeff Johnsondda167c2017-01-23 10:37:57 -08005936 priv->summary_stats = *summary_stats;
5937 priv->class_a_stats = *class_a_stats;
5938 priv->per_chain_rssi_stats = *per_chain_rssi_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005939
Jeff Johnsondda167c2017-01-23 10:37:57 -08005940 hdd_request_complete(request);
5941 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005942}
5943
5944/**
5945 * wlan_hdd_get_station_stats() - Get station statistics
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005946 * @adapter: adapter for which statistics are desired
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005947 *
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305948 * Return: QDF_STATUS_SUCCESS if adapter's statistics were updated
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005949 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005950QDF_STATUS wlan_hdd_get_station_stats(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005951{
Jeff Johnsond377dce2017-10-04 10:32:42 -07005952 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Dustin Brown0f5260d2017-06-12 16:17:38 -07005953 QDF_STATUS status;
5954 int errno;
Jeff Johnsondda167c2017-01-23 10:37:57 -08005955 void *cookie;
5956 struct hdd_request *request;
5957 struct station_stats *priv;
5958 static const struct hdd_request_params params = {
5959 .priv_size = sizeof(*priv),
5960 .timeout_ms = WLAN_WAIT_TIME_STATS,
5961 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005962
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005963 if (NULL == adapter) {
5964 hdd_err("adapter is NULL");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05305965 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005966 }
5967
Jeff Johnsondda167c2017-01-23 10:37:57 -08005968 request = hdd_request_alloc(&params);
5969 if (!request) {
5970 hdd_err("Request allocation failure");
5971 return QDF_STATUS_E_NOMEM;
5972 }
5973 cookie = hdd_request_cookie(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005974
5975 /* query only for Summary & Class A statistics */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005976 status = sme_get_statistics(WLAN_HDD_GET_HAL_CTX(adapter),
Dustin Brown0f5260d2017-06-12 16:17:38 -07005977 eCSR_HDD,
5978 SME_SUMMARY_STATS |
5979 SME_GLOBAL_CLASSA_STATS |
5980 SME_PER_CHAIN_RSSI_STATS,
5981 hdd_get_station_statistics_cb,
Jeff Johnsond377dce2017-10-04 10:32:42 -07005982 sta_ctx->conn_info.staId[0],
Dustin Brown0f5260d2017-06-12 16:17:38 -07005983 cookie,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005984 adapter->sessionId);
Dustin Brown0f5260d2017-06-12 16:17:38 -07005985 if (QDF_IS_STATUS_ERROR(status)) {
5986 hdd_err("Failed to retrieve statistics, status %d", status);
5987 goto put_request;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08005988 }
5989
Dustin Brown0f5260d2017-06-12 16:17:38 -07005990 /* request was sent -- wait for the response */
5991 errno = hdd_request_wait_for_response(request);
5992 if (errno) {
5993 hdd_err("Failed to wait for statistics, errno %d", errno);
5994 goto put_request;
5995 }
5996
5997 /* update the adapter with the fresh results */
5998 priv = hdd_request_priv(request);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07005999 adapter->hdd_stats.summary_stat = priv->summary_stats;
6000 adapter->hdd_stats.ClassA_stat = priv->class_a_stats;
6001 adapter->hdd_stats.per_chain_rssi_stats = priv->per_chain_rssi_stats;
Dustin Brown0f5260d2017-06-12 16:17:38 -07006002
6003put_request:
Jeff Johnsondda167c2017-01-23 10:37:57 -08006004 /*
6005 * either we never sent a request, we sent a request and
6006 * received a response or we sent a request and timed out.
6007 * regardless we are done with the request.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006008 */
Jeff Johnsondda167c2017-01-23 10:37:57 -08006009 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006010
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006011 /* either callback updated adapter stats or it has cached data */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306012 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006013}
6014
6015/**
6016 * iw_get_linkspeed() - Get current link speed ioctl
6017 * @dev: device upon which the ioctl was received
6018 * @info: ioctl request information
6019 * @wrqu: ioctl request data
6020 * @extra: extra ioctl buffer
6021 *
6022 * Return: 0 on success, non-zero on error
6023 */
6024static int __iw_get_linkspeed(struct net_device *dev,
6025 struct iw_request_info *info,
6026 union iwreq_data *wrqu, char *extra)
6027{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006028 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006029 char *pLinkSpeed = (char *)extra;
6030 int len = sizeof(uint32_t) + 1;
6031 uint32_t link_speed = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006032 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -08006033 int ret;
6034 int rc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006035
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08006036 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306037
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006038 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson441e1f72017-02-07 08:50:49 -08006039 ret = wlan_hdd_validate_context(hdd_ctx);
6040 if (0 != ret)
6041 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006042
Jeff Johnson441e1f72017-02-07 08:50:49 -08006043 ret = hdd_check_private_wext_control(hdd_ctx, info);
6044 if (0 != ret)
6045 return ret;
6046
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006047 ret = wlan_hdd_get_link_speed(adapter, &link_speed);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006048 if (0 != ret)
Jeff Johnson441e1f72017-02-07 08:50:49 -08006049 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006050
6051 wrqu->data.length = len;
6052 /* return the linkspeed as a string */
6053 rc = snprintf(pLinkSpeed, len, "%u", link_speed);
6054 if ((rc < 0) || (rc >= len)) {
6055 /* encoding or length error? */
Jeff Johnson99bac312016-06-28 10:38:18 -07006056 hdd_err("Unable to encode link speed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006057 return -EIO;
6058 }
6059
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05306060 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006061 /* a value is being successfully returned */
6062 return 0;
6063}
6064
6065static int iw_get_linkspeed(struct net_device *dev,
6066 struct iw_request_info *info,
6067 union iwreq_data *wrqu, char *extra)
6068{
6069 int ret;
6070
6071 cds_ssr_protect(__func__);
6072 ret = __iw_get_linkspeed(dev, info, wrqu, extra);
6073 cds_ssr_unprotect(__func__);
6074
6075 return ret;
6076}
6077
6078/**
6079 * wlan_hdd_change_country_code_callback() - Change country code callback
6080 * @context: opaque context originally passed to SME. All functions
6081 * which use this callback pass the adapter upon which the country
6082 * code change is active
6083 *
6084 * This function is registered as the callback function when
6085 * sme_change_country_code() is invoked. Callers of
6086 * sme_change_country_code() subsequently wait for the adapter's
6087 * @change_country_code completion variable, so all this function
6088 * needs to do is set that completion variable so that execution can
6089 * continue.
6090 *
6091 * Return: none
6092 */
6093void wlan_hdd_change_country_code_callback(void *context)
6094{
6095
Jeff Johnson3d278b02017-08-29 14:17:47 -07006096 struct hdd_adapter *adapter = context;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006097
6098 if (adapter && (WLAN_HDD_ADAPTER_MAGIC == adapter->magic))
6099 complete(&adapter->change_country_code);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006100}
6101
6102/**
6103 * __iw_set_nick() - SIOCSIWNICKN ioctl handler
6104 * @dev: device upon which the ioctl was received
6105 * @info: ioctl request information
6106 * @wrqu: ioctl request data
6107 * @extra: ioctl extra data
6108 *
6109 * Return: 0 on success, non-zero on error
6110 */
6111static int __iw_set_nick(struct net_device *dev,
6112 struct iw_request_info *info,
6113 union iwreq_data *wrqu, char *extra)
6114{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006115 struct hdd_adapter *adapter;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006116 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006117 int ret;
6118
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08006119 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006120
6121 adapter = WLAN_HDD_GET_PRIV_PTR(dev);
6122 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
6123 ret = wlan_hdd_validate_context(hdd_ctx);
6124 if (0 != ret)
6125 return ret;
6126
Jeff Johnson441e1f72017-02-07 08:50:49 -08006127 ret = hdd_check_standard_wext_control(hdd_ctx, info);
6128 if (0 != ret)
6129 return ret;
6130
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006131 return 0;
6132}
6133
6134/**
6135 * iw_set_nick() - SSR wrapper for __iw_set_nick
6136 * @dev: pointer to net_device
6137 * @info: pointer to iw_request_info
6138 * @wrqu: pointer to iwreq_data
6139 * @extra: extra
6140 *
6141 * Return: 0 on success, error number otherwise
6142 */
6143static int iw_set_nick(struct net_device *dev,
6144 struct iw_request_info *info,
6145 union iwreq_data *wrqu, char *extra)
6146{
6147 int ret;
6148
6149 cds_ssr_protect(__func__);
6150 ret = __iw_set_nick(dev, info, wrqu, extra);
6151 cds_ssr_unprotect(__func__);
6152
6153 return ret;
6154}
6155
6156/**
6157 * __iw_get_nick() - SIOCGIWNICKN ioctl handler
6158 * @dev: device upon which the ioctl was received
6159 * @info: ioctl request information
6160 * @wrqu: ioctl request data
6161 * @extra: ioctl extra data
6162 *
6163 * Return: 0 on success, non-zero on error
6164 */
6165static int __iw_get_nick(struct net_device *dev,
6166 struct iw_request_info *info,
6167 union iwreq_data *wrqu, char *extra)
6168{
Jeff Johnson3d278b02017-08-29 14:17:47 -07006169 struct hdd_adapter *adapter;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006170 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006171 int ret;
6172
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08006173 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006174
6175 adapter = WLAN_HDD_GET_PRIV_PTR(dev);
6176 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
6177 ret = wlan_hdd_validate_context(hdd_ctx);
6178 if (0 != ret)
6179 return ret;
6180
Jeff Johnson441e1f72017-02-07 08:50:49 -08006181 ret = hdd_check_standard_wext_control(hdd_ctx, info);
6182 if (0 != ret)
6183 return ret;
6184
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006185 return 0;
6186}
6187
6188/**
6189 * iw_get_nick() - SSR wrapper for __iw_get_nick
6190 * @dev: pointer to net_device
6191 * @info: pointer to iw_request_info
6192 * @wrqu: pointer to iwreq_data
6193 * @extra: extra
6194 *
6195 * Return: 0 on success, error number otherwise
6196 */
6197static int iw_get_nick(struct net_device *dev,
6198 struct iw_request_info *info,
6199 union iwreq_data *wrqu, char *extra)
6200{
6201 int ret;
6202
6203 cds_ssr_protect(__func__);
6204 ret = __iw_get_nick(dev, info, wrqu, extra);
6205 cds_ssr_unprotect(__func__);
6206
6207 return ret;
6208}
6209
6210/**
6211 * __iw_set_encode() - SIOCSIWENCODE ioctl handler
6212 * @dev: device upon which the ioctl was received
6213 * @info: ioctl request information
6214 * @wrqu: ioctl request data
6215 * @extra: ioctl extra data
6216 *
6217 * Return: 0 on success, non-zero on error
6218 */
6219static int __iw_set_encode(struct net_device *dev, struct iw_request_info *info,
6220 union iwreq_data *wrqu, char *extra)
6221{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006222 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07006223 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006224 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson2a722002017-09-30 20:02:35 -07006225 struct hdd_wext_state *pWextState =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006226 WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006227 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006228 struct iw_point *encoderq = &(wrqu->encoding);
6229 uint32_t keyId;
6230 uint8_t key_length;
6231 eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE;
6232 bool fKeyPresent = 0;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306233 QDF_STATUS status = QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006234 int ret;
6235
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08006236 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006237
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006238 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006239 ret = wlan_hdd_validate_context(hdd_ctx);
6240 if (0 != ret)
6241 return ret;
6242
Jeff Johnson441e1f72017-02-07 08:50:49 -08006243 ret = hdd_check_standard_wext_control(hdd_ctx, info);
6244 if (0 != ret)
6245 return ret;
6246
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006247 keyId = encoderq->flags & IW_ENCODE_INDEX;
6248
6249 if (keyId) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006250 if (keyId > MAX_WEP_KEYS)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006251 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006252
6253 fKeyPresent = 1;
6254 keyId--;
6255 } else {
6256 fKeyPresent = 0;
6257 }
6258
6259 if (wrqu->data.flags & IW_ENCODE_DISABLED) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006260 hdd_debug("****iwconfig wlan0 key off*****");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006261 if (!fKeyPresent) {
Yingying Tang3cc6b792016-10-20 17:00:37 +08006262 qdf_mem_zero(pWextState->roamProfile.Keys.KeyLength,
6263 CSR_MAX_NUM_KEY);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006264 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07006265 sta_ctx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
Jeff Johnsonce4a8342017-10-14 13:12:22 -07006266 sta_ctx->wpa_versions = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006267 pWextState->roamProfile.EncryptionType.encryptionType[0] =
6268 eCSR_ENCRYPT_TYPE_NONE;
6269 pWextState->roamProfile.mcEncryptionType.encryptionType[0] =
6270 eCSR_ENCRYPT_TYPE_NONE;
6271
Jeff Johnsond377dce2017-10-04 10:32:42 -07006272 sta_ctx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
6273 sta_ctx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006274
6275 if (eConnectionState_Associated ==
Jeff Johnsond377dce2017-10-04 10:32:42 -07006276 sta_ctx->conn_info.connState) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006277 INIT_COMPLETION(adapter->disconnect_comp_var);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006278 status =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006279 sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(adapter),
6280 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006281 eCSR_DISCONNECT_REASON_UNSPECIFIED);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306282 if (QDF_STATUS_SUCCESS == status) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006283 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006284
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006285 rc = wait_for_completion_timeout(&adapter->
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006286 disconnect_comp_var,
6287 msecs_to_jiffies
6288 (WLAN_WAIT_TIME_DISCONNECT));
6289 if (!rc)
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006290 hdd_err("disconnect_comp_var failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006291 }
6292 }
6293
6294 return status;
6295
6296 }
6297
6298 if (wrqu->data.flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED)) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006299 hdd_debug("iwconfig wlan0 key on");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006300
Jeff Johnsond377dce2017-10-04 10:32:42 -07006301 sta_ctx->conn_info.authType =
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006302 (encoderq->flags & IW_ENCODE_RESTRICTED) ?
6303 eCSR_AUTH_TYPE_SHARED_KEY :
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006304 eCSR_AUTH_TYPE_OPEN_SYSTEM;
6305
6306 }
6307
6308 if (wrqu->data.length > 0) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006309 hdd_debug("wrqu->data.length : %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006310
6311 key_length = wrqu->data.length;
6312
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006313 /* IW_ENCODING_TOKEN_MAX is the value that is set
6314 * for wrqu->data.length by iwconfig.c
6315 * when 'iwconfig wlan0 key on' is issued.
6316 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006317
6318 if (5 == key_length) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006319 hdd_debug("Call with WEP40,key_len=%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006320 key_length);
6321
6322 if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt)
6323 && (eCSR_AUTH_TYPE_OPEN_SYSTEM ==
Jeff Johnsond377dce2017-10-04 10:32:42 -07006324 sta_ctx->conn_info.authType)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006325 encryptionType = eCSR_ENCRYPT_TYPE_WEP40;
6326 } else {
6327 encryptionType =
6328 eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
6329 }
6330 } else if (13 == key_length) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006331 hdd_debug("Call with WEP104,key_len:%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006332 key_length);
6333
6334 if ((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt)
6335 && (eCSR_AUTH_TYPE_OPEN_SYSTEM ==
Jeff Johnsond377dce2017-10-04 10:32:42 -07006336 sta_ctx->conn_info.authType)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006337 encryptionType = eCSR_ENCRYPT_TYPE_WEP104;
6338 } else {
6339 encryptionType =
6340 eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
6341 }
6342 } else {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006343 hdd_err("Invalid WEP key length :%d", key_length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006344 return -EINVAL;
6345 }
6346
Jeff Johnsond377dce2017-10-04 10:32:42 -07006347 sta_ctx->conn_info.ucEncryptionType = encryptionType;
6348 sta_ctx->conn_info.mcEncryptionType = encryptionType;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006349 pWextState->roamProfile.EncryptionType.numEntries = 1;
6350 pWextState->roamProfile.EncryptionType.encryptionType[0] =
6351 encryptionType;
6352 pWextState->roamProfile.mcEncryptionType.numEntries = 1;
6353 pWextState->roamProfile.mcEncryptionType.encryptionType[0] =
6354 encryptionType;
6355
6356 if ((eConnectionState_NotConnected ==
Jeff Johnsond377dce2017-10-04 10:32:42 -07006357 sta_ctx->conn_info.connState)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006358 &&
6359 ((eCSR_AUTH_TYPE_OPEN_SYSTEM ==
Jeff Johnsond377dce2017-10-04 10:32:42 -07006360 sta_ctx->conn_info.authType)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006361 || (eCSR_AUTH_TYPE_SHARED_KEY ==
Jeff Johnsond377dce2017-10-04 10:32:42 -07006362 sta_ctx->conn_info.authType))) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006363
Anurag Chouhan600c3a02016-03-01 10:33:54 +05306364 qdf_mem_copy(&pWextState->roamProfile.Keys.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006365 KeyMaterial[keyId][0], extra, key_length);
6366
6367 pWextState->roamProfile.Keys.KeyLength[keyId] =
6368 (uint8_t) key_length;
6369 pWextState->roamProfile.Keys.defaultIndex =
6370 (uint8_t) keyId;
6371
6372 return status;
6373 }
6374 }
6375
6376 return 0;
6377}
6378
6379/**
6380 * iw_set_encode() - SSR wrapper for __iw_set_encode()
6381 * @dev: pointer to net_device
6382 * @info: pointer to iw_request_info
6383 * @wrqu: pointer to iwreq_data
6384 * @extra: pointer to extra ioctl payload
6385 *
6386 * Return: 0 on success, error number otherwise
6387 */
6388static int iw_set_encode(struct net_device *dev, struct iw_request_info *info,
6389 union iwreq_data *wrqu, char *extra)
6390{
6391 int ret;
6392
6393 cds_ssr_protect(__func__);
6394 ret = __iw_set_encode(dev, info, wrqu, extra);
6395 cds_ssr_unprotect(__func__);
6396
6397 return ret;
6398}
6399
6400/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006401 * __iw_set_retry() - SIOCSIWRETRY ioctl handler
6402 * @dev: device upon which the ioctl was received
6403 * @info: ioctl request information
6404 * @wrqu: ioctl request data
6405 * @extra: ioctl extra data
6406 *
6407 * Return: 0 on success, non-zero on error
6408 */
6409static int __iw_set_retry(struct net_device *dev, struct iw_request_info *info,
6410 union iwreq_data *wrqu, char *extra)
6411{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006412 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
6413 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006414 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006415 int ret;
6416
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08006417 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006418
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006419 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006420 ret = wlan_hdd_validate_context(hdd_ctx);
6421 if (0 != ret)
6422 return ret;
6423
Jeff Johnson441e1f72017-02-07 08:50:49 -08006424 ret = hdd_check_standard_wext_control(hdd_ctx, info);
6425 if (0 != ret)
6426 return ret;
6427
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006428 if (wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN ||
6429 wrqu->retry.value > WNI_CFG_LONG_RETRY_LIMIT_STAMAX) {
6430
Jeff Johnson99bac312016-06-28 10:38:18 -07006431 hdd_err("Invalid Retry-Limit=%d!!", wrqu->retry.value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006432
6433 return -EINVAL;
6434 }
6435
6436 if (wrqu->retry.flags & IW_RETRY_LIMIT) {
6437
6438 if ((wrqu->retry.flags & IW_RETRY_LONG)) {
6439 if (sme_cfg_set_int (hHal, WNI_CFG_LONG_RETRY_LIMIT,
6440 wrqu->retry.value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306441 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006442 hdd_err("WNI_CFG_LONG_RETRY_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006443 return -EIO;
6444 }
6445 } else if ((wrqu->retry.flags & IW_RETRY_SHORT)) {
6446 if (sme_cfg_set_int (hHal, WNI_CFG_SHORT_RETRY_LIMIT,
6447 wrqu->retry.value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306448 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006449 hdd_err("WNI_CFG_SHORT_RETRY_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006450 return -EIO;
6451 }
6452 }
6453 } else {
6454 return -EOPNOTSUPP;
6455 }
6456
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006457 hdd_debug("Set Retry-Limit=%d!!", wrqu->retry.value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006458
6459 EXIT();
6460
6461 return 0;
6462
6463}
6464
6465/**
6466 * iw_set_retry() - SSR wrapper for __iw_set_retry()
6467 * @dev: pointer to net_device
6468 * @info: pointer to iw_request_info
6469 * @wrqu: pointer to iwreq_data
6470 * @extra: pointer to extra ioctl payload
6471 *
6472 * Return: 0 on success, error number otherwise
6473 */
6474static int iw_set_retry(struct net_device *dev, struct iw_request_info *info,
6475 union iwreq_data *wrqu, char *extra)
6476{
6477 int ret;
6478
6479 cds_ssr_protect(__func__);
6480 ret = __iw_set_retry(dev, info, wrqu, extra);
6481 cds_ssr_unprotect(__func__);
6482
6483 return ret;
6484}
6485
6486/**
6487 * __iw_get_retry() - SIOCGIWRETRY ioctl handler
6488 * @dev: device upon which the ioctl was received
6489 * @info: ioctl request information
6490 * @wrqu: ioctl request data
6491 * @extra: ioctl extra data
6492 *
6493 * Return: 0 on success, non-zero on error
6494 */
6495static int __iw_get_retry(struct net_device *dev, struct iw_request_info *info,
6496 union iwreq_data *wrqu, char *extra)
6497{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006498 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
6499 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006500 uint32_t retry = 0;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006501 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006502 int ret;
6503
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08006504 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006505
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006506 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006507 ret = wlan_hdd_validate_context(hdd_ctx);
6508 if (0 != ret)
6509 return ret;
6510
Jeff Johnson441e1f72017-02-07 08:50:49 -08006511 ret = hdd_check_standard_wext_control(hdd_ctx, info);
6512 if (0 != ret)
6513 return ret;
6514
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006515 if ((wrqu->retry.flags & IW_RETRY_LONG)) {
6516 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
6517
6518 if (sme_cfg_get_int(hHal, WNI_CFG_LONG_RETRY_LIMIT, &retry) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306519 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006520 hdd_err("WNI_CFG_LONG_RETRY_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006521 return -EIO;
6522 }
6523
6524 wrqu->retry.value = retry;
6525 } else if ((wrqu->retry.flags & IW_RETRY_SHORT)) {
6526 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT;
6527
6528 if (sme_cfg_get_int(hHal, WNI_CFG_SHORT_RETRY_LIMIT, &retry) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306529 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006530 hdd_err("WNI_CFG_SHORT_RETRY_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006531 return -EIO;
6532 }
6533
6534 wrqu->retry.value = retry;
6535 } else {
6536 return -EOPNOTSUPP;
6537 }
6538
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006539 hdd_debug("Retry-Limit=%d!!", retry);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006540
6541 EXIT();
6542
6543 return 0;
6544}
6545
6546/**
6547 * iw_get_retry() - SSR wrapper for __iw_get_retry()
6548 * @dev: pointer to net_device
6549 * @info: pointer to iw_request_info
6550 * @wrqu: pointer to iwreq_data
6551 * @extra: pointer to extra ioctl payload
6552 *
6553 * Return: 0 on success, error number otherwise
6554 */
6555static int iw_get_retry(struct net_device *dev, struct iw_request_info *info,
6556 union iwreq_data *wrqu, char *extra)
6557{
6558 int ret;
6559
6560 cds_ssr_protect(__func__);
6561 ret = __iw_get_retry(dev, info, wrqu, extra);
6562 cds_ssr_unprotect(__func__);
6563
6564 return ret;
6565}
6566
6567/**
6568 * __iw_set_mlme() - SIOCSIWMLME ioctl handler
6569 * @dev: device upon which the ioctl was received
6570 * @info: ioctl request information
6571 * @wrqu: ioctl request data
6572 * @extra: ioctl extra data
6573 *
6574 * Return: 0 on success, non-zero on error
6575 */
6576static int __iw_set_mlme(struct net_device *dev,
6577 struct iw_request_info *info,
6578 union iwreq_data *wrqu, char *extra)
6579{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006580 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -07006581 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006582 struct iw_mlme *mlme = (struct iw_mlme *)extra;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306583 QDF_STATUS status = QDF_STATUS_SUCCESS;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006584 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006585 int ret;
6586
Jeff Johnsonb25dcb12016-02-11 17:46:42 -08006587 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006588
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006589 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006590 ret = wlan_hdd_validate_context(hdd_ctx);
6591 if (0 != ret)
6592 return ret;
6593
Jeff Johnson441e1f72017-02-07 08:50:49 -08006594 ret = hdd_check_standard_wext_control(hdd_ctx, info);
6595 if (0 != ret)
6596 return ret;
6597
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006598 /* reason_code is unused. By default it is set to
6599 * eCSR_DISCONNECT_REASON_UNSPECIFIED
6600 */
6601 switch (mlme->cmd) {
6602 case IW_MLME_DISASSOC:
6603 case IW_MLME_DEAUTH:
6604
Jeff Johnsond377dce2017-10-04 10:32:42 -07006605 if (sta_ctx->conn_info.connState ==
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006606 eConnectionState_Associated) {
6607 eCsrRoamDisconnectReason reason =
6608 eCSR_DISCONNECT_REASON_UNSPECIFIED;
6609
6610 if (mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE)
6611 reason = eCSR_DISCONNECT_REASON_MIC_ERROR;
6612
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006613 INIT_COMPLETION(adapter->disconnect_comp_var);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006614 status =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006615 sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(adapter),
6616 adapter->sessionId, reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006617
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306618 if (QDF_STATUS_SUCCESS == status) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006619 unsigned long rc;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006620
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006621 rc = wait_for_completion_timeout(&adapter->
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006622 disconnect_comp_var,
6623 msecs_to_jiffies
6624 (WLAN_WAIT_TIME_DISCONNECT));
6625 if (!rc)
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006626 hdd_err("disconnect_comp_var failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006627 } else
Jeff Johnson99bac312016-06-28 10:38:18 -07006628 hdd_err("%d Command Disassociate/Deauthenticate : csr_roam_disconnect failure returned %d",
6629 (int)mlme->cmd, (int)status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006630
6631 /* Resetting authKeyMgmt */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006632 (WLAN_HDD_GET_WEXT_STATE_PTR(adapter))->authKeyMgmt =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006633 0;
6634
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -07006635 hdd_debug("Disabling queues");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006636 wlan_hdd_netif_queue_control(adapter,
Himanshu Agarwal865201d2017-04-12 15:45:31 +05306637 WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006638 WLAN_CONTROL_PATH);
6639
6640 } else {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006641 hdd_warn("%d Command Disassociate/Deauthenticate called but station is not in associated state",
Jeff Johnson99bac312016-06-28 10:38:18 -07006642 (int)mlme->cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006643 }
6644 break;
6645 default:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006646 hdd_err("Unexpected cmd: %d", (int)mlme->cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006647 return -EINVAL;
6648 } /* end of switch */
6649
6650 EXIT();
6651
6652 return status;
6653
6654}
6655
6656/**
6657 * iw_set_mlme() - SSR wrapper for __iw_set_mlme()
6658 * @dev: pointer to net_device
6659 * @info: pointer to iw_request_info
6660 * @wrqu: pointer to iwreq_data
6661 * @extra: pointer to extra ioctl payload
6662 *
6663 * Return: 0 on success, error number otherwise
6664 */
6665static int iw_set_mlme(struct net_device *dev, struct iw_request_info *info,
6666 union iwreq_data *wrqu, char *extra)
6667{
6668 int ret;
6669
6670 cds_ssr_protect(__func__);
6671 ret = __iw_set_mlme(dev, info, wrqu, extra);
6672 cds_ssr_unprotect(__func__);
6673
6674 return ret;
6675}
6676
6677/**
6678 * wlan_hdd_update_phymode() - handle change in PHY mode
6679 * @net: device upon which PHY mode change was received
6680 * @hal: umac handle for the driver
6681 * @new_phymode: new PHY mode for the device
6682 * @phddctx: pointer to the HDD context
6683 *
6684 * This function is called when the device is set to a new PHY mode.
6685 * It takes a holistic look at the desired PHY mode along with the
6686 * configured capabilities of the driver and the reported capabilities
6687 * of the hardware in order to correctly configure all PHY-related
6688 * parameters.
6689 *
6690 * Return: 0 on success, negative errno value on error
6691 */
6692int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal,
Jeff Johnson6d38ab82017-08-28 11:36:27 -07006693 int new_phymode, struct hdd_context *phddctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006694{
6695#ifdef QCA_HT_2040_COEX
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006696 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(net);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306697 QDF_STATUS halStatus = QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006698#endif
6699 bool band_24 = false, band_5g = false;
6700 bool ch_bond24 = false, ch_bond5g = false;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306701 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006702 uint32_t chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006703 uint32_t vhtchanwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006704 eCsrPhyMode phymode = -EIO, old_phymode;
Srinivas Girigowda2fb677c2017-03-25 15:35:34 -07006705 enum hdd_dot11_mode hdd_dot11mode = phddctx->config->dot11Mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006706 eCsrBand curr_band = eCSR_BAND_ALL;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306707 int retval = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006708
6709 old_phymode = sme_get_phy_mode(hal);
6710
6711 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
6712 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
6713 nChannelBondingMode24GHz))
6714 ch_bond24 = true;
6715
6716 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
6717 sme_get_cb_phy_state_from_cb_ini_value(phddctx->config->
6718 nChannelBondingMode5GHz))
6719 ch_bond5g = true;
6720
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006721 if (phddctx->config->nBandCapability == eCSR_BAND_ALL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006722 band_24 = band_5g = true;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006723 else if (phddctx->config->nBandCapability == eCSR_BAND_24)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006724 band_24 = true;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07006725 else if (phddctx->config->nBandCapability == eCSR_BAND_5G)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006726 band_5g = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006727
6728 vhtchanwidth = phddctx->config->vhtChannelWidth;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006729 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 -08006730 ch_bond24, ch_bond5g, band_24, band_5g, vhtchanwidth);
6731
6732 switch (new_phymode) {
6733 case IEEE80211_MODE_AUTO:
6734 sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006735 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006736 phymode = eCSR_DOT11_MODE_AUTO;
6737 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
6738 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
6739 curr_band = eCSR_BAND_ALL;
6740 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
6741 } else {
6742 sme_set_phy_mode(hal, old_phymode);
6743 return -EIO;
6744 }
6745 break;
6746 case IEEE80211_MODE_11A:
6747 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11a);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006748 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006749 phymode = eCSR_DOT11_MODE_11a;
6750 hdd_dot11mode = eHDD_DOT11_MODE_11a;
6751 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
6752 curr_band = eCSR_BAND_5G;
6753 } else {
6754 sme_set_phy_mode(hal, old_phymode);
6755 return -EIO;
6756 }
6757 break;
6758 case IEEE80211_MODE_11B:
6759 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11b);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006760 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006761 phymode = eCSR_DOT11_MODE_11b;
6762 hdd_dot11mode = eHDD_DOT11_MODE_11b;
6763 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
6764 curr_band = eCSR_BAND_24;
6765 } else {
6766 sme_set_phy_mode(hal, old_phymode);
6767 return -EIO;
6768 }
6769 break;
6770 case IEEE80211_MODE_11G:
6771 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11g);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006772 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006773 phymode = eCSR_DOT11_MODE_11g;
6774 hdd_dot11mode = eHDD_DOT11_MODE_11g;
6775 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
6776 curr_band = eCSR_BAND_24;
6777 } else {
6778 sme_set_phy_mode(hal, old_phymode);
6779 return -EIO;
6780 }
6781 break;
6782 /* UMAC doesnt have option to set MODE_11NA/MODE_11NG as phymode
6783 * so setting phymode as eCSR_DOT11_MODE_11n and updating the band
6784 * and channel bonding in configuration to reflect MODE_11NA/MODE_11NG
6785 */
6786 case IEEE80211_MODE_11NA_HT20:
6787 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006788 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006789 phymode = eCSR_DOT11_MODE_11n;
6790 hdd_dot11mode = eHDD_DOT11_MODE_11n;
6791 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
6792 curr_band = eCSR_BAND_5G;
6793 } else {
6794 sme_set_phy_mode(hal, old_phymode);
6795 return -EIO;
6796 }
6797 break;
6798 case IEEE80211_MODE_11NA_HT40:
6799 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006800 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006801 phymode = eCSR_DOT11_MODE_11n;
6802 hdd_dot11mode = eHDD_DOT11_MODE_11n;
6803 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
6804 curr_band = eCSR_BAND_5G;
6805 } else {
6806 sme_set_phy_mode(hal, old_phymode);
6807 return -EIO;
6808 }
6809 break;
6810 case IEEE80211_MODE_11NG_HT20:
6811 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006812 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006813 phymode = eCSR_DOT11_MODE_11n;
6814 hdd_dot11mode = eHDD_DOT11_MODE_11n;
6815 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
6816 curr_band = eCSR_BAND_24;
6817 } else {
6818 sme_set_phy_mode(hal, old_phymode);
6819 return -EIO;
6820 }
6821 break;
6822 case IEEE80211_MODE_11NG_HT40:
6823 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006824 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006825 phymode = eCSR_DOT11_MODE_11n;
6826 hdd_dot11mode = eHDD_DOT11_MODE_11n;
6827 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
6828 curr_band = eCSR_BAND_24;
6829 } else {
6830 sme_set_phy_mode(hal, old_phymode);
6831 return -EIO;
6832 }
6833 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006834 case IEEE80211_MODE_11AC_VHT20:
6835 case IEEE80211_MODE_11AC_VHT40:
6836 case IEEE80211_MODE_11AC_VHT80:
6837 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11ac);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006838 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006839 phymode = eCSR_DOT11_MODE_11ac;
6840 hdd_dot11mode = eHDD_DOT11_MODE_11ac;
6841 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
6842 curr_band = eCSR_BAND_5G;
6843 } else {
6844 sme_set_phy_mode(hal, old_phymode);
6845 return -EIO;
6846 }
6847 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006848 case IEEE80211_MODE_2G_AUTO:
6849 sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006850 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_2_4_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006851 phymode = eCSR_DOT11_MODE_AUTO;
6852 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
6853 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
6854 curr_band = eCSR_BAND_24;
6855 } else {
6856 sme_set_phy_mode(hal, old_phymode);
6857 return -EIO;
6858 }
6859 break;
6860 case IEEE80211_MODE_5G_AUTO:
6861 sme_set_phy_mode(hal, eCSR_DOT11_MODE_AUTO);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006862 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_5_GHZ) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006863 phymode = eCSR_DOT11_MODE_AUTO;
6864 hdd_dot11mode = eHDD_DOT11_MODE_AUTO;
6865 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
6866 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
6867 curr_band = eCSR_BAND_5G;
6868 } else {
6869 sme_set_phy_mode(hal, old_phymode);
6870 return -EIO;
6871 }
6872 break;
6873 case IEEE80211_MODE_11AGN:
6874 sme_set_phy_mode(hal, eCSR_DOT11_MODE_11n);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -07006875 if (hdd_reg_set_band(net, WLAN_HDD_UI_BAND_AUTO) == 0) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006876 phymode = eCSR_DOT11_MODE_11n;
6877 hdd_dot11mode = eHDD_DOT11_MODE_11n;
6878 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
6879 curr_band = eCSR_BAND_ALL;
6880 } else {
6881 sme_set_phy_mode(hal, old_phymode);
6882 return -EIO;
6883 }
6884 break;
6885 default:
6886 return -EIO;
6887 }
6888
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006889 switch (new_phymode) {
6890 case IEEE80211_MODE_11AC_VHT20:
6891 chwidth = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
6892 vhtchanwidth = eHT_CHANNEL_WIDTH_20MHZ;
6893 break;
6894 case IEEE80211_MODE_11AC_VHT40:
6895 vhtchanwidth = eHT_CHANNEL_WIDTH_40MHZ;
6896 break;
6897 case IEEE80211_MODE_11AC_VHT80:
6898 vhtchanwidth = eHT_CHANNEL_WIDTH_80MHZ;
6899 break;
6900 default:
6901 vhtchanwidth = phddctx->config->vhtChannelWidth;
6902 break;
6903 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006904
6905 if (phymode != -EIO) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306906 sme_config = qdf_mem_malloc(sizeof(*sme_config));
6907 if (!sme_config) {
6908 hdd_err("Failed to allocate memory for sme_config");
6909 return -ENOMEM;
6910 }
6911 qdf_mem_zero(sme_config, sizeof(*sme_config));
6912 sme_get_config_param(hal, sme_config);
6913 sme_config->csrConfig.phyMode = phymode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006914#ifdef QCA_HT_2040_COEX
6915 if (phymode == eCSR_DOT11_MODE_11n &&
6916 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_DISABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306917 sme_config->csrConfig.obssEnabled = false;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006918 halStatus = sme_set_ht2040_mode(hal,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006919 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006920 eHT_CHAN_HT20, false);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306921 if (halStatus == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006922 hdd_err("Failed to disable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306923 retval = -EIO;
6924 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006925 }
6926 } else if (phymode == eCSR_DOT11_MODE_11n &&
6927 chwidth == WNI_CFG_CHANNEL_BONDING_MODE_ENABLE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306928 sme_config->csrConfig.obssEnabled = true;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006929 halStatus = sme_set_ht2040_mode(hal,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07006930 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006931 eHT_CHAN_HT20, true);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05306932 if (halStatus == QDF_STATUS_E_FAILURE) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006933 hdd_err("Failed to enable OBSS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306934 retval = -EIO;
6935 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006936 }
6937 }
6938#endif
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306939 sme_config->csrConfig.eBand = curr_band;
6940 sme_config->csrConfig.bandCapability = curr_band;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006941 if (curr_band == eCSR_BAND_24)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306942 sme_config->csrConfig.Is11hSupportEnabled = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006943 else
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306944 sme_config->csrConfig.Is11hSupportEnabled =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006945 phddctx->config->Is11hSupportEnabled;
6946 if (curr_band == eCSR_BAND_24)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306947 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006948 else if (curr_band == eCSR_BAND_24)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306949 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006950 else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306951 sme_config->csrConfig.channelBondingMode24GHz = chwidth;
6952 sme_config->csrConfig.channelBondingMode5GHz = chwidth;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006953 }
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306954 sme_config->csrConfig.nVhtChannelWidth = vhtchanwidth;
6955 sme_update_config(hal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006956
6957 phddctx->config->dot11Mode = hdd_dot11mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006958 phddctx->config->nChannelBondingMode24GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306959 sme_config->csrConfig.channelBondingMode24GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006960 phddctx->config->nChannelBondingMode5GHz =
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306961 sme_config->csrConfig.channelBondingMode5GHz;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006962 phddctx->config->vhtChannelWidth = vhtchanwidth;
Krunal Sonidf0f8742016-09-26 14:56:31 -07006963 if (hdd_update_config_cfg(phddctx) == false) {
Jeff Johnson99bac312016-06-28 10:38:18 -07006964 hdd_err("could not update config_dat");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306965 retval = -EIO;
6966 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006967 }
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +05306968
6969 if (band_5g) {
6970 struct ieee80211_supported_band *band;
6971
6972 band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ];
6973 if (phddctx->config->nChannelBondingMode5GHz)
6974 band->ht_cap.cap |=
6975 IEEE80211_HT_CAP_SUP_WIDTH_20_40;
6976 else
6977 band->ht_cap.cap &=
6978 ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
6979 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006980
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08006981 hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006982 phymode, chwidth, curr_band, vhtchanwidth);
6983 }
6984
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05306985free:
6986 if (sme_config)
6987 qdf_mem_free(sme_config);
6988 return retval;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006989}
6990
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006991struct temperature_priv {
6992 int temperature;
6993};
6994
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006995/**
6996 * hdd_get_temperature_cb() - "Get Temperature" callback function
6997 * @temperature: measured temperature
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08006998 * @context: callback context
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08006999 *
7000 * This function is passed to sme_get_temperature() as the callback
7001 * function to be invoked when the temperature measurement is
7002 * available.
7003 *
7004 * Return: None
7005 */
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007006static void hdd_get_temperature_cb(int temperature, void *context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007007{
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007008 struct hdd_request *request;
7009 struct temperature_priv *priv;
7010
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007011 ENTER();
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007012
7013 request = hdd_request_get(context);
7014 if (!request) {
7015 hdd_err("Obsolete request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007016 return;
7017 }
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007018
7019 priv = hdd_request_priv(request);
7020 priv->temperature = temperature;
7021 hdd_request_complete(request);
7022 hdd_request_put(request);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007023 EXIT();
7024}
7025
7026/**
7027 * wlan_hdd_get_temperature() - get current device temperature
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007028 * @adapter: device upon which the request was made
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007029 * @temperature: pointer to where the temperature is to be returned
7030 *
7031 * Return: 0 if a temperature value (either current or cached) was
7032 * returned, otherwise a negative errno is returned.
7033 *
7034 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007035int wlan_hdd_get_temperature(struct hdd_adapter *adapter, int *temperature)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007036{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307037 QDF_STATUS status;
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007038 int ret;
7039 void *cookie;
7040 struct hdd_request *request;
7041 struct temperature_priv *priv;
7042 static const struct hdd_request_params params = {
7043 .priv_size = sizeof(*priv),
7044 .timeout_ms = WLAN_WAIT_TIME_STATS,
7045 };
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007046
7047 ENTER();
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007048 if (NULL == adapter) {
7049 hdd_err("adapter is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007050 return -EPERM;
7051 }
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007052
7053 request = hdd_request_alloc(&params);
7054 if (!request) {
7055 hdd_err("Request allocation failure");
7056 return -ENOMEM;
7057 }
7058 cookie = hdd_request_cookie(request);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007059 status = sme_get_temperature(WLAN_HDD_GET_HAL_CTX(adapter),
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007060 cookie, hdd_get_temperature_cb);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307061 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007062 hdd_err("Unable to retrieve temperature");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007063 } else {
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007064 ret = hdd_request_wait_for_response(request);
7065 if (ret) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007066 hdd_err("SME timed out while retrieving temperature");
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007067 } else {
7068 /* update the adapter with the fresh results */
7069 priv = hdd_request_priv(request);
7070 if (priv->temperature)
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007071 adapter->temperature = priv->temperature;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007072 }
7073 }
Jeff Johnson0c5a2ba2017-01-23 16:36:43 -08007074
7075 /*
7076 * either we never sent a request, we sent a request and
7077 * received a response or we sent a request and timed out.
7078 * regardless we are done with the request.
7079 */
7080 hdd_request_put(request);
7081
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007082 *temperature = adapter->temperature;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007083 EXIT();
7084 return 0;
7085}
7086
Jeff Johnson011c4502017-10-05 15:25:56 -07007087static int hdd_validate_pdev_reset(int value)
7088{
7089 if ((value < 1) || (value > 5)) {
7090 hdd_warn(" Invalid value %d: Use any one of the below values\n"
7091 " TX_FLUSH = 1\n"
7092 " WARM_RESET = 2\n"
7093 " COLD_RESET = 3\n"
7094 " WARM_RESET_RESTORE_CAL = 4\n"
7095 " COLD_RESET_RESTORE_CAL = 5", value);
7096
7097 return -EINVAL;
7098 }
7099
7100 return 0;
7101}
7102
7103static int hdd_handle_pdev_reset(struct hdd_adapter *adapter, int value)
7104{
7105 int ret;
7106
7107 hdd_debug("%d", value);
7108
7109 ret = hdd_validate_pdev_reset(value);
7110 if (ret)
7111 return ret;
7112
7113 ret = wma_cli_set_command(adapter->sessionId,
7114 WMI_PDEV_PARAM_PDEV_RESET,
7115 value, PDEV_CMD);
7116
7117 return ret;
7118}
7119
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007120/**
7121 * iw_setint_getnone() - Generic "set integer" private ioctl handler
7122 * @dev: device upon which the ioctl was received
7123 * @info: ioctl request information
7124 * @wrqu: ioctl request data
7125 * @extra: ioctl extra data
7126 *
7127 * Return: 0 on success, non-zero on error
7128 */
7129static int __iw_setint_getnone(struct net_device *dev,
7130 struct iw_request_info *info,
7131 union iwreq_data *wrqu, char *extra)
7132{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007133 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
7134 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Jeff Johnsond377dce2017-10-04 10:32:42 -07007135 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07007136 struct hdd_context *hdd_ctx;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307137 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007138 int *value = (int *)extra;
7139 int sub_cmd = value[0];
7140 int set_value = value[1];
7141 int ret;
7142 int enable_pbm, enable_mp;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307143 QDF_STATUS status;
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007144 void *soc = NULL;
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007145 struct cdp_pdev *pdev = NULL;
7146 struct cdp_vdev *vdev = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007147
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08007148 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05307149
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007150 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007151 ret = wlan_hdd_validate_context(hdd_ctx);
7152 if (0 != ret)
7153 return ret;
7154
Jeff Johnson441e1f72017-02-07 08:50:49 -08007155 ret = hdd_check_private_wext_control(hdd_ctx, info);
7156 if (0 != ret)
7157 return ret;
7158
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307159 sme_config = qdf_mem_malloc(sizeof(*sme_config));
7160 if (!sme_config) {
7161 hdd_err("failed to allocate memory for sme_config");
7162 return -ENOMEM;
7163 }
7164 qdf_mem_zero(sme_config, sizeof(*sme_config));
Jeff Johnson441e1f72017-02-07 08:50:49 -08007165
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007166 switch (sub_cmd) {
7167 case WE_SET_11D_STATE:
7168 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307169 if (((ENABLE_11D == set_value)
7170 || (DISABLE_11D == set_value)) && hHal) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007171
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307172 sme_get_config_param(hHal, sme_config);
7173 sme_config->csrConfig.Is11dSupportEnabled =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007174 (bool) set_value;
7175
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007176 hdd_debug("11D state=%d!!",
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307177 sme_config->csrConfig.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007178 Is11dSupportEnabled);
7179
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307180 sme_update_config(hHal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007181 } else {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307182 ret = -EINVAL;
7183 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007184 }
7185 break;
7186 }
7187
7188 case WE_WOWL:
7189 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307190 if (!hHal)
7191 return -EINVAL;
7192
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007193 switch (set_value) {
7194 case 0x00:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007195 hdd_exit_wowl(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007196 break;
7197 case 0x01:
7198 case 0x02:
7199 case 0x03:
7200 enable_mp = (set_value & 0x01) ? 1 : 0;
7201 enable_pbm = (set_value & 0x02) ? 1 : 0;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007202 hdd_debug("magic packet ? = %s pattern byte matching ? = %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007203 (enable_mp ? "YES" : "NO"),
7204 (enable_pbm ? "YES" : "NO"));
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007205 hdd_enter_wowl(adapter, enable_mp, enable_pbm);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007206 break;
7207 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007208 hdd_err("Invalid arg %d in WE_WOWL IOCTL",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007209 set_value);
7210 ret = -EINVAL;
7211 break;
7212 }
7213
7214 break;
7215 }
7216 case WE_SET_POWER:
7217 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307218 if (!hHal)
7219 return -EINVAL;
7220
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007221 switch (set_value) {
7222 case 1:
7223 /* Enable PowerSave */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007224 sme_ps_enable_disable(hHal, adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007225 SME_PS_ENABLE);
7226 break;
7227 case 2:
7228 /* Disable PowerSave */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007229 sme_ps_enable_disable(hHal, adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007230 SME_PS_DISABLE);
7231 break;
7232 case 3: /* Enable UASPD */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007233 sme_ps_uapsd_enable(hHal, adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007234 break;
7235 case 4: /* Disable UASPD */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007236 sme_ps_uapsd_disable(hHal, adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007237 break;
7238 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07007239 hdd_err("Invalid arg %d in WE_SET_POWER IOCTL",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007240 set_value);
7241 ret = -EINVAL;
7242 break;
7243 }
7244 break;
7245 }
7246
7247 case WE_SET_MAX_ASSOC:
7248 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307249 if (!hHal)
7250 return -EINVAL;
7251
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007252 if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) ||
7253 (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) {
7254 ret = -EINVAL;
7255 } else if (sme_cfg_set_int(hHal, WNI_CFG_ASSOC_STA_LIMIT,
7256 set_value)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307257 != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007258 hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007259 ret = -EIO;
7260 }
7261 break;
7262 }
7263
7264 case WE_SET_SAP_AUTO_CHANNEL_SELECTION:
7265 if (set_value == 0 || set_value == 1)
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007266 (WLAN_HDD_GET_CTX(adapter))->config->force_sap_acs =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007267 set_value;
7268 else
7269 ret = -EINVAL;
7270 break;
7271
7272 case WE_SET_DATA_INACTIVITY_TO:
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307273 if (!hHal)
7274 return -EINVAL;
7275
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007276 if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) ||
7277 (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) ||
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007278 (sme_cfg_set_int((WLAN_HDD_GET_CTX(adapter))->hHal,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007279 WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307280 set_value) == QDF_STATUS_E_FAILURE)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007281 hdd_err("WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007282 ret = -EINVAL;
7283 }
7284 break;
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05307285 case WE_SET_WOW_DATA_INACTIVITY_TO:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307286 if (!hHal) {
7287 ret = -EINVAL;
7288 goto free;
7289 }
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05307290
7291 if ((set_value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) ||
7292 (set_value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX) ||
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007293 (sme_cfg_set_int((WLAN_HDD_GET_CTX(adapter))->hHal,
Mukul Sharmaed92f2f2017-04-20 00:06:28 +05307294 WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT,
7295 set_value) == QDF_STATUS_E_FAILURE)) {
7296 hdd_err("WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT fail");
7297 ret = -EINVAL;
7298 }
7299 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007300 case WE_SET_MC_RATE:
7301 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307302 if (!hHal)
7303 return -EINVAL;
7304
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007305 ret = wlan_hdd_set_mc_rate(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007306 break;
7307 }
7308 case WE_SET_TX_POWER:
7309 {
Anurag Chouhan6d760662016-02-20 16:05:43 +05307310 struct qdf_mac_addr bssid;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007311
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307312 if (!hHal)
7313 return -EINVAL;
7314
Jeff Johnsond377dce2017-10-04 10:32:42 -07007315 qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007316 if (sme_set_tx_power
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007317 (hHal, adapter->sessionId, bssid,
7318 adapter->device_mode,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307319 set_value) != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007320 hdd_err("Setting tx power failed");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307321 ret = -EIO;
7322 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007323 }
7324 break;
7325 }
7326 case WE_SET_MAX_TX_POWER:
7327 {
Anurag Chouhan6d760662016-02-20 16:05:43 +05307328 struct qdf_mac_addr bssid;
7329 struct qdf_mac_addr selfMac;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007330
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307331 if (!hHal)
7332 return -EINVAL;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007333
7334 hdd_debug("Setting maximum tx power %d dBm",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007335 set_value);
Jeff Johnsond377dce2017-10-04 10:32:42 -07007336 qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId);
7337 qdf_copy_macaddr(&selfMac, &sta_ctx->conn_info.bssId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007338
7339 if (sme_set_max_tx_power(hHal, bssid, selfMac, set_value)
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307340 != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007341 hdd_err("Setting maximum tx power failed");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307342 ret = -EIO;
7343 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007344 }
7345
7346 break;
7347 }
7348 case WE_SET_MAX_TX_POWER_2_4:
7349 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007350 hdd_debug("Setting maximum tx power %d dBm for 2.4 GHz band",
Jeff Johnson99bac312016-06-28 10:38:18 -07007351 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007352 if (sme_set_max_tx_power_per_band(eCSR_BAND_24, set_value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307353 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007354 hdd_err("Setting max tx power failed for 2.4 GHz band");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307355 ret = -EIO;
7356 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007357 }
7358
7359 break;
7360 }
7361 case WE_SET_MAX_TX_POWER_5_0:
7362 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007363 hdd_debug("Setting maximum tx power %d dBm for 5.0 GHz band",
Jeff Johnson99bac312016-06-28 10:38:18 -07007364 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007365 if (sme_set_max_tx_power_per_band(eCSR_BAND_5G, set_value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307366 QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007367 hdd_err("Setting max tx power failed for 5.0 GHz band");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307368 ret = -EIO;
7369 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007370 }
7371
7372 break;
7373 }
7374 case WE_SET_HIGHER_DTIM_TRANSITION:
7375 {
7376 if (!((set_value == false) || (set_value == true))) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007377 hdd_err("Dynamic DTIM Incorrect data:%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007378 set_value);
7379 ret = -EINVAL;
7380 } else {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007381 if (adapter->higherDtimTransition != set_value) {
7382 adapter->higherDtimTransition =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007383 set_value;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007384 hdd_debug("higherDtimTransition set to :%d",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007385 adapter->higherDtimTransition);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007386 }
7387 }
7388
7389 break;
7390 }
7391
7392 case WE_SET_TM_LEVEL:
7393 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307394 if (!hHal)
7395 return -EINVAL;
7396
7397 hdd_notice("Set Thermal Mitigation Level %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007398 (void)sme_set_thermal_level(hHal, set_value);
7399 break;
7400 }
7401
7402 case WE_SET_PHYMODE:
7403 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007404 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson4f7f7c62017-10-05 08:53:41 -07007405
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307406 if (!hHal)
7407 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007408
7409 ret =
7410 wlan_hdd_update_phymode(dev, hHal, set_value,
7411 phddctx);
7412 break;
7413 }
7414
7415 case WE_SET_NSS:
7416 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307417 if (!hHal)
7418 return -EINVAL;
7419
7420 hdd_notice("Set NSS = %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007421 if ((set_value > 2) || (set_value <= 0)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007422 hdd_err("NSS greater than 2 not supported");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007423 ret = -EINVAL;
7424 } else {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307425 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007426 hdd_update_nss(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007427 set_value))
7428 ret = -EINVAL;
7429 }
7430 break;
7431 }
7432
7433 case WE_SET_GTX_HT_MCS:
7434 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007435 hdd_debug("WMI_VDEV_PARAM_GTX_HT_MCS %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007436 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007437 WMI_VDEV_PARAM_GTX_HT_MCS,
7438 set_value, GTX_CMD);
7439 break;
7440 }
7441
7442 case WE_SET_GTX_VHT_MCS:
7443 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007444 hdd_debug("WMI_VDEV_PARAM_GTX_VHT_MCS %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007445 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007446 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007447 WMI_VDEV_PARAM_GTX_VHT_MCS,
7448 set_value, GTX_CMD);
7449 break;
7450 }
7451
7452 case WE_SET_GTX_USRCFG:
7453 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007454 hdd_debug("WMI_VDEV_PARAM_GTX_USR_CFG %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007455 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007456 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007457 WMI_VDEV_PARAM_GTX_USR_CFG,
7458 set_value, GTX_CMD);
7459 break;
7460 }
7461
7462 case WE_SET_GTX_THRE:
7463 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007464 hdd_debug("WMI_VDEV_PARAM_GTX_THRE %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007465 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007466 WMI_VDEV_PARAM_GTX_THRE,
7467 set_value, GTX_CMD);
7468 break;
7469 }
7470
7471 case WE_SET_GTX_MARGIN:
7472 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007473 hdd_debug("WMI_VDEV_PARAM_GTX_MARGIN %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007474 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007475 WMI_VDEV_PARAM_GTX_MARGIN,
7476 set_value, GTX_CMD);
7477 break;
7478 }
7479
7480 case WE_SET_GTX_STEP:
7481 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007482 hdd_debug("WMI_VDEV_PARAM_GTX_STEP %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007483 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007484 WMI_VDEV_PARAM_GTX_STEP,
7485 set_value, GTX_CMD);
7486 break;
7487 }
7488
7489 case WE_SET_GTX_MINTPC:
7490 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007491 hdd_debug("WMI_VDEV_PARAM_GTX_MINTPC %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007492 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007493 WMI_VDEV_PARAM_GTX_MINTPC,
7494 set_value, GTX_CMD);
7495 break;
7496 }
7497
7498 case WE_SET_GTX_BWMASK:
7499 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007500 hdd_debug("WMI_VDEV_PARAM_GTX_BWMASK %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007501 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007502 WMI_VDEV_PARAM_GTX_BW_MASK,
7503 set_value, GTX_CMD);
7504 break;
7505 }
7506
7507 case WE_SET_LDPC:
7508 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307509 if (!hHal)
7510 return -EINVAL;
7511
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007512 ret = hdd_set_ldpc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007513 break;
7514 }
7515
7516 case WE_SET_TX_STBC:
7517 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307518 if (!hHal)
7519 return -EINVAL;
7520
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007521 ret = hdd_set_tx_stbc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007522 break;
7523 }
7524
7525 case WE_SET_RX_STBC:
7526 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307527 if (!hHal)
7528 return -EINVAL;
7529
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007530 ret = hdd_set_rx_stbc(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007531 break;
7532 }
7533
7534 case WE_SET_SHORT_GI:
7535 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307536 if (!hHal)
7537 return -EINVAL;
7538
7539 hdd_notice("WMI_VDEV_PARAM_SGI val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007540 ret = sme_update_ht_config(hHal, adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007541 WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
7542 set_value);
7543 if (ret)
Jeff Johnson99bac312016-06-28 10:38:18 -07007544 hdd_err("Failed to set ShortGI value");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007545 break;
7546 }
7547
7548 case WE_SET_RTSCTS:
7549 {
7550 uint32_t value;
7551
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307552 if (!hHal)
7553 return -EINVAL;
7554
7555 hdd_notice("WMI_VDEV_PARAM_ENABLE_RTSCTS val 0x%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007556 set_value);
7557
7558 if ((set_value & HDD_RTSCTS_EN_MASK) ==
7559 HDD_RTSCTS_ENABLE)
7560 value =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007561 (WLAN_HDD_GET_CTX(adapter))->config->
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007562 RTSThreshold;
7563 else if (((set_value & HDD_RTSCTS_EN_MASK) == 0)
7564 || ((set_value & HDD_RTSCTS_EN_MASK) ==
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307565 HDD_CTS_ENABLE)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007566 value = WNI_CFG_RTS_THRESHOLD_STAMAX;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307567 } else {
7568 ret = -EIO;
7569 goto free;
7570 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007571
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007572 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007573 WMI_VDEV_PARAM_ENABLE_RTSCTS,
7574 set_value, VDEV_CMD);
7575 if (!ret) {
7576 if (sme_cfg_set_int
7577 (hHal, WNI_CFG_RTS_THRESHOLD, value) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05307578 QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007579 hdd_err("FAILED TO SET RTSCTS");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307580 ret = -EIO;
7581 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007582 }
7583 }
7584
7585 break;
7586 }
7587
7588 case WE_SET_CHWIDTH:
7589 {
7590 bool chwidth = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007591 struct hdd_context *phddctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson4f7f7c62017-10-05 08:53:41 -07007592
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05307593 if (!hHal)
7594 return -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007595
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007596 /*updating channel bonding only on 5Ghz */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007597 hdd_debug("WMI_VDEV_PARAM_CHWIDTH val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007598 set_value);
7599 if (set_value > eHT_CHANNEL_WIDTH_80MHZ) {
Jeff Johnson99bac312016-06-28 10:38:18 -07007600 hdd_err("Invalid channel width 0->20 1->40 2->80");
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307601 ret = -EINVAL;
7602 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007603 }
7604
7605 if ((WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
7606 csr_convert_cb_ini_value_to_phy_cb_state(phddctx->config->
7607 nChannelBondingMode5GHz)))
7608 chwidth = true;
7609
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307610 sme_get_config_param(hHal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007611 switch (set_value) {
7612 case eHT_CHANNEL_WIDTH_20MHZ:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307613 sme_config->csrConfig.channelBondingMode5GHz =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007614 WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
7615 break;
7616 case eHT_CHANNEL_WIDTH_40MHZ:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307617 if (chwidth) {
7618 sme_config->csrConfig.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007619 channelBondingMode5GHz =
7620 phddctx->config->
7621 nChannelBondingMode5GHz;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307622 } else {
7623 ret = -EINVAL;
7624 goto free;
7625 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007626
7627 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007628 case eHT_CHANNEL_WIDTH_80MHZ:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307629 if (chwidth) {
7630 sme_config->csrConfig.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007631 channelBondingMode5GHz =
7632 phddctx->config->
7633 nChannelBondingMode5GHz;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307634 } else {
7635 ret = -EINVAL;
7636 goto free;
7637 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007638
7639 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007640
7641 default:
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307642 ret = -EINVAL;
7643 goto free;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007644 }
7645
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007646 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007647 WMI_VDEV_PARAM_CHWIDTH,
7648 set_value, VDEV_CMD);
7649 if (!ret)
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05307650 sme_update_config(hHal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007651
7652 break;
7653 }
7654
7655 case WE_SET_ANI_EN_DIS:
7656 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007657 hdd_debug("WMI_PDEV_PARAM_ANI_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007658 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007659 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007660 WMI_PDEV_PARAM_ANI_ENABLE,
7661 set_value, PDEV_CMD);
7662 break;
7663 }
7664
7665 case WE_SET_ANI_POLL_PERIOD:
7666 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007667 hdd_debug("WMI_PDEV_PARAM_ANI_POLL_PERIOD val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007668 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007669 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007670 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
7671 set_value, PDEV_CMD);
7672 break;
7673 }
7674
7675 case WE_SET_ANI_LISTEN_PERIOD:
7676 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007677 hdd_debug("WMI_PDEV_PARAM_ANI_LISTEN_PERIOD val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007678 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007679 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007680 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
7681 set_value, PDEV_CMD);
7682 break;
7683 }
7684
7685 case WE_SET_ANI_OFDM_LEVEL:
7686 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007687 hdd_debug("WMI_PDEV_PARAM_ANI_OFDM_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007688 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007689 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007690 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
7691 set_value, PDEV_CMD);
7692 break;
7693 }
7694
7695 case WE_SET_ANI_CCK_LEVEL:
7696 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007697 hdd_debug("WMI_PDEV_PARAM_ANI_CCK_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007698 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007699 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007700 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
7701 set_value, PDEV_CMD);
7702 break;
7703 }
7704
7705 case WE_SET_DYNAMIC_BW:
7706 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007707 hdd_debug("WMI_PDEV_PARAM_DYNAMIC_BW val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007708 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007709 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007710 WMI_PDEV_PARAM_DYNAMIC_BW,
7711 set_value, PDEV_CMD);
7712 break;
7713 }
7714
7715 case WE_SET_CTS_CBW:
7716 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007717 hdd_debug("WE_SET_CTS_CBW val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007718 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007719 WMI_PDEV_PARAM_CTS_CBW,
7720 set_value, PDEV_CMD);
7721 break;
7722 }
7723
7724 case WE_SET_11N_RATE:
7725 {
7726 uint8_t preamble = 0, nss = 0, rix = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07007727
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007728 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007729 set_value);
7730
7731 if (set_value != 0xff) {
7732 rix = RC_2_RATE_IDX(set_value);
7733 if (set_value & 0x80) {
7734 preamble = WMI_RATE_PREAMBLE_HT;
7735 nss = HT_RC_2_STREAMS(set_value) - 1;
7736 } else {
7737 nss = 0;
7738 rix = RC_2_RATE_IDX(set_value);
7739 if (set_value & 0x10) {
7740 preamble =
7741 WMI_RATE_PREAMBLE_CCK;
7742 if (rix != 0x3)
7743 /* Enable Short
7744 * preamble always for
7745 * CCK except 1mbps
7746 */
7747 rix |= 0x4;
7748 } else {
7749 preamble =
7750 WMI_RATE_PREAMBLE_OFDM;
7751 }
7752 }
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08007753 set_value = hdd_assemble_rate_code(preamble, nss, rix);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007754 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007755 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007756 set_value, rix, preamble, nss);
7757
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007758 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007759 WMI_VDEV_PARAM_FIXED_RATE,
7760 set_value, VDEV_CMD);
7761 break;
7762 }
7763
7764 case WE_SET_VHT_RATE:
7765 {
7766 uint8_t preamble = 0, nss = 0, rix = 0;
7767
7768 if (set_value != 0xff) {
7769 rix = RC_2_RATE_IDX_11AC(set_value);
7770 preamble = WMI_RATE_PREAMBLE_VHT;
7771 nss = HT_RC_2_STREAMS_11AC(set_value) - 1;
7772
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08007773 set_value = hdd_assemble_rate_code(preamble, nss, rix);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007774 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007775 hdd_debug("WMI_VDEV_PARAM_FIXED_RATE val %d rix %d preamble %x nss %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007776 set_value, rix, preamble, nss);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007777 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007778 WMI_VDEV_PARAM_FIXED_RATE,
7779 set_value, VDEV_CMD);
7780 break;
7781 }
7782
7783 case WE_SET_AMPDU:
7784 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007785 hdd_debug("SET AMPDU val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007786 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007787 GEN_VDEV_PARAM_AMPDU,
7788 set_value, GEN_CMD);
7789 break;
7790 }
7791
7792 case WE_SET_AMSDU:
7793 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007794 hdd_debug("SET AMSDU val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007795 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007796 GEN_VDEV_PARAM_AMSDU,
7797 set_value, GEN_CMD);
Deepak Dhamdhere612392c2016-08-28 02:56:51 -07007798 /* Update the stored ini value */
7799 if (!ret)
7800 hdd_ctx->config->max_amsdu_num = set_value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007801 break;
7802 }
7803
7804 case WE_SET_BURST_ENABLE:
7805 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007806 hdd_debug("SET Burst enable val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007807 if ((set_value == 0) || (set_value == 1)) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007808 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007809 WMI_PDEV_PARAM_BURST_ENABLE,
7810 set_value, PDEV_CMD);
7811 } else
7812 ret = -EINVAL;
7813 break;
7814 }
7815 case WE_SET_BURST_DUR:
7816 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007817 hdd_debug("SET Burst duration val %d", set_value);
Jeff Johnsonda5ee772016-08-04 17:18:47 -07007818 if ((set_value > 0) && (set_value <= 102400))
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007819 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007820 WMI_PDEV_PARAM_BURST_DUR,
7821 set_value, PDEV_CMD);
7822 else
7823 ret = -EINVAL;
7824 break;
7825 }
7826
7827 case WE_SET_TX_CHAINMASK:
7828 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007829 hdd_debug("WMI_PDEV_PARAM_TX_CHAIN_MASK val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007830 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007831 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007832 WMI_PDEV_PARAM_TX_CHAIN_MASK,
7833 set_value, PDEV_CMD);
7834 break;
7835 }
7836
7837 case WE_SET_RX_CHAINMASK:
7838 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007839 hdd_debug("WMI_PDEV_PARAM_RX_CHAIN_MASK val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007840 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007841 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007842 WMI_PDEV_PARAM_RX_CHAIN_MASK,
7843 set_value, PDEV_CMD);
7844 break;
7845 }
7846
7847 case WE_SET_TXPOW_2G:
7848 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007849 hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT2G val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007850 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007851 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007852 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
7853 set_value, PDEV_CMD);
7854 break;
7855 }
7856
7857 case WE_SET_TXPOW_5G:
7858 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007859 hdd_debug("WMI_PDEV_PARAM_TXPOWER_LIMIT5G val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007860 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007861 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007862 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
7863 set_value, PDEV_CMD);
7864 break;
7865 }
7866
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007867 /* Firmware debug log */
7868 case WE_DBGLOG_LOG_LEVEL:
7869 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007870 hdd_debug("WE_DBGLOG_LOG_LEVEL val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007871 hdd_ctx->fw_log_settings.dl_loglevel = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007872 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007873 WMI_DBGLOG_LOG_LEVEL,
7874 set_value, DBG_CMD);
7875 break;
7876 }
7877
7878 case WE_DBGLOG_VAP_ENABLE:
7879 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007880 hdd_debug("WE_DBGLOG_VAP_ENABLE val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007881 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007882 WMI_DBGLOG_VAP_ENABLE,
7883 set_value, DBG_CMD);
7884 break;
7885 }
7886
7887 case WE_DBGLOG_VAP_DISABLE:
7888 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007889 hdd_debug("WE_DBGLOG_VAP_DISABLE val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007890 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007891 WMI_DBGLOG_VAP_DISABLE,
7892 set_value, DBG_CMD);
7893 break;
7894 }
7895
7896 case WE_DBGLOG_MODULE_ENABLE:
7897 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007898 hdd_debug("WE_DBGLOG_MODULE_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007899 set_value);
7900 hdd_ctx->fw_log_settings.enable = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007901 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007902 WMI_DBGLOG_MODULE_ENABLE,
7903 set_value, DBG_CMD);
7904 break;
7905 }
7906
7907 case WE_DBGLOG_MODULE_DISABLE:
7908 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007909 hdd_debug("WE_DBGLOG_MODULE_DISABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007910 set_value);
7911 hdd_ctx->fw_log_settings.enable = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007912 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007913 WMI_DBGLOG_MODULE_DISABLE,
7914 set_value, DBG_CMD);
7915 break;
7916 }
7917 case WE_DBGLOG_MOD_LOG_LEVEL:
7918 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007919 hdd_debug("WE_DBGLOG_MOD_LOG_LEVEL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007920 set_value);
7921
7922 if (hdd_ctx->fw_log_settings.index >= MAX_MOD_LOGLEVEL)
7923 hdd_ctx->fw_log_settings.index = 0;
7924
7925 hdd_ctx->fw_log_settings.
7926 dl_mod_loglevel[hdd_ctx->fw_log_settings.index] =
7927 set_value;
7928 hdd_ctx->fw_log_settings.index++;
7929
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007930 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007931 WMI_DBGLOG_MOD_LOG_LEVEL,
7932 set_value, DBG_CMD);
7933 break;
7934 }
7935
7936 case WE_DBGLOG_TYPE:
7937 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007938 hdd_debug("WE_DBGLOG_TYPE val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007939 hdd_ctx->fw_log_settings.dl_type = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007940 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007941 WMI_DBGLOG_TYPE,
7942 set_value, DBG_CMD);
7943 break;
7944 }
7945 case WE_DBGLOG_REPORT_ENABLE:
7946 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007947 hdd_debug("WE_DBGLOG_REPORT_ENABLE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007948 set_value);
7949 hdd_ctx->fw_log_settings.dl_report = set_value;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007950 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007951 WMI_DBGLOG_REPORT_ENABLE,
7952 set_value, DBG_CMD);
7953 break;
7954 }
7955
7956 case WE_SET_TXRX_FWSTATS:
7957 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007958 hdd_debug("WE_SET_TXRX_FWSTATS val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007959 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007960 WMA_VDEV_TXRX_FWSTATS_ENABLE_CMDID,
7961 set_value, VDEV_CMD);
7962 break;
7963 }
7964
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007965 case WE_SET_TXRX_STATS:
7966 {
7967 hdd_notice("WE_SET_TXRX_STATS val %d", set_value);
7968 ret = cds_get_datapath_handles(&soc, &pdev, &vdev,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007969 adapter->sessionId);
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007970
Venkata Sharath Chandra Manchalabcdfdb12017-03-29 19:25:45 -07007971 if (ret != 0) {
7972 QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
7973 "Invalid handles");
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007974 break;
Venkata Sharath Chandra Manchalabcdfdb12017-03-29 19:25:45 -07007975 }
7976 ret = cdp_txrx_stats(soc, vdev, set_value);
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -08007977 break;
7978 }
7979
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007980 case WE_TXRX_FWSTATS_RESET:
7981 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007982 hdd_debug("WE_TXRX_FWSTATS_RESET val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007983 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007984 WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
7985 set_value, VDEV_CMD);
7986 break;
7987 }
7988
7989 case WE_DUMP_STATS:
7990 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007991 hdd_debug("WE_DUMP_STATS val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07007992 ret = hdd_wlan_dump_stats(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007993 break;
7994 }
7995
7996 case WE_CLEAR_STATS:
7997 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08007998 hdd_debug("WE_CLEAR_STATS val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08007999 switch (set_value) {
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07008000 case CDP_HDD_STATS:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008001 memset(&adapter->stats, 0, sizeof(adapter->stats));
8002 memset(&adapter->hdd_stats, 0,
8003 sizeof(adapter->hdd_stats));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008004 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07008005 case CDP_TXRX_HIST_STATS:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008006 wlan_hdd_clear_tx_rx_histogram(hdd_ctx);
8007 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07008008 case CDP_HDD_NETIF_OPER_HISTORY:
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008009 wlan_hdd_clear_netif_queue_history(hdd_ctx);
8010 break;
Venkata Sharath Chandra Manchala71032b62017-03-29 12:30:45 -07008011 case CDP_HIF_STATS:
Nirav Shahbf1b0332016-05-25 14:27:39 +05308012 hdd_clear_hif_stats();
8013 break;
Yun Park1027e8c2017-10-13 15:17:37 -07008014 case CDP_NAPI_STATS:
8015 hdd_clear_napi_stats();
8016 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008017 default:
Leo Changfdb45c32016-10-28 11:09:23 -07008018 cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC),
8019 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008020 }
8021 break;
8022 }
8023
8024 case WE_PPS_PAID_MATCH:
8025 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008026 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308027 ret = -EINVAL;
8028 goto free;
8029 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008030
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008031 hdd_debug("WMI_VDEV_PPS_PAID_MATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008032 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008033 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008034 WMI_VDEV_PPS_PAID_MATCH,
8035 set_value, PPS_CMD);
8036 break;
8037 }
8038
8039 case WE_PPS_GID_MATCH:
8040 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008041 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308042 ret = -EINVAL;
8043 goto free;
8044 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008045 hdd_debug("WMI_VDEV_PPS_GID_MATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008046 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008047 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008048 WMI_VDEV_PPS_GID_MATCH,
8049 set_value, PPS_CMD);
8050 break;
8051 }
8052
8053 case WE_PPS_EARLY_TIM_CLEAR:
8054 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008055 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308056 ret = -EINVAL;
8057 goto free;
8058 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008059 hdd_debug(" WMI_VDEV_PPS_EARLY_TIM_CLEAR val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008060 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008061 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008062 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
8063 set_value, PPS_CMD);
8064 break;
8065 }
8066
8067 case WE_PPS_EARLY_DTIM_CLEAR:
8068 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008069 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308070 ret = -EINVAL;
8071 goto free;
8072 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008073 hdd_debug("WMI_VDEV_PPS_EARLY_DTIM_CLEAR val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008074 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008075 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008076 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
8077 set_value, PPS_CMD);
8078 break;
8079 }
8080
8081 case WE_PPS_EOF_PAD_DELIM:
8082 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008083 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308084 ret = -EINVAL;
8085 goto free;
8086 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008087 hdd_debug("WMI_VDEV_PPS_EOF_PAD_DELIM val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008088 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008089 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008090 WMI_VDEV_PPS_EOF_PAD_DELIM,
8091 set_value, PPS_CMD);
8092 break;
8093 }
8094
8095 case WE_PPS_MACADDR_MISMATCH:
8096 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008097 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308098 ret = -EINVAL;
8099 goto free;
8100 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008101 hdd_debug("WMI_VDEV_PPS_MACADDR_MISMATCH val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008102 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008103 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008104 WMI_VDEV_PPS_MACADDR_MISMATCH,
8105 set_value, PPS_CMD);
8106 break;
8107 }
8108
8109 case WE_PPS_DELIM_CRC_FAIL:
8110 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008111 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308112 ret = -EINVAL;
8113 goto free;
8114 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008115 hdd_debug("WMI_VDEV_PPS_DELIM_CRC_FAIL val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008116 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008117 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008118 WMI_VDEV_PPS_DELIM_CRC_FAIL,
8119 set_value, PPS_CMD);
8120 break;
8121 }
8122
8123 case WE_PPS_GID_NSTS_ZERO:
8124 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008125 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308126 ret = -EINVAL;
8127 goto free;
8128 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008129 hdd_debug("WMI_VDEV_PPS_GID_NSTS_ZERO val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008130 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008131 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008132 WMI_VDEV_PPS_GID_NSTS_ZERO,
8133 set_value, PPS_CMD);
8134 break;
8135 }
8136
8137 case WE_PPS_RSSI_CHECK:
8138 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008139 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308140 ret = -EINVAL;
8141 goto free;
8142 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008143 hdd_debug("WMI_VDEV_PPS_RSSI_CHECK val %d ",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008144 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008145 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008146 WMI_VDEV_PPS_RSSI_CHECK,
8147 set_value, PPS_CMD);
8148 break;
8149 }
8150
8151 case WE_PPS_5G_EBT:
8152 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008153 if (adapter->device_mode != QDF_STA_MODE) {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308154 ret = -EINVAL;
8155 goto free;
8156 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008157
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008158 hdd_debug("WMI_VDEV_PPS_5G_EBT val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008159 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008160 WMI_VDEV_PPS_5G_EBT,
8161 set_value, PPS_CMD);
8162 break;
8163 }
8164
8165 case WE_SET_HTSMPS:
8166 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008167 hdd_debug("WE_SET_HTSMPS val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008168 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008169 WMI_STA_SMPS_FORCE_MODE_CMDID,
8170 set_value, VDEV_CMD);
8171 break;
8172 }
8173
8174 case WE_SET_QPOWER_MAX_PSPOLL_COUNT:
8175 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008176 hdd_debug("WE_SET_QPOWER_MAX_PSPOLL_COUNT val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008177 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008178 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008179 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
8180 set_value, QPOWER_CMD);
8181 break;
8182 }
8183
8184 case WE_SET_QPOWER_MAX_TX_BEFORE_WAKE:
8185 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008186 hdd_debug("WE_SET_QPOWER_MAX_TX_BEFORE_WAKE val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008187 set_value);
8188 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008189 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008190 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
8191 set_value, QPOWER_CMD);
8192 break;
8193 }
8194
8195 case WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
8196 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008197 hdd_debug("WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008198 set_value);
8199 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008200 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008201 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
8202 set_value, QPOWER_CMD);
8203 break;
8204 }
8205
8206 case WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
8207 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008208 hdd_debug("WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008209 set_value);
8210 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008211 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008212 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
8213 set_value, QPOWER_CMD);
8214 break;
8215 }
8216
8217 case WE_MCC_CONFIG_LATENCY:
8218 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008219 wlan_hdd_set_mcc_latency(adapter, set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008220 break;
8221 }
8222
8223 case WE_MCC_CONFIG_QUOTA:
8224 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008225 hdd_debug("iwpriv cmd to set MCC quota with val %dms",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008226 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008227 ret = wlan_hdd_set_mcc_p2p_quota(adapter,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08008228 set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008229 break;
8230 }
8231 case WE_SET_DEBUG_LOG:
8232 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008233 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson4f7f7c62017-10-05 08:53:41 -07008234
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05308235 if (!hHal)
8236 return -EINVAL;
8237
Nirav Shah1da77682016-05-03 20:16:39 +05308238
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008239 hdd_ctx->config->gEnableDebugLog = set_value;
8240 sme_update_connect_debug(hdd_ctx->hHal, set_value);
8241 break;
8242 }
8243 case WE_SET_EARLY_RX_ADJUST_ENABLE:
8244 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008245 hdd_debug("SET early_rx enable val %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008246 if ((set_value == 0) || (set_value == 1))
8247 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008248 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008249 WMI_VDEV_PARAM_EARLY_RX_ADJUST_ENABLE,
8250 set_value, VDEV_CMD);
8251 else
8252 ret = -EINVAL;
8253 break;
8254 }
8255 case WE_SET_EARLY_RX_TGT_BMISS_NUM:
8256 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008257 hdd_debug("SET early_rx bmiss val %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008258 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008259 WMI_VDEV_PARAM_EARLY_RX_TGT_BMISS_NUM,
8260 set_value, VDEV_CMD);
8261 break;
8262 }
8263 case WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE:
8264 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008265 hdd_debug("SET early_rx bmiss sample cycle %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008266 set_value);
8267 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008268 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008269 WMI_VDEV_PARAM_EARLY_RX_BMISS_SAMPLE_CYCLE,
8270 set_value, VDEV_CMD);
8271 break;
8272 }
8273 case WE_SET_EARLY_RX_SLOP_STEP:
8274 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008275 hdd_debug("SET early_rx bmiss slop step val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008276 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008277 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008278 WMI_VDEV_PARAM_EARLY_RX_SLOP_STEP,
8279 set_value, VDEV_CMD);
8280 break;
8281 }
8282 case WE_SET_EARLY_RX_INIT_SLOP:
8283 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008284 hdd_debug("SET early_rx init slop step val %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008285 set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008286 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008287 WMI_VDEV_PARAM_EARLY_RX_INIT_SLOP,
8288 set_value, VDEV_CMD);
8289 break;
8290 }
8291 case WE_SET_EARLY_RX_ADJUST_PAUSE:
8292 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008293 hdd_debug("SET early_rx adjust pause %d", set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008294 if ((set_value == 0) || (set_value == 1))
8295 ret = wma_cli_set_command(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008296 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008297 WMI_VDEV_PARAM_EARLY_RX_ADJUST_PAUSE,
8298 set_value, VDEV_CMD);
8299 else
8300 ret = -EINVAL;
8301 break;
8302 }
8303 case WE_SET_EARLY_RX_DRIFT_SAMPLE:
8304 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008305 hdd_debug("SET early_rx drift sample %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008306 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008307 WMI_VDEV_PARAM_EARLY_RX_DRIFT_SAMPLE,
8308 set_value, VDEV_CMD);
8309 break;
8310 }
8311 case WE_SET_SCAN_DISABLE:
8312 {
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05308313 if (!hHal)
8314 return -EINVAL;
8315
8316 hdd_notice("SET SCAN DISABLE %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008317 sme_set_scan_disable(WLAN_HDD_GET_HAL_CTX(adapter), set_value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008318 break;
8319 }
Govind Singha471e5e2015-10-12 17:11:14 +05308320 case WE_START_FW_PROFILE:
8321 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008322 hdd_debug("WE_START_FW_PROFILE %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008323 ret = wma_cli_set_command(adapter->sessionId,
Govind Singha471e5e2015-10-12 17:11:14 +05308324 WMI_WLAN_PROFILE_TRIGGER_CMDID,
8325 set_value, DBG_CMD);
8326 break;
8327 }
Abhishek Singh1bdb1572015-10-16 16:24:19 +05308328 case WE_SET_CHANNEL:
8329 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008330 hdd_debug("Set Channel %d Session ID %d mode %d", set_value,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008331 adapter->sessionId, adapter->device_mode);
SaidiReddy Yenuga8cbd9212017-02-15 15:35:29 +05308332 if (!hHal)
8333 return -EINVAL;
8334
Abhishek Singh1bdb1572015-10-16 16:24:19 +05308335
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008336 if ((QDF_STA_MODE == adapter->device_mode) ||
8337 (QDF_P2P_CLIENT_MODE == adapter->device_mode)) {
Abhishek Singh1bdb1572015-10-16 16:24:19 +05308338
8339 status = sme_ext_change_channel(hHal,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008340 set_value, adapter->sessionId);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308341 if (status != QDF_STATUS_SUCCESS) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008342 hdd_err("Error in change channel status %d",
Abhishek Singh1bdb1572015-10-16 16:24:19 +05308343 status);
8344 ret = -EINVAL;
8345 }
8346 } else {
Jeff Johnson99bac312016-06-28 10:38:18 -07008347 hdd_err("change channel not supported for device mode %d",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008348 adapter->device_mode);
Abhishek Singh1bdb1572015-10-16 16:24:19 +05308349 ret = -EINVAL;
8350 }
8351 break;
8352 }
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05308353 case WE_SET_CONC_SYSTEM_PREF:
8354 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008355 hdd_debug("New preference: %d", set_value);
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05308356 if (!((set_value >= CFG_CONC_SYSTEM_PREF_MIN) &&
8357 (set_value <= CFG_CONC_SYSTEM_PREF_MAX))) {
8358 hdd_err("Invalid system preference %d", set_value);
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308359 ret = -EINVAL;
8360 goto free;
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05308361 }
Abhishek Singh1bdb1572015-10-16 16:24:19 +05308362
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +05308363 /* hdd_ctx, hdd_ctx->config are already checked for null */
8364 hdd_ctx->config->conc_system_pref = set_value;
8365 break;
8366 }
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08008367 case WE_SET_11AX_RATE:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008368 ret = hdd_set_11ax_rate(adapter, set_value, NULL);
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -08008369 break;
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07008370 case WE_SET_DCM:
8371 hdd_notice("Set WMI_VDEV_PARAM_HE_DCM: %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008372 ret = wma_cli_set_command(adapter->sessionId,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07008373 WMI_VDEV_PARAM_HE_DCM, set_value,
8374 VDEV_CMD);
8375 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07008376 case WE_SET_RANGE_EXT:
8377 hdd_notice("Set WMI_VDEV_PARAM_HE_RANGE_EXT: %d", set_value);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008378 ret = wma_cli_set_command(adapter->sessionId,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07008379 WMI_VDEV_PARAM_HE_RANGE_EXT,
8380 set_value, VDEV_CMD);
8381 break;
Jeff Johnson011c4502017-10-05 15:25:56 -07008382 case WE_SET_PDEV_RESET:
8383 ret = hdd_handle_pdev_reset(adapter, set_value);
8384 break;
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +05308385 case WE_SET_MODULATED_DTIM:
8386 {
8387 if ((set_value < CFG_ENABLE_MODULATED_DTIM_MIN) ||
8388 (set_value > CFG_ENABLE_MODULATED_DTIM_MAX)) {
8389 hdd_err("Invalid gEnableModuleDTIM value %d",
8390 set_value);
8391 return -EINVAL;
8392 } else {
8393 hdd_ctx->config->enableModulatedDTIM = set_value;
8394 }
8395 break;
8396 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008397 default:
Jeff Johnson011c4502017-10-05 15:25:56 -07008398 hdd_err("Invalid sub command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008399 ret = -EINVAL;
8400 break;
8401 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308402 EXIT();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308403free:
8404 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008405 return ret;
8406}
8407
8408static int iw_setint_getnone(struct net_device *dev,
8409 struct iw_request_info *info,
8410 union iwreq_data *wrqu,
8411 char *extra)
8412{
8413 int ret;
8414
8415 cds_ssr_protect(__func__);
8416 ret = __iw_setint_getnone(dev, info, wrqu, extra);
8417 cds_ssr_unprotect(__func__);
8418
8419 return ret;
8420}
8421
8422/**
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07008423 * __iw_setnone_get_threeint() - return three value to up layer.
8424 *
8425 * @dev: pointer of net_device of this wireless card
8426 * @info: meta data about Request sent
8427 * @wrqu: include request info
8428 * @extra: buf used for in/Output
8429 *
8430 * Return: execute result
8431 */
8432static int __iw_setnone_get_threeint(struct net_device *dev,
8433 struct iw_request_info *info,
8434 union iwreq_data *wrqu, char *extra)
8435{
8436 int ret = 0; /* success */
8437 uint32_t *value = (int *)extra;
Jeff Johnson3d278b02017-08-29 14:17:47 -07008438 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008439 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07008440
8441 ENTER_DEV(dev);
8442 ret = wlan_hdd_validate_context(hdd_ctx);
8443 if (0 != ret)
8444 return ret;
8445
Jeff Johnson441e1f72017-02-07 08:50:49 -08008446 ret = hdd_check_private_wext_control(hdd_ctx, info);
8447 if (0 != ret)
8448 return ret;
8449
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008450 hdd_debug("param = %d", value[0]);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07008451 switch (value[0]) {
8452 case WE_GET_TSF:
8453 ret = hdd_indicate_tsf(adapter, value, 3);
8454 break;
8455 default:
8456 hdd_err("Invalid IOCTL get_value command %d", value[0]);
8457 break;
8458 }
8459 return ret;
8460}
8461
8462/**
8463 * iw_setnone_get_threeint() - return three value to up layer.
8464 *
8465 * @dev: pointer of net_device of this wireless card
8466 * @info: meta data about Request sent
8467 * @wrqu: include request info
8468 * @extra: buf used for in/Output
8469 *
8470 * Return: execute result
8471 */
8472static int iw_setnone_get_threeint(struct net_device *dev,
8473 struct iw_request_info *info,
8474 union iwreq_data *wrqu, char *extra)
8475{
8476 int ret;
8477
8478 cds_ssr_protect(__func__);
8479 ret = __iw_setnone_get_threeint(dev, info, wrqu, extra);
8480 cds_ssr_unprotect(__func__);
8481
8482 return ret;
8483}
8484
8485/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008486 * iw_setchar_getnone() - Generic "set string" private ioctl handler
8487 * @dev: device upon which the ioctl was received
8488 * @info: ioctl request information
8489 * @wrqu: ioctl request data
8490 * @extra: ioctl extra data
8491 *
8492 * Return: 0 on success, non-zero on error
8493 */
8494static int __iw_setchar_getnone(struct net_device *dev,
8495 struct iw_request_info *info,
8496 union iwreq_data *wrqu, char *extra)
8497{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308498 QDF_STATUS vstatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008499 int sub_cmd;
8500 int ret;
8501 char *pBuffer = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008502 struct hdd_adapter *adapter = (netdev_priv(dev));
8503 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008504 struct hdd_config *pConfig = hdd_ctx->config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008505 struct iw_point s_priv_data;
8506
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08008507 ENTER_DEV(dev);
8508
Mukul Sharma34777c62015-11-02 20:22:30 +05308509 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008510 hdd_err("permission check failed");
Mukul Sharma34777c62015-11-02 20:22:30 +05308511 return -EPERM;
8512 }
8513
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008514 ret = wlan_hdd_validate_context(hdd_ctx);
8515 if (0 != ret)
8516 return ret;
8517
Jeff Johnson441e1f72017-02-07 08:50:49 -08008518 ret = hdd_check_private_wext_control(hdd_ctx, info);
8519 if (0 != ret)
8520 return ret;
8521
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008522 /* helper function to get iwreq_data with compat handling. */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008523 if (hdd_priv_get_data(&s_priv_data, wrqu))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008524 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008525
8526 /* make sure all params are correctly passed to function */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008527 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008528 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008529
8530 sub_cmd = s_priv_data.flags;
8531
8532 /* ODD number is used for set, copy data using copy_from_user */
8533 pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
8534 s_priv_data.length);
8535 if (NULL == pBuffer) {
Jeff Johnson99bac312016-06-28 10:38:18 -07008536 hdd_err("mem_alloc_copy_from_user_helper fail");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008537 return -ENOMEM;
8538 }
8539
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008540 hdd_debug("Received length: %d data: %s",
8541 s_priv_data.length, pBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008542
8543 switch (sub_cmd) {
8544 case WE_WOWL_ADD_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008545 hdd_debug("ADD_PTRN");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008546 hdd_add_wowl_ptrn(adapter, pBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008547 break;
8548 case WE_WOWL_DEL_PTRN:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008549 hdd_debug("DEL_PTRN");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008550 hdd_del_wowl_ptrn(adapter, pBuffer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008551 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008552 case WE_NEIGHBOR_REPORT_REQUEST:
8553 {
8554 tRrmNeighborReq neighborReq;
8555 tRrmNeighborRspCallbackInfo callbackInfo;
8556
8557 if (pConfig->fRrmEnable) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008558 hdd_debug("Neighbor Request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008559 neighborReq.no_ssid =
8560 (s_priv_data.length - 1) ? false : true;
8561 if (!neighborReq.no_ssid) {
8562 neighborReq.ssid.length =
8563 (s_priv_data.length - 1) >
8564 32 ? 32 : (s_priv_data.length - 1);
Anurag Chouhan600c3a02016-03-01 10:33:54 +05308565 qdf_mem_copy(neighborReq.ssid.ssId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008566 pBuffer,
8567 neighborReq.ssid.length);
8568 }
8569
8570 callbackInfo.neighborRspCallback = NULL;
8571 callbackInfo.neighborRspCallbackContext = NULL;
8572 callbackInfo.timeout = 5000; /* 5 seconds */
8573 sme_neighbor_report_request(WLAN_HDD_GET_HAL_CTX
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008574 (adapter),
8575 adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008576 &neighborReq,
8577 &callbackInfo);
8578 } else {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008579 hdd_err("Ignoring neighbor request as RRM not enabled");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008580 ret = -EINVAL;
8581 }
8582 }
8583 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008584 case WE_SET_AP_WPS_IE:
Wu Gao02bd75b2017-10-13 18:34:02 +08008585 hdd_debug("Received WE_SET_AP_WPS_IE, won't process");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008586 break;
8587 case WE_SET_CONFIG:
8588 vstatus = hdd_execute_global_config_command(hdd_ctx, pBuffer);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008589 if (QDF_STATUS_SUCCESS != vstatus)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008590 ret = -EINVAL;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008591
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008592 break;
8593 default:
8594 {
Jeff Johnson99bac312016-06-28 10:38:18 -07008595 hdd_err("Invalid sub command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008596 sub_cmd);
8597 ret = -EINVAL;
8598 break;
8599 }
8600 }
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -07008601 qdf_mem_free(pBuffer);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308602 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008603 return ret;
8604}
8605
8606static int iw_setchar_getnone(struct net_device *dev,
8607 struct iw_request_info *info,
8608 union iwreq_data *wrqu, char *extra)
8609{
8610 int ret;
8611
8612 cds_ssr_protect(__func__);
8613 ret = __iw_setchar_getnone(dev, info, wrqu, extra);
8614 cds_ssr_unprotect(__func__);
8615
8616 return ret;
8617}
8618
8619/**
8620 * iw_setnone_getint() - Generic "get integer" private ioctl handler
8621 * @dev: device upon which the ioctl was received
8622 * @info: ioctl request information
8623 * @wrqu: ioctl request data
8624 * @extra: ioctl extra data
8625 *
8626 * Return: 0 on success, non-zero on error
8627 */
8628static int __iw_setnone_getint(struct net_device *dev,
8629 struct iw_request_info *info,
8630 union iwreq_data *wrqu, char *extra)
8631{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008632 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
8633 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008634 int *value = (int *)extra;
8635 int ret;
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308636 tSmeConfigParams *sme_config;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07008637 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008638
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308639 sme_config = qdf_mem_malloc(sizeof(*sme_config));
8640 if (!sme_config) {
8641 hdd_err("failed to allocate memory for sme_config");
8642 return -ENOMEM;
8643 }
8644 qdf_mem_zero(sme_config, sizeof(*sme_config));
8645
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08008646 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05308647
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008648 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008649 ret = wlan_hdd_validate_context(hdd_ctx);
8650 if (0 != ret)
8651 return ret;
8652
Jeff Johnson441e1f72017-02-07 08:50:49 -08008653 ret = hdd_check_private_wext_control(hdd_ctx, info);
8654 if (0 != ret)
8655 return ret;
8656
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008657 switch (value[0]) {
8658 case WE_GET_11D_STATE:
8659 {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308660 sme_get_config_param(hHal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008661
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308662 *value = sme_config->csrConfig.Is11dSupportEnabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008663
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008664 hdd_debug("11D state=%d!!", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008665
8666 break;
8667 }
8668
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008669 case WE_GET_WLAN_DBG:
8670 {
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05308671 qdf_trace_display();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008672 *value = 0;
8673 break;
8674 }
8675 case WE_GET_MAX_ASSOC:
8676 {
8677 if (sme_cfg_get_int
8678 (hHal, WNI_CFG_ASSOC_STA_LIMIT,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308679 (uint32_t *) value) != QDF_STATUS_SUCCESS) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008680 hdd_err("WNI_CFG_ASSOC_STA_LIMIT failed");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008681 ret = -EIO;
8682 }
8683 break;
8684 }
8685 case WE_GET_SAP_AUTO_CHANNEL_SELECTION:
8686 *value = (WLAN_HDD_GET_CTX(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008687 adapter))->config->force_sap_acs;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008688 break;
8689
8690 case WE_GET_CONCURRENCY_MODE:
8691 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08008692 *value = policy_mgr_get_concurrency_mode(hdd_ctx->hdd_psoc);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008693
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008694 hdd_debug("concurrency mode=%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008695 break;
8696 }
8697
8698 case WE_GET_NSS:
8699 {
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05308700 sme_get_config_param(hHal, sme_config);
8701 *value = (sme_config->csrConfig.enable2x2 == 0) ? 1 : 2;
Srinivas Girigowda576b2352017-08-25 14:44:26 -07008702 if (policy_mgr_is_current_hwmode_dbs(hdd_ctx->hdd_psoc))
8703 *value = *value - 1;
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008704 hdd_debug("GET_NSS: Current NSS:%d", *value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008705 break;
8706 }
8707
8708 case WE_GET_GTX_HT_MCS:
8709 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008710 hdd_debug("GET WMI_VDEV_PARAM_GTX_HT_MCS");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008711 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008712 WMI_VDEV_PARAM_GTX_HT_MCS,
8713 GTX_CMD);
8714 break;
8715 }
8716
8717 case WE_GET_GTX_VHT_MCS:
8718 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008719 hdd_debug("GET WMI_VDEV_PARAM_GTX_VHT_MCS");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008720 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008721 WMI_VDEV_PARAM_GTX_VHT_MCS,
8722 GTX_CMD);
8723 break;
8724 }
8725
8726 case WE_GET_GTX_USRCFG:
8727 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008728 hdd_debug("GET WMI_VDEV_PARAM_GTX_USR_CFG");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008729 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008730 WMI_VDEV_PARAM_GTX_USR_CFG,
8731 GTX_CMD);
8732 break;
8733 }
8734
8735 case WE_GET_GTX_THRE:
8736 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008737 hdd_debug("GET WMI_VDEV_PARAM_GTX_THRE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008738 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008739 WMI_VDEV_PARAM_GTX_THRE,
8740 GTX_CMD);
8741 break;
8742 }
8743
8744 case WE_GET_GTX_MARGIN:
8745 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008746 hdd_debug("GET WMI_VDEV_PARAM_GTX_MARGIN");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008747 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008748 WMI_VDEV_PARAM_GTX_MARGIN,
8749 GTX_CMD);
8750 break;
8751 }
8752
8753 case WE_GET_GTX_STEP:
8754 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008755 hdd_debug("GET WMI_VDEV_PARAM_GTX_STEP");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008756 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008757 WMI_VDEV_PARAM_GTX_STEP,
8758 GTX_CMD);
8759 break;
8760 }
8761
8762 case WE_GET_GTX_MINTPC:
8763 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008764 hdd_debug("GET WMI_VDEV_PARAM_GTX_MINTPC");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008765 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008766 WMI_VDEV_PARAM_GTX_MINTPC,
8767 GTX_CMD);
8768 break;
8769 }
8770
8771 case WE_GET_GTX_BWMASK:
8772 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008773 hdd_debug("GET WMI_VDEV_PARAM_GTX_BW_MASK");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008774 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008775 WMI_VDEV_PARAM_GTX_BW_MASK,
8776 GTX_CMD);
8777 break;
8778 }
8779
8780 case WE_GET_LDPC:
8781 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008782 ret = hdd_get_ldpc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008783 break;
8784 }
8785
8786 case WE_GET_TX_STBC:
8787 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008788 ret = hdd_get_tx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008789 break;
8790 }
8791
8792 case WE_GET_RX_STBC:
8793 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008794 ret = hdd_get_rx_stbc(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008795 break;
8796 }
8797
8798 case WE_GET_SHORT_GI:
8799 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008800 hdd_debug("GET WMI_VDEV_PARAM_SGI");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008801 *value = wma_cli_get_command(adapter->sessionId,
Krishna Kumaar Natarajana5c5aad2016-12-05 14:12:13 -08008802 WMI_VDEV_PARAM_SGI,
8803 VDEV_CMD);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008804 break;
8805 }
8806
8807 case WE_GET_RTSCTS:
8808 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008809 hdd_debug("GET WMI_VDEV_PARAM_ENABLE_RTSCTS");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008810 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008811 WMI_VDEV_PARAM_ENABLE_RTSCTS,
8812 VDEV_CMD);
8813 break;
8814 }
8815
8816 case WE_GET_CHWIDTH:
8817 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008818 hdd_debug("GET WMI_VDEV_PARAM_CHWIDTH");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008819 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008820 WMI_VDEV_PARAM_CHWIDTH,
8821 VDEV_CMD);
8822 break;
8823 }
8824
8825 case WE_GET_ANI_EN_DIS:
8826 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008827 hdd_debug("GET WMI_PDEV_PARAM_ANI_ENABLE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008828 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008829 WMI_PDEV_PARAM_ANI_ENABLE,
8830 PDEV_CMD);
8831 break;
8832 }
8833
8834 case WE_GET_ANI_POLL_PERIOD:
8835 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008836 hdd_debug("GET WMI_PDEV_PARAM_ANI_POLL_PERIOD");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008837 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008838 WMI_PDEV_PARAM_ANI_POLL_PERIOD,
8839 PDEV_CMD);
8840 break;
8841 }
8842
8843 case WE_GET_ANI_LISTEN_PERIOD:
8844 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008845 hdd_debug("GET WMI_PDEV_PARAM_ANI_LISTEN_PERIOD");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008846 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008847 WMI_PDEV_PARAM_ANI_LISTEN_PERIOD,
8848 PDEV_CMD);
8849 break;
8850 }
8851
8852 case WE_GET_ANI_OFDM_LEVEL:
8853 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008854 hdd_debug("GET WMI_PDEV_PARAM_ANI_OFDM_LEVEL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008855 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008856 WMI_PDEV_PARAM_ANI_OFDM_LEVEL,
8857 PDEV_CMD);
8858 break;
8859 }
8860
8861 case WE_GET_ANI_CCK_LEVEL:
8862 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008863 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008864 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008865 WMI_PDEV_PARAM_ANI_CCK_LEVEL,
8866 PDEV_CMD);
8867 break;
8868 }
8869
8870 case WE_GET_DYNAMIC_BW:
8871 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008872 hdd_debug("GET WMI_PDEV_PARAM_ANI_CCK_LEVEL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008873 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008874 WMI_PDEV_PARAM_DYNAMIC_BW,
8875 PDEV_CMD);
8876 break;
8877 }
8878
8879 case WE_GET_11N_RATE:
8880 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008881 hdd_debug("GET WMI_VDEV_PARAM_FIXED_RATE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008882 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008883 WMI_VDEV_PARAM_FIXED_RATE,
8884 VDEV_CMD);
8885 break;
8886 }
8887
8888 case WE_GET_AMPDU:
8889 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008890 hdd_debug("GET AMPDU");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008891 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008892 GEN_VDEV_PARAM_AMPDU,
8893 GEN_CMD);
8894 break;
8895 }
8896
8897 case WE_GET_AMSDU:
8898 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008899 hdd_debug("GET AMSDU");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008900 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008901 GEN_VDEV_PARAM_AMSDU,
8902 GEN_CMD);
8903 break;
8904 }
8905
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07008906 case WE_GET_ROAM_SYNCH_DELAY:
8907 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008908 hdd_debug("GET ROAM SYNCH DELAY");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008909 *value = wma_cli_get_command(adapter->sessionId,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -07008910 GEN_VDEV_ROAM_SYNCH_DELAY,
8911 GEN_CMD);
8912 break;
8913 }
8914
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008915 case WE_GET_BURST_ENABLE:
8916 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008917 hdd_debug("GET Burst enable value");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008918 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008919 WMI_PDEV_PARAM_BURST_ENABLE,
8920 PDEV_CMD);
8921 break;
8922 }
8923 case WE_GET_BURST_DUR:
8924 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008925 hdd_debug("GET Burst Duration value");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008926 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008927 WMI_PDEV_PARAM_BURST_DUR,
8928 PDEV_CMD);
8929 break;
8930 }
8931
8932 case WE_GET_TX_CHAINMASK:
8933 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008934 hdd_debug("GET WMI_PDEV_PARAM_TX_CHAIN_MASK");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008935 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008936 WMI_PDEV_PARAM_TX_CHAIN_MASK,
8937 PDEV_CMD);
8938 break;
8939 }
8940
8941 case WE_GET_RX_CHAINMASK:
8942 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008943 hdd_debug("GET WMI_PDEV_PARAM_RX_CHAIN_MASK");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008944 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008945 WMI_PDEV_PARAM_RX_CHAIN_MASK,
8946 PDEV_CMD);
8947 break;
8948 }
8949
8950 case WE_GET_TXPOW_2G:
8951 {
8952 uint32_t txpow2g = 0;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008953 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008954
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008955 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT2G");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008956 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008957 WMI_PDEV_PARAM_TXPOWER_LIMIT2G,
8958 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308959 if (QDF_STATUS_SUCCESS !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008960 sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL,
8961 &txpow2g)) {
8962 return -EIO;
8963 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008964 hdd_debug("2G tx_power %d", txpow2g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008965 break;
8966 }
8967
8968 case WE_GET_TXPOW_5G:
8969 {
8970 uint32_t txpow5g = 0;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008971 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07008972
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008973 hdd_debug("GET WMI_PDEV_PARAM_TXPOWER_LIMIT5G");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008974 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008975 WMI_PDEV_PARAM_TXPOWER_LIMIT5G,
8976 PDEV_CMD);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05308977 if (QDF_STATUS_SUCCESS !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008978 sme_cfg_get_int(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL,
8979 &txpow5g)) {
8980 return -EIO;
8981 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008982 hdd_debug("5G tx_power %d", txpow5g);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008983 break;
8984 }
8985
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008986 case WE_GET_PPS_PAID_MATCH:
8987 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008988 hdd_debug("GET WMI_VDEV_PPS_PAID_MATCH");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008989 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008990 WMI_VDEV_PPS_PAID_MATCH,
8991 PPS_CMD);
8992 break;
8993 }
8994
8995 case WE_GET_PPS_GID_MATCH:
8996 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08008997 hdd_debug("GET WMI_VDEV_PPS_GID_MATCH");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07008998 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08008999 WMI_VDEV_PPS_GID_MATCH,
9000 PPS_CMD);
9001 break;
9002 }
9003
9004 case WE_GET_PPS_EARLY_TIM_CLEAR:
9005 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009006 hdd_debug("GET WMI_VDEV_PPS_EARLY_TIM_CLEAR");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009007 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009008 WMI_VDEV_PPS_EARLY_TIM_CLEAR,
9009 PPS_CMD);
9010 break;
9011 }
9012
9013 case WE_GET_PPS_EARLY_DTIM_CLEAR:
9014 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009015 hdd_debug("GET WMI_VDEV_PPS_EARLY_DTIM_CLEAR");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009016 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009017 WMI_VDEV_PPS_EARLY_DTIM_CLEAR,
9018 PPS_CMD);
9019 break;
9020 }
9021
9022 case WE_GET_PPS_EOF_PAD_DELIM:
9023 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009024 hdd_debug("GET WMI_VDEV_PPS_EOF_PAD_DELIM");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009025 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009026 WMI_VDEV_PPS_EOF_PAD_DELIM,
9027 PPS_CMD);
9028 break;
9029 }
9030
9031 case WE_GET_PPS_MACADDR_MISMATCH:
9032 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009033 hdd_debug("GET WMI_VDEV_PPS_MACADDR_MISMATCH");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009034 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009035 WMI_VDEV_PPS_MACADDR_MISMATCH,
9036 PPS_CMD);
9037 break;
9038 }
9039
9040 case WE_GET_PPS_DELIM_CRC_FAIL:
9041 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009042 hdd_debug("GET WMI_VDEV_PPS_DELIM_CRC_FAIL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009043 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009044 WMI_VDEV_PPS_DELIM_CRC_FAIL,
9045 PPS_CMD);
9046 break;
9047 }
9048
9049 case WE_GET_PPS_GID_NSTS_ZERO:
9050 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009051 hdd_debug("GET WMI_VDEV_PPS_GID_NSTS_ZERO");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009052 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009053 WMI_VDEV_PPS_GID_NSTS_ZERO,
9054 PPS_CMD);
9055 break;
9056 }
9057
9058 case WE_GET_PPS_RSSI_CHECK:
9059 {
9060
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009061 hdd_debug("GET WMI_VDEV_PPS_RSSI_CHECK");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009062 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009063 WMI_VDEV_PPS_RSSI_CHECK,
9064 PPS_CMD);
9065 break;
9066 }
9067
9068 case WE_GET_QPOWER_MAX_PSPOLL_COUNT:
9069 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009070 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009071 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009072 WMI_STA_PS_PARAM_QPOWER_PSPOLL_COUNT,
9073 QPOWER_CMD);
9074 break;
9075 }
9076
9077 case WE_GET_QPOWER_MAX_TX_BEFORE_WAKE:
9078 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009079 hdd_debug("WE_GET_QPOWER_MAX_TX_BEFORE_WAKE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009080 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009081 WMI_STA_PS_PARAM_QPOWER_MAX_TX_BEFORE_WAKE,
9082 QPOWER_CMD);
9083 break;
9084 }
9085
9086 case WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL:
9087 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009088 hdd_debug("WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009089 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009090 WMI_STA_PS_PARAM_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
9091 QPOWER_CMD);
9092 break;
9093 }
9094
9095 case WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL:
9096 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009097 hdd_debug("WE_GET_QPOWER_MAX_PSPOLL_COUNT");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009098 *value = wma_cli_get_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009099 WMI_STA_PS_PARAM_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
9100 QPOWER_CMD);
9101 break;
9102 }
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009103 case WE_CAP_TSF:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009104 ret = hdd_capture_tsf(adapter, (uint32_t *)value, 1);
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07009105 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009106 case WE_GET_TEMPERATURE:
9107 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009108 hdd_debug("WE_GET_TEMPERATURE");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009109 ret = wlan_hdd_get_temperature(adapter, value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009110 break;
9111 }
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07009112 case WE_GET_DCM:
9113 hdd_notice("GET WMI_VDEV_PARAM_HE_DCM");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009114 *value = wma_cli_get_command(adapter->sessionId,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -07009115 WMI_VDEV_PARAM_HE_DCM,
9116 VDEV_CMD);
9117 break;
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07009118 case WE_GET_RANGE_EXT:
9119 hdd_notice("GET WMI_VDEV_PARAM_HE_RANGE_EXT");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009120 *value = wma_cli_get_command(adapter->sessionId,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -07009121 WMI_VDEV_PARAM_HE_RANGE_EXT,
9122 VDEV_CMD);
9123 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009124 default:
9125 {
Jeff Johnson99bac312016-06-28 10:38:18 -07009126 hdd_err("Invalid IOCTL get_value command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009127 value[0]);
9128 break;
9129 }
9130 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309131 EXIT();
Sridhar Selvaraj48c47092017-07-31 18:18:14 +05309132 qdf_mem_free(sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009133 return ret;
9134}
9135
9136static int iw_setnone_getint(struct net_device *dev,
9137 struct iw_request_info *info,
9138 union iwreq_data *wrqu, char *extra)
9139{
9140 int ret;
9141
9142 cds_ssr_protect(__func__);
9143 ret = __iw_setnone_getint(dev, info, wrqu, extra);
9144 cds_ssr_unprotect(__func__);
9145
9146 return ret;
9147}
9148
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05309149static int hdd_set_fwtest(int argc, int cmd, int value)
9150{
9151 struct set_fwtest_params *fw_test;
9152
9153 /* check for max number of arguments */
9154 if (argc > (WMA_MAX_NUM_ARGS) ||
9155 argc != HDD_FWTEST_PARAMS) {
9156 hdd_err("Too Many args %d", argc);
9157 return -EINVAL;
9158 }
9159 /*
9160 * check if number of arguments are 3 then, check
9161 * then set the default value for sounding interval.
9162 */
9163 if (HDD_FWTEST_PARAMS == argc) {
9164 if (HDD_FWTEST_SU_PARAM_ID == cmd && 0 == value)
9165 value = HDD_FWTEST_SU_DEFAULT_VALUE;
9166 if (HDD_FWTEST_MU_PARAM_ID == cmd && 0 == value)
9167 value = HDD_FWTEST_MU_DEFAULT_VALUE;
9168 }
9169 /* check sounding interval value should not exceed to max */
9170 if (value > HDD_FWTEST_MAX_VALUE) {
9171 hdd_err("Invalid arguments value should not exceed max: %d",
9172 value);
9173 return -EINVAL;
9174 }
9175 fw_test = qdf_mem_malloc(sizeof(*fw_test));
9176 if (NULL == fw_test) {
9177 hdd_err("qdf_mem_malloc failed for fw_test");
9178 return -ENOMEM;
9179 }
9180 fw_test->arg = cmd;
9181 fw_test->value = value;
9182 if (QDF_STATUS_SUCCESS != sme_set_fw_test(fw_test)) {
9183 qdf_mem_free(fw_test);
9184 hdd_err("Not able to post FW_TEST_CMD message to WMA");
9185 return -EINVAL;
9186 }
9187 return 0;
9188}
9189
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009190/**
9191 * iw_set_three_ints_getnone() - Generic "set 3 params" private ioctl handler
9192 * @dev: device upon which the ioctl was received
9193 * @info: ioctl request information
9194 * @wrqu: ioctl request data
9195 * @extra: ioctl extra data
9196 *
9197 * Return: 0 on success, non-zero on error
9198 */
9199static int __iw_set_three_ints_getnone(struct net_device *dev,
9200 struct iw_request_info *info,
9201 union iwreq_data *wrqu, char *extra)
9202{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009203 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009204 int *value = (int *)extra;
9205 int sub_cmd = value[0];
9206 int ret;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009207 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009208
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009209 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309210
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07009211 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009212 hdd_err("permission check failed");
Rajeev Kumar2cce8a82016-04-14 15:10:41 -07009213 return -EPERM;
9214 }
9215
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009216 ret = wlan_hdd_validate_context(hdd_ctx);
9217 if (0 != ret)
9218 return ret;
9219
Jeff Johnson441e1f72017-02-07 08:50:49 -08009220 ret = hdd_check_private_wext_control(hdd_ctx, info);
9221 if (0 != ret)
9222 return ret;
9223
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009224 switch (sub_cmd) {
9225
9226 case WE_SET_WLAN_DBG:
Dustin Brown36e2e5c2017-05-16 15:41:37 -07009227 qdf_print_set_category_verbose(qdf_get_pidx(), value[1],
9228 value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009229 break;
9230 case WE_SET_DP_TRACE:
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +05309231 qdf_dp_trace_set_value(value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009232 break;
9233
9234 /* value[3] the acs band is not required as start and end channels are
9235 * enough but this cmd is maintained under set three ints for historic
9236 * reasons.
9237 */
9238 case WE_SET_SAP_CHANNELS:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009239 if (wlan_hdd_validate_operation_channel(adapter, value[1]) !=
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05309240 QDF_STATUS_SUCCESS ||
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009241 wlan_hdd_validate_operation_channel(adapter,
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05309242 value[2]) != QDF_STATUS_SUCCESS) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009243 ret = -EINVAL;
9244 } else {
9245 hdd_ctx->config->force_sap_acs_st_ch = value[1];
9246 hdd_ctx->config->force_sap_acs_end_ch = value[2];
9247 }
9248 break;
9249 case WE_SET_DUAL_MAC_SCAN_CONFIG:
9250 hdd_debug("Ioctl to set dual mac scan config");
Tushnim Bhattacharyya49ed8ab2017-05-26 18:20:10 -07009251 if (hdd_ctx->config->dual_mac_feature_disable ==
9252 DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009253 hdd_err("Dual mac feature is disabled from INI");
9254 return -EPERM;
9255 }
9256 hdd_debug("%d %d %d", value[1], value[2], value[3]);
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -08009257 policy_mgr_set_dual_mac_scan_config(hdd_ctx->hdd_psoc,
9258 value[1], value[2], value[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009259 break;
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +05309260 case WE_SET_FW_TEST:
9261 {
9262 ret = hdd_set_fwtest(value[1], value[2], value[3]);
9263 if (ret) {
9264 hdd_err("Not able to set fwtest %d", ret);
9265 return ret;
9266 }
9267 }
9268 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009269 default:
Jeff Johnson99bac312016-06-28 10:38:18 -07009270 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009271 break;
9272
9273 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309274 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009275 return ret;
9276}
9277
9278int iw_set_three_ints_getnone(struct net_device *dev,
9279 struct iw_request_info *info,
9280 union iwreq_data *wrqu, char *extra)
9281{
9282 int ret;
9283
9284 cds_ssr_protect(__func__);
9285 ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
9286 cds_ssr_unprotect(__func__);
9287
9288 return ret;
9289}
9290
9291/**
9292 * hdd_connection_state_string() - Get connection state string
9293 * @connection_state: enum to be converted to a string
9294 *
9295 * Return: the string equivalent of @connection_state
9296 */
9297static const char *
9298hdd_connection_state_string(eConnectionState connection_state)
9299{
9300 switch (connection_state) {
9301 CASE_RETURN_STRING(eConnectionState_NotConnected);
9302 CASE_RETURN_STRING(eConnectionState_Connecting);
9303 CASE_RETURN_STRING(eConnectionState_Associated);
9304 CASE_RETURN_STRING(eConnectionState_IbssDisconnected);
9305 CASE_RETURN_STRING(eConnectionState_IbssConnected);
9306 CASE_RETURN_STRING(eConnectionState_Disconnecting);
9307 default:
9308 return "UNKNOWN";
9309 }
9310}
9311
Naveen Rawat910726a2017-03-06 11:42:51 -08009312#if defined(FEATURE_OEM_DATA_SUPPORT)
9313/**
9314 * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
9315 * wifi_pos api to get oem data caps
9316 * @dev: net device upon which the request was received
9317 * @info: ioctl request information
9318 * @wrqu: ioctl request data
9319 * @extra: ioctl data payload
9320 *
9321 * Return: 0 for success, negative errno value on failure
9322 */
9323static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
9324 struct iw_request_info *info,
9325 union iwreq_data *wrqu, char *extra)
9326{
9327 return iw_get_oem_data_cap(dev, info, wrqu, extra);
9328}
9329#elif defined(WIFI_POS_CONVERGED)
9330static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
9331 struct iw_request_info *info,
9332 union iwreq_data *wrqu, char *extra)
9333{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009334 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009335 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Naveen Rawat910726a2017-03-06 11:42:51 -08009336
9337 return os_if_wifi_pos_populate_caps(hdd_ctx->hdd_psoc,
9338 (struct wifi_pos_driver_caps *)extra);
9339}
9340#else
9341static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
9342 struct iw_request_info *info,
9343 union iwreq_data *wrqu, char *extra)
9344{
9345 return -ENOTSUPP;
9346}
9347#endif
9348
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009349/**
9350 * iw_get_char_setnone() - Generic "get string" private ioctl handler
9351 * @dev: device upon which the ioctl was received
9352 * @info: ioctl request information
9353 * @wrqu: ioctl request data
9354 * @extra: ioctl extra data
9355 *
9356 * Return: 0 on success, non-zero on error
9357 */
9358static int __iw_get_char_setnone(struct net_device *dev,
9359 struct iw_request_info *info,
9360 union iwreq_data *wrqu, char *extra)
9361{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009362 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009363 int sub_cmd = wrqu->data.flags;
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009364 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009365 int ret;
9366#ifdef WLAN_FEATURE_11W
Jeff Johnson2a722002017-09-30 20:02:35 -07009367 struct hdd_wext_state *pWextState;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009368#endif
9369
9370#ifdef WLAN_FEATURE_11W
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009371 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009372#endif
9373
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009374 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309375
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009376 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009377 ret = wlan_hdd_validate_context(hdd_ctx);
9378 if (0 != ret)
9379 return ret;
9380
Jeff Johnson441e1f72017-02-07 08:50:49 -08009381 ret = hdd_check_private_wext_control(hdd_ctx, info);
9382 if (0 != ret)
9383 return ret;
9384
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009385 switch (sub_cmd) {
9386 case WE_WLAN_VERSION:
9387 {
Arun Khandavallia96c2c02016-05-17 19:15:34 +05309388 hdd_wlan_get_version(hdd_ctx, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009389 break;
9390 }
9391
9392 case WE_GET_STATS:
9393 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009394 hdd_wlan_get_stats(adapter, &(wrqu->data.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009395 extra, WE_MAX_STR_LEN);
9396 break;
9397 }
9398
Dustin Brownd9322482017-01-09 12:46:03 -08009399 case WE_GET_SUSPEND_RESUME_STATS:
9400 {
9401 ret = wlan_hdd_write_suspend_resume_stats(hdd_ctx, extra,
9402 WE_MAX_STR_LEN);
9403 if (ret >= 0) {
9404 wrqu->data.length = ret;
9405 ret = 0;
9406 }
9407
9408 break;
9409 }
9410
Govind Singha471e5e2015-10-12 17:11:14 +05309411 case WE_LIST_FW_PROFILE:
9412 hdd_wlan_list_fw_profile(&(wrqu->data.length),
9413 extra, WE_MAX_STR_LEN);
9414 break;
9415
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009416 /* The case prints the current state of the HDD, SME, CSR, PE,
9417 * TL it can be extended for WDI Global State as well. And
9418 * currently it only checks P2P_CLIENT adapter. P2P_DEVICE
9419 * and P2P_GO have not been added as of now.
9420 */
9421 case WE_GET_STATES:
9422 {
9423 int buf = 0, len = 0;
9424 int adapter_num = 0;
9425 int count = 0, check = 1;
9426
9427 tHalHandle hHal = NULL;
9428 tpAniSirGlobal pMac = NULL;
Jeff Johnsond377dce2017-10-04 10:32:42 -07009429 struct hdd_station_ctx *sta_ctx = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009430
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009431 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson3d278b02017-08-29 14:17:47 -07009432 struct hdd_adapter *useAdapter = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009433
9434 /* Print wlan0 or p2p0 states based on the adapter_num
9435 * by using the correct adapter
9436 */
9437 while (adapter_num < 2) {
9438 if (WLAN_ADAPTER == adapter_num) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009439 useAdapter = adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009440 buf =
9441 scnprintf(extra + len,
9442 WE_MAX_STR_LEN - len,
9443 "\n\n wlan0 States:-");
9444 len += buf;
9445 } else if (P2P_ADAPTER == adapter_num) {
9446 buf =
9447 scnprintf(extra + len,
9448 WE_MAX_STR_LEN - len,
9449 "\n\n p2p0 States:-");
9450 len += buf;
9451
Jeff Johnsonce2ee982017-09-03 09:27:35 -07009452 if (!hdd_ctx) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009453 buf =
9454 scnprintf(extra + len,
9455 WE_MAX_STR_LEN -
9456 len,
Jeff Johnsonce2ee982017-09-03 09:27:35 -07009457 "\n hdd_ctx is NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009458 len += buf;
9459 break;
9460 }
9461
9462 /* Printing p2p0 states only in the
9463 * case when the device is configured
9464 * as a p2p_client
9465 */
9466 useAdapter =
Jeff Johnsonce2ee982017-09-03 09:27:35 -07009467 hdd_get_adapter(hdd_ctx,
Krunal Sonif07bb382016-03-10 13:02:11 -08009468 QDF_P2P_CLIENT_MODE);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009469 if (!useAdapter) {
9470 buf =
9471 scnprintf(extra + len,
9472 WE_MAX_STR_LEN -
9473 len,
9474 "\n Device not configured as P2P_CLIENT.");
9475 len += buf;
9476 break;
9477 }
9478 }
9479
9480 hHal = WLAN_HDD_GET_HAL_CTX(useAdapter);
9481 if (!hHal) {
9482 buf =
9483 scnprintf(extra + len,
9484 WE_MAX_STR_LEN - len,
9485 "\n pMac is NULL");
9486 len += buf;
9487 break;
9488 }
9489 pMac = PMAC_STRUCT(hHal);
9490 if (!pMac) {
9491 buf =
9492 scnprintf(extra + len,
9493 WE_MAX_STR_LEN - len,
9494 "\n pMac is NULL");
9495 len += buf;
9496 break;
9497 }
Jeff Johnsond377dce2017-10-04 10:32:42 -07009498 sta_ctx =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009499 WLAN_HDD_GET_STATION_CTX_PTR(useAdapter);
9500
9501
9502 buf =
9503 scnprintf(extra + len, WE_MAX_STR_LEN - len,
9504 "\n HDD Conn State - %s "
9505 "\n \n SME State:"
9506 "\n Neighbour Roam State - %s"
9507 "\n CSR State - %s"
9508 "\n CSR Substate - %s",
9509 hdd_connection_state_string
Jeff Johnsond377dce2017-10-04 10:32:42 -07009510 (sta_ctx->conn_info.connState),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009511 mac_trace_get_neighbour_roam_state
9512 (sme_get_neighbor_roam_state
9513 (hHal, useAdapter->sessionId)),
9514 mac_trace_getcsr_roam_state
9515 (sme_get_current_roam_state
9516 (hHal, useAdapter->sessionId)),
9517 mac_trace_getcsr_roam_sub_state
9518 (sme_get_current_roam_sub_state
9519 (hHal, useAdapter->sessionId))
9520 );
9521 len += buf;
9522 adapter_num++;
9523 }
9524
Mukul Sharma81661ae2015-10-30 20:26:02 +05309525 if (hHal) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009526 /* Printing Lim State starting with global lim states */
9527 buf =
9528 scnprintf(extra + len, WE_MAX_STR_LEN - len,
9529 "\n \n LIM STATES:-"
9530 "\n Global Sme State - %s "
9531 "\n Global mlm State - %s " "\n",
9532 mac_trace_get_lim_sme_state
9533 (sme_get_lim_sme_state(hHal)),
9534 mac_trace_get_lim_mlm_state
9535 (sme_get_lim_sme_state(hHal))
9536 );
9537 len += buf;
9538
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009539 while (check < 3 && count < 255) {
9540 if (sme_is_lim_session_valid(hHal, count)) {
9541 buf =
9542 scnprintf(extra + len,
9543 WE_MAX_STR_LEN -
9544 len,
9545 "\n Lim Valid Session %d:-"
9546 "\n PE Sme State - %s "
9547 "\n PE Mlm State - %s "
9548 "\n", check,
9549 mac_trace_get_lim_sme_state
9550 (sme_get_lim_sme_session_state
9551 (hHal, count)),
9552 mac_trace_get_lim_mlm_state
9553 (sme_get_lim_mlm_session_state
9554 (hHal, count))
9555 );
9556
9557 len += buf;
9558 check++;
9559 }
9560 count++;
9561 }
9562 }
9563
9564 wrqu->data.length = strlen(extra) + 1;
9565 break;
9566 }
9567
9568 case WE_GET_CFG:
9569 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009570 hdd_debug("Printing CLD global INI Config");
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009571 hdd_cfg_get_global_config(WLAN_HDD_GET_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009572 extra,
9573 QCSAP_IOCTL_MAX_STR_LEN);
9574 wrqu->data.length = strlen(extra) + 1;
9575 break;
9576 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009577 case WE_GET_RSSI:
9578 {
9579 int8_t s7Rssi = 0;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009580
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009581 wlan_hdd_get_rssi(adapter, &s7Rssi);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009582 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
9583 wrqu->data.length = strlen(extra) + 1;
9584 break;
9585 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009586
9587 case WE_GET_WMM_STATUS:
9588 {
9589 snprintf(extra, WE_MAX_STR_LEN,
9590 "\nDir: 0=up, 1=down, 3=both\n"
9591 "|------------------------|\n"
9592 "|AC | ACM |Admitted| Dir |\n"
9593 "|------------------------|\n"
9594 "|VO | %d | %3s | %d |\n"
9595 "|VI | %d | %3s | %d |\n"
9596 "|BE | %d | %3s | %d |\n"
9597 "|BK | %d | %3s | %d |\n"
9598 "|------------------------|\n",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009599 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009600 wmmAcStatus[SME_AC_VO].wmmAcAccessRequired,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009601 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009602 wmmAcStatus[SME_AC_VO].
9603 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009604 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009605 wmmAcStatus[SME_AC_VO].wmmAcTspecInfo.
9606 ts_info.direction,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009607 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009608 wmmAcStatus[SME_AC_VI].wmmAcAccessRequired,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009609 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009610 wmmAcStatus[SME_AC_VI].
9611 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009612 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009613 wmmAcStatus[SME_AC_VI].wmmAcTspecInfo.
9614 ts_info.direction,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009615 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009616 wmmAcStatus[SME_AC_BE].wmmAcAccessRequired,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009617 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009618 wmmAcStatus[SME_AC_BE].
9619 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009620 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009621 wmmAcStatus[SME_AC_BE].wmmAcTspecInfo.
9622 ts_info.direction,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009623 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009624 wmmAcStatus[SME_AC_BK].wmmAcAccessRequired,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009625 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009626 wmmAcStatus[SME_AC_BK].
9627 wmmAcAccessAllowed ? "YES" : "NO",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009628 adapter->hddWmmStatus.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009629 wmmAcStatus[SME_AC_BK].wmmAcTspecInfo.
9630 ts_info.direction);
9631
9632 wrqu->data.length = strlen(extra) + 1;
9633 break;
9634 }
9635 case WE_GET_CHANNEL_LIST:
9636 {
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05309637 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009638 uint8_t i, len;
9639 char *buf;
9640 uint8_t ubuf[WNI_CFG_COUNTRY_CODE_LEN];
9641 uint8_t ubuf_len = WNI_CFG_COUNTRY_CODE_LEN;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009642 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009643
Srinivas Girigowdac231df62017-03-24 18:27:57 -07009644 struct channel_list_info channel_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009645
9646 memset(&channel_list, 0, sizeof(channel_list));
Agrawal Ashish6c9bca72016-09-04 13:37:59 +05309647 status = iw_get_channel_list(dev, info, wrqu,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009648 (char *)&channel_list);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05309649 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009650 hdd_err("GetChannelList Failed!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009651 return -EINVAL;
9652 }
9653 buf = extra;
9654 /*
9655 * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN.
9656 * Maximum buffer needed = 5 * number of channels.
9657 * Check ifsufficient buffer is available and then
9658 * proceed to fill the buffer.
9659 */
9660 if (WE_MAX_STR_LEN <
9661 (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009662 hdd_err("Insufficient Buffer to populate channel list");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009663 return -EINVAL;
9664 }
9665 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
9666 channel_list.num_channels);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05309667 if (QDF_STATUS_SUCCESS == sme_get_country_code(hdd_ctx->hHal,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009668 ubuf, &ubuf_len)) {
9669 /* Printing Country code in getChannelList */
9670 for (i = 0; i < (ubuf_len - 1); i++)
9671 len += scnprintf(buf + len,
9672 WE_MAX_STR_LEN - len,
9673 "%c", ubuf[i]);
9674 }
9675 for (i = 0; i < channel_list.num_channels; i++) {
9676 len +=
9677 scnprintf(buf + len, WE_MAX_STR_LEN - len,
9678 " %u", channel_list.channels[i]);
9679 }
9680 wrqu->data.length = strlen(extra) + 1;
9681
9682 break;
9683 }
9684#ifdef FEATURE_WLAN_TDLS
9685 case WE_GET_TDLS_PEERS:
9686 {
9687 wrqu->data.length =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009688 wlan_hdd_tdls_get_all_peers(adapter, extra,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009689 WE_MAX_STR_LEN) + 1;
9690 break;
9691 }
9692#endif
9693#ifdef WLAN_FEATURE_11W
9694 case WE_GET_11W_INFO:
9695 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009696 hdd_debug("WE_GET_11W_ENABLED = %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009697 pWextState->roamProfile.MFPEnabled);
9698
9699 snprintf(extra, WE_MAX_STR_LEN,
9700 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
9701 "\n Number of Unprotected Disassocs %d"
9702 "\n Number of Unprotected Deauths %d",
9703 pWextState->roamProfile.BSSIDs.bssid->bytes[0],
9704 pWextState->roamProfile.BSSIDs.bssid->bytes[1],
9705 pWextState->roamProfile.BSSIDs.bssid->bytes[2],
9706 pWextState->roamProfile.BSSIDs.bssid->bytes[3],
9707 pWextState->roamProfile.BSSIDs.bssid->bytes[4],
9708 pWextState->roamProfile.BSSIDs.bssid->bytes[5],
9709 pWextState->roamProfile.MFPEnabled,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009710 adapter->hdd_stats.hddPmfStats.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009711 numUnprotDisassocRx,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009712 adapter->hdd_stats.hddPmfStats.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009713 numUnprotDeauthRx);
9714
9715 wrqu->data.length = strlen(extra) + 1;
9716 break;
9717 }
9718#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009719 case WE_GET_IBSS_STA_INFO:
9720 {
Jeff Johnsond377dce2017-10-04 10:32:42 -07009721 struct hdd_station_ctx *sta_ctx =
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009722 WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009723 int idx = 0;
9724 int length = 0, buf = 0;
9725
Naveen Rawatc45d1622016-07-05 12:20:09 -07009726 for (idx = 0; idx < MAX_PEERS; idx++) {
Naveen Rawatac027cb2017-04-27 15:02:42 -07009727 if (HDD_WLAN_INVALID_STA_ID !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07009728 sta_ctx->conn_info.staId[idx]) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009729 buf = snprintf
9730 ((extra + length),
9731 WE_MAX_STR_LEN - length,
9732 "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n",
Jeff Johnsond377dce2017-10-04 10:32:42 -07009733 sta_ctx->conn_info.staId[idx],
9734 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009735 peerMacAddress[idx].bytes[0],
Jeff Johnsond377dce2017-10-04 10:32:42 -07009736 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009737 peerMacAddress[idx].bytes[1],
Jeff Johnsond377dce2017-10-04 10:32:42 -07009738 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009739 peerMacAddress[idx].bytes[2],
Jeff Johnsond377dce2017-10-04 10:32:42 -07009740 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009741 peerMacAddress[idx].bytes[3],
Jeff Johnsond377dce2017-10-04 10:32:42 -07009742 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009743 peerMacAddress[idx].bytes[4],
Jeff Johnsond377dce2017-10-04 10:32:42 -07009744 sta_ctx->conn_info.
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009745 peerMacAddress[idx].bytes[5]
9746 );
9747 length += buf;
9748 }
9749 }
9750 wrqu->data.length = strlen(extra) + 1;
9751 break;
9752 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009753 case WE_GET_PHYMODE:
9754 {
9755 bool ch_bond24 = false, ch_bond5g = false;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009756 struct hdd_context *hddctx = WLAN_HDD_GET_CTX(adapter);
9757 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009758 eCsrPhyMode phymode;
9759 eCsrBand currBand;
Dustin Browne9c6b3a2017-01-23 17:17:32 -08009760 tSmeConfigParams *sme_config;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009761
Dustin Browne9c6b3a2017-01-23 17:17:32 -08009762 sme_config = qdf_mem_malloc(sizeof(*sme_config));
9763 if (!sme_config) {
9764 hdd_err("Out of memory");
9765 ret = -ENOMEM;
9766 break;
9767 }
9768
9769 sme_get_config_param(hal, sme_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009770 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08009771 sme_config->csrConfig.channelBondingMode24GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009772 ch_bond24 = true;
9773
9774 if (WNI_CFG_CHANNEL_BONDING_MODE_DISABLE !=
Dustin Browne9c6b3a2017-01-23 17:17:32 -08009775 sme_config->csrConfig.channelBondingMode5GHz)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009776 ch_bond5g = true;
9777
Dustin Browne9c6b3a2017-01-23 17:17:32 -08009778 qdf_mem_free(sme_config);
9779
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009780 phymode = sme_get_phy_mode(hal);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05309781 if ((QDF_STATUS_SUCCESS !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009782 sme_get_freq_band(hal, &currBand))) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -08009783 hdd_err("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009784 return -EIO;
9785 }
9786
9787 switch (phymode) {
9788 case eCSR_DOT11_MODE_AUTO:
9789 snprintf(extra, WE_MAX_STR_LEN, "AUTO MODE");
9790 break;
9791 case eCSR_DOT11_MODE_11n:
9792 case eCSR_DOT11_MODE_11n_ONLY:
9793 if (currBand == eCSR_BAND_24) {
9794 if (ch_bond24)
9795 snprintf(extra, WE_MAX_STR_LEN,
9796 "11NGHT40");
9797 else
9798 snprintf(extra, WE_MAX_STR_LEN,
9799 "11NGHT20");
9800 } else if (currBand == eCSR_BAND_5G) {
9801 if (ch_bond5g)
9802 snprintf(extra, WE_MAX_STR_LEN,
9803 "11NAHT40");
9804 else
9805 snprintf(extra, WE_MAX_STR_LEN,
9806 "11NAHT20");
9807 } else {
9808 snprintf(extra, WE_MAX_STR_LEN, "11N");
9809 }
9810 break;
9811 case eCSR_DOT11_MODE_abg:
9812 snprintf(extra, WE_MAX_STR_LEN, "11ABG");
9813 break;
9814 case eCSR_DOT11_MODE_11a:
9815 snprintf(extra, WE_MAX_STR_LEN, "11A");
9816 break;
9817 case eCSR_DOT11_MODE_11b:
9818 case eCSR_DOT11_MODE_11b_ONLY:
9819 snprintf(extra, WE_MAX_STR_LEN, "11B");
9820 break;
9821 case eCSR_DOT11_MODE_11g:
9822 case eCSR_DOT11_MODE_11g_ONLY:
9823 snprintf(extra, WE_MAX_STR_LEN, "11G");
9824 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009825 case eCSR_DOT11_MODE_11ac:
9826 case eCSR_DOT11_MODE_11ac_ONLY:
9827 if (hddctx->config->vhtChannelWidth ==
9828 eHT_CHANNEL_WIDTH_20MHZ)
9829 snprintf(extra, WE_MAX_STR_LEN,
9830 "11ACVHT20");
9831 else if (hddctx->config->vhtChannelWidth ==
9832 eHT_CHANNEL_WIDTH_40MHZ)
9833 snprintf(extra, WE_MAX_STR_LEN,
9834 "11ACVHT40");
9835 else if (hddctx->config->vhtChannelWidth ==
9836 eHT_CHANNEL_WIDTH_80MHZ)
9837 snprintf(extra, WE_MAX_STR_LEN,
9838 "11ACVHT80");
9839 else if (hddctx->config->vhtChannelWidth ==
9840 eHT_CHANNEL_WIDTH_160MHZ)
9841 snprintf(extra, WE_MAX_STR_LEN,
9842 "11ACVHT160");
9843 break;
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -08009844 case eCSR_DOT11_MODE_11ax:
9845 case eCSR_DOT11_MODE_11ax_ONLY:
9846 /* currently using vhtChannelWidth */
9847 if (hddctx->config->vhtChannelWidth ==
9848 eHT_CHANNEL_WIDTH_20MHZ)
9849 snprintf(extra, WE_MAX_STR_LEN,
9850 "11AX_HE_20");
9851 else if (hddctx->config->vhtChannelWidth ==
9852 eHT_CHANNEL_WIDTH_40MHZ)
9853 snprintf(extra, WE_MAX_STR_LEN,
9854 "11AX_HE_40");
9855 else if (hddctx->config->vhtChannelWidth ==
9856 eHT_CHANNEL_WIDTH_80MHZ)
9857 snprintf(extra, WE_MAX_STR_LEN,
9858 "11AX_HE_80");
9859 else if (hddctx->config->vhtChannelWidth ==
9860 eHT_CHANNEL_WIDTH_160MHZ)
9861 snprintf(extra, WE_MAX_STR_LEN,
9862 "11AX_HE_160");
9863 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009864 }
9865
9866 wrqu->data.length = strlen(extra) + 1;
9867 break;
9868 }
9869
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009870 case WE_GET_OEM_DATA_CAP:
Naveen Rawat910726a2017-03-06 11:42:51 -08009871 return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009872 case WE_GET_SNR:
9873 {
9874 int8_t s7snr = 0;
9875 int status = 0;
Jeff Johnsonce2ee982017-09-03 09:27:35 -07009876 struct hdd_context *hdd_ctx;
Jeff Johnsond377dce2017-10-04 10:32:42 -07009877 struct hdd_station_ctx *sta_ctx;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009878
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009879 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07009880 status = wlan_hdd_validate_context(hdd_ctx);
Abhishek Singh23edd1c2016-05-05 11:56:06 +05309881 if (status)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009882 return status;
Abhishek Singh23edd1c2016-05-05 11:56:06 +05309883
Jeff Johnsond377dce2017-10-04 10:32:42 -07009884 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -07009885 if (0 == hdd_ctx->config->fEnableSNRMonitoring ||
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009886 eConnectionState_Associated !=
Jeff Johnsond377dce2017-10-04 10:32:42 -07009887 sta_ctx->conn_info.connState) {
Jeff Johnson99bac312016-06-28 10:38:18 -07009888 hdd_err("getSNR failed: Enable SNR Monitoring-%d, ConnectionState-%d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -07009889 hdd_ctx->config->fEnableSNRMonitoring,
Jeff Johnsond377dce2017-10-04 10:32:42 -07009890 sta_ctx->conn_info.connState);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009891 return -ENONET;
9892 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -07009893 wlan_hdd_get_snr(adapter, &s7snr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009894 snprintf(extra, WE_MAX_STR_LEN, "snr=%d", s7snr);
9895 wrqu->data.length = strlen(extra) + 1;
9896 break;
9897 }
9898 default:
9899 {
Jeff Johnson99bac312016-06-28 10:38:18 -07009900 hdd_err("Invalid IOCTL command %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009901 sub_cmd);
9902 break;
9903 }
9904 }
Dustin Brownd9322482017-01-09 12:46:03 -08009905
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309906 EXIT();
Dustin Brownd9322482017-01-09 12:46:03 -08009907 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009908}
9909
9910static int iw_get_char_setnone(struct net_device *dev,
9911 struct iw_request_info *info,
9912 union iwreq_data *wrqu, char *extra)
9913{
9914 int ret;
9915
9916 cds_ssr_protect(__func__);
9917 ret = __iw_get_char_setnone(dev, info, wrqu, extra);
9918 cds_ssr_unprotect(__func__);
9919
9920 return ret;
9921}
9922
9923/**
9924 * iw_setnone_getnone() - Generic "action" private ioctl handler
9925 * @dev: device upon which the ioctl was received
9926 * @info: ioctl request information
9927 * @wrqu: ioctl request data
9928 * @extra: ioctl extra data
9929 *
9930 * Return: 0 on success, non-zero on error
9931 */
9932static int __iw_setnone_getnone(struct net_device *dev,
9933 struct iw_request_info *info,
9934 union iwreq_data *wrqu, char *extra)
9935{
Jeff Johnson3d278b02017-08-29 14:17:47 -07009936 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -07009937 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009938 int ret;
9939 int sub_cmd;
9940
Jeff Johnson6ee91ee2016-02-11 18:55:30 -08009941 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +05309942
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009943 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009944 ret = wlan_hdd_validate_context(hdd_ctx);
9945 if (0 != ret)
9946 return ret;
9947
Jeff Johnson441e1f72017-02-07 08:50:49 -08009948 ret = hdd_check_private_wext_control(hdd_ctx, info);
9949 if (0 != ret)
9950 return ret;
9951
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009952#ifdef CONFIG_COMPAT
9953 /* this ioctl is a special case where a sub-ioctl is used and both
9954 * the number of get and set args is 0. in this specific case the
9955 * logic in iwpriv places the sub_cmd in the data.flags portion of
9956 * the iwreq. unfortunately the location of this field will be
9957 * different between 32-bit and 64-bit userspace, and the standard
9958 * compat support in the kernel does not handle this case. so we
9959 * need to explicitly handle it here.
9960 */
9961 if (is_compat_task()) {
9962 struct compat_iw_point *compat_iw_point =
9963 (struct compat_iw_point *)&wrqu->data;
9964 sub_cmd = compat_iw_point->flags;
9965 } else {
9966 sub_cmd = wrqu->data.flags;
9967 }
9968#else
9969 sub_cmd = wrqu->data.flags;
9970#endif
9971
9972 switch (sub_cmd) {
9973 case WE_GET_RECOVERY_STAT:
9974 {
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009975 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009976
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009977 sme_get_recovery_stats(hal);
9978 break;
9979 }
9980
Govind Singha471e5e2015-10-12 17:11:14 +05309981 case WE_GET_FW_PROFILE_DATA:
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009982 ret = wma_cli_set_command(adapter->sessionId,
Govind Singha471e5e2015-10-12 17:11:14 +05309983 WMI_WLAN_PROFILE_GET_PROFILE_DATA_CMDID,
9984 0, DBG_CMD);
9985 break;
9986
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08009987 case WE_IBSS_GET_PEER_INFO_ALL:
9988 {
9989 hdd_wlan_get_ibss_peer_info_all(adapter);
9990 break;
9991 }
9992
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08009993 case WE_SET_REASSOC_TRIGGER:
9994 {
Jeff Johnson3d278b02017-08-29 14:17:47 -07009995 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Srinivas Girigowdafba82a02017-03-24 21:26:35 -07009996
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -08009997 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +05309998 tSirMacAddr bssid;
Krunal Sonibfd05492017-10-03 15:48:37 -07009999 uint32_t roamId = INVALID_ROAM_ID;
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +053010000 uint8_t operating_ch =
10001 adapter->sessionCtx.station.conn_info.operationChannel;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010002 tCsrRoamModifyProfileFields modProfileFields;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010003
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010004 sme_get_modify_profile_fields(hHal, adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010005 &modProfileFields);
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +053010006 if (roaming_offload_enabled(hdd_ctx)) {
10007 qdf_mem_copy(bssid,
10008 &adapter->sessionCtx.station.conn_info.bssId,
10009 sizeof(bssid));
Naveen Rawat664a7cb2017-01-19 17:58:14 -080010010 hdd_wma_send_fastreassoc_cmd(adapter,
Deepak Dhamdhere5fda0e42016-06-24 18:30:02 +053010011 bssid, operating_ch);
10012 } else {
10013 sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId,
10014 NULL, modProfileFields, &roamId, 1);
10015 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010016 return 0;
10017 }
10018
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080010019 case WE_STOP_OBSS_SCAN:
10020 {
10021 /*
10022 * 1.OBSS Scan is mandatory while operating in 2.4GHz
10023 * 2.OBSS scan is stopped by Firmware during the disassociation
10024 * 3.OBSS stop comamnd is added for debugging purpose
10025 */
10026 tHalHandle hal;
10027
10028 hal = WLAN_HDD_GET_HAL_CTX(adapter);
10029 if (hal == NULL) {
10030 hdd_err("hal context is NULL");
10031 return -EINVAL;
10032 }
10033 sme_ht40_stop_obss_scan(hal, adapter->sessionId);
10034 }
10035 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010036 default:
10037 {
Jeff Johnson99bac312016-06-28 10:38:18 -070010038 hdd_err("unknown ioctl %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010039 break;
10040 }
10041 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010042 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010043 return ret;
10044}
10045
10046static int iw_setnone_getnone(struct net_device *dev,
10047 struct iw_request_info *info,
10048 union iwreq_data *wrqu, char *extra)
10049{
10050 int ret;
10051
10052 cds_ssr_protect(__func__);
10053 ret = __iw_setnone_getnone(dev, info, wrqu, extra);
10054 cds_ssr_unprotect(__func__);
10055
10056 return ret;
10057}
10058
Krunal Sonia6e505b2017-01-12 12:25:18 -080010059#ifdef MPC_UT_FRAMEWORK
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010060static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -070010061 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -080010062{
Jeff Johnsonac8b0de2017-02-10 09:22:22 -080010063 switch (sub_cmd) {
Krunal Sonia6e505b2017-01-12 12:25:18 -080010064 case WE_POLICY_MANAGER_CLIST_CMD:
10065 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010066 hdd_debug("<iwpriv wlan0 pm_clist> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010067 policy_mgr_incr_connection_count_utfw(hdd_ctx->hdd_psoc,
10068 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
10069 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010070 }
10071 break;
10072
10073 case WE_POLICY_MANAGER_DLIST_CMD:
10074 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010075 hdd_debug("<iwpriv wlan0 pm_dlist> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010076 policy_mgr_decr_connection_count_utfw(hdd_ctx->hdd_psoc,
10077 apps_args[0], apps_args[1]);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010078 }
10079 break;
10080
10081 case WE_POLICY_MANAGER_ULIST_CMD:
10082 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010083 hdd_debug("<iwpriv wlan0 pm_ulist> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010084 policy_mgr_update_connection_info_utfw(hdd_ctx->hdd_psoc,
10085 apps_args[0], apps_args[1], apps_args[2], apps_args[3],
10086 apps_args[4], apps_args[5], apps_args[6], apps_args[7]);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010087 }
10088 break;
10089
10090 case WE_POLICY_MANAGER_DBS_CMD:
10091 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010092 hdd_debug("<iwpriv wlan0 pm_dbs> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -080010093 if (apps_args[0] == 0)
10094 wma_set_dbs_capability_ut(0);
10095 else
10096 wma_set_dbs_capability_ut(1);
10097
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010098 if (apps_args[1] >= PM_THROUGHPUT &&
10099 apps_args[1] <= PM_LATENCY) {
Krunal Sonia6e505b2017-01-12 12:25:18 -080010100 pr_info("setting system pref to [%d]\n", apps_args[1]);
10101 hdd_ctx->config->conc_system_pref = apps_args[1];
10102 }
10103 }
10104 break;
10105
10106 case WE_POLICY_MANAGER_PCL_CMD:
10107 {
10108 uint8_t pcl[QDF_MAX_NUM_CHAN] = {0};
10109 uint8_t weight_list[QDF_MAX_NUM_CHAN] = {0};
10110 uint32_t pcl_len = 0, i = 0;
10111
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -070010112 hdd_debug("<iwpriv wlan0 pm_pcl> is called");
Krunal Sonia6e505b2017-01-12 12:25:18 -080010113
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010114 policy_mgr_get_pcl(hdd_ctx->hdd_psoc, apps_args[0],
Krunal Sonia6e505b2017-01-12 12:25:18 -080010115 pcl, &pcl_len,
10116 weight_list, QDF_ARRAY_SIZE(weight_list));
10117 pr_info("PCL list for role[%d] is {", apps_args[0]);
10118 for (i = 0 ; i < pcl_len; i++)
10119 pr_info(" %d, ", pcl[i]);
10120 pr_info("}--------->\n");
10121 }
10122 break;
10123
10124 case WE_POLICY_SET_HW_MODE_CMD:
10125 {
10126 if (apps_args[0] == 0) {
10127 hdd_err("set hw mode for single mac");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010128 policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -080010129 adapter->sessionId,
10130 HW_MODE_SS_2x2,
10131 HW_MODE_80_MHZ,
10132 HW_MODE_SS_0x0, HW_MODE_BW_NONE,
10133 HW_MODE_DBS_NONE,
10134 HW_MODE_AGILE_DFS_NONE,
10135 HW_MODE_SBS_NONE,
10136 SIR_UPDATE_REASON_UT);
10137 } else if (apps_args[0] == 1) {
10138 hdd_err("set hw mode for dual mac");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010139 policy_mgr_pdev_set_hw_mode(hdd_ctx->hdd_psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -080010140 adapter->sessionId,
10141 HW_MODE_SS_1x1,
10142 HW_MODE_80_MHZ,
10143 HW_MODE_SS_1x1, HW_MODE_40_MHZ,
10144 HW_MODE_DBS,
10145 HW_MODE_AGILE_DFS_NONE,
10146 HW_MODE_SBS_NONE,
10147 SIR_UPDATE_REASON_UT);
10148 }
10149 }
10150 break;
10151
10152 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
10153 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010154 enum policy_mgr_conc_next_action action;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070010155
Varun Reddy Yeturu8a5d3d42017-08-02 13:03:27 -070010156 hdd_debug("<iwpriv wlan0 pm_query_action> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010157 action = policy_mgr_current_connections_update(
10158 hdd_ctx->hdd_psoc,
10159 adapter->sessionId, apps_args[0],
10160 SIR_UPDATE_REASON_UT);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010161 pr_info("next action is %d {HDD_NOP = 0, HDD_DBS, HDD_DBS_DOWNGRADE, HDD_MCC, HDD_MCC_UPGRADE}", action);
10162 }
10163 break;
10164
10165 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
10166 {
10167 bool allow;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070010168
10169 hdd_notice("<iwpriv wlan0 pm_query_allow> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010170 allow = policy_mgr_allow_concurrency(hdd_ctx->hdd_psoc,
Krunal Sonia6e505b2017-01-12 12:25:18 -080010171 apps_args[0], apps_args[1], apps_args[2]);
10172 pr_info("allow %d {0 = don't allow, 1 = allow}", allow);
10173 }
10174 break;
10175
10176 case WE_POLICY_MANAGER_SCENARIO_CMD:
10177 {
10178 clean_report(hdd_ctx);
10179 if (apps_args[0] == 1) {
10180 wlan_hdd_one_connection_scenario(hdd_ctx);
10181 } else if (apps_args[0] == 2) {
10182 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010183 6, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010184 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010185 36, POLICY_MGR_TWO_TWO);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010186 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010187 6, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010188 wlan_hdd_two_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010189 36, POLICY_MGR_ONE_ONE);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010190 } else if (apps_args[0] == 3) {
10191 /* MCC on same band with 2x2 same mac*/
10192 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010193 6, 11, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010194 /* MCC on diff band with 2x2 same mac*/
10195 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010196 6, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010197 /* MCC on diff band with 1x1 diff mac */
10198 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010199 36, 6, POLICY_MGR_ONE_ONE, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010200 /* MCC on diff band with 1x1 same mac */
10201 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010202 36, 6, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010203 /* SCC on same band with 2x2 same mac */
10204 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010205 36, 36, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010206 /* SCC on same band with 1x1 same mac */
10207 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010208 36, 36, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010209 /* MCC on same band with 2x2 same mac */
10210 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010211 36, 149, POLICY_MGR_TWO_TWO, 0);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010212 /* MCC on same band with 1x1 same mac */
10213 wlan_hdd_three_connections_scenario(hdd_ctx,
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010214 36, 149, POLICY_MGR_ONE_ONE, 1);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010215 }
10216 print_report(hdd_ctx);
10217 }
10218 break;
10219 }
10220 return 0;
10221}
10222#else
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010223static int iw_get_policy_manager_ut_ops(struct hdd_context *hdd_ctx,
Jeff Johnson3d278b02017-08-29 14:17:47 -070010224 struct hdd_adapter *adapter, int sub_cmd, int *apps_args)
Krunal Sonia6e505b2017-01-12 12:25:18 -080010225{
10226 return 0;
10227}
10228#endif
10229
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010230/**
10231 * __iw_set_var_ints_getnone - Generic "set many" private ioctl handler
10232 * @dev: device upon which the ioctl was received
10233 * @info: ioctl request information
10234 * @wrqu: ioctl request data
10235 * @extra: ioctl extra data
10236 *
10237 * This is an SSR-protected generic handler for private ioctls which
10238 * take multiple arguments. Note that this implementation is also
10239 * somewhat unique in that it is shared by both STA-mode and SAP-mode
10240 * interfaces.
10241 *
10242 * Return: 0 on success, non-zero on error
10243 */
10244static int __iw_set_var_ints_getnone(struct net_device *dev,
10245 struct iw_request_info *info,
10246 union iwreq_data *wrqu, char *extra)
10247{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010248 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
10249 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010250 int sub_cmd;
10251 int *apps_args = (int *) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010252 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010253 int ret, num_args;
10254
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010255 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010256
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010257 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010258 ret = wlan_hdd_validate_context(hdd_ctx);
10259 if (0 != ret)
10260 return ret;
10261
Jeff Johnson441e1f72017-02-07 08:50:49 -080010262 ret = hdd_check_private_wext_control(hdd_ctx, info);
10263 if (0 != ret)
10264 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010265
10266 sub_cmd = wrqu->data.flags;
10267 num_args = wrqu->data.length;
10268
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010269 hdd_debug("Received length %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010270
10271 switch (sub_cmd) {
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010272 case WE_IBSS_GET_PEER_INFO:
10273 {
10274 pr_info("Station ID = %d\n", apps_args[0]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010275 hdd_wlan_get_ibss_peer_info(adapter, apps_args[0]);
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080010276 }
10277 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010278
10279 case WE_P2P_NOA_CMD:
10280 {
Srinivas Girigowda5d5fdc52017-03-24 22:30:57 -070010281 struct p2p_app_set_ps p2pNoA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010282
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010283 if (adapter->device_mode != QDF_P2P_GO_MODE) {
Rajeev Kumar274034c2015-11-23 11:28:58 -080010284 hdd_err("Setting NoA is not allowed in Device mode %s(%d)",
10285 hdd_device_mode_to_string(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010286 adapter->device_mode),
10287 adapter->device_mode);
Rajeev Kumar274034c2015-11-23 11:28:58 -080010288 return -EINVAL;
10289 }
10290
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010291 p2pNoA.opp_ps = apps_args[0];
10292 p2pNoA.ctWindow = apps_args[1];
10293 p2pNoA.duration = apps_args[2];
10294 p2pNoA.interval = apps_args[3];
10295 p2pNoA.count = apps_args[4];
10296 p2pNoA.single_noa_duration = apps_args[5];
10297 p2pNoA.psSelection = apps_args[6];
10298
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010299 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 -070010300 apps_args[0], apps_args[1], apps_args[2],
10301 apps_args[3], apps_args[4],
10302 apps_args[5], apps_args[6]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010303
10304 hdd_set_p2p_ps(dev, &p2pNoA);
10305
10306 }
10307 break;
10308
10309 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
10310 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010311 hdd_debug("SELECTIVE_MODULE_LOG %d arg1 %d arg2",
Jeff Johnson99bac312016-06-28 10:38:18 -070010312 apps_args[0], apps_args[1]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053010313 qdf_trace_enable(apps_args[0], apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010314 }
10315 break;
10316
10317 case WE_MTRACE_DUMP_CMD:
10318 {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010319 hdd_debug("MTRACE_DUMP code %d session %d count %d bitmask_of_module %d ",
Jeff Johnson99bac312016-06-28 10:38:18 -070010320 apps_args[0], apps_args[1],
10321 apps_args[2], apps_args[3]);
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +053010322 qdf_trace_dump_all((void *)hHal, apps_args[0],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010323 apps_args[1], apps_args[2],
10324 apps_args[3]);
10325
10326 }
10327 break;
10328
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010329 case WE_POLICY_MANAGER_CINFO_CMD:
10330 {
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010331 struct policy_mgr_conc_connection_info *conn_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010332 uint32_t i = 0, len = 0;
10333
Krunal Sonia6e505b2017-01-12 12:25:18 -080010334 hdd_info("<iwpriv wlan0 pm_cinfo> is called");
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080010335 conn_info = policy_mgr_get_conn_info(&len);
Krunal Sonia6e505b2017-01-12 12:25:18 -080010336 pr_info("+--------------------------+\n");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010337 for (i = 0; i < len; i++) {
Jeff Johnson59eb5fd2017-10-05 09:42:39 -070010338 pr_info("|table_index[%d]\t\t\n", i);
10339 pr_info("|\t|vdev_id - %-10d|\n", conn_info->vdev_id);
10340 pr_info("|\t|chan - %-10d|\n", conn_info->chan);
10341 pr_info("|\t|bw - %-10d|\n", conn_info->bw);
10342 pr_info("|\t|mode - %-10d|\n", conn_info->mode);
10343 pr_info("|\t|mac - %-10d|\n", conn_info->mac);
10344 pr_info("|\t|in_use - %-10d|\n", conn_info->in_use);
10345 pr_info("+--------------------------+\n");
10346 conn_info++;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010347 }
10348 }
10349 break;
10350
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010351
10352#ifdef FEATURE_WLAN_TDLS
10353 case WE_TDLS_CONFIG_PARAMS:
10354 {
Jeff Johnsona0ce1022017-10-01 20:09:16 -070010355 struct hdd_tdls_config_params tdlsParams;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010356
10357 tdlsParams.tdls = apps_args[0];
10358 tdlsParams.tx_period_t = apps_args[1];
10359 tdlsParams.tx_packet_n = apps_args[2];
10360 /* ignore args[3] as discovery_period is not used anymore */
10361 tdlsParams.discovery_tries_n = apps_args[4];
10362 /* ignore args[5] as idle_timeout is not used anymore */
10363 tdlsParams.idle_packet_n = apps_args[6];
10364 /* ignore args[7] as rssi_hysteresis is not used anymore */
10365 tdlsParams.rssi_trigger_threshold = apps_args[8];
10366 tdlsParams.rssi_teardown_threshold = apps_args[9];
10367 tdlsParams.rssi_delta = apps_args[10];
10368
10369 wlan_hdd_tdls_set_params(dev, &tdlsParams);
10370 }
10371 break;
10372#endif
10373 case WE_UNIT_TEST_CMD:
10374 {
Krunal Soniaadaa272017-10-04 16:42:55 -070010375 QDF_STATUS status;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070010376
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010377 if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
10378 (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
Krunal Soniaadaa272017-10-04 16:42:55 -070010379 hdd_err("Invalid MODULE ID %d", apps_args[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010380 return -EINVAL;
10381 }
Krunal Soniaadaa272017-10-04 16:42:55 -070010382 if ((apps_args[1] >= (WMA_MAX_NUM_ARGS)) ||
Anurag Chouhan77564182016-09-03 16:38:01 +053010383 (apps_args[1] < 0)) {
Krunal Soniaadaa272017-10-04 16:42:55 -070010384 hdd_err("Too Many/Few args %d", apps_args[1]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010385 return -EINVAL;
10386 }
Krunal Soniaadaa272017-10-04 16:42:55 -070010387 status = sme_send_unit_test_cmd(adapter->sessionId,
10388 apps_args[0],
10389 apps_args[1],
10390 &apps_args[2]);
10391 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson21d63bb2017-10-07 17:45:33 -070010392 hdd_err("sme_send_unit_test_cmd returned %d", status);
10393 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010394 }
10395 }
10396 break;
10397#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
10398 case WE_LED_FLASHING_PARAM:
10399 {
10400 int i;
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070010401
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010402 if (num_args != 4) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010403 hdd_err("gpio_control: 4 parameters are required");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010404 return -EINVAL;
10405 }
10406 for (i = 0; i < num_args; i++) {
10407 if (apps_args[i] >= 0x7fffffff) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010408 hdd_err("gpio_control: parameter should be less than 0x7fffffff");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010409 return -EINVAL;
10410 }
10411 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010412 sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010413 0, apps_args[0], apps_args[1]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010414 sme_set_led_flashing(WLAN_HDD_GET_HAL_CTX(adapter),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010415 1, apps_args[2], apps_args[3]);
10416 }
10417 break;
10418#endif
Poddar, Siddarth176c4362016-10-03 12:25:00 +053010419 case WE_SET_PKTLOG:
10420 {
10421 int ret;
10422
10423 if (num_args < 1 || num_args > 2) {
10424 hdd_err("pktlog: either 1 or 2 parameters are required");
10425 return -EINVAL;
10426 }
10427
10428 ret = hdd_process_pktlog_command(hdd_ctx, apps_args[0],
10429 apps_args[1]);
10430 if (ret)
10431 return ret;
10432 break;
10433 }
10434
Manjeet Singhf82ed072016-07-08 11:40:00 +053010435 case WE_MAC_PWR_DEBUG_CMD:
10436 {
10437 struct sir_mac_pwr_dbg_cmd mac_pwr_dbg_args;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010438 tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
Manjeet Singhf82ed072016-07-08 11:40:00 +053010439 int i, j;
10440
10441 if (num_args < 3) {
10442 hdd_err("number of arguments can't be null %d",
10443 num_args);
10444 return -EINVAL;
10445 }
10446 if (num_args - 3 != apps_args[2]) {
10447 hdd_err("arg list of size %d doesn't match num_args %d",
10448 num_args-3, apps_args[2]);
10449 return -EINVAL;
10450 }
10451 if ((apps_args[1] < WLAN_MODULE_ID_MIN) ||
10452 (apps_args[1] >= WLAN_MODULE_ID_MAX)) {
10453 hdd_err("Invalid MODULE ID %d", apps_args[1]);
10454 return -EINVAL;
10455 }
10456 if (apps_args[2] > (MAX_POWER_DBG_ARGS_SUPPORTED)) {
10457 hdd_err("Too Many args %d", apps_args[2]);
10458 return -EINVAL;
10459 }
10460 mac_pwr_dbg_args.pdev_id = apps_args[0];
10461 mac_pwr_dbg_args.module_id = apps_args[1];
10462 mac_pwr_dbg_args.num_args = apps_args[2];
10463
10464 for (i = 0, j = 3; i < mac_pwr_dbg_args.num_args; i++, j++)
10465 mac_pwr_dbg_args.args[i] = apps_args[j];
10466
10467 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010468 sme_process_mac_pwr_dbg_cmd(hal, adapter->sessionId,
Manjeet Singhf82ed072016-07-08 11:40:00 +053010469 &mac_pwr_dbg_args)) {
10470 return -EINVAL;
10471 }
10472 }
10473 break;
Krunal Sonia6e505b2017-01-12 12:25:18 -080010474 case WE_POLICY_MANAGER_CLIST_CMD:
10475 case WE_POLICY_MANAGER_DLIST_CMD:
10476 case WE_POLICY_MANAGER_ULIST_CMD:
10477 case WE_POLICY_MANAGER_DBS_CMD:
10478 case WE_POLICY_MANAGER_PCL_CMD:
10479 case WE_POLICY_SET_HW_MODE_CMD:
10480 case WE_POLICY_MANAGER_QUERY_ACTION_CMD:
10481 case WE_POLICY_MANAGER_QUERY_ALLOW_CMD:
10482 case WE_POLICY_MANAGER_SCENARIO_CMD:
10483 {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010484 iw_get_policy_manager_ut_ops(hdd_ctx, adapter,
Krunal Sonia6e505b2017-01-12 12:25:18 -080010485 sub_cmd, apps_args);
10486 }
10487 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010488 default:
10489 {
Jeff Johnson99bac312016-06-28 10:38:18 -070010490 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010491 }
10492 break;
10493 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010494 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010495 return 0;
10496}
10497
10498/**
10499 * iw_hdd_set_var_ints_getnone() - set var ints getnone callback
10500 * @dev: pointer to net_device structure
10501 * @info: pointer to iw_request_info structure
10502 * @wrqu: pointer to iwreq_data
10503 * @extra; extra
10504 *
10505 * Return: 0 on success, error number otherwise
10506 *
10507 */
10508static int iw_hdd_set_var_ints_getnone(struct net_device *dev,
10509 struct iw_request_info *info,
10510 union iwreq_data *wrqu, char *extra)
10511{
10512 union iwreq_data u_priv_wrqu;
10513 int apps_args[MAX_VAR_ARGS] = {0};
10514 int ret, num_args;
10515
Mukul Sharma64a70e82015-11-02 20:05:09 +053010516 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010517 hdd_err("permission check failed");
Mukul Sharma64a70e82015-11-02 20:05:09 +053010518 return -EPERM;
10519 }
10520
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010521 /* Helper function to get iwreq_data with compat handling. */
10522 if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu))
10523 return -EINVAL;
10524
10525 if (NULL == u_priv_wrqu.data.pointer) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010526 hdd_err("NULL data pointer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010527 return -EINVAL;
10528 }
10529
10530 num_args = u_priv_wrqu.data.length;
10531 if (num_args > MAX_VAR_ARGS)
10532 num_args = MAX_VAR_ARGS;
10533
10534 if (copy_from_user(apps_args, u_priv_wrqu.data.pointer,
10535 (sizeof(int)) * num_args)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010536 hdd_err("failed to copy data from user buffer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010537 return -EFAULT;
10538 }
10539
10540 cds_ssr_protect(__func__);
10541 ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu,
10542 (char *)&apps_args);
10543 cds_ssr_unprotect(__func__);
10544 return ret;
10545}
10546
10547/**
10548 * iw_set_var_ints_getnone - Generic "set many" private ioctl handler
10549 * @dev: device upon which the ioctl was received
10550 * @info: ioctl request information
10551 * @wrqu: ioctl request data
10552 * @extra: ioctl extra data
10553 *
10554 * This is a generic handler for private ioctls which take multiple
10555 * arguments. Note that this implementation is also somewhat unique
10556 * in that it is shared by both STA-mode and SAP-mode interfaces.
10557 *
10558 * Return: 0 on success, non-zero on error
10559 */
10560int iw_set_var_ints_getnone(struct net_device *dev,
10561 struct iw_request_info *info,
10562 union iwreq_data *wrqu, char *extra)
10563{
10564 int ret;
10565
10566 cds_ssr_protect(__func__);
10567 ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
10568 cds_ssr_unprotect(__func__);
10569 return ret;
10570}
10571
10572/**
10573 * iw_add_tspec - Add TSpec private ioctl handler
10574 * @dev: device upon which the ioctl was received
10575 * @info: ioctl request information
10576 * @wrqu: ioctl request data
10577 * @extra: ioctl extra data
10578 *
10579 * Return: 0 on success, non-zero on error
10580 */
10581static int __iw_add_tspec(struct net_device *dev, struct iw_request_info *info,
10582 union iwreq_data *wrqu, char *extra)
10583{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010584 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -070010585 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010586 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
10587 int params[HDD_WLAN_WMM_PARAM_COUNT];
Abhishek Singh12be60f2017-08-11 13:52:42 +053010588 struct sme_qos_wmmtspecinfo tSpec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010589 uint32_t handle;
10590 struct iw_point s_priv_data;
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010591 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010592 int ret;
10593
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010594 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010595
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010596 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010597 ret = wlan_hdd_validate_context(hdd_ctx);
10598 if (0 != ret)
10599 return ret;
10600
Jeff Johnson441e1f72017-02-07 08:50:49 -080010601 ret = hdd_check_private_wext_control(hdd_ctx, info);
10602 if (0 != ret)
10603 return ret;
10604
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010605 /* make sure the application is sufficiently priviledged */
10606 /* note that the kernel will do this for "set" ioctls, but since */
10607 /* this ioctl wants to return status to user space it must be */
10608 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070010609 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010610 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010611
10612 /* we must be associated in order to add a tspec */
Jeff Johnsond377dce2017-10-04 10:32:42 -070010613 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010614 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10615 return 0;
10616 }
10617 /* since we are defined to be a "get" ioctl, and since the number */
10618 /* of params exceeds the number of params that wireless extensions */
10619 /* will pass down in the iwreq_data, we must copy the "set" params. */
10620 /* We must handle the compat for iwreq_data in 32U/64K environment. */
10621
10622 /* helper function to get iwreq_data with compat handling. */
10623 if (hdd_priv_get_data(&s_priv_data, wrqu)) {
10624 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10625 return 0;
10626 }
10627 /* make sure all params are correctly passed to function */
10628 if ((NULL == s_priv_data.pointer) ||
10629 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) {
10630 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10631 return 0;
10632 }
10633 /* from user space ourselves */
10634 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params))) {
10635 /* hmmm, can't get them */
10636 return -EIO;
10637 }
10638 /* clear the tspec */
10639 memset(&tSpec, 0, sizeof(tSpec));
10640
10641 /* validate the handle */
10642 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
10643 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
10644 /* that one is reserved */
10645 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10646 return 0;
10647 }
10648 /* validate the TID */
10649 if (params[HDD_WLAN_WMM_PARAM_TID] > 7) {
10650 /* out of range */
10651 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10652 return 0;
10653 }
10654 tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
10655
10656 /* validate the direction */
10657 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) {
10658 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
10659 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
10660 break;
10661
10662 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
10663 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
10664 break;
10665
10666 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
10667 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
10668 break;
10669
10670 default:
10671 /* unknown */
10672 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10673 return 0;
10674 }
10675
10676 tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
10677
10678 /* validate the user priority */
10679 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) {
10680 /* out of range */
10681 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10682 return 0;
10683 }
10684 tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
10685 if (0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010686 hdd_err("***ts_info.up out of bounds***");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010687 return 0;
10688 }
10689
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010690 hdd_debug("TS_INFO PSB %d UP %d !!!",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010691 tSpec.ts_info.psb, tSpec.ts_info.up);
10692
10693 tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
10694 tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
10695 tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
10696 tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
10697 tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
10698 tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
10699 tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
10700 tSpec.surplus_bw_allowance =
10701 params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
10702 tSpec.min_service_interval =
10703 params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
10704 tSpec.max_service_interval =
10705 params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
10706 tSpec.suspension_interval =
10707 params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
10708 tSpec.inactivity_interval =
10709 params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
10710
10711 tSpec.ts_info.burst_size_defn =
10712 params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
10713
10714 /* validate the ts info ack policy */
10715 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) {
10716 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK:
10717 tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
10718 break;
10719
10720 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
10721 tSpec.ts_info.ack_policy =
10722 SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
10723 break;
10724
10725 default:
10726 /* unknown */
10727 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10728 return 0;
10729 }
10730
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010731 *pStatus = hdd_wmm_addts(adapter, handle, &tSpec);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010732 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010733 return 0;
10734}
10735
10736static int iw_add_tspec(struct net_device *dev,
10737 struct iw_request_info *info,
10738 union iwreq_data *wrqu, char *extra)
10739{
10740 int ret;
10741
10742 cds_ssr_protect(__func__);
10743 ret = __iw_add_tspec(dev, info, wrqu, extra);
10744 cds_ssr_unprotect(__func__);
10745
10746 return ret;
10747}
10748
10749/**
10750 * iw_del_tspec - Delete TSpec private ioctl handler
10751 * @dev: device upon which the ioctl was received
10752 * @info: ioctl request information
10753 * @wrqu: ioctl request data
10754 * @extra: ioctl extra data
10755 *
10756 * Return: 0 on success, non-zero on error
10757 */
10758static int __iw_del_tspec(struct net_device *dev, struct iw_request_info *info,
10759 union iwreq_data *wrqu, char *extra)
10760{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010761 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010762 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010763 int *params = (int *)extra;
10764 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
10765 uint32_t handle;
10766 int ret;
10767
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010768 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010769
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010770 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010771 ret = wlan_hdd_validate_context(hdd_ctx);
10772 if (0 != ret)
10773 return ret;
10774
Jeff Johnson441e1f72017-02-07 08:50:49 -080010775 ret = hdd_check_private_wext_control(hdd_ctx, info);
10776 if (0 != ret)
10777 return ret;
10778
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010779 /* make sure the application is sufficiently priviledged */
10780 /* note that the kernel will do this for "set" ioctls, but since */
10781 /* this ioctl wants to return status to user space it must be */
10782 /* defined as a "get" ioctl */
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070010783 if (!capable(CAP_NET_ADMIN))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010784 return -EPERM;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010785
10786 /* although we are defined to be a "get" ioctl, the params we require */
10787 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
10788 /* is no need to copy the params from user space */
10789
10790 /* validate the handle */
10791 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
10792 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
10793 /* that one is reserved */
10794 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10795 return 0;
10796 }
10797
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010798 *pStatus = hdd_wmm_delts(adapter, handle);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010799 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010800 return 0;
10801}
10802
10803static int iw_del_tspec(struct net_device *dev,
10804 struct iw_request_info *info,
10805 union iwreq_data *wrqu, char *extra)
10806{
10807 int ret;
10808
10809 cds_ssr_protect(__func__);
10810 ret = __iw_del_tspec(dev, info, wrqu, extra);
10811 cds_ssr_unprotect(__func__);
10812
10813 return ret;
10814}
10815
10816/**
10817 * iw_get_tspec - Get TSpec private ioctl handler
10818 * @dev: device upon which the ioctl was received
10819 * @info: ioctl request information
10820 * @wrqu: ioctl request data
10821 * @extra: ioctl extra data
10822 *
10823 * Return: 0 on success, non-zero on error
10824 */
10825static int __iw_get_tspec(struct net_device *dev, struct iw_request_info *info,
10826 union iwreq_data *wrqu, char *extra)
10827{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010828 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010829 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010830 int *params = (int *)extra;
10831 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *) extra;
10832 uint32_t handle;
10833 int ret;
10834
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010835 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010836
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010837 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010838 ret = wlan_hdd_validate_context(hdd_ctx);
10839 if (0 != ret)
10840 return ret;
10841
Jeff Johnson441e1f72017-02-07 08:50:49 -080010842 ret = hdd_check_private_wext_control(hdd_ctx, info);
10843 if (0 != ret)
10844 return ret;
10845
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010846 /* although we are defined to be a "get" ioctl, the params we require */
10847 /* will fit in the iwreq_data, therefore unlike iw_add_tspec() there */
10848 /* is no need to copy the params from user space */
10849
10850 /* validate the handle */
10851 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
10852 if (HDD_WMM_HANDLE_IMPLICIT == handle) {
10853 /* that one is reserved */
10854 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
10855 return 0;
10856 }
10857
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010858 *pStatus = hdd_wmm_checkts(adapter, handle);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010859 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010860 return 0;
10861}
10862
10863static int iw_get_tspec(struct net_device *dev,
10864 struct iw_request_info *info,
10865 union iwreq_data *wrqu, char *extra)
10866{
10867 int ret;
10868
10869 cds_ssr_protect(__func__);
10870 ret = __iw_get_tspec(dev, info, wrqu, extra);
10871 cds_ssr_unprotect(__func__);
10872
10873 return ret;
10874}
10875
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010876/**
10877 * iw_set_fties - Set FT IEs private ioctl handler
10878 * @dev: device upon which the ioctl was received
10879 * @info: ioctl request information
10880 * @wrqu: ioctl request data
10881 * @extra: ioctl extra data
10882 *
10883 * Each time the supplicant has the auth_request or reassoc request
10884 * IEs ready they are pushed to the driver. The driver will in turn
10885 * use it to send out the auth req and reassoc req for 11r FT Assoc.
10886 *
10887 * Return: 0 on success, non-zero on error
10888 */
10889static int __iw_set_fties(struct net_device *dev, struct iw_request_info *info,
10890 union iwreq_data *wrqu, char *extra)
10891{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010892 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnsond377dce2017-10-04 10:32:42 -070010893 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010894 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010895 int ret;
10896
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010897 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010898
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010899 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010900 ret = wlan_hdd_validate_context(hdd_ctx);
10901 if (0 != ret)
10902 return ret;
10903
Jeff Johnson441e1f72017-02-07 08:50:49 -080010904 ret = hdd_check_private_wext_control(hdd_ctx, info);
10905 if (0 != ret)
10906 return ret;
10907
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010908 if (!wrqu->data.length) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010909 hdd_err("called with 0 length IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010910 return -EINVAL;
10911 }
10912 if (wrqu->data.pointer == NULL) {
Jeff Johnson99bac312016-06-28 10:38:18 -070010913 hdd_err("called with NULL IE");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010914 return -EINVAL;
10915 }
10916 /* Added for debug on reception of Re-assoc Req. */
Jeff Johnsond377dce2017-10-04 10:32:42 -070010917 if (eConnectionState_Associated != sta_ctx->conn_info.connState) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010918 hdd_debug("Called with Ie of length = %d when not associated",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010919 wrqu->data.length);
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010920 hdd_debug("Should be Re-assoc Req IEs");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010921 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080010922 hdd_debug("called with Ie of length = %d", wrqu->data.length);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010923
10924 /* Pass the received FT IEs to SME */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010925 sme_set_ft_ies(WLAN_HDD_GET_HAL_CTX(adapter), adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010926 extra, wrqu->data.length);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010927 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010928 return 0;
10929}
10930
10931static int iw_set_fties(struct net_device *dev,
10932 struct iw_request_info *info,
10933 union iwreq_data *wrqu, char *extra)
10934{
10935 int ret;
10936
10937 cds_ssr_protect(__func__);
10938 ret = __iw_set_fties(dev, info, wrqu, extra);
10939 cds_ssr_unprotect(__func__);
10940
10941 return ret;
10942}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010943
Dustin Brown0cbc7572016-12-16 13:54:40 -080010944/**
10945 * iw_set_dynamic_mcbc_filter() - Set Dynamic MCBC Filter ioctl handler
10946 * @dev: device upon which the ioctl was received
10947 * @info: ioctl request information
10948 * @wrqu: ioctl request data
10949 * @extra: ioctl extra data
10950 *
Dustin Brown860566f2017-01-31 15:24:43 -080010951 * This IOCTL is OBSOLETE as of Jan 30, 2017. We are leaving it here for the
10952 * time being to provide guidance in migrating to standard APIs.
10953 *
Dustin Brown0cbc7572016-12-16 13:54:40 -080010954 * Return: 0 on success, non-zero on error
10955 */
10956static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
10957 struct iw_request_info *info,
10958 union iwreq_data *wrqu,
10959 char *extra)
10960{
Dustin Brown860566f2017-01-31 15:24:43 -080010961 hdd_err("\n"
10962 "setMCBCFilter is obsolete. Use the following instead:\n"
10963 "Configure multicast filtering via the ‘ip’ command.\n"
10964 "\tip maddr add 11:22:33:44:55:66 dev wlan0 # allow traffic to address\n"
10965 "\tip maddr del 11:22:33:44:55:66 dev wlan0 # undo allow\n"
10966 "Configure broadcast filtering via ini item, 'g_enable_non_arp_bc_hw_filter.'\n"
10967 "\tg_enable_non_arp_bc_hw_filter=1 # drop all non-ARP broadcast traffic\n"
10968 "\tg_enable_non_arp_bc_hw_filter=0 # allow all broadcast traffic");
Jeff Johnson59eb5fd2017-10-05 09:42:39 -070010969 return -EINVAL;
Dustin Brown0cbc7572016-12-16 13:54:40 -080010970}
10971
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010972/**
10973 * iw_set_host_offload - Set host offload ioctl handler
10974 * @dev: device upon which the ioctl was received
10975 * @info: ioctl request information
10976 * @wrqu: ioctl request data
10977 * @extra: ioctl extra data
10978 *
10979 * Return: 0 on success, non-zero on error
10980 */
10981static int __iw_set_host_offload(struct net_device *dev,
10982 struct iw_request_info *info,
10983 union iwreq_data *wrqu, char *extra)
10984{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010985 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Srinivas Girigowda077143e2017-03-25 10:47:27 -070010986 struct host_offload_req *pRequest = (struct host_offload_req *) extra;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010987 tSirHostOffloadReq offloadRequest;
Jeff Johnson6d38ab82017-08-28 11:36:27 -070010988 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010989 int ret;
10990
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080010991 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053010992
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070010993 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080010994 ret = wlan_hdd_validate_context(hdd_ctx);
10995 if (0 != ret)
10996 return ret;
10997
Jeff Johnson441e1f72017-02-07 08:50:49 -080010998 ret = hdd_check_private_wext_control(hdd_ctx, info);
10999 if (0 != ret)
11000 return ret;
11001
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011002 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
Jeff Johnson99bac312016-06-28 10:38:18 -070011003 hdd_err("dev is not in CONNECTED state, ignore!!!");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011004 return -EINVAL;
11005 }
11006
11007 /* Debug display of request components. */
11008 switch (pRequest->offloadType) {
11009 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011010 hdd_debug("Host offload request: ARP reply");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011011 switch (pRequest->enableOrDisable) {
11012 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011013 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011014 break;
11015 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011016 hdd_debug(" BC Filtering enable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011017 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011018 hdd_debug(" ARP offload enable");
11019 hdd_debug(" IP address: %d.%d.%d.%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011020 pRequest->params.hostIpv4Addr[0],
11021 pRequest->params.hostIpv4Addr[1],
11022 pRequest->params.hostIpv4Addr[2],
11023 pRequest->params.hostIpv4Addr[3]);
11024 }
11025 break;
11026
11027 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011028 hdd_debug("Host offload request: neighbor discovery");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011029 switch (pRequest->enableOrDisable) {
11030 case WLAN_OFFLOAD_DISABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011031 hdd_debug(" disable");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011032 break;
11033 case WLAN_OFFLOAD_ENABLE:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011034 hdd_debug(" enable");
11035 hdd_debug(" IP address: %x:%x:%x:%x:%x:%x:%x:%x",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011036 *(uint16_t *) (pRequest->params.hostIpv6Addr),
11037 *(uint16_t *) (pRequest->params.hostIpv6Addr +
11038 2),
11039 *(uint16_t *) (pRequest->params.hostIpv6Addr +
11040 4),
11041 *(uint16_t *) (pRequest->params.hostIpv6Addr +
11042 6),
11043 *(uint16_t *) (pRequest->params.hostIpv6Addr +
11044 8),
11045 *(uint16_t *) (pRequest->params.hostIpv6Addr +
11046 10),
11047 *(uint16_t *) (pRequest->params.hostIpv6Addr +
11048 12),
11049 *(uint16_t *) (pRequest->params.hostIpv6Addr +
11050 14));
11051 }
11052 }
11053
11054 /* Execute offload request. The reason that we can copy the
11055 * request information from the ioctl structure to the SME
11056 * structure is that they are laid out exactly the same.
11057 * Otherwise, each piece of information would have to be
11058 * copied individually.
11059 */
11060 memcpy(&offloadRequest, pRequest, wrqu->data.length);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053011061 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011062 sme_set_host_offload(WLAN_HDD_GET_HAL_CTX(adapter),
11063 adapter->sessionId, &offloadRequest)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070011064 hdd_err("Failure to execute host offload request");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011065 return -EINVAL;
11066 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053011067 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011068 return 0;
11069}
11070
11071static int iw_set_host_offload(struct net_device *dev,
11072 struct iw_request_info *info,
11073 union iwreq_data *wrqu, char *extra)
11074{
11075 int ret;
11076
11077 cds_ssr_protect(__func__);
11078 ret = __iw_set_host_offload(dev, info, wrqu, extra);
11079 cds_ssr_unprotect(__func__);
11080
11081 return ret;
11082}
11083
11084/**
11085 * iw_set_keepalive_params - Set keepalive params ioctl handler
11086 * @dev: device upon which the ioctl was received
11087 * @info: ioctl request information
11088 * @wrqu: ioctl request data
11089 * @extra: ioctl extra data
11090 *
11091 * Return: 0 on success, non-zero on error
11092 */
11093static int __iw_set_keepalive_params(struct net_device *dev,
11094 struct iw_request_info *info,
11095 union iwreq_data *wrqu, char *extra)
11096{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011097 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080011098 tpSirKeepAliveReq request = (tpSirKeepAliveReq) extra;
Jeff Johnson6d38ab82017-08-28 11:36:27 -070011099 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011100 int ret;
11101
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080011102 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053011103
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011104 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011105 ret = wlan_hdd_validate_context(hdd_ctx);
11106 if (0 != ret)
11107 return ret;
11108
Jeff Johnson441e1f72017-02-07 08:50:49 -080011109 ret = hdd_check_private_wext_control(hdd_ctx, info);
11110 if (0 != ret)
11111 return ret;
11112
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080011113 if (wrqu->data.length != sizeof(*request)) {
11114 hdd_err("Invalid length %d", wrqu->data.length);
11115 return -EINVAL;
11116 }
11117
11118 if (request->timePeriod > WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX) {
11119 hdd_err("Value of timePeriod %d exceed Max limit %d",
11120 request->timePeriod,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011121 WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD_STAMAX);
11122 return -EINVAL;
11123 }
11124
11125 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011126 hdd_debug("Set Keep Alive Request : TimePeriod %d size %zu",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080011127 request->timePeriod, sizeof(tSirKeepAliveReq));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011128
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080011129 switch (request->packetType) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011130 case WLAN_KEEP_ALIVE_NULL_PKT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011131 hdd_debug("Keep Alive Request: Tx NULL");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011132 break;
11133
11134 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011135 hdd_debug("Keep Alive Request: Tx UnSolicited ARP RSP");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011136
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011137 hdd_debug("Host IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080011138 request->hostIpv4Addr[0], request->hostIpv4Addr[1],
11139 request->hostIpv4Addr[2], request->hostIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011140
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011141 hdd_debug("Dest IP address: %d.%d.%d.%d",
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080011142 request->destIpv4Addr[0], request->destIpv4Addr[1],
11143 request->destIpv4Addr[2], request->destIpv4Addr[3]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011144
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011145 hdd_debug("Dest MAC address: "MAC_ADDRESS_STR,
Srinivas Girigowda9c330a92015-11-24 12:28:25 -080011146 MAC_ADDR_ARRAY(request->dest_macaddr.bytes));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011147 break;
11148 }
11149
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011150 hdd_debug("Keep alive period %d", request->timePeriod);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011151
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053011152 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011153 sme_set_keep_alive(WLAN_HDD_GET_HAL_CTX(adapter),
11154 adapter->sessionId, request)) {
Rajeev Kumar3ddf1c62015-11-03 14:10:13 -080011155 hdd_err("Failure to execute Keep Alive");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011156 return -EINVAL;
11157 }
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053011158 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011159 return 0;
11160}
11161
11162static int iw_set_keepalive_params(struct net_device *dev,
11163 struct iw_request_info *info,
11164 union iwreq_data *wrqu,
11165 char *extra)
11166{
11167 int ret;
11168
11169 cds_ssr_protect(__func__);
11170 ret = __iw_set_keepalive_params(dev, info, wrqu, extra);
11171 cds_ssr_unprotect(__func__);
11172
11173 return ret;
11174}
11175
11176#ifdef WLAN_FEATURE_PACKET_FILTERING
11177/**
11178 * wlan_hdd_set_filter() - Set packet filter
11179 * @hdd_ctx: Global HDD context
11180 * @request: Packet filter request struct
11181 * @sessionId: Target session for the request
11182 *
11183 * Return: 0 on success, non-zero on error
11184 */
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +053011185int wlan_hdd_set_filter(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011186 struct pkt_filter_cfg *request,
11187 uint8_t sessionId)
11188{
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011189 struct pmo_rcv_pkt_fltr_cfg *pmo_set_pkt_fltr_req = NULL;
11190 struct pmo_rcv_pkt_fltr_clear_param *pmo_clr_pkt_fltr_param = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011191 int i = 0;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011192 QDF_STATUS status = QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011193
11194 if (hdd_ctx->config->disablePacketFilter) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011195 hdd_warn("Packet filtering disabled in ini");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011196 return 0;
11197 }
11198
11199 /* Debug display of request components. */
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011200 hdd_debug("Packet Filter Request : FA %d params %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011201 request->filter_action, request->num_params);
11202
11203 switch (request->filter_action) {
11204 case HDD_RCV_FILTER_SET:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011205 hdd_debug("Set Packet Filter Request for Id: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011206 request->filter_id);
11207
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011208 pmo_set_pkt_fltr_req =
11209 qdf_mem_malloc(sizeof(*pmo_set_pkt_fltr_req));
11210 if (!pmo_set_pkt_fltr_req) {
Mukul Sharmad75a6672017-06-22 15:40:53 +053011211 hdd_err("unable to allocate pmo_set_pkt_fltr_req");
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011212 return QDF_STATUS_E_NOMEM;
11213 }
11214
11215 pmo_set_pkt_fltr_req->filter_id = request->filter_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011216 if (request->num_params >= HDD_MAX_CMP_PER_PACKET_FILTER) {
11217 hdd_err("Number of Params exceed Max limit %d",
11218 request->num_params);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011219 status = QDF_STATUS_E_INVAL;
11220 goto out;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011221 }
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011222 pmo_set_pkt_fltr_req->num_params = request->num_params;
11223 pmo_set_pkt_fltr_req->coalesce_time = 0;
Srinivas Girigowdabbbecad2017-06-28 16:01:48 -070011224 pmo_set_pkt_fltr_req->filter_type = PMO_RCV_FILTER_TYPE_FILTER_PKT;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011225 for (i = 0; i < request->num_params; i++) {
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011226 pmo_set_pkt_fltr_req->params_data[i].protocol_layer =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011227 request->params_data[i].protocol_layer;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011228 pmo_set_pkt_fltr_req->params_data[i].compare_flag =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011229 request->params_data[i].compare_flag;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011230 pmo_set_pkt_fltr_req->params_data[i].data_offset =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011231 request->params_data[i].data_offset;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011232 pmo_set_pkt_fltr_req->params_data[i].data_length =
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011233 request->params_data[i].data_length;
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011234 pmo_set_pkt_fltr_req->params_data[i].reserved = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011235
Dustin Brown4d1e8462016-12-14 12:12:24 -080011236 if (request->params_data[i].data_offset >
11237 SIR_MAX_FILTER_TEST_DATA_OFFSET) {
11238 hdd_err("Invalid data offset %u for param %d (max = %d)",
11239 request->params_data[i].data_offset,
11240 i,
11241 SIR_MAX_FILTER_TEST_DATA_OFFSET);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011242 status = QDF_STATUS_E_INVAL;
11243 goto out;
Dustin Brown4d1e8462016-12-14 12:12:24 -080011244 }
11245
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011246 if (request->params_data[i].data_length >
11247 SIR_MAX_FILTER_TEST_DATA_LEN) {
11248 hdd_err("Error invalid data length %d",
11249 request->params_data[i].data_length);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011250 status = QDF_STATUS_E_INVAL;
11251 goto out;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011252 }
11253
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011254 hdd_debug("Proto %d Comp Flag %d Filter Type %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011255 request->params_data[i].protocol_layer,
11256 request->params_data[i].compare_flag,
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011257 pmo_set_pkt_fltr_req->filter_type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011258
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011259 hdd_debug("Data Offset %d Data Len %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011260 request->params_data[i].data_offset,
11261 request->params_data[i].data_length);
11262
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011263 if (sizeof(
11264 pmo_set_pkt_fltr_req->params_data[i].compare_data)
Rajeev Kumarf5b6da22016-04-15 13:24:03 -070011265 < (request->params_data[i].data_length)) {
11266 hdd_err("Error invalid data length %d",
11267 request->params_data[i].data_length);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011268 status = QDF_STATUS_E_INVAL;
11269 goto out;
Rajeev Kumarf5b6da22016-04-15 13:24:03 -070011270 }
11271
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011272 memcpy(
11273 &pmo_set_pkt_fltr_req->params_data[i].compare_data,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011274 request->params_data[i].compare_data,
11275 request->params_data[i].data_length);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011276 memcpy(&pmo_set_pkt_fltr_req->params_data[i].data_mask,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011277 request->params_data[i].data_mask,
11278 request->params_data[i].data_length);
11279
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011280 hdd_debug("CData %d CData %d CData %d CData %d CData %d CData %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011281 request->params_data[i].compare_data[0],
11282 request->params_data[i].compare_data[1],
11283 request->params_data[i].compare_data[2],
11284 request->params_data[i].compare_data[3],
11285 request->params_data[i].compare_data[4],
11286 request->params_data[i].compare_data[5]);
11287
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011288 hdd_debug("MData %d MData %d MData %d MData %d MData %d MData %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011289 request->params_data[i].data_mask[0],
11290 request->params_data[i].data_mask[1],
11291 request->params_data[i].data_mask[2],
11292 request->params_data[i].data_mask[3],
11293 request->params_data[i].data_mask[4],
11294 request->params_data[i].data_mask[5]);
11295 }
11296
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053011297 if (QDF_STATUS_SUCCESS !=
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011298 pmo_ucfg_set_pkt_filter(hdd_ctx->hdd_psoc,
11299 pmo_set_pkt_fltr_req,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011300 sessionId)) {
11301 hdd_err("Failure to execute Set Filter");
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011302 status = QDF_STATUS_E_INVAL;
11303 goto out;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011304 }
11305
11306 break;
11307
11308 case HDD_RCV_FILTER_CLEAR:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011309 hdd_debug("Clear Packet Filter Request for Id: %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011310 request->filter_id);
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011311
11312 pmo_clr_pkt_fltr_param = qdf_mem_malloc(
11313 sizeof(*pmo_clr_pkt_fltr_param));
11314 if (!pmo_clr_pkt_fltr_param) {
11315 hdd_err("unable to allocate pmo_clr_pkt_fltr_param");
11316 return QDF_STATUS_E_NOMEM;
11317 }
11318
11319 pmo_clr_pkt_fltr_param->filter_id = request->filter_id;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053011320 if (QDF_STATUS_SUCCESS !=
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011321 pmo_ucfg_clear_pkt_filter(hdd_ctx->hdd_psoc,
11322 pmo_clr_pkt_fltr_param,
11323 sessionId)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011324 hdd_err("Failure to execute Clear Filter");
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011325 status = QDF_STATUS_E_INVAL;
11326 goto out;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011327 }
11328 break;
11329
11330 default:
11331 hdd_err("Packet Filter Request: Invalid %d",
11332 request->filter_action);
11333 return -EINVAL;
11334 }
Ravi Kumar Bokka4bd571d2017-04-17 14:21:10 +053011335
11336out:
11337 if (pmo_set_pkt_fltr_req)
11338 qdf_mem_free(pmo_set_pkt_fltr_req);
11339 if (pmo_clr_pkt_fltr_param)
11340 qdf_mem_free(pmo_clr_pkt_fltr_param);
11341
11342 return status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011343}
11344
11345/**
11346 * __iw_set_packet_filter_params() - set packet filter parameters in target
11347 * @dev: Pointer to netdev
11348 * @info: Pointer to iw request info
11349 * @wrqu: Pointer to data
11350 * @extra: Pointer to extra data
11351 *
11352 * Return: 0 on success, non-zero on error
11353 */
11354static int __iw_set_packet_filter_params(struct net_device *dev,
11355 struct iw_request_info *info,
11356 union iwreq_data *wrqu, char *extra)
11357{
11358 int ret;
Jeff Johnson6d38ab82017-08-28 11:36:27 -070011359 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011360 struct iw_point priv_data;
Jeff Johnson3d278b02017-08-29 14:17:47 -070011361 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011362 struct pkt_filter_cfg *request = NULL;
11363
Mukul Sharma472382f2015-11-02 20:16:31 +053011364 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070011365 hdd_err("permission check failed");
Mukul Sharma472382f2015-11-02 20:16:31 +053011366 return -EPERM;
11367 }
11368
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080011369 ENTER_DEV(dev);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053011370
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011371 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
11372 ret = wlan_hdd_validate_context(hdd_ctx);
11373 if (0 != ret)
11374 return ret;
11375
Jeff Johnson441e1f72017-02-07 08:50:49 -080011376 ret = hdd_check_private_wext_control(hdd_ctx, info);
11377 if (0 != ret)
11378 return ret;
11379
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011380 if (hdd_priv_get_data(&priv_data, wrqu)) {
11381 hdd_err("failed to get priv data");
11382 return -EINVAL;
11383 }
11384
11385 if ((NULL == priv_data.pointer) || (0 == priv_data.length)) {
Jeff Johnson36e74c42017-09-18 08:15:42 -070011386 hdd_err("invalid priv data %pK or invalid priv data length %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011387 priv_data.pointer, priv_data.length);
11388 return -EINVAL;
11389 }
11390
Arun Khandavalli75d246b2017-08-07 19:46:06 +053011391 if (adapter->device_mode != QDF_STA_MODE) {
11392 hdd_err("Packet filter not supported for this mode :%d",
11393 adapter->device_mode);
11394 return -ENOTSUPP;
11395 }
11396
Mukul Sharmabe846bb2017-05-09 17:41:52 +053011397 if (!hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
11398 hdd_err("Packet filter not supported in disconnected state");
11399 return -ENOTSUPP;
11400 }
11401
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011402 /* copy data using copy_from_user */
11403 request = mem_alloc_copy_from_user_helper(priv_data.pointer,
11404 priv_data.length);
11405 if (NULL == request) {
11406 hdd_err("mem_alloc_copy_from_user_helper fail");
11407 return -ENOMEM;
11408 }
11409
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +053011410 if (request->filter_action == HDD_RCV_FILTER_SET)
11411 hdd_ctx->user_configured_pkt_filter_rules |=
11412 1 << request->filter_id;
11413 else if (request->filter_action == HDD_RCV_FILTER_CLEAR)
11414 hdd_ctx->user_configured_pkt_filter_rules &=
11415 ~(1 << request->filter_id);
11416
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011417 ret = wlan_hdd_set_filter(hdd_ctx, request, adapter->sessionId);
11418
Mahesh Kumar Kalikot Veetil9c656182016-11-02 10:28:03 -070011419 qdf_mem_free(request);
Hanumantha Reddy Pothula2db50ed2015-11-23 10:48:33 +053011420 EXIT();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011421 return ret;
11422}
11423
11424/**
11425 * iw_set_packet_filter_params() - set packet filter parameters in target
11426 * @dev: Pointer to netdev
11427 * @info: Pointer to iw request info
11428 * @wrqu: Pointer to data
11429 * @extra: Pointer to extra data
11430 *
11431 * Return: 0 on success, non-zero on error
11432 */
11433static int iw_set_packet_filter_params(struct net_device *dev,
11434 struct iw_request_info *info,
11435 union iwreq_data *wrqu, char *extra)
11436{
11437 int ret;
11438
11439 cds_ssr_protect(__func__);
11440 ret = __iw_set_packet_filter_params(dev, info, wrqu, extra);
11441 cds_ssr_unprotect(__func__);
11442
11443 return ret;
11444}
11445#endif
11446
11447
11448static int __iw_get_statistics(struct net_device *dev,
11449 struct iw_request_info *info,
11450 union iwreq_data *wrqu, char *extra)
11451{
11452
Anurag Chouhance0dc992016-02-16 18:18:03 +053011453 QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053011454 QDF_STATUS status = QDF_STATUS_SUCCESS;
Jeff Johnson2a722002017-09-30 20:02:35 -070011455 struct hdd_wext_state *pWextState;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011456 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
11457 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011458 char *p = extra;
11459 int tlen = 0;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011460 tCsrSummaryStatsInfo *pStats = &(adapter->hdd_stats.summary_stat);
11461 tCsrGlobalClassAStatsInfo *aStats = &(adapter->hdd_stats.ClassA_stat);
11462 tCsrGlobalClassDStatsInfo *dStats = &(adapter->hdd_stats.ClassD_stat);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011463 int ret;
11464
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080011465 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011466
11467 ret = wlan_hdd_validate_context(hdd_ctx);
11468 if (0 != ret)
11469 return ret;
11470
Jeff Johnson441e1f72017-02-07 08:50:49 -080011471 ret = hdd_check_private_wext_control(hdd_ctx, info);
11472 if (0 != ret)
11473 return ret;
11474
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011475 if (eConnectionState_Associated !=
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011476 (WLAN_HDD_GET_STATION_CTX_PTR(adapter))->conn_info.connState) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011477
11478 wrqu->txpower.value = 0;
11479 } else {
11480 status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD,
11481 SME_SUMMARY_STATS |
11482 SME_GLOBAL_CLASSA_STATS |
Jeff Johnsondfe89512017-03-10 15:50:00 -080011483 SME_GLOBAL_CLASSD_STATS,
Naveen Rawatd0ca4412017-06-16 14:19:19 -070011484 hdd_statistics_cb,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011485 (WLAN_HDD_GET_STATION_CTX_PTR
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011486 (adapter))->conn_info.staId[0],
11487 adapter, adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011488
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053011489 if (QDF_STATUS_SUCCESS != status) {
Jeff Johnson99bac312016-06-28 10:38:18 -070011490 hdd_err("Unable to retrieve SME statistics");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011491 return -EINVAL;
11492 }
11493
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011494 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011495
Anurag Chouhance0dc992016-02-16 18:18:03 +053011496 qdf_status =
Anurag Chouhanf04e84f2016-03-03 10:12:12 +053011497 qdf_wait_single_event(&pWextState->hdd_qdf_event,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011498 WLAN_WAIT_TIME_STATS);
Anurag Chouhance0dc992016-02-16 18:18:03 +053011499 if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070011500 hdd_err("SME timeout while retrieving statistics");
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070011501 /* Remove the SME statistics list by
11502 * passing NULL in callback argument
11503 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011504 status = sme_get_statistics(hdd_ctx->hHal, eCSR_HDD,
11505 SME_SUMMARY_STATS |
11506 SME_GLOBAL_CLASSA_STATS |
Jeff Johnsondfe89512017-03-10 15:50:00 -080011507 SME_GLOBAL_CLASSD_STATS,
Naveen Rawatd0ca4412017-06-16 14:19:19 -070011508 NULL,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011509 (WLAN_HDD_GET_STATION_CTX_PTR
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011510 (adapter))->conn_info.
11511 staId[0], adapter,
11512 adapter->sessionId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011513
11514 return -EINVAL;
11515 }
11516 FILL_TLV(p, (uint8_t) WLAN_STATS_RETRY_CNT,
11517 (uint8_t) sizeof(pStats->retry_cnt),
11518 (char *)&(pStats->retry_cnt[0]), tlen);
11519
11520 FILL_TLV(p, (uint8_t) WLAN_STATS_MUL_RETRY_CNT,
11521 (uint8_t) sizeof(pStats->multiple_retry_cnt),
11522 (char *)&(pStats->multiple_retry_cnt[0]), tlen);
11523
11524 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_FRM_CNT,
11525 (uint8_t) sizeof(pStats->tx_frm_cnt),
11526 (char *)&(pStats->tx_frm_cnt[0]), tlen);
11527
11528 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_FRM_CNT,
11529 (uint8_t) sizeof(pStats->rx_frm_cnt),
11530 (char *)&(pStats->rx_frm_cnt), tlen);
11531
11532 FILL_TLV(p, (uint8_t) WLAN_STATS_FRM_DUP_CNT,
11533 (uint8_t) sizeof(pStats->frm_dup_cnt),
11534 (char *)&(pStats->frm_dup_cnt), tlen);
11535
11536 FILL_TLV(p, (uint8_t) WLAN_STATS_FAIL_CNT,
11537 (uint8_t) sizeof(pStats->fail_cnt),
11538 (char *)&(pStats->fail_cnt[0]), tlen);
11539
11540 FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_FAIL_CNT,
11541 (uint8_t) sizeof(pStats->rts_fail_cnt),
11542 (char *)&(pStats->rts_fail_cnt), tlen);
11543
11544 FILL_TLV(p, (uint8_t) WLAN_STATS_ACK_FAIL_CNT,
11545 (uint8_t) sizeof(pStats->ack_fail_cnt),
11546 (char *)&(pStats->ack_fail_cnt), tlen);
11547
11548 FILL_TLV(p, (uint8_t) WLAN_STATS_RTS_SUC_CNT,
11549 (uint8_t) sizeof(pStats->rts_succ_cnt),
11550 (char *)&(pStats->rts_succ_cnt), tlen);
11551
11552 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_DISCARD_CNT,
11553 (uint8_t) sizeof(pStats->rx_discard_cnt),
11554 (char *)&(pStats->rx_discard_cnt), tlen);
11555
11556 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_ERROR_CNT,
11557 (uint8_t) sizeof(pStats->rx_error_cnt),
11558 (char *)&(pStats->rx_error_cnt), tlen);
11559
11560 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BYTE_CNT,
11561 (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]),
11562 (char *)&(dStats->tx_uc_byte_cnt[0]), tlen);
11563
11564 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BYTE_CNT,
11565 (uint8_t) sizeof(dStats->rx_byte_cnt),
11566 (char *)&(dStats->rx_byte_cnt), tlen);
11567
11568 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_RATE,
11569 (uint8_t) sizeof(dStats->rx_rate),
11570 (char *)&(dStats->rx_rate), tlen);
11571
11572 /* Transmit rate, in units of 500 kbit/sec */
11573 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_RATE,
11574 (uint8_t) sizeof(aStats->tx_rate),
11575 (char *)&(aStats->tx_rate), tlen);
11576
11577 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_UC_BYTE_CNT,
11578 (uint8_t) sizeof(dStats->rx_uc_byte_cnt[0]),
11579 (char *)&(dStats->rx_uc_byte_cnt[0]), tlen);
11580 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_MC_BYTE_CNT,
11581 (uint8_t) sizeof(dStats->rx_mc_byte_cnt),
11582 (char *)&(dStats->rx_mc_byte_cnt), tlen);
11583 FILL_TLV(p, (uint8_t) WLAN_STATS_RX_BC_BYTE_CNT,
11584 (uint8_t) sizeof(dStats->rx_bc_byte_cnt),
11585 (char *)&(dStats->rx_bc_byte_cnt), tlen);
11586 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_UC_BYTE_CNT,
11587 (uint8_t) sizeof(dStats->tx_uc_byte_cnt[0]),
11588 (char *)&(dStats->tx_uc_byte_cnt[0]), tlen);
11589 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_MC_BYTE_CNT,
11590 (uint8_t) sizeof(dStats->tx_mc_byte_cnt),
11591 (char *)&(dStats->tx_mc_byte_cnt), tlen);
11592 FILL_TLV(p, (uint8_t) WLAN_STATS_TX_BC_BYTE_CNT,
11593 (uint8_t) sizeof(dStats->tx_bc_byte_cnt),
11594 (char *)&(dStats->tx_bc_byte_cnt), tlen);
11595
11596 wrqu->data.length = tlen;
11597
11598 }
11599
11600 EXIT();
11601
11602 return 0;
11603}
11604
11605static int iw_get_statistics(struct net_device *dev,
11606 struct iw_request_info *info,
11607 union iwreq_data *wrqu, char *extra)
11608{
11609 int ret;
11610
11611 cds_ssr_protect(__func__);
11612 ret = __iw_get_statistics(dev, info, wrqu, extra);
11613 cds_ssr_unprotect(__func__);
11614
11615 return ret;
11616}
11617
11618#ifdef FEATURE_WLAN_SCAN_PNO
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011619/*Max Len for PNO notification*/
11620#define MAX_PNO_NOTIFY_LEN 100
Abhishek Singh0481d662017-04-11 18:20:11 +053011621static void found_pref_network_cb(struct wlan_objmgr_vdev *vdev,
11622 struct scan_event *event, void *args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011623{
Abhishek Singh0481d662017-04-11 18:20:11 +053011624 struct vdev_osif_priv *osif_priv;
11625 struct wireless_dev *wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011626 union iwreq_data wrqu;
11627 char buf[MAX_PNO_NOTIFY_LEN + 1];
11628
Abhishek Singh0481d662017-04-11 18:20:11 +053011629 wlan_vdev_obj_lock(vdev);
11630 osif_priv = wlan_vdev_get_ospriv(vdev);
11631 wlan_vdev_obj_unlock(vdev);
11632 if (!osif_priv) {
11633 hdd_err("osif_priv is null");
11634 return;
11635 }
11636
11637 wdev = osif_priv->wdev;
11638 if (!wdev) {
11639 hdd_err("wdev is null");
11640 return;
11641 }
11642
11643 hdd_debug("A preferred network was found");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011644
11645 /* create the event */
Abhishek Singh0481d662017-04-11 18:20:11 +053011646 qdf_mem_zero(&wrqu, sizeof(wrqu));
11647 qdf_mem_zero(buf, sizeof(buf));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011648
11649 snprintf(buf, MAX_PNO_NOTIFY_LEN,
Abhishek Singh0481d662017-04-11 18:20:11 +053011650 "QCOM: Found preferred network:");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011651
11652 wrqu.data.pointer = buf;
11653 wrqu.data.length = strlen(buf);
11654
11655 /* send the event */
11656
Abhishek Singh0481d662017-04-11 18:20:11 +053011657 wireless_send_event(wdev->netdev, IWEVCUSTOM, &wrqu, buf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011658}
11659
11660/**
11661 * __iw_set_pno() - Preferred Network Offload ioctl handler
11662 * @dev: device upon which the ioctl was received
11663 * @info: ioctl request information
11664 * @wrqu: ioctl request data
11665 * @extra: ioctl extra data
11666 *
11667 * This function parses a Preferred Network Offload command
11668 * Input is string based and expected to be of the form:
11669 *
11670 * <enable(1) | disable(0)>
11671 * when enabling:
11672 * <number of networks>
11673 * for each network:
11674 * <ssid_len> <ssid> <authentication> <encryption>
11675 * <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
Dustin Brown43e87292016-10-10 10:38:25 -070011676 * <scan_time (seconds)>
11677 * <scan_repeat_count (0 means indefinite)>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011678 * <suspend mode>
11679 *
11680 * e.g:
Dustin Brown43e87292016-10-10 10:38:25 -070011681 * 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 -080011682 *
11683 * this translates into:
11684 * -----------------------------
11685 * enable PNO
11686 * 2 networks
11687 * Network 1:
11688 * test - with authentication type 0 and encryption type 0,
11689 * search on 3 channels: 1 6 and 11,
11690 * SSID bcast type is unknown (directed probe will be sent if
11691 * AP not found) and must meet -40dBm RSSI
11692 * Network 2:
11693 * test2 - with authentication type 4 and encryption type 4,
11694 * search on 6 channels 1, 2, 3, 4, 5 and 6
11695 * bcast type is non-bcast (directed probe will be sent)
11696 * and must not meet any RSSI threshold
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011697 * scan every 5 seconds 2 times
Dustin Brown43e87292016-10-10 10:38:25 -070011698 * enable on suspend
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011699 */
11700static int __iw_set_pno(struct net_device *dev,
11701 struct iw_request_info *info,
11702 union iwreq_data *wrqu, char *extra)
11703{
Jeff Johnson3d278b02017-08-29 14:17:47 -070011704 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -070011705 struct hdd_context *hdd_ctx;
Abhishek Singh0481d662017-04-11 18:20:11 +053011706 uint8_t value;
11707 struct wlan_objmgr_vdev *vdev;
11708 struct wlan_objmgr_psoc *psoc;
11709 int ret = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011710 int offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011711 char *ptr, *data;
Abhishek Singh0481d662017-04-11 18:20:11 +053011712 uint8_t i, j, params;
11713 QDF_STATUS status;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011714 size_t len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011715
11716 /* request is a large struct, so we make it static to avoid
11717 * stack overflow. This API is only invoked via ioctl, so it
11718 * is serialized by the kernel rtnl_lock and hence does not
11719 * need to be reentrant
11720 */
Abhishek Singh0481d662017-04-11 18:20:11 +053011721 static struct pno_scan_req_params req;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011722
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080011723 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011724
11725 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
11726 ret = wlan_hdd_validate_context(hdd_ctx);
11727 if (ret)
11728 return ret;
11729
Jeff Johnson441e1f72017-02-07 08:50:49 -080011730 ret = hdd_check_private_wext_control(hdd_ctx, info);
11731 if (0 != ret)
11732 return ret;
11733
Abhishek Singh0481d662017-04-11 18:20:11 +053011734 vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->hdd_pdev,
11735 dev->dev_addr, WLAN_LEGACY_MAC_ID);
11736 if (!vdev) {
11737 hdd_err("vdev object is NULL");
11738 return -EIO;
11739 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011740
Abhishek Singh0481d662017-04-11 18:20:11 +053011741 hdd_debug("PNO data len %d data %s", wrqu->data.length, extra);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011742
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011743 /* making sure argument string ends with '\0' */
11744 len = (wrqu->data.length + 1);
11745 data = qdf_mem_malloc(len);
11746 if (!data) {
11747 hdd_err("fail to allocate memory %zu", len);
11748 return -EINVAL;
11749 }
11750 qdf_mem_copy(data, extra, (len-1));
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011751 ptr = data;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011752
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011753 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011754 hdd_err("PNO enable input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053011755 ret = -EINVAL;
11756 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011757 }
11758
Abhishek Singh0481d662017-04-11 18:20:11 +053011759 if (!value) {
11760 status = ucfg_scan_pno_stop(vdev);
11761 if (QDF_IS_STATUS_ERROR(status)) {
11762 hdd_err("Failed to disabled PNO");
11763 ret = -EINVAL;
11764 } else {
11765 hdd_debug("PNO scan disabled");
11766 }
11767 goto exit;
11768 }
11769
11770 if (ucfg_scan_get_pno_in_progress(vdev)) {
11771 hdd_debug("pno is already in progress");
11772 ret = -EBUSY;
11773 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011774 }
11775
11776 ptr += offset;
11777
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011778 if (1 != sscanf(ptr, " %hhu %n", &value, &offset)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011779 hdd_err("PNO count input not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053011780 ret = -EINVAL;
11781 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011782 }
Abhishek Singh0481d662017-04-11 18:20:11 +053011783 req.networks_cnt = value;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011784
Abhishek Singh0481d662017-04-11 18:20:11 +053011785 hdd_debug("PNO enable networks count %d offset %d",
11786 req.networks_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011787
Abhishek Singh0481d662017-04-11 18:20:11 +053011788 if ((0 == req.networks_cnt) ||
11789 (req.networks_cnt > SCAN_PNO_MAX_SUPP_NETWORKS)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011790 hdd_err("Network count %d invalid",
Abhishek Singh0481d662017-04-11 18:20:11 +053011791 req.networks_cnt);
11792 ret = -EINVAL;
11793 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011794 }
11795
11796 ptr += offset;
11797
Abhishek Singh0481d662017-04-11 18:20:11 +053011798 for (i = 0; i < req.networks_cnt; i++) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011799
Abhishek Singh0481d662017-04-11 18:20:11 +053011800 req.networks_list[i].ssid.length = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011801
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011802 params = sscanf(ptr, " %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +053011803 &(req.networks_list[i].ssid.length),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011804 &offset);
11805
11806 if (1 != params) {
11807 hdd_err("PNO ssid length input is not valid %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053011808 ret = -EINVAL;
11809 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011810 }
11811
Abhishek Singh0481d662017-04-11 18:20:11 +053011812 if ((0 == req.networks_list[i].ssid.length) ||
11813 (req.networks_list[i].ssid.length > 32)) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011814 hdd_err("SSID Len %d is not correct for network %d",
Abhishek Singh0481d662017-04-11 18:20:11 +053011815 req.networks_list[i].ssid.length, i);
11816 ret = -EINVAL;
11817 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011818 }
11819
11820 /* Advance to SSID */
11821 ptr += offset;
11822
Abhishek Singh0481d662017-04-11 18:20:11 +053011823 memcpy(req.networks_list[i].ssid.ssid, ptr,
11824 req.networks_list[i].ssid.length);
11825 ptr += req.networks_list[i].ssid.length;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011826
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011827 params = sscanf(ptr, " %u %u %hhu %n",
Abhishek Singh0481d662017-04-11 18:20:11 +053011828 &(req.networks_list[i].authentication),
11829 &(req.networks_list[i].encryption),
11830 &(req.networks_list[i].channel_cnt),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011831 &offset);
11832
11833 if (3 != params) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011834 hdd_err("Incorrect cmd %s", ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053011835 ret = -EINVAL;
11836 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011837 }
11838
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011839 hdd_debug("PNO len %d ssid %.*s auth %d encry %d channel count %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +053011840 req.networks_list[i].ssid.length,
11841 req.networks_list[i].ssid.length,
11842 req.networks_list[i].ssid.ssid,
11843 req.networks_list[i].authentication,
11844 req.networks_list[i].encryption,
11845 req.networks_list[i].channel_cnt, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011846
11847 /* Advance to channel list */
11848 ptr += offset;
11849
Abhishek Singh0481d662017-04-11 18:20:11 +053011850 if (SCAN_PNO_MAX_NETW_CHANNELS_EX <
11851 req.networks_list[i].channel_cnt) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011852 hdd_err("Incorrect number of channels");
Abhishek Singh0481d662017-04-11 18:20:11 +053011853 ret = -EINVAL;
11854 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011855 }
11856
Abhishek Singh0481d662017-04-11 18:20:11 +053011857 if (0 != req.networks_list[i].channel_cnt) {
11858 for (j = 0; j < req.networks_list[i].channel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011859 j++) {
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011860 if (1 != sscanf(ptr, " %hhu %n", &value,
Abhishek Singh0481d662017-04-11 18:20:11 +053011861 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070011862 hdd_err("PNO network channel is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011863 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053011864 ret = -EINVAL;
11865 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011866 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011867 if (!IS_CHANNEL_VALID(value)) {
11868 hdd_err("invalid channel: %hhu", value);
11869 ret = -EINVAL;
11870 goto exit;
11871 }
Abhishek Singh0481d662017-04-11 18:20:11 +053011872 req.networks_list[i].channels[j] =
11873 cds_chan_to_freq(value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011874 /* Advance to next channel number */
11875 ptr += offset;
11876 }
11877 }
11878
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011879 if (1 != sscanf(ptr, " %u %n",
Abhishek Singh0481d662017-04-11 18:20:11 +053011880 &(req.networks_list[i].bc_new_type),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011881 &offset)) {
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070011882 hdd_err("PNO broadcast network type is not valid %s",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011883 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053011884 ret = -EINVAL;
11885 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011886 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011887 if (req.networks_list[i].bc_new_type > 2) {
11888 hdd_err("invalid bcast nw type: %u",
11889 req.networks_list[i].bc_new_type);
11890 ret = -EINVAL;
11891 goto exit;
11892 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011893
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011894 hdd_debug("PNO bcastNetwType %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +053011895 req.networks_list[i].bc_new_type, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011896
11897 /* Advance to rssi Threshold */
11898 ptr += offset;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011899 if (1 != sscanf(ptr, " %d %n",
Abhishek Singh0481d662017-04-11 18:20:11 +053011900 &(req.networks_list[i].rssi_thresh),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011901 &offset)) {
11902 hdd_err("PNO rssi threshold input is not valid %s",
11903 ptr);
Abhishek Singh0481d662017-04-11 18:20:11 +053011904 ret = -EINVAL;
11905 goto exit;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011906 }
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080011907 hdd_debug("PNO rssi %d offset %d",
Abhishek Singh0481d662017-04-11 18:20:11 +053011908 req.networks_list[i].rssi_thresh, offset);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011909 /* Advance to next network */
11910 ptr += offset;
11911 } /* For ucNetworkCount */
11912
Abhishek Singh0481d662017-04-11 18:20:11 +053011913 req.fast_scan_period = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011914 if (sscanf(ptr, " %u %n", &(req.fast_scan_period), &offset) > 0) {
Abhishek Singh0481d662017-04-11 18:20:11 +053011915 req.fast_scan_period *= MSEC_PER_SEC;
Dustin Brown43e87292016-10-10 10:38:25 -070011916 ptr += offset;
11917 }
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011918 if (req.fast_scan_period == 0) {
11919 hdd_err("invalid fast scan period %u",
11920 req.fast_scan_period);
11921 ret = -EINVAL;
11922 goto exit;
11923 }
Dustin Brown43e87292016-10-10 10:38:25 -070011924
Abhishek Singh0481d662017-04-11 18:20:11 +053011925 req.fast_scan_max_cycles = 0;
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011926 if (sscanf(ptr, " %hhu %n", &value,
Dustin Brown43e87292016-10-10 10:38:25 -070011927 &offset) > 0)
11928 ptr += offset;
Abhishek Singh0481d662017-04-11 18:20:11 +053011929 req.fast_scan_max_cycles = value;
Dustin Brown43e87292016-10-10 10:38:25 -070011930
Abhishek Singh0481d662017-04-11 18:20:11 +053011931 wlan_pdev_obj_lock(hdd_ctx->hdd_pdev);
11932 psoc = wlan_pdev_get_psoc(hdd_ctx->hdd_pdev);
11933 wlan_pdev_obj_unlock(hdd_ctx->hdd_pdev);
11934 ucfg_scan_register_pno_cb(psoc,
11935 found_pref_network_cb, NULL);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011936
Abhishek Singh0481d662017-04-11 18:20:11 +053011937 ucfg_scan_get_pno_def_params(vdev, &req);
11938 status = ucfg_scan_pno_start(vdev, &req);
11939 if (QDF_IS_STATUS_ERROR(status)) {
11940 hdd_err("Failed to enable PNO");
11941 ret = -EINVAL;
11942 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011943
Abhishek Singh0481d662017-04-11 18:20:11 +053011944exit:
11945 wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011946
Hanumanth Reddy Pothula6310c772017-01-16 14:19:21 +053011947 qdf_mem_free(data);
Abhishek Singh0481d662017-04-11 18:20:11 +053011948 return ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011949}
11950
11951static int iw_set_pno(struct net_device *dev,
11952 struct iw_request_info *info,
11953 union iwreq_data *wrqu, char *extra)
11954{
11955 int ret;
11956
11957 cds_ssr_protect(__func__);
11958 ret = __iw_set_pno(dev, info, wrqu, extra);
11959 cds_ssr_unprotect(__func__);
11960
11961 return ret;
11962}
11963#endif /* FEATURE_WLAN_SCAN_PNO */
11964
11965/* Common function to SetBand */
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011966int hdd_reg_set_band(struct net_device *dev, u8 ui_band)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011967{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011968 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
11969 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011970 enum band_info band;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011971
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053011972 QDF_STATUS status;
Jeff Johnsonce2ee982017-09-03 09:27:35 -070011973 struct hdd_context *hdd_ctx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011974 hdd_adapter_list_node_t *pAdapterNode, *pNext;
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011975 enum band_info currBand;
11976 enum band_info connectedBand;
11977 long lrc;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011978
11979 pAdapterNode = NULL;
11980 pNext = NULL;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070011981 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011982
11983 switch (ui_band) {
11984 case WLAN_HDD_UI_BAND_AUTO:
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011985 band = BAND_ALL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011986 break;
11987 case WLAN_HDD_UI_BAND_5_GHZ:
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011988 band = BAND_5G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011989 break;
11990 case WLAN_HDD_UI_BAND_2_4_GHZ:
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011991 band = BAND_2G;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011992 break;
11993 default:
Jeff Johnson99bac312016-06-28 10:38:18 -070011994 hdd_err("Invalid band value %u", ui_band);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011995 return -EINVAL;
11996 }
11997
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070011998 hdd_debug("change band to %u", band);
11999
Jeff Johnsonce2ee982017-09-03 09:27:35 -070012000 if ((band == BAND_2G && hdd_ctx->config->nBandCapability == 2) ||
Rajeev Kumar Sirasanagandla4c9b6752017-07-25 20:35:20 +053012001 (band == BAND_5G && hdd_ctx->config->nBandCapability == 1) ||
12002 (band == BAND_ALL && hdd_ctx->config->nBandCapability != 0)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070012003 hdd_err("band value %u violate INI settings %u",
Jeff Johnsonce2ee982017-09-03 09:27:35 -070012004 band, hdd_ctx->config->nBandCapability);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012005 return -EIO;
12006 }
12007
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012008 if (band == BAND_ALL) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080012009 hdd_debug("Auto band received. Setting band same as ini value %d",
Jeff Johnsonce2ee982017-09-03 09:27:35 -070012010 hdd_ctx->config->nBandCapability);
12011 band = hdd_ctx->config->nBandCapability;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012012 }
12013
Jeff Johnsonce2ee982017-09-03 09:27:35 -070012014 if (QDF_STATUS_SUCCESS != ucfg_reg_get_curr_band(hdd_ctx->hdd_pdev,
Amar Singhal58b45ef2017-08-01 13:43:54 -070012015 &currBand)) {
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080012016 hdd_debug("Failed to get current band config");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012017 return -EIO;
12018 }
12019
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012020 if (currBand == band)
12021 return 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012022
Jeff Johnsonce2ee982017-09-03 09:27:35 -070012023 hdd_ctx->curr_band = band;
Amar Singhal58b45ef2017-08-01 13:43:54 -070012024
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012025 /* Change band request received.
12026 * Abort pending scan requests, flush the existing scan results,
12027 * and change the band capability
12028 */
12029 hdd_debug("Current band value = %u, new setting %u ",
12030 currBand, band);
12031
Jeff Johnsonce2ee982017-09-03 09:27:35 -070012032 status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012033 while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) {
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012034 adapter = pAdapterNode->adapter;
12035 hHal = WLAN_HDD_GET_HAL_CTX(adapter);
Jeff Johnsonce2ee982017-09-03 09:27:35 -070012036 wlan_abort_scan(hdd_ctx->hdd_pdev, INVAL_PDEV_ID,
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012037 adapter->sessionId, INVALID_SCAN_ID, false);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012038 connectedBand = hdd_conn_get_connected_band(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012039 WLAN_HDD_GET_STATION_CTX_PTR(adapter));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012040
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012041 /* Handling is done only for STA and P2P */
12042 if (band != BAND_ALL &&
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012043 ((adapter->device_mode == QDF_STA_MODE) ||
12044 (adapter->device_mode == QDF_P2P_CLIENT_MODE)) &&
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012045 (hdd_conn_is_connected(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012046 WLAN_HDD_GET_STATION_CTX_PTR(adapter)))
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012047 && (connectedBand != band)) {
12048 status = QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012049
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012050 /* STA already connected on current
12051 * band, So issue disconnect first,
12052 * then change the band
12053 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012054
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012055 hdd_debug("STA (Device mode %s(%d)) connected in band %u, Changing band to %u, Issuing Disconnect",
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012056 hdd_device_mode_to_string(adapter->device_mode),
12057 adapter->device_mode, currBand, band);
12058 INIT_COMPLETION(adapter->disconnect_comp_var);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012059
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012060 status = sme_roam_disconnect(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012061 WLAN_HDD_GET_HAL_CTX(adapter),
12062 adapter->sessionId,
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012063 eCSR_DISCONNECT_REASON_UNSPECIFIED);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012064
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012065 if (QDF_STATUS_SUCCESS != status) {
12066 hdd_err("sme_roam_disconnect failure, status: %d",
Jeff Johnson99bac312016-06-28 10:38:18 -070012067 (int)status);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012068 return -EINVAL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012069 }
12070
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012071 lrc = wait_for_completion_timeout(
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012072 &adapter->disconnect_comp_var,
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012073 msecs_to_jiffies(
12074 WLAN_WAIT_TIME_DISCONNECT));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012075
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012076 if (lrc == 0) {
12077 hdd_err("Timeout while waiting for csr_roam_disconnect");
12078 return -ETIMEDOUT;
12079 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012080 }
12081
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012082 sme_scan_flush_result(hHal);
12083
Jeff Johnsonce2ee982017-09-03 09:27:35 -070012084 status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext);
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012085 pAdapterNode = pNext;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012086 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012087
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012088 if (QDF_STATUS_SUCCESS !=
Jeff Johnsonce2ee982017-09-03 09:27:35 -070012089 ucfg_reg_set_band(hdd_ctx->hdd_pdev, band)) {
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012090 hdd_err("Failed to set the band value to %u",
12091 band);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012092 return -EINVAL;
12093 }
12094
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012095 return 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012096}
12097
12098static int __iw_set_band_config(struct net_device *dev,
12099 struct iw_request_info *info,
12100 union iwreq_data *wrqu, char *extra)
12101{
Jeff Johnson3d278b02017-08-29 14:17:47 -070012102 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson6d38ab82017-08-28 11:36:27 -070012103 struct hdd_context *hdd_ctx;
Jeff Johnson441e1f72017-02-07 08:50:49 -080012104 int ret;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012105 int *value = (int *)extra;
12106
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080012107 ENTER_DEV(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012108
Mukul Sharmaa5fe1982015-11-02 19:28:14 +053012109 if (!capable(CAP_NET_ADMIN)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070012110 hdd_err("permission check failed");
Mukul Sharmaa5fe1982015-11-02 19:28:14 +053012111 return -EPERM;
12112 }
12113
Jeff Johnson441e1f72017-02-07 08:50:49 -080012114 hdd_ctx = WLAN_HDD_GET_CTX(adapter);
12115 ret = hdd_check_private_wext_control(hdd_ctx, info);
12116 if (0 != ret)
12117 return ret;
12118
Kiran Kumar Lokereb1d412e2017-04-23 17:19:43 -070012119 return hdd_reg_set_band(dev, value[0]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012120}
12121
12122static int iw_set_band_config(struct net_device *dev,
12123 struct iw_request_info *info,
12124 union iwreq_data *wrqu, char *extra)
12125{
12126 int ret;
12127
12128 cds_ssr_protect(__func__);
12129 ret = __iw_set_band_config(dev, info, wrqu, extra);
12130 cds_ssr_unprotect(__func__);
12131
12132 return ret;
12133}
12134
Arunk Khandavalli062fb032017-10-04 12:18:15 +053012135int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012136 uint32_t bandwidth)
12137{
Jeff Johnson6d38ab82017-08-28 11:36:27 -070012138 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Jeff Johnson40dae4e2017-08-29 14:00:25 -070012139 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012140 struct hdd_mon_set_ch_info *ch_info = &sta_ctx->ch_info;
12141 QDF_STATUS status;
12142 tHalHandle hal_hdl = hdd_ctx->hHal;
12143 struct qdf_mac_addr bssid;
12144 tCsrRoamProfile roam_profile;
Amar Singhal5cccafe2017-02-15 12:42:58 -080012145 struct ch_params ch_params;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012146
12147 if (QDF_GLOBAL_MONITOR_MODE != hdd_get_conparam()) {
12148 hdd_err("Not supported, device is not in monitor mode");
12149 return -EINVAL;
12150 }
12151
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080012152 hdd_debug("Set monitor mode Channel %d", chan);
Hong Shie531d1f2016-11-14 14:08:03 +080012153 qdf_mem_zero(&roam_profile, sizeof(roam_profile));
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012154 roam_profile.ChannelInfo.ChannelList = &ch_info->channel;
12155 roam_profile.ChannelInfo.numOfChannels = 1;
12156 roam_profile.phyMode = ch_info->phy_mode;
12157 roam_profile.ch_params.ch_width = bandwidth;
Naveen Rawatc77e6e72016-08-05 15:19:03 -070012158 hdd_select_cbmode(adapter, chan, &roam_profile.ch_params);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012159
12160 qdf_mem_copy(bssid.bytes, adapter->macAddressCurrent.bytes,
12161 QDF_MAC_ADDR_SIZE);
12162
12163 ch_params.ch_width = bandwidth;
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -070012164 wlan_reg_set_channel_params(hdd_ctx->hdd_pdev, chan, 0, &ch_params);
Manjunathappa Prakashc4dc9382017-03-07 18:50:33 -080012165 if (ch_params.ch_width == CH_WIDTH_INVALID) {
12166 hdd_err("Invalid capture channel or bandwidth for a country");
12167 return -EINVAL;
12168 }
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -070012169
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012170 status = sme_roam_channel_change_req(hal_hdl, bssid, &ch_params,
12171 &roam_profile);
12172 if (status) {
12173 hdd_err("Status: %d Failed to set sme_roam Channel for monitor mode",
12174 status);
12175 }
12176
Arunk Khandavalli062fb032017-10-04 12:18:15 +053012177 adapter->mon_chan = chan;
12178 adapter->mon_bandwidth = bandwidth;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012179 return qdf_status_to_os_return(status);
12180}
12181
Dustin Brown8d2d0f52017-04-03 17:02:08 -070012182static int printk_adapter(void *priv, const char *fmt, ...)
12183{
12184 int ret;
12185 va_list args;
12186
12187 va_start(args, fmt);
12188 ret = vprintk(fmt, args);
12189 ret += printk("\n");
12190 va_end(args);
12191
12192 return ret;
12193}
12194
12195#ifdef WMI_INTERFACE_EVENT_LOGGING
12196static void hdd_ioctl_log_buffer(int log_id, uint32_t count)
12197{
12198 qdf_abstract_print *print = &printk_adapter;
12199
12200 switch (log_id) {
12201 case HTC_CREDIT_HISTORY_LOG:
12202 print(NULL, "HTC Credit History (count %u)", count);
12203 cds_print_htc_credit_history(count, print, NULL);
12204 break;
12205 case COMMAND_LOG:
12206 print(NULL, "Command Log (count %u)", count);
12207 wma_print_wmi_cmd_log(count, print, NULL);
12208 break;
12209 case COMMAND_TX_CMP_LOG:
12210 print(NULL, "Command Tx Complete Log (count %u)", count);
12211 wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
12212 break;
12213 case MGMT_COMMAND_LOG:
12214 print(NULL, "Management Command Log (count %u)", count);
12215 wma_print_wmi_mgmt_cmd_log(count, print, NULL);
12216 break;
12217 case MGMT_COMMAND_TX_CMP_LOG:
12218 print(NULL, "Management Command Tx Complete Log (count %u)",
12219 count);
12220 wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
12221 break;
12222 case EVENT_LOG:
12223 print(NULL, "Event Log (count %u)", count);
12224 wma_print_wmi_event_log(count, print, NULL);
12225 break;
12226 case RX_EVENT_LOG:
12227 print(NULL, "Rx Event Log (count %u)", count);
12228 wma_print_wmi_rx_event_log(count, print, NULL);
12229 break;
12230 case MGMT_EVENT_LOG:
12231 print(NULL, "Management Event Log (count %u)", count);
12232 wma_print_wmi_mgmt_event_log(count, print, NULL);
12233 break;
12234 default:
12235 print(NULL, "Invalid Log Id %d", log_id);
12236 break;
12237 }
12238}
12239#else
12240static inline void hdd_ioctl_log_buffer(int log_id, uint32_t count)
12241{
12242}
12243#endif /* WMI_INTERFACE_EVENT_LOGGING */
12244
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012245static int __iw_set_two_ints_getnone(struct net_device *dev,
12246 struct iw_request_info *info,
12247 union iwreq_data *wrqu, char *extra)
12248{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012249 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012250 int *value = (int *)extra;
12251 int sub_cmd = value[0];
12252 int ret;
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012253 struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012254
Jeff Johnson6ee91ee2016-02-11 18:55:30 -080012255 ENTER_DEV(dev);
12256
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012257 ret = wlan_hdd_validate_context(hdd_ctx);
12258 if (0 != ret)
12259 return ret;
12260
Jeff Johnson441e1f72017-02-07 08:50:49 -080012261 ret = hdd_check_private_wext_control(hdd_ctx, info);
12262 if (0 != ret)
12263 return ret;
12264
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012265 switch (sub_cmd) {
12266 case WE_SET_SMPS_PARAM:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080012267 hdd_debug("WE_SET_SMPS_PARAM val %d %d", value[1], value[2]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012268 ret = wma_cli_set_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012269 WMI_STA_SMPS_PARAM_CMDID,
12270 value[1] << WMA_SMPS_PARAM_VALUE_S
12271 | value[2],
12272 VDEV_CMD);
12273 break;
Srinivas Girigowda6147c582016-10-18 12:26:15 -070012274#ifdef WLAN_DEBUG
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012275 case WE_SET_FW_CRASH_INJECT:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080012276 hdd_debug("WE_SET_FW_CRASH_INJECT: %d %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012277 value[1], value[2]);
DARAM SUDHA7e7e91b2015-05-29 11:38:47 +053012278 pr_err("SSR is triggered by iwpriv CRASH_INJECT: %d %d\n",
12279 value[1], value[2]);
SaidiReddy Yenugacc733af2016-11-09 17:45:42 +053012280 if (!hdd_ctx->config->crash_inject_enabled) {
12281 hdd_err("Crash Inject ini disabled, Ignore Crash Inject");
12282 return 0;
12283 }
Yue Ma06152352017-06-20 18:08:58 -070012284 if (value[1] == 3) {
Anurag Chouhan4085ff72017-10-05 18:09:56 +053012285 cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
Yue Ma06152352017-06-20 18:08:58 -070012286 return 0;
12287 }
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012288 ret = wma_cli_set2_command(adapter->sessionId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012289 GEN_PARAM_CRASH_INJECT,
12290 value[1], value[2], GEN_CMD);
12291 break;
12292#endif
Govind Singha471e5e2015-10-12 17:11:14 +053012293 case WE_ENABLE_FW_PROFILE:
Jeff Johnson99bac312016-06-28 10:38:18 -070012294 hdd_err("WE_ENABLE_FW_PROFILE: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +053012295 value[1], value[2]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012296 ret = wma_cli_set2_command(adapter->sessionId,
Govind Singha471e5e2015-10-12 17:11:14 +053012297 WMI_WLAN_PROFILE_ENABLE_PROFILE_ID_CMDID,
12298 value[1], value[2], DBG_CMD);
12299 break;
12300 case WE_SET_FW_PROFILE_HIST_INTVL:
Jeff Johnson99bac312016-06-28 10:38:18 -070012301 hdd_err("WE_SET_FW_PROFILE_HIST_INTVL: %d %d",
Govind Singha471e5e2015-10-12 17:11:14 +053012302 value[1], value[2]);
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012303 ret = wma_cli_set2_command(adapter->sessionId,
Govind Singha471e5e2015-10-12 17:11:14 +053012304 WMI_WLAN_PROFILE_SET_HIST_INTVL_CMDID,
12305 value[1], value[2], DBG_CMD);
12306 break;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012307 case WE_SET_DUAL_MAC_FW_MODE_CONFIG:
12308 hdd_debug("Ioctl to set dual fw mode config");
Tushnim Bhattacharyya49ed8ab2017-05-26 18:20:10 -070012309 if (hdd_ctx->config->dual_mac_feature_disable ==
12310 DISABLE_DBS_CXN_AND_SCAN) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012311 hdd_err("Dual mac feature is disabled from INI");
12312 return -EPERM;
12313 }
12314 hdd_debug("%d %d", value[1], value[2]);
Tushnim Bhattacharyyade1070d2017-03-09 13:23:55 -080012315 policy_mgr_set_dual_mac_fw_mode_config(hdd_ctx->hdd_psoc,
12316 value[1], value[2]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012317 break;
12318 case WE_DUMP_DP_TRACE_LEVEL:
Srinivas Girigowdaaf2bfa42017-03-06 18:45:13 -080012319 hdd_debug("WE_DUMP_DP_TRACE_LEVEL: %d %d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012320 value[1], value[2]);
12321 if (value[1] == DUMP_DP_TRACE)
Venkata Sharath Chandra Manchala0b9fc632017-05-15 14:35:15 -070012322 qdf_dp_trace_dump_all(value[2],
12323 QDF_TRACE_DEFAULT_PDEV_ID);
Nirav Shah0d58a7e2016-04-26 22:54:12 +053012324 else if (value[1] == ENABLE_DP_TRACE_LIVE_MODE)
12325 qdf_dp_trace_enable_live_mode();
Nirav Shahda008342016-05-17 18:50:40 +053012326 else if (value[1] == CLEAR_DP_TRACE_BUFFER)
12327 qdf_dp_trace_clear_buffer();
Mohit Khannaf8f96822017-05-17 17:11:59 -070012328 else if (value[1] == DISABLE_DP_TRACE_LIVE_MODE)
12329 qdf_dp_trace_disable_live_mode();
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012330 break;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012331 case WE_SET_MON_MODE_CHAN:
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070012332 ret = wlan_hdd_set_mon_chan(adapter, value[1], value[2]);
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070012333 break;
Dustin Brown54096432017-02-23 13:00:44 -080012334 case WE_SET_WLAN_SUSPEND: {
Dustin Brown3ed3e9b2017-03-23 12:57:58 -070012335 hdd_info("STA unit-test suspend(%d, %d)", value[1], value[2]);
Dustin Brown54096432017-02-23 13:00:44 -080012336 ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev,
12337 value[1], value[2]);
Rajeev Kumara78a0a42016-07-13 19:28:20 -070012338 break;
Dustin Brown54096432017-02-23 13:00:44 -080012339 }
Rajeev Kumara78a0a42016-07-13 19:28:20 -070012340 case WE_SET_WLAN_RESUME:
Dustin Brownbc81a472016-10-26 16:56:59 -070012341 ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
Rajeev Kumara78a0a42016-07-13 19:28:20 -070012342 break;
Dustin Brown8d2d0f52017-04-03 17:02:08 -070012343 case WE_LOG_BUFFER: {
12344 int log_id = value[1];
12345 uint32_t count = value[2] < 0 ? 0 : value[2];
12346
12347 hdd_ioctl_log_buffer(log_id, count);
12348
12349 break;
12350 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012351 default:
Jeff Johnson99bac312016-06-28 10:38:18 -070012352 hdd_err("Invalid IOCTL command %d", sub_cmd);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012353 break;
12354 }
12355
12356 return ret;
12357}
12358
12359static int iw_set_two_ints_getnone(struct net_device *dev,
12360 struct iw_request_info *info,
12361 union iwreq_data *wrqu, char *extra)
12362{
12363 int ret;
12364
12365 cds_ssr_protect(__func__);
12366 ret = __iw_set_two_ints_getnone(dev, info, wrqu, extra);
12367 cds_ssr_unprotect(__func__);
12368
12369 return ret;
12370}
12371
12372/* Define the Wireless Extensions to the Linux Network Device structure */
12373/* A number of these routines are NULL (meaning they are not implemented.) */
12374
12375static const iw_handler we_handler[] = {
12376 (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */
12377 (iw_handler) iw_get_name, /* SIOCGIWNAME */
12378 (iw_handler) NULL, /* SIOCSIWNWID */
12379 (iw_handler) NULL, /* SIOCGIWNWID */
12380 (iw_handler) iw_set_freq, /* SIOCSIWFREQ */
12381 (iw_handler) iw_get_freq, /* SIOCGIWFREQ */
12382 (iw_handler) iw_set_mode, /* SIOCSIWMODE */
12383 (iw_handler) iw_get_mode, /* SIOCGIWMODE */
12384 (iw_handler) NULL, /* SIOCSIWSENS */
12385 (iw_handler) NULL, /* SIOCGIWSENS */
12386 (iw_handler) NULL, /* SIOCSIWRANGE */
12387 (iw_handler) iw_get_range, /* SIOCGIWRANGE */
12388 (iw_handler) NULL, /* SIOCSIWPRIV */
12389 (iw_handler) NULL, /* SIOCGIWPRIV */
12390 (iw_handler) NULL, /* SIOCSIWSTATS */
12391 (iw_handler) NULL, /* SIOCGIWSTATS */
12392 (iw_handler) NULL, /* SIOCSIWSPY */
12393 (iw_handler) NULL, /* SIOCGIWSPY */
12394 (iw_handler) NULL, /* SIOCSIWTHRSPY */
12395 (iw_handler) NULL, /* SIOCGIWTHRSPY */
12396 (iw_handler) iw_set_ap_address, /* SIOCSIWAP */
12397 (iw_handler) iw_get_ap_address, /* SIOCGIWAP */
12398 (iw_handler) iw_set_mlme, /* SIOCSIWMLME */
12399 (iw_handler) NULL, /* SIOCGIWAPLIST */
Sandeep Puligillad0004212017-02-26 18:34:56 -080012400 (iw_handler) NULL, /* SIOCSIWSCAN */
12401 (iw_handler) NULL, /* SIOCGIWSCAN */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012402 (iw_handler) iw_set_essid, /* SIOCSIWESSID */
12403 (iw_handler) iw_get_essid, /* SIOCGIWESSID */
12404 (iw_handler) iw_set_nick, /* SIOCSIWNICKN */
12405 (iw_handler) iw_get_nick, /* SIOCGIWNICKN */
12406 (iw_handler) NULL, /* -- hole -- */
12407 (iw_handler) NULL, /* -- hole -- */
12408 (iw_handler) iw_set_bitrate, /* SIOCSIWRATE */
12409 (iw_handler) iw_get_bitrate, /* SIOCGIWRATE */
12410 (iw_handler) iw_set_rts_threshold, /* SIOCSIWRTS */
12411 (iw_handler) iw_get_rts_threshold, /* SIOCGIWRTS */
12412 (iw_handler) iw_set_frag_threshold, /* SIOCSIWFRAG */
12413 (iw_handler) iw_get_frag_threshold, /* SIOCGIWFRAG */
12414 (iw_handler) iw_set_tx_power, /* SIOCSIWTXPOW */
12415 (iw_handler) iw_get_tx_power, /* SIOCGIWTXPOW */
12416 (iw_handler) iw_set_retry, /* SIOCSIWRETRY */
12417 (iw_handler) iw_get_retry, /* SIOCGIWRETRY */
12418 (iw_handler) iw_set_encode, /* SIOCSIWENCODE */
Jeff Johnsone84e8d02017-10-15 12:22:58 -070012419 (iw_handler) NULL, /* SIOCGIWENCODE */
Jeff Johnson955e0582017-10-15 11:56:52 -070012420 (iw_handler) NULL, /* SIOCSIWPOWER */
Jeff Johnson330d8dc2017-10-15 11:43:13 -070012421 (iw_handler) NULL, /* SIOCGIWPOWER */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012422 (iw_handler) NULL, /* -- hole -- */
12423 (iw_handler) NULL, /* -- hole -- */
Jeff Johnson4bcdafa2017-10-15 11:33:42 -070012424 (iw_handler) NULL, /* SIOCSIWGENIE */
Jeff Johnsonf6562c62017-10-15 11:24:05 -070012425 (iw_handler) NULL, /* SIOCGIWGENIE */
Jeff Johnson079f7de2017-10-15 11:04:08 -070012426 (iw_handler) NULL, /* SIOCSIWAUTH */
Jeff Johnson4139b822017-10-15 10:55:03 -070012427 (iw_handler) NULL, /* SIOCGIWAUTH */
Jeff Johnson5b300822017-10-15 10:44:40 -070012428 (iw_handler) NULL, /* SIOCSIWENCODEEXT */
Jeff Johnson6b747052017-10-15 10:29:04 -070012429 (iw_handler) NULL, /* SIOCGIWENCODEEXT */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012430 (iw_handler) NULL, /* SIOCSIWPMKSA */
12431};
12432
12433static const iw_handler we_private[] = {
12434
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070012435 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone,
12436 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint,
12437 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012438 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] =
12439 iw_set_three_ints_getnone,
12440 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070012441 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012442 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] =
12443 iw_hdd_set_var_ints_getnone,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070012444 [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] =
12445 iw_setnone_get_threeint,
Jeff Johnson6fa1e012017-04-05 06:40:53 -070012446 [WLAN_PRIV_FIPS_TEST - SIOCIWFIRSTPRIV] = hdd_fips_test,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012447 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
12448 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
12449 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012450 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012451 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
12452 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
12453 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] =
12454 iw_set_keepalive_params,
12455#ifdef WLAN_FEATURE_PACKET_FILTERING
12456 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] =
12457 iw_set_packet_filter_params,
12458#endif
12459#ifdef FEATURE_WLAN_SCAN_PNO
12460 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno,
12461#endif
12462 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
Dustin Brown0cbc7572016-12-16 13:54:40 -080012463 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] =
12464 iw_set_dynamic_mcbc_filter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012465 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed,
12466 [WLAN_PRIV_SET_TWO_INT_GET_NONE - SIOCIWFIRSTPRIV] =
12467 iw_set_two_ints_getnone,
12468 [WLAN_SET_DOT11P_CHANNEL_SCHED - SIOCIWFIRSTPRIV] =
12469 iw_set_dot11p_channel_sched,
12470};
12471
12472/*Maximum command length can be only 15 */
12473static const struct iw_priv_args we_private_args[] = {
12474
12475 /* handlers for main ioctl */
12476 {WLAN_PRIV_SET_INT_GET_NONE,
12477 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12478 0,
12479 ""},
12480
12481 /* handlers for sub-ioctl */
12482 {WE_SET_11D_STATE,
12483 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12484 0,
12485 "set11Dstate"},
12486
12487 {WE_WOWL,
12488 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12489 0,
12490 "wowl"},
12491
12492 {WE_SET_POWER,
12493 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12494 0,
12495 "setPower"},
12496
12497 {WE_SET_MAX_ASSOC,
12498 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12499 0,
12500 "setMaxAssoc"},
12501
12502 {WE_SET_SAP_AUTO_CHANNEL_SELECTION,
12503 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
12504 "setAutoChannel" },
12505
12506 {WE_SET_SCAN_DISABLE,
12507 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12508 0,
12509 "scan_disable"},
12510
12511 {WE_SET_DATA_INACTIVITY_TO,
12512 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12513 0,
12514 "inactivityTO"},
12515
Mukul Sharmaed92f2f2017-04-20 00:06:28 +053012516 {WE_SET_WOW_DATA_INACTIVITY_TO,
12517 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12518 0,
12519 "wow_ito"},
12520
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012521 {WE_SET_MAX_TX_POWER,
12522 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12523 0,
12524 "setMaxTxPower"},
12525
12526 {WE_SET_TX_POWER,
12527 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12528 0,
12529 "setTxPower"},
12530
12531 {WE_SET_MC_RATE,
12532 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12533 0,
12534 "setMcRate"},
12535
12536 {WE_SET_MAX_TX_POWER_2_4,
12537 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12538 0,
12539 "setTxMaxPower2G"},
12540
12541 {WE_SET_MAX_TX_POWER_5_0,
12542 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12543 0,
12544 "setTxMaxPower5G"},
12545
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080012546 {WE_SET_PKTLOG,
Poddar, Siddarth176c4362016-10-03 12:25:00 +053012547 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -080012548 0,
12549 "pktlog"},
12550
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012551 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
12552 * as well to keep same syntax as in SAP. Now onwards, STA
Jeff Johnson3bb7c732017-01-12 08:40:17 -080012553 * will support both
12554 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012555 {WE_SET_MAX_TX_POWER,
12556 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12557 0,
12558 "setTxMaxPower"},
12559
12560 /* set Higher DTIM Transition (DTIM1 to DTIM3)
Jeff Johnson3bb7c732017-01-12 08:40:17 -080012561 * 1 = enable and 0 = disable
12562 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012563 {
12564 WE_SET_HIGHER_DTIM_TRANSITION,
12565 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12566 0,
12567 "setHDtimTransn"
12568 },
12569
12570 {WE_SET_TM_LEVEL,
12571 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12572 0,
12573 "setTmLevel"},
12574
12575 {WE_SET_PHYMODE,
12576 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12577 0,
12578 "setphymode"},
12579
12580 {WE_SET_NSS,
12581 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12582 0,
12583 "nss"},
12584
12585 {WE_SET_LDPC,
12586 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12587 0,
12588 "ldpc"},
12589
12590 {WE_SET_TX_STBC,
12591 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12592 0,
12593 "tx_stbc"},
12594
12595 {WE_SET_RX_STBC,
12596 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12597 0,
12598 "rx_stbc"},
12599
12600 {WE_SET_SHORT_GI,
12601 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12602 0,
12603 "shortgi"},
12604
12605 {WE_SET_RTSCTS,
12606 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12607 0,
12608 "enablertscts"},
12609
12610 {WE_SET_CHWIDTH,
12611 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12612 0,
12613 "chwidth"},
12614
12615 {WE_SET_ANI_EN_DIS,
12616 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12617 0,
12618 "anienable"},
12619
12620 {WE_SET_ANI_POLL_PERIOD,
12621 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12622 0,
12623 "aniplen"},
12624
12625 {WE_SET_ANI_LISTEN_PERIOD,
12626 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12627 0,
12628 "anilislen"},
12629
12630 {WE_SET_ANI_OFDM_LEVEL,
12631 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12632 0,
12633 "aniofdmlvl"},
12634
12635 {WE_SET_ANI_CCK_LEVEL,
12636 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12637 0,
12638 "aniccklvl"},
12639
12640 {WE_SET_DYNAMIC_BW,
12641 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12642 0,
12643 "cwmenable"},
12644
12645 {WE_SET_CTS_CBW,
12646 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12647 0,
12648 "cts_cbw" },
12649
12650 {WE_SET_GTX_HT_MCS,
12651 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12652 0,
12653 "gtxHTMcs"},
12654
12655 {WE_SET_GTX_VHT_MCS,
12656 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12657 0,
12658 "gtxVHTMcs"},
12659
12660 {WE_SET_GTX_USRCFG,
12661 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12662 0,
12663 "gtxUsrCfg"},
12664
12665 {WE_SET_GTX_THRE,
12666 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12667 0,
12668 "gtxThre"},
12669
12670 {WE_SET_GTX_MARGIN,
12671 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12672 0,
12673 "gtxMargin"},
12674
12675 {WE_SET_GTX_STEP,
12676 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12677 0,
12678 "gtxStep"},
12679
12680 {WE_SET_GTX_MINTPC,
12681 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12682 0,
12683 "gtxMinTpc"},
12684
12685 {WE_SET_GTX_BWMASK,
12686 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12687 0,
12688 "gtxBWMask"},
12689
12690 {WE_SET_TX_CHAINMASK,
12691 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12692 0,
12693 "txchainmask"},
12694
12695 {WE_SET_RX_CHAINMASK,
12696 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12697 0,
12698 "rxchainmask"},
12699
12700 {WE_SET_11N_RATE,
12701 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12702 0,
12703 "set11NRates"},
12704
12705 {WE_SET_VHT_RATE,
12706 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12707 0,
12708 "set11ACRates"},
12709
12710 {WE_SET_AMPDU,
12711 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12712 0,
12713 "ampdu"},
12714
12715 {WE_SET_AMSDU,
12716 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12717 0,
12718 "amsdu"},
12719
12720 {WE_SET_BURST_ENABLE,
12721 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12722 0,
12723 "burst_enable"},
12724
12725 {WE_SET_BURST_DUR,
12726 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12727 0,
12728 "burst_dur"},
12729
12730 {WE_SET_TXPOW_2G,
12731 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12732 0,
12733 "txpow2g"},
12734
12735 {WE_SET_TXPOW_5G,
12736 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12737 0,
12738 "txpow5g"},
12739
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012740 /* Sub-cmds DBGLOG specific commands */
12741 {WE_DBGLOG_LOG_LEVEL,
12742 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12743 0,
12744 "dl_loglevel"},
12745
12746 {WE_DBGLOG_VAP_ENABLE,
12747 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12748 0,
12749 "dl_vapon"},
12750
12751 {WE_DBGLOG_VAP_DISABLE,
12752 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12753 0,
12754 "dl_vapoff"},
12755
12756 {WE_DBGLOG_MODULE_ENABLE,
12757 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12758 0,
12759 "dl_modon"},
12760
12761 {WE_DBGLOG_MODULE_DISABLE,
12762 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12763 0,
12764 "dl_modoff"},
12765
12766 {WE_DBGLOG_MOD_LOG_LEVEL,
12767 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12768 0,
12769 "dl_mod_loglevel"},
12770
12771 {WE_DBGLOG_TYPE,
12772 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12773 0,
12774 "dl_type"},
12775 {WE_DBGLOG_REPORT_ENABLE,
12776 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12777 0,
12778 "dl_report"},
12779
12780 {WE_SET_TXRX_FWSTATS,
12781 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12782 0,
12783 "txrx_fw_stats"},
12784
Venkata Sharath Chandra Manchala83985632017-02-28 14:16:22 -080012785 {WE_SET_TXRX_STATS,
12786 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12787 0,
12788 "txrx_stats"},
12789
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012790 {WE_TXRX_FWSTATS_RESET,
12791 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12792 0,
12793 "txrx_fw_st_rst"},
12794
12795 {WE_PPS_PAID_MATCH,
12796 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12797 0, "paid_match"},
12798
12799 {WE_PPS_GID_MATCH,
12800 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12801 0, "gid_match"},
12802
12803 {WE_PPS_EARLY_TIM_CLEAR,
12804 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12805 0, "tim_clear"},
12806
12807 {WE_PPS_EARLY_DTIM_CLEAR,
12808 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12809 0, "dtim_clear"},
12810
12811 {WE_PPS_EOF_PAD_DELIM,
12812 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12813 0, "eof_delim"},
12814
12815 {WE_PPS_MACADDR_MISMATCH,
12816 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12817 0, "mac_match"},
12818
12819 {WE_PPS_DELIM_CRC_FAIL,
12820 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12821 0, "delim_fail"},
12822
12823 {WE_PPS_GID_NSTS_ZERO,
12824 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12825 0, "nsts_zero"},
12826
12827 {WE_PPS_RSSI_CHECK,
12828 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12829 0, "rssi_chk"},
12830
12831 {WE_PPS_5G_EBT,
12832 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12833 0, "5g_ebt"},
12834
12835 {WE_SET_HTSMPS,
12836 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12837 0, "htsmps"},
12838
12839 {WE_SET_QPOWER_MAX_PSPOLL_COUNT,
12840 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12841 0, "set_qpspollcnt"},
12842
12843 {WE_SET_QPOWER_MAX_TX_BEFORE_WAKE,
12844 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12845 0, "set_qtxwake"},
12846
12847 {WE_SET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
12848 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12849 0, "set_qwakeintv"},
12850
12851 {WE_SET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
12852 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12853 0, "set_qnodatapoll"},
12854
12855 /* handlers for MCC time quota and latency sub ioctls */
12856 {WE_MCC_CONFIG_LATENCY,
12857 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12858 0, "setMccLatency"},
12859
12860 {WE_MCC_CONFIG_QUOTA,
12861 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12862 0, "setMccQuota"},
12863
12864 {WE_SET_DEBUG_LOG,
12865 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12866 0, "setDbgLvl"},
12867
12868 /* handlers for early_rx power save */
12869 {WE_SET_EARLY_RX_ADJUST_ENABLE,
12870 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12871 0, "erx_enable"},
12872
12873 {WE_SET_EARLY_RX_TGT_BMISS_NUM,
12874 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12875 0, "erx_bmiss_val"},
12876
12877 {WE_SET_EARLY_RX_BMISS_SAMPLE_CYCLE,
12878 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12879 0, "erx_bmiss_smpl"},
12880
12881 {WE_SET_EARLY_RX_SLOP_STEP,
12882 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12883 0, "erx_slop_step"},
12884
12885 {WE_SET_EARLY_RX_INIT_SLOP,
12886 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12887 0, "erx_init_slop"},
12888
12889 {WE_SET_EARLY_RX_ADJUST_PAUSE,
12890 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12891 0, "erx_adj_pause"},
12892
12893 {WE_SET_EARLY_RX_DRIFT_SAMPLE,
12894 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12895 0, "erx_dri_sample"},
12896
12897 {WE_DUMP_STATS,
12898 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12899 0, "dumpStats"},
12900
12901 {WE_CLEAR_STATS,
12902 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12903 0, "clearStats"},
12904
Govind Singha471e5e2015-10-12 17:11:14 +053012905 {WE_START_FW_PROFILE,
12906 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12907 0, "startProfile"},
12908
Abhishek Singh1bdb1572015-10-16 16:24:19 +053012909 {WE_SET_CHANNEL,
12910 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12911 0, "setChanChange" },
12912
Manishekar Chandrasekaran97e077d2016-03-23 17:10:31 +053012913 {WE_SET_CONC_SYSTEM_PREF,
12914 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12915 0, "setConcSysPref" },
12916
Jeff Johnson011c4502017-10-05 15:25:56 -070012917 {WE_SET_PDEV_RESET,
12918 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12919 0, "pdev_reset" },
12920
SaidiReddy Yenugaa92f8cc2017-03-24 15:15:03 +053012921 {WE_SET_MODULATED_DTIM,
12922 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12923 0, "setModDTIM" },
12924
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012925 {WLAN_PRIV_SET_NONE_GET_INT,
12926 0,
12927 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12928 ""},
12929
12930 /* handlers for sub-ioctl */
12931 {WE_GET_11D_STATE,
12932 0,
12933 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12934 "get11Dstate"},
12935
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080012936 {WE_GET_WLAN_DBG,
12937 0,
12938 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12939 "getwlandbg"},
12940
12941 {WE_GET_MAX_ASSOC,
12942 0,
12943 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12944 "getMaxAssoc"},
12945
12946 {WE_GET_SAP_AUTO_CHANNEL_SELECTION,
12947 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12948 "getAutoChannel" },
12949
12950 {WE_GET_CONCURRENCY_MODE,
12951 0,
12952 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12953 "getconcurrency"},
12954
12955 {WE_GET_NSS,
12956 0,
12957 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12958 "get_nss"},
12959
12960 {WE_GET_LDPC,
12961 0,
12962 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12963 "get_ldpc"},
12964
12965 {WE_GET_TX_STBC,
12966 0,
12967 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12968 "get_tx_stbc"},
12969
12970 {WE_GET_RX_STBC,
12971 0,
12972 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12973 "get_rx_stbc"},
12974
12975 {WE_GET_SHORT_GI,
12976 0,
12977 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12978 "get_shortgi"},
12979
12980 {WE_GET_RTSCTS,
12981 0,
12982 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12983 "get_rtscts"},
12984
12985 {WE_GET_CHWIDTH,
12986 0,
12987 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12988 "get_chwidth"},
12989
12990 {WE_GET_ANI_EN_DIS,
12991 0,
12992 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12993 "get_anienable"},
12994
12995 {WE_GET_ANI_POLL_PERIOD,
12996 0,
12997 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
12998 "get_aniplen"},
12999
13000 {WE_GET_ANI_LISTEN_PERIOD,
13001 0,
13002 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13003 "get_anilislen"},
13004
13005 {WE_GET_ANI_OFDM_LEVEL,
13006 0,
13007 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13008 "get_aniofdmlvl"},
13009
13010 {WE_GET_ANI_CCK_LEVEL,
13011 0,
13012 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13013 "get_aniccklvl"},
13014
13015 {WE_GET_DYNAMIC_BW,
13016 0,
13017 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13018 "get_cwmenable"},
13019
13020 {WE_GET_GTX_HT_MCS,
13021 0,
13022 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13023 "get_gtxHTMcs"},
13024
13025 {WE_GET_GTX_VHT_MCS,
13026 0,
13027 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13028 "get_gtxVHTMcs"},
13029
13030 {WE_GET_GTX_USRCFG,
13031 0,
13032 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13033 "get_gtxUsrCfg"},
13034
13035 {WE_GET_GTX_THRE,
13036 0,
13037 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13038 "get_gtxThre"},
13039
13040 {WE_GET_GTX_MARGIN,
13041 0,
13042 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13043 "get_gtxMargin"},
13044
13045 {WE_GET_GTX_STEP,
13046 0,
13047 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13048 "get_gtxStep"},
13049
13050 {WE_GET_GTX_MINTPC,
13051 0,
13052 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13053 "get_gtxMinTpc"},
13054
13055 {WE_GET_GTX_BWMASK,
13056 0,
13057 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13058 "get_gtxBWMask"},
13059
13060 {WE_GET_TX_CHAINMASK,
13061 0,
13062 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13063 "get_txchainmask"},
13064
13065 {WE_GET_RX_CHAINMASK,
13066 0,
13067 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13068 "get_rxchainmask"},
13069
13070 {WE_GET_11N_RATE,
13071 0,
13072 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13073 "get_11nrate"},
13074
13075 {WE_GET_AMPDU,
13076 0,
13077 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13078 "get_ampdu"},
13079
13080 {WE_GET_AMSDU,
13081 0,
13082 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13083 "get_amsdu"},
13084
13085 {WE_GET_BURST_ENABLE,
13086 0,
13087 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13088 "get_burst_en"},
13089
13090 {WE_GET_BURST_DUR,
13091 0,
13092 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13093 "get_burst_dur"},
13094
13095 {WE_GET_TXPOW_2G,
13096 0,
13097 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13098 "get_txpow2g"},
13099
13100 {WE_GET_TXPOW_5G,
13101 0,
13102 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13103 "get_txpow5g"},
13104
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013105 {WE_GET_PPS_PAID_MATCH,
13106 0,
13107 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13108 "get_paid_match"},
13109
13110 {WE_GET_PPS_GID_MATCH,
13111 0,
13112 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13113 "get_gid_match"},
13114
13115 {WE_GET_PPS_EARLY_TIM_CLEAR,
13116 0,
13117 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13118 "get_tim_clear"},
13119
13120 {WE_GET_PPS_EARLY_DTIM_CLEAR,
13121 0,
13122 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13123 "get_dtim_clear"},
13124
13125 {WE_GET_PPS_EOF_PAD_DELIM,
13126 0,
13127 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13128 "get_eof_delim"},
13129
13130 {WE_GET_PPS_MACADDR_MISMATCH,
13131 0,
13132 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13133 "get_mac_match"},
13134
13135 {WE_GET_PPS_DELIM_CRC_FAIL,
13136 0,
13137 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13138 "get_delim_fail"},
13139
13140 {WE_GET_PPS_GID_NSTS_ZERO,
13141 0,
13142 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13143 "get_nsts_zero"},
13144
13145 {WE_GET_PPS_RSSI_CHECK,
13146 0,
13147 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13148 "get_rssi_chk"},
13149
13150 {WE_GET_QPOWER_MAX_PSPOLL_COUNT,
13151 0,
13152 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13153 "get_qpspollcnt"},
13154
13155 {WE_GET_QPOWER_MAX_TX_BEFORE_WAKE,
13156 0,
13157 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13158 "get_qtxwake"},
13159
13160 {WE_GET_QPOWER_SPEC_PSPOLL_WAKE_INTERVAL,
13161 0,
13162 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13163 "get_qwakeintv"},
13164
13165 {WE_GET_QPOWER_SPEC_MAX_SPEC_NODATA_PSPOLL,
13166 0,
13167 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13168 "get_qnodatapoll"},
13169
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070013170 {WE_CAP_TSF,
13171 0,
13172 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13173 "cap_tsf"},
13174
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013175 {WE_GET_TEMPERATURE,
13176 0,
13177 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13178 "get_temp"},
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070013179 {WE_GET_DCM,
13180 0,
13181 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13182 "get_dcm"},
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070013183 {WE_GET_RANGE_EXT,
13184 0,
13185 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13186 "get_range_ext"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013187 /* handlers for main ioctl */
13188 {WLAN_PRIV_SET_CHAR_GET_NONE,
13189 IW_PRIV_TYPE_CHAR | 512,
13190 0,
13191 ""},
13192
13193 /* handlers for sub-ioctl */
13194 {WE_WOWL_ADD_PTRN,
13195 IW_PRIV_TYPE_CHAR | 512,
13196 0,
13197 "wowlAddPtrn"},
13198
13199 {WE_WOWL_DEL_PTRN,
13200 IW_PRIV_TYPE_CHAR | 512,
13201 0,
13202 "wowlDelPtrn"},
13203
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013204 /* handlers for sub-ioctl */
13205 {WE_NEIGHBOR_REPORT_REQUEST,
13206 IW_PRIV_TYPE_CHAR | 512,
13207 0,
13208 "neighbor"},
Deepak Dhamdhere641bf322016-01-06 15:19:03 -080013209
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013210 {WE_SET_AP_WPS_IE,
13211 IW_PRIV_TYPE_CHAR | 512,
13212 0,
13213 "set_ap_wps_ie"},
13214
13215 {WE_SET_CONFIG,
13216 IW_PRIV_TYPE_CHAR | 512,
13217 0,
13218 "setConfig"},
13219
13220 /* handlers for main ioctl */
13221 {WLAN_PRIV_SET_THREE_INT_GET_NONE,
13222 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
13223 0,
13224 ""},
13225
13226 /* handlers for sub-ioctl */
13227 {WE_SET_WLAN_DBG,
13228 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
13229 0,
13230 "setwlandbg"},
13231
13232 /* handlers for sub-ioctl */
13233 {WE_SET_DP_TRACE,
13234 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
13235 0,
13236 "set_dp_trace"},
13237
13238 {WE_SET_SAP_CHANNELS,
13239 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
13240 0,
13241 "setsapchannels"},
Anurag Chouhanbf5e0e22016-09-12 12:54:09 +053013242
13243 {WE_SET_FW_TEST,
13244 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
13245 0, "fw_test"},
13246
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070013247 /* handlers for main ioctl */
13248 {WLAN_PRIV_SET_NONE_GET_THREE_INT,
13249 0,
13250 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
13251 "" },
13252 {WE_GET_TSF,
13253 0,
13254 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
13255 "get_tsf" },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013256
13257 {WE_SET_DUAL_MAC_SCAN_CONFIG,
13258 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
13259 0,
13260 "set_scan_cfg"},
13261
13262 /* handlers for main ioctl */
13263 {WLAN_PRIV_GET_CHAR_SET_NONE,
13264 0,
13265 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13266 ""},
13267
13268 /* handlers for sub-ioctl */
13269 {WE_WLAN_VERSION,
13270 0,
13271 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13272 "version"},
13273 {WE_GET_STATS,
13274 0,
13275 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13276 "getStats"},
Dustin Brownd9322482017-01-09 12:46:03 -080013277 {WE_GET_SUSPEND_RESUME_STATS,
13278 0,
13279 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13280 "getSuspendStats"},
Govind Singha471e5e2015-10-12 17:11:14 +053013281 {WE_LIST_FW_PROFILE,
13282 0,
13283 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13284 "listProfile"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013285 {WE_GET_STATES,
13286 0,
13287 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13288 "getHostStates"},
13289 {WE_GET_CFG,
13290 0,
13291 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13292 "getConfig"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013293 {WE_GET_RSSI,
13294 0,
13295 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13296 "getRSSI"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013297 {WE_GET_WMM_STATUS,
13298 0,
13299 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13300 "getWmmStatus"},
13301 {
13302 WE_GET_CHANNEL_LIST,
13303 0,
13304 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13305 "getChannelList"
13306 },
13307#ifdef FEATURE_WLAN_TDLS
13308 {
13309 WE_GET_TDLS_PEERS,
13310 0,
13311 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13312 "getTdlsPeers"
13313 },
13314#endif
13315#ifdef WLAN_FEATURE_11W
13316 {
13317 WE_GET_11W_INFO,
13318 0,
13319 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13320 "getPMFInfo"
13321 },
13322#endif
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080013323 {
13324 WE_GET_IBSS_STA_INFO,
13325 0,
13326 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13327 "getIbssSTAs"
13328 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013329 {WE_GET_PHYMODE,
13330 0,
13331 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13332 "getphymode"},
Naveen Rawat910726a2017-03-06 11:42:51 -080013333#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013334 {WE_GET_OEM_DATA_CAP,
13335 0,
13336 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13337 "getOemDataCap"},
Naveen Rawat910726a2017-03-06 11:42:51 -080013338#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013339 {WE_GET_SNR,
13340 0,
13341 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13342 "getSNR"},
13343
13344 /* handlers for main ioctl */
13345 {WLAN_PRIV_SET_NONE_GET_NONE,
13346 0,
13347 0,
13348 ""},
13349
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080013350 /* handlers for sub-ioctl */
13351 {
13352 WE_IBSS_GET_PEER_INFO_ALL,
13353 0,
13354 0,
13355 "ibssPeerInfoAll"
13356 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013357 {WE_GET_RECOVERY_STAT,
13358 0,
13359 0,
13360 "getRecoverStat"},
Govind Singha471e5e2015-10-12 17:11:14 +053013361
13362 {WE_GET_FW_PROFILE_DATA,
13363 0,
13364 0,
13365 "getProfileData"},
13366
13367 {WE_SET_REASSOC_TRIGGER,
13368 0,
13369 0,
13370 "reassoc"},
13371
Sandeep Puligilla93a29ec2016-02-12 16:10:56 -080013372 {WE_STOP_OBSS_SCAN,
13373 0,
13374 0,
13375 "stop_obss_scan"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013376 /* handlers for main ioctl */
13377 {WLAN_PRIV_SET_VAR_INT_GET_NONE,
13378 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13379 0,
13380 ""},
13381
13382 /* handlers for sub-ioctl */
Rajeev Kumar8e3e2832015-11-06 16:02:54 -080013383 {WE_IBSS_GET_PEER_INFO,
13384 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13385 0,
13386 "ibssPeerInfo"},
13387
13388 /* handlers for sub-ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013389 {WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
13390 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13391 0,
13392 "setdumplog"},
13393
13394 {WE_MTRACE_DUMP_CMD,
13395 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13396 0,
13397 "dumplog"},
Krunal Sonia6e505b2017-01-12 12:25:18 -080013398
13399 {WE_POLICY_MANAGER_CINFO_CMD,
13400 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13401 0,
13402 "pm_cinfo"},
13403
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013404#ifdef MPC_UT_FRAMEWORK
13405 {WE_POLICY_MANAGER_CLIST_CMD,
13406 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13407 0,
13408 "pm_clist"},
13409
13410 {WE_POLICY_MANAGER_DLIST_CMD,
13411 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13412 0,
13413 "pm_dlist"},
13414
13415 {WE_POLICY_MANAGER_DBS_CMD,
13416 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13417 0,
13418 "pm_dbs"},
13419
13420 {WE_POLICY_MANAGER_PCL_CMD,
13421 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13422 0,
13423 "pm_pcl"},
13424
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013425 {WE_POLICY_MANAGER_ULIST_CMD,
13426 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13427 0,
13428 "pm_ulist"},
13429
13430 {WE_POLICY_MANAGER_QUERY_ACTION_CMD,
13431 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13432 0,
13433 "pm_query_action"},
13434
13435 {WE_POLICY_MANAGER_QUERY_ALLOW_CMD,
13436 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13437 0,
13438 "pm_query_allow"},
13439
13440 {WE_POLICY_MANAGER_SCENARIO_CMD,
13441 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13442 0,
13443 "pm_run_scenario"},
13444
13445 {WE_POLICY_SET_HW_MODE_CMD,
13446 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13447 0,
13448 "pm_set_hw_mode"},
13449#endif
13450#ifdef FEATURE_WLAN_TDLS
13451 /* handlers for sub ioctl */
13452 {
13453 WE_TDLS_CONFIG_PARAMS,
13454 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13455 0,
13456 "setTdlsConfig"
13457 },
13458#endif
13459 {
13460 WE_UNIT_TEST_CMD,
13461 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13462 0,
13463 "setUnitTestCmd"
13464 },
Manjeet Singhf82ed072016-07-08 11:40:00 +053013465 {
13466 WE_MAC_PWR_DEBUG_CMD,
13467 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13468 0,
13469 "halPwrDebug"
13470 },
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013471
13472#ifdef WLAN_FEATURE_GPIO_LED_FLASHING
13473 {WE_LED_FLASHING_PARAM,
13474 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
13475 0,
13476 "gpio_control"},
13477#endif
13478 /* handlers for main ioctl */
Jeff Johnson6fa1e012017-04-05 06:40:53 -070013479 {WLAN_PRIV_FIPS_TEST,
13480 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
13481 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
13482 "fips_test"},
13483
13484 /* handlers for main ioctl */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013485 {WLAN_PRIV_ADD_TSPEC,
13486 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
13487 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13488 "addTspec"},
13489
13490 /* handlers for main ioctl */
13491 {WLAN_PRIV_DEL_TSPEC,
13492 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13493 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13494 "delTspec"},
13495
13496 /* handlers for main ioctl */
13497 {WLAN_PRIV_GET_TSPEC,
13498 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13499 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13500 "getTspec"},
13501
13502 /* handlers for main ioctl - host offload */
13503 {
13504 WLAN_PRIV_SET_HOST_OFFLOAD,
Srinivas Girigowda077143e2017-03-25 10:47:27 -070013505 IW_PRIV_TYPE_BYTE | sizeof(struct host_offload_req),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013506 0,
13507 "setHostOffload"
13508 }
13509 ,
13510
13511 {
13512 WLAN_GET_WLAN_STATISTICS,
13513 0,
13514 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
13515 "getWlanStats"
13516 }
13517 ,
13518
13519 {
13520 WLAN_SET_KEEPALIVE_PARAMS,
Mahesh A Saptasagar72d2e4b2016-04-20 12:44:17 +053013521 IW_PRIV_TYPE_BYTE | sizeof(tSirKeepAliveReq) |
13522 IW_PRIV_SIZE_FIXED,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013523 0,
13524 "setKeepAlive"
13525 }
13526 ,
13527#ifdef WLAN_FEATURE_PACKET_FILTERING
13528 {
13529 WLAN_SET_PACKET_FILTER_PARAMS,
Hanumanth Reddy Pothulab3ef4162016-10-25 15:13:26 +053013530 IW_PRIV_TYPE_BYTE |
13531 sizeof(struct pkt_filter_cfg),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013532 0,
13533 "setPktFilter"
13534 }
13535 ,
13536#endif
13537#ifdef FEATURE_WLAN_SCAN_PNO
13538 {
13539 WLAN_SET_PNO,
13540 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
13541 0,
13542 "setpno"
13543 }
13544 ,
13545#endif
13546 {
13547 WLAN_SET_BAND_CONFIG,
13548 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13549 0,
13550 "SETBAND"
13551 }
13552 ,
13553 {
Dustin Brown0cbc7572016-12-16 13:54:40 -080013554 WLAN_PRIV_SET_MCBC_FILTER,
Dustin Brown860566f2017-01-31 15:24:43 -080013555 0,
Dustin Brown0cbc7572016-12-16 13:54:40 -080013556 0,
13557 "setMCBCFilter"
13558 }
13559 ,
Dustin Brown0cbc7572016-12-16 13:54:40 -080013560
13561 {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013562 WLAN_GET_LINK_SPEED,
13563 IW_PRIV_TYPE_CHAR | 18,
13564 IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed"
13565 }
13566 ,
13567
13568 /* handlers for main ioctl */
13569 {WLAN_PRIV_SET_TWO_INT_GET_NONE,
13570 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13571 0,
13572 ""}
13573 ,
13574 {WE_SET_SMPS_PARAM,
13575 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13576 0, "set_smps_param"}
13577 ,
13578 {WLAN_SET_DOT11P_CHANNEL_SCHED,
13579 IW_PRIV_TYPE_BYTE | sizeof(struct dot11p_channel_sched),
13580 0, "set_dot11p" }
13581 ,
Srinivas Girigowda6147c582016-10-18 12:26:15 -070013582#ifdef WLAN_DEBUG
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013583 {WE_SET_FW_CRASH_INJECT,
13584 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13585 0, "crash_inject"}
13586 ,
Dustin Brown8d2d0f52017-04-03 17:02:08 -070013587 {WE_LOG_BUFFER,
13588 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13589 0, "log_buffer"}
13590 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013591#endif
Rajeev Kumara78a0a42016-07-13 19:28:20 -070013592#ifdef WLAN_SUSPEND_RESUME_TEST
13593 {WE_SET_WLAN_SUSPEND,
13594 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13595 0, "wlan_suspend"}
13596 ,
13597 {WE_SET_WLAN_RESUME,
13598 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13599 0, "wlan_resume"}
13600 ,
13601#endif
Govind Singha471e5e2015-10-12 17:11:14 +053013602 {WE_ENABLE_FW_PROFILE,
13603 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13604 0, "enableProfile"}
13605 ,
13606 {WE_SET_FW_PROFILE_HIST_INTVL,
13607 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13608 0, "set_hist_intvl"}
13609 ,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013610 {WE_SET_DUAL_MAC_FW_MODE_CONFIG,
13611 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13612 0, "set_fw_mode_cfg"}
13613 ,
13614 {WE_DUMP_DP_TRACE_LEVEL,
13615 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13616 0, "dump_dp_trace"}
13617 ,
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -070013618 {WE_SET_MON_MODE_CHAN,
13619 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
13620 0, "setMonChan"}
13621 ,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070013622
13623 {WE_GET_ROAM_SYNCH_DELAY,
13624 0,
13625 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13626 "hostroamdelay"}
13627 ,
Krishna Kumaar Natarajan9e5339d2016-12-05 14:12:13 -080013628 {WE_SET_11AX_RATE,
13629 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13630 0,
13631 "set_11ax_rate"}
13632 ,
Krishna Kumaar Natarajan1a71ec72017-03-23 12:26:31 -070013633 {WE_SET_DCM,
13634 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13635 0,
13636 "enable_dcm"}
13637 ,
Krishna Kumaar Natarajan150cd012017-03-23 12:29:10 -070013638 {WE_SET_RANGE_EXT,
13639 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
13640 0,
13641 "enable_range_ext"}
13642 ,
Naveen Rawatc921c7b2017-06-13 17:29:51 -070013643
13644 {WLAN_PRIV_SET_FTIES,
13645 IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE,
13646 0,
13647 "set_ft_ies"},
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013648};
13649
13650const struct iw_handler_def we_handler_def = {
Anurag Chouhan6d760662016-02-20 16:05:43 +053013651 .num_standard = QDF_ARRAY_SIZE(we_handler),
13652 .num_private = QDF_ARRAY_SIZE(we_private),
13653 .num_private_args = QDF_ARRAY_SIZE(we_private_args),
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013654
13655 .standard = (iw_handler *) we_handler,
13656 .private = (iw_handler *) we_private,
13657 .private_args = we_private_args,
13658 .get_wireless_stats = NULL,
13659};
13660
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070013661/* hdd_set_wext() - configures bss parameters
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070013662 * @adapter: handle to adapter context
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070013663 *
13664 * Returns: none
13665 */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070013666static int hdd_set_wext(struct hdd_adapter *adapter)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013667{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070013668 struct hdd_wext_state *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Jeff Johnsond377dce2017-10-04 10:32:42 -070013669 struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013670
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070013671 ENTER();
13672
13673 if (!pwextBuf) {
13674 hdd_err("ERROR: pwextBuf is NULL");
13675 return QDF_STATUS_E_FAILURE;
13676 }
13677
Jeff Johnsond377dce2017-10-04 10:32:42 -070013678 if (!sta_ctx) {
13679 hdd_err("ERROR: sta_ctx is NULL");
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070013680 return QDF_STATUS_E_FAILURE;
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070013681 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013682
13683 /* Now configure the roaming profile links. To SSID and bssid. */
13684 pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0;
Jeff Johnsond377dce2017-10-04 10:32:42 -070013685 pwextBuf->roamProfile.SSIDs.SSIDList = &sta_ctx->conn_info.SSID;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013686
13687 pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0;
Jeff Johnsond377dce2017-10-04 10:32:42 -070013688 pwextBuf->roamProfile.BSSIDs.bssid = &sta_ctx->conn_info.bssId;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013689
13690 /*Set the numOfChannels to zero to scan all the channels */
13691 pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0;
13692 pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL;
13693
13694 /* Default is no encryption */
13695 pwextBuf->roamProfile.EncryptionType.numEntries = 1;
13696 pwextBuf->roamProfile.EncryptionType.encryptionType[0] =
13697 eCSR_ENCRYPT_TYPE_NONE;
13698
13699 pwextBuf->roamProfile.mcEncryptionType.numEntries = 1;
13700 pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] =
13701 eCSR_ENCRYPT_TYPE_NONE;
13702
13703 pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
13704
13705 /* Default is no authentication */
13706 pwextBuf->roamProfile.AuthType.numEntries = 1;
13707 pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
13708
13709 pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_AUTO;
Jeff Johnsonce4a8342017-10-14 13:12:22 -070013710 sta_ctx->wpa_versions = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013711
13712 /*Set the default scan mode */
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070013713 adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013714
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070013715 hdd_clear_roam_profile_ie(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013716
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070013717 EXIT();
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053013718 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013719
13720}
13721
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053013722#ifdef WLAN_FEATURE_FILS_SK
Jeff Johnson2a722002017-09-30 20:02:35 -070013723static void hdd_initialize_fils_info(struct hdd_wext_state *pwextBuf)
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053013724{
13725 pwextBuf->roamProfile.fils_con_info = NULL;
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +053013726 pwextBuf->roamProfile.hlp_ie = NULL;
13727 pwextBuf->roamProfile.hlp_ie_len = 0;
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053013728}
13729#else
Jeff Johnson2a722002017-09-30 20:02:35 -070013730static void hdd_initialize_fils_info(struct hdd_wext_state *pwextBuf)
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053013731{ }
13732#endif
13733
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070013734/**
13735 * hdd_register_wext() - register wext context
13736 * @dev: net device handle
13737 *
13738 * Registers wext interface context for a given net device
13739 *
13740 * Returns: 0 on success, errno on failure
13741 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013742int hdd_register_wext(struct net_device *dev)
13743{
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070013744 struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
13745 struct hdd_wext_state *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(adapter);
Anurag Chouhance0dc992016-02-16 18:18:03 +053013746 QDF_STATUS status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013747
13748 ENTER();
13749
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -070013750 if (!pwextBuf) {
13751 hdd_err(FL("ERROR: pwextBuf is NULL"));
13752 return QDF_STATUS_E_FAILURE;
13753 }
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070013754
13755 /* Zero the memory. This zeros the profile structure */
Jeff Johnson2a722002017-09-30 20:02:35 -070013756 memset(pwextBuf, 0, sizeof(struct hdd_wext_state));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013757
Jeff Johnsonf23a89b2017-10-02 13:20:38 -070013758 status = hdd_set_wext(adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013759
Anurag Chouhance0dc992016-02-16 18:18:03 +053013760 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070013761 hdd_err("ERROR: hdd_set_wext failed!!");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053013762 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013763 }
13764
Srinivas Girigowdafba82a02017-03-24 21:26:35 -070013765 status = qdf_event_create(&pwextBuf->hdd_qdf_event);
13766 if (!QDF_IS_STATUS_SUCCESS(status)) {
Jeff Johnson99bac312016-06-28 10:38:18 -070013767 hdd_err("ERROR: HDD qdf event init failed!!");
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053013768 return QDF_STATUS_E_FAILURE;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013769 }
13770
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +053013771 hdd_initialize_fils_info(pwextBuf);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013772 /* Register as a wireless device */
13773 dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def;
13774
13775 EXIT();
13776 return 0;
13777}
13778
13779int hdd_unregister_wext(struct net_device *dev)
13780{
Jeff Johnson36e74c42017-09-18 08:15:42 -070013781 hdd_debug("dev(%pK)", dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013782
13783 if (dev != NULL) {
13784 rtnl_lock();
13785 dev->wireless_handlers = NULL;
13786 rtnl_unlock();
13787 }
13788
13789 return 0;
13790}