blob: 561ba46be1176ed5960dccd587f7410a3fa44a30 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
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/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/** ------------------------------------------------------------------------ *
32 ------------------------------------------------------------------------ *
33
34
35 \file wlan_hdd_wext.c
36
37 \brief Airgo Linux Wireless Extensions Common Control Plane Types and
38 interfaces.
39
40 $Id: wlan_hdd_wext.c,v 1.34 2007/04/14 01:49:23 jimz Exp jimz $
41
Jeff Johnson295189b2012-06-20 16:38:30 -070042 This file defines all of the types that are utilized by the CCP module
43 of the "Portable" HDD. This file also includes the underlying Linux
44 Wireless Extensions Data types referred to by CCP.
45
46 ======================================================================== */
47
48#include <linux/version.h>
49#include <linux/module.h>
50#include <linux/kernel.h>
51#include <linux/init.h>
52#include <linux/wireless.h>
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053053#include <macTrace.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070054#include <wlan_hdd_includes.h>
55#include <wlan_btc_svc.h>
56#include <wlan_nlink_common.h>
57#ifdef WLAN_BTAMP_FEATURE
58#include <bap_hdd_main.h>
59#endif
60#include <vos_api.h>
61#include <net/arp.h>
62#include "ccmApi.h"
63#include "sirParams.h"
64#include "csrApi.h"
65#include "csrInsideApi.h"
66#if defined WLAN_FEATURE_VOWIFI
67#include "smeRrmInternal.h"
68#endif
69#include <aniGlobal.h>
70#include "dot11f.h"
71#include <wlan_hdd_wowl.h>
72#include <wlan_hdd_cfg.h>
73#include <wlan_hdd_wmm.h>
74#include "utilsApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070075#include "wlan_hdd_p2p.h"
Chilam NG571c65a2013-01-19 12:27:36 +053076#ifdef FEATURE_WLAN_TDLS
77#include "wlan_hdd_tdls.h"
78#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070079
80#ifdef CONFIG_HAS_EARLYSUSPEND
81#include <linux/earlysuspend.h>
82#endif
83#include "wlan_hdd_power.h"
84#include "qwlan_version.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070085#include "wlan_hdd_host_offload.h"
86#include "wlan_hdd_keep_alive.h"
87#ifdef WLAN_FEATURE_PACKET_FILTERING
88#include "wlan_hdd_packet_filtering.h"
89#endif
90
Jeff Johnson295189b2012-06-20 16:38:30 -070091#include <linux/wireless.h>
92#include <net/cfg80211.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070093#include "wlan_qct_pal_trace.h"
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +053094#include "wlan_qct_tl.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070095
96#include "wlan_hdd_misc.h"
97#include "bap_hdd_misc.h"
98
99#include "wlan_hdd_dev_pwr.h"
100#include "qc_sap_ioctl.h"
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +0530101#include "sme_Api.h"
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700102#include "vos_trace.h"
Agarwal Ashish450ffde2014-04-08 19:53:00 +0530103#include "wlan_hdd_assoc.h"
Jeff Johnson295189b2012-06-20 16:38:30 -0700104
Mukul Sharma84f27252014-07-14 18:11:42 +0530105#ifdef DEBUG_ROAM_DELAY
106#include "vos_utils.h"
107#endif
108
Jeff Johnson295189b2012-06-20 16:38:30 -0700109#ifdef CONFIG_HAS_EARLYSUSPEND
110extern void hdd_suspend_wlan(struct early_suspend *wlan_suspend);
111extern void hdd_resume_wlan(struct early_suspend *wlan_suspend);
112#endif
113
Jeff Johnsone7245742012-09-05 17:12:55 -0700114#ifdef FEATURE_OEM_DATA_SUPPORT
Madan Mohan Koyyalamudi7a4d9312012-12-04 17:21:36 -0800115#define MAX_OEM_DATA_RSP_LEN 2047
Jeff Johnsone7245742012-09-05 17:12:55 -0700116#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700117
118#define HDD_FINISH_ULA_TIME_OUT 800
Sushant Kaushik10315f92014-04-29 11:30:25 +0530119#define COUNTRY_CODE_LEN 2
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700120
Jeff Johnson295189b2012-06-20 16:38:30 -0700121
Atul Mittalc0f739f2014-07-31 13:47:47 +0530122// tdlsoffchan
123#ifdef FEATURE_WLAN_TDLS
Atul Mittalc0f739f2014-07-31 13:47:47 +0530124static int tdlsOffCh = 1;
125static int tdlsOffChBwOffset = 0;
126#endif
Abhishek Singh678227a2014-11-04 10:52:38 +0530127
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700128static int ioctl_debug;
Jeff Johnson295189b2012-06-20 16:38:30 -0700129module_param(ioctl_debug, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
130
Jeff Johnson295189b2012-06-20 16:38:30 -0700131/* To Validate Channel against the Frequency and Vice-Versa */
132static const hdd_freq_chan_map_t freq_chan_map[] = { {2412, 1}, {2417, 2},
133 {2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, {2442, 7}, {2447, 8},
134 {2452, 9}, {2457, 10}, {2462, 11}, {2467 ,12}, {2472, 13},
135 {2484, 14}, {4920, 240}, {4940, 244}, {4960, 248}, {4980, 252},
136 {5040, 208}, {5060, 212}, {5080, 216}, {5180, 36}, {5200, 40}, {5220, 44},
137 {5240, 48}, {5260, 52}, {5280, 56}, {5300, 60}, {5320, 64}, {5500, 100},
138 {5520, 104}, {5540, 108}, {5560, 112}, {5580, 116}, {5600, 120},
139 {5620, 124}, {5640, 128}, {5660, 132}, {5680, 136}, {5700, 140},
Manjunathappa Prakash009dcb42014-03-07 15:29:22 -0800140 {5720, 144}, {5745, 149}, {5765, 153}, {5785, 157}, {5805, 161},
141 {5825, 165} };
Jeff Johnson295189b2012-06-20 16:38:30 -0700142
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800143#define FREQ_CHAN_MAP_TABLE_SIZE (sizeof(freq_chan_map)/sizeof(freq_chan_map[0]))
Jeff Johnson295189b2012-06-20 16:38:30 -0700144
145/* Private ioctls and their sub-ioctls */
146#define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0)
147#define WE_SET_11D_STATE 1
148#define WE_WOWL 2
149#define WE_SET_POWER 3
150#define WE_SET_MAX_ASSOC 4
151#define WE_SET_SAP_AUTO_CHANNEL_SELECTION 5
152#define WE_SET_DATA_INACTIVITY_TO 6
153#define WE_SET_MAX_TX_POWER 7
154#define WE_SET_HIGHER_DTIM_TRANSITION 8
155#define WE_SET_TM_LEVEL 9
Kiet Lam46b8e4e2013-11-06 21:49:53 +0530156#define WE_ENABLE_STRICT_FCC_REG 10
Arif Hussaina5ebce02013-08-09 15:09:58 -0700157#define WE_SET_MAX_TX_POWER_2_4 11
158#define WE_SET_MAX_TX_POWER_5_0 12
Tushnim Bhattacharyyaa3ba5a52014-01-30 11:37:33 -0800159/* Private IOCTL for debug connection issues */
160#define WE_SET_DEBUG_LOG 13
Atul Mittalc0f739f2014-07-31 13:47:47 +0530161// tdlsoffchan
162#ifdef FEATURE_WLAN_TDLS
163#define WE_SET_TDLS_OFF_CHAN 14
164#define WE_SET_TDLS_SEC_OFF_CHAN_OFFSET 15
165#define WE_SET_TDLS_OFF_CHAN_MODE 16
166#endif
Peng Xu2446a892014-09-05 17:21:18 +0530167#define WE_SET_SCAN_BAND_PREFERENCE 17
Jeff Johnson295189b2012-06-20 16:38:30 -0700168
169/* Private ioctls and their sub-ioctls */
170#define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1)
171#define WE_GET_11D_STATE 1
172#define WE_IBSS_STATUS 2
173#define WE_PMC_STATE 3
174#define WE_GET_WLAN_DBG 4
Jeff Johnson295189b2012-06-20 16:38:30 -0700175#define WE_GET_MAX_ASSOC 6
176#define WE_GET_WDI_DBG 7
177#define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8
178#define WE_GET_CONCURRENCY_MODE 9
Peng Xu2446a892014-09-05 17:21:18 +0530179#define WE_GET_SCAN_BAND_PREFERENCE 10
Jeff Johnson295189b2012-06-20 16:38:30 -0700180/* Private ioctls and their sub-ioctls */
181#define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2)
182
183/* Private ioctls and their sub-ioctls */
184#define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3)
185#define WE_WOWL_ADD_PTRN 1
186#define WE_WOWL_DEL_PTRN 2
187#if defined WLAN_FEATURE_VOWIFI
188#define WE_NEIGHBOR_REPORT_REQUEST 3
189#endif
190#define WE_SET_AP_WPS_IE 4 //This is called in station mode to set probe rsp ie.
191#define WE_SET_CONFIG 5
192
193/* Private ioctls and their sub-ioctls */
194#define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4)
195#define WE_SET_WLAN_DBG 1
196#define WE_SET_WDI_DBG 2
197#define WE_SET_SAP_CHANNELS 3
198
199/* Private ioctls and their sub-ioctls */
200#define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5)
201#define WE_WLAN_VERSION 1
202#define WE_GET_STATS 2
203#define WE_GET_CFG 3
204#define WE_GET_WMM_STATUS 4
205#define WE_GET_CHANNEL_LIST 5
Jeff Johnsone7245742012-09-05 17:12:55 -0700206#ifdef WLAN_FEATURE_11AC
207#define WE_GET_RSSI 6
208#endif
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800209#define WE_GET_ROAM_RSSI 7
Chilam Ng16a2a1c2013-01-29 01:27:29 -0800210#ifdef FEATURE_WLAN_TDLS
211#define WE_GET_TDLS_PEERS 8
212#endif
Chet Lanctot186b5732013-03-18 10:26:30 -0700213#ifdef WLAN_FEATURE_11W
214#define WE_GET_11W_INFO 9
215#endif
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +0530216#define WE_GET_STATES 10
Girish Gowlidab72f12014-09-04 15:34:43 +0530217#define WE_GET_SNR 11
Jeff Johnson295189b2012-06-20 16:38:30 -0700218
219/* Private ioctls and their sub-ioctls */
220#define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6)
221#define WE_CLEAR_STATS 1
222#define WE_INIT_AP 2
223#define WE_STOP_AP 3
Girish Gowli345bff82014-06-09 20:05:24 +0530224#ifdef WLAN_BTAMP_FEATURE
Jeff Johnson295189b2012-06-20 16:38:30 -0700225#define WE_ENABLE_AMP 4
226#define WE_DISABLE_AMP 5
Girish Gowli345bff82014-06-09 20:05:24 +0530227#endif /* WLAN_BTAMP_FEATURE */
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -0700228#define WE_ENABLE_DXE_STALL_DETECT 6
229#define WE_DISPLAY_DXE_SNAP_SHOT 7
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -0700230#define WE_SET_REASSOC_TRIGGER 8
Sandeep Puligillaa3e76952014-06-23 15:53:11 +0530231#define WE_DISPLAY_DATAPATH_SNAP_SHOT 9
Sandeep Puligilla04bb8fd2014-02-03 23:21:47 +0530232#define WE_STOP_OBSS_SCAN 11
Jeff Johnson295189b2012-06-20 16:38:30 -0700233
Mukul Sharma84f27252014-07-14 18:11:42 +0530234#ifdef DEBUG_ROAM_DELAY
235#define WE_DUMP_ROAM_TIMER_LOG 12
236#define WE_RESET_ROAM_TIMER_LOG 13
237#endif
238
Jeff Johnson295189b2012-06-20 16:38:30 -0700239/* Private ioctls and their sub-ioctls */
240#define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7)
241#define WE_LOG_DUMP_CMD 1
242
Jeff Johnson295189b2012-06-20 16:38:30 -0700243#define WE_P2P_NOA_CMD 2
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -0800244//IOCTL to configure MCC params
245#define WE_MCC_CONFIG_CREDENTIAL 3
246#define WE_MCC_CONFIG_PARAMS 4
Jeff Johnson295189b2012-06-20 16:38:30 -0700247
Chilam NG571c65a2013-01-19 12:27:36 +0530248#ifdef FEATURE_WLAN_TDLS
249#define WE_TDLS_CONFIG_PARAMS 5
250#endif
251
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700252#define WE_MTRACE_DUMP_CMD 8
Katya Nigamc2f29dc2014-01-20 19:29:30 +0530253#define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -0700254
Chilam Ng01120412013-02-19 18:32:21 -0800255#ifdef FEATURE_WLAN_TDLS
256#undef MAX_VAR_ARGS
257#define MAX_VAR_ARGS 10
258#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700259#define MAX_VAR_ARGS 7
Chilam Ng01120412013-02-19 18:32:21 -0800260#endif
261
Jeff Johnson295189b2012-06-20 16:38:30 -0700262/* Private ioctls (with no sub-ioctls) */
263/* note that they must be odd so that they have "get" semantics */
264#define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9)
265#define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11)
266#define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13)
267
Girish Gowli464c9c82014-06-09 19:47:53 +0530268/* (SIOCIWFIRSTPRIV + 8) is currently unused */
269/* (SIOCIWFIRSTPRIV + 16) is currently unused */
270/* (SIOCIWFIRSTPRIV + 10) is currently unused */
271/* (SIOCIWFIRSTPRIV + 12) is currently unused */
272/* (SIOCIWFIRSTPRIV + 14) is currently unused */
273/* (SIOCIWFIRSTPRIV + 15) is currently unused */
Jeff Johnson295189b2012-06-20 16:38:30 -0700274
Jeff Johnsone7245742012-09-05 17:12:55 -0700275#ifdef FEATURE_OEM_DATA_SUPPORT
276/* Private ioctls for setting the measurement configuration */
277#define WLAN_PRIV_SET_OEM_DATA_REQ (SIOCIWFIRSTPRIV + 17)
278#define WLAN_PRIV_GET_OEM_DATA_RSP (SIOCIWFIRSTPRIV + 19)
279#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700280
281#ifdef WLAN_FEATURE_VOWIFI_11R
282#define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20)
283#endif
284
285/* Private ioctl for setting the host offload feature */
286#define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18)
287
288/* Private ioctl to get the statistics */
289#define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21)
290
291/* Private ioctl to set the Keep Alive Params */
292#define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22)
293#ifdef WLAN_FEATURE_PACKET_FILTERING
294/* Private ioctl to set the Packet Filtering Params */
295#define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23)
296#endif
297
298#ifdef FEATURE_WLAN_SCAN_PNO
299/* Private ioctl to get the statistics */
300#define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24)
301#endif
302
303#define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25) /*Don't change this number*/
304
305#define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26)
306#define WLAN_PRIV_CLEAR_MCBC_FILTER (SIOCIWFIRSTPRIV + 27)
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -0700307/* Private ioctl to trigger reassociation */
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -0700308
Jeff Johnson295189b2012-06-20 16:38:30 -0700309#define WLAN_SET_POWER_PARAMS (SIOCIWFIRSTPRIV + 29)
310#define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31)
311
312#define WLAN_STATS_INVALID 0
313#define WLAN_STATS_RETRY_CNT 1
314#define WLAN_STATS_MUL_RETRY_CNT 2
315#define WLAN_STATS_TX_FRM_CNT 3
316#define WLAN_STATS_RX_FRM_CNT 4
317#define WLAN_STATS_FRM_DUP_CNT 5
318#define WLAN_STATS_FAIL_CNT 6
319#define WLAN_STATS_RTS_FAIL_CNT 7
320#define WLAN_STATS_ACK_FAIL_CNT 8
321#define WLAN_STATS_RTS_SUC_CNT 9
322#define WLAN_STATS_RX_DISCARD_CNT 10
323#define WLAN_STATS_RX_ERROR_CNT 11
324#define WLAN_STATS_TX_BYTE_CNT 12
325
326#define WLAN_STATS_RX_BYTE_CNT 13
327#define WLAN_STATS_RX_RATE 14
328#define WLAN_STATS_TX_RATE 15
329
Jeff Johnsone7245742012-09-05 17:12:55 -0700330#define WLAN_STATS_RX_UC_BYTE_CNT 16
331#define WLAN_STATS_RX_MC_BYTE_CNT 17
332#define WLAN_STATS_RX_BC_BYTE_CNT 18
333#define WLAN_STATS_TX_UC_BYTE_CNT 19
334#define WLAN_STATS_TX_MC_BYTE_CNT 20
335#define WLAN_STATS_TX_BC_BYTE_CNT 21
336
Madan Mohan Koyyalamudic0d1b3f2012-11-13 10:41:07 -0800337#define FILL_TLV(__p, __type, __size, __val, __tlen) do { \
338 if ((__tlen + __size + 2) < WE_MAX_STR_LEN) \
339 { \
340 *__p++ = __type; \
341 *__p++ = __size; \
342 memcpy(__p, __val, __size); \
343 __p += __size; \
344 __tlen += __size + 2; \
345 } \
346 else \
347 { \
Arif Hussain6d2a3322013-11-17 19:50:10 -0800348 hddLog(VOS_TRACE_LEVEL_ERROR, "FILL_TLV Failed!!!"); \
Madan Mohan Koyyalamudic0d1b3f2012-11-13 10:41:07 -0800349 } \
350 } while(0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700351
352#define VERSION_VALUE_MAX_LEN 32
353
354#define TX_PER_TRACKING_DEFAULT_RATIO 5
355#define TX_PER_TRACKING_MAX_RATIO 10
356#define TX_PER_TRACKING_DEFAULT_WATERMARK 5
357
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +0530358#define WLAN_ADAPTER 0
359#define P2P_ADAPTER 1
360
Abhishek Singh2ec36ab2014-08-07 16:14:25 +0530361/*
362 * When supplicant sends SETBAND ioctl it queries for channels from
363 * cfg80211 layer by sending itself EVENT_CHANNEL_LIST_CHANGED command.
364 * This is not required if the return type from ioctl is
365 * DO_NOT_SEND_CHANNEL_CHANGE_EVENT as wiphy will send channel change
366 * event as part of regulatory_hint.
367 */
368enum {
369 SEND_CHANNEL_CHANGE_EVENT = 0,
370 DO_NOT_SEND_CHANNEL_CHANGE_EVENT,
371};
372
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -0800373/*MCC Configuration parameters */
374enum {
375 MCC_SCHEDULE_TIME_SLICE_CFG_PARAM = 1,
376 MCC_MAX_NULL_SEND_TIME_CFG_PARAM,
377 MCC_TX_EARLY_STOP_TIME_CFG_PARAM,
378 MCC_RX_DRAIN_TIME_CFG_PARAM,
379 MCC_CHANNEL_SWITCH_TIME_CFG_PARAM,
380 MCC_MIN_CHANNEL_TIME_CFG_PARAM,
381 MCC_PARK_BEFORE_TBTT_CFG_PARAM,
382 MCC_MIN_AFTER_DTIM_CFG_PARAM,
383 MCC_TOO_CLOSE_MARGIN_CFG_PARAM,
384};
385
386int hdd_validate_mcc_config(hdd_adapter_t *pAdapter, v_UINT_t staId,
387 v_UINT_t arg1, v_UINT_t arg2, v_UINT_t arg3);
388
Jeff Johnson295189b2012-06-20 16:38:30 -0700389#ifdef WLAN_FEATURE_PACKET_FILTERING
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -0800390int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest,
Jeff Johnsone7245742012-09-05 17:12:55 -0700391 v_U8_t sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700392#endif
393
Jeff Johnson295189b2012-06-20 16:38:30 -0700394/**---------------------------------------------------------------------------
395
Arif Hussain0273cba2014-01-07 20:58:29 -0800396 \brief mem_alloc_copy_from_user_helper -
397
398 Helper function to allocate buffer and copy user data.
399
400 \param - wrqu - Pointer to IOCTL Data.
401 len - size
402
403 \return - On Success pointer to buffer, On failure NULL
404
405 --------------------------------------------------------------------------*/
Girish Gowli86c471e2014-06-17 19:28:05 +0530406void *mem_alloc_copy_from_user_helper(const void *wrqu_data, size_t len)
Arif Hussain0273cba2014-01-07 20:58:29 -0800407{
408 u8 *ptr = NULL;
409
410 /* in order to protect the code, an extra byte is post appended to the buffer
411 * and the null termination is added. However, when allocating (len+1) byte
412 * of memory, we need to make sure that there is no uint overflow when doing
413 * addition. In theory check len < UINT_MAX protects the uint overflow. For
414 * wlan private ioctl, the buffer size is much less than UINT_MAX, as a good
415 * guess, now, it is assumed that the private command buffer size is no
416 * greater than 4K (4096 bytes). So we use 4096 as the upper boundary for now.
417 */
418 if (len > MAX_USER_COMMAND_SIZE)
419 {
420 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
421 "Invalid length");
422 return NULL;
423 }
424
425 ptr = kmalloc(len + 1, GFP_KERNEL);
426 if (NULL == ptr)
427 {
428 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
429 "unable to allocate memory");
430 return NULL;
431 }
432
433 if (copy_from_user(ptr, wrqu_data, len))
434 {
435 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
436 "%s: failed to copy data to user buffer", __func__);
437 kfree(ptr);
438 return NULL;
439 }
440 ptr[len] = '\0';
441 return ptr;
442}
443
Girish Gowli488ef492014-06-12 18:44:33 +0530444// Function to handle and get compatible struct iw_point passed to ioctl.
445int hdd_priv_get_data(struct iw_point *p_priv_data,
446 union iwreq_data *wrqu)
447{
448 if ((NULL == p_priv_data) || (NULL == wrqu))
449 {
450 return -EINVAL;
451 }
452
453#ifdef CONFIG_COMPAT
454 if (is_compat_task())
455 {
456 struct compat_iw_point *p_compat_priv_data;
457
458 // Compat task: typecast to campat structure and copy the members.
459 p_compat_priv_data = (struct compat_iw_point *) &wrqu->data;
460
461 p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer);
462 p_priv_data->length = p_compat_priv_data->length;
463 p_priv_data->flags = p_compat_priv_data->flags;
464 }//if(is_compat_task())
465 else
466 {
467#endif //#ifdef CONFIG_COMPAT
468
469 // Non compat task: directly copy the structure.
470 memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point));
471
472#ifdef CONFIG_COMPAT
473 }//else of - if(is_compat_task())
474#endif //#ifdef CONFIG_COMPAT
475
476 return 0;
477}
478
Arif Hussain0273cba2014-01-07 20:58:29 -0800479/**---------------------------------------------------------------------------
480
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 \brief hdd_wlan_get_version() -
482
Jeff Johnson4824d4c2013-02-12 14:23:57 -0800483 This function use to get Wlan Driver, Firmware, & Hardware Version.
Jeff Johnson295189b2012-06-20 16:38:30 -0700484
485 \param - pAdapter Pointer to the adapter.
486 wrqu - Pointer to IOCTL REQUEST Data.
487 extra - Pointer to char
488
Jeff Johnson4824d4c2013-02-12 14:23:57 -0800489 \return - none
Jeff Johnson295189b2012-06-20 16:38:30 -0700490
491 --------------------------------------------------------------------------*/
Jeff Johnson4824d4c2013-02-12 14:23:57 -0800492void hdd_wlan_get_version(hdd_adapter_t *pAdapter, union iwreq_data *wrqu,
493 char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -0700494{
495 VOS_STATUS status;
Jeff Johnson4824d4c2013-02-12 14:23:57 -0800496 tSirVersionString wcnss_SW_version;
497 tSirVersionString wcnss_HW_version;
498 char *pSWversion;
499 char *pHWversion;
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -0700501
Jeff Johnson4824d4c2013-02-12 14:23:57 -0800502 status = sme_GetWcnssSoftwareVersion(hHal, wcnss_SW_version,
503 sizeof(wcnss_SW_version));
504 if (VOS_IS_STATUS_SUCCESS(status))
505 {
506 pSWversion = wcnss_SW_version;
507 }
508 else
509 {
510 pSWversion = "Unknown";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 }
512
Jeff Johnson4824d4c2013-02-12 14:23:57 -0800513 status = sme_GetWcnssHardwareVersion(hHal, wcnss_HW_version,
514 sizeof(wcnss_HW_version));
515 if (VOS_IS_STATUS_SUCCESS(status))
516 {
517 pHWversion = wcnss_HW_version;
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 }
Jeff Johnson4824d4c2013-02-12 14:23:57 -0800519 else
520 {
521 pHWversion = "Unknown";
522 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700523
Sameer Thalappilb0a30232013-09-27 15:37:48 -0700524 wrqu->data.length = scnprintf(extra, WE_MAX_STR_LEN,
Jeff Johnson4824d4c2013-02-12 14:23:57 -0800525 "Host SW:%s, FW:%s, HW:%s",
526 QWLAN_VERSIONSTR,
527 pSWversion,
528 pHWversion);
529
530 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700531}
532
Jeff Johnson295189b2012-06-20 16:38:30 -0700533int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu)
534{
535 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
536 v_U32_t threshold = 0,status = 0;
537
538 ENTER();
539
Agarwal Ashish971c2882013-10-30 20:11:12 +0530540 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
541 {
542 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 "%s:LOGP in Progress. Ignore!!!",__func__);
544 return status;
545 }
546
547 if ( eHAL_STATUS_SUCCESS !=
548 ccmCfgGetInt(hHal, WNI_CFG_RTS_THRESHOLD, &threshold) )
549 {
c_hpothub8245442013-11-20 23:41:09 +0530550 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
551 FL("failed to get ini parameter, WNI_CFG_RTS_THRESHOLD"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 return -EIO;
553 }
554 wrqu->rts.value = threshold;
555
556 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Arif Hussain6d2a3322013-11-17 19:50:10 -0800557 ("Rts-Threshold=%d!!"), wrqu->rts.value);
Jeff Johnson295189b2012-06-20 16:38:30 -0700558
559 EXIT();
560
561 return 0;
562}
563
564int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu)
565{
566 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
567 v_U32_t threshold = 0,status = 0;
568
569 ENTER();
570
Agarwal Ashish971c2882013-10-30 20:11:12 +0530571 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
572 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
574 "%s:LOGP in Progress. Ignore!!!",__func__);
575 return status;
576 }
577
578 if ( ccmCfgGetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold)
579 != eHAL_STATUS_SUCCESS )
580 {
c_hpothub8245442013-11-20 23:41:09 +0530581 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
582 FL("failed to get ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 return -EIO;
584 }
585 wrqu->frag.value = threshold;
586
587 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Arif Hussain6d2a3322013-11-17 19:50:10 -0800588 ("Frag-Threshold=%d!!"), wrqu->frag.value);
Jeff Johnson295189b2012-06-20 16:38:30 -0700589
590 EXIT();
591
592 return 0;
593}
594
595int hdd_wlan_get_freq(v_U32_t channel, v_U32_t *pfreq)
596{
Jeff Johnsone7245742012-09-05 17:12:55 -0700597 int i;
598 if (channel > 0)
599 {
600 for (i=0; i < FREQ_CHAN_MAP_TABLE_SIZE; i++)
601 {
602 if (channel == freq_chan_map[i].chan)
603 {
604 *pfreq = freq_chan_map[i].freq;
605 return 1;
606 }
607 }
608 }
609 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Arif Hussain6d2a3322013-11-17 19:50:10 -0800610 ("Invalid channel no=%d!!"), channel);
Jeff Johnsone7245742012-09-05 17:12:55 -0700611 return -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700612}
613
614static v_BOOL_t
615hdd_IsAuthTypeRSN( tHalHandle halHandle, eCsrAuthType authType)
616{
617 v_BOOL_t rsnType = VOS_FALSE;
618 // is the authType supported?
619 switch (authType)
620 {
621 case eCSR_AUTH_TYPE_NONE: //never used
622 rsnType = eANI_BOOLEAN_FALSE;
623 break;
624 // MAC layer authentication types
625 case eCSR_AUTH_TYPE_OPEN_SYSTEM:
626 rsnType = eANI_BOOLEAN_FALSE;
627 break;
628 case eCSR_AUTH_TYPE_SHARED_KEY:
629 rsnType = eANI_BOOLEAN_FALSE;
630 break;
631 case eCSR_AUTH_TYPE_AUTOSWITCH:
632 rsnType = eANI_BOOLEAN_FALSE;
633 break;
634
635 // Upper layer authentication types
636 case eCSR_AUTH_TYPE_WPA:
637 rsnType = eANI_BOOLEAN_TRUE;
638 break;
639 case eCSR_AUTH_TYPE_WPA_PSK:
640 rsnType = eANI_BOOLEAN_TRUE;
641 break;
642 case eCSR_AUTH_TYPE_WPA_NONE:
643 rsnType = eANI_BOOLEAN_TRUE;
644 break;
645#ifdef WLAN_FEATURE_VOWIFI_11R
646 case eCSR_AUTH_TYPE_FT_RSN:
647#endif
648 case eCSR_AUTH_TYPE_RSN:
649 rsnType = eANI_BOOLEAN_TRUE;
650 break;
651#ifdef WLAN_FEATURE_VOWIFI_11R
652 case eCSR_AUTH_TYPE_FT_RSN_PSK:
653#endif
654 case eCSR_AUTH_TYPE_RSN_PSK:
Chet Lanctot186b5732013-03-18 10:26:30 -0700655#ifdef WLAN_FEATURE_11W
656 case eCSR_AUTH_TYPE_RSN_PSK_SHA256:
Abhishek Singhae408032014-09-25 17:22:04 +0530657 case eCSR_AUTH_TYPE_RSN_8021X_SHA256:
Chet Lanctot186b5732013-03-18 10:26:30 -0700658#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 rsnType = eANI_BOOLEAN_TRUE;
660 break;
661 //case eCSR_AUTH_TYPE_FAILED:
662 case eCSR_AUTH_TYPE_UNKNOWN:
663 rsnType = eANI_BOOLEAN_FALSE;
664 break;
665 default:
Arif Hussain6d2a3322013-11-17 19:50:10 -0800666 hddLog(LOGE, FL("%s called with unknown authType - default to Open, None"),
667 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 rsnType = eANI_BOOLEAN_FALSE;
669 break;
670 }
Arif Hussain6d2a3322013-11-17 19:50:10 -0800671 hddLog(LOGE, FL("%s called with authType: %d, returned: %d"),
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700672 __func__, authType, rsnType);
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 return rsnType;
674}
675
676static void hdd_GetRssiCB( v_S7_t rssi, tANI_U32 staId, void *pContext )
677{
678 struct statsContext *pStatsContext;
679 hdd_adapter_t *pAdapter;
680
681 if (ioctl_debug)
682 {
683 pr_info("%s: rssi [%d] STA [%d] pContext [%p]\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700684 __func__, (int)rssi, (int)staId, pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 }
686
687 if (NULL == pContext)
688 {
689 hddLog(VOS_TRACE_LEVEL_ERROR,
690 "%s: Bad param, pContext [%p]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700691 __func__, pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 return;
693 }
694
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 pStatsContext = pContext;
696 pAdapter = pStatsContext->pAdapter;
Jeff Johnson72a40512013-12-19 10:14:15 -0800697
698 /* there is a race condition that exists between this callback
699 function and the caller since the caller could time out either
700 before or while this code is executing. we use a spinlock to
701 serialize these actions */
702 spin_lock(&hdd_context_lock);
703
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 if ((NULL == pAdapter) || (RSSI_CONTEXT_MAGIC != pStatsContext->magic))
705 {
706 /* the caller presumably timed out so there is nothing we can do */
Jeff Johnson72a40512013-12-19 10:14:15 -0800707 spin_unlock(&hdd_context_lock);
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 hddLog(VOS_TRACE_LEVEL_WARN,
709 "%s: Invalid context, pAdapter [%p] magic [%08x]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700710 __func__, pAdapter, pStatsContext->magic);
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 if (ioctl_debug)
712 {
713 pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700714 __func__, pAdapter, pStatsContext->magic);
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 }
716 return;
717 }
718
Jeff Johnson72a40512013-12-19 10:14:15 -0800719 /* context is valid so caller is still waiting */
720
721 /* paranoia: invalidate the magic */
722 pStatsContext->magic = 0;
723
724 /* copy over the rssi */
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 pAdapter->rssi = rssi;
726
Jeff Johnson72a40512013-12-19 10:14:15 -0800727 /* notify the caller */
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 complete(&pStatsContext->completion);
Jeff Johnson72a40512013-12-19 10:14:15 -0800729
730 /* serialization is complete */
731 spin_unlock(&hdd_context_lock);
Jeff Johnson295189b2012-06-20 16:38:30 -0700732}
733
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530734static void hdd_GetSnrCB(tANI_S8 snr, tANI_U32 staId, void *pContext)
735{
736 struct statsContext *pStatsContext;
737 hdd_adapter_t *pAdapter;
738
739 if (ioctl_debug)
740 {
741 pr_info("%s: snr [%d] STA [%d] pContext [%p]\n",
742 __func__, (int)snr, (int)staId, pContext);
743 }
744
745 if (NULL == pContext)
746 {
747 hddLog(VOS_TRACE_LEVEL_ERROR,
748 "%s: Bad param, pContext [%p]",
749 __func__, pContext);
750 return;
751 }
752
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530753 pStatsContext = pContext;
754 pAdapter = pStatsContext->pAdapter;
Jeff Johnson72a40512013-12-19 10:14:15 -0800755
756 /* there is a race condition that exists between this callback
757 function and the caller since the caller could time out either
758 before or while this code is executing. we use a spinlock to
759 serialize these actions */
760 spin_lock(&hdd_context_lock);
761
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530762 if ((NULL == pAdapter) || (SNR_CONTEXT_MAGIC != pStatsContext->magic))
763 {
764 /* the caller presumably timed out so there is nothing we can do */
Jeff Johnson72a40512013-12-19 10:14:15 -0800765 spin_unlock(&hdd_context_lock);
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530766 hddLog(VOS_TRACE_LEVEL_WARN,
767 "%s: Invalid context, pAdapter [%p] magic [%08x]",
768 __func__, pAdapter, pStatsContext->magic);
769 if (ioctl_debug)
770 {
771 pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n",
772 __func__, pAdapter, pStatsContext->magic);
773 }
774 return;
775 }
776
Jeff Johnson72a40512013-12-19 10:14:15 -0800777 /* context is valid so caller is still waiting */
778
779 /* paranoia: invalidate the magic */
780 pStatsContext->magic = 0;
781
782 /* copy over the snr */
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530783 pAdapter->snr = snr;
784
Jeff Johnson72a40512013-12-19 10:14:15 -0800785 /* notify the caller */
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530786 complete(&pStatsContext->completion);
Jeff Johnson72a40512013-12-19 10:14:15 -0800787
788 /* serialization is complete */
789 spin_unlock(&hdd_context_lock);
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530790}
791
Jeff Johnson295189b2012-06-20 16:38:30 -0700792VOS_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value)
793{
794 struct statsContext context;
795 hdd_context_t *pHddCtx;
796 hdd_station_ctx_t *pHddStaCtx;
797 eHalStatus hstatus;
798 long lrc;
799
800 if (NULL == pAdapter)
801 {
802 hddLog(VOS_TRACE_LEVEL_WARN,
803 "%s: Invalid context, pAdapter", __func__);
804 return VOS_STATUS_E_FAULT;
805 }
806 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
807 {
808 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__);
809 /* return a cached value */
810 *rssi_value = pAdapter->rssi;
811 return VOS_STATUS_SUCCESS;
812 }
813
814 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
815 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
816
817 init_completion(&context.completion);
818 context.pAdapter = pAdapter;
819 context.magic = RSSI_CONTEXT_MAGIC;
820
821 hstatus = sme_GetRssi(pHddCtx->hHal, hdd_GetRssiCB,
822 pHddStaCtx->conn_info.staId[ 0 ],
823 pHddStaCtx->conn_info.bssId,
824 &context, pHddCtx->pvosContext);
825 if (eHAL_STATUS_SUCCESS != hstatus)
826 {
827 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700828 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 /* we'll returned a cached value below */
830 }
831 else
832 {
833 /* request was sent -- wait for the response */
834 lrc = wait_for_completion_interruptible_timeout(&context.completion,
835 msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 if (lrc <= 0)
837 {
Jeff Johnson72a40512013-12-19 10:14:15 -0800838 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: SME %s while retrieving RSSI",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700839 __func__, (0 == lrc) ? "timeout" : "interrupt");
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 /* we'll now returned a cached value below */
841 }
842 }
Jeff Johnson72a40512013-12-19 10:14:15 -0800843
844 /* either we never sent a request, we sent a request and received a
845 response or we sent a request and timed out. if we never sent a
846 request or if we sent a request and got a response, we want to
847 clear the magic out of paranoia. if we timed out there is a
848 race condition such that the callback function could be
849 executing at the same time we are. of primary concern is if the
850 callback function had already verified the "magic" but had not
851 yet set the completion variable when a timeout occurred. we
852 serialize these activities by invalidating the magic while
853 holding a shared spinlock which will cause us to block if the
854 callback is currently executing */
855 spin_lock(&hdd_context_lock);
856 context.magic = 0;
857 spin_unlock(&hdd_context_lock);
858
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 *rssi_value = pAdapter->rssi;
860
861 return VOS_STATUS_SUCCESS;
862}
863
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530864VOS_STATUS wlan_hdd_get_snr(hdd_adapter_t *pAdapter, v_S7_t *snr)
865{
866 struct statsContext context;
867 hdd_context_t *pHddCtx;
868 hdd_station_ctx_t *pHddStaCtx;
869 eHalStatus hstatus;
870 long lrc;
871 int valid;
872
873 if (NULL == pAdapter)
874 {
875 hddLog(VOS_TRACE_LEVEL_ERROR,
876 "%s: Invalid context, pAdapter", __func__);
877 return VOS_STATUS_E_FAULT;
878 }
879
880 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
881
882 valid = wlan_hdd_validate_context(pHddCtx);
883 if (0 != valid)
884 {
885 hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid"));
886 return VOS_STATUS_E_FAULT;
887 }
888
889 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
890 if (NULL == pHddStaCtx)
891 {
892 hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is not valid"));
893 return VOS_STATUS_E_FAULT;
894 }
895
896 init_completion(&context.completion);
897 context.pAdapter = pAdapter;
898 context.magic = SNR_CONTEXT_MAGIC;
899
900 hstatus = sme_GetSnr(pHddCtx->hHal, hdd_GetSnrCB,
901 pHddStaCtx->conn_info.staId[ 0 ],
902 pHddStaCtx->conn_info.bssId,
903 &context);
904 if (eHAL_STATUS_SUCCESS != hstatus)
905 {
906 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI",
907 __func__);
908 /* we'll returned a cached value below */
909 }
910 else
911 {
912 /* request was sent -- wait for the response */
913 lrc = wait_for_completion_interruptible_timeout(&context.completion,
914 msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530915 if (lrc <= 0)
916 {
Jeff Johnson72a40512013-12-19 10:14:15 -0800917 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: SME %s while retrieving SNR",
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530918 __func__, (0 == lrc) ? "timeout" : "interrupt");
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530919 /* we'll now returned a cached value below */
920 }
921 }
Jeff Johnson72a40512013-12-19 10:14:15 -0800922
923 /* either we never sent a request, we sent a request and received a
924 response or we sent a request and timed out. if we never sent a
925 request or if we sent a request and got a response, we want to
926 clear the magic out of paranoia. if we timed out there is a
927 race condition such that the callback function could be
928 executing at the same time we are. of primary concern is if the
929 callback function had already verified the "magic" but had not
930 yet set the completion variable when a timeout occurred. we
931 serialize these activities by invalidating the magic while
932 holding a shared spinlock which will cause us to block if the
933 callback is currently executing */
934 spin_lock(&hdd_context_lock);
935 context.magic = 0;
936 spin_unlock(&hdd_context_lock);
937
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +0530938 *snr = pAdapter->snr;
939
940 return VOS_STATUS_SUCCESS;
941}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800942#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800943
944static void hdd_GetRoamRssiCB( v_S7_t rssi, tANI_U32 staId, void *pContext )
945{
946 struct statsContext *pStatsContext;
947 hdd_adapter_t *pAdapter;
948 if (ioctl_debug)
949 {
950 pr_info("%s: rssi [%d] STA [%d] pContext [%p]\n",
951 __func__, (int)rssi, (int)staId, pContext);
952 }
953
954 if (NULL == pContext)
955 {
956 hddLog(VOS_TRACE_LEVEL_ERROR,
957 "%s: Bad param, pContext [%p]",
958 __func__, pContext);
959 return;
960 }
961
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800962 pStatsContext = pContext;
963 pAdapter = pStatsContext->pAdapter;
Jeff Johnson72a40512013-12-19 10:14:15 -0800964
965 /* there is a race condition that exists between this callback
966 function and the caller since the caller could time out either
967 before or while this code is executing. we use a spinlock to
968 serialize these actions */
969 spin_lock(&hdd_context_lock);
970
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800971 if ((NULL == pAdapter) || (RSSI_CONTEXT_MAGIC != pStatsContext->magic))
972 {
973 /* the caller presumably timed out so there is nothing we can do */
Jeff Johnson72a40512013-12-19 10:14:15 -0800974 spin_unlock(&hdd_context_lock);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800975 hddLog(VOS_TRACE_LEVEL_WARN,
976 "%s: Invalid context, pAdapter [%p] magic [%08x]",
977 __func__, pAdapter, pStatsContext->magic);
978 if (ioctl_debug)
979 {
980 pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n",
981 __func__, pAdapter, pStatsContext->magic);
982 }
983 return;
984 }
985
Jeff Johnson72a40512013-12-19 10:14:15 -0800986 /* context is valid so caller is still waiting */
987
988 /* paranoia: invalidate the magic */
989 pStatsContext->magic = 0;
990
991 /* copy over the rssi */
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800992 pAdapter->rssi = rssi;
993
Jeff Johnson72a40512013-12-19 10:14:15 -0800994 /* notify the caller */
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800995 complete(&pStatsContext->completion);
Jeff Johnson72a40512013-12-19 10:14:15 -0800996
997 /* serialization is complete */
998 spin_unlock(&hdd_context_lock);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800999}
1000
1001
1002
1003VOS_STATUS wlan_hdd_get_roam_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value)
1004{
1005 struct statsContext context;
1006 hdd_context_t *pHddCtx = NULL;
1007 hdd_station_ctx_t *pHddStaCtx = NULL;
1008 eHalStatus hstatus;
1009 long lrc;
1010
1011 if (NULL == pAdapter)
1012 {
1013 hddLog(VOS_TRACE_LEVEL_WARN,
1014 "%s: Invalid context, pAdapter", __func__);
1015 return VOS_STATUS_E_FAULT;
1016 }
1017 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
1018 {
1019 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__);
1020 /* return a cached value */
1021 *rssi_value = pAdapter->rssi;
1022 return VOS_STATUS_SUCCESS;
1023 }
1024
1025 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
1026 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1027
Kanchanapally, Vidyullathad883c652014-05-09 21:17:04 +05301028 if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08001029 {
1030 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:Not associated!",__func__);
1031 /* return a cached value */
1032 *rssi_value = 0;
1033 return VOS_STATUS_SUCCESS;
1034 }
Kanchanapally, Vidyullathad883c652014-05-09 21:17:04 +05301035
1036 if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario)
1037 {
1038 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
1039 "%s: Roaming in progress, hence return last cached RSSI", __func__);
1040 *rssi_value = pAdapter->rssi;
1041 return VOS_STATUS_SUCCESS;
1042 }
1043
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08001044 init_completion(&context.completion);
1045 context.pAdapter = pAdapter;
1046 context.magic = RSSI_CONTEXT_MAGIC;
1047
1048 hstatus = sme_GetRoamRssi(pHddCtx->hHal, hdd_GetRoamRssiCB,
1049 pHddStaCtx->conn_info.staId[ 0 ],
1050 pHddStaCtx->conn_info.bssId,
1051 &context, pHddCtx->pvosContext);
1052 if (eHAL_STATUS_SUCCESS != hstatus)
1053 {
1054 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI",
1055 __func__);
1056 /* we'll returned a cached value below */
1057 }
1058 else
1059 {
1060 /* request was sent -- wait for the response */
1061 lrc = wait_for_completion_interruptible_timeout(&context.completion,
1062 msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08001063 if (lrc <= 0)
1064 {
Jeff Johnson72a40512013-12-19 10:14:15 -08001065 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while retrieving RSSI",
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08001066 __func__, (0 == lrc) ? "timeout" : "interrupt");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08001067 /* we'll now returned a cached value below */
1068 }
1069 }
Jeff Johnson72a40512013-12-19 10:14:15 -08001070
1071 /* either we never sent a request, we sent a request and received a
1072 response or we sent a request and timed out. if we never sent a
1073 request or if we sent a request and got a response, we want to
1074 clear the magic out of paranoia. if we timed out there is a
1075 race condition such that the callback function could be
1076 executing at the same time we are. of primary concern is if the
1077 callback function had already verified the "magic" but had not
1078 yet set the completion variable when a timeout occurred. we
1079 serialize these activities by invalidating the magic while
1080 holding a shared spinlock which will cause us to block if the
1081 callback is currently executing */
1082 spin_lock(&hdd_context_lock);
1083 context.magic = 0;
1084 spin_unlock(&hdd_context_lock);
1085
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08001086 *rssi_value = pAdapter->rssi;
1087
1088 return VOS_STATUS_SUCCESS;
1089}
1090#endif
1091
1092
Jeff Johnson295189b2012-06-20 16:38:30 -07001093void hdd_StatisticsCB( void *pStats, void *pContext )
1094{
1095 hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext;
1096 hdd_stats_t *pStatsCache = NULL;
1097 hdd_wext_state_t *pWextState;
1098 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
1099
1100 tCsrSummaryStatsInfo *pSummaryStats = NULL;
1101 tCsrGlobalClassAStatsInfo *pClassAStats = NULL;
1102 tCsrGlobalClassBStatsInfo *pClassBStats = NULL;
1103 tCsrGlobalClassCStatsInfo *pClassCStats = NULL;
1104 tCsrGlobalClassDStatsInfo *pClassDStats = NULL;
1105 tCsrPerStaStatsInfo *pPerStaStats = NULL;
1106
1107 if (pAdapter!= NULL)
1108 pStatsCache = &pAdapter->hdd_stats;
1109
1110
1111 pSummaryStats = (tCsrSummaryStatsInfo *)pStats;
1112 pClassAStats = (tCsrGlobalClassAStatsInfo *)( pSummaryStats + 1 );
1113 pClassBStats = (tCsrGlobalClassBStatsInfo *)( pClassAStats + 1 );
1114 pClassCStats = (tCsrGlobalClassCStatsInfo *)( pClassBStats + 1 );
1115 pClassDStats = (tCsrGlobalClassDStatsInfo *)( pClassCStats + 1 );
1116 pPerStaStats = (tCsrPerStaStatsInfo *)( pClassDStats + 1 );
1117
1118 if (pStatsCache!=NULL)
1119 {
1120 // and copy the stats into the cache we keep in the adapter instance structure
1121 vos_mem_copy( &pStatsCache->summary_stat, pSummaryStats, sizeof( pStatsCache->summary_stat ) );
1122 vos_mem_copy( &pStatsCache->ClassA_stat, pClassAStats, sizeof( pStatsCache->ClassA_stat ) );
1123 vos_mem_copy( &pStatsCache->ClassB_stat, pClassBStats, sizeof( pStatsCache->ClassB_stat ) );
1124 vos_mem_copy( &pStatsCache->ClassC_stat, pClassCStats, sizeof( pStatsCache->ClassC_stat ) );
1125 vos_mem_copy( &pStatsCache->ClassD_stat, pClassDStats, sizeof( pStatsCache->ClassD_stat ) );
1126 vos_mem_copy( &pStatsCache->perStaStats, pPerStaStats, sizeof( pStatsCache->perStaStats ) );
1127 }
1128
1129 if(pAdapter)
1130 {
1131 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
1132 if(pWextState)
1133 {
1134 vos_status = vos_event_set(&pWextState->vosevent);
1135 if (!VOS_IS_STATUS_SUCCESS(vos_status))
1136 {
1137 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001138 "%s: vos_event_set failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001139 return;
1140 }
1141 }
1142 }
1143}
1144
1145void ccmCfgSetCallback(tHalHandle halHandle, tANI_S32 result)
1146{
1147 v_CONTEXT_t pVosContext;
1148 hdd_context_t *pHddCtx;
1149 VOS_STATUS hdd_reconnect_all_adapters( hdd_context_t *pHddCtx );
1150#if 0
1151 hdd_wext_state_t *pWextState;
1152 v_U32_t roamId;
1153#endif
1154
1155 ENTER();
1156
1157 pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL);
1158
1159 pHddCtx = (hdd_context_t*) vos_get_context(VOS_MODULE_ID_HDD,pVosContext);
1160 if (NULL == pHddCtx)
1161 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001162 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid pHddCtx", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001163 return;
1164 }
1165#if 0
1166 pWextState = pAdapter->pWextState;
1167#endif
1168
1169 if (WNI_CFG_NEED_RESTART == result || WNI_CFG_NEED_RELOAD == result)
1170 {
1171 //TODO Verify is this is really used. If yes need to fix it.
1172 hdd_reconnect_all_adapters( pHddCtx );
1173#if 0
1174 pAdapter->conn_info.connState = eConnectionState_NotConnected;
1175 INIT_COMPLETION(pAdapter->disconnect_comp_var);
1176 vosStatus = sme_RoamDisconnect(halHandle, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
1177
1178 if(VOS_STATUS_SUCCESS == vosStatus)
1179 wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var,
1180 msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
1181
1182 sme_RoamConnect(halHandle,
1183 pAdapter->sessionId, &(pWextState->roamProfile),
1184 &roamId);
1185#endif
1186 }
1187
1188 EXIT();
1189
1190}
1191
1192void hdd_clearRoamProfileIe( hdd_adapter_t *pAdapter)
1193{
Jeff Johnson295189b2012-06-20 16:38:30 -07001194 hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
1195
1196 /* clear WPA/RSN/WSC IE information in the profile */
1197 pWextState->roamProfile.nWPAReqIELength = 0;
1198 pWextState->roamProfile.pWPAReqIE = (tANI_U8 *)NULL;
1199 pWextState->roamProfile.nRSNReqIELength = 0;
1200 pWextState->roamProfile.pRSNReqIE = (tANI_U8 *)NULL;
1201
Chet Lanctot186b5732013-03-18 10:26:30 -07001202#ifdef FEATURE_WLAN_WAPI
1203 pWextState->roamProfile.nWAPIReqIELength = 0;
1204 pWextState->roamProfile.pWAPIReqIE = (tANI_U8 *)NULL;
1205#endif
1206
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 pWextState->roamProfile.bWPSAssociation = VOS_FALSE;
Leela Venkata Kiran Kumar Reddy Chiralaf257bef2014-04-11 18:48:12 -07001208 pWextState->roamProfile.bOSENAssociation = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001209 pWextState->roamProfile.nAddIEScanLength = 0;
Agarwal Ashish4f616132013-12-30 23:32:50 +05301210 memset(pWextState->roamProfile.addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH+2);
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 pWextState->roamProfile.pAddIEAssoc = (tANI_U8 *)NULL;
1212 pWextState->roamProfile.nAddIEAssocLength = 0;
1213
1214 pWextState->roamProfile.EncryptionType.numEntries = 1;
1215 pWextState->roamProfile.EncryptionType.encryptionType[0]
1216 = eCSR_ENCRYPT_TYPE_NONE;
1217
1218 pWextState->roamProfile.mcEncryptionType.numEntries = 1;
1219 pWextState->roamProfile.mcEncryptionType.encryptionType[0]
1220 = eCSR_ENCRYPT_TYPE_NONE;
1221
1222 pWextState->roamProfile.AuthType.numEntries = 1;
1223 pWextState->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
1224
Chet Lanctot186b5732013-03-18 10:26:30 -07001225#ifdef WLAN_FEATURE_11W
1226 pWextState->roamProfile.MFPEnabled = eANI_BOOLEAN_FALSE;
1227 pWextState->roamProfile.MFPRequired = 0;
1228 pWextState->roamProfile.MFPCapable = 0;
1229#endif
1230
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 pWextState->authKeyMgmt = 0;
1232
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05301233 vos_mem_zero(&pWextState->roamProfile.Keys,
1234 sizeof(pWextState->roamProfile.Keys));
1235
Jeff Johnson295189b2012-06-20 16:38:30 -07001236#ifdef FEATURE_WLAN_WAPI
1237 pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_OPEN;
1238 pAdapter->wapi_info.nWapiMode = 0;
1239#endif
1240
1241 vos_mem_zero((void *)(pWextState->req_bssId), WNI_CFG_BSSID_LEN);
1242
1243}
1244
1245void wlan_hdd_ula_done_cb(v_VOID_t *callbackContext)
1246{
1247 hdd_adapter_t *pAdapter = (hdd_adapter_t*)callbackContext;
Jeff Johnson295189b2012-06-20 16:38:30 -07001248
Jeff Johnson9efb9aa2013-03-15 13:59:27 -07001249 if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
1250 {
1251 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1252 "%s: Invalid pAdapter magic", __func__);
1253 }
1254 else
1255 {
1256 complete(&pAdapter->ula_complete);
1257 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001258}
1259
1260VOS_STATUS wlan_hdd_check_ula_done(hdd_adapter_t *pAdapter)
1261{
1262 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 VOS_STATUS vos_status;
Jeff Johnson9efb9aa2013-03-15 13:59:27 -07001264 unsigned long rc;
Jeff Johnson295189b2012-06-20 16:38:30 -07001265
1266 if (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)
1267 {
Jeff Johnson9efb9aa2013-03-15 13:59:27 -07001268 INIT_COMPLETION(pAdapter->ula_complete);
Jeff Johnson295189b2012-06-20 16:38:30 -07001269
1270 /*To avoid race condition between the set key and the last EAPOL
1271 packet, notify TL to finish upper layer authentication incase if the
1272 last EAPOL packet pending in the TL queue.*/
Tushnim Bhattacharyya39a8f182013-02-20 18:10:30 -08001273 vos_status = WLANTL_Finish_ULA(wlan_hdd_ula_done_cb, pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07001274
1275 if ( vos_status != VOS_STATUS_SUCCESS )
1276 {
1277 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1278 "[%4d] WLANTL_Finish_ULA returned ERROR status= %d",
1279 __LINE__, vos_status );
1280 return vos_status;
1281
1282 }
1283
Jeff Johnson9efb9aa2013-03-15 13:59:27 -07001284 rc = wait_for_completion_timeout(&pAdapter->ula_complete,
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 msecs_to_jiffies(HDD_FINISH_ULA_TIME_OUT));
c_hpothub8245442013-11-20 23:41:09 +05301286 if (rc <= 0)
Jeff Johnson9efb9aa2013-03-15 13:59:27 -07001287 {
1288 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
c_hpothub8245442013-11-20 23:41:09 +05301289 FL("failure wait on ULA to complete %ld"), rc);
Jeff Johnson9efb9aa2013-03-15 13:59:27 -07001290 /* we'll still fall through and return success since the
1291 * connection may still get established but is just taking
1292 * too long for us to wait */
1293 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001294 }
1295 return VOS_STATUS_SUCCESS;
1296}
1297
1298v_U8_t* wlan_hdd_get_vendor_oui_ie_ptr(v_U8_t *oui, v_U8_t oui_size, v_U8_t *ie, int ie_len)
1299{
1300
1301 int left = ie_len;
1302 v_U8_t *ptr = ie;
1303 v_U8_t elem_id,elem_len;
1304 v_U8_t eid = 0xDD;
1305
1306 if ( NULL == ie || 0 == ie_len )
1307 return NULL;
1308
1309 while(left >= 2)
1310 {
1311 elem_id = ptr[0];
1312 elem_len = ptr[1];
1313 left -= 2;
1314 if(elem_len > left)
1315 {
1316 hddLog(VOS_TRACE_LEVEL_FATAL,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07001317 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 eid,elem_len,left);
1319 return NULL;
1320 }
1321 if (elem_id == eid)
1322 {
1323 if(memcmp( &ptr[2], oui, oui_size)==0)
1324 return ptr;
1325 }
1326
1327 left -= elem_len;
1328 ptr += (elem_len + 2);
1329 }
1330 return NULL;
1331}
1332
1333static int iw_set_commit(struct net_device *dev, struct iw_request_info *info,
1334 union iwreq_data *wrqu, char *extra)
1335{
Arif Hussain6d2a3322013-11-17 19:50:10 -08001336 hddLog( LOG1, "In %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 /* Do nothing for now */
1338 return 0;
1339}
1340
1341static int iw_get_name(struct net_device *dev,
1342 struct iw_request_info *info,
1343 char *wrqu, char *extra)
1344{
1345
1346 ENTER();
1347 strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ);
1348 EXIT();
1349 return 0;
1350}
1351
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301352static int __iw_set_mode(struct net_device *dev,
1353 struct iw_request_info *info,
1354 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07001355{
1356 hdd_wext_state_t *pWextState;
1357 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1358 tCsrRoamProfile *pRoamProfile;
1359 eCsrRoamBssType LastBSSType;
1360 eMib_dot11DesiredBssType connectedBssType;
1361 hdd_config_t *pConfig;
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 struct wireless_dev *wdev;
Jeff Johnson295189b2012-06-20 16:38:30 -07001363
1364 ENTER();
1365
1366 if (NULL == pAdapter)
1367 {
1368 hddLog(VOS_TRACE_LEVEL_WARN,
1369 "%s: Invalid context, pAdapter", __func__);
1370 return 0;
1371 }
1372
1373 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301374 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
1375 "%s:LOGP in Progress. Ignore!!!", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 return 0;
1377 }
1378
1379 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
1380 if (pWextState == NULL)
1381 {
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301382 hddLog(LOGE, "%s ERROR: Data Storage Corruption", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001383 return -EINVAL;
1384 }
1385
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 wdev = dev->ieee80211_ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 pRoamProfile = &pWextState->roamProfile;
1388 LastBSSType = pRoamProfile->BSSType;
1389
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301390 hddLog(LOG1, "%s Old Bss type = %d", __func__, LastBSSType);
Jeff Johnson295189b2012-06-20 16:38:30 -07001391
1392 switch (wrqu->mode)
1393 {
1394 case IW_MODE_ADHOC:
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301395 hddLog(LOG1, "%s Setting AP Mode as IW_MODE_ADHOC", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS;
1397 // Set the phymode correctly for IBSS.
1398 pConfig = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini;
1399 pWextState->roamProfile.phyMode = hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode);
Shailender Karmuchia734f332013-04-19 14:02:48 -07001400 pAdapter->device_mode = WLAN_HDD_IBSS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 wdev->iftype = NL80211_IFTYPE_ADHOC;
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 break;
1403 case IW_MODE_INFRA:
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301404 hddLog(LOG1, "%s Setting AP Mode as IW_MODE_INFRA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001405 pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 wdev->iftype = NL80211_IFTYPE_STATION;
Jeff Johnson295189b2012-06-20 16:38:30 -07001407 break;
1408 case IW_MODE_AUTO:
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301409 hddLog(LOG1, "%s Setting AP Mode as IW_MODE_AUTO", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001410 pRoamProfile->BSSType = eCSR_BSS_TYPE_ANY;
1411 break;
1412 default:
Agarwal Ashish971c2882013-10-30 20:11:12 +05301413 hddLog(LOGE, "%s Unknown AP Mode value %d ", __func__, wrqu->mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 return -EOPNOTSUPP;
1415 }
1416
1417 if ( LastBSSType != pRoamProfile->BSSType )
1418 {
1419 //the BSS mode changed
1420 // We need to issue disconnect if connected or in IBSS disconnect state
1421 if ( hdd_connGetConnectedBssType( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) ||
1422 ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) )
1423 {
1424 VOS_STATUS vosStatus;
1425 // need to issue a disconnect to CSR.
1426 INIT_COMPLETION(pAdapter->disconnect_comp_var);
1427 vosStatus = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
1428 pAdapter->sessionId,
1429 eCSR_DISCONNECT_REASON_IBSS_LEAVE );
1430 if(VOS_STATUS_SUCCESS == vosStatus)
c_hpothub8245442013-11-20 23:41:09 +05301431 {
1432 long ret;
1433 ret = wait_for_completion_interruptible_timeout(
1434 &pAdapter->disconnect_comp_var,
1435 msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
1436 if (ret <= 0)
1437 hddLog(VOS_TRACE_LEVEL_ERROR,
1438 FL("failed wait on disconnect_comp_var %ld"), ret);
1439 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 }
1441 }
1442
Jeff Johnson295189b2012-06-20 16:38:30 -07001443 EXIT();
1444 return 0;
1445}
1446
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301447static int iw_set_mode(struct net_device *dev,
1448 struct iw_request_info *info,
1449 union iwreq_data *wrqu, char *extra)
1450{
1451 int ret;
Jeff Johnson295189b2012-06-20 16:38:30 -07001452
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301453 vos_ssr_protect(__func__);
1454 ret = __iw_set_mode(dev, info, wrqu, extra);
1455 vos_ssr_unprotect(__func__);
1456
1457 return ret;
1458}
1459
1460static int __iw_get_mode(struct net_device *dev,
1461 struct iw_request_info *info,
1462 union iwreq_data *wrqu,
1463 char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07001464{
1465
1466 hdd_wext_state_t *pWextState;
1467 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1468
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301469 hddLog(LOG1, "In %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001470
1471 if (NULL == pAdapter)
1472 {
1473 hddLog(VOS_TRACE_LEVEL_WARN,
1474 "%s: Invalid context, pAdapter", __func__);
1475 return 0;
1476 }
1477
1478 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301479 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
1480 "%s:LOGP in Progress. Ignore!!!", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 return 0;
1482 }
1483
1484 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
1485 if (pWextState == NULL)
1486 {
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301487 hddLog(LOGE, "%s ERROR: Data Storage Corruption", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 return -EINVAL;
1489 }
1490
1491 switch (pWextState->roamProfile.BSSType)
1492 {
1493 case eCSR_BSS_TYPE_INFRASTRUCTURE:
Arif Hussain6d2a3322013-11-17 19:50:10 -08001494 hddLog(LOG1, "%s returns IW_MODE_INFRA", __func__);
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301495 wrqu->mode = IW_MODE_INFRA;
Jeff Johnson295189b2012-06-20 16:38:30 -07001496 break;
1497 case eCSR_BSS_TYPE_IBSS:
1498 case eCSR_BSS_TYPE_START_IBSS:
Arif Hussain6d2a3322013-11-17 19:50:10 -08001499 hddLog(LOG1, "%s returns IW_MODE_ADHOC", __func__);
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301500 wrqu->mode = IW_MODE_ADHOC;
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 break;
1502 case eCSR_BSS_TYPE_ANY:
Arif Hussain6d2a3322013-11-17 19:50:10 -08001503 hddLog(LOG1, "%s returns IW_MODE_AUTO", __func__);
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301504 wrqu->mode = IW_MODE_AUTO;
Jeff Johnson295189b2012-06-20 16:38:30 -07001505 break;
1506 default:
Arif Hussain6d2a3322013-11-17 19:50:10 -08001507 hddLog(LOG1, "%s returns APMODE_UNKNOWN", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001508 break;
1509 }
Madan Mohan Koyyalamudi0c2ba1b2013-10-01 19:47:50 +05301510
Jeff Johnson295189b2012-06-20 16:38:30 -07001511 return 0;
1512}
1513
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301514static int iw_get_mode(struct net_device *dev,
1515 struct iw_request_info *info,
1516 union iwreq_data *wrqu,
1517 char *extra)
1518{
1519 int ret;
1520
1521 vos_ssr_protect(__func__);
1522 ret = __iw_get_mode(dev, info, wrqu, extra);
1523 vos_ssr_unprotect(__func__);
1524
1525 return ret;
1526}
1527
1528static int __iw_set_freq(struct net_device *dev,
1529 struct iw_request_info *info,
1530 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07001531{
1532 v_U32_t numChans = 0;
1533 v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN];
1534 v_U32_t indx = 0;
1535 v_U32_t status = 0;
1536
1537 hdd_wext_state_t *pWextState;
1538 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1539 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
1540 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1541 tCsrRoamProfile * pRoamProfile;
1542 ENTER();
1543
1544 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
1545 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
1546 return status;
1547 }
1548
1549 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
1550
1551 pRoamProfile = &pWextState->roamProfile;
1552
Arif Hussain6d2a3322013-11-17 19:50:10 -08001553 hddLog(LOG1,"setCHANNEL ioctl");
Jeff Johnson295189b2012-06-20 16:38:30 -07001554
1555 /* Link is up then return cant set channel*/
1556 if(eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState ||
1557 eConnectionState_Associated == pHddStaCtx->conn_info.connState)
1558 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08001559 hddLog( LOGE, "IBSS Associated");
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 return -EOPNOTSUPP;
1561 }
1562
1563 /* Settings by Frequency as input */
1564 if((wrqu->freq.e == 1) && (wrqu->freq.m >= (tANI_U32)2.412e8) &&
1565 (wrqu->freq.m <= (tANI_U32)5.825e8))
1566 {
1567 tANI_U32 freq = wrqu->freq.m / 100000;
1568
1569 while ((indx < FREQ_CHAN_MAP_TABLE_SIZE) && (freq != freq_chan_map[indx].freq))
1570 indx++;
1571 if (indx >= FREQ_CHAN_MAP_TABLE_SIZE)
1572 {
1573 return -EINVAL;
1574 }
1575 wrqu->freq.e = 0;
1576 wrqu->freq.m = freq_chan_map[indx].chan;
1577
1578 }
1579
1580 if (wrqu->freq.e == 0)
1581 {
1582 if((wrqu->freq.m < WNI_CFG_CURRENT_CHANNEL_STAMIN) ||
1583 (wrqu->freq.m > WNI_CFG_CURRENT_CHANNEL_STAMAX))
1584 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08001585 hddLog(LOG1,"%s: Channel [%d] is outside valid range from %d to %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001586 __func__, wrqu->freq.m, WNI_CFG_CURRENT_CHANNEL_STAMIN,
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 WNI_CFG_CURRENT_CHANNEL_STAMAX);
1588 return -EINVAL;
1589 }
1590
1591 numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1592
1593 if (ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST,
1594 validChan, &numChans) != eHAL_STATUS_SUCCESS){
c_hpothub8245442013-11-20 23:41:09 +05301595 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
1596 FL("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001597 return -EIO;
1598 }
1599
1600 for (indx = 0; indx < numChans; indx++) {
1601 if (wrqu->freq.m == validChan[indx]){
1602 break;
1603 }
1604 }
1605 }
1606 else{
1607
1608 return -EINVAL;
1609 }
1610
1611 if(indx >= numChans)
1612 {
1613 return -EINVAL;
1614 }
1615
1616 /* Set the Operational Channel */
1617 numChans = pRoamProfile->ChannelInfo.numOfChannels = 1;
1618 pHddStaCtx->conn_info.operationChannel = wrqu->freq.m;
1619 pRoamProfile->ChannelInfo.ChannelList = &pHddStaCtx->conn_info.operationChannel;
1620
Arif Hussain6d2a3322013-11-17 19:50:10 -08001621 hddLog(LOG1,"pRoamProfile->operationChannel = %d", wrqu->freq.m);
Jeff Johnson295189b2012-06-20 16:38:30 -07001622
1623 EXIT();
1624
1625 return status;
1626}
1627
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301628static int iw_set_freq(struct net_device *dev,
1629 struct iw_request_info *info,
1630 union iwreq_data *wrqu, char *extra)
1631{
1632 int ret;
1633
1634 vos_ssr_protect(__func__);
1635 ret = __iw_set_freq(dev, info, wrqu, extra);
1636 vos_ssr_unprotect(__func__);
1637
1638 return ret;
1639}
1640
1641static int __iw_get_freq(struct net_device *dev,
1642 struct iw_request_info *info,
1643 struct iw_freq *fwrq, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07001644{
Jeff Johnsone7245742012-09-05 17:12:55 -07001645 v_U32_t status = FALSE, channel = 0, freq = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1647 tHalHandle hHal;
1648 hdd_wext_state_t *pWextState;
1649 tCsrRoamProfile * pRoamProfile;
1650 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1651
1652 ENTER();
1653
1654 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
1655 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
1656 return status;
1657 }
1658
1659 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
1660 hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
1661
1662 pRoamProfile = &pWextState->roamProfile;
1663
1664 if( pHddStaCtx->conn_info.connState== eConnectionState_Associated )
1665 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001666 if (sme_GetOperationChannel(hHal, &channel, pAdapter->sessionId) != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001667 {
c_hpothub8245442013-11-20 23:41:09 +05301668 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1669 FL("failed to get operating channel %u"), pAdapter->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001670 return -EIO;
1671 }
1672 else
1673 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001674 status = hdd_wlan_get_freq(channel, &freq);
1675 if( TRUE == status )
1676 {
1677 /* Set Exponent parameter as 6 (MHZ) in struct iw_freq
1678 * iwlist & iwconfig command shows frequency into proper
1679 * format (2.412 GHz instead of 246.2 MHz)*/
1680 fwrq->m = freq;
1681 fwrq->e = MHZ;
1682 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 }
1684 }
1685 else
1686 {
Madan Mohan Koyyalamudi99f9c662012-10-11 17:00:31 -07001687 /* Set Exponent parameter as 6 (MHZ) in struct iw_freq
1688 * iwlist & iwconfig command shows frequency into proper
1689 * format (2.412 GHz instead of 246.2 MHz)*/
1690 fwrq->m = 0;
1691 fwrq->e = MHZ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001693 return 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001694}
1695
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301696static int iw_get_freq(struct net_device *dev,
1697 struct iw_request_info *info,
1698 struct iw_freq *fwrq, char *extra)
1699{
1700 int ret;
1701
1702 vos_ssr_protect(__func__);
1703 ret = __iw_get_freq(dev, info, fwrq, extra);
1704 vos_ssr_unprotect(__func__);
1705
1706 return ret;
1707}
1708
1709static int __iw_get_tx_power(struct net_device *dev,
1710 struct iw_request_info *info,
1711 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07001712{
1713
1714 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1715 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
1716 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1717
1718 if (pHddCtx->isLogpInProgress)
1719 {
1720 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
1721 "%s:LOGP in Progress. Ignore!!!",__func__);
1722 return -EBUSY;
1723 }
1724
1725 if(eConnectionState_Associated != pHddStaCtx->conn_info.connState)
1726 {
1727 wrqu->txpower.value = 0;
1728 return 0;
1729 }
1730 wlan_hdd_get_classAstats(pAdapter);
1731 wrqu->txpower.value = pAdapter->hdd_stats.ClassA_stat.max_pwr;
1732
1733 return 0;
1734}
1735
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301736static int iw_get_tx_power(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 struct iw_request_info *info,
1738 union iwreq_data *wrqu, char *extra)
1739{
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301740 int ret;
1741
1742 vos_ssr_protect(__func__);
1743 ret = __iw_get_tx_power(dev, info, wrqu, extra);
1744 vos_ssr_unprotect(__func__);
1745
1746 return ret;
1747}
1748
1749static int __iw_set_tx_power(struct net_device *dev,
1750 struct iw_request_info *info,
1751 union iwreq_data *wrqu, char *extra)
1752{
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1754 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
1755
1756 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
1757 {
1758 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
1759 return 0;
1760 }
1761
1762 ENTER();
1763
1764 if ( ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, wrqu->txpower.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
1765 {
c_hpothub8245442013-11-20 23:41:09 +05301766 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1767 FL("failed to set ini parameter, WNI_CFG_CURRENT_TX_POWER_LEVEL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 return -EIO;
1769 }
1770
1771 EXIT();
1772
1773 return 0;
1774}
1775
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301776static int iw_set_tx_power(struct net_device *dev,
1777 struct iw_request_info *info,
1778 union iwreq_data *wrqu, char *extra)
1779{
1780 int ret;
1781
1782 vos_ssr_protect(__func__);
1783 ret = __iw_set_tx_power(dev, info, wrqu, extra);
1784 vos_ssr_unprotect(__func__);
1785
1786 return ret;
1787}
1788
1789static int __iw_get_bitrate(struct net_device *dev,
1790 struct iw_request_info *info,
1791 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07001792{
1793 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
1794 eHalStatus status = eHAL_STATUS_SUCCESS;
1795 hdd_wext_state_t *pWextState;
1796 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1797 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1798
1799 ENTER();
1800
1801 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
1802 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
1803 return status;
1804 }
1805
1806 if(eConnectionState_Associated != pHddStaCtx->conn_info.connState) {
1807 wrqu->bitrate.value = 0;
1808 }
1809 else {
1810 status = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), eCSR_HDD,
1811 SME_SUMMARY_STATS |
1812 SME_GLOBAL_CLASSA_STATS |
1813 SME_GLOBAL_CLASSB_STATS |
1814 SME_GLOBAL_CLASSC_STATS |
1815 SME_GLOBAL_CLASSD_STATS |
1816 SME_PER_STA_STATS,
1817 hdd_StatisticsCB, 0, FALSE,
1818 pHddStaCtx->conn_info.staId[0], pAdapter );
1819
1820 if(eHAL_STATUS_SUCCESS != status)
1821 {
1822 hddLog(VOS_TRACE_LEVEL_ERROR,
1823 "%s: Unable to retrieve statistics",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001824 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001825 return status;
1826 }
1827
1828 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
1829
1830 vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS);
1831
1832 if (!VOS_IS_STATUS_SUCCESS(vos_status))
1833 {
1834 hddLog(VOS_TRACE_LEVEL_ERROR,
1835 "%s: SME timeout while retrieving statistics",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001836 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 return VOS_STATUS_E_FAILURE;
1838 }
1839
1840 wrqu->bitrate.value = pAdapter->hdd_stats.ClassA_stat.tx_rate*500*1000;
1841 }
1842
1843 EXIT();
1844
1845 return vos_status;
1846}
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301847
1848static int iw_get_bitrate(struct net_device *dev,
1849 struct iw_request_info *info,
1850 union iwreq_data *wrqu, char *extra)
1851{
1852 int ret;
1853
1854 vos_ssr_protect(__func__);
1855 ret = __iw_get_bitrate(dev, info, wrqu, extra);
1856 vos_ssr_unprotect(__func__);
1857
1858 return ret;
1859}
1860
1861
Jeff Johnson295189b2012-06-20 16:38:30 -07001862/* ccm call back function */
1863
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301864static int __iw_set_bitrate(struct net_device *dev,
1865 struct iw_request_info *info,
1866 union iwreq_data *wrqu,
1867 char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07001868{
1869 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1870 hdd_wext_state_t *pWextState;
1871 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
1872 v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN];
1873 v_U32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1874 v_U32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1875 v_U32_t i, rate;
1876 v_U32_t valid_rate = FALSE, active_phy_mode = 0;
1877
1878 ENTER();
1879
1880 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
1881 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
1882 return 0;
1883 }
1884
1885 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
1886
1887 if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
1888 {
1889 return -ENXIO ;
1890 }
1891
1892 rate = wrqu->bitrate.value;
1893
1894 if (rate == -1)
1895 {
1896 rate = WNI_CFG_FIXED_RATE_AUTO;
1897 valid_rate = TRUE;
1898 }
1899 else if (ccmCfgGetInt(WLAN_HDD_GET_HAL_CTX(pAdapter),
1900 WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS)
1901 {
1902 if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G
1903 || active_phy_mode == WNI_CFG_DOT11_MODE_11B)
1904 {
1905 if ((ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter),
1906 WNI_CFG_SUPPORTED_RATES_11A,
1907 supp_rates, &a_len) == eHAL_STATUS_SUCCESS) &&
1908 (ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter),
1909 WNI_CFG_SUPPORTED_RATES_11B,
1910 supp_rates, &b_len) == eHAL_STATUS_SUCCESS))
1911 {
1912 for (i = 0; i < (b_len + a_len); ++i)
1913 {
1914 /* supported rates returned is double the actual rate so we divide it by 2 */
1915 if ((supp_rates[i]&0x7F)/2 == rate)
1916 {
1917 valid_rate = TRUE;
1918 rate = i + WNI_CFG_FIXED_RATE_1MBPS;
1919 break;
1920 }
1921 }
1922 }
1923 }
1924 }
1925 if (valid_rate != TRUE)
1926 {
1927 return -EINVAL;
1928 }
1929 if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter),
1930 WNI_CFG_FIXED_RATE, rate,
1931 ccmCfgSetCallback,eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS)
1932 {
c_hpothub8245442013-11-20 23:41:09 +05301933 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1934 FL("failed to set ini parameter, WNI_CFG_FIXED_RATE"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 return -EIO;
1936 }
1937 return 0;
1938}
1939
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301940static int iw_set_bitrate(struct net_device *dev,
1941 struct iw_request_info *info,
1942 union iwreq_data *wrqu,
1943 char *extra)
1944{
1945 int ret;
Jeff Johnson295189b2012-06-20 16:38:30 -07001946
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05301947 vos_ssr_protect(__func__);
1948 ret = __iw_set_bitrate(dev, info, wrqu, extra);
1949 vos_ssr_unprotect(__func__);
1950
1951 return ret;
1952}
1953
1954static int __iw_set_genie(struct net_device *dev,
1955 struct iw_request_info *info,
1956 union iwreq_data *wrqu,
1957 char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07001958{
1959 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
1960 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Arif Hussain24bfa702014-01-22 13:51:30 -08001961 u_int8_t *genie = NULL;
1962 u_int8_t *base_genie = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 v_U16_t remLen;
1964
1965 ENTER();
Jeff Johnson295189b2012-06-20 16:38:30 -07001966
1967 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
Arif Hussain24bfa702014-01-22 13:51:30 -08001968 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
1969 "%s:LOGP in Progress. Ignore!!!", __func__);
1970 return 0;
1971 }
1972
1973 if (!wrqu->data.length) {
1974 hdd_clearRoamProfileIe(pAdapter);
1975 EXIT();
1976 return 0;
1977 }
1978
1979 base_genie = mem_alloc_copy_from_user_helper(wrqu->data.pointer,
1980 wrqu->data.length);
1981 if (NULL == base_genie)
1982 {
1983 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1984 "mem_alloc_copy_from_user_helper fail");
1985 return -ENOMEM;
1986 }
1987
1988 genie = base_genie;
Jeff Johnson295189b2012-06-20 16:38:30 -07001989
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 remLen = wrqu->data.length;
1991
Arif Hussain6d2a3322013-11-17 19:50:10 -08001992 hddLog(LOG1,"iw_set_genie ioctl IE[0x%X], LEN[%d]", genie[0], genie[1]);
Jeff Johnson295189b2012-06-20 16:38:30 -07001993
1994 /* clear any previous genIE before this call */
1995 memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) );
1996
1997 while (remLen >= 2)
1998 {
1999 v_U16_t eLen = 0;
2000 v_U8_t elementId;
2001 elementId = *genie++;
2002 eLen = *genie++;
2003 remLen -= 2;
2004
Arif Hussain6d2a3322013-11-17 19:50:10 -08002005 hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]",
Jeff Johnson295189b2012-06-20 16:38:30 -07002006 __func__, elementId, eLen);
2007
2008 switch ( elementId )
2009 {
2010 case IE_EID_VENDOR:
2011 if ((IE_LEN_SIZE+IE_EID_SIZE+IE_VENDOR_OUI_SIZE) > eLen) /* should have at least OUI */
Arif Hussain24bfa702014-01-22 13:51:30 -08002012 {
2013 kfree(base_genie);
2014 return -EINVAL;
2015 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002016
2017 if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4))
2018 {
2019 v_U16_t curGenIELen = pWextState->genIE.length;
2020 hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS OUI(%02x %02x %02x %02x) IE(len %d)",
2021 __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2);
2022
2023 if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) )
2024 {
2025 hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. "
Arif Hussain6d2a3322013-11-17 19:50:10 -08002026 "Need bigger buffer space");
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 VOS_ASSERT(0);
Arif Hussain24bfa702014-01-22 13:51:30 -08002028 kfree(base_genie);
Jeff Johnson295189b2012-06-20 16:38:30 -07002029 return -ENOMEM;
2030 }
2031 // save to Additional IE ; it should be accumulated to handle WPS IE + other IE
2032 memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2);
2033 pWextState->genIE.length += eLen + 2;
2034 }
2035 else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3))
2036 {
2037 hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2);
2038 memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN );
2039 memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2));
2040 pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE;
2041 pWextState->roamProfile.nWPAReqIELength = eLen + 2;
2042 }
2043 else /* any vendorId except WPA IE should be accumulated to genIE */
2044 {
2045 v_U16_t curGenIELen = pWextState->genIE.length;
2046 hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OUI(%02x %02x %02x %02x) IE(len %d)",
2047 __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2);
2048
2049 if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) )
2050 {
2051 hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. "
Arif Hussain6d2a3322013-11-17 19:50:10 -08002052 "Need bigger buffer space");
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 VOS_ASSERT(0);
Arif Hussain24bfa702014-01-22 13:51:30 -08002054 kfree(base_genie);
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 return -ENOMEM;
2056 }
2057 // save to Additional IE ; it should be accumulated to handle WPS IE + other IE
2058 memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2);
2059 pWextState->genIE.length += eLen + 2;
2060 }
2061 break;
2062 case DOT11F_EID_RSN:
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002063 hddLog (LOG1, "%s Set RSN IE (len %d)",__func__, eLen+2);
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN );
2065 memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2));
2066 pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE;
2067 pWextState->roamProfile.nRSNReqIELength = eLen + 2;
2068 break;
2069
2070 default:
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002071 hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, elementId);
Arif Hussain24bfa702014-01-22 13:51:30 -08002072 kfree(base_genie);
Jeff Johnson295189b2012-06-20 16:38:30 -07002073 return 0;
2074 }
2075 genie += eLen;
2076 remLen -= eLen;
2077 }
2078 EXIT();
Arif Hussain24bfa702014-01-22 13:51:30 -08002079 kfree(base_genie);
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 return 0;
2081}
2082
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302083static int iw_set_genie(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 struct iw_request_info *info,
2085 union iwreq_data *wrqu,
2086 char *extra)
2087{
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302088 int ret;
2089
2090 vos_ssr_protect(__func__);
2091 ret = __iw_set_genie(dev, info, wrqu, extra);
2092 vos_ssr_unprotect(__func__);
2093
2094 return ret;
2095}
2096
2097static int __iw_get_genie(struct net_device *dev,
2098 struct iw_request_info *info,
2099 union iwreq_data *wrqu,
2100 char *extra)
2101{
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 hdd_wext_state_t *pWextState;
2103 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
2104 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
2105 eHalStatus status;
2106 v_U32_t length = DOT11F_IE_RSN_MAX_LEN;
2107 v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN];
2108
2109 ENTER();
2110
2111 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
2112 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
2113 return 0;
2114 }
2115
2116
Arif Hussain6d2a3322013-11-17 19:50:10 -08002117 hddLog(LOG1,"getGEN_IE ioctl");
Jeff Johnson295189b2012-06-20 16:38:30 -07002118
2119 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
2120
2121 if( pHddStaCtx->conn_info.connState == eConnectionState_NotConnected)
2122 {
2123 return -ENXIO;
2124 }
2125
2126 // Return something ONLY if we are associated with an RSN or WPA network
2127 if ( VOS_TRUE != hdd_IsAuthTypeRSN(WLAN_HDD_GET_HAL_CTX(pAdapter),
2128 pWextState->roamProfile.negotiatedAuthType))
2129 {
2130 return -ENXIO;
2131 }
2132
2133 // Actually retrieve the RSN IE from CSR. (We previously sent it down in the CSR Roam Profile.)
2134 status = csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter),
2135 pAdapter->sessionId,
2136 &length,
2137 genIeBytes);
Arif Hussain7adce1b2013-11-11 22:59:34 -08002138 length = VOS_MIN((u_int16_t) length, DOT11F_IE_RSN_MAX_LEN);
2139 if (wrqu->data.length < length)
2140 {
2141 hddLog(LOG1, "%s: failed to copy data to user buffer", __func__);
2142 return -EFAULT;
2143 }
Arif Hussain9f05be02014-02-05 12:06:53 -08002144 vos_mem_copy( extra, (v_VOID_t*)genIeBytes, length);
Arif Hussain7adce1b2013-11-11 22:59:34 -08002145 wrqu->data.length = length;
Jeff Johnson295189b2012-06-20 16:38:30 -07002146
Arif Hussain6d2a3322013-11-17 19:50:10 -08002147 hddLog(LOG1,"%s: RSN IE of %d bytes returned", __func__, wrqu->data.length );
Jeff Johnson295189b2012-06-20 16:38:30 -07002148
2149 EXIT();
2150
2151 return 0;
2152}
2153
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302154static int iw_get_genie(struct net_device *dev,
2155 struct iw_request_info *info,
2156 union iwreq_data *wrqu,
2157 char *extra)
2158{
2159 int ret;
2160
2161 vos_ssr_protect(__func__);
2162 ret = __iw_get_genie(dev, info, wrqu, extra);
2163 vos_ssr_unprotect(__func__);
2164
2165 return ret;
2166}
2167
2168
2169static int __iw_get_encode(struct net_device *dev,
2170 struct iw_request_info *info,
2171 struct iw_point *dwrq, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07002172{
2173 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
2174 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
2175 tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile);
2176 int keyId;
2177 eCsrAuthType authType = eCSR_AUTH_TYPE_NONE;
2178 int i;
2179
2180 ENTER();
2181
2182 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) {
2183 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
2184 return 0;
2185 }
2186
2187 keyId = pRoamProfile->Keys.defaultIndex;
2188
2189 if(keyId < 0 || keyId >= MAX_WEP_KEYS)
2190 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08002191 hddLog(LOG1,"%s: Invalid keyId : %d",__func__,keyId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 return -EINVAL;
2193 }
2194
2195 if(pRoamProfile->Keys.KeyLength[keyId] > 0)
2196 {
2197 dwrq->flags |= IW_ENCODE_ENABLED;
2198 dwrq->length = pRoamProfile->Keys.KeyLength[keyId];
2199 vos_mem_copy(extra,&(pRoamProfile->Keys.KeyMaterial[keyId][0]),pRoamProfile->Keys.KeyLength[keyId]);
2200
2201 dwrq->flags |= (keyId + 1);
2202
2203 }
2204 else
2205 {
2206 dwrq->flags |= IW_ENCODE_DISABLED;
2207 }
2208
2209 for(i=0; i < MAX_WEP_KEYS; i++)
2210 {
2211 if(pRoamProfile->Keys.KeyMaterial[i] == NULL)
2212 {
2213 continue;
2214 }
2215 else
2216 {
2217 break;
2218 }
2219 }
2220
2221 if(MAX_WEP_KEYS == i)
2222 {
2223 dwrq->flags |= IW_ENCODE_NOKEY;
2224 }
2225
2226 authType = ((hdd_station_ctx_t*)WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType;
2227
2228 if(eCSR_AUTH_TYPE_OPEN_SYSTEM == authType)
2229 {
2230 dwrq->flags |= IW_ENCODE_OPEN;
2231 }
2232 else
2233 {
2234 dwrq->flags |= IW_ENCODE_RESTRICTED;
2235 }
2236 EXIT();
2237 return 0;
2238}
2239
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302240static int iw_get_encode(struct net_device *dev,
2241 struct iw_request_info *info,
2242 struct iw_point *dwrq, char *extra)
2243{
2244 int ret;
2245
2246 vos_ssr_protect(__func__);
2247 ret = __iw_get_encode(dev, info, dwrq, extra);
2248 vos_ssr_unprotect(__func__);
2249
2250 return ret;
2251}
2252
Jeff Johnson295189b2012-06-20 16:38:30 -07002253#define PAE_ROLE_AUTHENTICATOR 1 // =1 for authenticator,
2254#define PAE_ROLE_SUPPLICANT 0 // =0 for supplicant
2255
2256
2257/*
2258 * This function sends a single 'key' to LIM at all time.
2259 */
2260
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302261static int __iw_get_rts_threshold(struct net_device *dev,
2262 struct iw_request_info *info,
2263 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07002264{
2265 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
2266 v_U32_t status = 0;
2267
2268 status = hdd_wlan_get_rts_threshold(pAdapter,wrqu);
2269
2270 return status;
2271}
2272
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302273static int iw_get_rts_threshold(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 struct iw_request_info *info,
2275 union iwreq_data *wrqu, char *extra)
2276{
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302277 int ret;
2278
2279 vos_ssr_protect(__func__);
2280 ret = __iw_get_rts_threshold(dev, info, wrqu, extra);
2281 vos_ssr_unprotect(__func__);
2282
2283 return ret;
2284}
2285
2286static int __iw_set_rts_threshold(struct net_device *dev,
2287 struct iw_request_info *info,
2288 union iwreq_data *wrqu, char *extra)
2289{
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
2291 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
2292
2293 ENTER();
2294
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08002295 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
2296 {
2297 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
2298 "%s:LOGP in Progress. Ignore!!!", __func__);
2299 return -EAGAIN;
2300 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 if ( wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX )
2302 {
2303 return -EINVAL;
2304 }
2305
2306 if ( ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, wrqu->rts.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
2307 {
c_hpothub8245442013-11-20 23:41:09 +05302308 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
2309 FL("failed to set ini parameter, WNI_CFG_RTS_THRESHOLD"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 return -EIO;
2311 }
2312
2313 EXIT();
2314
2315 return 0;
2316}
2317
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302318static int iw_set_rts_threshold(struct net_device *dev,
2319 struct iw_request_info *info,
2320 union iwreq_data *wrqu, char *extra)
2321{
2322 int ret;
2323
2324 vos_ssr_protect(__func__);
2325 ret = __iw_set_rts_threshold(dev, info, wrqu, extra);
2326 vos_ssr_unprotect(__func__);
2327
2328 return ret;
2329}
2330
2331static int __iw_get_frag_threshold(struct net_device *dev,
2332 struct iw_request_info *info,
2333 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07002334{
2335 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
2336 v_U32_t status = 0;
2337
2338 status = hdd_wlan_get_frag_threshold(pAdapter,wrqu);
2339
2340 return status;
2341}
2342
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302343static int iw_get_frag_threshold(struct net_device *dev,
2344 struct iw_request_info *info,
2345 union iwreq_data *wrqu, char *extra)
2346{
2347 int ret;
2348
2349 vos_ssr_protect(__func__);
2350 ret = __iw_get_frag_threshold(dev, info, wrqu, extra);
2351 vos_ssr_unprotect(__func__);
2352
2353 return ret;
2354}
2355
2356static int __iw_set_frag_threshold(struct net_device *dev,
2357 struct iw_request_info *info,
2358 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07002359{
2360 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
2361 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
2362
2363 ENTER();
2364
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08002365 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
2366 {
2367 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2368 "%s:LOGP in Progress. Ignore!!!", __func__);
2369 return -EBUSY;
2370 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002371 if ( wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX )
2372 {
2373 return -EINVAL;
2374 }
2375
2376 if ( ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, wrqu->frag.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
2377 {
c_hpothub8245442013-11-20 23:41:09 +05302378 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
2379 FL("failed to set ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002380 return -EIO;
2381 }
2382
2383 EXIT();
2384
2385 return 0;
2386}
2387
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302388static int iw_set_frag_threshold(struct net_device *dev,
2389 struct iw_request_info *info,
2390 union iwreq_data *wrqu, char *extra)
2391{
2392 int ret;
2393
2394 vos_ssr_protect(__func__);
2395 ret = __iw_set_frag_threshold(dev, info, wrqu, extra);
2396 vos_ssr_unprotect(__func__);
2397
2398 return ret;
2399}
2400
Jeff Johnson295189b2012-06-20 16:38:30 -07002401static int iw_get_power_mode(struct net_device *dev,
2402 struct iw_request_info *info,
2403 union iwreq_data *wrqu, char *extra)
2404{
2405 ENTER();
2406 return -EOPNOTSUPP;
2407}
2408
2409static int iw_set_power_mode(struct net_device *dev,
2410 struct iw_request_info *info,
2411 union iwreq_data *wrqu, char *extra)
2412{
2413 ENTER();
2414 return -EOPNOTSUPP;
2415}
2416
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302417static int __iw_get_range(struct net_device *dev,
2418 struct iw_request_info *info,
2419 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07002420{
2421 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
2422 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
2423 struct iw_range *range = (struct iw_range *) extra;
2424
2425 v_U8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN];
2426
2427 v_U32_t num_channels = sizeof(channels);
2428 v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN];
2429 v_U32_t a_len;
2430 v_U32_t b_len;
2431 v_U32_t active_phy_mode = 0;
2432 v_U8_t index = 0, i;
2433
2434 ENTER();
2435
2436 wrqu->data.length = sizeof(struct iw_range);
2437 memset(range, 0, sizeof(struct iw_range));
2438
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08002439 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
2440 {
2441 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
2442 "%s:LOGP in Progress. Ignore!!!", __func__);
2443 return -EBUSY;
2444 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002445
2446 /*Get the phy mode*/
2447 if (ccmCfgGetInt(hHal,
2448 WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS)
2449 {
2450 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07002451 "active_phy_mode = %d", active_phy_mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002452
2453 if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G)
2454 {
2455 /*Get the supported rates for 11G band*/
Jeff Johnson1611e582013-04-03 10:43:16 -07002456 a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
Jeff Johnson295189b2012-06-20 16:38:30 -07002457 if (ccmCfgGetStr(hHal,
2458 WNI_CFG_SUPPORTED_RATES_11A,
2459 supp_rates, &a_len) == eHAL_STATUS_SUCCESS)
2460 {
2461 if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN)
2462 {
2463 a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN;
2464 }
2465 for (i = 0; i < a_len; i++)
2466 {
2467 range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000;
2468 }
2469 range->num_bitrates = a_len;
2470 }
2471 else
2472 {
2473 return -EIO;
2474 }
2475 }
2476 else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B)
2477 {
2478 /*Get the supported rates for 11B band*/
Jeff Johnson1611e582013-04-03 10:43:16 -07002479 b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 if (ccmCfgGetStr(hHal,
2481 WNI_CFG_SUPPORTED_RATES_11B,
2482 supp_rates, &b_len) == eHAL_STATUS_SUCCESS)
2483 {
2484 if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN)
2485 {
2486 b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN;
2487 }
2488 for (i = 0; i < b_len; i++)
2489 {
2490 range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000;
2491 }
2492 range->num_bitrates = b_len;
2493 }
2494 else
2495 {
2496 return -EIO;
2497 }
2498 }
2499 }
2500
2501 range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX;
2502 range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN;
2503 range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX;
2504
2505 range->encoding_size[0] = 5;
2506 range->encoding_size[1] = 13;
2507 range->num_encoding_sizes = 2;
2508 range->max_encoding_tokens = MAX_WEP_KEYS;
2509
2510 // we support through Wireless Extensions 22
2511 range->we_version_compiled = WIRELESS_EXT;
2512 range->we_version_source = 22;
2513
2514 /*Supported Channels and Frequencies*/
2515 if (ccmCfgGetStr((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels, &num_channels) != eHAL_STATUS_SUCCESS)
2516 {
c_hpothub8245442013-11-20 23:41:09 +05302517 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
2518 FL("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002519 return -EIO;
2520 }
2521 if (num_channels > IW_MAX_FREQUENCIES)
2522 {
2523 num_channels = IW_MAX_FREQUENCIES;
2524 }
2525
2526 range->num_channels = num_channels;
2527 range->num_frequency = num_channels;
2528
2529 for (index=0; index < num_channels; index++)
2530 {
2531 v_U32_t frq_indx = 0;
2532
2533 range->freq[index].i = channels[index];
2534 while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE)
2535 {
2536 if(channels[index] == freq_chan_map[frq_indx].chan)
2537 {
2538 range->freq[index].m = freq_chan_map[frq_indx].freq * 100000;
2539 range->freq[index].e = 1;
2540 break;
2541 }
2542 frq_indx++;
2543 }
2544 }
2545
2546 /* Event capability (kernel + driver) */
2547 range->event_capa[0] = (IW_EVENT_CAPA_K_0 |
2548 IW_EVENT_CAPA_MASK(SIOCGIWAP) |
2549 IW_EVENT_CAPA_MASK(SIOCGIWSCAN));
2550 range->event_capa[1] = IW_EVENT_CAPA_K_1;
2551
2552 /*Encryption capability*/
2553 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
2554 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
2555
2556 /* Txpower capability */
2557 range->txpower_capa = IW_TXPOW_MWATT;
2558
2559 /*Scanning capability*/
2560 #if WIRELESS_EXT >= 22
2561 range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL;
2562 #endif
2563
2564 EXIT();
2565 return 0;
2566}
2567
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05302568static int iw_get_range(struct net_device *dev,
2569 struct iw_request_info *info,
2570 union iwreq_data *wrqu, char *extra)
2571{
2572 int ret;
2573
2574 vos_ssr_protect(__func__);
2575 ret = __iw_get_range(dev, info, wrqu, extra);
2576 vos_ssr_unprotect(__func__);
2577
2578 return ret;
2579}
2580
Jeff Johnson295189b2012-06-20 16:38:30 -07002581/* Callback function registered with PMC to know status of PMC request */
2582static void iw_power_callback_fn (void *pContext, eHalStatus status)
2583{
2584 struct statsContext *pStatsContext;
Jeff Johnson295189b2012-06-20 16:38:30 -07002585
2586 if (NULL == pContext)
2587 {
2588 hddLog(VOS_TRACE_LEVEL_ERROR,
2589 "%s: Bad param, pContext [%p]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002590 __func__, pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 return;
2592 }
2593
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 pStatsContext = (struct statsContext *)pContext;
Jeff Johnson295189b2012-06-20 16:38:30 -07002595
Jeff Johnson72a40512013-12-19 10:14:15 -08002596 /* there is a race condition that exists between this callback
2597 function and the caller since the caller could time out either
2598 before or while this code is executing. we use a spinlock to
2599 serialize these actions */
2600 spin_lock(&hdd_context_lock);
2601
2602 if (POWER_CONTEXT_MAGIC != pStatsContext->magic)
Jeff Johnson295189b2012-06-20 16:38:30 -07002603 {
2604 /* the caller presumably timed out so there is nothing we can do */
Jeff Johnson72a40512013-12-19 10:14:15 -08002605 spin_unlock(&hdd_context_lock);
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 hddLog(VOS_TRACE_LEVEL_WARN,
Jeff Johnson72a40512013-12-19 10:14:15 -08002607 "%s: Invalid context, magic [%08x]",
2608 __func__, pStatsContext->magic);
Jeff Johnson295189b2012-06-20 16:38:30 -07002609
2610 if (ioctl_debug)
2611 {
Jeff Johnson72a40512013-12-19 10:14:15 -08002612 pr_info("%s: Invalid context, magic [%08x]\n",
2613 __func__, pStatsContext->magic);
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 }
2615 return;
2616 }
2617
Jeff Johnson72a40512013-12-19 10:14:15 -08002618 /* context is valid so caller is still waiting */
2619
2620 /* paranoia: invalidate the magic */
2621 pStatsContext->magic = 0;
2622
2623 /* notify the caller */
Jeff Johnson295189b2012-06-20 16:38:30 -07002624 complete(&pStatsContext->completion);
Jeff Johnson72a40512013-12-19 10:14:15 -08002625
2626 /* serialization is complete */
2627 spin_unlock(&hdd_context_lock);
Jeff Johnson295189b2012-06-20 16:38:30 -07002628}
2629
2630/* Callback function for tx per hit */
2631void hdd_tx_per_hit_cb (void *pCallbackContext)
2632{
2633 hdd_adapter_t *pAdapter = (hdd_adapter_t *)pCallbackContext;
2634 unsigned char tx_fail[16];
2635 union iwreq_data wrqu;
2636
Kaushik, Sushantc78ee812014-08-01 12:21:19 +05302637 if (NULL == pAdapter || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic))
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08002639 hddLog(LOGE, "hdd_tx_per_hit_cb: pAdapter is NULL");
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 return;
2641 }
2642 memset(&wrqu, 0, sizeof(wrqu));
2643 wrqu.data.length = strlcpy(tx_fail, "TX_FAIL", sizeof(tx_fail));
2644 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, tx_fail);
2645}
2646
2647void hdd_GetClassA_statisticsCB(void *pStats, void *pContext)
2648{
2649 struct statsContext *pStatsContext;
2650 tCsrGlobalClassAStatsInfo *pClassAStats;
2651 hdd_adapter_t *pAdapter;
2652
2653 if (ioctl_debug)
2654 {
2655 pr_info("%s: pStats [%p] pContext [%p]\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002656 __func__, pStats, pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 }
2658
2659 if ((NULL == pStats) || (NULL == pContext))
2660 {
2661 hddLog(VOS_TRACE_LEVEL_ERROR,
2662 "%s: Bad param, pStats [%p] pContext [%p]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002663 __func__, pStats, pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07002664 return;
2665 }
2666
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 pClassAStats = pStats;
2668 pStatsContext = pContext;
2669 pAdapter = pStatsContext->pAdapter;
Jeff Johnson72a40512013-12-19 10:14:15 -08002670
2671 /* there is a race condition that exists between this callback
2672 function and the caller since the caller could time out either
2673 before or while this code is executing. we use a spinlock to
2674 serialize these actions */
2675 spin_lock(&hdd_context_lock);
2676
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 if ((NULL == pAdapter) || (STATS_CONTEXT_MAGIC != pStatsContext->magic))
2678 {
2679 /* the caller presumably timed out so there is nothing we can do */
Jeff Johnson72a40512013-12-19 10:14:15 -08002680 spin_unlock(&hdd_context_lock);
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 hddLog(VOS_TRACE_LEVEL_WARN,
2682 "%s: Invalid context, pAdapter [%p] magic [%08x]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002683 __func__, pAdapter, pStatsContext->magic);
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 if (ioctl_debug)
2685 {
2686 pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002687 __func__, pAdapter, pStatsContext->magic);
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 }
2689 return;
2690 }
2691
Jeff Johnson72a40512013-12-19 10:14:15 -08002692 /* context is valid so caller is still waiting */
2693
2694 /* paranoia: invalidate the magic */
2695 pStatsContext->magic = 0;
2696
2697 /* copy over the stats. do so as a struct copy */
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 pAdapter->hdd_stats.ClassA_stat = *pClassAStats;
2699
Jeff Johnson72a40512013-12-19 10:14:15 -08002700 /* notify the caller */
Jeff Johnson295189b2012-06-20 16:38:30 -07002701 complete(&pStatsContext->completion);
Jeff Johnson72a40512013-12-19 10:14:15 -08002702
2703 /* serialization is complete */
2704 spin_unlock(&hdd_context_lock);
Jeff Johnson295189b2012-06-20 16:38:30 -07002705}
2706
2707VOS_STATUS wlan_hdd_get_classAstats(hdd_adapter_t *pAdapter)
2708{
2709 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
2710 eHalStatus hstatus;
2711 long lrc;
2712 struct statsContext context;
2713
2714 if (NULL == pAdapter)
2715 {
2716 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__);
2717 return VOS_STATUS_E_FAULT;
2718 }
2719 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
2720 {
2721 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__);
2722 return VOS_STATUS_SUCCESS;
2723 }
2724
2725 /* we are connected
2726 prepare our callback context */
2727 init_completion(&context.completion);
2728 context.pAdapter = pAdapter;
2729 context.magic = STATS_CONTEXT_MAGIC;
2730 /* query only for Class A statistics (which include link speed) */
2731 hstatus = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter),
2732 eCSR_HDD,
2733 SME_GLOBAL_CLASSA_STATS,
2734 hdd_GetClassA_statisticsCB,
2735 0, // not periodic
2736 FALSE, //non-cached results
2737 pHddStaCtx->conn_info.staId[0],
2738 &context);
2739 if (eHAL_STATUS_SUCCESS != hstatus)
2740 {
2741 hddLog(VOS_TRACE_LEVEL_ERROR,
Jeff Johnson72a40512013-12-19 10:14:15 -08002742 "%s: Unable to retrieve Class A statistics",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002743 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 /* we'll returned a cached value below */
2745 }
2746 else
2747 {
2748 /* request was sent -- wait for the response */
2749 lrc = wait_for_completion_interruptible_timeout(&context.completion,
2750 msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 if (lrc <= 0)
2752 {
2753 hddLog(VOS_TRACE_LEVEL_ERROR,
2754 "%s: SME %s while retrieving Class A statistics",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002755 __func__, (0 == lrc) ? "timeout" : "interrupt");
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 }
2757 }
Jeff Johnson72a40512013-12-19 10:14:15 -08002758
2759 /* either we never sent a request, we sent a request and received a
2760 response or we sent a request and timed out. if we never sent a
2761 request or if we sent a request and got a response, we want to
2762 clear the magic out of paranoia. if we timed out there is a
2763 race condition such that the callback function could be
2764 executing at the same time we are. of primary concern is if the
2765 callback function had already verified the "magic" but had not
2766 yet set the completion variable when a timeout occurred. we
2767 serialize these activities by invalidating the magic while
2768 holding a shared spinlock which will cause us to block if the
2769 callback is currently executing */
2770 spin_lock(&hdd_context_lock);
2771 context.magic = 0;
2772 spin_unlock(&hdd_context_lock);
2773
2774 /* either callback updated pAdapter stats or it has cached data */
Jeff Johnson295189b2012-06-20 16:38:30 -07002775 return VOS_STATUS_SUCCESS;
2776}
2777
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002778static void hdd_get_station_statisticsCB(void *pStats, void *pContext)
2779{
2780 struct statsContext *pStatsContext;
2781 tCsrSummaryStatsInfo *pSummaryStats;
2782 tCsrGlobalClassAStatsInfo *pClassAStats;
2783 hdd_adapter_t *pAdapter;
2784
2785 if (ioctl_debug)
2786 {
2787 pr_info("%s: pStats [%p] pContext [%p]\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002788 __func__, pStats, pContext);
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002789 }
2790
2791 if ((NULL == pStats) || (NULL == pContext))
2792 {
2793 hddLog(VOS_TRACE_LEVEL_ERROR,
2794 "%s: Bad param, pStats [%p] pContext [%p]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002795 __func__, pStats, pContext);
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002796 return;
2797 }
2798
Jeff Johnson72a40512013-12-19 10:14:15 -08002799 /* there is a race condition that exists between this callback
2800 function and the caller since the caller could time out either
2801 before or while this code is executing. we use a spinlock to
2802 serialize these actions */
2803 spin_lock(&hdd_context_lock);
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002804
2805 pSummaryStats = (tCsrSummaryStatsInfo *)pStats;
2806 pClassAStats = (tCsrGlobalClassAStatsInfo *)( pSummaryStats + 1 );
2807 pStatsContext = pContext;
2808 pAdapter = pStatsContext->pAdapter;
2809 if ((NULL == pAdapter) || (STATS_CONTEXT_MAGIC != pStatsContext->magic))
2810 {
2811 /* the caller presumably timed out so there is nothing we can do */
Jeff Johnson72a40512013-12-19 10:14:15 -08002812 spin_unlock(&hdd_context_lock);
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002813 hddLog(VOS_TRACE_LEVEL_WARN,
2814 "%s: Invalid context, pAdapter [%p] magic [%08x]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002815 __func__, pAdapter, pStatsContext->magic);
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002816 if (ioctl_debug)
2817 {
2818 pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002819 __func__, pAdapter, pStatsContext->magic);
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002820 }
2821 return;
2822 }
2823
Jeff Johnson72a40512013-12-19 10:14:15 -08002824 /* context is valid so caller is still waiting */
2825
2826 /* paranoia: invalidate the magic */
2827 pStatsContext->magic = 0;
2828
2829 /* copy over the stats. do so as a struct copy */
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002830 pAdapter->hdd_stats.summary_stat = *pSummaryStats;
2831 pAdapter->hdd_stats.ClassA_stat = *pClassAStats;
2832
Jeff Johnson72a40512013-12-19 10:14:15 -08002833 /* notify the caller */
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002834 complete(&pStatsContext->completion);
Jeff Johnson72a40512013-12-19 10:14:15 -08002835
2836 /* serialization is complete */
2837 spin_unlock(&hdd_context_lock);
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002838}
2839
2840VOS_STATUS wlan_hdd_get_station_stats(hdd_adapter_t *pAdapter)
2841{
2842 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
2843 eHalStatus hstatus;
2844 long lrc;
2845 struct statsContext context;
2846
2847 if (NULL == pAdapter)
2848 {
2849 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__);
2850 return VOS_STATUS_SUCCESS;
2851 }
2852
2853 /* we are connected
2854 prepare our callback context */
2855 init_completion(&context.completion);
2856 context.pAdapter = pAdapter;
2857 context.magic = STATS_CONTEXT_MAGIC;
2858
2859 /* query only for Summary & Class A statistics */
2860 hstatus = sme_GetStatistics(WLAN_HDD_GET_HAL_CTX(pAdapter),
2861 eCSR_HDD,
2862 SME_SUMMARY_STATS |
2863 SME_GLOBAL_CLASSA_STATS,
2864 hdd_get_station_statisticsCB,
2865 0, // not periodic
2866 FALSE, //non-cached results
2867 pHddStaCtx->conn_info.staId[0],
2868 &context);
2869 if (eHAL_STATUS_SUCCESS != hstatus)
2870 {
2871 hddLog(VOS_TRACE_LEVEL_ERROR,
2872 "%s: Unable to retrieve statistics",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002873 __func__);
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002874 /* we'll return with cached values */
2875 }
2876 else
2877 {
2878 /* request was sent -- wait for the response */
2879 lrc = wait_for_completion_interruptible_timeout(&context.completion,
2880 msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
Jeff Johnson72a40512013-12-19 10:14:15 -08002881
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002882 if (lrc <= 0)
2883 {
2884 hddLog(VOS_TRACE_LEVEL_ERROR,
2885 "%s: SME %s while retrieving statistics",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002886 __func__, (0 == lrc) ? "timeout" : "interrupt");
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002887 }
2888 }
Jeff Johnson72a40512013-12-19 10:14:15 -08002889
2890 /* either we never sent a request, we sent a request and received a
2891 response or we sent a request and timed out. if we never sent a
2892 request or if we sent a request and got a response, we want to
2893 clear the magic out of paranoia. if we timed out there is a
2894 race condition such that the callback function could be
2895 executing at the same time we are. of primary concern is if the
2896 callback function had already verified the "magic" but had not
2897 yet set the completion variable when a timeout occurred. we
2898 serialize these activities by invalidating the magic while
2899 holding a shared spinlock which will cause us to block if the
2900 callback is currently executing */
2901 spin_lock(&hdd_context_lock);
2902 context.magic = 0;
2903 spin_unlock(&hdd_context_lock);
2904
2905 /* either callback updated pAdapter stats or it has cached data */
Madan Mohan Koyyalamudi4d4d2812012-09-24 14:08:29 -07002906 return VOS_STATUS_SUCCESS;
2907}
2908
2909
Jeff Johnson295189b2012-06-20 16:38:30 -07002910/*
2911 * Support for the LINKSPEED private command
2912 * Per the WiFi framework the response must be of the form
2913 * "LinkSpeed xx"
2914 */
2915static int iw_get_linkspeed(struct net_device *dev,
2916 struct iw_request_info *info,
2917 union iwreq_data *wrqu, char *extra)
2918{
2919 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +05302920 hdd_context_t *pHddCtx;
Jeff Johnson295189b2012-06-20 16:38:30 -07002921 char *pLinkSpeed = (char*)extra;
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +05302922 int len = sizeof(v_U32_t) + 1;
2923 v_U32_t link_speed;
Jeff Johnson295189b2012-06-20 16:38:30 -07002924 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +05302925 VOS_STATUS status;
2926 int rc, valid;
Jeff Johnson295189b2012-06-20 16:38:30 -07002927
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +05302928 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
2929
2930 valid = wlan_hdd_validate_context(pHddCtx);
2931
2932 if (0 != valid)
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08002933 {
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +05302934 hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid"));
2935 return valid;
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08002936 }
2937
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
2939 {
2940 /* we are not connected so we don't have a classAstats */
2941 link_speed = 0;
2942 }
2943 else
2944 {
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +05302945 status = wlan_hdd_get_classAstats(pAdapter);
2946
2947 if (!VOS_IS_STATUS_SUCCESS(status ))
2948 {
2949 hddLog(VOS_TRACE_LEVEL_ERROR, FL("Unable to retrieve SME statistics"));
2950 return -EINVAL;
2951 }
2952
2953 /* Unit of link capacity is obtained from the TL API is MbpsX10 */
2954 WLANTL_GetSTALinkCapacity(WLAN_HDD_GET_CTX(pAdapter)->pvosContext,
2955 (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0],
2956 &link_speed);
2957
2958 link_speed = link_speed / 10;
2959
2960 if (0 == link_speed)
2961 {
2962 /* The linkspeed returned by HAL is in units of 500kbps.
2963 * converting it to mbps.
2964 * This is required to support legacy firmware which does
2965 * not return link capacity.
2966 */
2967 link_speed = pAdapter->hdd_stats.ClassA_stat.tx_rate/2;
2968 }
2969
Jeff Johnson295189b2012-06-20 16:38:30 -07002970 }
2971
2972 wrqu->data.length = len;
2973 // return the linkspeed in the format required by the WiFi Framework
Jeff Johnson02797792013-10-26 19:17:13 -07002974 rc = snprintf(pLinkSpeed, len, "%u", link_speed);
Jeff Johnson295189b2012-06-20 16:38:30 -07002975 if ((rc < 0) || (rc >= len))
2976 {
2977 // encoding or length error?
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +05302978 hddLog(VOS_TRACE_LEVEL_ERROR,FL("Unable to encode link speed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002979 return -EIO;
2980 }
2981
2982 /* a value is being successfully returned */
Arif Hussain24bfa702014-01-22 13:51:30 -08002983 return rc;
Jeff Johnson295189b2012-06-20 16:38:30 -07002984}
2985
Arif Hussain695279c2014-03-24 14:06:07 -07002986/*
2987 * Helper function to return correct value for WLAN_GET_LINK_SPEED
2988 *
2989 */
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05302990static int __iw_get_linkspeed_priv(struct net_device *dev,
Arif Hussain695279c2014-03-24 14:06:07 -07002991 struct iw_request_info *info,
2992 union iwreq_data *wrqu, char *extra)
2993{
2994 int rc;
2995
2996 rc = iw_get_linkspeed(dev, info, wrqu, extra);
2997
2998 if (rc < 0)
2999 return rc;
3000
3001 /* a value is being successfully returned */
3002 return 0;
3003}
Jeff Johnson295189b2012-06-20 16:38:30 -07003004
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05303005static int iw_get_linkspeed_priv(struct net_device *dev,
3006 struct iw_request_info *info,
3007 union iwreq_data *wrqu, char *extra)
3008{
3009 int ret;
3010
3011 vos_ssr_protect(__func__);
3012 ret = __iw_get_linkspeed_priv(dev, info, wrqu, extra);
3013 vos_ssr_unprotect(__func__);
3014
3015 return ret;
3016}
3017
Jeff Johnson295189b2012-06-20 16:38:30 -07003018/*
3019 * Support for the RSSI & RSSI-APPROX private commands
3020 * Per the WiFi framework the response must be of the form
3021 * "<ssid> rssi <xx>"
3022 * unless we are not associated, in which case the response is
3023 * "OK"
3024 */
3025static int iw_get_rssi(struct net_device *dev,
3026 struct iw_request_info *info,
3027 union iwreq_data *wrqu, char *extra)
3028{
3029 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Arif Hussain7adce1b2013-11-11 22:59:34 -08003030 char *cmd = extra;
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 int len = wrqu->data.length;
3032 v_S7_t s7Rssi = 0;
3033 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
3034 int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length;
3035 VOS_STATUS vosStatus;
3036 int rc;
3037
3038 if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) ||
3039 (0 == ssidlen) || (ssidlen >= len))
3040 {
3041 /* we are not connected or our SSID is too long
3042 so we cannot report an rssi */
Sameer Thalappilb0a30232013-09-27 15:37:48 -07003043 rc = scnprintf(cmd, len, "OK");
Jeff Johnson295189b2012-06-20 16:38:30 -07003044 }
3045 else
3046 {
3047 /* we are connected with a valid SSID
3048 so we can write the SSID into the return buffer
3049 (note that it is not NUL-terminated) */
3050 memcpy(cmd, pHddStaCtx->conn_info.SSID.SSID.ssId, ssidlen );
3051
3052 vosStatus = wlan_hdd_get_rssi(pAdapter, &s7Rssi);
3053
3054 if (VOS_STATUS_SUCCESS == vosStatus)
3055 {
3056 /* append the rssi to the ssid in the format required by
3057 the WiFI Framework */
Sameer Thalappilb0a30232013-09-27 15:37:48 -07003058 rc = scnprintf(&cmd[ssidlen], len - ssidlen, " rssi %d", s7Rssi);
c_hpothu72afb282014-02-17 12:55:36 +05303059 rc += ssidlen;
Jeff Johnson295189b2012-06-20 16:38:30 -07003060 }
3061 else
3062 {
3063 rc = -1;
3064 }
3065 }
3066
3067 /* verify that we wrote a valid response */
3068 if ((rc < 0) || (rc >= len))
3069 {
3070 // encoding or length error?
3071 hddLog(VOS_TRACE_LEVEL_ERROR,
3072 "%s: Unable to encode RSSI, got [%s]",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003073 __func__, cmd);
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 return -EIO;
3075 }
3076
3077 /* a value is being successfully returned */
Arif Hussain24bfa702014-01-22 13:51:30 -08003078 return rc;
Jeff Johnson295189b2012-06-20 16:38:30 -07003079}
3080
3081/*
3082 * Support for SoftAP channel range private command
3083 */
3084static int iw_softap_set_channel_range( struct net_device *dev,
3085 int startChannel,
3086 int endChannel,
3087 int band)
3088{
Jeff Johnson43971f52012-07-17 12:26:56 -07003089 VOS_STATUS status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003090 int ret = 0;
3091 hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev));
3092 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter);
Madan Mohan Koyyalamudi543172b2012-12-05 16:40:18 -08003093 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter);
3094
Jeff Johnson295189b2012-06-20 16:38:30 -07003095
3096 status = WLANSAP_SetChannelRange(hHal, startChannel, endChannel, band);
3097 if (VOS_STATUS_SUCCESS != status)
3098 {
3099 ret = -EINVAL;
3100 }
Yathish9f22e662012-12-10 14:21:35 -08003101 pHddCtx->is_dynamic_channel_range_set = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 return ret;
3103}
3104
3105VOS_STATUS wlan_hdd_enter_bmps(hdd_adapter_t *pAdapter, int mode)
3106{
3107 struct statsContext context;
3108 eHalStatus status;
3109 hdd_context_t *pHddCtx;
3110
3111 if (NULL == pAdapter)
3112 {
3113 hddLog(VOS_TRACE_LEVEL_FATAL, "Adapter NULL");
3114 return VOS_STATUS_E_FAULT;
3115 }
3116
3117 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "power mode=%d", mode);
3118 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Siddharth Bhal6cd329b2014-03-19 20:39:13 +05303119 if (pHddCtx->isLogpInProgress) {
3120 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3121 "%s:LOGP in Progress. Ignore!!!", __func__);
3122 return VOS_STATUS_E_FAILURE;
3123 }
3124
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 init_completion(&context.completion);
3126
3127 context.pAdapter = pAdapter;
3128 context.magic = POWER_CONTEXT_MAGIC;
3129
3130 if (DRIVER_POWER_MODE_ACTIVE == mode)
3131 {
3132 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering "
3133 "Full Power", __func__);
3134 status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter),
3135 iw_power_callback_fn, &context,
3136 eSME_FULL_PWR_NEEDED_BY_HDD);
3137 // Enter Full power command received from GUI this means we are disconnected
3138 // Set PMC remainInPowerActiveTillDHCP flag to disable auto BMPS entry by PMC
3139 sme_SetDHCPTillPowerActiveFlag(pHddCtx->hHal, TRUE);
3140 if (eHAL_STATUS_PMC_PENDING == status)
3141 {
Jeff Johnson72a40512013-12-19 10:14:15 -08003142 /* request was sent -- wait for the response */
Jeff Johnson295189b2012-06-20 16:38:30 -07003143 int lrc = wait_for_completion_interruptible_timeout(
3144 &context.completion,
3145 msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
Jeff Johnson72a40512013-12-19 10:14:15 -08003146
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 if (lrc <= 0)
3148 {
3149 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while requesting fullpower ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003150 __func__, (0 == lrc) ? "timeout" : "interrupt");
Jeff Johnson295189b2012-06-20 16:38:30 -07003151 }
3152 }
3153 }
3154 else if (DRIVER_POWER_MODE_AUTO == mode)
3155 {
3156 if (pHddCtx->cfg_ini->fIsBmpsEnabled)
3157 {
3158 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering Bmps ",
3159 __func__);
3160 // Enter BMPS command received from GUI this means DHCP is completed
3161 // Clear PMC remainInPowerActiveTillDHCP flag to enable auto BMPS entry
3162 sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter),
3163 FALSE);
3164 status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter),
3165 iw_power_callback_fn, &context);
3166 if (eHAL_STATUS_PMC_PENDING == status)
3167 {
Jeff Johnson72a40512013-12-19 10:14:15 -08003168 /* request was sent -- wait for the response */
Jeff Johnson295189b2012-06-20 16:38:30 -07003169 int lrc = wait_for_completion_interruptible_timeout(
3170 &context.completion,
3171 msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003172 if (lrc <= 0)
3173 {
Jeff Johnson72a40512013-12-19 10:14:15 -08003174 hddLog(VOS_TRACE_LEVEL_ERROR,
3175 "%s: SME %s while requesting BMPS",
3176 __func__, (0 == lrc) ? "timeout" : "interrupt");
Jeff Johnson295189b2012-06-20 16:38:30 -07003177 }
3178 }
3179 }
3180 else
3181 {
3182 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "BMPS is not "
3183 "enabled in the cfg");
3184 }
3185 }
Jeff Johnson72a40512013-12-19 10:14:15 -08003186
3187 /* either we never sent a request, we sent a request and received a
3188 response or we sent a request and timed out. if we never sent a
3189 request or if we sent a request and got a response, we want to
3190 clear the magic out of paranoia. if we timed out there is a
3191 race condition such that the callback function could be
3192 executing at the same time we are. of primary concern is if the
3193 callback function had already verified the "magic" but had not
3194 yet set the completion variable when a timeout occurred. we
3195 serialize these activities by invalidating the magic while
3196 holding a shared spinlock which will cause us to block if the
3197 callback is currently executing */
3198 spin_lock(&hdd_context_lock);
3199 context.magic = 0;
3200 spin_unlock(&hdd_context_lock);
3201
Jeff Johnson295189b2012-06-20 16:38:30 -07003202 return VOS_STATUS_SUCCESS;
3203}
3204
3205VOS_STATUS wlan_hdd_exit_lowpower(hdd_context_t *pHddCtx,
3206 hdd_adapter_t *pAdapter)
3207{
3208 VOS_STATUS vos_Status;
3209
3210 if ((NULL == pAdapter) || (NULL == pHddCtx))
3211 {
3212 hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid pointer");
3213 return VOS_STATUS_E_FAULT;
3214 }
3215
3216 /**Exit from Deep sleep or standby if we get the driver
3217 START cmd from android GUI
3218 */
3219 if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop)
3220 {
3221 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit "
3222 "from Stand by",__func__);
3223 vos_Status = hdd_exit_standby(pHddCtx);
3224 }
3225 else if (eHDD_SUSPEND_DEEP_SLEEP == pHddCtx->hdd_ps_state)
3226 {
3227 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit "
3228 "from deep sleep",__func__);
3229 vos_Status = hdd_exit_deep_sleep(pHddCtx, pAdapter);
3230 }
3231 else
3232 {
3233 hddLog(VOS_TRACE_LEVEL_WARN, "%s: Not in standby or deep sleep. "
3234 "Ignore start cmd %d", __func__, pHddCtx->hdd_ps_state);
3235 vos_Status = VOS_STATUS_SUCCESS;
3236 }
3237
3238 return vos_Status;
3239}
3240
3241VOS_STATUS wlan_hdd_enter_lowpower(hdd_context_t *pHddCtx)
3242{
3243 VOS_STATUS vos_Status = VOS_STATUS_E_FAILURE;
3244
3245 if (NULL == pHddCtx)
3246 {
Agarwal Ashish971c2882013-10-30 20:11:12 +05303247 hddLog(VOS_TRACE_LEVEL_ERROR, "HDD context NULL");
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 return VOS_STATUS_E_FAULT;
3249 }
3250
3251 if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop)
3252 {
3253 //Execute standby procedure.
3254 //Executing standby procedure will cause the STA to
3255 //disassociate first and then the chip will be put into standby.
3256 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering Stand by mode");
3257 vos_Status = hdd_enter_standby(pHddCtx);
3258 }
3259 else if (WLAN_MAP_DRIVER_STOP_TO_DEEP_SLEEP ==
3260 pHddCtx->cfg_ini->nEnableDriverStop)
3261 {
3262 //Execute deep sleep procedure
3263 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering "
Arif Hussain6d2a3322013-11-17 19:50:10 -08003264 "deep sleep mode");
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 //Deep sleep not supported
3266 vos_Status = hdd_enter_standby(pHddCtx);
3267 }
3268 else
3269 {
3270 hddLog(VOS_TRACE_LEVEL_INFO_LOW, "%s: Driver stop is not enabled %d",
3271 __func__, pHddCtx->cfg_ini->nEnableDriverStop);
3272 vos_Status = VOS_STATUS_SUCCESS;
3273 }
3274
3275 return vos_Status;
3276}
3277
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003278
3279void* wlan_hdd_change_country_code_callback(void *pAdapter)
3280{
3281
3282 hdd_adapter_t *call_back_pAdapter = pAdapter;
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003283 complete(&call_back_pAdapter->change_country_code);
3284
3285 return NULL;
3286}
3287
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05303288static int __iw_set_priv(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07003289 struct iw_request_info *info,
3290 union iwreq_data *wrqu, char *extra)
3291{
3292 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Arif Hussain24bfa702014-01-22 13:51:30 -08003293 char *cmd = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003294 int cmd_len = wrqu->data.length;
3295 int ret = 0;
Arif Hussain24bfa702014-01-22 13:51:30 -08003296 int rc = 0;
3297 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
3298
Jeff Johnson295189b2012-06-20 16:38:30 -07003299 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
3300
3301 ENTER();
Arif Hussain24bfa702014-01-22 13:51:30 -08003302 cmd = mem_alloc_copy_from_user_helper(wrqu->data.pointer,
3303 wrqu->data.length);
3304 if (NULL == cmd)
3305 {
3306 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3307 "mem_alloc_copy_from_user_helper fail");
3308 return -ENOMEM;
3309 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003310
3311 if (ioctl_debug)
3312 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003313 pr_info("%s: req [%s] len [%d]\n", __func__, cmd, cmd_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07003314 }
3315
Madan Mohan Koyyalamudif9bdd4e2012-10-30 18:05:03 -07003316 hddLog(VOS_TRACE_LEVEL_INFO_MED,
3317 "%s: ***Received %s cmd from Wi-Fi GUI***", __func__, cmd);
Jeff Johnson295189b2012-06-20 16:38:30 -07003318
3319 if (pHddCtx->isLogpInProgress) {
Arif Hussain24bfa702014-01-22 13:51:30 -08003320 if (ioctl_debug)
3321 {
3322 pr_info("%s: RESTART in progress\n", __func__);
3323 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003324
Arif Hussain24bfa702014-01-22 13:51:30 -08003325 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
Jeff Johnson295189b2012-06-20 16:38:30 -07003326 "%s:LOGP in Progress. Ignore!!!",__func__);
Arif Hussain24bfa702014-01-22 13:51:30 -08003327 kfree(cmd);
3328 return -EBUSY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003329 }
3330
Arif Hussain24bfa702014-01-22 13:51:30 -08003331 if (strncmp(cmd, "CSCAN", 5) == 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003332 {
Arif Hussain24bfa702014-01-22 13:51:30 -08003333 if (eHAL_STATUS_SUCCESS != iw_set_cscan(dev, info, wrqu, cmd)) {
3334 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3335 "%s: Error in iw_set_scan!", __func__);
3336 rc = -EINVAL;
3337 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 }
3339 else if( strcasecmp(cmd, "start") == 0 ) {
3340
Arif Hussain6d2a3322013-11-17 19:50:10 -08003341 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Start command");
Jeff Johnson295189b2012-06-20 16:38:30 -07003342 /*Exit from Deep sleep or standby if we get the driver START cmd from android GUI*/
Jeff Johnson295189b2012-06-20 16:38:30 -07003343
Arif Hussain24bfa702014-01-22 13:51:30 -08003344 vos_status = wlan_hdd_exit_lowpower(pHddCtx, pAdapter);
3345 if (vos_status == VOS_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07003346 {
3347 union iwreq_data wrqu;
3348 char buf[10];
3349
3350 memset(&wrqu, 0, sizeof(wrqu));
3351 wrqu.data.length = strlcpy(buf, "START", sizeof(buf));
3352 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
3353 }
3354 else
3355 {
Arif Hussain24bfa702014-01-22 13:51:30 -08003356 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: START CMD Status %d", __func__, vos_status);
3357 rc = -EIO;
Jeff Johnson295189b2012-06-20 16:38:30 -07003358 }
3359 goto done;
3360 }
3361 else if( strcasecmp(cmd, "stop") == 0 )
3362 {
3363 union iwreq_data wrqu;
3364 char buf[10];
3365
Arif Hussain6d2a3322013-11-17 19:50:10 -08003366 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Stop command");
Jeff Johnson295189b2012-06-20 16:38:30 -07003367
3368 wlan_hdd_enter_lowpower(pHddCtx);
3369 memset(&wrqu, 0, sizeof(wrqu));
3370 wrqu.data.length = strlcpy(buf, "STOP", sizeof(buf));
3371 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003372 goto done;
3373 }
3374 else if (strcasecmp(cmd, "macaddr") == 0)
3375 {
3376 ret = snprintf(cmd, cmd_len, "Macaddr = " MAC_ADDRESS_STR,
3377 MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes));
3378 }
3379 else if (strcasecmp(cmd, "scan-active") == 0)
3380 {
c_hpothudbefd3e2014-04-28 15:59:47 +05303381 hddLog(VOS_TRACE_LEVEL_ERROR,
3382 FL("making default scan to active"));
Madan Mohan Koyyalamudi2a1ba772012-10-11 14:59:06 -07003383 pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -07003384 ret = snprintf(cmd, cmd_len, "OK");
3385 }
3386 else if (strcasecmp(cmd, "scan-passive") == 0)
3387 {
c_hpothudbefd3e2014-04-28 15:59:47 +05303388 hddLog(VOS_TRACE_LEVEL_ERROR,
3389 FL("making default scan to passive"));
Madan Mohan Koyyalamudi2a1ba772012-10-11 14:59:06 -07003390 pHddCtx->scan_info.scan_mode = eSIR_PASSIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 ret = snprintf(cmd, cmd_len, "OK");
3392 }
3393 else if( strcasecmp(cmd, "scan-mode") == 0 )
3394 {
Madan Mohan Koyyalamudi2a1ba772012-10-11 14:59:06 -07003395 ret = snprintf(cmd, cmd_len, "ScanMode = %u", pHddCtx->scan_info.scan_mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003396 }
3397 else if( strcasecmp(cmd, "linkspeed") == 0 )
3398 {
Arif Hussain24bfa702014-01-22 13:51:30 -08003399 ret = iw_get_linkspeed(dev, info, wrqu, cmd);
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 }
3401 else if( strncasecmp(cmd, "COUNTRY", 7) == 0 ) {
3402 char *country_code;
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003403 long lrc;
Arif Hussain24bfa702014-01-22 13:51:30 -08003404 eHalStatus eHal_status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003405
3406 country_code = cmd + 8;
3407
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003408 init_completion(&pAdapter->change_country_code);
3409
Arif Hussain24bfa702014-01-22 13:51:30 -08003410 eHal_status = sme_ChangeCountryCode(pHddCtx->hHal,
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003411 (void *)(tSmeChangeCountryCallback)wlan_hdd_change_country_code_callback,
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 country_code,
3413 pAdapter,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05303414 pHddCtx->pvosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05303415 eSIR_TRUE,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05303416 eSIR_TRUE);
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003417
3418 /* Wait for completion */
3419 lrc = wait_for_completion_interruptible_timeout(&pAdapter->change_country_code,
3420 msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
3421
3422 if (lrc <= 0)
3423 {
3424 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while setting country code ",
Arif Hussain24bfa702014-01-22 13:51:30 -08003425 __func__, "Timed out");
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003426 }
3427
Arif Hussain24bfa702014-01-22 13:51:30 -08003428 if (eHAL_STATUS_SUCCESS != eHal_status)
Jeff Johnson295189b2012-06-20 16:38:30 -07003429 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003430 VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
Arif Hussain24bfa702014-01-22 13:51:30 -08003431 "%s: SME Change Country code fail", __func__);
3432 kfree(cmd);
3433 return -EIO;
Jeff Johnson295189b2012-06-20 16:38:30 -07003434 }
3435 }
3436 else if( strncasecmp(cmd, "rssi", 4) == 0 )
3437 {
Arif Hussain24bfa702014-01-22 13:51:30 -08003438 ret = iw_get_rssi(dev, info, wrqu, cmd);
Jeff Johnson295189b2012-06-20 16:38:30 -07003439 }
3440 else if( strncasecmp(cmd, "powermode", 9) == 0 ) {
3441 int mode;
Wilson Yang1be3e652013-10-09 15:18:31 -07003442 char *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07003443
Wilson Yang1be3e652013-10-09 15:18:31 -07003444 if (9 < cmd_len)
3445 {
3446 ptr = (char*)(cmd + 9);
3447
3448 }else{
3449 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3450 "CMD LENGTH %d is not correct",cmd_len);
Arif Hussain24bfa702014-01-22 13:51:30 -08003451 kfree(cmd);
3452 return -EINVAL;
Wilson Yang1be3e652013-10-09 15:18:31 -07003453 }
3454
3455 if (1 != sscanf(ptr,"%d",&mode))
3456 {
3457 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3458 "powermode input %s is not correct",ptr);
Arif Hussain24bfa702014-01-22 13:51:30 -08003459 kfree(cmd);
3460 return -EIO;
Wilson Yang1be3e652013-10-09 15:18:31 -07003461 }
3462
Jeff Johnson295189b2012-06-20 16:38:30 -07003463 wlan_hdd_enter_bmps(pAdapter, mode);
3464 /*TODO:Set the power mode*/
3465 }
3466 else if (strncasecmp(cmd, "getpower", 8) == 0 ) {
3467 v_U32_t pmc_state;
3468 v_U16_t value;
3469
3470 pmc_state = pmcGetPmcState(WLAN_HDD_GET_HAL_CTX(pAdapter));
3471 if(pmc_state == BMPS) {
3472 value = DRIVER_POWER_MODE_AUTO;
3473 }
3474 else {
3475 value = DRIVER_POWER_MODE_ACTIVE;
3476 }
3477 ret = snprintf(cmd, cmd_len, "powermode = %u", value);
3478 }
3479 else if( strncasecmp(cmd, "btcoexmode", 10) == 0 ) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003480 hddLog( VOS_TRACE_LEVEL_INFO, "btcoexmode");
Jeff Johnson295189b2012-06-20 16:38:30 -07003481 /*TODO: set the btcoexmode*/
3482 }
3483 else if( strcasecmp(cmd, "btcoexstat") == 0 ) {
3484
Arif Hussain6d2a3322013-11-17 19:50:10 -08003485 hddLog(VOS_TRACE_LEVEL_INFO, "BtCoex Status");
Jeff Johnson295189b2012-06-20 16:38:30 -07003486 /*TODO: Return the btcoex status*/
3487 }
3488 else if( strcasecmp(cmd, "rxfilter-start") == 0 ) {
3489
Arif Hussain6d2a3322013-11-17 19:50:10 -08003490 hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Start command");
Jeff Johnson295189b2012-06-20 16:38:30 -07003491
3492 /*TODO: Enable Rx data Filter*/
3493 }
3494 else if( strcasecmp(cmd, "rxfilter-stop") == 0 ) {
3495
Arif Hussain6d2a3322013-11-17 19:50:10 -08003496 hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Stop command");
Jeff Johnson295189b2012-06-20 16:38:30 -07003497
3498 /*TODO: Disable Rx data Filter*/
3499 }
3500 else if( strcasecmp(cmd, "rxfilter-statistics") == 0 ) {
3501
Arif Hussain6d2a3322013-11-17 19:50:10 -08003502 hddLog( VOS_TRACE_LEVEL_INFO, "Rx Data Filter Statistics command");
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 /*TODO: rxfilter-statistics*/
3504 }
3505 else if( strncasecmp(cmd, "rxfilter-add", 12) == 0 ) {
3506
Arif Hussain6d2a3322013-11-17 19:50:10 -08003507 hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-add");
Jeff Johnson295189b2012-06-20 16:38:30 -07003508 /*TODO: rxfilter-add*/
3509 }
3510 else if( strncasecmp(cmd, "rxfilter-remove",15) == 0 ) {
3511
Arif Hussain6d2a3322013-11-17 19:50:10 -08003512 hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-remove");
Jeff Johnson295189b2012-06-20 16:38:30 -07003513 /*TODO: rxfilter-remove*/
3514 }
3515#ifdef FEATURE_WLAN_SCAN_PNO
Madan Mohan Koyyalamudi03978e12012-10-30 17:52:55 -07003516 else if( strncasecmp(cmd, "pnosetup", 8) == 0 ) {
3517 hddLog( VOS_TRACE_LEVEL_INFO, "pnosetup");
3518 /*TODO: support pnosetup*/
3519 }
3520 else if( strncasecmp(cmd, "pnoforce", 8) == 0 ) {
3521 hddLog( VOS_TRACE_LEVEL_INFO, "pnoforce");
3522 /*TODO: support pnoforce*/
3523 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003524 else if( strncasecmp(cmd, "pno",3) == 0 ) {
3525
Arif Hussain6d2a3322013-11-17 19:50:10 -08003526 hddLog( VOS_TRACE_LEVEL_INFO, "pno");
Arif Hussain24bfa702014-01-22 13:51:30 -08003527 vos_status = iw_set_pno(dev, info, wrqu, cmd, 3);
3528 kfree(cmd);
3529 return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003530 }
3531 else if( strncasecmp(cmd, "rssifilter",10) == 0 ) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003532 hddLog( VOS_TRACE_LEVEL_INFO, "rssifilter");
Arif Hussain24bfa702014-01-22 13:51:30 -08003533 vos_status = iw_set_rssi_filter(dev, info, wrqu, cmd, 10);
3534 kfree(cmd);
3535 return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003536 }
3537#endif /*FEATURE_WLAN_SCAN_PNO*/
3538 else if( strncasecmp(cmd, "powerparams",11) == 0 ) {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003539 hddLog( VOS_TRACE_LEVEL_INFO, "powerparams");
Arif Hussain24bfa702014-01-22 13:51:30 -08003540 vos_status = iw_set_power_params(dev, info, wrqu, cmd, 11);
3541 kfree(cmd);
3542 return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003543 }
3544 else if( 0 == strncasecmp(cmd, "CONFIG-TX-TRACKING", 18) ) {
3545 tSirTxPerTrackingParam tTxPerTrackingParam;
Wilson Yang1be3e652013-10-09 15:18:31 -07003546 char *ptr;
3547
3548 if (18 < cmd_len)
3549 {
3550 ptr = (char*)(cmd + 18);
3551 }else{
3552 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3553 "CMD LENGTH %d is not correct",cmd_len);
Arif Hussain24bfa702014-01-22 13:51:30 -08003554 kfree(cmd);
3555 return -EINVAL;
Wilson Yang1be3e652013-10-09 15:18:31 -07003556 }
3557
Jeff Johnson02797792013-10-26 19:17:13 -07003558 if (4 != sscanf(ptr,"%hhu %hhu %hhu %u",
Wilson Yang1be3e652013-10-09 15:18:31 -07003559 &(tTxPerTrackingParam.ucTxPerTrackingEnable),
3560 &(tTxPerTrackingParam.ucTxPerTrackingPeriod),
3561 &(tTxPerTrackingParam.ucTxPerTrackingRatio),
3562 &(tTxPerTrackingParam.uTxPerTrackingWatermark)))
3563 {
3564 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3565 "CONFIG-TX-TRACKING %s input is not correct",ptr);
Arif Hussain24bfa702014-01-22 13:51:30 -08003566 kfree(cmd);
3567 return -EIO;
Wilson Yang1be3e652013-10-09 15:18:31 -07003568 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003569
3570 // parameters checking
3571 // period has to be larger than 0
3572 if (0 == tTxPerTrackingParam.ucTxPerTrackingPeriod)
3573 {
3574 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Period input is not correct");
Arif Hussain24bfa702014-01-22 13:51:30 -08003575 kfree(cmd);
3576 return -EIO;
Jeff Johnson295189b2012-06-20 16:38:30 -07003577 }
3578
3579 // use default value 5 is the input is not reasonable. in unit of 10%
3580 if ((tTxPerTrackingParam.ucTxPerTrackingRatio > TX_PER_TRACKING_MAX_RATIO) || (0 == tTxPerTrackingParam.ucTxPerTrackingRatio))
3581 {
3582 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Ratio input is not good. use default 5");
3583 tTxPerTrackingParam.ucTxPerTrackingRatio = TX_PER_TRACKING_DEFAULT_RATIO;
3584 }
3585
3586 // default is 5
3587 if (0 == tTxPerTrackingParam.uTxPerTrackingWatermark)
3588 {
3589 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Tx Packet number input is not good. use default 5");
3590 tTxPerTrackingParam.uTxPerTrackingWatermark = TX_PER_TRACKING_DEFAULT_WATERMARK;
3591 }
3592
Arif Hussain24bfa702014-01-22 13:51:30 -08003593 if (eHAL_STATUS_SUCCESS !=
3594 sme_SetTxPerTracking(pHddCtx->hHal,
3595 hdd_tx_per_hit_cb,
3596 (void*)pAdapter, &tTxPerTrackingParam)) {
Jeff Johnson295189b2012-06-20 16:38:30 -07003597 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Set Tx PER Tracking Failed!");
Arif Hussain24bfa702014-01-22 13:51:30 -08003598 rc = -EIO;
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 }
3600 }
3601 else {
Madan Mohan Koyyalamudif9bdd4e2012-10-30 18:05:03 -07003602 hddLog( VOS_TRACE_LEVEL_WARN, "%s: Unsupported GUI command %s",
3603 __func__, cmd);
Jeff Johnson295189b2012-06-20 16:38:30 -07003604 }
3605done:
3606 /* many of the commands write information back into the command
3607 string using snprintf(). check the return value here in one
3608 place */
3609 if ((ret < 0) || (ret >= cmd_len))
3610 {
3611 /* there was an encoding error or overflow */
Arif Hussain24bfa702014-01-22 13:51:30 -08003612 rc = -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003613 }
Arif Hussain7adce1b2013-11-11 22:59:34 -08003614 else if (ret > 0)
3615 {
3616 if (copy_to_user(wrqu->data.pointer, cmd, ret))
3617 {
3618 hddLog(VOS_TRACE_LEVEL_ERROR,
3619 "%s: failed to copy data to user buffer", __func__);
Arif Hussain24bfa702014-01-22 13:51:30 -08003620 kfree(cmd);
Arif Hussain7adce1b2013-11-11 22:59:34 -08003621 return -EFAULT;
3622 }
3623 wrqu->data.length = ret;
3624 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003625
3626 if (ioctl_debug)
3627 {
3628 pr_info("%s: rsp [%s] len [%d] status %d\n",
Arif Hussain24bfa702014-01-22 13:51:30 -08003629 __func__, cmd, wrqu->data.length, rc);
Jeff Johnson295189b2012-06-20 16:38:30 -07003630 }
Arif Hussain24bfa702014-01-22 13:51:30 -08003631 kfree(cmd);
3632 return rc;
Jeff Johnson295189b2012-06-20 16:38:30 -07003633}
3634
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05303635static int iw_set_priv(struct net_device *dev,
3636 struct iw_request_info *info,
3637 union iwreq_data *wrqu, char *extra)
3638{
3639 int ret;
3640 vos_ssr_protect(__func__);
3641 ret = __iw_set_priv(dev, info, wrqu, extra);
3642 vos_ssr_unprotect(__func__);
3643
3644 return ret;
3645}
3646
Jeff Johnson295189b2012-06-20 16:38:30 -07003647static int iw_set_nick(struct net_device *dev,
3648 struct iw_request_info *info,
3649 union iwreq_data *wrqu, char *extra)
3650{
3651 ENTER();
3652 return 0;
3653}
3654
3655static int iw_get_nick(struct net_device *dev,
3656 struct iw_request_info *info,
3657 union iwreq_data *wrqu, char *extra)
3658{
3659 ENTER();
3660 return 0;
3661}
3662
3663static struct iw_statistics *get_wireless_stats(struct net_device *dev)
3664{
3665 ENTER();
3666 return NULL;
3667}
3668
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05303669static int __iw_set_encode(struct net_device *dev,
3670 struct iw_request_info *info,
3671 union iwreq_data *wrqu,char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07003672
3673{
3674 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
3675 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
3676 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
3677 struct iw_point *encoderq = &(wrqu->encoding);
3678 v_U32_t keyId;
3679 v_U8_t key_length;
3680 eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE;
3681 v_BOOL_t fKeyPresent = 0;
3682 int i;
3683 eHalStatus status = eHAL_STATUS_SUCCESS;
3684
3685
3686 ENTER();
3687
3688 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
3689 {
3690 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
3691 "%s:LOGP in Progress. Ignore!!!",__func__);
3692 return 0;
3693 }
3694
3695
3696 keyId = encoderq->flags & IW_ENCODE_INDEX;
3697
3698 if(keyId)
3699 {
3700 if(keyId > MAX_WEP_KEYS)
3701 {
3702 return -EINVAL;
3703 }
3704
3705 fKeyPresent = 1;
3706 keyId--;
3707 }
3708 else
3709 {
3710 fKeyPresent = 0;
3711 }
3712
3713
3714 if(wrqu->data.flags & IW_ENCODE_DISABLED)
3715 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003716 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****iwconfig wlan0 key off*****");
Jeff Johnson295189b2012-06-20 16:38:30 -07003717 if(!fKeyPresent) {
3718
3719 for(i=0;i < CSR_MAX_NUM_KEY; i++) {
3720
3721 if(pWextState->roamProfile.Keys.KeyMaterial[i])
3722 pWextState->roamProfile.Keys.KeyLength[i] = 0;
3723 }
3724 }
3725 pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
3726 pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED;
3727 pWextState->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
3728 pWextState->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
3729
3730 pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
3731 pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
3732
3733 if(eConnectionState_Associated == pHddStaCtx->conn_info.connState)
3734 {
3735 INIT_COMPLETION(pAdapter->disconnect_comp_var);
3736 status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED );
Jeff Johnson43971f52012-07-17 12:26:56 -07003737 if(eHAL_STATUS_SUCCESS == status)
c_hpothub8245442013-11-20 23:41:09 +05303738 {
3739 long ret;
3740 ret = wait_for_completion_interruptible_timeout(
3741 &pAdapter->disconnect_comp_var,
3742 msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
3743 if (ret <= 0)
3744 hddLog(VOS_TRACE_LEVEL_ERROR,
3745 FL("failed wait on disconnect_comp_var %ld"), ret);
3746 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003747 }
3748
3749 return status;
3750
3751 }
3752
3753 if (wrqu->data.flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED))
3754 {
3755 hddLog(VOS_TRACE_LEVEL_INFO, "iwconfig wlan0 key on");
3756
3757 pHddStaCtx->conn_info.authType = (encoderq->flags & IW_ENCODE_RESTRICTED) ? eCSR_AUTH_TYPE_SHARED_KEY : eCSR_AUTH_TYPE_OPEN_SYSTEM;
3758
3759 }
3760
3761
3762 if(wrqu->data.length > 0)
3763 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003764 hddLog(VOS_TRACE_LEVEL_INFO, "%s : wrqu->data.length : %d",__func__,wrqu->data.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003765
3766 key_length = wrqu->data.length;
3767
3768 /* IW_ENCODING_TOKEN_MAX is the value that is set for wrqu->data.length by iwconfig.c when 'iwconfig wlan0 key on' is issued.*/
3769
3770 if(5 == key_length)
3771 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003772 hddLog(VOS_TRACE_LEVEL_INFO, "%s: Call with WEP40,key_len=%d",__func__,key_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003773
3774 if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
3775 {
3776 encryptionType = eCSR_ENCRYPT_TYPE_WEP40;
3777 }
3778 else
3779 {
3780 encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
3781 }
3782 }
3783 else if(13 == key_length)
3784 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003785 hddLog(VOS_TRACE_LEVEL_INFO, "%s:Call with WEP104,key_len:%d",__func__,key_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003786
3787 if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType))
3788 {
3789 encryptionType = eCSR_ENCRYPT_TYPE_WEP104;
3790 }
3791 else
3792 {
3793 encryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3794 }
3795 }
3796 else
3797 {
3798 hddLog(VOS_TRACE_LEVEL_WARN, "%s: Invalid WEP key length :%d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003799 __func__, key_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003800 return -EINVAL;
3801 }
3802
3803 pHddStaCtx->conn_info.ucEncryptionType = encryptionType;
3804 pHddStaCtx->conn_info.mcEncryptionType = encryptionType;
3805 pWextState->roamProfile.EncryptionType.numEntries = 1;
3806 pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType;
3807 pWextState->roamProfile.mcEncryptionType.numEntries = 1;
3808 pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType;
3809
3810 if((eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) &&
3811 ((eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) ||
3812 (eCSR_AUTH_TYPE_SHARED_KEY == pHddStaCtx->conn_info.authType)))
3813 {
3814
3815 vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[keyId][0],extra,key_length);
3816
3817 pWextState->roamProfile.Keys.KeyLength[keyId] = (v_U8_t)key_length;
3818 pWextState->roamProfile.Keys.defaultIndex = (v_U8_t)keyId;
3819
3820 return status;
3821 }
3822 }
3823
3824 return 0;
3825}
3826
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05303827static int iw_set_encode(struct net_device *dev,
3828 struct iw_request_info *info,
3829 union iwreq_data *wrqu,char *extra)
3830{
3831 int ret;
3832
3833 vos_ssr_protect(__func__);
3834 ret = __iw_set_encode(dev, info, wrqu, extra);
3835 vos_ssr_unprotect(__func__);
3836
3837 return ret;
3838}
3839
3840static int __iw_get_encodeext(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07003841 struct iw_request_info *info,
3842 struct iw_point *dwrq,
3843 char *extra)
3844{
3845 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
3846 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
3847 tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile);
3848 int keyId;
3849 eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE;
3850 eCsrAuthType authType = eCSR_AUTH_TYPE_NONE;
3851 int i;
3852
3853 ENTER();
3854
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08003855 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
3856 {
3857 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
3858 "%s:LOGP in Progress. Ignore!!!", __func__);
3859 return -EBUSY;
3860 }
3861
Jeff Johnson295189b2012-06-20 16:38:30 -07003862 keyId = pRoamProfile->Keys.defaultIndex;
3863
3864 if(keyId < 0 || keyId >= MAX_WEP_KEYS)
3865 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08003866 hddLog(LOG1,"%s: Invalid keyId : %d",__func__,keyId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 return -EINVAL;
3868 }
3869
3870 if(pRoamProfile->Keys.KeyLength[keyId] > 0)
3871 {
3872 dwrq->flags |= IW_ENCODE_ENABLED;
3873 dwrq->length = pRoamProfile->Keys.KeyLength[keyId];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303874 vos_mem_copy(extra, &(pRoamProfile->Keys.KeyMaterial[keyId][0]),
3875 pRoamProfile->Keys.KeyLength[keyId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003876 }
3877 else
3878 {
3879 dwrq->flags |= IW_ENCODE_DISABLED;
3880 }
3881
3882 for(i=0; i < MAX_WEP_KEYS; i++)
3883 {
3884 if(pRoamProfile->Keys.KeyMaterial[i] == NULL)
3885 {
3886 continue;
3887 }
3888 else
3889 {
3890 break;
3891 }
3892 }
3893
3894 if(MAX_WEP_KEYS == i)
3895 {
3896 dwrq->flags |= IW_ENCODE_NOKEY;
3897 }
3898 else
3899 {
3900 dwrq->flags |= IW_ENCODE_ENABLED;
3901 }
3902
3903 encryptionType = pRoamProfile->EncryptionType.encryptionType[0];
3904
3905 if(eCSR_ENCRYPT_TYPE_NONE == encryptionType)
3906 {
3907 dwrq->flags |= IW_ENCODE_DISABLED;
3908 }
3909
3910 authType = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType;
3911
3912 if(IW_AUTH_ALG_OPEN_SYSTEM == authType)
3913 {
3914 dwrq->flags |= IW_ENCODE_OPEN;
3915 }
3916 else
3917 {
3918 dwrq->flags |= IW_ENCODE_RESTRICTED;
3919 }
3920 EXIT();
3921 return 0;
3922
3923}
3924
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05303925static int iw_get_encodeext(struct net_device *dev,
3926 struct iw_request_info *info,
3927 struct iw_point *dwrq,
3928 char *extra)
3929{
3930 int ret;
3931 vos_ssr_protect(__func__);
3932 ret = __iw_get_encodeext(dev, info, dwrq, extra);
3933 vos_ssr_unprotect(__func__);
3934
3935 return ret;
3936}
3937
3938static int __iw_set_encodeext(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07003939 struct iw_request_info *info,
3940 union iwreq_data *wrqu, char *extra)
3941{
3942 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
3943 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
3944 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
3945 eHalStatus halStatus= eHAL_STATUS_SUCCESS;
3946
3947 tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile;
3948 v_U32_t status = 0;
3949
3950 struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
3951
3952 v_U8_t groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
3953
3954 int key_index;
3955 struct iw_point *encoding = &wrqu->encoding;
3956 tCsrRoamSetKey setKey;
3957 v_U32_t roamId= 0xFF;
3958 VOS_STATUS vos_status;
3959
3960 ENTER();
3961
3962 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
3963 {
3964 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
3965 "%s:LOGP in Progress. Ignore!!!",__func__);
3966 return 0;
3967 }
3968
3969 key_index = encoding->flags & IW_ENCODE_INDEX;
3970
3971 if(key_index > 0) {
3972
3973 /*Convert from 1-based to 0-based keying*/
3974 key_index--;
3975 }
3976 if(!ext->key_len) {
3977
3978 /*Set the encrytion type to NONE*/
3979 pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
3980 return status;
3981 }
3982
3983 if(eConnectionState_NotConnected == pHddStaCtx->conn_info.connState &&
3984 (IW_ENCODE_ALG_WEP == ext->alg))
3985 {
3986 if(IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) {
3987
Agarwal Ashish971c2882013-10-30 20:11:12 +05303988 VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
3989 ("Invalid Configuration:%s"),__func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 return -EINVAL;
3991 }
3992 else {
3993 /*Static wep, update the roam profile with the keys */
3994 if(ext->key && (ext->key_len <= eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) &&
3995 key_index < CSR_MAX_NUM_KEY) {
3996 vos_mem_copy(&pRoamProfile->Keys.KeyMaterial[key_index][0],ext->key,ext->key_len);
3997 pRoamProfile->Keys.KeyLength[key_index] = (v_U8_t)ext->key_len;
3998
3999 if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
4000 pRoamProfile->Keys.defaultIndex = (v_U8_t)key_index;
4001
4002 }
4003 }
4004 return status;
4005 }
4006
4007 vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey));
4008
4009 setKey.keyId = key_index;
4010 setKey.keyLength = ext->key_len;
4011
4012 if(ext->key_len <= CSR_MAX_KEY_LEN) {
4013 vos_mem_copy(&setKey.Key[0],ext->key,ext->key_len);
4014 }
4015
4016 if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
4017 /*Key direction for group is RX only*/
4018 setKey.keyDirection = eSIR_RX_ONLY;
4019 vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN);
4020 }
4021 else {
4022
4023 setKey.keyDirection = eSIR_TX_RX;
4024 vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN);
4025 }
4026
4027 /*For supplicant pae role is zero*/
4028 setKey.paeRole = 0;
4029
4030 switch(ext->alg)
4031 {
4032 case IW_ENCODE_ALG_NONE:
4033 setKey.encType = eCSR_ENCRYPT_TYPE_NONE;
4034 break;
4035
4036 case IW_ENCODE_ALG_WEP:
4037 setKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104;
4038 break;
4039
4040 case IW_ENCODE_ALG_TKIP:
4041 {
4042 v_U8_t *pKey = &setKey.Key[0];
4043
4044 setKey.encType = eCSR_ENCRYPT_TYPE_TKIP;
4045
4046 vos_mem_zero(pKey, CSR_MAX_KEY_LEN);
4047
4048 /*Supplicant sends the 32bytes key in this order
4049
4050 |--------------|----------|----------|
4051 | Tk1 |TX-MIC | RX Mic |
4052 |--------------|----------|----------|
4053 <---16bytes---><--8bytes--><--8bytes-->
4054
4055 */
4056 /*Sme expects the 32 bytes key to be in the below order
4057
4058 |--------------|----------|----------|
4059 | Tk1 |RX-MIC | TX Mic |
4060 |--------------|----------|----------|
4061 <---16bytes---><--8bytes--><--8bytes-->
4062 */
4063 /* Copy the Temporal Key 1 (TK1) */
4064 vos_mem_copy(pKey,ext->key,16);
4065
4066 /*Copy the rx mic first*/
4067 vos_mem_copy(&pKey[16],&ext->key[24],8);
4068
4069 /*Copy the tx mic */
4070 vos_mem_copy(&pKey[24],&ext->key[16],8);
4071
4072 }
4073 break;
4074
4075 case IW_ENCODE_ALG_CCMP:
4076 setKey.encType = eCSR_ENCRYPT_TYPE_AES;
4077 break;
4078
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004079#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07004080#define IW_ENCODE_ALG_KRK 6
4081 case IW_ENCODE_ALG_KRK:
4082 setKey.encType = eCSR_ENCRYPT_TYPE_KRK;
4083 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004084#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -07004085
4086 default:
4087 setKey.encType = eCSR_ENCRYPT_TYPE_NONE;
4088 break;
4089 }
4090
4091 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Arif Hussain6d2a3322013-11-17 19:50:10 -08004092 ("%s:cipher_alg:%d key_len[%d] *pEncryptionType :%d"),__func__,(int)ext->alg,(int)ext->key_len,setKey.encType);
Jeff Johnson295189b2012-06-20 16:38:30 -07004093
4094#ifdef WLAN_FEATURE_VOWIFI_11R
Gopichand Nakkala3d295922013-05-07 16:19:14 +05304095 /* The supplicant may attempt to set the PTK once pre-authentication
4096 is done. Save the key in the UMAC and include it in the ADD
4097 BSS request */
Jeff Johnson295189b2012-06-20 16:38:30 -07004098 halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey);
Gopichand Nakkala3d295922013-05-07 16:19:14 +05304099 if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -07004100 {
Gopichand Nakkala3d295922013-05-07 16:19:14 +05304101 hddLog(VOS_TRACE_LEVEL_INFO_MED,
4102 "%s: Update PreAuth Key success", __func__);
4103 return 0;
4104 }
4105 else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED )
4106 {
4107 hddLog(VOS_TRACE_LEVEL_ERROR,
4108 "%s: Update PreAuth Key failed", __func__);
4109 return -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004110 }
4111#endif /* WLAN_FEATURE_VOWIFI_11R */
4112
4113 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY;
4114
4115 vos_status = wlan_hdd_check_ula_done(pAdapter);
4116 if ( vos_status != VOS_STATUS_SUCCESS )
4117 {
4118 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4119 "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d",
4120 __LINE__, vos_status );
4121
4122 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
4123 }
4124
4125 halStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),pAdapter->sessionId, &setKey, &roamId );
4126
4127 if ( halStatus != eHAL_STATUS_SUCCESS )
4128 {
4129 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4130 "[%4d] sme_RoamSetKey returned ERROR status= %d",
4131 __LINE__, halStatus );
4132
4133 pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
4134 }
4135
4136 return halStatus;
4137}
4138
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05304139static int iw_set_encodeext(struct net_device *dev,
4140 struct iw_request_info *info,
4141 union iwreq_data *wrqu, char *extra)
4142{
4143 int ret;
4144
4145 vos_ssr_protect(__func__);
4146 ret = __iw_set_encodeext(dev, info, wrqu, extra);
4147 vos_ssr_unprotect(__func__);
4148
4149 return ret;
4150}
4151
4152static int __iw_set_retry(struct net_device *dev,
4153 struct iw_request_info *info,
4154 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07004155{
4156 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
4157 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
4158
4159 ENTER();
4160
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08004161 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
4162 {
4163 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
4164 "%s:LOGP in Progress. Ignore!!!", __func__);
4165 return -EBUSY;
4166 }
4167
Jeff Johnson295189b2012-06-20 16:38:30 -07004168 if(wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN ||
4169 wrqu->retry.value > WNI_CFG_LONG_RETRY_LIMIT_STAMAX) {
4170
Arif Hussain6d2a3322013-11-17 19:50:10 -08004171 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Invalid Retry-Limit=%d!!"),wrqu->retry.value);
Jeff Johnson295189b2012-06-20 16:38:30 -07004172
4173 return -EINVAL;
4174 }
4175
4176 if(wrqu->retry.flags & IW_RETRY_LIMIT) {
4177
4178 if((wrqu->retry.flags & IW_RETRY_LONG))
4179 {
4180 if ( ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
4181 {
c_hpothub8245442013-11-20 23:41:09 +05304182 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4183 FL("failed to set ini parameter, WNI_CFG_LONG_RETRY_LIMIT"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 return -EIO;
4185 }
4186 }
4187 else if((wrqu->retry.flags & IW_RETRY_SHORT))
4188 {
4189 if ( ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS )
4190 {
c_hpothub8245442013-11-20 23:41:09 +05304191 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4192 FL("failed to set ini parameter, WNI_CFG_SHORT_RETRY_LIMIT"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004193 return -EIO;
4194 }
4195 }
4196 }
4197 else
4198 {
4199 return -EOPNOTSUPP;
4200 }
4201
Arif Hussain6d2a3322013-11-17 19:50:10 -08004202 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Set Retry-Limit=%d!!"),wrqu->retry.value);
Jeff Johnson295189b2012-06-20 16:38:30 -07004203
4204 EXIT();
4205
4206 return 0;
4207
4208}
4209
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05304210static int iw_set_retry(struct net_device *dev,
4211 struct iw_request_info *info,
4212 union iwreq_data *wrqu, char *extra)
4213{
4214 int ret;
4215
4216 vos_ssr_protect(__func__);
4217 ret = __iw_set_retry(dev, info, wrqu, extra);
4218 vos_ssr_unprotect(__func__);
4219
4220 return ret;
4221}
4222
4223static int __iw_get_retry(struct net_device *dev,
4224 struct iw_request_info *info,
4225 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07004226{
4227 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
4228 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
4229 v_U32_t retry = 0;
4230
4231 ENTER();
4232
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08004233 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
4234 {
4235 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
4236 "%s:LOGP in Progress. Ignore!!!", __func__);
4237 return -EBUSY;
4238 }
4239
Jeff Johnson295189b2012-06-20 16:38:30 -07004240 if((wrqu->retry.flags & IW_RETRY_LONG))
4241 {
4242 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
4243
4244 if ( ccmCfgGetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS )
4245 {
c_hpothub8245442013-11-20 23:41:09 +05304246 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
4247 FL("failed to get ini parameter, WNI_CFG_LONG_RETRY_LIMIT"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004248 return -EIO;
4249 }
4250
4251 wrqu->retry.value = retry;
4252 }
4253 else if ((wrqu->retry.flags & IW_RETRY_SHORT))
4254 {
4255 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT;
4256
4257 if ( ccmCfgGetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS )
4258 {
c_hpothub8245442013-11-20 23:41:09 +05304259 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
4260 FL("failed to get ini parameter, WNI_CFG_SHORT_RETRY_LIMIT"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 return -EIO;
4262 }
4263
4264 wrqu->retry.value = retry;
4265 }
4266 else {
4267 return -EOPNOTSUPP;
4268 }
4269
Arif Hussain6d2a3322013-11-17 19:50:10 -08004270 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Retry-Limit=%d!!"),retry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004271
4272 EXIT();
4273
4274 return 0;
4275}
4276
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05304277static int iw_get_retry(struct net_device *dev,
4278 struct iw_request_info *info,
4279 union iwreq_data *wrqu, char *extra)
4280{
4281 int ret;
4282
4283 vos_ssr_protect(__func__);
4284 ret = __iw_get_retry(dev, info, wrqu, extra);
4285 vos_ssr_unprotect(__func__);
4286
4287 return ret;
4288}
4289
4290static int __iw_set_mlme(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07004291 struct iw_request_info *info,
4292 union iwreq_data *wrqu,
4293 char *extra)
4294{
4295 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
4296 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
4297 struct iw_mlme *mlme = (struct iw_mlme *)extra;
4298 eHalStatus status = eHAL_STATUS_SUCCESS;
4299
4300 ENTER();
4301
4302 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
4303 {
4304 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
4305 "%s:LOGP in Progress. Ignore!!!",__func__);
4306 return 0;
4307 }
4308
4309 //reason_code is unused. By default it is set to eCSR_DISCONNECT_REASON_UNSPECIFIED
4310 switch (mlme->cmd) {
4311 case IW_MLME_DISASSOC:
4312 case IW_MLME_DEAUTH:
4313
4314 if( pHddStaCtx->conn_info.connState == eConnectionState_Associated )
4315 {
4316 eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_UNSPECIFIED;
4317
4318 if( mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE )
4319 reason = eCSR_DISCONNECT_REASON_MIC_ERROR;
4320
4321 INIT_COMPLETION(pAdapter->disconnect_comp_var);
4322 status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId,reason);
4323
Jeff Johnson43971f52012-07-17 12:26:56 -07004324 if(eHAL_STATUS_SUCCESS == status)
c_hpothub8245442013-11-20 23:41:09 +05304325 {
4326 long ret;
4327 ret = wait_for_completion_interruptible_timeout(
4328 &pAdapter->disconnect_comp_var,
4329 msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
4330 if (ret <= 0)
4331 hddLog(VOS_TRACE_LEVEL_ERROR,
4332 FL("failed wait on disconnect_comp_var %ld"), ret);
4333 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004334 else
Arif Hussain6d2a3322013-11-17 19:50:10 -08004335 hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate : csrRoamDisconnect failure returned %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004336 __func__, (int)mlme->cmd, (int)status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004337
4338 /* Resetting authKeyMgmt */
4339 (WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->authKeyMgmt = 0;
4340
4341 netif_tx_disable(dev);
4342 netif_carrier_off(dev);
4343
4344 }
4345 else
4346 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004347 hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate called but station is not in associated state", __func__, (int)mlme->cmd );
Jeff Johnson295189b2012-06-20 16:38:30 -07004348 }
4349 break;
4350 default:
Arif Hussain6d2a3322013-11-17 19:50:10 -08004351 hddLog(LOGE,"%s %d Command should be Disassociate/Deauthenticate", __func__, (int)mlme->cmd );
Jeff Johnson295189b2012-06-20 16:38:30 -07004352 return -EINVAL;
4353 }//end of switch
4354
4355 EXIT();
4356
4357 return status;
4358
4359}
4360
Mahesh A Saptasagarc06673e2014-08-13 15:55:42 +05304361static int iw_set_mlme(struct net_device *dev,
4362 struct iw_request_info *info,
4363 union iwreq_data *wrqu,
4364 char *extra)
4365{
4366 int ret;
4367
4368 vos_ssr_protect(__func__);
4369 ret = __iw_set_mlme(dev, info, wrqu, extra);
4370 vos_ssr_unprotect(__func__);
4371
4372 return ret;
4373}
4374
Jeff Johnson295189b2012-06-20 16:38:30 -07004375/* set param sub-ioctls */
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05304376static int __iw_setint_getnone(struct net_device *dev,
4377 struct iw_request_info *info,
4378 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07004379{
4380 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
4381 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
4382 hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
4383 int *value = (int *)extra;
4384 int sub_cmd = value[0];
4385 int set_value = value[1];
4386 int ret = 0; /* success */
4387 int enable_pbm, enable_mp;
4388#ifdef CONFIG_HAS_EARLYSUSPEND
4389 v_U8_t nEnableSuspendOld;
4390#endif
4391 INIT_COMPLETION(pWextState->completion_var);
4392
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08004393 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
4394 {
4395 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
4396 "%s:LOGP in Progress. Ignore!!!", __func__);
4397 return -EBUSY;
4398 }
4399
Jeff Johnson295189b2012-06-20 16:38:30 -07004400 switch(sub_cmd)
4401 {
4402 case WE_SET_11D_STATE:
4403 {
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07004404 tSmeConfigParams smeConfig;
Wilson Yang00256342013-10-10 23:13:38 -07004405 memset(&smeConfig, 0x00, sizeof(smeConfig));
4406
Jeff Johnson295189b2012-06-20 16:38:30 -07004407 if((ENABLE_11D == set_value) || (DISABLE_11D == set_value)) {
4408
4409 sme_GetConfigParam(hHal,&smeConfig);
4410 smeConfig.csrConfig.Is11dSupportEnabled = (v_BOOL_t)set_value;
4411
Arif Hussain6d2a3322013-11-17 19:50:10 -08004412 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%d!!"),smeConfig.csrConfig.Is11dSupportEnabled);
Jeff Johnson295189b2012-06-20 16:38:30 -07004413
4414 sme_UpdateConfig(hHal,&smeConfig);
4415 }
4416 else {
4417 return -EINVAL;
4418 }
4419 break;
4420 }
4421
4422 case WE_WOWL:
4423 {
4424 switch (set_value)
4425 {
4426 case 0x00:
c_hpothu01484c02014-05-16 14:05:15 +05304427 hdd_exit_wowl(pAdapter, eWOWL_EXIT_USER);
Jeff Johnson295189b2012-06-20 16:38:30 -07004428 break;
4429 case 0x01:
4430 case 0x02:
4431 case 0x03:
4432 enable_mp = (set_value & 0x01) ? 1 : 0;
4433 enable_pbm = (set_value & 0x02) ? 1 : 0;
Arif Hussain6d2a3322013-11-17 19:50:10 -08004434 hddLog(LOGE, "magic packet ? = %s pattern byte matching ? = %s",
Jeff Johnson295189b2012-06-20 16:38:30 -07004435 (enable_mp ? "YES":"NO"), (enable_pbm ? "YES":"NO"));
4436 hdd_enter_wowl(pAdapter, enable_mp, enable_pbm);
4437 break;
4438 default:
Arif Hussain6d2a3322013-11-17 19:50:10 -08004439 hddLog(LOGE, "Invalid arg %d in WE_WOWL IOCTL", set_value);
Jeff Johnson295189b2012-06-20 16:38:30 -07004440 ret = -EINVAL;
4441 break;
4442 }
4443
4444 break;
4445 }
4446 case WE_SET_POWER:
4447 {
4448 switch (set_value)
4449 {
4450 case 0: //Full Power
4451 {
4452 struct statsContext context;
4453 eHalStatus status;
4454
4455 init_completion(&context.completion);
4456
4457 context.pAdapter = pAdapter;
4458 context.magic = POWER_CONTEXT_MAGIC;
4459
4460 status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter),
4461 iw_power_callback_fn, &context,
4462 eSME_FULL_PWR_NEEDED_BY_HDD);
Jeff Johnson72a40512013-12-19 10:14:15 -08004463 if (eHAL_STATUS_PMC_PENDING == status)
Jeff Johnson295189b2012-06-20 16:38:30 -07004464 {
4465 int lrc = wait_for_completion_interruptible_timeout(
4466 &context.completion,
4467 msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
Jeff Johnson72a40512013-12-19 10:14:15 -08004468
Jeff Johnson295189b2012-06-20 16:38:30 -07004469 if (lrc <= 0)
4470 {
Jeff Johnson72a40512013-12-19 10:14:15 -08004471 hddLog(VOS_TRACE_LEVEL_ERROR,
4472 "%s: SME %s while requesting fullpower",
4473 __func__, (0 == lrc) ?
4474 "timeout" : "interrupt");
Jeff Johnson295189b2012-06-20 16:38:30 -07004475 }
4476 }
Jeff Johnson72a40512013-12-19 10:14:15 -08004477 /* either we have a response or we timed out. if we timed
4478 out there is a race condition such that the callback
4479 function could be executing at the same time we are. of
4480 primary concern is if the callback function had already
4481 verified the "magic" but had not yet set the completion
4482 variable when a timeout occurred. we serialize these
4483 activities by invalidating the magic while holding a
4484 shared spinlock which will cause us to block if the
4485 callback is currently executing */
4486 spin_lock(&hdd_context_lock);
4487 context.magic = 0;
4488 spin_unlock(&hdd_context_lock);
4489
Arif Hussain6d2a3322013-11-17 19:50:10 -08004490 hddLog(LOGE, "iwpriv Full Power completed");
Jeff Johnson295189b2012-06-20 16:38:30 -07004491 break;
4492 }
4493 case 1: //Enable BMPS
4494 sme_EnablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE);
4495 break;
4496 case 2: //Disable BMPS
4497 sme_DisablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE);
4498 break;
4499 case 3: //Request Bmps
4500 {
4501 struct statsContext context;
4502 eHalStatus status;
4503
4504 init_completion(&context.completion);
4505
4506 context.pAdapter = pAdapter;
4507 context.magic = POWER_CONTEXT_MAGIC;
4508
4509 status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter),
4510 iw_power_callback_fn, &context);
Jeff Johnson72a40512013-12-19 10:14:15 -08004511 if (eHAL_STATUS_PMC_PENDING == status)
Jeff Johnson295189b2012-06-20 16:38:30 -07004512 {
4513 int lrc = wait_for_completion_interruptible_timeout(
4514 &context.completion,
4515 msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004516 if (lrc <= 0)
4517 {
Jeff Johnson72a40512013-12-19 10:14:15 -08004518 hddLog(VOS_TRACE_LEVEL_ERROR,
4519 "%s: SME %s while requesting BMPS",
4520 __func__, (0 == lrc) ? "timeout" :
4521 "interrupt");
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 }
4523 }
Jeff Johnson72a40512013-12-19 10:14:15 -08004524 /* either we have a response or we timed out. if we
4525 timed out there is a race condition such that the
4526 callback function could be executing at the same
4527 time we are. of primary concern is if the callback
4528 function had already verified the "magic" but had
4529 not yet set the completion variable when a timeout
4530 occurred. we serialize these activities by
4531 invalidating the magic while holding a shared
4532 spinlock which will cause us to block if the
4533 callback is currently executing */
4534 spin_lock(&hdd_context_lock);
4535 context.magic = 0;
4536 spin_unlock(&hdd_context_lock);
4537
Arif Hussain6d2a3322013-11-17 19:50:10 -08004538 hddLog(LOGE, "iwpriv Request BMPS completed");
Jeff Johnson295189b2012-06-20 16:38:30 -07004539 break;
4540 }
4541 case 4: //Enable IMPS
4542 sme_EnablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE);
4543 break;
4544 case 5: //Disable IMPS
4545 sme_DisablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE);
4546 break;
4547 case 6: //Enable Standby
4548 sme_EnablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE);
4549 break;
4550 case 7: //Disable Standby
4551 sme_DisablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE);
4552 break;
4553 case 8: //Request Standby
4554#ifdef CONFIG_HAS_EARLYSUSPEND
Jeff Johnson295189b2012-06-20 16:38:30 -07004555#endif
4556 break;
4557 case 9: //Start Auto Bmps Timer
4558 sme_StartAutoBmpsTimer(hHal);
4559 break;
4560 case 10://Stop Auto BMPS Timer
4561 sme_StopAutoBmpsTimer(hHal);
4562 break;
4563#ifdef CONFIG_HAS_EARLYSUSPEND
4564 case 11://suspend to standby
4565#ifdef CONFIG_HAS_EARLYSUSPEND
4566 nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend;
4567 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07004568 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld;
4569#endif
4570 break;
4571 case 12://suspend to deep sleep
4572#ifdef CONFIG_HAS_EARLYSUSPEND
4573 nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend;
4574 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 2;
Jeff Johnson295189b2012-06-20 16:38:30 -07004575 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld;
4576#endif
4577 break;
4578 case 13://resume from suspend
4579#ifdef CONFIG_HAS_EARLYSUSPEND
Jeff Johnson295189b2012-06-20 16:38:30 -07004580#endif
4581 break;
4582#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004583 default:
Arif Hussain6d2a3322013-11-17 19:50:10 -08004584 hddLog(LOGE, "Invalid arg %d in WE_SET_POWER IOCTL", set_value);
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 ret = -EINVAL;
4586 break;
4587 }
4588 break;
4589 }
4590
4591 case WE_SET_MAX_ASSOC:
4592 {
4593 if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) ||
4594 (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value))
4595 {
4596 ret = -EINVAL;
4597 }
4598 else if ( ccmCfgSetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT,
4599 set_value, NULL, eANI_BOOLEAN_FALSE)
4600 != eHAL_STATUS_SUCCESS )
4601 {
c_hpothub8245442013-11-20 23:41:09 +05304602 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4603 FL("failed to set ini parameter, WNI_CFG_ASSOC_STA_LIMIT"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 ret = -EIO;
4605 }
4606 break;
4607 }
4608
4609 case WE_SET_SAP_AUTO_CHANNEL_SELECTION:
4610 {
4611 if( 0 == set_value )
4612 {
4613 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 0;
4614 }
4615 else if ( 1 == set_value )
4616 {
4617 (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 1;
4618 }
4619 else
4620 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004621 hddLog(LOGE, "Invalid arg %d in WE_SET_SAP_AUTO_CHANNEL_SELECTION IOCTL", set_value);
Jeff Johnson295189b2012-06-20 16:38:30 -07004622 ret = -EINVAL;
4623 }
4624 break;
4625 }
4626
4627 case WE_SET_DATA_INACTIVITY_TO:
4628 {
4629 if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) ||
4630 (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) ||
4631 (ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal,
4632 WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT,
4633 set_value,
4634 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE))
4635 {
4636 hddLog(LOGE,"Failure: Could not pass on "
4637 "WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT configuration info "
Arif Hussain6d2a3322013-11-17 19:50:10 -08004638 "to CCM");
Jeff Johnson295189b2012-06-20 16:38:30 -07004639 ret = -EINVAL;
4640 }
4641 break;
4642 }
4643 case WE_SET_MAX_TX_POWER:
4644 {
4645 tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
4646 tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
4647
4648 hddLog(VOS_TRACE_LEVEL_INFO, "%s: Setting maximum tx power %d dBm",
4649 __func__, set_value);
4650 if( sme_SetMaxTxPower(hHal, bssid, selfMac, set_value) !=
4651 eHAL_STATUS_SUCCESS )
4652 {
4653 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed",
4654 __func__);
4655 return -EIO;
4656 }
4657
4658 break;
4659 }
Arif Hussaina5ebce02013-08-09 15:09:58 -07004660 case WE_SET_MAX_TX_POWER_2_4:
4661 {
4662 hddLog(VOS_TRACE_LEVEL_INFO,
4663 "%s: Setting maximum tx power %d dBm for 2.4 GHz band",
4664 __func__, set_value);
4665 if (sme_SetMaxTxPowerPerBand(eCSR_BAND_24, set_value) !=
4666 eHAL_STATUS_SUCCESS)
4667 {
4668 hddLog(VOS_TRACE_LEVEL_ERROR,
4669 "%s: Setting maximum tx power failed for 2.4 GHz band",
4670 __func__);
4671 return -EIO;
4672 }
4673
4674 break;
4675 }
4676 case WE_SET_MAX_TX_POWER_5_0:
4677 {
4678 hddLog(VOS_TRACE_LEVEL_INFO,
4679 "%s: Setting maximum tx power %d dBm for 5.0 GHz band",
4680 __func__, set_value);
4681 if (sme_SetMaxTxPowerPerBand(eCSR_BAND_5G, set_value) !=
4682 eHAL_STATUS_SUCCESS)
4683 {
4684 hddLog(VOS_TRACE_LEVEL_ERROR,
4685 "%s: Setting maximum tx power failed for 5.0 GHz band",
4686 __func__);
4687 return -EIO;
4688 }
4689
4690 break;
4691 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004692 case WE_SET_HIGHER_DTIM_TRANSITION:
4693 {
4694 if(!((set_value == eANI_BOOLEAN_FALSE) ||
4695 (set_value == eANI_BOOLEAN_TRUE)))
4696 {
4697 hddLog(LOGE, "Dynamic DTIM Incorrect data:%d", set_value);
4698 ret = -EINVAL;
4699 }
4700 else
4701 {
4702 if(pAdapter->higherDtimTransition != set_value)
4703 {
4704 pAdapter->higherDtimTransition = set_value;
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004705 hddLog(LOG1, "%s: higherDtimTransition set to :%d", __func__, pAdapter->higherDtimTransition);
Jeff Johnson295189b2012-06-20 16:38:30 -07004706 }
4707 }
4708
4709 break;
4710 }
4711
4712 case WE_SET_TM_LEVEL:
4713 {
4714 hdd_context_t *hddCtxt = WLAN_HDD_GET_CTX(pAdapter);
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08004715 hddLog(VOS_TRACE_LEVEL_INFO, "Set Thermal Mitigation Level %d", (int)set_value);
Jeff Johnson295189b2012-06-20 16:38:30 -07004716 hddDevTmLevelChangedHandler(hddCtxt->parent_dev, set_value);
4717
4718 break;
4719 }
4720
Kiet Lam46b8e4e2013-11-06 21:49:53 +05304721 case WE_ENABLE_STRICT_FCC_REG:
4722 {
4723 hdd_context_t *hddCtxt = WLAN_HDD_GET_CTX(pAdapter);
4724 struct wiphy *wiphy = NULL;
4725 long lrc;
4726 int status;
4727
4728 wiphy = hddCtxt->wiphy;
4729 if(wiphy == NULL)
4730 {
4731 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy is NULL ", __func__);
4732 break;
4733 }
4734 init_completion(&hddCtxt->wiphy_channel_update_event);
4735
4736 hddCtxt->nEnableStrictRegulatoryForFCC = set_value;
4737
4738 status = regulatory_hint(wiphy, "00");
4739 if(status < 0)
4740 {
4741 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Failure in setting regulatory rule ", __func__);
4742 break;
4743 }
4744
4745 /* Wait for completion */
4746 lrc = wait_for_completion_interruptible_timeout(&hddCtxt->wiphy_channel_update_event,
4747 msecs_to_jiffies(WLAN_WAIT_TIME_CHANNEL_UPDATE));
4748 if (lrc <= 0)
4749 {
4750 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while setting strict FCC regulatory rule ",
4751 __func__, (0 == lrc) ? "Timeout" : "Interrupt");
4752 return (0 == lrc) ? -ETIMEDOUT : -EINTR;
4753 }
4754 hddLog(VOS_TRACE_LEVEL_INFO,"%s: SUCCESS in setting strict FCC regulatory rule", __func__);
4755
4756 break;
4757 }
Tushnim Bhattacharyyaa3ba5a52014-01-30 11:37:33 -08004758 case WE_SET_DEBUG_LOG:
4759 {
4760 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
4761 pHddCtx->cfg_ini->gEnableDebugLog = set_value;
4762 sme_UpdateConnectDebug(pHddCtx->hHal, set_value);
4763 break;
4764 }
Atul Mittalc0f739f2014-07-31 13:47:47 +05304765#ifdef FEATURE_WLAN_TDLS
4766 case WE_SET_TDLS_OFF_CHAN:
4767 {
4768 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
4769 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Tdls offchannel num %d",
4770 __func__, set_value);
4771 ret = iw_set_tdlsoffchannel(pHddCtx, set_value);
4772 break;
4773 }
4774 case WE_SET_TDLS_SEC_OFF_CHAN_OFFSET:
4775 {
4776 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
4777 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Tdls sec offchan offset %d",
4778 __func__, set_value);
4779 ret = iw_set_tdlssecoffchanneloffset(pHddCtx, set_value);
4780 break;
4781 }
4782 case WE_SET_TDLS_OFF_CHAN_MODE:
4783 {
4784 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Tdls offchannel mode %d",
4785 __func__, set_value);
4786 ret = iw_set_tdlsoffchannelmode(pAdapter, set_value);
4787 break;
4788 }
4789#endif
Peng Xu2446a892014-09-05 17:21:18 +05304790 case WE_SET_SCAN_BAND_PREFERENCE:
4791 {
4792 tSmeConfigParams smeConfig;
4793 memset(&smeConfig, 0x00, sizeof(smeConfig));
4794 if(pAdapter->device_mode != WLAN_HDD_INFRA_STATION) {
4795 ret = -EINVAL;
4796 break;
4797 }
4798 hddLog(LOG1, "WE_SET_BAND_PREFERRENCE val %d ", set_value);
4799
4800 if (eCSR_BAND_ALL == set_value ||
4801 eCSR_BAND_24 == set_value || eCSR_BAND_5G == set_value) {
4802 sme_GetConfigParam(hHal, &smeConfig);
4803 smeConfig.csrConfig.scanBandPreference = set_value;
4804
4805 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
4806 "set band scan preference = %d\n",
4807 smeConfig.csrConfig.scanBandPreference);
4808
4809 sme_UpdateConfig(hHal, &smeConfig);
4810 }
4811 else {
4812 ret = -EINVAL;
4813 }
4814 break;
4815 }
Kiet Lam46b8e4e2013-11-06 21:49:53 +05304816
Jeff Johnson295189b2012-06-20 16:38:30 -07004817 default:
4818 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004819 hddLog(LOGE, "Invalid IOCTL setvalue command %d value %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004820 sub_cmd, set_value);
4821 break;
4822 }
4823 }
4824
4825 return ret;
4826}
4827
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05304828static int iw_setint_getnone(struct net_device *dev,
4829 struct iw_request_info *info,
4830 union iwreq_data *wrqu, char *extra)
4831{
4832 int ret;
4833
4834 vos_ssr_protect(__func__);
4835 ret = __iw_setint_getnone(dev, info, wrqu, extra);
4836 vos_ssr_unprotect(__func__);
4837
4838 return 0;
4839}
Jeff Johnson295189b2012-06-20 16:38:30 -07004840/* set param sub-ioctls */
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05304841static int __iw_setchar_getnone(struct net_device *dev,
4842 struct iw_request_info *info,
4843 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07004844{
4845 VOS_STATUS vstatus;
Girish Gowli552fc072014-06-14 18:26:16 +05304846 int sub_cmd;
Jeff Johnson295189b2012-06-20 16:38:30 -07004847 int ret = 0; /* success */
Arif Hussain0273cba2014-01-07 20:58:29 -08004848 char *pBuffer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 hdd_adapter_t *pAdapter = (netdev_priv(dev));
4850 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
4851#ifdef WLAN_FEATURE_VOWIFI
4852 hdd_config_t *pConfig = pHddCtx->cfg_ini;
4853#endif /* WLAN_FEATURE_VOWIFI */
Girish Gowli552fc072014-06-14 18:26:16 +05304854 struct iw_point s_priv_data;
Jeff Johnson295189b2012-06-20 16:38:30 -07004855
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08004856 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
4857 {
4858 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
4859 "%s:LOGP in Progress. Ignore!!!", __func__);
4860 return -EBUSY;
4861 }
4862
Girish Gowli552fc072014-06-14 18:26:16 +05304863 /* helper function to get iwreq_data with compat handling. */
4864 if (hdd_priv_get_data(&s_priv_data, wrqu))
4865 {
4866 return -EINVAL;
4867 }
4868
4869 /* make sure all params are correctly passed to function */
4870 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
4871 {
4872 return -EINVAL;
4873 }
4874
4875 sub_cmd = s_priv_data.flags;
4876
Arif Hussain0273cba2014-01-07 20:58:29 -08004877 /* ODD number is used for set, copy data using copy_from_user */
Girish Gowli552fc072014-06-14 18:26:16 +05304878 pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
4879 s_priv_data.length);
Arif Hussain0273cba2014-01-07 20:58:29 -08004880 if (NULL == pBuffer)
4881 {
4882 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
4883 "mem_alloc_copy_from_user_helper fail");
4884 return -ENOMEM;
4885 }
4886
4887 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Girish Gowli552fc072014-06-14 18:26:16 +05304888 "%s: Received length %d", __func__, s_priv_data.length);
Arif Hussain0273cba2014-01-07 20:58:29 -08004889 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
4890 "%s: Received data %s", __func__, pBuffer);
4891
Jeff Johnson295189b2012-06-20 16:38:30 -07004892 switch(sub_cmd)
4893 {
4894 case WE_WOWL_ADD_PTRN:
Arif Hussain6d2a3322013-11-17 19:50:10 -08004895 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "ADD_PTRN");
Arif Hussain0273cba2014-01-07 20:58:29 -08004896 hdd_add_wowl_ptrn(pAdapter, pBuffer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004897 break;
4898 case WE_WOWL_DEL_PTRN:
Arif Hussain6d2a3322013-11-17 19:50:10 -08004899 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "DEL_PTRN");
Arif Hussain0273cba2014-01-07 20:58:29 -08004900 hdd_del_wowl_ptrn(pAdapter, pBuffer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004901 break;
4902#if defined WLAN_FEATURE_VOWIFI
4903 case WE_NEIGHBOR_REPORT_REQUEST:
4904 {
4905 tRrmNeighborReq neighborReq;
4906 tRrmNeighborRspCallbackInfo callbackInfo;
4907
4908 if (pConfig->fRrmEnable)
4909 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004910 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Neighbor Request");
Girish Gowli552fc072014-06-14 18:26:16 +05304911 neighborReq.no_ssid = (s_priv_data.length - 1) ? false : true ;
Jeff Johnson295189b2012-06-20 16:38:30 -07004912 if( !neighborReq.no_ssid )
4913 {
Girish Gowli552fc072014-06-14 18:26:16 +05304914 neighborReq.ssid.length = (s_priv_data.length - 1) > 32 ? 32 : (s_priv_data.length - 1) ;
Arif Hussain0273cba2014-01-07 20:58:29 -08004915 vos_mem_copy( neighborReq.ssid.ssId, pBuffer, neighborReq.ssid.length );
Jeff Johnson295189b2012-06-20 16:38:30 -07004916 }
4917
4918 callbackInfo.neighborRspCallback = NULL;
4919 callbackInfo.neighborRspCallbackContext = NULL;
4920 callbackInfo.timeout = 5000; //5 seconds
4921 sme_NeighborReportRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &neighborReq, &callbackInfo );
4922 }
4923 else
4924 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004925 hddLog(LOGE, "%s: Ignoring neighbor request as RRM is not enabled", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004926 ret = -EINVAL;
4927 }
4928 }
4929 break;
4930#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004931 case WE_SET_AP_WPS_IE:
4932 hddLog( LOGE, "Received WE_SET_AP_WPS_IE" );
Girish Gowli552fc072014-06-14 18:26:16 +05304933 sme_updateP2pIe( WLAN_HDD_GET_HAL_CTX(pAdapter), pBuffer, s_priv_data.length );
Jeff Johnson295189b2012-06-20 16:38:30 -07004934 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004935 case WE_SET_CONFIG:
Arif Hussain0273cba2014-01-07 20:58:29 -08004936 vstatus = hdd_execute_config_command(pHddCtx, pBuffer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004937 if (VOS_STATUS_SUCCESS != vstatus)
4938 {
4939 ret = -EINVAL;
4940 }
4941 break;
4942 default:
4943 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08004944 hddLog(LOGE, "%s: Invalid sub command %d",__func__, sub_cmd);
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 ret = -EINVAL;
4946 break;
4947 }
4948 }
Arif Hussain0273cba2014-01-07 20:58:29 -08004949 kfree(pBuffer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004950 return ret;
4951}
4952
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05304953static int iw_setchar_getnone(struct net_device *dev,
4954 struct iw_request_info *info,
4955 union iwreq_data *wrqu, char *extra)
4956{
4957 int ret;
4958
4959 vos_ssr_protect(__func__);
4960 ret = __iw_setchar_getnone(dev, info, wrqu, extra);
4961 vos_ssr_unprotect(__func__);
4962
4963 return ret;
4964}
4965
Jeff Johnson295189b2012-06-20 16:38:30 -07004966/* get param sub-ioctls */
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05304967static int __iw_setnone_getint(struct net_device *dev,
4968 struct iw_request_info *info,
4969 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07004970{
4971 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
4972 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
Girish Gowli385be612014-09-18 11:17:20 +05304973 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07004974 int *value = (int *)extra;
4975 int ret = 0; /* success */
Peng Xu2446a892014-09-05 17:21:18 +05304976 tSmeConfigParams smeConfig;
Jeff Johnson295189b2012-06-20 16:38:30 -07004977
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08004978 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
4979 {
4980 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
4981 "%s:LOGP in Progress. Ignore!!!", __func__);
4982 return -EBUSY;
4983 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004984
4985 switch (value[0])
4986 {
4987 case WE_GET_11D_STATE:
4988 {
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07004989 tSmeConfigParams smeConfig;
Jeff Johnson295189b2012-06-20 16:38:30 -07004990 sme_GetConfigParam(hHal,&smeConfig);
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304991
Jeff Johnson295189b2012-06-20 16:38:30 -07004992 *value = smeConfig.csrConfig.Is11dSupportEnabled;
4993
Arif Hussain6d2a3322013-11-17 19:50:10 -08004994 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%d!!"),*value);
Jeff Johnson295189b2012-06-20 16:38:30 -07004995
4996 break;
4997 }
4998
4999 case WE_IBSS_STATUS:
Arif Hussain6d2a3322013-11-17 19:50:10 -08005000 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****Return IBSS Status*****");
Jeff Johnson295189b2012-06-20 16:38:30 -07005001 break;
5002
5003 case WE_PMC_STATE:
5004 {
5005 *value = pmcGetPmcState(hHal);
Arif Hussain6d2a3322013-11-17 19:50:10 -08005006 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("PMC state=%d!!"),*value);
Jeff Johnson295189b2012-06-20 16:38:30 -07005007 break;
5008 }
5009 case WE_GET_WLAN_DBG:
5010 {
5011 vos_trace_display();
5012 *value = 0;
5013 break;
5014 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005015 case WE_GET_MAX_ASSOC:
5016 {
5017 if (ccmCfgGetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, (tANI_U32 *)value) != eHAL_STATUS_SUCCESS)
5018 {
c_hpothub8245442013-11-20 23:41:09 +05305019 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
5020 FL("failed to get ini parameter, WNI_CFG_ASSOC_STA_LIMIT"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005021 ret = -EIO;
5022 }
Girish Gowli385be612014-09-18 11:17:20 +05305023#ifdef WLAN_SOFTAP_VSTA_FEATURE
5024 if (pHddCtx->cfg_ini->fEnableVSTASupport)
5025 {
5026 if (*value > VSTA_NUM_ASSOC_STA)
5027 {
5028 *value = VSTA_NUM_ASSOC_STA;
5029 }
5030 if ((pHddCtx->hddAdapters.count > VSTA_NUM_RESV_SELFSTA) &&
5031 (*value > (VSTA_NUM_ASSOC_STA -
5032 (pHddCtx->hddAdapters.count - VSTA_NUM_RESV_SELFSTA))))
5033 {
5034 *value = (VSTA_NUM_ASSOC_STA -
5035 (pHddCtx->hddAdapters.count - VSTA_NUM_RESV_SELFSTA));
5036 }
5037 }
5038 else
5039#endif
5040 {
5041 if (*value > NUM_ASSOC_STA)
5042 {
5043 *value = NUM_ASSOC_STA;
5044 }
5045 if ((pHddCtx->hddAdapters.count > NUM_RESV_SELFSTA) &&
5046 (*value > (NUM_ASSOC_STA -
5047 (pHddCtx->hddAdapters.count - NUM_RESV_SELFSTA))))
5048 {
5049 *value = (NUM_ASSOC_STA -
5050 (pHddCtx->hddAdapters.count - NUM_RESV_SELFSTA));
5051 }
5052 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005053 break;
5054 }
5055
Jeff Johnson295189b2012-06-20 16:38:30 -07005056 case WE_GET_WDI_DBG:
5057 {
5058 wpalTraceDisplay();
5059 *value = 0;
5060 break;
5061 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005062
5063 case WE_GET_SAP_AUTO_CHANNEL_SELECTION:
5064 {
5065 *value = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection;
5066 break;
5067 }
5068 case WE_GET_CONCURRENCY_MODE:
5069 {
5070 *value = hdd_get_concurrency_mode ( );
5071
Arif Hussain6d2a3322013-11-17 19:50:10 -08005072 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("concurrency mode=%d"),*value);
Jeff Johnson295189b2012-06-20 16:38:30 -07005073 break;
5074 }
5075
Peng Xu2446a892014-09-05 17:21:18 +05305076 case WE_GET_SCAN_BAND_PREFERENCE:
5077 {
5078 sme_GetConfigParam(hHal, &smeConfig);
5079 *value = smeConfig.csrConfig.scanBandPreference;
5080
5081 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
5082 "scanBandPreference = %d\n", *value);
5083 break;
5084 }
5085
Jeff Johnson295189b2012-06-20 16:38:30 -07005086 default:
5087 {
5088 hddLog(LOGE, "Invalid IOCTL get_value command %d ",value[0]);
5089 break;
5090 }
5091 }
5092
5093 return ret;
5094}
5095
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05305096static int iw_setnone_getint(struct net_device *dev,
5097 struct iw_request_info *info,
5098 union iwreq_data *wrqu, char *extra)
5099{
5100 int ret;
5101
5102 vos_ssr_protect(__func__);
5103 ret = __iw_setnone_getint(dev, info, wrqu, extra);
5104 vos_ssr_unprotect(__func__);
5105
5106 return ret;
5107
5108}
Jeff Johnson295189b2012-06-20 16:38:30 -07005109/* set param sub-ioctls */
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05305110int __iw_set_three_ints_getnone(struct net_device *dev,
5111 struct iw_request_info *info,
5112 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07005113{
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005114 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Jeff Johnson295189b2012-06-20 16:38:30 -07005115 int *value = (int *)extra;
5116 int sub_cmd = value[0];
5117 int ret = 0;
5118
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005119 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
5120 {
5121 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
5122 "%s:LOGP in Progress. Ignore!!!", __func__);
5123 return -EBUSY;
5124 }
5125
Jeff Johnson295189b2012-06-20 16:38:30 -07005126 switch(sub_cmd)
5127 {
5128 case WE_SET_WLAN_DBG:
5129 {
5130 vos_trace_setValue( value[1], value[2], value[3]);
5131 break;
5132 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005133 case WE_SET_WDI_DBG:
5134 {
5135 wpalTraceSetLevel( value[1], value[2], value[3]);
5136 break;
5137 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005138 case WE_SET_SAP_CHANNELS:
5139 {
5140 ret = iw_softap_set_channel_range( dev, value[1], value[2], value[3]);
5141 break;
5142 }
5143
5144 default:
5145 {
Jeff Johnson11e77032014-02-14 13:22:22 -08005146 hddLog(LOGE, "%s: Invalid IOCTL command %d", __func__, sub_cmd );
Jeff Johnson295189b2012-06-20 16:38:30 -07005147 break;
5148 }
5149 }
5150 return ret;
5151}
5152
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05305153int iw_set_three_ints_getnone(struct net_device *dev,
5154 struct iw_request_info *info,
5155 union iwreq_data *wrqu, char *extra)
5156{
5157 int ret;
5158
5159 vos_ssr_protect(__func__);
5160 ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra);
5161 vos_ssr_unprotect(__func__);
5162
5163 return ret;
5164}
5165
5166static int __iw_get_char_setnone(struct net_device *dev,
5167 struct iw_request_info *info,
5168 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07005169{
5170 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
5171 int sub_cmd = wrqu->data.flags;
Chet Lanctot186b5732013-03-18 10:26:30 -07005172#ifdef WLAN_FEATURE_11W
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005173 hdd_wext_state_t *pWextState;
5174#endif
5175
5176 if (pAdapter == NULL)
5177 {
5178 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5179 "%s: pAdapter is NULL!", __func__);
5180 return -EINVAL;
5181 }
5182#ifdef WLAN_FEATURE_11W
5183 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
Chet Lanctot186b5732013-03-18 10:26:30 -07005184#endif
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005185
Yue Ma3ede6052013-08-29 00:33:26 -07005186 if (NULL == WLAN_HDD_GET_CTX(pAdapter))
5187 {
5188 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5189 "%s: HDD Context is NULL!", __func__);
5190
5191 return -EINVAL;
5192 }
5193
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005194 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
5195 {
5196 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
5197 "%s:LOGP in Progress. Ignore!!!", __func__);
5198 return -EBUSY;
5199 }
5200
Jeff Johnson295189b2012-06-20 16:38:30 -07005201 switch(sub_cmd)
5202 {
5203 case WE_WLAN_VERSION:
5204 {
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005205 hdd_wlan_get_version(pAdapter, wrqu, extra);
Jeff Johnson295189b2012-06-20 16:38:30 -07005206 break;
5207 }
5208
5209 case WE_GET_STATS:
5210 {
Sandeep Puligilla383bbfc2014-05-01 15:06:09 +05305211 tHalHandle hHal = NULL;
5212 tpAniSirGlobal pMac = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005213 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
5214 hdd_tx_rx_stats_t *pStats = &pAdapter->hdd_stats.hddTxRxStats;
5215 hdd_chip_reset_stats_t *pResetStats = &pHddCtx->hddChipResetStats;
5216
Sandeep Puligilla383bbfc2014-05-01 15:06:09 +05305217
Jeff Johnson295189b2012-06-20 16:38:30 -07005218 snprintf(extra, WE_MAX_STR_LEN,
5219 "\nTransmit"
5220 "\ncalled %u, dropped %u, backpressured %u, queued %u"
5221 "\n dropped BK %u, BE %u, VI %u, VO %u"
5222 "\n classified BK %u, BE %u, VI %u, VO %u"
5223 "\nbackpressured BK %u, BE %u, VI %u, VO %u"
5224 "\n queued BK %u, BE %u, VI %u, VO %u"
5225 "\nfetched %u, empty %u, lowres %u, deqerr %u"
Ravi Joshi41914632013-10-21 23:02:21 -07005226 "\ndequeued %u, depressured %u, deque-depressured %u, completed %u, flushed %u"
Jeff Johnson295189b2012-06-20 16:38:30 -07005227 "\n fetched BK %u, BE %u, VI %u, VO %u"
5228 "\n dequeued BK %u, BE %u, VI %u, VO %u"
5229 "\n depressured BK %u, BE %u, VI %u, VO %u"
Ravi Joshi41914632013-10-21 23:02:21 -07005230 "\nDeque depressured BK %u, BE %u, VI %u, VO %u"
Jeff Johnson295189b2012-06-20 16:38:30 -07005231 "\n flushed BK %u, BE %u, VI %u, VO %u"
5232 "\n\nReceive"
5233 "\nchains %u, packets %u, dropped %u, delivered %u, refused %u"
5234 "\n\nResetsStats"
5235 "\n TotalLogp %u Cmd53 %u MutexRead %u MIF-Error %u FW-Heartbeat %u Others %u"
5236 "\n",
5237 pStats->txXmitCalled,
5238 pStats->txXmitDropped,
5239 pStats->txXmitBackPressured,
5240 pStats->txXmitQueued,
5241
5242 pStats->txXmitDroppedAC[WLANTL_AC_BK],
5243 pStats->txXmitDroppedAC[WLANTL_AC_BE],
5244 pStats->txXmitDroppedAC[WLANTL_AC_VI],
5245 pStats->txXmitDroppedAC[WLANTL_AC_VO],
5246
5247 pStats->txXmitClassifiedAC[WLANTL_AC_BK],
5248 pStats->txXmitClassifiedAC[WLANTL_AC_BE],
5249 pStats->txXmitClassifiedAC[WLANTL_AC_VI],
5250 pStats->txXmitClassifiedAC[WLANTL_AC_VO],
5251
5252 pStats->txXmitBackPressuredAC[WLANTL_AC_BK],
5253 pStats->txXmitBackPressuredAC[WLANTL_AC_BE],
5254 pStats->txXmitBackPressuredAC[WLANTL_AC_VI],
5255 pStats->txXmitBackPressuredAC[WLANTL_AC_VO],
5256
5257 pStats->txXmitQueuedAC[WLANTL_AC_BK],
5258 pStats->txXmitQueuedAC[WLANTL_AC_BE],
5259 pStats->txXmitQueuedAC[WLANTL_AC_VI],
5260 pStats->txXmitQueuedAC[WLANTL_AC_VO],
5261
5262 pStats->txFetched,
5263 pStats->txFetchEmpty,
5264 pStats->txFetchLowResources,
5265 pStats->txFetchDequeueError,
5266
5267 pStats->txFetchDequeued,
5268 pStats->txFetchDePressured,
Ravi Joshi41914632013-10-21 23:02:21 -07005269 pStats->txDequeDePressured,
Jeff Johnson295189b2012-06-20 16:38:30 -07005270 pStats->txCompleted,
5271 pStats->txFlushed,
5272
5273 pStats->txFetchedAC[WLANTL_AC_BK],
5274 pStats->txFetchedAC[WLANTL_AC_BE],
5275 pStats->txFetchedAC[WLANTL_AC_VI],
5276 pStats->txFetchedAC[WLANTL_AC_VO],
5277
5278 pStats->txFetchDequeuedAC[WLANTL_AC_BK],
5279 pStats->txFetchDequeuedAC[WLANTL_AC_BE],
5280 pStats->txFetchDequeuedAC[WLANTL_AC_VI],
5281 pStats->txFetchDequeuedAC[WLANTL_AC_VO],
5282
5283 pStats->txFetchDePressuredAC[WLANTL_AC_BK],
5284 pStats->txFetchDePressuredAC[WLANTL_AC_BE],
5285 pStats->txFetchDePressuredAC[WLANTL_AC_VI],
5286 pStats->txFetchDePressuredAC[WLANTL_AC_VO],
5287
Ravi Joshi41914632013-10-21 23:02:21 -07005288 pStats->txDequeDePressuredAC[WLANTL_AC_BK],
5289 pStats->txDequeDePressuredAC[WLANTL_AC_BE],
5290 pStats->txDequeDePressuredAC[WLANTL_AC_VI],
5291 pStats->txDequeDePressuredAC[WLANTL_AC_VO],
5292
Jeff Johnson295189b2012-06-20 16:38:30 -07005293 pStats->txFlushedAC[WLANTL_AC_BK],
5294 pStats->txFlushedAC[WLANTL_AC_BE],
5295 pStats->txFlushedAC[WLANTL_AC_VI],
5296 pStats->txFlushedAC[WLANTL_AC_VO],
5297
5298 pStats->rxChains,
5299 pStats->rxPackets,
5300 pStats->rxDropped,
5301 pStats->rxDelivered,
5302 pStats->rxRefused,
5303
5304 pResetStats->totalLogpResets,
5305 pResetStats->totalCMD53Failures,
5306 pResetStats->totalMutexReadFailures,
5307 pResetStats->totalMIFErrorFailures,
5308 pResetStats->totalFWHearbeatFailures,
5309 pResetStats->totalUnknownExceptions
5310 );
Sandeep Puligilla383bbfc2014-05-01 15:06:09 +05305311 wrqu->data.length = strlen(extra);
5312
5313 hHal = WLAN_HDD_GET_HAL_CTX( pAdapter );
5314
5315 if (hHal)
5316 pMac = PMAC_STRUCT( hHal );
5317
5318 if (pMac && (wrqu->data.length < WE_MAX_STR_LEN)) {
5319 __u32 pmmStatsLength = WE_MAX_STR_LEN - wrqu->data.length;
5320 snprintf(extra+wrqu->data.length, pmmStatsLength,
Rajesh Babu Prathipati6aa7cb82014-06-02 09:56:59 +05305321 "\n BMPS sleepcnt %lld, BMPS awakecnt %lld"
5322 "\n BMPS sleepreqfailcnt %lld, BMPS wakeupreqfailcnt %lld"
5323 "\n IMPS sleepcnt %lld, IMPS awakecnt %lld"
5324 "\n IMPS sleepreqfailcnt %lld, IMPS wakeupreqfailcnt %lld, IMPS lasterr %lld"
Sandeep Puligilla383bbfc2014-05-01 15:06:09 +05305325 "\n",
5326 pMac->pmm.BmpscntSleep,
5327 pMac->pmm.BmpscntAwake,
5328 pMac->pmm.BmpsSleeReqFailCnt,
5329 pMac->pmm.BmpsWakeupReqFailCnt,
5330 pMac->pmm.ImpsCntSleep,
5331 pMac->pmm.ImpsCntAwake,
5332 pMac->pmm.ImpsSleepErrCnt,
5333 pMac->pmm.ImpsWakeupErrCnt,
5334 pMac->pmm.ImpsLastErr
5335 );
5336 }
5337
Jeff Johnson295189b2012-06-20 16:38:30 -07005338 wrqu->data.length = strlen(extra)+1;
5339 break;
5340 }
5341
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305342/* The case prints the current state of the HDD, SME, CSR, PE, TL
5343 *it can be extended for WDI Global State as well.
5344 *And currently it only checks P2P_CLIENT adapter.
5345 *P2P_DEVICE and P2P_GO have not been added as of now.
5346*/
5347 case WE_GET_STATES:
5348 {
5349 int buf = 0, len = 0;
5350 int adapter_num = 0;
5351 int count = 0, check = 1;
5352
5353 tANI_U16 tlState;
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005354 tHalHandle hHal = NULL;
5355 tpAniSirGlobal pMac = NULL;
5356 hdd_station_ctx_t *pHddStaCtx = NULL;
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305357
5358 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
5359 hdd_adapter_t *useAdapter = NULL;
5360
5361 /* Print wlan0 or p2p0 states based on the adapter_num
5362 *by using the correct adapter
5363 */
5364 while ( adapter_num < 2 )
5365 {
5366 if ( WLAN_ADAPTER == adapter_num )
5367 {
5368 useAdapter = pAdapter;
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005369 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305370 "\n\n wlan0 States:-");
5371 len += buf;
5372 }
5373 else if ( P2P_ADAPTER == adapter_num )
5374 {
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005375 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305376 "\n\n p2p0 States:-");
5377 len += buf;
5378
5379 if( !pHddCtx )
5380 {
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005381 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305382 "\n pHddCtx is NULL");
5383 len += buf;
5384 break;
5385 }
5386
5387 /*Printing p2p0 states only in the case when the device is
5388 configured as a p2p_client*/
5389 useAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_CLIENT);
5390 if ( !useAdapter )
5391 {
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005392 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305393 "\n Device not configured as P2P_CLIENT.");
5394 len += buf;
5395 break;
5396 }
5397 }
5398
5399 hHal = WLAN_HDD_GET_HAL_CTX( useAdapter );
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005400 if (!hHal) {
5401 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
5402 "\n pMac is NULL");
5403 len += buf;
5404 break;
5405 }
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305406 pMac = PMAC_STRUCT( hHal );
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005407 if (!pMac) {
5408 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
5409 "\n pMac is NULL");
5410 len += buf;
5411 break;
5412 }
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305413 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR( useAdapter );
5414 if( !pHddStaCtx )
5415 {
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005416 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305417 "\n pHddStaCtx is NULL");
5418 len += buf;
5419 break;
5420 }
5421
5422 tlState = smeGetTLSTAState(hHal, pHddStaCtx->conn_info.staId[0]);
5423
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005424 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305425 "\n HDD Conn State - %s "
5426 "\n \n SME State:"
5427 "\n Neighbour Roam State - %s"
5428 "\n CSR State - %s"
5429 "\n CSR Substate - %s"
5430 "\n \n TL STA %d State: %s",
5431 macTraceGetHDDWlanConnState(
5432 pHddStaCtx->conn_info.connState),
5433 macTraceGetNeighbourRoamState(
5434 pMac->roam.neighborRoamInfo.neighborRoamState),
5435 macTraceGetcsrRoamState(
5436 pMac->roam.curState[useAdapter->sessionId]),
5437 macTraceGetcsrRoamSubState(
5438 pMac->roam.curSubState[useAdapter->sessionId]),
5439 pHddStaCtx->conn_info.staId[0],
5440 macTraceGetTLState(tlState)
5441 );
5442 len += buf;
5443 adapter_num++;
5444 }
5445
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005446 if (pMac) {
5447 /* Printing Lim State starting with global lim states */
5448 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
5449 "\n \n LIM STATES:-"
5450 "\n Global Sme State - %s "\
5451 "\n Global mlm State - %s "\
5452 "\n",
5453 macTraceGetLimSmeState(pMac->lim.gLimSmeState),
5454 macTraceGetLimMlmState(pMac->lim.gLimMlmState)
5455 );
5456 len += buf;
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305457
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005458 /*printing the PE Sme and Mlm states for valid lim sessions*/
5459 while ( check < 3 && count < 255)
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305460 {
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005461 if ( pMac->lim.gpSession[count].valid )
5462 {
5463 buf = scnprintf(extra + len, WE_MAX_STR_LEN - len,
5464 "\n Lim Valid Session %d:-"
5465 "\n PE Sme State - %s "
5466 "\n PE Mlm State - %s "
5467 "\n",
5468 check,
5469 macTraceGetLimSmeState(pMac->lim.gpSession[count].limSmeState),
5470 macTraceGetLimMlmState(pMac->lim.gpSession[count].limMlmState)
5471 );
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305472
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005473 len += buf;
5474 check++;
5475 }
5476 count++;
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305477 }
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305478 }
5479
5480 wrqu->data.length = strlen(extra)+1;
5481 break;
5482 }
5483
Jeff Johnson295189b2012-06-20 16:38:30 -07005484 case WE_GET_CFG:
5485 {
5486 hdd_cfg_get_config(WLAN_HDD_GET_CTX(pAdapter), extra, WE_MAX_STR_LEN);
5487 wrqu->data.length = strlen(extra)+1;
5488 break;
5489 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005490#ifdef WLAN_FEATURE_11AC
5491 case WE_GET_RSSI:
5492 {
5493 v_S7_t s7Rssi = 0;
5494 wlan_hdd_get_rssi(pAdapter, &s7Rssi);
5495 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d",s7Rssi);
5496 wrqu->data.length = strlen(extra)+1;
5497 break;
5498 }
5499#endif
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305500
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005501#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005502 case WE_GET_ROAM_RSSI:
5503 {
5504 v_S7_t s7Rssi = 0;
5505 wlan_hdd_get_roam_rssi(pAdapter, &s7Rssi);
5506 snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi);
5507 wrqu->data.length = strlen(extra)+1;
5508 break;
5509 }
5510#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005511 case WE_GET_WMM_STATUS:
5512 {
5513 snprintf(extra, WE_MAX_STR_LEN,
5514 "\nDir: 0=up, 1=down, 3=both\n"
5515 "|------------------------|\n"
5516 "|AC | ACM |Admitted| Dir |\n"
5517 "|------------------------|\n"
5518 "|VO | %d | %3s | %d |\n"
5519 "|VI | %d | %3s | %d |\n"
5520 "|BE | %d | %3s | %d |\n"
5521 "|BK | %d | %3s | %d |\n"
5522 "|------------------------|\n",
5523 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessRequired,
5524 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessAllowed?"YES":"NO",
5525 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcTspecInfo.ts_info.direction,
5526 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessRequired,
5527 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessAllowed?"YES":"NO",
5528 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcTspecInfo.ts_info.direction,
5529 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessRequired,
5530 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessAllowed?"YES":"NO",
5531 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcTspecInfo.ts_info.direction,
5532 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessRequired,
5533 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessAllowed?"YES":"NO",
5534 pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcTspecInfo.ts_info.direction);
5535
Jeff Johnsone7245742012-09-05 17:12:55 -07005536
Jeff Johnson295189b2012-06-20 16:38:30 -07005537 wrqu->data.length = strlen(extra)+1;
5538 break;
5539 }
5540 case WE_GET_CHANNEL_LIST:
5541 {
5542 VOS_STATUS status;
5543 v_U8_t i, len;
5544 char* buf ;
Sushant Kaushik10315f92014-04-29 11:30:25 +05305545 tANI_U8 pBuf[COUNTRY_CODE_LEN];
5546 tANI_U8 uBufLen = COUNTRY_CODE_LEN;
5547 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
Jeff Johnson295189b2012-06-20 16:38:30 -07005548 tChannelListInfo channel_list;
5549
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005550 memset(&channel_list, 0, sizeof(channel_list));
Jeff Johnson295189b2012-06-20 16:38:30 -07005551 status = iw_softap_get_channel_list(dev, info, wrqu, (char *)&channel_list);
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08005552 if ( !VOS_IS_STATUS_SUCCESS( status ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08005554 hddLog(VOS_TRACE_LEVEL_ERROR, "%s GetChannelList Failed!!!",__func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005555 return -EINVAL;
5556 }
5557 buf = extra;
5558
5559 /**
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005560 * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN. Maximum buffer
5561 * needed = 5 * number of channels. Check ifsufficient
5562 * buffer is available and then proceed to fill the buffer.
5563 */
Jeff Johnson295189b2012-06-20 16:38:30 -07005564 if(WE_MAX_STR_LEN < (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN))
5565 {
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005566 hddLog(VOS_TRACE_LEVEL_ERROR,
Arif Hussain6d2a3322013-11-17 19:50:10 -08005567 "%s Insufficient Buffer to populate channel list",
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005568 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005569 return -EINVAL;
5570 }
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005571 len = scnprintf(buf, WE_MAX_STR_LEN, "%u ",
5572 channel_list.num_channels);
Sushant Kaushik10315f92014-04-29 11:30:25 +05305573 if( eHAL_STATUS_SUCCESS == sme_GetCountryCode(pHddCtx->hHal, pBuf, &uBufLen))
5574 {
5575 //Printing Country code in getChannelList
5576 for(i= 0; i < COUNTRY_CODE_LEN; i++)
5577 {
5578 len += scnprintf(buf + len, WE_MAX_STR_LEN - len,
5579 "%c ", pBuf[i]);
5580 }
5581 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005582 for(i = 0 ; i < channel_list.num_channels; i++)
5583 {
Sameer Thalappilb0a30232013-09-27 15:37:48 -07005584 len += scnprintf(buf + len, WE_MAX_STR_LEN - len,
Jeff Johnson295189b2012-06-20 16:38:30 -07005585 "%u ", channel_list.channels[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005586 }
5587 wrqu->data.length = strlen(extra)+1;
5588
5589 break;
5590 }
Chilam Ng16a2a1c2013-01-29 01:27:29 -08005591#ifdef FEATURE_WLAN_TDLS
5592 case WE_GET_TDLS_PEERS:
5593 {
Gopichand Nakkala4327a152013-03-04 23:22:42 -08005594 wrqu->data.length = wlan_hdd_tdls_get_all_peers(pAdapter, extra, WE_MAX_STR_LEN)+1;
Chilam Ng16a2a1c2013-01-29 01:27:29 -08005595 break;
5596 }
5597#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07005598#ifdef WLAN_FEATURE_11W
5599 case WE_GET_11W_INFO:
5600 {
5601 hddLog(LOGE, "WE_GET_11W_ENABLED = %d", pWextState->roamProfile.MFPEnabled );
5602
5603 snprintf(extra, WE_MAX_STR_LEN,
5604 "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d"
5605 "\n Number of Unprotected Disassocs %d"
5606 "\n Number of Unprotected Deauths %d",
5607 (*pWextState->roamProfile.BSSIDs.bssid)[0], (*pWextState->roamProfile.BSSIDs.bssid)[1],
5608 (*pWextState->roamProfile.BSSIDs.bssid)[2], (*pWextState->roamProfile.BSSIDs.bssid)[3],
5609 (*pWextState->roamProfile.BSSIDs.bssid)[4], (*pWextState->roamProfile.BSSIDs.bssid)[5],
5610 pWextState->roamProfile.MFPEnabled, pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx,
5611 pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx);
5612
5613 wrqu->data.length = strlen(extra)+1;
5614 break;
5615 }
5616#endif
Girish Gowlidab72f12014-09-04 15:34:43 +05305617 case WE_GET_SNR:
5618 {
5619 v_S7_t s7snr = 0;
5620 int status = 0;
5621 hdd_context_t *pHddCtx;
5622 hdd_station_ctx_t *pHddStaCtx;
5623
5624 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
5625 status = wlan_hdd_validate_context(pHddCtx);
5626 if (0 != status)
5627 {
5628 hddLog(LOGE, "%s: getSNR: HDD context is not valid", __func__);
5629 return status;
5630 }
5631
5632 pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
5633
5634 if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring ||
5635 eConnectionState_Associated != pHddStaCtx->conn_info.connState)
5636 {
5637 hddLog(LOGE, "%s: getSNR failed: Enable SNR Monitoring-%d,"
5638 " ConnectionState-%d", __func__,
5639 pHddCtx->cfg_ini->fEnableSNRMonitoring,
5640 pHddStaCtx->conn_info.connState);
5641 return -ENONET;
5642 }
5643
5644 /*update the stats in TL*/
5645 wlan_hdd_get_station_stats(pAdapter);
5646 wlan_hdd_get_snr(pAdapter, &s7snr);
5647 snprintf(extra, WE_MAX_STR_LEN, "snr=%d",s7snr);
5648 wrqu->data.length = strlen(extra) + 1;
5649 break;
5650 }
5651
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305652 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07005653 {
Jeff Johnson11e77032014-02-14 13:22:22 -08005654 hddLog(LOGE, "%s: Invalid IOCTL command %d", __func__, sub_cmd );
Jeff Johnson295189b2012-06-20 16:38:30 -07005655 break;
5656 }
5657 }
5658
5659 return 0;
5660}
5661
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05305662static int iw_get_char_setnone(struct net_device *dev,
5663 struct iw_request_info *info,
5664 union iwreq_data *wrqu, char *extra)
5665{
5666 int ret;
5667
5668 vos_ssr_protect(__func__);
5669 ret = __iw_get_char_setnone(dev, info, wrqu, extra);
5670 vos_ssr_unprotect(__func__);
5671
5672 return ret;
5673}
5674
Jeff Johnson295189b2012-06-20 16:38:30 -07005675/* action sub-ioctls */
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05305676static int __iw_setnone_getnone(struct net_device *dev,
5677 struct iw_request_info *info,
5678 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07005679{
5680 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Girish Gowlibaf3f2b2014-06-14 18:02:54 +05305681 int sub_cmd;
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005682 int ret = 0; /* success */
Girish Gowlibaf3f2b2014-06-14 18:02:54 +05305683 struct iw_point s_priv_data;
Jeff Johnson295189b2012-06-20 16:38:30 -07005684
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005685 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
5686 {
5687 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
5688 "%s:LOGP in Progress. Ignore!!!", __func__);
5689 return -EBUSY;
5690 }
5691
Girish Gowlibaf3f2b2014-06-14 18:02:54 +05305692 /* helper function to get iwreq_data with compat handling. */
5693 if (hdd_priv_get_data(&s_priv_data, wrqu))
5694 {
5695 return -EINVAL;
5696 }
5697
5698 sub_cmd = s_priv_data.flags;
5699
Jeff Johnson295189b2012-06-20 16:38:30 -07005700 switch (sub_cmd)
5701 {
5702 case WE_CLEAR_STATS:
5703 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005704 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: clearing", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005705 memset(&pAdapter->stats, 0, sizeof(pAdapter->stats));
5706 memset(&pAdapter->hdd_stats, 0, sizeof(pAdapter->hdd_stats));
5707 break;
5708 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005709 case WE_INIT_AP:
5710 {
Abhishek Singh98d2f802014-02-10 15:47:55 +05305711 /*FIX ME: Need to be revisited if multiple SAPs to be supported */
5712
5713 /* As Soft AP mode might been changed to STA already with
5714 * killing of Hostapd, need to find the adpater by name
5715 * rather than mode */
5716 hdd_adapter_t* pAdapter_to_stop =
5717 hdd_get_adapter_by_name(WLAN_HDD_GET_CTX(pAdapter), "softap.0");
5718 if( pAdapter_to_stop )
5719 {
5720 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5721 "Adapter with name softap.0 already "
5722 "exist, ignoring the request.\nRemove the "
5723 "adapter and try again\n");
5724 break;
5725 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005726 pr_info("Init AP trigger\n");
5727 hdd_open_adapter( WLAN_HDD_GET_CTX(pAdapter), WLAN_HDD_SOFTAP, "softap.%d",
5728 wlan_hdd_get_intf_addr( WLAN_HDD_GET_CTX(pAdapter) ),TRUE);
5729 break;
5730 }
5731 case WE_STOP_AP:
5732 {
5733 /*FIX ME: Need to be revisited if multiple SAPs to be supported */
5734 /* As Soft AP mode has been changed to STA already with killing of Hostapd,
5735 * this is a dead code and need to find the adpater by name rather than mode */
5736 hdd_adapter_t* pAdapter_to_stop =
5737 hdd_get_adapter_by_name(WLAN_HDD_GET_CTX(pAdapter), "softap.0");
5738 if( pAdapter_to_stop )
5739 {
5740 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
5741
5742 pr_info("Stopping AP mode\n");
5743
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05305744 if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter)))
5745 {
5746 /* EXIT BMPS as fw cannot handle DEL_STA when its in BMPS */
5747 wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE);
5748 }
5749
Jeff Johnson295189b2012-06-20 16:38:30 -07005750 /*Make sure that pAdapter cleaned properly*/
Agarwal Ashish3a38bd12014-06-12 15:16:52 +05305751 hdd_stop_adapter( pHddCtx, pAdapter_to_stop, VOS_TRUE );
Jeff Johnson295189b2012-06-20 16:38:30 -07005752 hdd_deinit_adapter( pHddCtx, pAdapter_to_stop );
5753 memset(&pAdapter_to_stop->sessionCtx, 0, sizeof(pAdapter_to_stop->sessionCtx));
5754
5755 wlan_hdd_release_intf_addr(WLAN_HDD_GET_CTX(pAdapter),
5756 pAdapter_to_stop->macAddressCurrent.bytes);
5757 hdd_close_adapter(WLAN_HDD_GET_CTX(pAdapter), pAdapter_to_stop,
5758 TRUE);
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05305759
5760 if (FALSE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter)))
5761 {
5762 /* put the device back into BMPS */
5763 wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO);
5764 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005765 }
5766 else
5767 {
Jeff Johnsona8a1a482012-12-12 16:49:33 -08005768 printk(KERN_ERR"SAP adapter not found to stop it!\n");
Jeff Johnson295189b2012-06-20 16:38:30 -07005769 }
5770
5771 break;
5772 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005773#ifdef WLAN_BTAMP_FEATURE
5774 case WE_ENABLE_AMP:
5775 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005776 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: enabling AMP", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005777 WLANBAP_RegisterWithHCI(pAdapter);
5778 break;
5779 }
5780 case WE_DISABLE_AMP:
5781 {
5782 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
5783 VOS_STATUS status;
5784
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005785 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: disabling AMP", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005786
5787 pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
5788 status = WLANBAP_StopAmp();
5789 if(VOS_STATUS_SUCCESS != status )
5790 {
5791 pHddCtx->isAmpAllowed = VOS_TRUE;
5792 hddLog(VOS_TRACE_LEVEL_FATAL,
5793 "%s: Failed to stop AMP", __func__);
5794 }
5795 else
5796 {
5797 //a state m/c implementation in PAL is TBD to avoid this delay
5798 msleep(500);
5799 pHddCtx->isAmpAllowed = VOS_FALSE;
5800 WLANBAP_DeregisterFromHCI();
5801 }
5802
5803 break;
5804 }
5805#endif
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07005806 case WE_ENABLE_DXE_STALL_DETECT:
5807 {
schang6295e542013-03-12 15:31:23 -07005808 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
5809 sme_transportDebug(hHal, VOS_FALSE, VOS_TRUE);
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07005810 break;
5811 }
5812 case WE_DISPLAY_DXE_SNAP_SHOT:
5813 {
schang6295e542013-03-12 15:31:23 -07005814 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
5815 sme_transportDebug(hHal, VOS_TRUE, VOS_FALSE);
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07005816 break;
5817 }
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05305818 case WE_DISPLAY_DATAPATH_SNAP_SHOT:
5819 {
5820 hddLog(LOGE, "%s: called %d",__func__, sub_cmd);
5821 hdd_wmm_tx_snapshot(pAdapter);
5822 WLANTL_TLDebugMessage(VOS_TRUE);
5823 break;
5824 }
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305825
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05305826 case WE_SET_REASSOC_TRIGGER:
5827 {
5828 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
5829 tpAniSirGlobal pMac = WLAN_HDD_GET_HAL_CTX(pAdapter);
5830 v_U32_t roamId = 0;
5831 tCsrRoamModifyProfileFields modProfileFields;
5832 sme_GetModifyProfileFields(pMac, pAdapter->sessionId, &modProfileFields);
5833 sme_RoamReassoc(pMac, pAdapter->sessionId, NULL, modProfileFields, &roamId, 1);
5834 return 0;
5835 }
5836
Sandeep Puligilla04bb8fd2014-02-03 23:21:47 +05305837 case WE_STOP_OBSS_SCAN:
5838 {
5839 /* 1.OBSS Scan is mandatory while operating in 2.4GHz
5840 2.OBSS scan is stopped by Firmware during the disassociation
5841 3.OBSS stop comamnd is added for debugging purpose*/
5842 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
5843 tpAniSirGlobal pMac;
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07005844
Sandeep Puligilla04bb8fd2014-02-03 23:21:47 +05305845 if (pAdapter == NULL)
5846 {
5847 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5848 " pAdapter is NULL ");
Kaushik, Sushantdf30db22014-05-05 12:14:33 +05305849 return -EINVAL;
Sandeep Puligilla04bb8fd2014-02-03 23:21:47 +05305850 }
5851 pMac = WLAN_HDD_GET_HAL_CTX(pAdapter);
5852 if (pMac == NULL)
5853 {
5854 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5855 " pMac is NULL ");
Kaushik, Sushantdf30db22014-05-05 12:14:33 +05305856 return -EINVAL;
Sandeep Puligilla04bb8fd2014-02-03 23:21:47 +05305857 }
5858 sme_HT40StopOBSSScan(pMac, pAdapter->sessionId);
5859 }
5860 break;
Mukul Sharma84f27252014-07-14 18:11:42 +05305861#ifdef DEBUG_ROAM_DELAY
5862 case WE_DUMP_ROAM_TIMER_LOG:
5863 {
5864 vos_dump_roam_time_log_service();
5865 break;
5866 }
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05305867
Mukul Sharma84f27252014-07-14 18:11:42 +05305868 case WE_RESET_ROAM_TIMER_LOG:
5869 {
5870 vos_reset_roam_timer_log();
5871 break;
5872 }
5873#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005874 default:
5875 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005876 hddLog(LOGE, "%s: unknown ioctl %d", __func__, sub_cmd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005877 break;
5878 }
5879 }
5880
5881 return ret;
5882}
5883
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05305884static int iw_setnone_getnone(struct net_device *dev,
5885 struct iw_request_info *info,
5886 union iwreq_data *wrqu, char *extra)
5887{
5888 int ret;
5889
5890 vos_ssr_protect(__func__);
5891 ret = __iw_setnone_getnone(dev, info, wrqu, extra);
5892 vos_ssr_unprotect(__func__);
5893
5894 return ret;
5895}
5896
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05305897void hdd_wmm_tx_snapshot(hdd_adapter_t *pAdapter)
5898{
5899 /*
5900 * Function to display HDD WMM information
5901 * for Tx Queues.
5902 * Prints globala as well as per client depending
5903 * whether the clients are registered or not.
5904 */
5905 int i = 0, j = 0;
5906 for ( i=0; i< NUM_TX_QUEUES; i++)
5907 {
Madan Mohan Koyyalamudi2be9f0c2013-07-25 16:30:37 +05305908 spin_lock_bh(&pAdapter->wmm_tx_queue[i].lock);
Jeff Johnson0299d0a2013-10-30 12:37:43 -07005909 hddLog(LOGE, "HDD WMM TxQueue Info For AC: %d Count: %d PrevAdress:%p, NextAddress:%p",
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05305910 i, pAdapter->wmm_tx_queue[i].count,
5911 pAdapter->wmm_tx_queue[i].anchor.prev, pAdapter->wmm_tx_queue[i].anchor.next);
Madan Mohan Koyyalamudi2be9f0c2013-07-25 16:30:37 +05305912 spin_unlock_bh(&pAdapter->wmm_tx_queue[i].lock);
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05305913 }
5914
5915 for(i =0; i<WLAN_MAX_STA_COUNT; i++)
5916 {
5917 if(pAdapter->aStaInfo[i].isUsed)
5918 {
5919 hddLog(LOGE, "******STAIndex: %d*********", i);
5920 for ( j=0; j< NUM_TX_QUEUES; j++)
5921 {
Madan Mohan Koyyalamudi2be9f0c2013-07-25 16:30:37 +05305922 spin_lock_bh(&pAdapter->aStaInfo[i].wmm_tx_queue[j].lock);
Jeff Johnson0299d0a2013-10-30 12:37:43 -07005923 hddLog(LOGE, "HDD TxQueue Info For AC: %d Count: %d PrevAdress:%p, NextAddress:%p",
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05305924 j, pAdapter->aStaInfo[i].wmm_tx_queue[j].count,
5925 pAdapter->aStaInfo[i].wmm_tx_queue[j].anchor.prev,
5926 pAdapter->aStaInfo[i].wmm_tx_queue[j].anchor.next);
Madan Mohan Koyyalamudi2be9f0c2013-07-25 16:30:37 +05305927 spin_unlock_bh(&pAdapter->aStaInfo[i].wmm_tx_queue[j].lock);
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05305928 }
5929 }
5930 }
5931
5932}
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05305933int __iw_set_var_ints_getnone(struct net_device *dev,
5934 struct iw_request_info *info,
5935 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07005936{
5937 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
5938 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
Girish Gowlid4522fd2014-06-14 17:20:27 +05305939 int sub_cmd;
Jeff Johnson295189b2012-06-20 16:38:30 -07005940 int apps_args[MAX_VAR_ARGS] = {0};
Girish Gowlid4522fd2014-06-14 17:20:27 +05305941 int num_args;
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08005942 hdd_station_ctx_t *pStaCtx = NULL ;
Mahesh A Saptasagar178ab1d2014-09-08 15:11:05 +05305943 hdd_context_t *pHddCtx = NULL;
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08005944 hdd_ap_ctx_t *pAPCtx = NULL;
5945 int cmd = 0;
5946 int staId = 0;
Mahesh A Saptasagar178ab1d2014-09-08 15:11:05 +05305947 int ret = 0;
Girish Gowlid4522fd2014-06-14 17:20:27 +05305948 struct iw_point s_priv_data;
Jeff Johnson295189b2012-06-20 16:38:30 -07005949
Girish Gowlid4522fd2014-06-14 17:20:27 +05305950 /* helper function to get iwreq_data with compat handling. */
5951 if (hdd_priv_get_data(&s_priv_data, wrqu))
5952 {
5953 return -EINVAL;
5954 }
5955
5956 if (NULL == s_priv_data.pointer)
5957 {
5958 return -EINVAL;
5959 }
5960
5961 sub_cmd = s_priv_data.flags;
5962 num_args = s_priv_data.length;
5963
5964 hddLog(LOG1, "%s: Received length %d", __func__, s_priv_data.length);
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005965
Mahesh A Saptasagar178ab1d2014-09-08 15:11:05 +05305966 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
5967 ret = wlan_hdd_validate_context(pHddCtx);
5968 if (0 != ret)
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005969 {
Mahesh A Saptasagar178ab1d2014-09-08 15:11:05 +05305970 VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5971 "%s: HDD context is Null", __func__);
5972 return ret;
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08005973 }
5974
Jeff Johnson295189b2012-06-20 16:38:30 -07005975 if (num_args > MAX_VAR_ARGS)
5976 {
5977 num_args = MAX_VAR_ARGS;
5978 }
Arif Hussain0273cba2014-01-07 20:58:29 -08005979
5980 /* ODD number is used for set, copy data using copy_from_user */
Girish Gowlid4522fd2014-06-14 17:20:27 +05305981 if (copy_from_user(apps_args, s_priv_data.pointer, (sizeof(int)) * num_args))
Arif Hussain0273cba2014-01-07 20:58:29 -08005982 {
5983 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
5984 "%s: failed to copy data to user buffer", __func__);
5985 return -EFAULT;
5986 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005987
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08005988 if(( sub_cmd == WE_MCC_CONFIG_CREDENTIAL ) ||
5989 (sub_cmd == WE_MCC_CONFIG_PARAMS ))
5990 {
5991 if(( pAdapter->device_mode == WLAN_HDD_INFRA_STATION )||
5992 ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT ))
5993 {
5994 pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
5995 staId = pStaCtx->conn_info.staId[0];
5996 }
5997 else if (( pAdapter->device_mode == WLAN_HDD_P2P_GO ) ||
5998 ( pAdapter->device_mode == WLAN_HDD_SOFTAP ))
5999 {
6000 pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter);
6001 staId = pAPCtx->uBCStaId;
6002 }
6003 else
6004 {
6005 hddLog(LOGE, "%s: Device mode %d not recognised", __FUNCTION__, pAdapter->device_mode);
6006 return 0;
6007 }
6008 }
6009
Jeff Johnson295189b2012-06-20 16:38:30 -07006010 switch (sub_cmd)
6011 {
6012 case WE_LOG_DUMP_CMD:
6013 {
6014 hddLog(LOG1, "%s: LOG_DUMP %d arg1 %d arg2 %d arg3 %d arg4 %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006015 __func__, apps_args[0], apps_args[1], apps_args[2],
Jeff Johnson295189b2012-06-20 16:38:30 -07006016 apps_args[3], apps_args[4]);
6017
6018 logPrintf(hHal, apps_args[0], apps_args[1], apps_args[2],
6019 apps_args[3], apps_args[4]);
6020
6021 }
6022 break;
6023
Jeff Johnson295189b2012-06-20 16:38:30 -07006024 case WE_P2P_NOA_CMD:
6025 {
6026 p2p_app_setP2pPs_t p2pNoA;
6027
6028 p2pNoA.opp_ps = apps_args[0];
6029 p2pNoA.ctWindow = apps_args[1];
6030 p2pNoA.duration = apps_args[2];
6031 p2pNoA.interval = apps_args[3];
6032 p2pNoA.count = apps_args[4];
6033 p2pNoA.single_noa_duration = apps_args[5];
6034 p2pNoA.psSelection = apps_args[6];
6035
6036 hddLog(LOG1, "%s: P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d "
6037 "interval %d count %d single noa duration %d PsSelection %x",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006038 __func__, apps_args[0], apps_args[1], apps_args[2],
Jeff Johnson295189b2012-06-20 16:38:30 -07006039 apps_args[3], apps_args[4], apps_args[5], apps_args[6]);
6040
6041 hdd_setP2pPs(dev, &p2pNoA);
6042
6043 }
6044 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07006045
Katya Nigamc2f29dc2014-01-20 19:29:30 +05306046 case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD:
6047 {
6048 hddLog(LOG1, "%s: SELECTIVE_MODULE_LOG %d arg1 %d arg2",
6049 __func__, apps_args[0], apps_args[1]);
6050 vosTraceEnable(apps_args[0], apps_args[1]);
6051 }
6052 break;
6053
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07006054 case WE_MTRACE_DUMP_CMD:
6055 {
6056 hddLog(LOG1, "%s: MTRACE_DUMP code %d session %d count %d "
6057 "bitmask_of_module %d ",
6058 __func__, apps_args[0], apps_args[1], apps_args[2],
6059 apps_args[3]);
6060 vosTraceDumpAll((void*)hHal , apps_args[0], apps_args[1],
6061 apps_args[2], apps_args[3]);
6062
6063 }
6064 break;
6065
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08006066 case WE_MCC_CONFIG_CREDENTIAL :
6067 {
6068 cmd = 287; //Command should be updated if there is any change
6069 // in the Riva dump command
Kumar Anand90ca3dd2013-01-18 15:24:47 -08006070 if((apps_args[0] >= 40 ) && (apps_args[0] <= 160 ))
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08006071 {
6072 logPrintf(hHal, cmd, staId, apps_args[0], apps_args[1], apps_args[2]);
6073 }
6074 else
6075 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08006076 hddLog(LOGE, "%s : Enter valid MccCredential value between MIN :40 and MAX:160", __func__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08006077 return 0;
6078 }
6079 }
6080 break;
6081
6082 case WE_MCC_CONFIG_PARAMS :
6083 {
6084 cmd = 288; //command Should be updated if there is any change
6085 // in the Riva dump command
6086 hdd_validate_mcc_config(pAdapter, staId, apps_args[0], apps_args[1],apps_args[2]);
6087 }
6088 break;
6089
Chilam NG571c65a2013-01-19 12:27:36 +05306090#ifdef FEATURE_WLAN_TDLS
6091 case WE_TDLS_CONFIG_PARAMS :
6092 {
6093 tdls_config_params_t tdlsParams;
6094
Chilam Ng01120412013-02-19 18:32:21 -08006095 tdlsParams.tdls = apps_args[0];
6096 tdlsParams.tx_period_t = apps_args[1];
6097 tdlsParams.tx_packet_n = apps_args[2];
6098 tdlsParams.discovery_period_t = apps_args[3];
6099 tdlsParams.discovery_tries_n = apps_args[4];
6100 tdlsParams.idle_timeout_t = apps_args[5];
6101 tdlsParams.idle_packet_n = apps_args[6];
6102 tdlsParams.rssi_hysteresis = apps_args[7];
6103 tdlsParams.rssi_trigger_threshold = apps_args[8];
6104 tdlsParams.rssi_teardown_threshold = apps_args[9];
Chilam NG571c65a2013-01-19 12:27:36 +05306105
Chilam Ng01120412013-02-19 18:32:21 -08006106 wlan_hdd_tdls_set_params(dev, &tdlsParams);
Chilam NG571c65a2013-01-19 12:27:36 +05306107 }
6108 break;
6109#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07006110 default:
6111 {
Jeff Johnson11e77032014-02-14 13:22:22 -08006112 hddLog(LOGE, "%s: Invalid IOCTL command %d",
6113 __func__, sub_cmd );
Jeff Johnson295189b2012-06-20 16:38:30 -07006114 }
6115 break;
6116 }
6117
6118 return 0;
6119}
6120
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306121int iw_set_var_ints_getnone(struct net_device *dev,
6122 struct iw_request_info *info,
6123 union iwreq_data *wrqu, char *extra)
6124{
6125 int ret;
6126 vos_ssr_protect(__func__);
6127 ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra);
6128 vos_ssr_unprotect(__func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006129
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306130 return ret;
6131}
6132
6133static int __iw_add_tspec(struct net_device *dev,
6134 struct iw_request_info *info,
6135 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07006136{
6137 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
6138 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
6139 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra;
6140 int params[HDD_WLAN_WMM_PARAM_COUNT];
6141 sme_QosWmmTspecInfo tSpec;
6142 v_U32_t handle;
Girish Gowli19993982014-06-12 20:05:32 +05306143 struct iw_point s_priv_data;
Jeff Johnson295189b2012-06-20 16:38:30 -07006144
6145 // make sure the application is sufficiently priviledged
6146 // note that the kernel will do this for "set" ioctls, but since
6147 // this ioctl wants to return status to user space it must be
6148 // defined as a "get" ioctl
6149 if (!capable(CAP_NET_ADMIN))
6150 {
6151 return -EPERM;
6152 }
6153
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08006154 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
6155 {
6156 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
6157 "%s:LOGP in Progress. Ignore!!!", __func__);
6158 return -EBUSY;
6159 }
6160
Jeff Johnson295189b2012-06-20 16:38:30 -07006161 // we must be associated in order to add a tspec
6162 if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
6163 {
6164 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6165 return 0;
6166 }
6167
6168 // since we are defined to be a "get" ioctl, and since the number
6169 // of params exceeds the number of params that wireless extensions
Girish Gowli19993982014-06-12 20:05:32 +05306170 // will pass down in the iwreq_data, we must copy the "set" params.
6171 // We must handle the compat for iwreq_data in 32U/64K environment.
6172
6173 // helper fucntion to get iwreq_data with compat handling.
6174 if (hdd_priv_get_data(&s_priv_data, wrqu))
6175 {
6176 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6177 return 0;
6178 }
6179
6180 // make sure all params are correctly passed to function
6181 if ((NULL == s_priv_data.pointer) ||
6182 (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length))
6183 {
6184 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6185 return 0;
6186 }
6187
Jeff Johnson295189b2012-06-20 16:38:30 -07006188 // from user space ourselves
Girish Gowli19993982014-06-12 20:05:32 +05306189 if (copy_from_user(&params, s_priv_data.pointer, sizeof(params)))
Jeff Johnson295189b2012-06-20 16:38:30 -07006190 {
6191 // hmmm, can't get them
6192 return -EIO;
6193 }
6194
6195 // clear the tspec
6196 memset(&tSpec, 0, sizeof(tSpec));
6197
6198 // validate the handle
6199 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
6200 if (HDD_WMM_HANDLE_IMPLICIT == handle)
6201 {
6202 // that one is reserved
6203 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6204 return 0;
6205 }
6206
6207 // validate the TID
6208 if (params[HDD_WLAN_WMM_PARAM_TID] > 7)
6209 {
6210 // out of range
6211 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6212 return 0;
6213 }
6214 tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID];
6215
6216 // validate the direction
6217 switch (params[HDD_WLAN_WMM_PARAM_DIRECTION])
6218 {
6219 case HDD_WLAN_WMM_DIRECTION_UPSTREAM:
6220 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK;
6221 break;
6222
6223 case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM:
6224 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK;
6225 break;
6226
6227 case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL:
6228 tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH;
6229 break;
6230
6231 default:
6232 // unknown
6233 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6234 return 0;
6235 }
6236
Madan Mohan Koyyalamudia5643d62013-09-25 14:37:55 +05306237 tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD];
6238
Jeff Johnson295189b2012-06-20 16:38:30 -07006239 // validate the user priority
6240 if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX)
6241 {
6242 // out of range
6243 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6244 return 0;
6245 }
6246 tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY];
Kiet Lamc6bef882013-11-11 17:07:36 +05306247 if(0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up)
6248 {
6249 hddLog(VOS_TRACE_LEVEL_ERROR,"***ts_info.up out of bounds***");
6250 return 0;
6251 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006252
Madan Mohan Koyyalamudic0c62382013-08-16 23:46:14 +05306253 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH,
6254 "%s:TS_INFO PSB %d UP %d !!!", __func__,
6255 tSpec.ts_info.psb, tSpec.ts_info.up);
6256
Jeff Johnson295189b2012-06-20 16:38:30 -07006257 tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE];
6258 tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE];
6259 tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE];
6260 tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE];
6261 tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE];
6262 tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE];
6263 tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE];
6264 tSpec.surplus_bw_allowance = params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE];
6265 tSpec.min_service_interval = params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL];
6266 tSpec.max_service_interval = params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL];
6267 tSpec.suspension_interval = params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL];
6268 tSpec.inactivity_interval = params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL];
6269
6270 tSpec.ts_info.burst_size_defn = params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN];
6271
6272 // validate the ts info ack policy
6273 switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY])
6274 {
6275 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK:
6276 tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK;
6277 break;
6278
6279 case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK:
6280 tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK;
6281 break;
6282
6283 default:
6284 // unknown
6285 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6286 return 0;
6287 }
6288
6289 *pStatus = hdd_wmm_addts(pAdapter, handle, &tSpec);
6290 return 0;
6291}
6292
6293
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306294static int iw_add_tspec(struct net_device *dev,
6295 struct iw_request_info *info,
Jeff Johnson295189b2012-06-20 16:38:30 -07006296 union iwreq_data *wrqu, char *extra)
6297{
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306298 int ret;
6299
6300 vos_ssr_protect(__func__);
6301 ret = __iw_add_tspec(dev, info, wrqu, extra);
6302 vos_ssr_unprotect(__func__);
6303
6304 return ret;
6305}
6306
6307static int __iw_del_tspec(struct net_device *dev,
6308 struct iw_request_info *info,
6309 union iwreq_data *wrqu, char *extra)
6310{
Jeff Johnson295189b2012-06-20 16:38:30 -07006311 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
6312 int *params = (int *)extra;
6313 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra;
6314 v_U32_t handle;
6315
6316 // make sure the application is sufficiently priviledged
6317 // note that the kernel will do this for "set" ioctls, but since
6318 // this ioctl wants to return status to user space it must be
6319 // defined as a "get" ioctl
6320 if (!capable(CAP_NET_ADMIN))
6321 {
6322 return -EPERM;
6323 }
6324
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08006325 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
6326 {
6327 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
6328 "%s:LOGP in Progress. Ignore!!!", __func__);
6329 return -EBUSY;
6330 }
6331
Jeff Johnson295189b2012-06-20 16:38:30 -07006332 // although we are defined to be a "get" ioctl, the params we require
6333 // will fit in the iwreq_data, therefore unlike iw_add_tspec() there
6334 // is no need to copy the params from user space
6335
6336 // validate the handle
6337 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
6338 if (HDD_WMM_HANDLE_IMPLICIT == handle)
6339 {
6340 // that one is reserved
6341 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6342 return 0;
6343 }
6344
6345 *pStatus = hdd_wmm_delts(pAdapter, handle);
6346 return 0;
6347}
6348
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306349static int iw_del_tspec(struct net_device *dev,
6350 struct iw_request_info *info,
Jeff Johnson295189b2012-06-20 16:38:30 -07006351 union iwreq_data *wrqu, char *extra)
6352{
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306353 int ret;
6354
6355 vos_ssr_protect(__func__);
6356 ret = __iw_del_tspec(dev, info, wrqu, extra);
6357 vos_ssr_unprotect(__func__);
6358
6359 return ret;
6360}
6361
6362
6363static int __iw_get_tspec(struct net_device *dev,
6364 struct iw_request_info *info,
6365 union iwreq_data *wrqu, char *extra)
6366{
Jeff Johnson295189b2012-06-20 16:38:30 -07006367 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
6368 int *params = (int *)extra;
6369 hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra;
6370 v_U32_t handle;
6371
6372 // although we are defined to be a "get" ioctl, the params we require
6373 // will fit in the iwreq_data, therefore unlike iw_add_tspec() there
6374 // is no need to copy the params from user space
6375
6376 // validate the handle
6377 handle = params[HDD_WLAN_WMM_PARAM_HANDLE];
6378 if (HDD_WMM_HANDLE_IMPLICIT == handle)
6379 {
6380 // that one is reserved
6381 *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM;
6382 return 0;
6383 }
6384
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08006385 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
6386 {
6387 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
6388 "%s:LOGP in Progress. Ignore!!!", __func__);
6389 return -EBUSY;
6390 }
6391
Jeff Johnson295189b2012-06-20 16:38:30 -07006392 *pStatus = hdd_wmm_checkts(pAdapter, handle);
6393 return 0;
6394}
6395
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306396static int iw_get_tspec(struct net_device *dev,
6397 struct iw_request_info *info,
6398 union iwreq_data *wrqu, char *extra)
6399{
6400 int ret;
6401
6402 vos_ssr_protect(__func__);
6403 ret = __iw_get_tspec(dev, info, wrqu, extra);
6404 vos_ssr_unprotect(__func__);
6405
6406 return ret;
6407}
6408
Jeff Johnson295189b2012-06-20 16:38:30 -07006409#ifdef WLAN_FEATURE_VOWIFI_11R
6410//
6411//
6412// Each time the supplicant has the auth_request or reassoc request
6413// IEs ready. This is pushed to the driver. The driver will inturn use
6414// it to send out the auth req and reassoc req for 11r FT Assoc.
6415//
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306416static int __iw_set_fties(struct net_device *dev,
6417 struct iw_request_info *info,
6418 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07006419{
6420 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
6421 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
6422 //v_CONTEXT_t pVosContext;
6423
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08006424 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
6425 {
6426 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
6427 "%s:LOGP in Progress. Ignore!!!", __func__);
6428 return -EBUSY;
6429 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006430 if (!wrqu->data.length)
6431 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08006432 hddLog(LOGE, FL("called with 0 length IEs"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006433 return -EINVAL;
6434 }
6435 if (wrqu->data.pointer == NULL)
6436 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08006437 hddLog(LOGE, FL("called with NULL IE"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006438 return -EINVAL;
6439 }
6440
6441 // Added for debug on reception of Re-assoc Req.
6442 if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
6443 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08006444 hddLog(LOGE, FL("Called with Ie of length = %d when not associated"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006445 wrqu->data.length);
Arif Hussain6d2a3322013-11-17 19:50:10 -08006446 hddLog(LOGE, FL("Should be Re-assoc Req IEs"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006447 }
6448
6449#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Arif Hussain6d2a3322013-11-17 19:50:10 -08006450 hddLog(LOGE, FL("%s called with Ie of length = %d"), __func__, wrqu->data.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07006451#endif
6452
6453 // Pass the received FT IEs to SME
Arif Hussain7adce1b2013-11-11 22:59:34 -08006454 sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, extra,
Jeff Johnson295189b2012-06-20 16:38:30 -07006455 wrqu->data.length);
6456
6457 return 0;
6458}
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306459
6460static int iw_set_fties(struct net_device *dev,
6461 struct iw_request_info *info,
6462 union iwreq_data *wrqu, char *extra)
6463{
6464 int ret;
6465
6466 vos_ssr_protect(__func__);
6467 ret = __iw_set_fties(dev, info, wrqu, extra);
6468 vos_ssr_unprotect(__func__);
6469
6470 return ret;
6471}
Jeff Johnson295189b2012-06-20 16:38:30 -07006472#endif
6473
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306474static int __iw_set_dynamic_mcbc_filter(struct net_device *dev,
Madan Mohan Koyyalamudif55e62a2012-09-24 11:14:27 -07006475 struct iw_request_info *info,
Jeff Johnson295189b2012-06-20 16:38:30 -07006476 union iwreq_data *wrqu, char *extra)
Amar Singhalf3a6e762013-02-19 15:06:50 -08006477{
Jeff Johnson295189b2012-06-20 16:38:30 -07006478 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Arif Hussain7adce1b2013-11-11 22:59:34 -08006479 tpRcvFltMcAddrList pRequest = (tpRcvFltMcAddrList)extra;
Jeff Johnson295189b2012-06-20 16:38:30 -07006480 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Madan Mohan Koyyalamudif55e62a2012-09-24 11:14:27 -07006481 tpSirWlanSetRxpFilters wlanRxpFilterParam;
Amar Singhalf3a6e762013-02-19 15:06:50 -08006482 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
Amar Singhalf3a6e762013-02-19 15:06:50 -08006483 tpSirRcvFltMcAddrList mc_addr_list_ptr;
6484 int idx;
6485 eHalStatus ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -07006486
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08006487 if (pHddCtx->isLogpInProgress)
6488 {
6489 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
6490 "%s:LOGP in Progress. Ignore!!!", __func__);
6491 return -EBUSY;
6492 }
6493
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306494 if (HDD_MULTICAST_FILTER_LIST == pRequest->mcastBcastFilterSetting)
6495 {
Gopichand Nakkalab03e8082013-05-30 18:09:25 +05306496#ifdef WLAN_FEATURE_PACKET_FILTERING
Jeff Johnson295189b2012-06-20 16:38:30 -07006497
Amar Singhalf3a6e762013-02-19 15:06:50 -08006498 mc_addr_list_ptr = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
6499 if (NULL == mc_addr_list_ptr)
Madan Mohan Koyyalamudif55e62a2012-09-24 11:14:27 -07006500 {
Amar Singhalf3a6e762013-02-19 15:06:50 -08006501 hddLog(VOS_TRACE_LEVEL_ERROR,
6502 "%s: vos_mem_alloc failed", __func__);
6503 return -ENOMEM;
Madan Mohan Koyyalamudif55e62a2012-09-24 11:14:27 -07006504 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006505
6506 mc_addr_list_ptr->ulMulticastAddrCnt = pRequest->mcast_addr_cnt;
6507
6508 if (mc_addr_list_ptr->ulMulticastAddrCnt > HDD_MAX_NUM_MULTICAST_ADDRESS)
6509 mc_addr_list_ptr->ulMulticastAddrCnt = HDD_MAX_NUM_MULTICAST_ADDRESS;
6510
6511 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s MC Addr List Cnt %d", __func__,
6512 mc_addr_list_ptr->ulMulticastAddrCnt);
6513
6514 for (idx = 0; idx < mc_addr_list_ptr->ulMulticastAddrCnt; idx++)
Madan Mohan Koyyalamudif55e62a2012-09-24 11:14:27 -07006515 {
Amar Singhalf3a6e762013-02-19 15:06:50 -08006516 memcpy(&mc_addr_list_ptr->multicastAddr[idx],
6517 pRequest->multicastAddr[idx], HDD_WLAN_MAC_ADDR_LEN);
6518
6519 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s MC Addr for Idx %d ="MAC_ADDRESS_STR, __func__,
6520 idx, MAC_ADDR_ARRAY(mc_addr_list_ptr->multicastAddr[idx]));
Madan Mohan Koyyalamudif55e62a2012-09-24 11:14:27 -07006521 }
Madan Mohan Koyyalamudif55e62a2012-09-24 11:14:27 -07006522
Amar Singhalf3a6e762013-02-19 15:06:50 -08006523 ret_val = sme_8023MulticastList(hHal, pAdapter->sessionId, mc_addr_list_ptr);
6524 vos_mem_free(mc_addr_list_ptr);
6525 if (eHAL_STATUS_SUCCESS != ret_val)
6526 {
6527 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to Set MC Address List",
6528 __func__);
6529 return -EINVAL;
6530 }
Gopichand Nakkalab03e8082013-05-30 18:09:25 +05306531#endif //WLAN_FEATURE_PACKET_FILTERING
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306532 }
6533 else
6534 {
Madan Mohan Koyyalamudif55e62a2012-09-24 11:14:27 -07006535
Amar Singhalf3a6e762013-02-19 15:06:50 -08006536 hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
6537 "%s: Set MC BC Filter Config request: %d suspend %d",
6538 __func__, pRequest->mcastBcastFilterSetting,
6539 pHddCtx->hdd_wlan_suspended);
6540
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306541 pHddCtx->configuredMcastBcastFilter = pRequest->mcastBcastFilterSetting;
Amar Singhalf3a6e762013-02-19 15:06:50 -08006542
6543 if (pHddCtx->hdd_wlan_suspended)
6544 {
Jeff Johnsonce3d75e2013-04-05 22:34:54 -07006545 wlanRxpFilterParam = vos_mem_malloc(sizeof(tSirWlanSetRxpFilters));
6546 if (NULL == wlanRxpFilterParam)
6547 {
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306548 hddLog(VOS_TRACE_LEVEL_ERROR,
Jeff Johnsonce3d75e2013-04-05 22:34:54 -07006549 "%s: vos_mem_alloc failed", __func__);
6550 return -EINVAL;
6551 }
6552
Amar Singhalf3a6e762013-02-19 15:06:50 -08006553 wlanRxpFilterParam->configuredMcstBcstFilterSetting =
6554 pRequest->mcastBcastFilterSetting;
6555 wlanRxpFilterParam->setMcstBcstFilter = TRUE;
6556
Gopichand Nakkalab03e8082013-05-30 18:09:25 +05306557 hdd_conf_hostoffload(pAdapter, TRUE);
6558 wlanRxpFilterParam->configuredMcstBcstFilterSetting =
6559 pHddCtx->configuredMcastBcastFilter;
Amar Singhalf3a6e762013-02-19 15:06:50 -08006560
6561 hddLog(VOS_TRACE_LEVEL_INFO, "%s:MC/BC changed Req %d Set %d En %d",
6562 __func__,
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306563 pHddCtx->configuredMcastBcastFilter,
Amar Singhalf3a6e762013-02-19 15:06:50 -08006564 wlanRxpFilterParam->configuredMcstBcstFilterSetting,
6565 wlanRxpFilterParam->setMcstBcstFilter);
6566
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306567 if (eHAL_STATUS_SUCCESS !=
6568 sme_ConfigureRxpFilter(WLAN_HDD_GET_HAL_CTX(pAdapter),
6569 wlanRxpFilterParam))
Amar Singhalf3a6e762013-02-19 15:06:50 -08006570 {
6571 hddLog(VOS_TRACE_LEVEL_ERROR,
6572 "%s: Failure to execute set HW MC/BC Filter request",
6573 __func__);
Chilam Ngc4244af2013-04-01 15:37:32 -07006574 vos_mem_free(wlanRxpFilterParam);
Amar Singhalf3a6e762013-02-19 15:06:50 -08006575 return -EINVAL;
6576 }
6577
c_hpothud3ce76d2014-10-28 10:34:13 +05306578 if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid)
6579 {
6580 pHddCtx->sus_res_mcastbcast_filter =
6581 pRequest->mcastBcastFilterSetting;
6582 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006583 }
Madan Mohan Koyyalamudif55e62a2012-09-24 11:14:27 -07006584 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006585
6586 return 0;
6587}
6588
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306589static int iw_set_dynamic_mcbc_filter(struct net_device *dev,
6590 struct iw_request_info *info,
6591 union iwreq_data *wrqu, char *extra)
6592{
6593 int ret;
6594
6595 vos_ssr_protect(__func__);
6596 ret = __iw_set_dynamic_mcbc_filter(dev, info, wrqu, extra);
6597 vos_ssr_unprotect(__func__);
6598
6599 return ret;
6600}
6601
6602static int __iw_clear_dynamic_mcbc_filter(struct net_device *dev,
6603 struct iw_request_info *info,
6604 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07006605{
6606 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
6607 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306608 tpSirWlanSetRxpFilters wlanRxpFilterParam;
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006609 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: ", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006610
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306611 //Reset the filter to INI value as we have to clear the dynamic filter
6612 pHddCtx->configuredMcastBcastFilter = pHddCtx->cfg_ini->mcastBcastFilterSetting;
Jeff Johnson295189b2012-06-20 16:38:30 -07006613
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306614 //Configure FW with new setting
6615 if (pHddCtx->hdd_wlan_suspended)
6616 {
6617 wlanRxpFilterParam = vos_mem_malloc(sizeof(tSirWlanSetRxpFilters));
6618 if (NULL == wlanRxpFilterParam)
6619 {
6620 hddLog(VOS_TRACE_LEVEL_ERROR,
6621 "%s: vos_mem_alloc failed", __func__);
6622 return -EINVAL;
6623 }
6624
6625 wlanRxpFilterParam->configuredMcstBcstFilterSetting =
6626 pHddCtx->configuredMcastBcastFilter;
6627 wlanRxpFilterParam->setMcstBcstFilter = TRUE;
6628
Gopichand Nakkalab03e8082013-05-30 18:09:25 +05306629 hdd_conf_hostoffload(pAdapter, TRUE);
6630 wlanRxpFilterParam->configuredMcstBcstFilterSetting =
6631 pHddCtx->configuredMcastBcastFilter;
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306632
6633 if (eHAL_STATUS_SUCCESS !=
6634 sme_ConfigureRxpFilter(WLAN_HDD_GET_HAL_CTX(pAdapter),
6635 wlanRxpFilterParam))
6636 {
6637 hddLog(VOS_TRACE_LEVEL_ERROR,
6638 "%s: Failure to execute set HW MC/BC Filter request",
6639 __func__);
6640 vos_mem_free(wlanRxpFilterParam);
6641 return -EINVAL;
6642 }
c_hpothud3ce76d2014-10-28 10:34:13 +05306643
6644 if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid)
6645 {
6646 pHddCtx->sus_res_mcastbcast_filter =
6647 pHddCtx->cfg_ini->mcastBcastFilterSetting;
6648 }
6649
Gopichand Nakkalab8f0f1a2013-05-23 18:19:48 +05306650 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006651 return 0;
6652}
6653
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306654
6655static int iw_clear_dynamic_mcbc_filter(struct net_device *dev,
6656 struct iw_request_info *info,
6657 union iwreq_data *wrqu, char *extra)
6658{
6659 int ret;
6660
6661 vos_ssr_protect(__func__);
6662 ret = __iw_clear_dynamic_mcbc_filter(dev, info, wrqu, extra);
6663 vos_ssr_unprotect(__func__);
6664
6665 return ret;
6666}
6667
6668static int __iw_set_host_offload(struct net_device *dev,
6669 struct iw_request_info *info,
6670 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07006671{
6672 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Arif Hussain7adce1b2013-11-11 22:59:34 -08006673 tpHostOffloadRequest pRequest = (tpHostOffloadRequest) extra;
Jeff Johnson295189b2012-06-20 16:38:30 -07006674 tSirHostOffloadReq offloadRequest;
6675
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08006676 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
6677 {
6678 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
6679 "%s:LOGP in Progress. Ignore!!!", __func__);
6680 return -EBUSY;
6681 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006682 /* Debug display of request components. */
6683 switch (pRequest->offloadType)
6684 {
6685 case WLAN_IPV4_ARP_REPLY_OFFLOAD:
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006686 hddLog(VOS_TRACE_LEVEL_WARN, "%s: Host offload request: ARP reply", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006687 switch (pRequest->enableOrDisable)
6688 {
6689 case WLAN_OFFLOAD_DISABLE:
6690 hddLog(VOS_TRACE_LEVEL_WARN, " disable");
6691 break;
6692 case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE:
6693 hddLog(VOS_TRACE_LEVEL_WARN, " BC Filtering enable");
6694 case WLAN_OFFLOAD_ENABLE:
6695 hddLog(VOS_TRACE_LEVEL_WARN, " ARP offload enable");
6696 hddLog(VOS_TRACE_LEVEL_WARN, " IP address: %d.%d.%d.%d",
6697 pRequest->params.hostIpv4Addr[0], pRequest->params.hostIpv4Addr[1],
6698 pRequest->params.hostIpv4Addr[2], pRequest->params.hostIpv4Addr[3]);
6699 }
6700 break;
6701
6702 case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD:
Arif Hussain6d2a3322013-11-17 19:50:10 -08006703 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Host offload request: neighbor discovery",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006704 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006705 switch (pRequest->enableOrDisable)
6706 {
6707 case WLAN_OFFLOAD_DISABLE:
6708 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " disable");
6709 break;
6710 case WLAN_OFFLOAD_ENABLE:
6711 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " enable");
6712 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " IP address: %x:%x:%x:%x:%x:%x:%x:%x",
6713 *(v_U16_t *)(pRequest->params.hostIpv6Addr),
6714 *(v_U16_t *)(pRequest->params.hostIpv6Addr + 2),
6715 *(v_U16_t *)(pRequest->params.hostIpv6Addr + 4),
6716 *(v_U16_t *)(pRequest->params.hostIpv6Addr + 6),
6717 *(v_U16_t *)(pRequest->params.hostIpv6Addr + 8),
6718 *(v_U16_t *)(pRequest->params.hostIpv6Addr + 10),
6719 *(v_U16_t *)(pRequest->params.hostIpv6Addr + 12),
6720 *(v_U16_t *)(pRequest->params.hostIpv6Addr + 14));
6721 }
6722 }
6723
6724 /* Execute offload request. The reason that we can copy the request information
6725 from the ioctl structure to the SME structure is that they are laid out
6726 exactly the same. Otherwise, each piece of information would have to be
6727 copied individually. */
6728 memcpy(&offloadRequest, pRequest, wrqu->data.length);
Jeff Johnsone7245742012-09-05 17:12:55 -07006729 if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter),
6730 pAdapter->sessionId, &offloadRequest))
Jeff Johnson295189b2012-06-20 16:38:30 -07006731 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08006732 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute host offload request",
Jeff Johnson295189b2012-06-20 16:38:30 -07006733 __func__);
6734 return -EINVAL;
6735 }
6736
6737 return 0;
6738}
6739
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306740static int iw_set_host_offload(struct net_device *dev,
6741 struct iw_request_info *info,
6742 union iwreq_data *wrqu, char *extra)
6743{
6744 int ret;
6745
6746 vos_ssr_protect(__func__);
6747 ret = __iw_set_host_offload(dev, info, wrqu, extra);
6748 vos_ssr_unprotect(__func__);
6749
6750 return ret;
6751}
6752
6753static int __iw_set_keepalive_params(struct net_device *dev,
6754 struct iw_request_info *info,
6755 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07006756{
6757 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Arif Hussain7adce1b2013-11-11 22:59:34 -08006758 tpKeepAliveRequest pRequest = (tpKeepAliveRequest) extra;
Jeff Johnson295189b2012-06-20 16:38:30 -07006759 tSirKeepAliveReq keepaliveRequest;
6760
6761 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
6762 {
6763 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08006764 "%s:LOGP in Progress. Ignore!!!", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006765 return 0;
6766 }
6767
6768 /* Debug display of request components. */
Jeff Johnson59a121e2013-11-30 09:46:08 -08006769 hddLog(VOS_TRACE_LEVEL_INFO,
6770 "%s: Set Keep Alive Request : TimePeriod %d size %zu",
6771 __func__, pRequest->timePeriod, sizeof(tKeepAliveRequest));
Jeff Johnson295189b2012-06-20 16:38:30 -07006772
6773 switch (pRequest->packetType)
6774 {
6775 case WLAN_KEEP_ALIVE_NULL_PKT:
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006776 hddLog(VOS_TRACE_LEVEL_WARN, "%s: Keep Alive Request: Tx NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006777 break;
6778
6779 case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP:
6780
Arif Hussain6d2a3322013-11-17 19:50:10 -08006781 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Keep Alive Request: Tx UnSolicited ARP RSP",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006782 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006783
6784 hddLog(VOS_TRACE_LEVEL_WARN, " Host IP address: %d.%d.%d.%d",
6785 pRequest->hostIpv4Addr[0], pRequest->hostIpv4Addr[1],
6786 pRequest->hostIpv4Addr[2], pRequest->hostIpv4Addr[3]);
6787
6788 hddLog(VOS_TRACE_LEVEL_WARN, " Dest IP address: %d.%d.%d.%d",
6789 pRequest->destIpv4Addr[0], pRequest->destIpv4Addr[1],
6790 pRequest->destIpv4Addr[2], pRequest->destIpv4Addr[3]);
6791
6792 hddLog(VOS_TRACE_LEVEL_WARN, " Dest MAC address: %d:%d:%d:%d:%d:%d",
6793 pRequest->destMacAddr[0], pRequest->destMacAddr[1],
6794 pRequest->destMacAddr[2], pRequest->destMacAddr[3],
6795 pRequest->destMacAddr[4], pRequest->destMacAddr[5]);
6796 break;
6797
6798 }
6799
6800 /* Execute keep alive request. The reason that we can copy the request information
6801 from the ioctl structure to the SME structure is that they are laid out
6802 exactly the same. Otherwise, each piece of information would have to be
6803 copied individually. */
6804 memcpy(&keepaliveRequest, pRequest, wrqu->data.length);
6805
Arif Hussain6d2a3322013-11-17 19:50:10 -08006806 hddLog(VOS_TRACE_LEVEL_ERROR, "set Keep: TP before SME %d", keepaliveRequest.timePeriod);
Jeff Johnson295189b2012-06-20 16:38:30 -07006807
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08006808 if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter),
Jeff Johnsone7245742012-09-05 17:12:55 -07006809 pAdapter->sessionId, &keepaliveRequest))
Jeff Johnson295189b2012-06-20 16:38:30 -07006810 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08006811 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Keep Alive",
Jeff Johnson295189b2012-06-20 16:38:30 -07006812 __func__);
6813 return -EINVAL;
6814 }
6815
6816 return 0;
6817}
6818
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05306819static int iw_set_keepalive_params(struct net_device *dev,
6820 struct iw_request_info *info,
6821 union iwreq_data *wrqu, char *extra)
6822{
6823 int ret;
6824 vos_ssr_protect(__func__);
6825 ret = __iw_set_keepalive_params(dev, info, wrqu, extra);
6826 vos_ssr_unprotect(__func__);
6827
6828 return ret;
6829}
6830
Jeff Johnson295189b2012-06-20 16:38:30 -07006831#ifdef WLAN_FEATURE_PACKET_FILTERING
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08006832int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest,
Jeff Johnsone7245742012-09-05 17:12:55 -07006833 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006834{
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006835 tSirRcvPktFilterCfgType packetFilterSetReq = {0};
6836 tSirRcvFltPktClearParam packetFilterClrReq = {0};
Jeff Johnson295189b2012-06-20 16:38:30 -07006837 int i=0;
6838
6839 if (pHddCtx->cfg_ini->disablePacketFilter)
6840 {
6841 hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Packet Filtering Disabled. Returning ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006842 __func__ );
Jeff Johnson295189b2012-06-20 16:38:30 -07006843 return 0;
6844 }
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08006845 if (pHddCtx->isLogpInProgress)
6846 {
6847 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
6848 "%s:LOGP in Progress. Ignore!!!", __func__);
6849 return -EBUSY;
6850 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006851 /* Debug display of request components. */
6852 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Packet Filter Request : FA %d params %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006853 __func__, pRequest->filterAction, pRequest->numParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006854
6855 switch (pRequest->filterAction)
6856 {
6857 case HDD_RCV_FILTER_SET:
6858 hddLog(VOS_TRACE_LEVEL_INFO, "%s: Set Packet Filter Request for Id: %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006859 __func__, pRequest->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006860
6861 packetFilterSetReq.filterId = pRequest->filterId;
6862 if ( pRequest->numParams >= HDD_MAX_CMP_PER_PACKET_FILTER)
6863 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08006864 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Number of Params exceed Max limit %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006865 __func__, pRequest->numParams);
6866 return -EINVAL;
6867 }
6868 packetFilterSetReq.numFieldParams = pRequest->numParams;
6869 packetFilterSetReq.coalesceTime = 0;
6870 packetFilterSetReq.filterType = 1;
6871 for (i=0; i < pRequest->numParams; i++)
6872 {
6873 packetFilterSetReq.paramsData[i].protocolLayer = pRequest->paramsData[i].protocolLayer;
6874 packetFilterSetReq.paramsData[i].cmpFlag = pRequest->paramsData[i].cmpFlag;
6875 packetFilterSetReq.paramsData[i].dataOffset = pRequest->paramsData[i].dataOffset;
6876 packetFilterSetReq.paramsData[i].dataLength = pRequest->paramsData[i].dataLength;
6877 packetFilterSetReq.paramsData[i].reserved = 0;
6878
Arif Hussain6d2a3322013-11-17 19:50:10 -08006879 hddLog(VOS_TRACE_LEVEL_INFO, "Proto %d Comp Flag %d Filter Type %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006880 pRequest->paramsData[i].protocolLayer, pRequest->paramsData[i].cmpFlag,
6881 packetFilterSetReq.filterType);
6882
Arif Hussain6d2a3322013-11-17 19:50:10 -08006883 hddLog(VOS_TRACE_LEVEL_INFO, "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006884 pRequest->paramsData[i].dataOffset, pRequest->paramsData[i].dataLength);
6885
6886 memcpy(&packetFilterSetReq.paramsData[i].compareData,
6887 pRequest->paramsData[i].compareData, pRequest->paramsData[i].dataLength);
6888 memcpy(&packetFilterSetReq.paramsData[i].dataMask,
6889 pRequest->paramsData[i].dataMask, pRequest->paramsData[i].dataLength);
6890
Arif Hussain6d2a3322013-11-17 19:50:10 -08006891 hddLog(VOS_TRACE_LEVEL_INFO, "CData %d CData %d CData %d CData %d CData %d CData %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006892 pRequest->paramsData[i].compareData[0], pRequest->paramsData[i].compareData[1],
6893 pRequest->paramsData[i].compareData[2], pRequest->paramsData[i].compareData[3],
6894 pRequest->paramsData[i].compareData[4], pRequest->paramsData[i].compareData[5]);
6895
Arif Hussain6d2a3322013-11-17 19:50:10 -08006896 hddLog(VOS_TRACE_LEVEL_INFO, "MData %d MData %d MData %d MData %d MData %d MData %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006897 pRequest->paramsData[i].dataMask[0], pRequest->paramsData[i].dataMask[1],
6898 pRequest->paramsData[i].dataMask[2], pRequest->paramsData[i].dataMask[3],
6899 pRequest->paramsData[i].dataMask[4], pRequest->paramsData[i].dataMask[5]);
6900 }
6901
Madan Mohan Koyyalamudi59a40c92012-09-24 14:13:16 -07006902 if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, &packetFilterSetReq, sessionId))
Jeff Johnson295189b2012-06-20 16:38:30 -07006903 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08006904 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Set Filter",
Jeff Johnson295189b2012-06-20 16:38:30 -07006905 __func__);
6906 return -EINVAL;
6907 }
6908
6909 break;
6910
6911 case HDD_RCV_FILTER_CLEAR:
6912
Arif Hussain6d2a3322013-11-17 19:50:10 -08006913 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Clear Packet Filter Request for Id: %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006914 __func__, pRequest->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006915 packetFilterClrReq.filterId = pRequest->filterId;
Madan Mohan Koyyalamudi59a40c92012-09-24 14:13:16 -07006916 if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx->hHal, &packetFilterClrReq, sessionId))
Jeff Johnson295189b2012-06-20 16:38:30 -07006917 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08006918 hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Clear Filter",
Jeff Johnson295189b2012-06-20 16:38:30 -07006919 __func__);
6920 return -EINVAL;
6921 }
6922 break;
6923
6924 default :
Arif Hussain6d2a3322013-11-17 19:50:10 -08006925 hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Packet Filter Request: Invalid %d",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006926 __func__, pRequest->filterAction);
Jeff Johnson295189b2012-06-20 16:38:30 -07006927 return -EINVAL;
6928 }
6929 return 0;
6930}
6931
Gopichand Nakkala227c7f32013-06-26 22:44:57 +05306932int wlan_hdd_setIPv6Filter(hdd_context_t *pHddCtx, tANI_U8 filterType,
6933 tANI_U8 sessionId)
6934{
6935 tSirRcvPktFilterCfgType packetFilterSetReq = {0};
6936 tSirRcvFltPktClearParam packetFilterClrReq = {0};
6937
6938 if (NULL == pHddCtx)
6939 {
6940 hddLog(VOS_TRACE_LEVEL_ERROR, FL(" NULL HDD Context Passed"));
6941 return -EINVAL;
6942 }
6943
6944 if (pHddCtx->isLogpInProgress)
6945 {
6946 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
6947 "%s:LOGP in Progress. Ignore!!!", __func__);
6948 return -EBUSY;
6949 }
6950
6951 if (pHddCtx->cfg_ini->disablePacketFilter)
6952 {
6953 hddLog(VOS_TRACE_LEVEL_ERROR,
6954 "%s: Packet Filtering Disabled. Returning ",
6955 __func__ );
6956 return -EINVAL;
6957 }
6958
6959 switch (filterType)
6960 {
6961 /* For setting IPV6 MC and UC Filter we need to configure
6962 * 2 filters, one for MC and one for UC.
6963 * The Filter ID shouldn't be swapped, which results in making
6964 * UC Filter ineffective.
6965 * We have Hardcode all the values
6966 *
6967 * Reason for a seperate UC filter is because, driver need to
6968 * specify the FW that the specific filter is for unicast
6969 * otherwise FW will not pass the unicast frames by default
6970 * through the filter. This is required to avoid any performance
6971 * hits when no unicast filter is set and only MC/BC are set.
6972 * The way driver informs host is by using the MAC protocol
6973 * layer, CMP flag set to MAX, CMP Data set to 1.
6974 */
6975
6976 case HDD_FILTER_IPV6_MC_UC:
6977 /* Setting IPV6 MC Filter below
6978 */
6979 packetFilterSetReq.filterType = HDD_RCV_FILTER_SET;
6980 packetFilterSetReq.filterId = HDD_FILTER_ID_IPV6_MC;
6981 packetFilterSetReq.numFieldParams = 2;
6982 packetFilterSetReq.paramsData[0].protocolLayer =
6983 HDD_FILTER_PROTO_TYPE_MAC;
6984 packetFilterSetReq.paramsData[0].cmpFlag =
6985 HDD_FILTER_CMP_TYPE_NOT_EQUAL;
6986 packetFilterSetReq.paramsData[0].dataOffset =
6987 WLAN_HDD_80211_FRM_DA_OFFSET;
6988 packetFilterSetReq.paramsData[0].dataLength = 1;
6989 packetFilterSetReq.paramsData[0].compareData[0] =
6990 HDD_IPV6_MC_CMP_DATA;
6991
6992 packetFilterSetReq.paramsData[1].protocolLayer =
6993 HDD_FILTER_PROTO_TYPE_ARP;
6994 packetFilterSetReq.paramsData[1].cmpFlag =
6995 HDD_FILTER_CMP_TYPE_NOT_EQUAL;
6996 packetFilterSetReq.paramsData[1].dataOffset = ETH_ALEN;
6997 packetFilterSetReq.paramsData[1].dataLength = 2;
6998 packetFilterSetReq.paramsData[1].compareData[0] =
6999 HDD_IPV6_CMP_DATA_0;
7000 packetFilterSetReq.paramsData[1].compareData[1] =
7001 HDD_IPV6_CMP_DATA_1;
7002
7003
7004 if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal,
7005 &packetFilterSetReq, sessionId))
7006 {
7007 hddLog(VOS_TRACE_LEVEL_ERROR,
7008 "%s: Failure to execute Set IPv6 Mulicast Filter",
7009 __func__);
7010 return -EINVAL;
7011 }
7012
7013 memset( &packetFilterSetReq, 0, sizeof(tSirRcvPktFilterCfgType));
7014
7015 /*
7016 * Setting IPV6 UC Filter below
7017 */
7018 packetFilterSetReq.filterType = HDD_RCV_FILTER_SET;
7019 packetFilterSetReq.filterId = HDD_FILTER_ID_IPV6_UC;
7020 packetFilterSetReq.numFieldParams = 2;
7021 packetFilterSetReq.paramsData[0].protocolLayer =
7022 HDD_FILTER_PROTO_TYPE_MAC;
7023 packetFilterSetReq.paramsData[0].cmpFlag =
7024 HDD_FILTER_CMP_TYPE_MAX;
7025 packetFilterSetReq.paramsData[0].dataOffset = 0;
7026 packetFilterSetReq.paramsData[0].dataLength = 1;
7027 packetFilterSetReq.paramsData[0].compareData[0] =
7028 HDD_IPV6_UC_CMP_DATA;
7029
7030 packetFilterSetReq.paramsData[1].protocolLayer =
7031 HDD_FILTER_PROTO_TYPE_ARP;
7032 packetFilterSetReq.paramsData[1].cmpFlag =
7033 HDD_FILTER_CMP_TYPE_NOT_EQUAL;
7034 packetFilterSetReq.paramsData[1].dataOffset = ETH_ALEN;
7035 packetFilterSetReq.paramsData[1].dataLength = 2;
7036 packetFilterSetReq.paramsData[1].compareData[0] =
7037 HDD_IPV6_CMP_DATA_0;
7038 packetFilterSetReq.paramsData[1].compareData[1] =
7039 HDD_IPV6_CMP_DATA_1;
7040
7041 if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal,
7042 &packetFilterSetReq, sessionId))
7043 {
7044 hddLog(VOS_TRACE_LEVEL_ERROR,
7045 "%s: Failure to execute Set IPv6 Unicast Filter",
7046 __func__);
7047 return -EINVAL;
7048 }
7049
7050 break;
7051
7052 case HDD_FILTER_IPV6_MC:
7053 /*
7054 * IPV6 UC Filter might be already set,
7055 * clear the UC Filter. As the Filter
7056 * IDs are static, we can directly clear it.
7057 */
7058 packetFilterSetReq.filterType = HDD_RCV_FILTER_SET;
7059 packetFilterClrReq.filterId = HDD_FILTER_ID_IPV6_UC;
7060 if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx->hHal,
7061 &packetFilterClrReq, sessionId))
7062 {
7063 hddLog(VOS_TRACE_LEVEL_ERROR,
7064 "%s: Failure to execute Clear IPv6 Unicast Filter",
7065 __func__);
7066 return -EINVAL;
7067 }
7068
7069 /*
7070 * Setting IPV6 MC Filter below
7071 */
7072 packetFilterSetReq.filterId = HDD_FILTER_ID_IPV6_MC;
7073 packetFilterSetReq.numFieldParams = 2;
7074 packetFilterSetReq.paramsData[0].protocolLayer =
7075 HDD_FILTER_PROTO_TYPE_MAC;
7076 packetFilterSetReq.paramsData[0].cmpFlag =
7077 HDD_FILTER_CMP_TYPE_NOT_EQUAL;
7078 packetFilterSetReq.paramsData[0].dataOffset =
7079 WLAN_HDD_80211_FRM_DA_OFFSET;
7080 packetFilterSetReq.paramsData[0].dataLength = 1;
7081 packetFilterSetReq.paramsData[0].compareData[0] =
7082 HDD_IPV6_MC_CMP_DATA;
7083
7084 packetFilterSetReq.paramsData[1].protocolLayer =
7085 HDD_FILTER_PROTO_TYPE_ARP;
7086 packetFilterSetReq.paramsData[1].cmpFlag =
7087 HDD_FILTER_CMP_TYPE_NOT_EQUAL;
7088 packetFilterSetReq.paramsData[1].dataOffset = ETH_ALEN;
7089 packetFilterSetReq.paramsData[1].dataLength = 2;
7090 packetFilterSetReq.paramsData[1].compareData[0] =
7091 HDD_IPV6_CMP_DATA_0;
7092 packetFilterSetReq.paramsData[1].compareData[1] =
7093 HDD_IPV6_CMP_DATA_1;
7094
7095
7096 if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal,
7097 &packetFilterSetReq, sessionId))
7098 {
7099 hddLog(VOS_TRACE_LEVEL_ERROR,
7100 "%s: Failure to execute Set IPv6 Multicast Filter",
7101 __func__);
7102 return -EINVAL;
7103 }
7104 break;
7105
7106 default :
7107 hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
7108 "%s: Packet Filter Request: Invalid",
7109 __func__);
7110 return -EINVAL;
7111 }
7112 return 0;
7113}
7114
Gopichand Nakkala0f276812013-02-24 14:45:51 +05307115void wlan_hdd_set_mc_addr_list(hdd_adapter_t *pAdapter, v_U8_t set)
Jeff Johnson295189b2012-06-20 16:38:30 -07007116{
Gopichand Nakkala0f276812013-02-24 14:45:51 +05307117 v_U8_t i;
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307118 tpSirRcvFltMcAddrList pMulticastAddrs = NULL;
Yue Ma3ede6052013-08-29 00:33:26 -07007119 tHalHandle hHal = NULL;
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307120 hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
Jeff Johnson295189b2012-06-20 16:38:30 -07007121
Yue Ma3ede6052013-08-29 00:33:26 -07007122 if (NULL == pHddCtx)
7123 {
7124 hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD CTX is NULL"));
7125 return;
7126 }
7127
7128 hHal = pHddCtx->hHal;
7129
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307130 if (NULL == hHal)
Jeff Johnson295189b2012-06-20 16:38:30 -07007131 {
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307132 hddLog(VOS_TRACE_LEVEL_ERROR, FL("HAL Handle is NULL"));
7133 return;
7134 }
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307135
7136 /* Check if INI is enabled or not, other wise just return
7137 */
Madan Mohan Koyyalamudiac94c7e2013-08-12 09:37:34 +05307138 if (pHddCtx->cfg_ini->fEnableMCAddrList)
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307139 {
7140 pMulticastAddrs = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7141 if (NULL == pMulticastAddrs)
7142 {
7143 hddLog(VOS_TRACE_LEVEL_ERROR, FL("Could not allocate Memory"));
7144 return;
7145 }
7146
Jeff Johnson295189b2012-06-20 16:38:30 -07007147 if (set)
7148 {
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307149 /* Following pre-conditions should be satisfied before wei
7150 * configure the MC address list.
7151 */
7152 if (((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) ||
7153 (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT))
7154 && pAdapter->mc_addr_list.mc_cnt
7155 && (eConnectionState_Associated ==
7156 (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
7157 {
7158 pMulticastAddrs->ulMulticastAddrCnt =
7159 pAdapter->mc_addr_list.mc_cnt;
7160 for (i = 0; i < pAdapter->mc_addr_list.mc_cnt; i++)
7161 {
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08007162 memcpy(pMulticastAddrs->multicastAddr[i],
7163 pAdapter->mc_addr_list.addr[i],
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307164 sizeof(pAdapter->mc_addr_list.addr[i]));
7165 hddLog(VOS_TRACE_LEVEL_INFO,
7166 "%s: %s multicast filter: addr ="
7167 MAC_ADDRESS_STR,
7168 __func__, set ? "setting" : "clearing",
7169 MAC_ADDR_ARRAY(pMulticastAddrs->multicastAddr[i]));
7170 }
7171 /* Set multicast filter */
7172 sme_8023MulticastList(hHal, pAdapter->sessionId,
7173 pMulticastAddrs);
7174 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007175 }
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307176 else
7177 {
7178 /* Need to clear only if it was previously configured
7179 */
7180 if (pAdapter->mc_addr_list.isFilterApplied)
7181 {
7182 pMulticastAddrs->ulMulticastAddrCnt = 0;
7183 sme_8023MulticastList(hHal, pAdapter->sessionId,
7184 pMulticastAddrs);
7185 }
7186
7187 }
7188 pAdapter->mc_addr_list.isFilterApplied = set ? TRUE : FALSE;
Sameer Thalappilb492efd2013-10-23 14:21:51 -07007189 vos_mem_free(pMulticastAddrs);
Jeff Johnson295189b2012-06-20 16:38:30 -07007190 }
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307191 else
7192 {
7193 hddLog(VOS_TRACE_LEVEL_INFO,
Madan Mohan Koyyalamudiac94c7e2013-08-12 09:37:34 +05307194 FL("gMCAddrListEnable is not enabled in INI"));
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307195 }
7196 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007197}
7198
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05307199static int __iw_set_packet_filter_params(struct net_device *dev,
7200 struct iw_request_info *info,
7201 union iwreq_data *wrqu, char *extra)
madan mohan koyyalamudibfd9cef2013-07-01 18:39:37 +05307202{
Jeff Johnson295189b2012-06-20 16:38:30 -07007203 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Arif Hussain0273cba2014-01-07 20:58:29 -08007204 tpPacketFilterCfg pRequest = NULL;
7205 int ret;
Girish Gowlidfdf85e2014-06-12 21:01:35 +05307206 struct iw_point s_priv_data;
7207
7208 if (hdd_priv_get_data(&s_priv_data, wrqu))
7209 {
7210 return -EINVAL;
7211 }
7212
7213 if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length))
7214 {
7215 return -EINVAL;
7216 }
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08007217
Arif Hussain0273cba2014-01-07 20:58:29 -08007218 /* ODD number is used for set, copy data using copy_from_user */
Girish Gowlidfdf85e2014-06-12 21:01:35 +05307219 pRequest = mem_alloc_copy_from_user_helper(s_priv_data.pointer,
7220 s_priv_data.length);
Arif Hussain0273cba2014-01-07 20:58:29 -08007221 if (NULL == pRequest)
7222 {
7223 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7224 "mem_alloc_copy_from_user_helper fail");
7225 return -ENOMEM;
7226 }
7227
7228 ret = wlan_hdd_set_filter(WLAN_HDD_GET_CTX(pAdapter), pRequest, pAdapter->sessionId);
7229 kfree(pRequest);
7230
7231 return ret;
Jeff Johnson295189b2012-06-20 16:38:30 -07007232}
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05307233
7234static int iw_set_packet_filter_params(struct net_device *dev,
7235 struct iw_request_info *info,
7236 union iwreq_data *wrqu, char *extra)
7237{
7238 int ret;
7239
7240 vos_ssr_protect(__func__);
7241 ret = __iw_set_packet_filter_params(dev, info, wrqu, extra);
7242 vos_ssr_unprotect(__func__);
7243
7244 return ret;
7245}
Jeff Johnson295189b2012-06-20 16:38:30 -07007246#endif
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05307247static int __iw_get_statistics(struct net_device *dev,
7248 struct iw_request_info *info,
7249 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07007250{
7251
7252 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
7253 eHalStatus status = eHAL_STATUS_SUCCESS;
7254 hdd_wext_state_t *pWextState;
7255 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
7256 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
7257 char *p = extra;
7258 int tlen = 0;
7259 tCsrSummaryStatsInfo *pStats = &(pAdapter->hdd_stats.summary_stat);
7260
7261 tCsrGlobalClassAStatsInfo *aStats = &(pAdapter->hdd_stats.ClassA_stat);
7262 tCsrGlobalClassDStatsInfo *dStats = &(pAdapter->hdd_stats.ClassD_stat);
7263
7264 ENTER();
7265
7266 if (pHddCtx->isLogpInProgress) {
7267 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
7268 return -EINVAL;
7269 }
7270
7271 if (eConnectionState_Associated != (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) {
7272
7273 wrqu->txpower.value = 0;
7274 }
7275 else {
7276 status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD,
7277 SME_SUMMARY_STATS |
7278 SME_GLOBAL_CLASSA_STATS |
7279 SME_GLOBAL_CLASSB_STATS |
7280 SME_GLOBAL_CLASSC_STATS |
7281 SME_GLOBAL_CLASSD_STATS |
7282 SME_PER_STA_STATS,
7283 hdd_StatisticsCB, 0, FALSE,
7284 (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter );
7285
7286 if (eHAL_STATUS_SUCCESS != status)
7287 {
7288 hddLog(VOS_TRACE_LEVEL_ERROR,
7289 "%s: Unable to retrieve SME statistics",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007290 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007291 return -EINVAL;
7292 }
7293
7294 pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
7295
7296 vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS);
7297 if (!VOS_IS_STATUS_SUCCESS(vos_status))
7298 {
7299 hddLog(VOS_TRACE_LEVEL_ERROR,
7300 "%s: SME timeout while retrieving statistics",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007301 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007302 /*Remove the SME statistics list by passing NULL in callback argument*/
7303 status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD,
7304 SME_SUMMARY_STATS |
7305 SME_GLOBAL_CLASSA_STATS |
7306 SME_GLOBAL_CLASSB_STATS |
7307 SME_GLOBAL_CLASSC_STATS |
7308 SME_GLOBAL_CLASSD_STATS |
7309 SME_PER_STA_STATS,
7310 NULL, 0, FALSE,
7311 (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter );
7312
7313 return -EINVAL;
7314 }
7315 FILL_TLV(p, (tANI_U8)WLAN_STATS_RETRY_CNT,
7316 (tANI_U8) sizeof (pStats->retry_cnt),
7317 (char*) &(pStats->retry_cnt[0]),
7318 tlen);
7319
7320 FILL_TLV(p, (tANI_U8)WLAN_STATS_MUL_RETRY_CNT,
7321 (tANI_U8) sizeof (pStats->multiple_retry_cnt),
7322 (char*) &(pStats->multiple_retry_cnt[0]),
7323 tlen);
7324
7325 FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_FRM_CNT,
7326 (tANI_U8) sizeof (pStats->tx_frm_cnt),
7327 (char*) &(pStats->tx_frm_cnt[0]),
7328 tlen);
7329
7330 FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_FRM_CNT,
7331 (tANI_U8) sizeof (pStats->rx_frm_cnt),
7332 (char*) &(pStats->rx_frm_cnt),
7333 tlen);
7334
7335 FILL_TLV(p, (tANI_U8)WLAN_STATS_FRM_DUP_CNT,
7336 (tANI_U8) sizeof (pStats->frm_dup_cnt),
7337 (char*) &(pStats->frm_dup_cnt),
7338 tlen);
7339
7340 FILL_TLV(p, (tANI_U8)WLAN_STATS_FAIL_CNT,
7341 (tANI_U8) sizeof (pStats->fail_cnt),
7342 (char*) &(pStats->fail_cnt[0]),
7343 tlen);
7344
7345 FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_FAIL_CNT,
7346 (tANI_U8) sizeof (pStats->rts_fail_cnt),
7347 (char*) &(pStats->rts_fail_cnt),
7348 tlen);
7349
7350 FILL_TLV(p, (tANI_U8)WLAN_STATS_ACK_FAIL_CNT,
7351 (tANI_U8) sizeof (pStats->ack_fail_cnt),
7352 (char*) &(pStats->ack_fail_cnt),
7353 tlen);
7354
7355 FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_SUC_CNT,
7356 (tANI_U8) sizeof (pStats->rts_succ_cnt),
7357 (char*) &(pStats->rts_succ_cnt),
7358 tlen);
7359
7360 FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_DISCARD_CNT,
7361 (tANI_U8) sizeof (pStats->rx_discard_cnt),
7362 (char*) &(pStats->rx_discard_cnt),
7363 tlen);
7364
7365 FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_ERROR_CNT,
7366 (tANI_U8) sizeof (pStats->rx_error_cnt),
7367 (char*) &(pStats->rx_error_cnt),
7368 tlen);
7369
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08007370 FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BYTE_CNT,
Jeff Johnsone7245742012-09-05 17:12:55 -07007371 (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]),
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08007372 (char*) &(dStats->tx_uc_byte_cnt[0]),
Jeff Johnson295189b2012-06-20 16:38:30 -07007373 tlen);
7374
7375 FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BYTE_CNT,
7376 (tANI_U8) sizeof (dStats->rx_byte_cnt),
7377 (char*) &(dStats->rx_byte_cnt),
7378 tlen);
7379
7380 FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_RATE,
7381 (tANI_U8) sizeof (dStats->rx_rate),
7382 (char*) &(dStats->rx_rate),
7383 tlen);
7384
7385 /* Transmit rate, in units of 500 kbit/sec */
7386 FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_RATE,
7387 (tANI_U8) sizeof (aStats->tx_rate),
7388 (char*) &(aStats->tx_rate),
7389 tlen);
7390
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08007391 FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_UC_BYTE_CNT,
7392 (tANI_U8) sizeof (dStats->rx_uc_byte_cnt[0]),
7393 (char*) &(dStats->rx_uc_byte_cnt[0]),
Jeff Johnsone7245742012-09-05 17:12:55 -07007394 tlen);
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08007395 FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_MC_BYTE_CNT,
7396 (tANI_U8) sizeof (dStats->rx_mc_byte_cnt),
7397 (char*) &(dStats->rx_mc_byte_cnt),
Jeff Johnsone7245742012-09-05 17:12:55 -07007398 tlen);
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08007399 FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BC_BYTE_CNT,
7400 (tANI_U8) sizeof (dStats->rx_bc_byte_cnt),
7401 (char*) &(dStats->rx_bc_byte_cnt),
Jeff Johnsone7245742012-09-05 17:12:55 -07007402 tlen);
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08007403 FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_UC_BYTE_CNT,
7404 (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]),
7405 (char*) &(dStats->tx_uc_byte_cnt[0]),
Jeff Johnsone7245742012-09-05 17:12:55 -07007406 tlen);
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08007407 FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_MC_BYTE_CNT,
7408 (tANI_U8) sizeof (dStats->tx_mc_byte_cnt),
7409 (char*) &(dStats->tx_mc_byte_cnt),
Jeff Johnsone7245742012-09-05 17:12:55 -07007410 tlen);
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08007411 FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BC_BYTE_CNT,
7412 (tANI_U8) sizeof (dStats->tx_bc_byte_cnt),
7413 (char*) &(dStats->tx_bc_byte_cnt),
Jeff Johnsone7245742012-09-05 17:12:55 -07007414 tlen);
7415
Jeff Johnson295189b2012-06-20 16:38:30 -07007416 wrqu->data.length = tlen;
7417
7418 }
7419
7420 EXIT();
7421
7422 return 0;
7423}
7424
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05307425static int iw_get_statistics(struct net_device *dev,
7426 struct iw_request_info *info,
7427 union iwreq_data *wrqu, char *extra)
7428{
7429 int ret;
Jeff Johnson295189b2012-06-20 16:38:30 -07007430
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05307431 vos_ssr_protect(__func__);
7432 ret = __iw_get_statistics(dev, info, wrqu, extra);
7433 vos_ssr_unprotect(__func__);
7434
7435 return ret;
7436}
Jeff Johnson295189b2012-06-20 16:38:30 -07007437#ifdef FEATURE_WLAN_SCAN_PNO
7438
7439/*Max Len for PNO notification*/
7440#define MAX_PNO_NOTIFY_LEN 100
7441void found_pref_network_cb (void *callbackContext,
7442 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd)
7443{
7444 hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext;
7445 union iwreq_data wrqu;
7446 char buf[MAX_PNO_NOTIFY_LEN+1];
7447
7448 hddLog(VOS_TRACE_LEVEL_WARN, "A preferred network was found: %s with rssi: -%d",
7449 pPrefNetworkFoundInd->ssId.ssId, pPrefNetworkFoundInd->rssi);
7450
7451 // create the event
7452 memset(&wrqu, 0, sizeof(wrqu));
7453 memset(buf, 0, sizeof(buf));
7454
7455 snprintf(buf, MAX_PNO_NOTIFY_LEN, "QCOM: Found preferred network: %s with RSSI of -%u",
7456 pPrefNetworkFoundInd->ssId.ssId,
7457 (unsigned int)pPrefNetworkFoundInd->rssi);
7458
7459 wrqu.data.pointer = buf;
7460 wrqu.data.length = strlen(buf);
7461
7462 // send the event
7463
7464 wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf);
7465
7466}
7467
7468
7469/*string based input*/
7470VOS_STATUS iw_set_pno(struct net_device *dev, struct iw_request_info *info,
7471 union iwreq_data *wrqu, char *extra, int nOffset)
7472{
7473 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
c_hpothu37f21312014-04-09 21:49:54 +05307474 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Madan Mohan Koyyalamudi729972c2012-10-21 12:39:24 -07007475 /* pnoRequest is a large struct, so we make it static to avoid stack
7476 overflow. This API is only invoked via ioctl, so it is
7477 serialized by the kernel rtnl_lock and hence does not need to be
7478 reentrant */
7479 static tSirPNOScanReq pnoRequest;
Jeff Johnson295189b2012-06-20 16:38:30 -07007480 char *ptr;
7481 v_U8_t i,j, ucParams, ucMode;
c_hpothu37f21312014-04-09 21:49:54 +05307482 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007483 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
7484
7485 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7486 "PNO data len %d data %s",
7487 wrqu->data.length,
Arif Hussain7adce1b2013-11-11 22:59:34 -08007488 extra);
Jeff Johnson295189b2012-06-20 16:38:30 -07007489
7490 if (wrqu->data.length <= nOffset )
7491 {
7492 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "PNO input is not correct");
7493 return VOS_STATUS_E_FAILURE;
7494 }
7495
7496 pnoRequest.enable = 0;
7497 pnoRequest.ucNetworksCount = 0;
7498 /*-----------------------------------------------------------------------
7499 Input is string based and expected to be like this:
7500
7501 <enabled> <netw_count>
7502 for each network:
7503 <ssid_len> <ssid> <authentication> <encryption>
7504 <ch_num> <channel_list optional> <bcast_type> <rssi_threshold>
7505 <scan_timers> <scan_time> <scan_repeat> <scan_time> <scan_repeat>
7506
7507 e.g:
Jeff Johnson8301aa12013-03-28 14:27:29 -07007508 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 2 5 2 300 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007509
7510 this translates into:
7511 -----------------------------
7512 enable PNO
7513 look for 2 networks:
7514 test - with authentication type 0 and encryption type 0,
7515 that can be found on 3 channels: 1 6 and 11 ,
7516 SSID bcast type is unknown (directed probe will be sent if AP not found)
7517 and must meet -40dBm RSSI
7518
7519 test2 - with auth and enrytption type 4/4
7520 that can be found on 6 channels 1, 2, 3, 4, 5 and 6
7521 bcast type is non-bcast (directed probe will be sent)
7522 and must not meet any RSSI threshold
7523
Jeff Johnson8301aa12013-03-28 14:27:29 -07007524 scan every 5 seconds 2 times, scan every 300 seconds until stopped
Jeff Johnson295189b2012-06-20 16:38:30 -07007525 -----------------------------------------------------------------------*/
Arif Hussain7adce1b2013-11-11 22:59:34 -08007526 ptr = extra + nOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07007527
Wilson Yang623f6592013-10-08 16:33:37 -07007528 if (1 != sscanf(ptr,"%hhu%n", &(pnoRequest.enable), &nOffset))
7529 {
7530 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7531 "PNO enable input is not valid %s",ptr);
7532 return VOS_STATUS_E_FAILURE;
7533 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007534
7535 if ( 0 == pnoRequest.enable )
7536 {
7537 /*Disable PNO*/
7538 memset(&pnoRequest, 0, sizeof(pnoRequest));
c_hpothu37f21312014-04-09 21:49:54 +05307539 status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter),
7540 &pnoRequest,
Jeff Johnson295189b2012-06-20 16:38:30 -07007541 pAdapter->sessionId,
7542 found_pref_network_cb, pAdapter);
c_hpothu37f21312014-04-09 21:49:54 +05307543 if (eHAL_STATUS_SUCCESS != status)
7544 {
7545 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7546 "%s: failed to disable PNO", __func__);
7547 return VOS_STATUS_E_FAILURE;
7548 }
7549 pHddCtx->isPnoEnable = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007550 return VOS_STATUS_SUCCESS;
7551 }
7552
c_hpothu37f21312014-04-09 21:49:54 +05307553 if (TRUE == pHddCtx->isPnoEnable)
7554 {
7555 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
7556 FL("already PNO is enabled"));
7557 return -EBUSY;
7558 }
7559 pHddCtx->isPnoEnable = TRUE;
7560
Jeff Johnson295189b2012-06-20 16:38:30 -07007561 ptr += nOffset;
Wilson Yang623f6592013-10-08 16:33:37 -07007562
7563 if (1 != sscanf(ptr,"%hhu %n", &(pnoRequest.ucNetworksCount), &nOffset))
7564 {
7565 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7566 "PNO count input not valid %s",ptr);
c_hpothu37f21312014-04-09 21:49:54 +05307567 goto error;
Wilson Yang623f6592013-10-08 16:33:37 -07007568 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007569
7570 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7571 "PNO enable %d networks count %d offset %d",
7572 pnoRequest.enable,
7573 pnoRequest.ucNetworksCount,
7574 nOffset);
7575
7576 /* Parameters checking:
7577 ucNetworksCount has to be larger than 0*/
7578 if (( 0 == pnoRequest.ucNetworksCount ) ||
7579 ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS ))
7580 {
7581 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Network input is not correct");
c_hpothu37f21312014-04-09 21:49:54 +05307582 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07007583 }
7584
7585 ptr += nOffset;
7586
7587 for ( i = 0; i < pnoRequest.ucNetworksCount; i++ )
7588 {
7589
7590 pnoRequest.aNetworks[i].ssId.length = 0;
7591
Wilson Yang623f6592013-10-08 16:33:37 -07007592 ucParams = sscanf(ptr,"%hhu %n",
7593 &(pnoRequest.aNetworks[i].ssId.length),&nOffset);
7594
7595 if (1 != ucParams)
7596 {
7597 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7598 "PNO ssid length input is not valid %s",ptr);
7599 return VOS_STATUS_E_FAILURE;
7600 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007601
7602 if (( 0 == pnoRequest.aNetworks[i].ssId.length ) ||
7603 ( pnoRequest.aNetworks[i].ssId.length > 32 ) )
7604 {
7605 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7606 "SSID Len %d is not correct for network %d",
7607 pnoRequest.aNetworks[i].ssId.length, i);
c_hpothu37f21312014-04-09 21:49:54 +05307608 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07007609 }
7610
7611 /*Advance to SSID*/
7612 ptr += nOffset;
7613
Jeff Johnson8301aa12013-03-28 14:27:29 -07007614 memcpy(pnoRequest.aNetworks[i].ssId.ssId, ptr,
Amar Singhal751e6072013-01-24 16:02:56 -08007615 pnoRequest.aNetworks[i].ssId.length);
7616 ptr += pnoRequest.aNetworks[i].ssId.length;
7617
Jeff Johnson02797792013-10-26 19:17:13 -07007618 ucParams = sscanf(ptr,"%u %u %hhu %n",
Amar Singhal751e6072013-01-24 16:02:56 -08007619 &(pnoRequest.aNetworks[i].authentication),
7620 &(pnoRequest.aNetworks[i].encryption),
7621 &(pnoRequest.aNetworks[i].ucChannelCount),
7622 &nOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -07007623
Wilson Yang623f6592013-10-08 16:33:37 -07007624 if ( 3 != ucParams )
7625 {
7626 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
7627 "Incorrect cmd %s",ptr);
c_hpothu37f21312014-04-09 21:49:54 +05307628 goto error;
Wilson Yang623f6592013-10-08 16:33:37 -07007629 }
7630
Jeff Johnson295189b2012-06-20 16:38:30 -07007631 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0299d0a2013-10-30 12:37:43 -07007632 "PNO len %d ssid 0x%08x%08x%08x%08x%08x%08x%08x%08x"
Amar Singhal751e6072013-01-24 16:02:56 -08007633 "auth %d encry %d channel count %d offset %d",
7634 pnoRequest.aNetworks[i].ssId.length,
7635 *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[0]),
7636 *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[4]),
7637 *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[8]),
7638 *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[12]),
7639 *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[16]),
7640 *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[20]),
7641 *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[24]),
7642 *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[28]),
7643 pnoRequest.aNetworks[i].authentication,
7644 pnoRequest.aNetworks[i].encryption,
7645 pnoRequest.aNetworks[i].ucChannelCount,
7646 nOffset );
Jeff Johnson295189b2012-06-20 16:38:30 -07007647
Jeff Johnson295189b2012-06-20 16:38:30 -07007648 /*Advance to channel list*/
7649 ptr += nOffset;
7650
Wilson Yang623f6592013-10-08 16:33:37 -07007651 if (SIR_PNO_MAX_NETW_CHANNELS < pnoRequest.aNetworks[i].ucChannelCount)
Jeff Johnson295189b2012-06-20 16:38:30 -07007652 {
7653 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
7654 "Incorrect number of channels");
7655 return VOS_STATUS_E_FAILURE;
7656 }
7657
7658 if ( 0 != pnoRequest.aNetworks[i].ucChannelCount)
7659 {
7660 for ( j = 0; j < pnoRequest.aNetworks[i].ucChannelCount; j++)
7661 {
Wilson Yang623f6592013-10-08 16:33:37 -07007662 if (1 != sscanf(ptr,"%hhu %n",
7663 &(pnoRequest.aNetworks[i].aChannels[j]),
7664 &nOffset))
7665 { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7666 "PNO network channel input is not valid %s",ptr);
7667 return VOS_STATUS_E_FAILURE;
7668 }
7669 /*Advance to next channel number*/
7670 ptr += nOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07007671 }
7672 }
7673
Jeff Johnson02797792013-10-26 19:17:13 -07007674 if (1 != sscanf(ptr,"%u %n",
Wilson Yang623f6592013-10-08 16:33:37 -07007675 &(pnoRequest.aNetworks[i].bcastNetwType),
7676 &nOffset))
7677 {
7678 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7679 "PNO broadcast network type input is not valid %s",ptr);
c_hpothu37f21312014-04-09 21:49:54 +05307680 goto error;
Wilson Yang623f6592013-10-08 16:33:37 -07007681 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007682
7683 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7684 "PNO bcastNetwType %d offset %d",
7685 pnoRequest.aNetworks[i].bcastNetwType,
7686 nOffset );
7687
7688 /*Advance to rssi Threshold*/
7689 ptr += nOffset;
7690
Wilson Yang623f6592013-10-08 16:33:37 -07007691 if (1 != sscanf(ptr,"%hhu %n",
7692 &(pnoRequest.aNetworks[i].rssiThreshold),
7693 &nOffset))
7694 {
7695 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7696 "PNO rssi threshold input is not valid %s",ptr);
c_hpothu37f21312014-04-09 21:49:54 +05307697 goto error;
Wilson Yang623f6592013-10-08 16:33:37 -07007698 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007699
7700 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7701 "PNO rssi %d offset %d",
7702 pnoRequest.aNetworks[i].rssiThreshold,
7703 nOffset );
7704 /*Advance to next network*/
7705 ptr += nOffset;
7706 }/*For ucNetworkCount*/
7707
7708 ucParams = sscanf(ptr,"%hhu %n",
Wilson Yang623f6592013-10-08 16:33:37 -07007709 &(pnoRequest.scanTimers.ucScanTimersCount),
7710 &nOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -07007711
7712 /*Read the scan timers*/
Jeff Johnson8301aa12013-03-28 14:27:29 -07007713 if (( 1 == ucParams ) && ( pnoRequest.scanTimers.ucScanTimersCount > 0 ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007714 {
7715 ptr += nOffset;
7716
Jeff Johnson8301aa12013-03-28 14:27:29 -07007717 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7718 "Scan timer count %d offset %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007719 pnoRequest.scanTimers.ucScanTimersCount,
7720 nOffset );
7721
7722 if ( SIR_PNO_MAX_SCAN_TIMERS < pnoRequest.scanTimers.ucScanTimersCount )
7723 {
Jeff Johnson8301aa12013-03-28 14:27:29 -07007724 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnson295189b2012-06-20 16:38:30 -07007725 "Incorrect cmd - too many scan timers");
c_hpothu37f21312014-04-09 21:49:54 +05307726 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07007727 }
7728
7729 for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++ )
7730 {
Jeff Johnson02797792013-10-26 19:17:13 -07007731 ucParams = sscanf(ptr,"%u %u %n",
Jeff Johnson295189b2012-06-20 16:38:30 -07007732 &(pnoRequest.scanTimers.aTimerValues[i].uTimerValue),
7733 &( pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat),
7734 &nOffset);
7735
Wilson Yang623f6592013-10-08 16:33:37 -07007736 if (2 != ucParams)
7737 {
7738 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7739 "Incorrect cmd - diff params then expected %d", ucParams);
c_hpothu37f21312014-04-09 21:49:54 +05307740 goto error;
Wilson Yang623f6592013-10-08 16:33:37 -07007741 }
7742
Jeff Johnson8301aa12013-03-28 14:27:29 -07007743 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7744 "PNO Timer value %d Timer repeat %d offset %d",
7745 pnoRequest.scanTimers.aTimerValues[i].uTimerValue,
Jeff Johnson295189b2012-06-20 16:38:30 -07007746 pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat,
7747 nOffset );
7748
Jeff Johnson295189b2012-06-20 16:38:30 -07007749 ptr += nOffset;
7750 }
7751
7752 }
7753 else
7754 {
Jeff Johnson8301aa12013-03-28 14:27:29 -07007755 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7756 "No scan timers provided param count %d scan timers %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007757 ucParams, pnoRequest.scanTimers.ucScanTimersCount );
7758
7759 /*Scan timers defaults to 5 minutes*/
7760 pnoRequest.scanTimers.ucScanTimersCount = 1;
7761 pnoRequest.scanTimers.aTimerValues[0].uTimerValue = 60;
7762 pnoRequest.scanTimers.aTimerValues[0].uTimerRepeat = 0;
7763 }
7764
Wilson Yang623f6592013-10-08 16:33:37 -07007765 ucParams = sscanf(ptr,"%hhu %n",&(ucMode), &nOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -07007766
7767 pnoRequest.modePNO = ucMode;
7768 /*for LA we just expose suspend option*/
7769 if (( 1 != ucParams )||( ucMode >= SIR_PNO_MODE_MAX ))
7770 {
7771 pnoRequest.modePNO = SIR_PNO_MODE_ON_SUSPEND;
7772 }
7773
c_hpothu37f21312014-04-09 21:49:54 +05307774 status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), &pnoRequest,
Jeff Johnson295189b2012-06-20 16:38:30 -07007775 pAdapter->sessionId,
7776 found_pref_network_cb, pAdapter);
c_hpothu37f21312014-04-09 21:49:54 +05307777 if (eHAL_STATUS_SUCCESS == status)
7778 {
7779 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7780 "%s: PNO enabled", __func__);
7781 return VOS_STATUS_SUCCESS;
7782 }
7783error:
7784 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7785 "%s: Failed to enable PNO", __func__);
7786 pHddCtx->isPnoEnable = FALSE;
7787 return VOS_STATUS_E_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007788}/*iw_set_pno*/
7789
7790VOS_STATUS iw_set_rssi_filter(struct net_device *dev, struct iw_request_info *info,
7791 union iwreq_data *wrqu, char *extra, int nOffset)
7792{
7793 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
7794 v_U8_t rssiThreshold = 0;
7795 v_U8_t nRead;
7796
Arif Hussain7adce1b2013-11-11 22:59:34 -08007797 nRead = sscanf(extra + nOffset,"%hhu",
Jeff Johnson295189b2012-06-20 16:38:30 -07007798 &rssiThreshold);
7799
7800 if ( 1 != nRead )
7801 {
7802 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN,
7803 "Incorrect format");
7804 return VOS_STATUS_E_FAILURE;
7805 }
7806
7807 sme_SetRSSIFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), rssiThreshold);
7808 return VOS_STATUS_SUCCESS;
7809}
7810
7811
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05307812static int __iw_set_pno_priv(struct net_device *dev,
Jeff Johnson295189b2012-06-20 16:38:30 -07007813 struct iw_request_info *info,
7814 union iwreq_data *wrqu, char *extra)
7815{
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08007816 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
7817
7818 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
Jeff Johnson295189b2012-06-20 16:38:30 -07007819 "Set PNO Private");
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08007820
7821 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
7822 {
7823 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
7824 "%s:LOGP in Progress. Ignore!!!", __func__);
7825 return -EBUSY;
7826 }
7827 return iw_set_pno(dev,info,wrqu,extra,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007828}
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05307829
7830static int iw_set_pno_priv(struct net_device *dev,
7831 struct iw_request_info *info,
7832 union iwreq_data *wrqu, char *extra)
7833{
7834 int ret;
7835
7836 vos_ssr_protect(__func__);
7837 ret = __iw_set_pno_priv(dev, info, wrqu, extra);
7838 vos_ssr_unprotect(__func__);
7839
7840 return ret;
7841}
Jeff Johnson295189b2012-06-20 16:38:30 -07007842#endif /*FEATURE_WLAN_SCAN_PNO*/
7843
7844//Common function to SetBand
Atul Mittal54378cb2014-04-02 16:51:50 +05307845int hdd_setBand(struct net_device *dev, u8 ui_band)
Jeff Johnson295189b2012-06-20 16:38:30 -07007846{
7847 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
7848 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
7849 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Kaushik, Sushant4975a572014-10-21 16:07:48 +05307850 hdd_scaninfo_t *pScanInfo = NULL;
Atul Mittal54378cb2014-04-02 16:51:50 +05307851 eCsrBand band;
Jeff Johnson295189b2012-06-20 16:38:30 -07007852 eCsrBand currBand = eCSR_BAND_MAX;
Agarwal Ashish450ffde2014-04-08 19:53:00 +05307853 eCsrBand connectedBand;
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307854 v_U8_t ret = SEND_CHANNEL_CHANGE_EVENT;
7855 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007856
Atul Mittal54378cb2014-04-02 16:51:50 +05307857 switch(ui_band)
Jeff Johnson295189b2012-06-20 16:38:30 -07007858 {
7859 case WLAN_HDD_UI_BAND_AUTO:
7860 band = eCSR_BAND_ALL;
7861 break;
7862 case WLAN_HDD_UI_BAND_5_GHZ:
7863 band = eCSR_BAND_5G;
7864 break;
7865 case WLAN_HDD_UI_BAND_2_4_GHZ:
7866 band = eCSR_BAND_24;
7867 break;
7868 default:
7869 band = eCSR_BAND_MAX;
7870 }
Agarwal Ashish450ffde2014-04-08 19:53:00 +05307871 connectedBand =
7872 hdd_connGetConnectedBand(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter));
Jeff Johnson295189b2012-06-20 16:38:30 -07007873
Atul Mittal54378cb2014-04-02 16:51:50 +05307874 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change band to %u",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007875 __func__, band);
Jeff Johnson295189b2012-06-20 16:38:30 -07007876
7877 if (band == eCSR_BAND_MAX)
7878 {
7879 /* Received change band request with invalid band value */
7880 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Atul Mittal54378cb2014-04-02 16:51:50 +05307881 "%s: Invalid band value %u", __func__, ui_band);
7882 return -EINVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007883 }
7884
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05307885 if ( (band == eCSR_BAND_24 && pHddCtx->cfg_ini->nBandCapability==2) ||
7886 (band == eCSR_BAND_5G && pHddCtx->cfg_ini->nBandCapability==1) ||
7887 (band == eCSR_BAND_ALL && pHddCtx->cfg_ini->nBandCapability!=0))
7888 {
Agarwal Ashish971c2882013-10-30 20:11:12 +05307889 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007890 "%s: band value %u violate INI settings %u", __func__,
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007891 band, pHddCtx->cfg_ini->nBandCapability);
7892 return -EIO;
7893 }
7894
Jeff Johnson295189b2012-06-20 16:38:30 -07007895 if (eHAL_STATUS_SUCCESS != sme_GetFreqBand(hHal, &currBand))
7896 {
7897 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7898 "%s: Failed to get current band config",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007899 __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007900 return -EIO;
7901 }
7902
7903 if (currBand != band)
7904 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307905 /* Return failure if current country code is world regulatory domain*/
7906 if( (pMac->scan.countryCodeCurrent[0] == '0' &&
7907 pMac->scan.countryCodeCurrent[1] == '0') )
7908 {
7909 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
7910 "%s: failed to set the band value to %u as country code is 00",
7911 __func__, band);
7912 return -EAGAIN;
7913 }
7914
Jeff Johnson295189b2012-06-20 16:38:30 -07007915 /* Change band request received.
7916 * Abort pending scan requests, flush the existing scan results,
7917 * and change the band capability
7918 */
7919 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
7920 "%s: Current band value = %u, new setting %u ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007921 __func__, currBand, band);
Jeff Johnson295189b2012-06-20 16:38:30 -07007922
Srinivas, Dasari187ca4e2014-02-07 12:40:09 +05307923 /* We need to change the band and flush the scan results here itself
7924 * as we may get timeout for disconnection in which we will return
7925 * with out doing any of these
7926 */
7927 if (eHAL_STATUS_SUCCESS != sme_SetFreqBand(hHal, (eCsrBand)band))
7928 {
7929 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
7930 "%s: failed to set the band value to %u ",
7931 __func__, band);
7932 return -EINVAL;
7933 }
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307934 if(currBand == eCSR_BAND_24 || currBand == eCSR_BAND_5G)
7935 {
7936 v_COUNTRYCODE_t curr_country;
7937 curr_country[0]=pMac->scan.countryCodeCurrent[0];
7938 curr_country[1]=pMac->scan.countryCodeCurrent[1];
7939
7940 /* As currunt band is already set to 2.4Ghz/5Ghz we dont have all channel
7941 * information available in NV so to get the channel information from kernel
7942 * we need to send regulatory hint for the currunt country
7943 * And to set the same country again we need to set the dummy country
7944 * first and then the actual country.
7945 */
7946
7947#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
7948 regulatory_hint_user("00", NL80211_USER_REG_HINT_USER);
7949#else
7950 regulatory_hint_user("00");
7951#endif
7952
7953 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_TRUE;
7954#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
7955 regulatory_hint_user(curr_country, NL80211_USER_REG_HINT_USER);
7956#else
7957 regulatory_hint_user(curr_country);
7958#endif
7959 ret = DO_NOT_SEND_CHANNEL_CHANGE_EVENT;
7960 }
7961 else
7962 {
Abhishek Singh678227a2014-11-04 10:52:38 +05307963#ifdef CONFIG_ENABLE_LINUX_REG
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307964 vos_update_nv_table_from_wiphy_band((void *)pHddCtx,
7965 (void *)pHddCtx->wiphy, (eCsrBand)band);
Abhishek Singh678227a2014-11-04 10:52:38 +05307966#else
7967 wlan_hdd_cfg80211_update_band( pHddCtx->wiphy, (eCsrBand)band );
7968#endif
7969
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307970 }
Kaushik, Sushant4975a572014-10-21 16:07:48 +05307971 pScanInfo = &pHddCtx->scan_info;
7972 if ((pScanInfo != NULL) && pHddCtx->scan_info.mScanPending)
7973 {
7974 hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId,
7975 eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE);
7976 }
Srinivas, Dasari187ca4e2014-02-07 12:40:09 +05307977 sme_FilterScanResults(hHal, pAdapter->sessionId);
7978
7979 if (band != eCSR_BAND_ALL &&
Agarwal Ashish450ffde2014-04-08 19:53:00 +05307980 hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)) &&
7981 (connectedBand != band))
Jeff Johnson295189b2012-06-20 16:38:30 -07007982 {
Jeff Johnson295189b2012-06-20 16:38:30 -07007983 eHalStatus status = eHAL_STATUS_SUCCESS;
7984 long lrc;
7985
7986 /* STA already connected on current band, So issue disconnect first,
7987 * then change the band*/
7988
7989 hddLog(VOS_TRACE_LEVEL_INFO,
Abhishek Singhf4669da2014-05-26 15:07:49 +05307990 "%s STA connected in band %u, Changing band to %u, Issuing Disconnect."
Agarwal Ashish2496e872014-10-01 19:04:29 +05307991 , __func__, csrGetCurrentBand(hHal), band);
Jeff Johnson295189b2012-06-20 16:38:30 -07007992
Jeff Johnson295189b2012-06-20 16:38:30 -07007993 INIT_COMPLETION(pAdapter->disconnect_comp_var);
7994
7995 status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
7996 pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
7997
Jeff Johnson43971f52012-07-17 12:26:56 -07007998 if ( eHAL_STATUS_SUCCESS != status)
Jeff Johnson295189b2012-06-20 16:38:30 -07007999 {
8000 hddLog(VOS_TRACE_LEVEL_ERROR,
Arif Hussain6d2a3322013-11-17 19:50:10 -08008001 "%s csrRoamDisconnect failure, returned %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008002 __func__, (int)status );
8003 return -EINVAL;
8004 }
8005
8006 lrc = wait_for_completion_interruptible_timeout(
8007 &pAdapter->disconnect_comp_var,
8008 msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
8009
Madan Mohan Koyyalamudi71278262013-04-12 22:00:48 +05308010 if (lrc <= 0) {
Jeff Johnson295189b2012-06-20 16:38:30 -07008011
Srinivas Girigowdacb4c6412013-07-02 10:19:12 -07008012 hddLog(VOS_TRACE_LEVEL_ERROR,"%s: %s while waiting for csrRoamDisconnect ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008013 __func__, (0 == lrc) ? "Timeout" : "Interrupt");
Jeff Johnson295189b2012-06-20 16:38:30 -07008014
8015 return (0 == lrc) ? -ETIMEDOUT : -EINTR;
8016 }
8017 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008018 }
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05308019 return ret;
Jeff Johnson295189b2012-06-20 16:38:30 -07008020}
8021
Atul Mittal54378cb2014-04-02 16:51:50 +05308022int hdd_setBand_helper(struct net_device *dev, const char *command)
8023{
8024 u8 band;
8025
8026 /*convert the band value from ascii to integer*/
8027 band = command[WLAN_HDD_UI_SET_BAND_VALUE_OFFSET] - '0';
8028
8029 return hdd_setBand(dev, band);
8030
8031}
8032
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05308033static int __iw_set_band_config(struct net_device *dev,
8034 struct iw_request_info *info,
8035 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07008036{
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08008037 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
Atul Mittal54378cb2014-04-02 16:51:50 +05308038 int *value = (int *)extra;
Jeff Johnson295189b2012-06-20 16:38:30 -07008039
Arif Hussain0273cba2014-01-07 20:58:29 -08008040 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008041
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08008042 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
8043 {
8044 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
8045 "%s:LOGP in Progress. Ignore!!!", __func__);
8046 return -EBUSY;
8047 }
8048
Atul Mittal54378cb2014-04-02 16:51:50 +05308049 return hdd_setBand(dev, value[0]);
Jeff Johnson295189b2012-06-20 16:38:30 -07008050}
8051
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05308052static int iw_set_band_config(struct net_device *dev,
8053 struct iw_request_info *info,
8054 union iwreq_data *wrqu, char *extra)
8055{
8056 int ret;
8057
8058 vos_ssr_protect(__func__);
8059 ret = __iw_set_band_config(dev, info, wrqu, extra);
8060 vos_ssr_unprotect(__func__);
8061
8062 return ret;
8063}
8064
8065static int __iw_set_power_params_priv(struct net_device *dev,
8066 struct iw_request_info *info,
8067 union iwreq_data *wrqu, char *extra)
Jeff Johnson295189b2012-06-20 16:38:30 -07008068{
Arif Hussain0273cba2014-01-07 20:58:29 -08008069 int ret;
8070 char *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07008071 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
8072 "Set power params Private");
Arif Hussain0273cba2014-01-07 20:58:29 -08008073 /* ODD number is used for set, copy data using copy_from_user */
8074 ptr = mem_alloc_copy_from_user_helper(wrqu->data.pointer,
8075 wrqu->data.length);
8076 if (NULL == ptr)
8077 {
8078 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
8079 "mem_alloc_copy_from_user_helper fail");
8080 return -ENOMEM;
8081 }
8082
8083 ret = iw_set_power_params(dev, info, wrqu, ptr, 0);
8084 kfree(ptr);
8085 return ret;
Jeff Johnson295189b2012-06-20 16:38:30 -07008086}
8087
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05308088static int iw_set_power_params_priv(struct net_device *dev,
8089 struct iw_request_info *info,
8090 union iwreq_data *wrqu, char *extra)
8091{
8092 int ret;
Jeff Johnson295189b2012-06-20 16:38:30 -07008093
Mahesh A Saptasagar97a9f812014-08-13 13:15:05 +05308094 vos_ssr_protect(__func__);
8095 ret = __iw_set_power_params_priv(dev, info, wrqu, extra);
8096 vos_ssr_unprotect(__func__);
8097
8098 return ret;
8099}
Jeff Johnson295189b2012-06-20 16:38:30 -07008100
8101/*string based input*/
8102VOS_STATUS iw_set_power_params(struct net_device *dev, struct iw_request_info *info,
8103 union iwreq_data *wrqu, char *extra, int nOffset)
8104{
8105 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
8106 tSirSetPowerParamsReq powerRequest;
8107 char *ptr;
8108 v_U8_t ucType;
8109 v_U32_t uTotalSize, uValue;
8110 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
8111
8112 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
8113 "Power Params data len %d data %s",
8114 wrqu->data.length,
Arif Hussain7adce1b2013-11-11 22:59:34 -08008115 extra);
Jeff Johnson295189b2012-06-20 16:38:30 -07008116
Sameer Thalappil75ea31a2013-02-21 19:38:16 -08008117 if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
8118 {
8119 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
8120 "%s:LOGP in Progress. Ignore!!!", __func__);
8121 return -EBUSY;
8122 }
8123
Jeff Johnson295189b2012-06-20 16:38:30 -07008124 if (wrqu->data.length <= nOffset )
8125 {
8126 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "set power param input is not correct");
8127 return VOS_STATUS_E_FAILURE;
8128 }
8129
8130 uTotalSize = wrqu->data.length - nOffset;
8131
8132 /*-----------------------------------------------------------------------
8133 Input is string based and expected to be like this:
8134
8135 <param_type> <param_value> <param_type> <param_value> ...
8136
8137 e.g:
8138 1 2 2 3 3 0 4 1 5 1
8139
8140 e.g. setting just a few:
8141 1 2 4 1
8142
8143 parameter types:
8144 -----------------------------
8145 1 - Ignore DTIM
8146 2 - Listen Interval
8147 3 - Broadcast Multicas Filter
8148 4 - Beacon Early Termination
8149 5 - Beacon Early Termination Interval
8150 -----------------------------------------------------------------------*/
8151 powerRequest.uIgnoreDTIM = SIR_NOCHANGE_POWER_VALUE;
8152 powerRequest.uListenInterval = SIR_NOCHANGE_POWER_VALUE;
8153 powerRequest.uBcastMcastFilter = SIR_NOCHANGE_POWER_VALUE;
8154 powerRequest.uEnableBET = SIR_NOCHANGE_POWER_VALUE;
8155 powerRequest.uBETInterval = SIR_NOCHANGE_POWER_VALUE;
8156
Arif Hussain7adce1b2013-11-11 22:59:34 -08008157 ptr = extra + nOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07008158
8159 while ( uTotalSize )
8160 {
Wilson Yang6f971452013-10-08 15:00:00 -07008161 if (1 != sscanf(ptr,"%hhu %n", &(ucType), &nOffset))
8162 {
8163 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
8164 "Invalid input parameter type %s",ptr);
8165 return VOS_STATUS_E_FAILURE;
8166 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008167
8168 uTotalSize -= nOffset;
8169
8170 if (!uTotalSize)
8171 {
8172 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnsona8a1a482012-12-12 16:49:33 -08008173 "Invalid input parameter type : %d with no value at offset %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008174 ucType, nOffset);
8175 return VOS_STATUS_E_FAILURE;
8176 }
8177
8178 ptr += nOffset;
Wilson Yang6f971452013-10-08 15:00:00 -07008179
Jeff Johnson02797792013-10-26 19:17:13 -07008180 if (1 != sscanf(ptr,"%u %n", &(uValue), &nOffset))
Wilson Yang6f971452013-10-08 15:00:00 -07008181 {
8182 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
8183 "Invalid input parameter value %s",ptr);
8184 return VOS_STATUS_E_FAILURE;
8185 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008186
8187 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
8188 "Power request parameter %d value %d offset %d",
8189 ucType, uValue, nOffset);
8190
8191 switch (ucType)
8192 {
8193 case eSIR_IGNORE_DTIM:
8194 powerRequest.uIgnoreDTIM = uValue;
8195 break;
8196 case eSIR_LISTEN_INTERVAL:
8197 powerRequest.uListenInterval = uValue;
8198 break;
8199 case eSIR_MCAST_BCAST_FILTER:
8200 powerRequest.uBcastMcastFilter = uValue;
8201 break;
8202 case eSIR_ENABLE_BET:
8203 powerRequest.uEnableBET = uValue;
8204 break;
8205 case eSIR_BET_INTERVAL:
8206 powerRequest.uBETInterval = uValue;
8207 break;
8208 default:
8209 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Jeff Johnsona8a1a482012-12-12 16:49:33 -08008210 "Invalid input parameter type : %d with value: %d at offset %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008211 ucType, uValue, nOffset);
8212 return VOS_STATUS_E_FAILURE;
8213 }
8214
8215 uTotalSize -= nOffset;
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08008216 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
8217 "Power request parameter %d Total size",
Jeff Johnsone7245742012-09-05 17:12:55 -07008218 uTotalSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07008219 ptr += nOffset;
Jeff Johnsone7245742012-09-05 17:12:55 -07008220 /* This is added for dynamic Tele LI enable (0xF1) /disable (0xF0)*/
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08008221 if(!(uTotalSize - nOffset) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07008222 (powerRequest.uListenInterval != SIR_NOCHANGE_POWER_VALUE))
8223 {
8224 uTotalSize = 0;
8225 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008226
8227 }/*Go for as long as we have a valid string*/
8228
8229 /* put the device into full power*/
8230 wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE);
8231
8232 /* Apply the power save params*/
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08008233 sme_SetPowerParams( WLAN_HDD_GET_HAL_CTX(pAdapter), &powerRequest, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07008234
8235 /* put the device back to power save*/
8236 wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO);
8237
8238 return VOS_STATUS_SUCCESS;
8239}/*iw_set_power_params*/
8240
Atul Mittalc0f739f2014-07-31 13:47:47 +05308241// tdlsoffchan
8242#ifdef FEATURE_WLAN_TDLS
8243
Atul Mittal87ec2422014-09-24 13:12:50 +05308244int iw_set_tdlsoffchannel(hdd_context_t *pHddCtx, int offchannel)
Atul Mittalc0f739f2014-07-31 13:47:47 +05308245{
8246 if (offchannel < 0 || offchannel > 165)
8247 {
8248 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Invalid tdls off channel %u",
8249 __func__, offchannel);
8250 return -1;
8251
8252 }
8253
8254 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls off channel from %d to %d",
8255 __func__, tdlsOffCh, offchannel);
8256
8257 tdlsOffCh = offchannel;
8258 return 0;
8259}
8260
Atul Mittal87ec2422014-09-24 13:12:50 +05308261int iw_set_tdlssecoffchanneloffset(hdd_context_t *pHddCtx, int offchanoffset)
Atul Mittalc0f739f2014-07-31 13:47:47 +05308262{
8263 if (offchanoffset == 0)
8264 {
8265 tdlsOffChBwOffset = 0;
8266 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u",
8267 __func__, tdlsOffChBwOffset);
8268
8269 return 0;
8270
8271 }
8272
8273 if ( offchanoffset == 40 )
8274 {
8275 tdlsOffChBwOffset = 1;
8276 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u",
8277 __func__, tdlsOffChBwOffset);
8278
8279 return 0;
8280
8281 }
8282 if (offchanoffset == -40)
8283 {
8284 tdlsOffChBwOffset = 3;
8285 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u",
8286 __func__, tdlsOffChBwOffset);
8287
8288 return 0;
8289
8290 }
8291 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Invalid tdls secondary off channel offset %d",
8292 __func__, offchanoffset);
8293 return -1;
8294}
8295
Atul Mittal87ec2422014-09-24 13:12:50 +05308296int iw_set_tdlsoffchannelmode(hdd_adapter_t *pAdapter, int offchanmode)
Atul Mittalc0f739f2014-07-31 13:47:47 +05308297{
8298 hddTdlsPeer_t *connPeer = NULL;
8299 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
8300 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
8301
8302 if (offchanmode < 0 || offchanmode > 4)
8303 {
8304 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
8305 "%s: Invalid tdls off channel mode %d",
8306 __func__, offchanmode);
8307 return -1;
8308 }
8309
8310 if (eConnectionState_Associated != pHddStaCtx->conn_info.connState)
8311 {
8312 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
8313 "%s: tdls off channel mode req in not associated state %d",
8314 __func__, offchanmode);
8315 return -1;
8316 }
8317
8318 if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode ||
8319 eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode)
8320 {
8321 /* Send TDLS Channel Switch Request to connected peer */
8322 connPeer = wlan_hdd_tdls_get_first_connected_peer(pAdapter);
8323 if (NULL == connPeer) {
8324 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
8325 "%s: No TDLS Connected Peer", __func__);
8326 return -1;
8327 }
8328 }
8329 else
8330 {
8331 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
8332 "%s: TDLS Connection not supported", __func__);
8333 return -1;
8334 }
8335
8336 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
8337 ("%s: TDLS Channel Switch in swmode=%d"),
8338 __func__, offchanmode);
8339
8340 switch (offchanmode)
8341 {
8342 case 1:/*Enable*/
8343 case 2:/*Disable*/
8344 {
8345 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
8346 "%s: change tdls off channel mode %d tdls_off_channel %d offchanoffset %d ",
8347 __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset);
8348 if (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel)
8349 {
8350
8351 sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter),
8352 pAdapter->sessionId, connPeer->peerMac,
8353 tdlsOffCh, tdlsOffChBwOffset,
8354 offchanmode);
8355 }
8356 else
8357 {
8358 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
8359 "%s: TDLS Off Channel not supported", __func__);
8360 return -1;
8361 }
8362 break;
8363 }
8364 case 3:
8365 {
8366 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
8367 "%s: change tdls off channel mode %d REJREQ 3 tdls_off_channel %d offchanoffset %d ",
8368 __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset);
8369
8370 break;
8371 }
8372 case 4:
8373 {
8374 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
8375 "%s: change tdls off channel mode %d UNSOLRESP 4 tdls_off_channel %d offchanoffset %d ",
8376 __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset);
8377 break;
8378 }
8379 default:
8380 {
8381 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
8382 "%s: change tdls off channel mode %d Not SET 0 tdls_off_channel %d offchanoffset %d ",
8383 __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset);
8384 break;
8385 }
8386
8387 }
8388
8389 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls off channel mode to %u",
8390 __func__, offchanmode);
8391 return 0;
8392}
Atul Mittalc0f739f2014-07-31 13:47:47 +05308393#endif
8394
Jeff Johnson295189b2012-06-20 16:38:30 -07008395
8396// Define the Wireless Extensions to the Linux Network Device structure
8397// A number of these routines are NULL (meaning they are not implemented.)
8398
8399static const iw_handler we_handler[] =
8400{
8401 (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */
8402 (iw_handler) iw_get_name, /* SIOCGIWNAME */
8403 (iw_handler) NULL, /* SIOCSIWNWID */
8404 (iw_handler) NULL, /* SIOCGIWNWID */
8405 (iw_handler) iw_set_freq, /* SIOCSIWFREQ */
8406 (iw_handler) iw_get_freq, /* SIOCGIWFREQ */
8407 (iw_handler) iw_set_mode, /* SIOCSIWMODE */
8408 (iw_handler) iw_get_mode, /* SIOCGIWMODE */
8409 (iw_handler) NULL, /* SIOCSIWSENS */
8410 (iw_handler) NULL, /* SIOCGIWSENS */
8411 (iw_handler) NULL, /* SIOCSIWRANGE */
8412 (iw_handler) iw_get_range, /* SIOCGIWRANGE */
8413 (iw_handler) iw_set_priv, /* SIOCSIWPRIV */
8414 (iw_handler) NULL, /* SIOCGIWPRIV */
8415 (iw_handler) NULL, /* SIOCSIWSTATS */
8416 (iw_handler) NULL, /* SIOCGIWSTATS */
8417 iw_handler_set_spy, /* SIOCSIWSPY */
8418 iw_handler_get_spy, /* SIOCGIWSPY */
8419 iw_handler_set_thrspy, /* SIOCSIWTHRSPY */
8420 iw_handler_get_thrspy, /* SIOCGIWTHRSPY */
8421 (iw_handler) iw_set_ap_address, /* SIOCSIWAP */
8422 (iw_handler) iw_get_ap_address, /* SIOCGIWAP */
8423 (iw_handler) iw_set_mlme, /* SIOCSIWMLME */
8424 (iw_handler) NULL, /* SIOCGIWAPLIST */
8425 (iw_handler) iw_set_scan, /* SIOCSIWSCAN */
8426 (iw_handler) iw_get_scan, /* SIOCGIWSCAN */
8427 (iw_handler) iw_set_essid, /* SIOCSIWESSID */
8428 (iw_handler) iw_get_essid, /* SIOCGIWESSID */
8429 (iw_handler) iw_set_nick, /* SIOCSIWNICKN */
8430 (iw_handler) iw_get_nick, /* SIOCGIWNICKN */
8431 (iw_handler) NULL, /* -- hole -- */
8432 (iw_handler) NULL, /* -- hole -- */
8433 (iw_handler) iw_set_bitrate, /* SIOCSIWRATE */
8434 (iw_handler) iw_get_bitrate, /* SIOCGIWRATE */
8435 (iw_handler) iw_set_rts_threshold,/* SIOCSIWRTS */
8436 (iw_handler) iw_get_rts_threshold,/* SIOCGIWRTS */
8437 (iw_handler) iw_set_frag_threshold, /* SIOCSIWFRAG */
8438 (iw_handler) iw_get_frag_threshold, /* SIOCGIWFRAG */
8439 (iw_handler) iw_set_tx_power, /* SIOCSIWTXPOW */
8440 (iw_handler) iw_get_tx_power, /* SIOCGIWTXPOW */
8441 (iw_handler) iw_set_retry, /* SIOCSIWRETRY */
8442 (iw_handler) iw_get_retry, /* SIOCGIWRETRY */
8443 (iw_handler) iw_set_encode, /* SIOCSIWENCODE */
8444 (iw_handler) iw_get_encode, /* SIOCGIWENCODE */
8445 (iw_handler) iw_set_power_mode, /* SIOCSIWPOWER */
8446 (iw_handler) iw_get_power_mode, /* SIOCGIWPOWER */
8447 (iw_handler) NULL, /* -- hole -- */
8448 (iw_handler) NULL, /* -- hole -- */
8449 (iw_handler) iw_set_genie, /* SIOCSIWGENIE */
8450 (iw_handler) iw_get_genie, /* SIOCGIWGENIE */
8451 (iw_handler) iw_set_auth, /* SIOCSIWAUTH */
8452 (iw_handler) iw_get_auth, /* SIOCGIWAUTH */
8453 (iw_handler) iw_set_encodeext, /* SIOCSIWENCODEEXT */
8454 (iw_handler) iw_get_encodeext, /* SIOCGIWENCODEEXT */
8455 (iw_handler) NULL, /* SIOCSIWPMKSA */
8456};
8457
8458static const iw_handler we_private[] = {
8459
8460 [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone, //set priv ioctl
8461 [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint, //get priv ioctl
8462 [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone, //get priv ioctl
8463 [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_three_ints_getnone,
8464 [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone,
8465 [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone, //action priv ioctl
8466 [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_var_ints_getnone,
8467 [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec,
8468 [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec,
8469 [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec,
Jeff Johnsone7245742012-09-05 17:12:55 -07008470#ifdef FEATURE_OEM_DATA_SUPPORT
8471 [WLAN_PRIV_SET_OEM_DATA_REQ - SIOCIWFIRSTPRIV] = iw_set_oem_data_req, //oem data req Specifc
8472 [WLAN_PRIV_GET_OEM_DATA_RSP - SIOCIWFIRSTPRIV] = iw_get_oem_data_rsp, //oem data req Specifc
8473#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008474
Jeff Johnson295189b2012-06-20 16:38:30 -07008475#ifdef WLAN_FEATURE_VOWIFI_11R
8476 [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties,
8477#endif
8478 [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload,
8479 [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics,
8480 [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] = iw_set_keepalive_params
8481#ifdef WLAN_FEATURE_PACKET_FILTERING
8482 ,
8483 [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] = iw_set_packet_filter_params
8484#endif
8485#ifdef FEATURE_WLAN_SCAN_PNO
8486 ,
8487 [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno_priv
8488#endif
8489 ,
8490 [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config,
8491 [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] = iw_set_dynamic_mcbc_filter,
8492 [WLAN_PRIV_CLEAR_MCBC_FILTER - SIOCIWFIRSTPRIV] = iw_clear_dynamic_mcbc_filter,
8493 [WLAN_SET_POWER_PARAMS - SIOCIWFIRSTPRIV] = iw_set_power_params_priv,
Arif Hussain695279c2014-03-24 14:06:07 -07008494 [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed_priv,
Jeff Johnson295189b2012-06-20 16:38:30 -07008495};
8496
8497/*Maximum command length can be only 15 */
8498static const struct iw_priv_args we_private_args[] = {
8499
8500 /* handlers for main ioctl */
8501 { WLAN_PRIV_SET_INT_GET_NONE,
8502 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8503 0,
8504 "" },
8505
8506 /* handlers for sub-ioctl */
8507 { WE_SET_11D_STATE,
8508 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8509 0,
8510 "set11Dstate" },
8511
8512 { WE_WOWL,
8513 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8514 0,
8515 "wowl" },
8516
8517 { WE_SET_POWER,
8518 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8519 0,
8520 "setPower" },
8521
8522 { WE_SET_MAX_ASSOC,
8523 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8524 0,
8525 "setMaxAssoc" },
8526
8527 { WE_SET_SAP_AUTO_CHANNEL_SELECTION,
8528 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8529 0,
8530 "setAutoChannel" },
8531
8532 { WE_SET_DATA_INACTIVITY_TO,
8533 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8534 0,
8535 "inactivityTO" },
8536
8537 { WE_SET_MAX_TX_POWER,
8538 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8539 0,
Arif Hussaina5ebce02013-08-09 15:09:58 -07008540 "setMaxTxPower" },
8541
8542 { WE_SET_MAX_TX_POWER_2_4,
8543 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8544 0,
8545 "setTxMaxPower2G" },
8546
8547 { WE_SET_MAX_TX_POWER_5_0,
8548 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8549 0,
8550 "setTxMaxPower5G" },
Rajesh Chauhanf22af962013-07-16 18:50:29 -07008551
8552 /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA
8553 * as well to keep same syntax as in SAP. Now onwards, STA
8554 * will support both */
8555 { WE_SET_MAX_TX_POWER,
8556 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8557 0,
8558 "setTxMaxPower" },
8559
Jeff Johnson295189b2012-06-20 16:38:30 -07008560 /* set Higher DTIM Transition (DTIM1 to DTIM3)
8561 * 1 = enable and 0 = disable */
8562 {
8563 WE_SET_HIGHER_DTIM_TRANSITION,
8564 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8565 0,
8566 "setHDtimTransn" },
8567
8568 { WE_SET_TM_LEVEL,
8569 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
Mingcheng Zhu87f22fc2014-01-30 19:23:32 -08008570 0,
Jeff Johnson295189b2012-06-20 16:38:30 -07008571 "setTmLevel" },
8572
Kiet Lam46b8e4e2013-11-06 21:49:53 +05308573 { WE_ENABLE_STRICT_FCC_REG,
8574 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8575 0,
8576 "setStrictFCCreg" },
8577
Tushnim Bhattacharyyaa3ba5a52014-01-30 11:37:33 -08008578 { WE_SET_DEBUG_LOG,
8579 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8580 0, "setDbgLvl" },
Atul Mittalc0f739f2014-07-31 13:47:47 +05308581#ifdef FEATURE_WLAN_TDLS
8582 {
8583 WE_SET_TDLS_OFF_CHAN,
8584 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8585 0,
8586 "tdlsoffchan" },
8587 {
8588 WE_SET_TDLS_SEC_OFF_CHAN_OFFSET,
8589 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8590 0,
8591 "tdlsecchnoffst" },
8592 {
8593 WE_SET_TDLS_OFF_CHAN_MODE,
8594 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8595 0,
8596 "tdlsoffchnmode" },
8597#endif
Tushnim Bhattacharyyaa3ba5a52014-01-30 11:37:33 -08008598
Peng Xu2446a892014-09-05 17:21:18 +05308599 { WE_SET_SCAN_BAND_PREFERENCE,
8600 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8601 0, "set_scan_pref" },
8602
Jeff Johnson295189b2012-06-20 16:38:30 -07008603 /* handlers for main ioctl */
8604 { WLAN_PRIV_SET_NONE_GET_INT,
8605 0,
8606 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8607 "" },
8608
8609 /* handlers for sub-ioctl */
8610 { WE_GET_11D_STATE,
8611 0,
8612 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8613 "get11Dstate" },
8614
8615 { WE_IBSS_STATUS,
8616 0,
8617 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8618 "getAdhocStatus" },
8619
8620 { WE_PMC_STATE,
8621 0,
8622 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8623 "pmcState" },
8624
8625 { WE_GET_WLAN_DBG,
8626 0,
8627 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8628 "getwlandbg" },
8629
Jeff Johnson295189b2012-06-20 16:38:30 -07008630 { WE_GET_MAX_ASSOC,
8631 0,
8632 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8633 "getMaxAssoc" },
8634
Jeff Johnson295189b2012-06-20 16:38:30 -07008635 { WE_GET_WDI_DBG,
8636 0,
8637 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8638 "getwdidbg" },
Jeff Johnson295189b2012-06-20 16:38:30 -07008639
8640 { WE_GET_SAP_AUTO_CHANNEL_SELECTION,
8641 0,
8642 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8643 "getAutoChannel" },
8644
8645 { WE_GET_CONCURRENCY_MODE,
8646 0,
8647 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8648 "getconcurrency" },
8649
Peng Xu2446a892014-09-05 17:21:18 +05308650 { WE_GET_SCAN_BAND_PREFERENCE,
8651 0,
8652 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8653 "get_scan_pref"},
8654
Jeff Johnson295189b2012-06-20 16:38:30 -07008655 /* handlers for main ioctl */
8656 { WLAN_PRIV_SET_CHAR_GET_NONE,
8657 IW_PRIV_TYPE_CHAR| 512,
8658 0,
8659 "" },
8660
8661 /* handlers for sub-ioctl */
8662 { WE_WOWL_ADD_PTRN,
8663 IW_PRIV_TYPE_CHAR| 512,
8664 0,
8665 "wowlAddPtrn" },
8666
8667 { WE_WOWL_DEL_PTRN,
8668 IW_PRIV_TYPE_CHAR| 512,
8669 0,
8670 "wowlDelPtrn" },
8671
8672#if defined WLAN_FEATURE_VOWIFI
8673 /* handlers for sub-ioctl */
8674 { WE_NEIGHBOR_REPORT_REQUEST,
8675 IW_PRIV_TYPE_CHAR | 512,
8676 0,
8677 "neighbor" },
8678#endif
8679 { WE_SET_AP_WPS_IE,
8680 IW_PRIV_TYPE_CHAR| 512,
8681 0,
8682 "set_ap_wps_ie" },
8683
8684 { WE_SET_CONFIG,
8685 IW_PRIV_TYPE_CHAR| 512,
8686 0,
8687 "setConfig" },
8688
8689 /* handlers for main ioctl */
8690 { WLAN_PRIV_SET_THREE_INT_GET_NONE,
8691 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
8692 0,
8693 "" },
8694
8695 /* handlers for sub-ioctl */
8696 { WE_SET_WLAN_DBG,
8697 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
8698 0,
8699 "setwlandbg" },
8700
Jeff Johnson295189b2012-06-20 16:38:30 -07008701 { WE_SET_WDI_DBG,
8702 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
8703 0,
8704 "setwdidbg" },
Jeff Johnson295189b2012-06-20 16:38:30 -07008705
8706 { WE_SET_SAP_CHANNELS,
8707 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3,
8708 0,
8709 "setsapchannels" },
8710
8711 /* handlers for main ioctl */
8712 { WLAN_PRIV_GET_CHAR_SET_NONE,
8713 0,
8714 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8715 "" },
8716
8717 /* handlers for sub-ioctl */
8718 { WE_WLAN_VERSION,
8719 0,
8720 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8721 "version" },
8722 { WE_GET_STATS,
8723 0,
8724 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8725 "getStats" },
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05308726 { WE_GET_STATES,
8727 0,
8728 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8729 "getHostStates" },
Jeff Johnson295189b2012-06-20 16:38:30 -07008730 { WE_GET_CFG,
8731 0,
8732 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8733 "getConfig" },
Jeff Johnsone7245742012-09-05 17:12:55 -07008734#ifdef WLAN_FEATURE_11AC
8735 { WE_GET_RSSI,
8736 0,
8737 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8738 "getRSSI" },
8739#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008740#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08008741 { WE_GET_ROAM_RSSI,
8742 0,
8743 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8744 "getRoamRSSI" },
8745#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008746 { WE_GET_WMM_STATUS,
8747 0,
8748 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8749 "getWmmStatus" },
8750 {
8751 WE_GET_CHANNEL_LIST,
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05308752 0,
Jeff Johnson295189b2012-06-20 16:38:30 -07008753 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8754 "getChannelList" },
Chilam Ng16a2a1c2013-01-29 01:27:29 -08008755#ifdef FEATURE_WLAN_TDLS
8756 {
8757 WE_GET_TDLS_PEERS,
8758 0,
8759 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8760 "getTdlsPeers" },
8761#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07008762#ifdef WLAN_FEATURE_11W
8763 {
8764 WE_GET_11W_INFO,
8765 0,
8766 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8767 "getPMFInfo" },
8768#endif
Girish Gowlidab72f12014-09-04 15:34:43 +05308769 { WE_GET_SNR,
8770 0,
8771 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8772 "getSNR" },
8773
Jeff Johnson295189b2012-06-20 16:38:30 -07008774 /* handlers for main ioctl */
8775 { WLAN_PRIV_SET_NONE_GET_NONE,
8776 0,
8777 0,
8778 "" },
8779
8780 /* handlers for sub-ioctl */
8781 { WE_CLEAR_STATS,
8782 0,
8783 0,
8784 "clearStats" },
8785 { WE_INIT_AP,
8786 0,
8787 0,
8788 "initAP" },
8789 { WE_STOP_AP,
8790 0,
8791 0,
8792 "exitAP" },
Girish Gowli345bff82014-06-09 20:05:24 +05308793#ifdef WLAN_BTAMP_FEATURE
Jeff Johnson295189b2012-06-20 16:38:30 -07008794 { WE_ENABLE_AMP,
8795 0,
8796 0,
8797 "enableAMP" },
8798 { WE_DISABLE_AMP,
8799 0,
8800 0,
8801 "disableAMP" },
Girish Gowli345bff82014-06-09 20:05:24 +05308802#endif /* WLAN_BTAMP_FEATURE */
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008803 { WE_ENABLE_DXE_STALL_DETECT,
8804 0,
8805 0,
8806 "dxeStallDetect" },
8807 { WE_DISPLAY_DXE_SNAP_SHOT,
8808 0,
8809 0,
8810 "dxeSnapshot" },
Madan Mohan Koyyalamudia96f5442013-05-10 11:32:06 +05308811 { WE_DISPLAY_DATAPATH_SNAP_SHOT,
8812 0,
8813 0,
8814 "dataSnapshot"},
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07008815 {
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05308816 WE_SET_REASSOC_TRIGGER,
8817 0,
8818 0,
8819 "reassoc" },
8820 {
Sandeep Puligilla04bb8fd2014-02-03 23:21:47 +05308821 WE_STOP_OBSS_SCAN,
8822 0,
8823 0,
8824 "stopOBSSScan" },
Mukul Sharma84f27252014-07-14 18:11:42 +05308825#ifdef DEBUG_ROAM_DELAY
8826 {
8827 WE_DUMP_ROAM_TIMER_LOG,
8828 0,
8829 0,
8830 "dumpRoamDelay" },
8831 {
8832 WE_RESET_ROAM_TIMER_LOG,
8833 0,
8834 0,
8835 "resetRoamDelay" },
8836#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008837 /* handlers for main ioctl */
8838 { WLAN_PRIV_SET_VAR_INT_GET_NONE,
8839 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
8840 0,
8841 "" },
8842
8843 /* handlers for sub-ioctl */
8844 { WE_LOG_DUMP_CMD,
8845 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
8846 0,
8847 "dump" },
8848
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07008849 /* handlers for sub-ioctl */
Katya Nigamc2f29dc2014-01-20 19:29:30 +05308850 { WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD,
8851 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
8852 0,
8853 "setdumplog" },
8854
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07008855 { WE_MTRACE_DUMP_CMD,
8856 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
8857 0,
8858 "dumplog" },
8859
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08008860 /* handlers for sub ioctl */
8861 {
8862 WE_MCC_CONFIG_CREDENTIAL,
8863 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
8864 0,
8865 "setMccCrdnl" },
8866
8867 /* handlers for sub ioctl */
8868 {
8869 WE_MCC_CONFIG_PARAMS,
8870 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
8871 0,
8872 "setMccConfig" },
8873
Chilam NG571c65a2013-01-19 12:27:36 +05308874#ifdef FEATURE_WLAN_TDLS
8875 /* handlers for sub ioctl */
8876 {
8877 WE_TDLS_CONFIG_PARAMS,
8878 IW_PRIV_TYPE_INT | MAX_VAR_ARGS,
8879 0,
8880 "setTdlsConfig" },
8881#endif
8882
Jeff Johnson295189b2012-06-20 16:38:30 -07008883 /* handlers for main ioctl */
8884 { WLAN_PRIV_ADD_TSPEC,
8885 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT,
8886 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8887 "addTspec" },
8888
8889 /* handlers for main ioctl */
8890 { WLAN_PRIV_DEL_TSPEC,
8891 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8892 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8893 "delTspec" },
8894
8895 /* handlers for main ioctl */
8896 { WLAN_PRIV_GET_TSPEC,
8897 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8898 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
8899 "getTspec" },
8900
Jeff Johnsone7245742012-09-05 17:12:55 -07008901#ifdef FEATURE_OEM_DATA_SUPPORT
8902 /* handlers for main ioctl - OEM DATA */
8903 {
8904 WLAN_PRIV_SET_OEM_DATA_REQ,
8905 IW_PRIV_TYPE_BYTE | sizeof(struct iw_oem_data_req) | IW_PRIV_SIZE_FIXED,
8906 0,
8907 "set_oem_data_req" },
8908
8909 /* handlers for main ioctl - OEM DATA */
8910 {
8911 WLAN_PRIV_GET_OEM_DATA_RSP,
8912 0,
8913 IW_PRIV_TYPE_BYTE | MAX_OEM_DATA_RSP_LEN,
8914 "get_oem_data_rsp" },
8915#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008916
Jeff Johnson295189b2012-06-20 16:38:30 -07008917 /* handlers for main ioctl - host offload */
8918 {
8919 WLAN_PRIV_SET_HOST_OFFLOAD,
8920 IW_PRIV_TYPE_BYTE | sizeof(tHostOffloadRequest),
8921 0,
8922 "setHostOffload" },
8923
8924 {
8925 WLAN_GET_WLAN_STATISTICS,
8926 0,
8927 IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN,
8928 "getWlanStats" },
8929
8930 {
8931 WLAN_SET_KEEPALIVE_PARAMS,
8932 IW_PRIV_TYPE_BYTE | sizeof(tKeepAliveRequest),
8933 0,
8934 "setKeepAlive" },
8935#ifdef WLAN_FEATURE_PACKET_FILTERING
8936 {
8937 WLAN_SET_PACKET_FILTER_PARAMS,
8938 IW_PRIV_TYPE_BYTE | sizeof(tPacketFilterCfg),
8939 0,
8940 "setPktFilter" },
8941#endif
8942#ifdef FEATURE_WLAN_SCAN_PNO
8943 {
8944 WLAN_SET_PNO,
8945 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8946 0,
8947 "setpno" },
8948#endif
8949 {
8950 WLAN_SET_BAND_CONFIG,
Atul Mittal54378cb2014-04-02 16:51:50 +05308951 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07008952 0,
8953 "SETBAND" },
8954 /* handlers for dynamic MC BC ioctl */
8955 {
8956 WLAN_PRIV_SET_MCBC_FILTER,
Amar Singhalf3a6e762013-02-19 15:06:50 -08008957 IW_PRIV_TYPE_BYTE | sizeof(tRcvFltMcAddrList),
Jeff Johnson295189b2012-06-20 16:38:30 -07008958 0,
8959 "setMCBCFilter" },
8960 {
8961 WLAN_PRIV_CLEAR_MCBC_FILTER,
8962 0,
8963 0,
8964 "clearMCBCFilter" },
8965 {
8966 WLAN_SET_POWER_PARAMS,
8967 IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN,
8968 0,
8969 "setpowerparams" },
8970 {
8971 WLAN_GET_LINK_SPEED,
8972 IW_PRIV_TYPE_CHAR | 18,
Gopichand Nakkala8a2b1442013-05-29 15:33:14 +05308973 IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" },
Jeff Johnson295189b2012-06-20 16:38:30 -07008974};
8975
8976
8977
8978const struct iw_handler_def we_handler_def = {
8979 .num_standard = sizeof(we_handler) / sizeof(we_handler[0]),
8980 .num_private = sizeof(we_private) / sizeof(we_private[0]),
8981 .num_private_args = sizeof(we_private_args) / sizeof(we_private_args[0]),
8982
8983 .standard = (iw_handler *)we_handler,
8984 .private = (iw_handler *)we_private,
8985 .private_args = we_private_args,
8986 .get_wireless_stats = get_wireless_stats,
8987};
8988
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08008989int hdd_validate_mcc_config(hdd_adapter_t *pAdapter, v_UINT_t staId, v_UINT_t arg1, v_UINT_t arg2, v_UINT_t arg3)
8990{
8991 v_U32_t cmd = 288; //Command to RIVA
8992 hdd_context_t *pHddCtx = NULL;
8993 tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
8994 pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
8995 /*
8996 *configMccParam : specify the bit which needs to be modified
8997 *allowed to update based on wlan_qcom_cfg.ini
8998 * configuration
8999 * Bit 0 : SCHEDULE_TIME_SLICE MIN : 5 MAX : 20
9000 * Bit 1 : MAX_NULL_SEND_TIME MIN : 1 MAX : 10
9001 * Bit 2 : TX_EARLY_STOP_TIME MIN : 1 MAX : 10
9002 * Bit 3 : RX_DRAIN_TIME MIN : 1 MAX : 10
9003 * Bit 4 : CHANNEL_SWITCH_TIME MIN : 1 MAX : 20
9004 * Bit 5 : MIN_CHANNEL_TIME MIN : 5 MAX : 20
9005 * Bit 6 : PARK_BEFORE_TBTT MIN : 1 MAX : 5
9006 * Bit 7 : MIN_AFTER_DTIM MIN : 5 MAX : 15
9007 * Bit 8 : TOO_CLOSE_MARGIN MIN : 1 MAX : 3
9008 * Bit 9 : Reserved
9009 */
9010 switch (arg1)
9011 {
9012 //Update MCC SCHEDULE_TIME_SLICE parameter
9013 case MCC_SCHEDULE_TIME_SLICE_CFG_PARAM :
9014 if( pHddCtx->cfg_ini->configMccParam & 0x0001)
9015 {
9016 if((arg2 >= 5) && (arg2 <= 20))
9017 {
9018 logPrintf(hHal, cmd, staId, arg1, arg2, arg3);
9019 }
9020 else
9021 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009022 hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009023 return 0;
9024 }
9025 }
9026 break;
9027
9028 //Update MCC MAX_NULL_SEND_TIME parameter
9029 case MCC_MAX_NULL_SEND_TIME_CFG_PARAM :
9030 if( pHddCtx->cfg_ini->configMccParam & 0x0002)
9031 {
9032 if((arg2 >= 1) && (arg2 <= 10))
9033 {
9034 logPrintf(hHal, cmd, staId, arg1, arg2, arg3);
9035 }
9036 else
9037 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009038 hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009039 return 0;
9040 }
9041 }
9042 break;
9043
9044 //Update MCC TX_EARLY_STOP_TIME parameter
9045 case MCC_TX_EARLY_STOP_TIME_CFG_PARAM :
9046 if( pHddCtx->cfg_ini->configMccParam & 0x0004)
9047 {
9048 if((arg2 >= 1) && (arg2 <= 10))
9049 {
9050 logPrintf(hHal, cmd, staId, arg1, arg2, arg3);
9051 }
9052 else
9053 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009054 hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009055 return 0;
9056 }
9057 }
9058 break;
9059
9060 //Update MCC RX_DRAIN_TIME parameter
9061 case MCC_RX_DRAIN_TIME_CFG_PARAM :
9062 if( pHddCtx->cfg_ini->configMccParam & 0x0008)
9063 {
9064 if((arg2 >= 1) && (arg2 <= 10))
9065 {
9066 logPrintf(hHal, cmd, staId, arg1, arg2, arg3);
9067 }
9068 else
9069 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009070 hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009071 return 0;
9072 }
9073 }
9074 break;
9075
9076 //Update MCC CHANNEL_SWITCH_TIME parameter
9077 case MCC_CHANNEL_SWITCH_TIME_CFG_PARAM :
9078 if( pHddCtx->cfg_ini->configMccParam & 0x0010)
9079 {
9080 if((arg2 >= 1) && (arg2 <= 20))
9081 {
9082 logPrintf(hHal, cmd, staId, arg1, arg2, arg3);
9083 }
9084 else
9085 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009086 hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009087 return 0;
9088 }
9089 }
9090 break;
9091
9092 //Update MCC MIN_CHANNEL_TIME parameter
9093 case MCC_MIN_CHANNEL_TIME_CFG_PARAM :
9094 if( pHddCtx->cfg_ini->configMccParam & 0x0020)
9095 {
9096 if((arg2 >= 5) && (arg2 <= 20))
9097 {
9098 logPrintf(hHal, cmd, staId, arg1, arg2, arg3);
9099 }
9100 else
9101 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009102 hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009103 return 0;
9104 }
9105 }
9106 break;
9107
9108 //Update MCC PARK_BEFORE_TBTT parameter
9109 case MCC_PARK_BEFORE_TBTT_CFG_PARAM :
9110 if( pHddCtx->cfg_ini->configMccParam & 0x0040)
9111 {
9112 if((arg2 >= 1) && (arg2 <= 5))
9113 {
9114 logPrintf(hHal, cmd, staId, arg1, arg2, arg3);
9115 }
9116 else
9117 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009118 hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009119 return 0;
9120 }
9121 }
9122 break;
9123
9124 //Update MCC MIN_AFTER_DTIM parameter
9125 case MCC_MIN_AFTER_DTIM_CFG_PARAM :
9126 if( pHddCtx->cfg_ini->configMccParam & 0x0080)
9127 {
9128 if((arg2 >= 5) && (arg2 <= 15))
9129 {
9130 logPrintf(hHal, cmd, staId, arg1, arg2, arg3);
9131 }
9132 else
9133 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009134 hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009135 return 0;
9136 }
9137 }
9138 break;
9139
9140 //Update MCC TOO_CLOSE_MARGIN parameter
9141 case MCC_TOO_CLOSE_MARGIN_CFG_PARAM :
9142 if( pHddCtx->cfg_ini->configMccParam & 0x0100)
9143 {
9144 if((arg2 >= 1) && (arg2 <= 3))
9145 {
9146 logPrintf(hHal, cmd, staId, arg1, arg2, arg3);
9147 }
9148 else
9149 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009150 hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__);
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009151 return 0;
9152 }
9153 }
9154 break;
9155
9156 default :
Arif Hussain6d2a3322013-11-17 19:50:10 -08009157 hddLog(LOGE, "%s : Uknown / Not allowed to configure parameter : %d",
Madan Mohan Koyyalamudid5f04ca2012-11-06 15:51:26 -08009158 __FUNCTION__,arg1);
9159 break;
9160 }
9161 return 0;
9162}
9163
Jeff Johnson295189b2012-06-20 16:38:30 -07009164int hdd_set_wext(hdd_adapter_t *pAdapter)
9165{
9166 hdd_wext_state_t *pwextBuf;
9167 hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
Madan Mohan Koyyalamudi2a1ba772012-10-11 14:59:06 -07009168 hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
Jeff Johnson295189b2012-06-20 16:38:30 -07009169
9170 pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
9171
9172 // Now configure the roaming profile links. To SSID and bssid.
9173 pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0;
9174 pwextBuf->roamProfile.SSIDs.SSIDList = &pHddStaCtx->conn_info.SSID;
9175
9176 pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0;
9177 pwextBuf->roamProfile.BSSIDs.bssid = &pHddStaCtx->conn_info.bssId;
9178
9179 /*Set the numOfChannels to zero to scan all the channels*/
9180 pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0;
9181 pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL;
9182
9183 /* Default is no encryption */
9184 pwextBuf->roamProfile.EncryptionType.numEntries = 1;
9185 pwextBuf->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
9186
9187 pwextBuf->roamProfile.mcEncryptionType.numEntries = 1;
9188 pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE;
9189
9190 pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
9191
9192 /* Default is no authentication */
9193 pwextBuf->roamProfile.AuthType.numEntries = 1;
9194 pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM;
9195
9196 pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_TAURUS;
9197 pwextBuf->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED;
9198
9199 /*Set the default scan mode*/
Madan Mohan Koyyalamudi2a1ba772012-10-11 14:59:06 -07009200 pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -07009201
9202 hdd_clearRoamProfileIe(pAdapter);
9203
9204 return VOS_STATUS_SUCCESS;
9205
9206 }
9207
9208int hdd_register_wext(struct net_device *dev)
9209 {
9210 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
9211 hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
9212 VOS_STATUS status;
9213
9214 ENTER();
9215
9216 // Zero the memory. This zeros the profile structure.
9217 memset(pwextBuf, 0,sizeof(hdd_wext_state_t));
9218
9219 init_completion(&(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->completion_var);
9220
9221
9222 status = hdd_set_wext(pAdapter);
9223
9224 if(!VOS_IS_STATUS_SUCCESS(status)) {
9225
Arif Hussain6d2a3322013-11-17 19:50:10 -08009226 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: hdd_set_wext failed!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07009227 return eHAL_STATUS_FAILURE;
9228 }
9229
9230 if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->vosevent)))
9231 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009232 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD vos event init failed!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07009233 return eHAL_STATUS_FAILURE;
9234 }
9235
9236 if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->scanevent)))
9237 {
Arif Hussain6d2a3322013-11-17 19:50:10 -08009238 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD scan event init failed!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07009239 return eHAL_STATUS_FAILURE;
9240 }
9241
9242 // Register as a wireless device
9243 dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def;
9244
9245 EXIT();
9246 return 0;
9247}
9248
9249int hdd_UnregisterWext(struct net_device *dev)
9250{
9251#if 0
9252 hdd_wext_state_t *wextBuf;
9253 hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
9254
9255 ENTER();
9256 // Set up the pointer to the Wireless Extensions state structure
9257 wextBuf = pAdapter->pWextState;
9258
9259 // De-allocate the Wireless Extensions state structure
9260 kfree(wextBuf);
9261
9262 // Clear out the pointer to the Wireless Extensions state structure
9263 pAdapter->pWextState = NULL;
9264
9265 EXIT();
9266#endif
c_hpothu5f0b6eb2014-09-15 13:36:50 +05309267
9268 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"In %s", __func__);
9269 rtnl_lock();
Jeff Johnson295189b2012-06-20 16:38:30 -07009270 dev->wireless_handlers = NULL;
c_hpothu5f0b6eb2014-09-15 13:36:50 +05309271 rtnl_unlock();
9272
Jeff Johnson295189b2012-06-20 16:38:30 -07009273 return 0;
9274}
9275
9276