Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 2 | * 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 Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 26 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 27 | |
| 28 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 29 | |
| 30 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 31 | /** ------------------------------------------------------------------------ * |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | 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 Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 53 | #include <macTrace.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 54 | #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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 75 | #include "wlan_hdd_p2p.h" |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 76 | #ifdef FEATURE_WLAN_TDLS |
| 77 | #include "wlan_hdd_tdls.h" |
| 78 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 79 | |
| 80 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 81 | #include <linux/earlysuspend.h> |
| 82 | #endif |
| 83 | #include "wlan_hdd_power.h" |
| 84 | #include "qwlan_version.h" |
| 85 | #include <vos_power.h> |
| 86 | #include "wlan_hdd_host_offload.h" |
| 87 | #include "wlan_hdd_keep_alive.h" |
| 88 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 89 | #include "wlan_hdd_packet_filtering.h" |
| 90 | #endif |
| 91 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 92 | #include <linux/wireless.h> |
| 93 | #include <net/cfg80211.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 94 | #include "wlan_qct_pal_trace.h" |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 95 | #include "wlan_qct_tl.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 96 | |
| 97 | #include "wlan_hdd_misc.h" |
| 98 | #include "bap_hdd_misc.h" |
| 99 | |
| 100 | #include "wlan_hdd_dev_pwr.h" |
| 101 | #include "qc_sap_ioctl.h" |
Gopichand Nakkala | fe7246d | 2013-06-10 17:43:37 +0530 | [diff] [blame] | 102 | #include "sme_Api.h" |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 103 | #include "vos_trace.h" |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 104 | #include "wlan_hdd_assoc.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 106 | #ifdef DEBUG_ROAM_DELAY |
| 107 | #include "vos_utils.h" |
| 108 | #endif |
| 109 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 111 | extern void hdd_suspend_wlan(struct early_suspend *wlan_suspend); |
| 112 | extern void hdd_resume_wlan(struct early_suspend *wlan_suspend); |
| 113 | #endif |
| 114 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 115 | #ifdef FEATURE_OEM_DATA_SUPPORT |
Madan Mohan Koyyalamudi | 7a4d931 | 2012-12-04 17:21:36 -0800 | [diff] [blame] | 116 | #define MAX_OEM_DATA_RSP_LEN 2047 |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 117 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 118 | |
| 119 | #define HDD_FINISH_ULA_TIME_OUT 800 |
Sushant Kaushik | 10315f9 | 2014-04-29 11:30:25 +0530 | [diff] [blame] | 120 | #define COUNTRY_CODE_LEN 2 |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 121 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 122 | |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 123 | // tdlsoffchan |
| 124 | #ifdef FEATURE_WLAN_TDLS |
| 125 | static int iw_set_tdlsoffchannel(hdd_context_t *pHddCtx, int offchannel); |
| 126 | static int iw_set_tdlssecoffchanneloffset(hdd_context_t *pHddCtx, int offchanoffset); |
| 127 | static int iw_set_tdlsoffchannelmode(hdd_adapter_t *pAdapter, int offchanmode); |
| 128 | static int tdlsOffCh = 1; |
| 129 | static int tdlsOffChBwOffset = 0; |
| 130 | #endif |
Madan Mohan Koyyalamudi | dfd6aa8 | 2012-10-18 20:18:43 -0700 | [diff] [blame] | 131 | static int ioctl_debug; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 132 | module_param(ioctl_debug, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); |
| 133 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 134 | /* To Validate Channel against the Frequency and Vice-Versa */ |
| 135 | static const hdd_freq_chan_map_t freq_chan_map[] = { {2412, 1}, {2417, 2}, |
| 136 | {2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, {2442, 7}, {2447, 8}, |
| 137 | {2452, 9}, {2457, 10}, {2462, 11}, {2467 ,12}, {2472, 13}, |
| 138 | {2484, 14}, {4920, 240}, {4940, 244}, {4960, 248}, {4980, 252}, |
| 139 | {5040, 208}, {5060, 212}, {5080, 216}, {5180, 36}, {5200, 40}, {5220, 44}, |
| 140 | {5240, 48}, {5260, 52}, {5280, 56}, {5300, 60}, {5320, 64}, {5500, 100}, |
| 141 | {5520, 104}, {5540, 108}, {5560, 112}, {5580, 116}, {5600, 120}, |
| 142 | {5620, 124}, {5640, 128}, {5660, 132}, {5680, 136}, {5700, 140}, |
Manjunathappa Prakash | 009dcb4 | 2014-03-07 15:29:22 -0800 | [diff] [blame] | 143 | {5720, 144}, {5745, 149}, {5765, 153}, {5785, 157}, {5805, 161}, |
| 144 | {5825, 165} }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 145 | |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 146 | #define FREQ_CHAN_MAP_TABLE_SIZE (sizeof(freq_chan_map)/sizeof(freq_chan_map[0])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 147 | |
| 148 | /* Private ioctls and their sub-ioctls */ |
| 149 | #define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0) |
| 150 | #define WE_SET_11D_STATE 1 |
| 151 | #define WE_WOWL 2 |
| 152 | #define WE_SET_POWER 3 |
| 153 | #define WE_SET_MAX_ASSOC 4 |
| 154 | #define WE_SET_SAP_AUTO_CHANNEL_SELECTION 5 |
| 155 | #define WE_SET_DATA_INACTIVITY_TO 6 |
| 156 | #define WE_SET_MAX_TX_POWER 7 |
| 157 | #define WE_SET_HIGHER_DTIM_TRANSITION 8 |
| 158 | #define WE_SET_TM_LEVEL 9 |
Kiet Lam | 46b8e4e | 2013-11-06 21:49:53 +0530 | [diff] [blame] | 159 | #define WE_ENABLE_STRICT_FCC_REG 10 |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 160 | #define WE_SET_MAX_TX_POWER_2_4 11 |
| 161 | #define WE_SET_MAX_TX_POWER_5_0 12 |
Tushnim Bhattacharyya | a3ba5a5 | 2014-01-30 11:37:33 -0800 | [diff] [blame] | 162 | /* Private IOCTL for debug connection issues */ |
| 163 | #define WE_SET_DEBUG_LOG 13 |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 164 | // tdlsoffchan |
| 165 | #ifdef FEATURE_WLAN_TDLS |
| 166 | #define WE_SET_TDLS_OFF_CHAN 14 |
| 167 | #define WE_SET_TDLS_SEC_OFF_CHAN_OFFSET 15 |
| 168 | #define WE_SET_TDLS_OFF_CHAN_MODE 16 |
| 169 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 170 | #define WE_SET_SCAN_BAND_PREFERENCE 17 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 171 | |
| 172 | /* Private ioctls and their sub-ioctls */ |
| 173 | #define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1) |
| 174 | #define WE_GET_11D_STATE 1 |
| 175 | #define WE_IBSS_STATUS 2 |
| 176 | #define WE_PMC_STATE 3 |
| 177 | #define WE_GET_WLAN_DBG 4 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 178 | #define WE_GET_MAX_ASSOC 6 |
| 179 | #define WE_GET_WDI_DBG 7 |
| 180 | #define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8 |
| 181 | #define WE_GET_CONCURRENCY_MODE 9 |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 182 | #define WE_GET_SCAN_BAND_PREFERENCE 10 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 183 | /* Private ioctls and their sub-ioctls */ |
| 184 | #define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2) |
| 185 | |
| 186 | /* Private ioctls and their sub-ioctls */ |
| 187 | #define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3) |
| 188 | #define WE_WOWL_ADD_PTRN 1 |
| 189 | #define WE_WOWL_DEL_PTRN 2 |
| 190 | #if defined WLAN_FEATURE_VOWIFI |
| 191 | #define WE_NEIGHBOR_REPORT_REQUEST 3 |
| 192 | #endif |
| 193 | #define WE_SET_AP_WPS_IE 4 //This is called in station mode to set probe rsp ie. |
| 194 | #define WE_SET_CONFIG 5 |
| 195 | |
| 196 | /* Private ioctls and their sub-ioctls */ |
| 197 | #define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4) |
| 198 | #define WE_SET_WLAN_DBG 1 |
| 199 | #define WE_SET_WDI_DBG 2 |
| 200 | #define WE_SET_SAP_CHANNELS 3 |
| 201 | |
| 202 | /* Private ioctls and their sub-ioctls */ |
| 203 | #define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5) |
| 204 | #define WE_WLAN_VERSION 1 |
| 205 | #define WE_GET_STATS 2 |
| 206 | #define WE_GET_CFG 3 |
| 207 | #define WE_GET_WMM_STATUS 4 |
| 208 | #define WE_GET_CHANNEL_LIST 5 |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 209 | #ifdef WLAN_FEATURE_11AC |
| 210 | #define WE_GET_RSSI 6 |
| 211 | #endif |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 212 | #define WE_GET_ROAM_RSSI 7 |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 213 | #ifdef FEATURE_WLAN_TDLS |
| 214 | #define WE_GET_TDLS_PEERS 8 |
| 215 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 216 | #ifdef WLAN_FEATURE_11W |
| 217 | #define WE_GET_11W_INFO 9 |
| 218 | #endif |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 219 | #define WE_GET_STATES 10 |
Girish Gowli | dab72f1 | 2014-09-04 15:34:43 +0530 | [diff] [blame] | 220 | #define WE_GET_SNR 11 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 221 | |
| 222 | /* Private ioctls and their sub-ioctls */ |
| 223 | #define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6) |
| 224 | #define WE_CLEAR_STATS 1 |
| 225 | #define WE_INIT_AP 2 |
| 226 | #define WE_STOP_AP 3 |
Girish Gowli | 345bff8 | 2014-06-09 20:05:24 +0530 | [diff] [blame] | 227 | #ifdef WLAN_BTAMP_FEATURE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 228 | #define WE_ENABLE_AMP 4 |
| 229 | #define WE_DISABLE_AMP 5 |
Girish Gowli | 345bff8 | 2014-06-09 20:05:24 +0530 | [diff] [blame] | 230 | #endif /* WLAN_BTAMP_FEATURE */ |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 231 | #define WE_ENABLE_DXE_STALL_DETECT 6 |
| 232 | #define WE_DISPLAY_DXE_SNAP_SHOT 7 |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 233 | #define WE_SET_REASSOC_TRIGGER 8 |
Sandeep Puligilla | a3e7695 | 2014-06-23 15:53:11 +0530 | [diff] [blame] | 234 | #define WE_DISPLAY_DATAPATH_SNAP_SHOT 9 |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 235 | #define WE_STOP_OBSS_SCAN 11 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 236 | |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 237 | #ifdef DEBUG_ROAM_DELAY |
| 238 | #define WE_DUMP_ROAM_TIMER_LOG 12 |
| 239 | #define WE_RESET_ROAM_TIMER_LOG 13 |
| 240 | #endif |
| 241 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 242 | /* Private ioctls and their sub-ioctls */ |
| 243 | #define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7) |
| 244 | #define WE_LOG_DUMP_CMD 1 |
| 245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 246 | #define WE_P2P_NOA_CMD 2 |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 247 | //IOCTL to configure MCC params |
| 248 | #define WE_MCC_CONFIG_CREDENTIAL 3 |
| 249 | #define WE_MCC_CONFIG_PARAMS 4 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 250 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 251 | #ifdef FEATURE_WLAN_TDLS |
| 252 | #define WE_TDLS_CONFIG_PARAMS 5 |
| 253 | #endif |
| 254 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 255 | #define WE_MTRACE_DUMP_CMD 8 |
Katya Nigam | c2f29dc | 2014-01-20 19:29:30 +0530 | [diff] [blame] | 256 | #define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9 |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 257 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 258 | #ifdef FEATURE_WLAN_TDLS |
| 259 | #undef MAX_VAR_ARGS |
| 260 | #define MAX_VAR_ARGS 10 |
| 261 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 262 | #define MAX_VAR_ARGS 7 |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 263 | #endif |
| 264 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 265 | /* Private ioctls (with no sub-ioctls) */ |
| 266 | /* note that they must be odd so that they have "get" semantics */ |
| 267 | #define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9) |
| 268 | #define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11) |
| 269 | #define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13) |
| 270 | |
Girish Gowli | 464c9c8 | 2014-06-09 19:47:53 +0530 | [diff] [blame] | 271 | /* (SIOCIWFIRSTPRIV + 8) is currently unused */ |
| 272 | /* (SIOCIWFIRSTPRIV + 16) is currently unused */ |
| 273 | /* (SIOCIWFIRSTPRIV + 10) is currently unused */ |
| 274 | /* (SIOCIWFIRSTPRIV + 12) is currently unused */ |
| 275 | /* (SIOCIWFIRSTPRIV + 14) is currently unused */ |
| 276 | /* (SIOCIWFIRSTPRIV + 15) is currently unused */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 277 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 278 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 279 | /* Private ioctls for setting the measurement configuration */ |
| 280 | #define WLAN_PRIV_SET_OEM_DATA_REQ (SIOCIWFIRSTPRIV + 17) |
| 281 | #define WLAN_PRIV_GET_OEM_DATA_RSP (SIOCIWFIRSTPRIV + 19) |
| 282 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | |
| 284 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 285 | #define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20) |
| 286 | #endif |
| 287 | |
| 288 | /* Private ioctl for setting the host offload feature */ |
| 289 | #define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18) |
| 290 | |
| 291 | /* Private ioctl to get the statistics */ |
| 292 | #define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21) |
| 293 | |
| 294 | /* Private ioctl to set the Keep Alive Params */ |
| 295 | #define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22) |
| 296 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 297 | /* Private ioctl to set the Packet Filtering Params */ |
| 298 | #define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23) |
| 299 | #endif |
| 300 | |
| 301 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 302 | /* Private ioctl to get the statistics */ |
| 303 | #define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24) |
| 304 | #endif |
| 305 | |
| 306 | #define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25) /*Don't change this number*/ |
| 307 | |
| 308 | #define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26) |
| 309 | #define WLAN_PRIV_CLEAR_MCBC_FILTER (SIOCIWFIRSTPRIV + 27) |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 310 | /* Private ioctl to trigger reassociation */ |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 311 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 312 | #define WLAN_SET_POWER_PARAMS (SIOCIWFIRSTPRIV + 29) |
| 313 | #define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31) |
| 314 | |
| 315 | #define WLAN_STATS_INVALID 0 |
| 316 | #define WLAN_STATS_RETRY_CNT 1 |
| 317 | #define WLAN_STATS_MUL_RETRY_CNT 2 |
| 318 | #define WLAN_STATS_TX_FRM_CNT 3 |
| 319 | #define WLAN_STATS_RX_FRM_CNT 4 |
| 320 | #define WLAN_STATS_FRM_DUP_CNT 5 |
| 321 | #define WLAN_STATS_FAIL_CNT 6 |
| 322 | #define WLAN_STATS_RTS_FAIL_CNT 7 |
| 323 | #define WLAN_STATS_ACK_FAIL_CNT 8 |
| 324 | #define WLAN_STATS_RTS_SUC_CNT 9 |
| 325 | #define WLAN_STATS_RX_DISCARD_CNT 10 |
| 326 | #define WLAN_STATS_RX_ERROR_CNT 11 |
| 327 | #define WLAN_STATS_TX_BYTE_CNT 12 |
| 328 | |
| 329 | #define WLAN_STATS_RX_BYTE_CNT 13 |
| 330 | #define WLAN_STATS_RX_RATE 14 |
| 331 | #define WLAN_STATS_TX_RATE 15 |
| 332 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 333 | #define WLAN_STATS_RX_UC_BYTE_CNT 16 |
| 334 | #define WLAN_STATS_RX_MC_BYTE_CNT 17 |
| 335 | #define WLAN_STATS_RX_BC_BYTE_CNT 18 |
| 336 | #define WLAN_STATS_TX_UC_BYTE_CNT 19 |
| 337 | #define WLAN_STATS_TX_MC_BYTE_CNT 20 |
| 338 | #define WLAN_STATS_TX_BC_BYTE_CNT 21 |
| 339 | |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 340 | #define FILL_TLV(__p, __type, __size, __val, __tlen) do { \ |
| 341 | if ((__tlen + __size + 2) < WE_MAX_STR_LEN) \ |
| 342 | { \ |
| 343 | *__p++ = __type; \ |
| 344 | *__p++ = __size; \ |
| 345 | memcpy(__p, __val, __size); \ |
| 346 | __p += __size; \ |
| 347 | __tlen += __size + 2; \ |
| 348 | } \ |
| 349 | else \ |
| 350 | { \ |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 351 | hddLog(VOS_TRACE_LEVEL_ERROR, "FILL_TLV Failed!!!"); \ |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 352 | } \ |
| 353 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 354 | |
| 355 | #define VERSION_VALUE_MAX_LEN 32 |
| 356 | |
| 357 | #define TX_PER_TRACKING_DEFAULT_RATIO 5 |
| 358 | #define TX_PER_TRACKING_MAX_RATIO 10 |
| 359 | #define TX_PER_TRACKING_DEFAULT_WATERMARK 5 |
| 360 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 361 | #define WLAN_ADAPTER 0 |
| 362 | #define P2P_ADAPTER 1 |
| 363 | |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 364 | /* |
| 365 | * When supplicant sends SETBAND ioctl it queries for channels from |
| 366 | * cfg80211 layer by sending itself EVENT_CHANNEL_LIST_CHANGED command. |
| 367 | * This is not required if the return type from ioctl is |
| 368 | * DO_NOT_SEND_CHANNEL_CHANGE_EVENT as wiphy will send channel change |
| 369 | * event as part of regulatory_hint. |
| 370 | */ |
| 371 | enum { |
| 372 | SEND_CHANNEL_CHANGE_EVENT = 0, |
| 373 | DO_NOT_SEND_CHANNEL_CHANGE_EVENT, |
| 374 | }; |
| 375 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 376 | /*MCC Configuration parameters */ |
| 377 | enum { |
| 378 | MCC_SCHEDULE_TIME_SLICE_CFG_PARAM = 1, |
| 379 | MCC_MAX_NULL_SEND_TIME_CFG_PARAM, |
| 380 | MCC_TX_EARLY_STOP_TIME_CFG_PARAM, |
| 381 | MCC_RX_DRAIN_TIME_CFG_PARAM, |
| 382 | MCC_CHANNEL_SWITCH_TIME_CFG_PARAM, |
| 383 | MCC_MIN_CHANNEL_TIME_CFG_PARAM, |
| 384 | MCC_PARK_BEFORE_TBTT_CFG_PARAM, |
| 385 | MCC_MIN_AFTER_DTIM_CFG_PARAM, |
| 386 | MCC_TOO_CLOSE_MARGIN_CFG_PARAM, |
| 387 | }; |
| 388 | |
| 389 | int hdd_validate_mcc_config(hdd_adapter_t *pAdapter, v_UINT_t staId, |
| 390 | v_UINT_t arg1, v_UINT_t arg2, v_UINT_t arg3); |
| 391 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 392 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 393 | int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 394 | v_U8_t sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | #endif |
| 396 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 397 | /**--------------------------------------------------------------------------- |
| 398 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 399 | \brief mem_alloc_copy_from_user_helper - |
| 400 | |
| 401 | Helper function to allocate buffer and copy user data. |
| 402 | |
| 403 | \param - wrqu - Pointer to IOCTL Data. |
| 404 | len - size |
| 405 | |
| 406 | \return - On Success pointer to buffer, On failure NULL |
| 407 | |
| 408 | --------------------------------------------------------------------------*/ |
Girish Gowli | 86c471e | 2014-06-17 19:28:05 +0530 | [diff] [blame] | 409 | void *mem_alloc_copy_from_user_helper(const void *wrqu_data, size_t len) |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 410 | { |
| 411 | u8 *ptr = NULL; |
| 412 | |
| 413 | /* in order to protect the code, an extra byte is post appended to the buffer |
| 414 | * and the null termination is added. However, when allocating (len+1) byte |
| 415 | * of memory, we need to make sure that there is no uint overflow when doing |
| 416 | * addition. In theory check len < UINT_MAX protects the uint overflow. For |
| 417 | * wlan private ioctl, the buffer size is much less than UINT_MAX, as a good |
| 418 | * guess, now, it is assumed that the private command buffer size is no |
| 419 | * greater than 4K (4096 bytes). So we use 4096 as the upper boundary for now. |
| 420 | */ |
| 421 | if (len > MAX_USER_COMMAND_SIZE) |
| 422 | { |
| 423 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 424 | "Invalid length"); |
| 425 | return NULL; |
| 426 | } |
| 427 | |
| 428 | ptr = kmalloc(len + 1, GFP_KERNEL); |
| 429 | if (NULL == ptr) |
| 430 | { |
| 431 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 432 | "unable to allocate memory"); |
| 433 | return NULL; |
| 434 | } |
| 435 | |
| 436 | if (copy_from_user(ptr, wrqu_data, len)) |
| 437 | { |
| 438 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 439 | "%s: failed to copy data to user buffer", __func__); |
| 440 | kfree(ptr); |
| 441 | return NULL; |
| 442 | } |
| 443 | ptr[len] = '\0'; |
| 444 | return ptr; |
| 445 | } |
| 446 | |
Girish Gowli | 488ef49 | 2014-06-12 18:44:33 +0530 | [diff] [blame] | 447 | // Function to handle and get compatible struct iw_point passed to ioctl. |
| 448 | int hdd_priv_get_data(struct iw_point *p_priv_data, |
| 449 | union iwreq_data *wrqu) |
| 450 | { |
| 451 | if ((NULL == p_priv_data) || (NULL == wrqu)) |
| 452 | { |
| 453 | return -EINVAL; |
| 454 | } |
| 455 | |
| 456 | #ifdef CONFIG_COMPAT |
| 457 | if (is_compat_task()) |
| 458 | { |
| 459 | struct compat_iw_point *p_compat_priv_data; |
| 460 | |
| 461 | // Compat task: typecast to campat structure and copy the members. |
| 462 | p_compat_priv_data = (struct compat_iw_point *) &wrqu->data; |
| 463 | |
| 464 | p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer); |
| 465 | p_priv_data->length = p_compat_priv_data->length; |
| 466 | p_priv_data->flags = p_compat_priv_data->flags; |
| 467 | }//if(is_compat_task()) |
| 468 | else |
| 469 | { |
| 470 | #endif //#ifdef CONFIG_COMPAT |
| 471 | |
| 472 | // Non compat task: directly copy the structure. |
| 473 | memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point)); |
| 474 | |
| 475 | #ifdef CONFIG_COMPAT |
| 476 | }//else of - if(is_compat_task()) |
| 477 | #endif //#ifdef CONFIG_COMPAT |
| 478 | |
| 479 | return 0; |
| 480 | } |
| 481 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 482 | /**--------------------------------------------------------------------------- |
| 483 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 484 | \brief hdd_wlan_get_version() - |
| 485 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 486 | This function use to get Wlan Driver, Firmware, & Hardware Version. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 487 | |
| 488 | \param - pAdapter Pointer to the adapter. |
| 489 | wrqu - Pointer to IOCTL REQUEST Data. |
| 490 | extra - Pointer to char |
| 491 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 492 | \return - none |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | |
| 494 | --------------------------------------------------------------------------*/ |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 495 | void hdd_wlan_get_version(hdd_adapter_t *pAdapter, union iwreq_data *wrqu, |
| 496 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 497 | { |
| 498 | VOS_STATUS status; |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 499 | tSirVersionString wcnss_SW_version; |
| 500 | tSirVersionString wcnss_HW_version; |
| 501 | char *pSWversion; |
| 502 | char *pHWversion; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 503 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 504 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 505 | status = sme_GetWcnssSoftwareVersion(hHal, wcnss_SW_version, |
| 506 | sizeof(wcnss_SW_version)); |
| 507 | if (VOS_IS_STATUS_SUCCESS(status)) |
| 508 | { |
| 509 | pSWversion = wcnss_SW_version; |
| 510 | } |
| 511 | else |
| 512 | { |
| 513 | pSWversion = "Unknown"; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 514 | } |
| 515 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 516 | status = sme_GetWcnssHardwareVersion(hHal, wcnss_HW_version, |
| 517 | sizeof(wcnss_HW_version)); |
| 518 | if (VOS_IS_STATUS_SUCCESS(status)) |
| 519 | { |
| 520 | pHWversion = wcnss_HW_version; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 521 | } |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 522 | else |
| 523 | { |
| 524 | pHWversion = "Unknown"; |
| 525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 526 | |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 527 | wrqu->data.length = scnprintf(extra, WE_MAX_STR_LEN, |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 528 | "Host SW:%s, FW:%s, HW:%s", |
| 529 | QWLAN_VERSIONSTR, |
| 530 | pSWversion, |
| 531 | pHWversion); |
| 532 | |
| 533 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 534 | } |
| 535 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 536 | int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu) |
| 537 | { |
| 538 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 539 | v_U32_t threshold = 0,status = 0; |
| 540 | |
| 541 | ENTER(); |
| 542 | |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 543 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 544 | { |
| 545 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 546 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 547 | return status; |
| 548 | } |
| 549 | |
| 550 | if ( eHAL_STATUS_SUCCESS != |
| 551 | ccmCfgGetInt(hHal, WNI_CFG_RTS_THRESHOLD, &threshold) ) |
| 552 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 553 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 554 | FL("failed to get ini parameter, WNI_CFG_RTS_THRESHOLD")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 555 | return -EIO; |
| 556 | } |
| 557 | wrqu->rts.value = threshold; |
| 558 | |
| 559 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 560 | ("Rts-Threshold=%d!!"), wrqu->rts.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 561 | |
| 562 | EXIT(); |
| 563 | |
| 564 | return 0; |
| 565 | } |
| 566 | |
| 567 | int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu) |
| 568 | { |
| 569 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 570 | v_U32_t threshold = 0,status = 0; |
| 571 | |
| 572 | ENTER(); |
| 573 | |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 574 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 575 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 576 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 577 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 578 | return status; |
| 579 | } |
| 580 | |
| 581 | if ( ccmCfgGetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold) |
| 582 | != eHAL_STATUS_SUCCESS ) |
| 583 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 584 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 585 | FL("failed to get ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 586 | return -EIO; |
| 587 | } |
| 588 | wrqu->frag.value = threshold; |
| 589 | |
| 590 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 591 | ("Frag-Threshold=%d!!"), wrqu->frag.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 592 | |
| 593 | EXIT(); |
| 594 | |
| 595 | return 0; |
| 596 | } |
| 597 | |
| 598 | int hdd_wlan_get_freq(v_U32_t channel, v_U32_t *pfreq) |
| 599 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 600 | int i; |
| 601 | if (channel > 0) |
| 602 | { |
| 603 | for (i=0; i < FREQ_CHAN_MAP_TABLE_SIZE; i++) |
| 604 | { |
| 605 | if (channel == freq_chan_map[i].chan) |
| 606 | { |
| 607 | *pfreq = freq_chan_map[i].freq; |
| 608 | return 1; |
| 609 | } |
| 610 | } |
| 611 | } |
| 612 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 613 | ("Invalid channel no=%d!!"), channel); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 614 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 615 | } |
| 616 | |
| 617 | static v_BOOL_t |
| 618 | hdd_IsAuthTypeRSN( tHalHandle halHandle, eCsrAuthType authType) |
| 619 | { |
| 620 | v_BOOL_t rsnType = VOS_FALSE; |
| 621 | // is the authType supported? |
| 622 | switch (authType) |
| 623 | { |
| 624 | case eCSR_AUTH_TYPE_NONE: //never used |
| 625 | rsnType = eANI_BOOLEAN_FALSE; |
| 626 | break; |
| 627 | // MAC layer authentication types |
| 628 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 629 | rsnType = eANI_BOOLEAN_FALSE; |
| 630 | break; |
| 631 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 632 | rsnType = eANI_BOOLEAN_FALSE; |
| 633 | break; |
| 634 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 635 | rsnType = eANI_BOOLEAN_FALSE; |
| 636 | break; |
| 637 | |
| 638 | // Upper layer authentication types |
| 639 | case eCSR_AUTH_TYPE_WPA: |
| 640 | rsnType = eANI_BOOLEAN_TRUE; |
| 641 | break; |
| 642 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 643 | rsnType = eANI_BOOLEAN_TRUE; |
| 644 | break; |
| 645 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 646 | rsnType = eANI_BOOLEAN_TRUE; |
| 647 | break; |
| 648 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 649 | case eCSR_AUTH_TYPE_FT_RSN: |
| 650 | #endif |
| 651 | case eCSR_AUTH_TYPE_RSN: |
| 652 | rsnType = eANI_BOOLEAN_TRUE; |
| 653 | break; |
| 654 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 655 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 656 | #endif |
| 657 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 658 | #ifdef WLAN_FEATURE_11W |
| 659 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame^] | 660 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 661 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 662 | rsnType = eANI_BOOLEAN_TRUE; |
| 663 | break; |
| 664 | //case eCSR_AUTH_TYPE_FAILED: |
| 665 | case eCSR_AUTH_TYPE_UNKNOWN: |
| 666 | rsnType = eANI_BOOLEAN_FALSE; |
| 667 | break; |
| 668 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 669 | hddLog(LOGE, FL("%s called with unknown authType - default to Open, None"), |
| 670 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 671 | rsnType = eANI_BOOLEAN_FALSE; |
| 672 | break; |
| 673 | } |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 674 | hddLog(LOGE, FL("%s called with authType: %d, returned: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 675 | __func__, authType, rsnType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 676 | return rsnType; |
| 677 | } |
| 678 | |
| 679 | static void hdd_GetRssiCB( v_S7_t rssi, tANI_U32 staId, void *pContext ) |
| 680 | { |
| 681 | struct statsContext *pStatsContext; |
| 682 | hdd_adapter_t *pAdapter; |
| 683 | |
| 684 | if (ioctl_debug) |
| 685 | { |
| 686 | pr_info("%s: rssi [%d] STA [%d] pContext [%p]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 687 | __func__, (int)rssi, (int)staId, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 688 | } |
| 689 | |
| 690 | if (NULL == pContext) |
| 691 | { |
| 692 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 693 | "%s: Bad param, pContext [%p]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 694 | __func__, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 695 | return; |
| 696 | } |
| 697 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 698 | pStatsContext = pContext; |
| 699 | pAdapter = pStatsContext->pAdapter; |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 700 | |
| 701 | /* there is a race condition that exists between this callback |
| 702 | function and the caller since the caller could time out either |
| 703 | before or while this code is executing. we use a spinlock to |
| 704 | serialize these actions */ |
| 705 | spin_lock(&hdd_context_lock); |
| 706 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 707 | if ((NULL == pAdapter) || (RSSI_CONTEXT_MAGIC != pStatsContext->magic)) |
| 708 | { |
| 709 | /* the caller presumably timed out so there is nothing we can do */ |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 710 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 711 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 712 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 713 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 714 | if (ioctl_debug) |
| 715 | { |
| 716 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 717 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 718 | } |
| 719 | return; |
| 720 | } |
| 721 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 722 | /* context is valid so caller is still waiting */ |
| 723 | |
| 724 | /* paranoia: invalidate the magic */ |
| 725 | pStatsContext->magic = 0; |
| 726 | |
| 727 | /* copy over the rssi */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 728 | pAdapter->rssi = rssi; |
| 729 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 730 | /* notify the caller */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 731 | complete(&pStatsContext->completion); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 732 | |
| 733 | /* serialization is complete */ |
| 734 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 735 | } |
| 736 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 737 | static void hdd_GetSnrCB(tANI_S8 snr, tANI_U32 staId, void *pContext) |
| 738 | { |
| 739 | struct statsContext *pStatsContext; |
| 740 | hdd_adapter_t *pAdapter; |
| 741 | |
| 742 | if (ioctl_debug) |
| 743 | { |
| 744 | pr_info("%s: snr [%d] STA [%d] pContext [%p]\n", |
| 745 | __func__, (int)snr, (int)staId, pContext); |
| 746 | } |
| 747 | |
| 748 | if (NULL == pContext) |
| 749 | { |
| 750 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 751 | "%s: Bad param, pContext [%p]", |
| 752 | __func__, pContext); |
| 753 | return; |
| 754 | } |
| 755 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 756 | pStatsContext = pContext; |
| 757 | pAdapter = pStatsContext->pAdapter; |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 758 | |
| 759 | /* there is a race condition that exists between this callback |
| 760 | function and the caller since the caller could time out either |
| 761 | before or while this code is executing. we use a spinlock to |
| 762 | serialize these actions */ |
| 763 | spin_lock(&hdd_context_lock); |
| 764 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 765 | if ((NULL == pAdapter) || (SNR_CONTEXT_MAGIC != pStatsContext->magic)) |
| 766 | { |
| 767 | /* the caller presumably timed out so there is nothing we can do */ |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 768 | spin_unlock(&hdd_context_lock); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 769 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 770 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
| 771 | __func__, pAdapter, pStatsContext->magic); |
| 772 | if (ioctl_debug) |
| 773 | { |
| 774 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 775 | __func__, pAdapter, pStatsContext->magic); |
| 776 | } |
| 777 | return; |
| 778 | } |
| 779 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 780 | /* context is valid so caller is still waiting */ |
| 781 | |
| 782 | /* paranoia: invalidate the magic */ |
| 783 | pStatsContext->magic = 0; |
| 784 | |
| 785 | /* copy over the snr */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 786 | pAdapter->snr = snr; |
| 787 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 788 | /* notify the caller */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 789 | complete(&pStatsContext->completion); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 790 | |
| 791 | /* serialization is complete */ |
| 792 | spin_unlock(&hdd_context_lock); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 793 | } |
| 794 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 795 | VOS_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value) |
| 796 | { |
| 797 | struct statsContext context; |
| 798 | hdd_context_t *pHddCtx; |
| 799 | hdd_station_ctx_t *pHddStaCtx; |
| 800 | eHalStatus hstatus; |
| 801 | long lrc; |
| 802 | |
| 803 | if (NULL == pAdapter) |
| 804 | { |
| 805 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 806 | "%s: Invalid context, pAdapter", __func__); |
| 807 | return VOS_STATUS_E_FAULT; |
| 808 | } |
| 809 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 810 | { |
| 811 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 812 | /* return a cached value */ |
| 813 | *rssi_value = pAdapter->rssi; |
| 814 | return VOS_STATUS_SUCCESS; |
| 815 | } |
| 816 | |
| 817 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 818 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 819 | |
| 820 | init_completion(&context.completion); |
| 821 | context.pAdapter = pAdapter; |
| 822 | context.magic = RSSI_CONTEXT_MAGIC; |
| 823 | |
| 824 | hstatus = sme_GetRssi(pHddCtx->hHal, hdd_GetRssiCB, |
| 825 | pHddStaCtx->conn_info.staId[ 0 ], |
| 826 | pHddStaCtx->conn_info.bssId, |
| 827 | &context, pHddCtx->pvosContext); |
| 828 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 829 | { |
| 830 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 831 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 832 | /* we'll returned a cached value below */ |
| 833 | } |
| 834 | else |
| 835 | { |
| 836 | /* request was sent -- wait for the response */ |
| 837 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 838 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 839 | if (lrc <= 0) |
| 840 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 841 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: SME %s while retrieving RSSI", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 842 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 843 | /* we'll now returned a cached value below */ |
| 844 | } |
| 845 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 846 | |
| 847 | /* either we never sent a request, we sent a request and received a |
| 848 | response or we sent a request and timed out. if we never sent a |
| 849 | request or if we sent a request and got a response, we want to |
| 850 | clear the magic out of paranoia. if we timed out there is a |
| 851 | race condition such that the callback function could be |
| 852 | executing at the same time we are. of primary concern is if the |
| 853 | callback function had already verified the "magic" but had not |
| 854 | yet set the completion variable when a timeout occurred. we |
| 855 | serialize these activities by invalidating the magic while |
| 856 | holding a shared spinlock which will cause us to block if the |
| 857 | callback is currently executing */ |
| 858 | spin_lock(&hdd_context_lock); |
| 859 | context.magic = 0; |
| 860 | spin_unlock(&hdd_context_lock); |
| 861 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 862 | *rssi_value = pAdapter->rssi; |
| 863 | |
| 864 | return VOS_STATUS_SUCCESS; |
| 865 | } |
| 866 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 867 | VOS_STATUS wlan_hdd_get_snr(hdd_adapter_t *pAdapter, v_S7_t *snr) |
| 868 | { |
| 869 | struct statsContext context; |
| 870 | hdd_context_t *pHddCtx; |
| 871 | hdd_station_ctx_t *pHddStaCtx; |
| 872 | eHalStatus hstatus; |
| 873 | long lrc; |
| 874 | int valid; |
| 875 | |
| 876 | if (NULL == pAdapter) |
| 877 | { |
| 878 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 879 | "%s: Invalid context, pAdapter", __func__); |
| 880 | return VOS_STATUS_E_FAULT; |
| 881 | } |
| 882 | |
| 883 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 884 | |
| 885 | valid = wlan_hdd_validate_context(pHddCtx); |
| 886 | if (0 != valid) |
| 887 | { |
| 888 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid")); |
| 889 | return VOS_STATUS_E_FAULT; |
| 890 | } |
| 891 | |
| 892 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 893 | if (NULL == pHddStaCtx) |
| 894 | { |
| 895 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is not valid")); |
| 896 | return VOS_STATUS_E_FAULT; |
| 897 | } |
| 898 | |
| 899 | init_completion(&context.completion); |
| 900 | context.pAdapter = pAdapter; |
| 901 | context.magic = SNR_CONTEXT_MAGIC; |
| 902 | |
| 903 | hstatus = sme_GetSnr(pHddCtx->hHal, hdd_GetSnrCB, |
| 904 | pHddStaCtx->conn_info.staId[ 0 ], |
| 905 | pHddStaCtx->conn_info.bssId, |
| 906 | &context); |
| 907 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 908 | { |
| 909 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI", |
| 910 | __func__); |
| 911 | /* we'll returned a cached value below */ |
| 912 | } |
| 913 | else |
| 914 | { |
| 915 | /* request was sent -- wait for the response */ |
| 916 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 917 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 918 | if (lrc <= 0) |
| 919 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 920 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: SME %s while retrieving SNR", |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 921 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 922 | /* we'll now returned a cached value below */ |
| 923 | } |
| 924 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 925 | |
| 926 | /* either we never sent a request, we sent a request and received a |
| 927 | response or we sent a request and timed out. if we never sent a |
| 928 | request or if we sent a request and got a response, we want to |
| 929 | clear the magic out of paranoia. if we timed out there is a |
| 930 | race condition such that the callback function could be |
| 931 | executing at the same time we are. of primary concern is if the |
| 932 | callback function had already verified the "magic" but had not |
| 933 | yet set the completion variable when a timeout occurred. we |
| 934 | serialize these activities by invalidating the magic while |
| 935 | holding a shared spinlock which will cause us to block if the |
| 936 | callback is currently executing */ |
| 937 | spin_lock(&hdd_context_lock); |
| 938 | context.magic = 0; |
| 939 | spin_unlock(&hdd_context_lock); |
| 940 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 941 | *snr = pAdapter->snr; |
| 942 | |
| 943 | return VOS_STATUS_SUCCESS; |
| 944 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 945 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 946 | |
| 947 | static void hdd_GetRoamRssiCB( v_S7_t rssi, tANI_U32 staId, void *pContext ) |
| 948 | { |
| 949 | struct statsContext *pStatsContext; |
| 950 | hdd_adapter_t *pAdapter; |
| 951 | if (ioctl_debug) |
| 952 | { |
| 953 | pr_info("%s: rssi [%d] STA [%d] pContext [%p]\n", |
| 954 | __func__, (int)rssi, (int)staId, pContext); |
| 955 | } |
| 956 | |
| 957 | if (NULL == pContext) |
| 958 | { |
| 959 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 960 | "%s: Bad param, pContext [%p]", |
| 961 | __func__, pContext); |
| 962 | return; |
| 963 | } |
| 964 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 965 | pStatsContext = pContext; |
| 966 | pAdapter = pStatsContext->pAdapter; |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 967 | |
| 968 | /* there is a race condition that exists between this callback |
| 969 | function and the caller since the caller could time out either |
| 970 | before or while this code is executing. we use a spinlock to |
| 971 | serialize these actions */ |
| 972 | spin_lock(&hdd_context_lock); |
| 973 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 974 | if ((NULL == pAdapter) || (RSSI_CONTEXT_MAGIC != pStatsContext->magic)) |
| 975 | { |
| 976 | /* the caller presumably timed out so there is nothing we can do */ |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 977 | spin_unlock(&hdd_context_lock); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 978 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 979 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
| 980 | __func__, pAdapter, pStatsContext->magic); |
| 981 | if (ioctl_debug) |
| 982 | { |
| 983 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 984 | __func__, pAdapter, pStatsContext->magic); |
| 985 | } |
| 986 | return; |
| 987 | } |
| 988 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 989 | /* context is valid so caller is still waiting */ |
| 990 | |
| 991 | /* paranoia: invalidate the magic */ |
| 992 | pStatsContext->magic = 0; |
| 993 | |
| 994 | /* copy over the rssi */ |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 995 | pAdapter->rssi = rssi; |
| 996 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 997 | /* notify the caller */ |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 998 | complete(&pStatsContext->completion); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 999 | |
| 1000 | /* serialization is complete */ |
| 1001 | spin_unlock(&hdd_context_lock); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1002 | } |
| 1003 | |
| 1004 | |
| 1005 | |
| 1006 | VOS_STATUS wlan_hdd_get_roam_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value) |
| 1007 | { |
| 1008 | struct statsContext context; |
| 1009 | hdd_context_t *pHddCtx = NULL; |
| 1010 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 1011 | eHalStatus hstatus; |
| 1012 | long lrc; |
| 1013 | |
| 1014 | if (NULL == pAdapter) |
| 1015 | { |
| 1016 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 1017 | "%s: Invalid context, pAdapter", __func__); |
| 1018 | return VOS_STATUS_E_FAULT; |
| 1019 | } |
| 1020 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 1021 | { |
| 1022 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1023 | /* return a cached value */ |
| 1024 | *rssi_value = pAdapter->rssi; |
| 1025 | return VOS_STATUS_SUCCESS; |
| 1026 | } |
| 1027 | |
| 1028 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1029 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1030 | |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 1031 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1032 | { |
| 1033 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:Not associated!",__func__); |
| 1034 | /* return a cached value */ |
| 1035 | *rssi_value = 0; |
| 1036 | return VOS_STATUS_SUCCESS; |
| 1037 | } |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 1038 | |
| 1039 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 1040 | { |
| 1041 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1042 | "%s: Roaming in progress, hence return last cached RSSI", __func__); |
| 1043 | *rssi_value = pAdapter->rssi; |
| 1044 | return VOS_STATUS_SUCCESS; |
| 1045 | } |
| 1046 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1047 | init_completion(&context.completion); |
| 1048 | context.pAdapter = pAdapter; |
| 1049 | context.magic = RSSI_CONTEXT_MAGIC; |
| 1050 | |
| 1051 | hstatus = sme_GetRoamRssi(pHddCtx->hHal, hdd_GetRoamRssiCB, |
| 1052 | pHddStaCtx->conn_info.staId[ 0 ], |
| 1053 | pHddStaCtx->conn_info.bssId, |
| 1054 | &context, pHddCtx->pvosContext); |
| 1055 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 1056 | { |
| 1057 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI", |
| 1058 | __func__); |
| 1059 | /* we'll returned a cached value below */ |
| 1060 | } |
| 1061 | else |
| 1062 | { |
| 1063 | /* request was sent -- wait for the response */ |
| 1064 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 1065 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1066 | if (lrc <= 0) |
| 1067 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 1068 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while retrieving RSSI", |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1069 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1070 | /* we'll now returned a cached value below */ |
| 1071 | } |
| 1072 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 1073 | |
| 1074 | /* either we never sent a request, we sent a request and received a |
| 1075 | response or we sent a request and timed out. if we never sent a |
| 1076 | request or if we sent a request and got a response, we want to |
| 1077 | clear the magic out of paranoia. if we timed out there is a |
| 1078 | race condition such that the callback function could be |
| 1079 | executing at the same time we are. of primary concern is if the |
| 1080 | callback function had already verified the "magic" but had not |
| 1081 | yet set the completion variable when a timeout occurred. we |
| 1082 | serialize these activities by invalidating the magic while |
| 1083 | holding a shared spinlock which will cause us to block if the |
| 1084 | callback is currently executing */ |
| 1085 | spin_lock(&hdd_context_lock); |
| 1086 | context.magic = 0; |
| 1087 | spin_unlock(&hdd_context_lock); |
| 1088 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1089 | *rssi_value = pAdapter->rssi; |
| 1090 | |
| 1091 | return VOS_STATUS_SUCCESS; |
| 1092 | } |
| 1093 | #endif |
| 1094 | |
| 1095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1096 | void hdd_StatisticsCB( void *pStats, void *pContext ) |
| 1097 | { |
| 1098 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
| 1099 | hdd_stats_t *pStatsCache = NULL; |
| 1100 | hdd_wext_state_t *pWextState; |
| 1101 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 1102 | |
| 1103 | tCsrSummaryStatsInfo *pSummaryStats = NULL; |
| 1104 | tCsrGlobalClassAStatsInfo *pClassAStats = NULL; |
| 1105 | tCsrGlobalClassBStatsInfo *pClassBStats = NULL; |
| 1106 | tCsrGlobalClassCStatsInfo *pClassCStats = NULL; |
| 1107 | tCsrGlobalClassDStatsInfo *pClassDStats = NULL; |
| 1108 | tCsrPerStaStatsInfo *pPerStaStats = NULL; |
| 1109 | |
| 1110 | if (pAdapter!= NULL) |
| 1111 | pStatsCache = &pAdapter->hdd_stats; |
| 1112 | |
| 1113 | |
| 1114 | pSummaryStats = (tCsrSummaryStatsInfo *)pStats; |
| 1115 | pClassAStats = (tCsrGlobalClassAStatsInfo *)( pSummaryStats + 1 ); |
| 1116 | pClassBStats = (tCsrGlobalClassBStatsInfo *)( pClassAStats + 1 ); |
| 1117 | pClassCStats = (tCsrGlobalClassCStatsInfo *)( pClassBStats + 1 ); |
| 1118 | pClassDStats = (tCsrGlobalClassDStatsInfo *)( pClassCStats + 1 ); |
| 1119 | pPerStaStats = (tCsrPerStaStatsInfo *)( pClassDStats + 1 ); |
| 1120 | |
| 1121 | if (pStatsCache!=NULL) |
| 1122 | { |
| 1123 | // and copy the stats into the cache we keep in the adapter instance structure |
| 1124 | vos_mem_copy( &pStatsCache->summary_stat, pSummaryStats, sizeof( pStatsCache->summary_stat ) ); |
| 1125 | vos_mem_copy( &pStatsCache->ClassA_stat, pClassAStats, sizeof( pStatsCache->ClassA_stat ) ); |
| 1126 | vos_mem_copy( &pStatsCache->ClassB_stat, pClassBStats, sizeof( pStatsCache->ClassB_stat ) ); |
| 1127 | vos_mem_copy( &pStatsCache->ClassC_stat, pClassCStats, sizeof( pStatsCache->ClassC_stat ) ); |
| 1128 | vos_mem_copy( &pStatsCache->ClassD_stat, pClassDStats, sizeof( pStatsCache->ClassD_stat ) ); |
| 1129 | vos_mem_copy( &pStatsCache->perStaStats, pPerStaStats, sizeof( pStatsCache->perStaStats ) ); |
| 1130 | } |
| 1131 | |
| 1132 | if(pAdapter) |
| 1133 | { |
| 1134 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1135 | if(pWextState) |
| 1136 | { |
| 1137 | vos_status = vos_event_set(&pWextState->vosevent); |
| 1138 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1139 | { |
| 1140 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1141 | "%s: vos_event_set failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1142 | return; |
| 1143 | } |
| 1144 | } |
| 1145 | } |
| 1146 | } |
| 1147 | |
| 1148 | void ccmCfgSetCallback(tHalHandle halHandle, tANI_S32 result) |
| 1149 | { |
| 1150 | v_CONTEXT_t pVosContext; |
| 1151 | hdd_context_t *pHddCtx; |
| 1152 | VOS_STATUS hdd_reconnect_all_adapters( hdd_context_t *pHddCtx ); |
| 1153 | #if 0 |
| 1154 | hdd_wext_state_t *pWextState; |
| 1155 | v_U32_t roamId; |
| 1156 | #endif |
| 1157 | |
| 1158 | ENTER(); |
| 1159 | |
| 1160 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL); |
| 1161 | |
| 1162 | pHddCtx = (hdd_context_t*) vos_get_context(VOS_MODULE_ID_HDD,pVosContext); |
| 1163 | if (NULL == pHddCtx) |
| 1164 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1165 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid pHddCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1166 | return; |
| 1167 | } |
| 1168 | #if 0 |
| 1169 | pWextState = pAdapter->pWextState; |
| 1170 | #endif |
| 1171 | |
| 1172 | if (WNI_CFG_NEED_RESTART == result || WNI_CFG_NEED_RELOAD == result) |
| 1173 | { |
| 1174 | //TODO Verify is this is really used. If yes need to fix it. |
| 1175 | hdd_reconnect_all_adapters( pHddCtx ); |
| 1176 | #if 0 |
| 1177 | pAdapter->conn_info.connState = eConnectionState_NotConnected; |
| 1178 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 1179 | vosStatus = sme_RoamDisconnect(halHandle, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 1180 | |
| 1181 | if(VOS_STATUS_SUCCESS == vosStatus) |
| 1182 | wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var, |
| 1183 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 1184 | |
| 1185 | sme_RoamConnect(halHandle, |
| 1186 | pAdapter->sessionId, &(pWextState->roamProfile), |
| 1187 | &roamId); |
| 1188 | #endif |
| 1189 | } |
| 1190 | |
| 1191 | EXIT(); |
| 1192 | |
| 1193 | } |
| 1194 | |
| 1195 | void hdd_clearRoamProfileIe( hdd_adapter_t *pAdapter) |
| 1196 | { |
| 1197 | int i = 0; |
| 1198 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1199 | |
| 1200 | /* clear WPA/RSN/WSC IE information in the profile */ |
| 1201 | pWextState->roamProfile.nWPAReqIELength = 0; |
| 1202 | pWextState->roamProfile.pWPAReqIE = (tANI_U8 *)NULL; |
| 1203 | pWextState->roamProfile.nRSNReqIELength = 0; |
| 1204 | pWextState->roamProfile.pRSNReqIE = (tANI_U8 *)NULL; |
| 1205 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1206 | #ifdef FEATURE_WLAN_WAPI |
| 1207 | pWextState->roamProfile.nWAPIReqIELength = 0; |
| 1208 | pWextState->roamProfile.pWAPIReqIE = (tANI_U8 *)NULL; |
| 1209 | #endif |
| 1210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1211 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 1212 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1213 | pWextState->roamProfile.nAddIEScanLength = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 1214 | memset(pWextState->roamProfile.addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH+2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1215 | pWextState->roamProfile.pAddIEAssoc = (tANI_U8 *)NULL; |
| 1216 | pWextState->roamProfile.nAddIEAssocLength = 0; |
| 1217 | |
| 1218 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 1219 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 1220 | = eCSR_ENCRYPT_TYPE_NONE; |
| 1221 | |
| 1222 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 1223 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] |
| 1224 | = eCSR_ENCRYPT_TYPE_NONE; |
| 1225 | |
| 1226 | pWextState->roamProfile.AuthType.numEntries = 1; |
| 1227 | pWextState->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1228 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1229 | #ifdef WLAN_FEATURE_11W |
| 1230 | pWextState->roamProfile.MFPEnabled = eANI_BOOLEAN_FALSE; |
| 1231 | pWextState->roamProfile.MFPRequired = 0; |
| 1232 | pWextState->roamProfile.MFPCapable = 0; |
| 1233 | #endif |
| 1234 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | pWextState->authKeyMgmt = 0; |
| 1236 | |
| 1237 | for (i=0; i < CSR_MAX_NUM_KEY; i++) |
| 1238 | { |
| 1239 | if (pWextState->roamProfile.Keys.KeyMaterial[i]) |
| 1240 | { |
| 1241 | pWextState->roamProfile.Keys.KeyLength[i] = 0; |
| 1242 | } |
| 1243 | } |
| 1244 | #ifdef FEATURE_WLAN_WAPI |
| 1245 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_OPEN; |
| 1246 | pAdapter->wapi_info.nWapiMode = 0; |
| 1247 | #endif |
| 1248 | |
| 1249 | vos_mem_zero((void *)(pWextState->req_bssId), WNI_CFG_BSSID_LEN); |
| 1250 | |
| 1251 | } |
| 1252 | |
| 1253 | void wlan_hdd_ula_done_cb(v_VOID_t *callbackContext) |
| 1254 | { |
| 1255 | hdd_adapter_t *pAdapter = (hdd_adapter_t*)callbackContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1256 | |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1257 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 1258 | { |
| 1259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1260 | "%s: Invalid pAdapter magic", __func__); |
| 1261 | } |
| 1262 | else |
| 1263 | { |
| 1264 | complete(&pAdapter->ula_complete); |
| 1265 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1266 | } |
| 1267 | |
| 1268 | VOS_STATUS wlan_hdd_check_ula_done(hdd_adapter_t *pAdapter) |
| 1269 | { |
| 1270 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1271 | VOS_STATUS vos_status; |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1272 | unsigned long rc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1273 | |
| 1274 | if (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated) |
| 1275 | { |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1276 | INIT_COMPLETION(pAdapter->ula_complete); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1277 | |
| 1278 | /*To avoid race condition between the set key and the last EAPOL |
| 1279 | packet, notify TL to finish upper layer authentication incase if the |
| 1280 | last EAPOL packet pending in the TL queue.*/ |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 1281 | vos_status = WLANTL_Finish_ULA(wlan_hdd_ula_done_cb, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1282 | |
| 1283 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 1284 | { |
| 1285 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1286 | "[%4d] WLANTL_Finish_ULA returned ERROR status= %d", |
| 1287 | __LINE__, vos_status ); |
| 1288 | return vos_status; |
| 1289 | |
| 1290 | } |
| 1291 | |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1292 | rc = wait_for_completion_timeout(&pAdapter->ula_complete, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1293 | msecs_to_jiffies(HDD_FINISH_ULA_TIME_OUT)); |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1294 | if (rc <= 0) |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1295 | { |
| 1296 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1297 | FL("failure wait on ULA to complete %ld"), rc); |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1298 | /* we'll still fall through and return success since the |
| 1299 | * connection may still get established but is just taking |
| 1300 | * too long for us to wait */ |
| 1301 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1302 | } |
| 1303 | return VOS_STATUS_SUCCESS; |
| 1304 | } |
| 1305 | |
| 1306 | v_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) |
| 1307 | { |
| 1308 | |
| 1309 | int left = ie_len; |
| 1310 | v_U8_t *ptr = ie; |
| 1311 | v_U8_t elem_id,elem_len; |
| 1312 | v_U8_t eid = 0xDD; |
| 1313 | |
| 1314 | if ( NULL == ie || 0 == ie_len ) |
| 1315 | return NULL; |
| 1316 | |
| 1317 | while(left >= 2) |
| 1318 | { |
| 1319 | elem_id = ptr[0]; |
| 1320 | elem_len = ptr[1]; |
| 1321 | left -= 2; |
| 1322 | if(elem_len > left) |
| 1323 | { |
| 1324 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1325 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1326 | eid,elem_len,left); |
| 1327 | return NULL; |
| 1328 | } |
| 1329 | if (elem_id == eid) |
| 1330 | { |
| 1331 | if(memcmp( &ptr[2], oui, oui_size)==0) |
| 1332 | return ptr; |
| 1333 | } |
| 1334 | |
| 1335 | left -= elem_len; |
| 1336 | ptr += (elem_len + 2); |
| 1337 | } |
| 1338 | return NULL; |
| 1339 | } |
| 1340 | |
| 1341 | static int iw_set_commit(struct net_device *dev, struct iw_request_info *info, |
| 1342 | union iwreq_data *wrqu, char *extra) |
| 1343 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1344 | hddLog( LOG1, "In %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1345 | /* Do nothing for now */ |
| 1346 | return 0; |
| 1347 | } |
| 1348 | |
| 1349 | static int iw_get_name(struct net_device *dev, |
| 1350 | struct iw_request_info *info, |
| 1351 | char *wrqu, char *extra) |
| 1352 | { |
| 1353 | |
| 1354 | ENTER(); |
| 1355 | strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ); |
| 1356 | EXIT(); |
| 1357 | return 0; |
| 1358 | } |
| 1359 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1360 | static int __iw_set_mode(struct net_device *dev, |
| 1361 | struct iw_request_info *info, |
| 1362 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1363 | { |
| 1364 | hdd_wext_state_t *pWextState; |
| 1365 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1366 | tCsrRoamProfile *pRoamProfile; |
| 1367 | eCsrRoamBssType LastBSSType; |
| 1368 | eMib_dot11DesiredBssType connectedBssType; |
| 1369 | hdd_config_t *pConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1370 | struct wireless_dev *wdev; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1371 | |
| 1372 | ENTER(); |
| 1373 | |
| 1374 | if (NULL == pAdapter) |
| 1375 | { |
| 1376 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 1377 | "%s: Invalid context, pAdapter", __func__); |
| 1378 | return 0; |
| 1379 | } |
| 1380 | |
| 1381 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1382 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 1383 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1384 | return 0; |
| 1385 | } |
| 1386 | |
| 1387 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1388 | if (pWextState == NULL) |
| 1389 | { |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1390 | hddLog(LOGE, "%s ERROR: Data Storage Corruption", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1391 | return -EINVAL; |
| 1392 | } |
| 1393 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1394 | wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1395 | pRoamProfile = &pWextState->roamProfile; |
| 1396 | LastBSSType = pRoamProfile->BSSType; |
| 1397 | |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1398 | hddLog(LOG1, "%s Old Bss type = %d", __func__, LastBSSType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1399 | |
| 1400 | switch (wrqu->mode) |
| 1401 | { |
| 1402 | case IW_MODE_ADHOC: |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1403 | hddLog(LOG1, "%s Setting AP Mode as IW_MODE_ADHOC", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 1405 | // Set the phymode correctly for IBSS. |
| 1406 | pConfig = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 1407 | pWextState->roamProfile.phyMode = hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 1408 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1409 | wdev->iftype = NL80211_IFTYPE_ADHOC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1410 | break; |
| 1411 | case IW_MODE_INFRA: |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1412 | hddLog(LOG1, "%s Setting AP Mode as IW_MODE_INFRA", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1413 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1414 | wdev->iftype = NL80211_IFTYPE_STATION; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1415 | break; |
| 1416 | case IW_MODE_AUTO: |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1417 | hddLog(LOG1, "%s Setting AP Mode as IW_MODE_AUTO", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1418 | pRoamProfile->BSSType = eCSR_BSS_TYPE_ANY; |
| 1419 | break; |
| 1420 | default: |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 1421 | hddLog(LOGE, "%s Unknown AP Mode value %d ", __func__, wrqu->mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1422 | return -EOPNOTSUPP; |
| 1423 | } |
| 1424 | |
| 1425 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 1426 | { |
| 1427 | //the BSS mode changed |
| 1428 | // We need to issue disconnect if connected or in IBSS disconnect state |
| 1429 | if ( hdd_connGetConnectedBssType( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 1430 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 1431 | { |
| 1432 | VOS_STATUS vosStatus; |
| 1433 | // need to issue a disconnect to CSR. |
| 1434 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 1435 | vosStatus = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1436 | pAdapter->sessionId, |
| 1437 | eCSR_DISCONNECT_REASON_IBSS_LEAVE ); |
| 1438 | if(VOS_STATUS_SUCCESS == vosStatus) |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1439 | { |
| 1440 | long ret; |
| 1441 | ret = wait_for_completion_interruptible_timeout( |
| 1442 | &pAdapter->disconnect_comp_var, |
| 1443 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 1444 | if (ret <= 0) |
| 1445 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1446 | FL("failed wait on disconnect_comp_var %ld"), ret); |
| 1447 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1448 | } |
| 1449 | } |
| 1450 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1451 | EXIT(); |
| 1452 | return 0; |
| 1453 | } |
| 1454 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1455 | static int iw_set_mode(struct net_device *dev, |
| 1456 | struct iw_request_info *info, |
| 1457 | union iwreq_data *wrqu, char *extra) |
| 1458 | { |
| 1459 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1460 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1461 | vos_ssr_protect(__func__); |
| 1462 | ret = __iw_set_mode(dev, info, wrqu, extra); |
| 1463 | vos_ssr_unprotect(__func__); |
| 1464 | |
| 1465 | return ret; |
| 1466 | } |
| 1467 | |
| 1468 | static int __iw_get_mode(struct net_device *dev, |
| 1469 | struct iw_request_info *info, |
| 1470 | union iwreq_data *wrqu, |
| 1471 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1472 | { |
| 1473 | |
| 1474 | hdd_wext_state_t *pWextState; |
| 1475 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1476 | |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1477 | hddLog(LOG1, "In %s", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1478 | |
| 1479 | if (NULL == pAdapter) |
| 1480 | { |
| 1481 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 1482 | "%s: Invalid context, pAdapter", __func__); |
| 1483 | return 0; |
| 1484 | } |
| 1485 | |
| 1486 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1487 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 1488 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1489 | return 0; |
| 1490 | } |
| 1491 | |
| 1492 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1493 | if (pWextState == NULL) |
| 1494 | { |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1495 | hddLog(LOGE, "%s ERROR: Data Storage Corruption", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1496 | return -EINVAL; |
| 1497 | } |
| 1498 | |
| 1499 | switch (pWextState->roamProfile.BSSType) |
| 1500 | { |
| 1501 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1502 | hddLog(LOG1, "%s returns IW_MODE_INFRA", __func__); |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1503 | wrqu->mode = IW_MODE_INFRA; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1504 | break; |
| 1505 | case eCSR_BSS_TYPE_IBSS: |
| 1506 | case eCSR_BSS_TYPE_START_IBSS: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1507 | hddLog(LOG1, "%s returns IW_MODE_ADHOC", __func__); |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1508 | wrqu->mode = IW_MODE_ADHOC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1509 | break; |
| 1510 | case eCSR_BSS_TYPE_ANY: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1511 | hddLog(LOG1, "%s returns IW_MODE_AUTO", __func__); |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1512 | wrqu->mode = IW_MODE_AUTO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1513 | break; |
| 1514 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1515 | hddLog(LOG1, "%s returns APMODE_UNKNOWN", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1516 | break; |
| 1517 | } |
Madan Mohan Koyyalamudi | 0c2ba1b | 2013-10-01 19:47:50 +0530 | [diff] [blame] | 1518 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1519 | return 0; |
| 1520 | } |
| 1521 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1522 | static int iw_get_mode(struct net_device *dev, |
| 1523 | struct iw_request_info *info, |
| 1524 | union iwreq_data *wrqu, |
| 1525 | char *extra) |
| 1526 | { |
| 1527 | int ret; |
| 1528 | |
| 1529 | vos_ssr_protect(__func__); |
| 1530 | ret = __iw_get_mode(dev, info, wrqu, extra); |
| 1531 | vos_ssr_unprotect(__func__); |
| 1532 | |
| 1533 | return ret; |
| 1534 | } |
| 1535 | |
| 1536 | static int __iw_set_freq(struct net_device *dev, |
| 1537 | struct iw_request_info *info, |
| 1538 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1539 | { |
| 1540 | v_U32_t numChans = 0; |
| 1541 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 1542 | v_U32_t indx = 0; |
| 1543 | v_U32_t status = 0; |
| 1544 | |
| 1545 | hdd_wext_state_t *pWextState; |
| 1546 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1547 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1548 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1549 | tCsrRoamProfile * pRoamProfile; |
| 1550 | ENTER(); |
| 1551 | |
| 1552 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1553 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1554 | return status; |
| 1555 | } |
| 1556 | |
| 1557 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1558 | |
| 1559 | pRoamProfile = &pWextState->roamProfile; |
| 1560 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1561 | hddLog(LOG1,"setCHANNEL ioctl"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1562 | |
| 1563 | /* Link is up then return cant set channel*/ |
| 1564 | if(eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState || |
| 1565 | eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1566 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1567 | hddLog( LOGE, "IBSS Associated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | return -EOPNOTSUPP; |
| 1569 | } |
| 1570 | |
| 1571 | /* Settings by Frequency as input */ |
| 1572 | if((wrqu->freq.e == 1) && (wrqu->freq.m >= (tANI_U32)2.412e8) && |
| 1573 | (wrqu->freq.m <= (tANI_U32)5.825e8)) |
| 1574 | { |
| 1575 | tANI_U32 freq = wrqu->freq.m / 100000; |
| 1576 | |
| 1577 | while ((indx < FREQ_CHAN_MAP_TABLE_SIZE) && (freq != freq_chan_map[indx].freq)) |
| 1578 | indx++; |
| 1579 | if (indx >= FREQ_CHAN_MAP_TABLE_SIZE) |
| 1580 | { |
| 1581 | return -EINVAL; |
| 1582 | } |
| 1583 | wrqu->freq.e = 0; |
| 1584 | wrqu->freq.m = freq_chan_map[indx].chan; |
| 1585 | |
| 1586 | } |
| 1587 | |
| 1588 | if (wrqu->freq.e == 0) |
| 1589 | { |
| 1590 | if((wrqu->freq.m < WNI_CFG_CURRENT_CHANNEL_STAMIN) || |
| 1591 | (wrqu->freq.m > WNI_CFG_CURRENT_CHANNEL_STAMAX)) |
| 1592 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1593 | hddLog(LOG1,"%s: Channel [%d] is outside valid range from %d to %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1594 | __func__, wrqu->freq.m, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1595 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 1596 | return -EINVAL; |
| 1597 | } |
| 1598 | |
| 1599 | numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1600 | |
| 1601 | if (ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 1602 | validChan, &numChans) != eHAL_STATUS_SUCCESS){ |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1603 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 1604 | FL("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1605 | return -EIO; |
| 1606 | } |
| 1607 | |
| 1608 | for (indx = 0; indx < numChans; indx++) { |
| 1609 | if (wrqu->freq.m == validChan[indx]){ |
| 1610 | break; |
| 1611 | } |
| 1612 | } |
| 1613 | } |
| 1614 | else{ |
| 1615 | |
| 1616 | return -EINVAL; |
| 1617 | } |
| 1618 | |
| 1619 | if(indx >= numChans) |
| 1620 | { |
| 1621 | return -EINVAL; |
| 1622 | } |
| 1623 | |
| 1624 | /* Set the Operational Channel */ |
| 1625 | numChans = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 1626 | pHddStaCtx->conn_info.operationChannel = wrqu->freq.m; |
| 1627 | pRoamProfile->ChannelInfo.ChannelList = &pHddStaCtx->conn_info.operationChannel; |
| 1628 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1629 | hddLog(LOG1,"pRoamProfile->operationChannel = %d", wrqu->freq.m); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1630 | |
| 1631 | EXIT(); |
| 1632 | |
| 1633 | return status; |
| 1634 | } |
| 1635 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1636 | static int iw_set_freq(struct net_device *dev, |
| 1637 | struct iw_request_info *info, |
| 1638 | union iwreq_data *wrqu, char *extra) |
| 1639 | { |
| 1640 | int ret; |
| 1641 | |
| 1642 | vos_ssr_protect(__func__); |
| 1643 | ret = __iw_set_freq(dev, info, wrqu, extra); |
| 1644 | vos_ssr_unprotect(__func__); |
| 1645 | |
| 1646 | return ret; |
| 1647 | } |
| 1648 | |
| 1649 | static int __iw_get_freq(struct net_device *dev, |
| 1650 | struct iw_request_info *info, |
| 1651 | struct iw_freq *fwrq, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1652 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1653 | v_U32_t status = FALSE, channel = 0, freq = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1654 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1655 | tHalHandle hHal; |
| 1656 | hdd_wext_state_t *pWextState; |
| 1657 | tCsrRoamProfile * pRoamProfile; |
| 1658 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1659 | |
| 1660 | ENTER(); |
| 1661 | |
| 1662 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1663 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1664 | return status; |
| 1665 | } |
| 1666 | |
| 1667 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1668 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1669 | |
| 1670 | pRoamProfile = &pWextState->roamProfile; |
| 1671 | |
| 1672 | if( pHddStaCtx->conn_info.connState== eConnectionState_Associated ) |
| 1673 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1674 | if (sme_GetOperationChannel(hHal, &channel, pAdapter->sessionId) != eHAL_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1675 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1676 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1677 | FL("failed to get operating channel %u"), pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1678 | return -EIO; |
| 1679 | } |
| 1680 | else |
| 1681 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1682 | status = hdd_wlan_get_freq(channel, &freq); |
| 1683 | if( TRUE == status ) |
| 1684 | { |
| 1685 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 1686 | * iwlist & iwconfig command shows frequency into proper |
| 1687 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 1688 | fwrq->m = freq; |
| 1689 | fwrq->e = MHZ; |
| 1690 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1691 | } |
| 1692 | } |
| 1693 | else |
| 1694 | { |
Madan Mohan Koyyalamudi | 99f9c66 | 2012-10-11 17:00:31 -0700 | [diff] [blame] | 1695 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 1696 | * iwlist & iwconfig command shows frequency into proper |
| 1697 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 1698 | fwrq->m = 0; |
| 1699 | fwrq->e = MHZ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1700 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1701 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1702 | } |
| 1703 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1704 | static int iw_get_freq(struct net_device *dev, |
| 1705 | struct iw_request_info *info, |
| 1706 | struct iw_freq *fwrq, char *extra) |
| 1707 | { |
| 1708 | int ret; |
| 1709 | |
| 1710 | vos_ssr_protect(__func__); |
| 1711 | ret = __iw_get_freq(dev, info, fwrq, extra); |
| 1712 | vos_ssr_unprotect(__func__); |
| 1713 | |
| 1714 | return ret; |
| 1715 | } |
| 1716 | |
| 1717 | static int __iw_get_tx_power(struct net_device *dev, |
| 1718 | struct iw_request_info *info, |
| 1719 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1720 | { |
| 1721 | |
| 1722 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1723 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1724 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1725 | |
| 1726 | if (pHddCtx->isLogpInProgress) |
| 1727 | { |
| 1728 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 1729 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1730 | return -EBUSY; |
| 1731 | } |
| 1732 | |
| 1733 | if(eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 1734 | { |
| 1735 | wrqu->txpower.value = 0; |
| 1736 | return 0; |
| 1737 | } |
| 1738 | wlan_hdd_get_classAstats(pAdapter); |
| 1739 | wrqu->txpower.value = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 1740 | |
| 1741 | return 0; |
| 1742 | } |
| 1743 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1744 | static int iw_get_tx_power(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1745 | struct iw_request_info *info, |
| 1746 | union iwreq_data *wrqu, char *extra) |
| 1747 | { |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1748 | int ret; |
| 1749 | |
| 1750 | vos_ssr_protect(__func__); |
| 1751 | ret = __iw_get_tx_power(dev, info, wrqu, extra); |
| 1752 | vos_ssr_unprotect(__func__); |
| 1753 | |
| 1754 | return ret; |
| 1755 | } |
| 1756 | |
| 1757 | static int __iw_set_tx_power(struct net_device *dev, |
| 1758 | struct iw_request_info *info, |
| 1759 | union iwreq_data *wrqu, char *extra) |
| 1760 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1761 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1762 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1763 | |
| 1764 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 1765 | { |
| 1766 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1767 | return 0; |
| 1768 | } |
| 1769 | |
| 1770 | ENTER(); |
| 1771 | |
| 1772 | if ( ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, wrqu->txpower.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 1773 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1774 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1775 | FL("failed to set ini parameter, WNI_CFG_CURRENT_TX_POWER_LEVEL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1776 | return -EIO; |
| 1777 | } |
| 1778 | |
| 1779 | EXIT(); |
| 1780 | |
| 1781 | return 0; |
| 1782 | } |
| 1783 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1784 | static int iw_set_tx_power(struct net_device *dev, |
| 1785 | struct iw_request_info *info, |
| 1786 | union iwreq_data *wrqu, char *extra) |
| 1787 | { |
| 1788 | int ret; |
| 1789 | |
| 1790 | vos_ssr_protect(__func__); |
| 1791 | ret = __iw_set_tx_power(dev, info, wrqu, extra); |
| 1792 | vos_ssr_unprotect(__func__); |
| 1793 | |
| 1794 | return ret; |
| 1795 | } |
| 1796 | |
| 1797 | static int __iw_get_bitrate(struct net_device *dev, |
| 1798 | struct iw_request_info *info, |
| 1799 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1800 | { |
| 1801 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 1802 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1803 | hdd_wext_state_t *pWextState; |
| 1804 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1805 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1806 | |
| 1807 | ENTER(); |
| 1808 | |
| 1809 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1810 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1811 | return status; |
| 1812 | } |
| 1813 | |
| 1814 | if(eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 1815 | wrqu->bitrate.value = 0; |
| 1816 | } |
| 1817 | else { |
| 1818 | status = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), eCSR_HDD, |
| 1819 | SME_SUMMARY_STATS | |
| 1820 | SME_GLOBAL_CLASSA_STATS | |
| 1821 | SME_GLOBAL_CLASSB_STATS | |
| 1822 | SME_GLOBAL_CLASSC_STATS | |
| 1823 | SME_GLOBAL_CLASSD_STATS | |
| 1824 | SME_PER_STA_STATS, |
| 1825 | hdd_StatisticsCB, 0, FALSE, |
| 1826 | pHddStaCtx->conn_info.staId[0], pAdapter ); |
| 1827 | |
| 1828 | if(eHAL_STATUS_SUCCESS != status) |
| 1829 | { |
| 1830 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1831 | "%s: Unable to retrieve statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1832 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1833 | return status; |
| 1834 | } |
| 1835 | |
| 1836 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1837 | |
| 1838 | vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS); |
| 1839 | |
| 1840 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1841 | { |
| 1842 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1843 | "%s: SME timeout while retrieving statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1844 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1845 | return VOS_STATUS_E_FAILURE; |
| 1846 | } |
| 1847 | |
| 1848 | wrqu->bitrate.value = pAdapter->hdd_stats.ClassA_stat.tx_rate*500*1000; |
| 1849 | } |
| 1850 | |
| 1851 | EXIT(); |
| 1852 | |
| 1853 | return vos_status; |
| 1854 | } |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1855 | |
| 1856 | static int iw_get_bitrate(struct net_device *dev, |
| 1857 | struct iw_request_info *info, |
| 1858 | union iwreq_data *wrqu, char *extra) |
| 1859 | { |
| 1860 | int ret; |
| 1861 | |
| 1862 | vos_ssr_protect(__func__); |
| 1863 | ret = __iw_get_bitrate(dev, info, wrqu, extra); |
| 1864 | vos_ssr_unprotect(__func__); |
| 1865 | |
| 1866 | return ret; |
| 1867 | } |
| 1868 | |
| 1869 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1870 | /* ccm call back function */ |
| 1871 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1872 | static int __iw_set_bitrate(struct net_device *dev, |
| 1873 | struct iw_request_info *info, |
| 1874 | union iwreq_data *wrqu, |
| 1875 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1876 | { |
| 1877 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1878 | hdd_wext_state_t *pWextState; |
| 1879 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1880 | v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 1881 | v_U32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 1882 | v_U32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 1883 | v_U32_t i, rate; |
| 1884 | v_U32_t valid_rate = FALSE, active_phy_mode = 0; |
| 1885 | |
| 1886 | ENTER(); |
| 1887 | |
| 1888 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1889 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1890 | return 0; |
| 1891 | } |
| 1892 | |
| 1893 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1894 | |
| 1895 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 1896 | { |
| 1897 | return -ENXIO ; |
| 1898 | } |
| 1899 | |
| 1900 | rate = wrqu->bitrate.value; |
| 1901 | |
| 1902 | if (rate == -1) |
| 1903 | { |
| 1904 | rate = WNI_CFG_FIXED_RATE_AUTO; |
| 1905 | valid_rate = TRUE; |
| 1906 | } |
| 1907 | else if (ccmCfgGetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1908 | WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS) |
| 1909 | { |
| 1910 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G |
| 1911 | || active_phy_mode == WNI_CFG_DOT11_MODE_11B) |
| 1912 | { |
| 1913 | if ((ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1914 | WNI_CFG_SUPPORTED_RATES_11A, |
| 1915 | supp_rates, &a_len) == eHAL_STATUS_SUCCESS) && |
| 1916 | (ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1917 | WNI_CFG_SUPPORTED_RATES_11B, |
| 1918 | supp_rates, &b_len) == eHAL_STATUS_SUCCESS)) |
| 1919 | { |
| 1920 | for (i = 0; i < (b_len + a_len); ++i) |
| 1921 | { |
| 1922 | /* supported rates returned is double the actual rate so we divide it by 2 */ |
| 1923 | if ((supp_rates[i]&0x7F)/2 == rate) |
| 1924 | { |
| 1925 | valid_rate = TRUE; |
| 1926 | rate = i + WNI_CFG_FIXED_RATE_1MBPS; |
| 1927 | break; |
| 1928 | } |
| 1929 | } |
| 1930 | } |
| 1931 | } |
| 1932 | } |
| 1933 | if (valid_rate != TRUE) |
| 1934 | { |
| 1935 | return -EINVAL; |
| 1936 | } |
| 1937 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1938 | WNI_CFG_FIXED_RATE, rate, |
| 1939 | ccmCfgSetCallback,eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS) |
| 1940 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1941 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1942 | FL("failed to set ini parameter, WNI_CFG_FIXED_RATE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1943 | return -EIO; |
| 1944 | } |
| 1945 | return 0; |
| 1946 | } |
| 1947 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1948 | static int iw_set_bitrate(struct net_device *dev, |
| 1949 | struct iw_request_info *info, |
| 1950 | union iwreq_data *wrqu, |
| 1951 | char *extra) |
| 1952 | { |
| 1953 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1954 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1955 | vos_ssr_protect(__func__); |
| 1956 | ret = __iw_set_bitrate(dev, info, wrqu, extra); |
| 1957 | vos_ssr_unprotect(__func__); |
| 1958 | |
| 1959 | return ret; |
| 1960 | } |
| 1961 | |
| 1962 | static int __iw_set_genie(struct net_device *dev, |
| 1963 | struct iw_request_info *info, |
| 1964 | union iwreq_data *wrqu, |
| 1965 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1966 | { |
| 1967 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1968 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 1969 | u_int8_t *genie = NULL; |
| 1970 | u_int8_t *base_genie = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1971 | v_U16_t remLen; |
| 1972 | |
| 1973 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1974 | |
| 1975 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 1976 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 1977 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 1978 | return 0; |
| 1979 | } |
| 1980 | |
| 1981 | if (!wrqu->data.length) { |
| 1982 | hdd_clearRoamProfileIe(pAdapter); |
| 1983 | EXIT(); |
| 1984 | return 0; |
| 1985 | } |
| 1986 | |
| 1987 | base_genie = mem_alloc_copy_from_user_helper(wrqu->data.pointer, |
| 1988 | wrqu->data.length); |
| 1989 | if (NULL == base_genie) |
| 1990 | { |
| 1991 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1992 | "mem_alloc_copy_from_user_helper fail"); |
| 1993 | return -ENOMEM; |
| 1994 | } |
| 1995 | |
| 1996 | genie = base_genie; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1997 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1998 | remLen = wrqu->data.length; |
| 1999 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2000 | hddLog(LOG1,"iw_set_genie ioctl IE[0x%X], LEN[%d]", genie[0], genie[1]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2001 | |
| 2002 | /* clear any previous genIE before this call */ |
| 2003 | memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) ); |
| 2004 | |
| 2005 | while (remLen >= 2) |
| 2006 | { |
| 2007 | v_U16_t eLen = 0; |
| 2008 | v_U8_t elementId; |
| 2009 | elementId = *genie++; |
| 2010 | eLen = *genie++; |
| 2011 | remLen -= 2; |
| 2012 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2013 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2014 | __func__, elementId, eLen); |
| 2015 | |
| 2016 | switch ( elementId ) |
| 2017 | { |
| 2018 | case IE_EID_VENDOR: |
| 2019 | if ((IE_LEN_SIZE+IE_EID_SIZE+IE_VENDOR_OUI_SIZE) > eLen) /* should have at least OUI */ |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2020 | { |
| 2021 | kfree(base_genie); |
| 2022 | return -EINVAL; |
| 2023 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2024 | |
| 2025 | if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
| 2026 | { |
| 2027 | v_U16_t curGenIELen = pWextState->genIE.length; |
| 2028 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS OUI(%02x %02x %02x %02x) IE(len %d)", |
| 2029 | __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2); |
| 2030 | |
| 2031 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) ) |
| 2032 | { |
| 2033 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2034 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2035 | VOS_ASSERT(0); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2036 | kfree(base_genie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2037 | return -ENOMEM; |
| 2038 | } |
| 2039 | // save to Additional IE ; it should be accumulated to handle WPS IE + other IE |
| 2040 | memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2); |
| 2041 | pWextState->genIE.length += eLen + 2; |
| 2042 | } |
| 2043 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 2044 | { |
| 2045 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 2046 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 2047 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)); |
| 2048 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 2049 | pWextState->roamProfile.nWPAReqIELength = eLen + 2; |
| 2050 | } |
| 2051 | else /* any vendorId except WPA IE should be accumulated to genIE */ |
| 2052 | { |
| 2053 | v_U16_t curGenIELen = pWextState->genIE.length; |
| 2054 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OUI(%02x %02x %02x %02x) IE(len %d)", |
| 2055 | __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2); |
| 2056 | |
| 2057 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) ) |
| 2058 | { |
| 2059 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2060 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2061 | VOS_ASSERT(0); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2062 | kfree(base_genie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2063 | return -ENOMEM; |
| 2064 | } |
| 2065 | // save to Additional IE ; it should be accumulated to handle WPS IE + other IE |
| 2066 | memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2); |
| 2067 | pWextState->genIE.length += eLen + 2; |
| 2068 | } |
| 2069 | break; |
| 2070 | case DOT11F_EID_RSN: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2071 | hddLog (LOG1, "%s Set RSN IE (len %d)",__func__, eLen+2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2072 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 2073 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)); |
| 2074 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 2075 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; |
| 2076 | break; |
| 2077 | |
| 2078 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2079 | hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, elementId); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2080 | kfree(base_genie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2081 | return 0; |
| 2082 | } |
| 2083 | genie += eLen; |
| 2084 | remLen -= eLen; |
| 2085 | } |
| 2086 | EXIT(); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2087 | kfree(base_genie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2088 | return 0; |
| 2089 | } |
| 2090 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2091 | static int iw_set_genie(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2092 | struct iw_request_info *info, |
| 2093 | union iwreq_data *wrqu, |
| 2094 | char *extra) |
| 2095 | { |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2096 | int ret; |
| 2097 | |
| 2098 | vos_ssr_protect(__func__); |
| 2099 | ret = __iw_set_genie(dev, info, wrqu, extra); |
| 2100 | vos_ssr_unprotect(__func__); |
| 2101 | |
| 2102 | return ret; |
| 2103 | } |
| 2104 | |
| 2105 | static int __iw_get_genie(struct net_device *dev, |
| 2106 | struct iw_request_info *info, |
| 2107 | union iwreq_data *wrqu, |
| 2108 | char *extra) |
| 2109 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2110 | hdd_wext_state_t *pWextState; |
| 2111 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2112 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2113 | eHalStatus status; |
| 2114 | v_U32_t length = DOT11F_IE_RSN_MAX_LEN; |
| 2115 | v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN]; |
| 2116 | |
| 2117 | ENTER(); |
| 2118 | |
| 2119 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 2120 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 2121 | return 0; |
| 2122 | } |
| 2123 | |
| 2124 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2125 | hddLog(LOG1,"getGEN_IE ioctl"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2126 | |
| 2127 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2128 | |
| 2129 | if( pHddStaCtx->conn_info.connState == eConnectionState_NotConnected) |
| 2130 | { |
| 2131 | return -ENXIO; |
| 2132 | } |
| 2133 | |
| 2134 | // Return something ONLY if we are associated with an RSN or WPA network |
| 2135 | if ( VOS_TRUE != hdd_IsAuthTypeRSN(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2136 | pWextState->roamProfile.negotiatedAuthType)) |
| 2137 | { |
| 2138 | return -ENXIO; |
| 2139 | } |
| 2140 | |
| 2141 | // Actually retrieve the RSN IE from CSR. (We previously sent it down in the CSR Roam Profile.) |
| 2142 | status = csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2143 | pAdapter->sessionId, |
| 2144 | &length, |
| 2145 | genIeBytes); |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 2146 | length = VOS_MIN((u_int16_t) length, DOT11F_IE_RSN_MAX_LEN); |
| 2147 | if (wrqu->data.length < length) |
| 2148 | { |
| 2149 | hddLog(LOG1, "%s: failed to copy data to user buffer", __func__); |
| 2150 | return -EFAULT; |
| 2151 | } |
Arif Hussain | 9f05be0 | 2014-02-05 12:06:53 -0800 | [diff] [blame] | 2152 | vos_mem_copy( extra, (v_VOID_t*)genIeBytes, length); |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 2153 | wrqu->data.length = length; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2154 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2155 | hddLog(LOG1,"%s: RSN IE of %d bytes returned", __func__, wrqu->data.length ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2156 | |
| 2157 | EXIT(); |
| 2158 | |
| 2159 | return 0; |
| 2160 | } |
| 2161 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2162 | static int iw_get_genie(struct net_device *dev, |
| 2163 | struct iw_request_info *info, |
| 2164 | union iwreq_data *wrqu, |
| 2165 | char *extra) |
| 2166 | { |
| 2167 | int ret; |
| 2168 | |
| 2169 | vos_ssr_protect(__func__); |
| 2170 | ret = __iw_get_genie(dev, info, wrqu, extra); |
| 2171 | vos_ssr_unprotect(__func__); |
| 2172 | |
| 2173 | return ret; |
| 2174 | } |
| 2175 | |
| 2176 | |
| 2177 | static int __iw_get_encode(struct net_device *dev, |
| 2178 | struct iw_request_info *info, |
| 2179 | struct iw_point *dwrq, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2180 | { |
| 2181 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2182 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2183 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 2184 | int keyId; |
| 2185 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
| 2186 | int i; |
| 2187 | |
| 2188 | ENTER(); |
| 2189 | |
| 2190 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 2191 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 2192 | return 0; |
| 2193 | } |
| 2194 | |
| 2195 | keyId = pRoamProfile->Keys.defaultIndex; |
| 2196 | |
| 2197 | if(keyId < 0 || keyId >= MAX_WEP_KEYS) |
| 2198 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2199 | hddLog(LOG1,"%s: Invalid keyId : %d",__func__,keyId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2200 | return -EINVAL; |
| 2201 | } |
| 2202 | |
| 2203 | if(pRoamProfile->Keys.KeyLength[keyId] > 0) |
| 2204 | { |
| 2205 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 2206 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
| 2207 | vos_mem_copy(extra,&(pRoamProfile->Keys.KeyMaterial[keyId][0]),pRoamProfile->Keys.KeyLength[keyId]); |
| 2208 | |
| 2209 | dwrq->flags |= (keyId + 1); |
| 2210 | |
| 2211 | } |
| 2212 | else |
| 2213 | { |
| 2214 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 2215 | } |
| 2216 | |
| 2217 | for(i=0; i < MAX_WEP_KEYS; i++) |
| 2218 | { |
| 2219 | if(pRoamProfile->Keys.KeyMaterial[i] == NULL) |
| 2220 | { |
| 2221 | continue; |
| 2222 | } |
| 2223 | else |
| 2224 | { |
| 2225 | break; |
| 2226 | } |
| 2227 | } |
| 2228 | |
| 2229 | if(MAX_WEP_KEYS == i) |
| 2230 | { |
| 2231 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 2232 | } |
| 2233 | |
| 2234 | authType = ((hdd_station_ctx_t*)WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType; |
| 2235 | |
| 2236 | if(eCSR_AUTH_TYPE_OPEN_SYSTEM == authType) |
| 2237 | { |
| 2238 | dwrq->flags |= IW_ENCODE_OPEN; |
| 2239 | } |
| 2240 | else |
| 2241 | { |
| 2242 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 2243 | } |
| 2244 | EXIT(); |
| 2245 | return 0; |
| 2246 | } |
| 2247 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2248 | static int iw_get_encode(struct net_device *dev, |
| 2249 | struct iw_request_info *info, |
| 2250 | struct iw_point *dwrq, char *extra) |
| 2251 | { |
| 2252 | int ret; |
| 2253 | |
| 2254 | vos_ssr_protect(__func__); |
| 2255 | ret = __iw_get_encode(dev, info, dwrq, extra); |
| 2256 | vos_ssr_unprotect(__func__); |
| 2257 | |
| 2258 | return ret; |
| 2259 | } |
| 2260 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2261 | #define PAE_ROLE_AUTHENTICATOR 1 // =1 for authenticator, |
| 2262 | #define PAE_ROLE_SUPPLICANT 0 // =0 for supplicant |
| 2263 | |
| 2264 | |
| 2265 | /* |
| 2266 | * This function sends a single 'key' to LIM at all time. |
| 2267 | */ |
| 2268 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2269 | static int __iw_get_rts_threshold(struct net_device *dev, |
| 2270 | struct iw_request_info *info, |
| 2271 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2272 | { |
| 2273 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2274 | v_U32_t status = 0; |
| 2275 | |
| 2276 | status = hdd_wlan_get_rts_threshold(pAdapter,wrqu); |
| 2277 | |
| 2278 | return status; |
| 2279 | } |
| 2280 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2281 | static int iw_get_rts_threshold(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2282 | struct iw_request_info *info, |
| 2283 | union iwreq_data *wrqu, char *extra) |
| 2284 | { |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2285 | int ret; |
| 2286 | |
| 2287 | vos_ssr_protect(__func__); |
| 2288 | ret = __iw_get_rts_threshold(dev, info, wrqu, extra); |
| 2289 | vos_ssr_unprotect(__func__); |
| 2290 | |
| 2291 | return ret; |
| 2292 | } |
| 2293 | |
| 2294 | static int __iw_set_rts_threshold(struct net_device *dev, |
| 2295 | struct iw_request_info *info, |
| 2296 | union iwreq_data *wrqu, char *extra) |
| 2297 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2298 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2299 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2300 | |
| 2301 | ENTER(); |
| 2302 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 2303 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 2304 | { |
| 2305 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2306 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 2307 | return -EAGAIN; |
| 2308 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2309 | if ( wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX ) |
| 2310 | { |
| 2311 | return -EINVAL; |
| 2312 | } |
| 2313 | |
| 2314 | if ( ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, wrqu->rts.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 2315 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 2316 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2317 | FL("failed to set ini parameter, WNI_CFG_RTS_THRESHOLD")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2318 | return -EIO; |
| 2319 | } |
| 2320 | |
| 2321 | EXIT(); |
| 2322 | |
| 2323 | return 0; |
| 2324 | } |
| 2325 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2326 | static int iw_set_rts_threshold(struct net_device *dev, |
| 2327 | struct iw_request_info *info, |
| 2328 | union iwreq_data *wrqu, char *extra) |
| 2329 | { |
| 2330 | int ret; |
| 2331 | |
| 2332 | vos_ssr_protect(__func__); |
| 2333 | ret = __iw_set_rts_threshold(dev, info, wrqu, extra); |
| 2334 | vos_ssr_unprotect(__func__); |
| 2335 | |
| 2336 | return ret; |
| 2337 | } |
| 2338 | |
| 2339 | static int __iw_get_frag_threshold(struct net_device *dev, |
| 2340 | struct iw_request_info *info, |
| 2341 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2342 | { |
| 2343 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2344 | v_U32_t status = 0; |
| 2345 | |
| 2346 | status = hdd_wlan_get_frag_threshold(pAdapter,wrqu); |
| 2347 | |
| 2348 | return status; |
| 2349 | } |
| 2350 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2351 | static int iw_get_frag_threshold(struct net_device *dev, |
| 2352 | struct iw_request_info *info, |
| 2353 | union iwreq_data *wrqu, char *extra) |
| 2354 | { |
| 2355 | int ret; |
| 2356 | |
| 2357 | vos_ssr_protect(__func__); |
| 2358 | ret = __iw_get_frag_threshold(dev, info, wrqu, extra); |
| 2359 | vos_ssr_unprotect(__func__); |
| 2360 | |
| 2361 | return ret; |
| 2362 | } |
| 2363 | |
| 2364 | static int __iw_set_frag_threshold(struct net_device *dev, |
| 2365 | struct iw_request_info *info, |
| 2366 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2367 | { |
| 2368 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2369 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2370 | |
| 2371 | ENTER(); |
| 2372 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 2373 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 2374 | { |
| 2375 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2376 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 2377 | return -EBUSY; |
| 2378 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2379 | if ( wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX ) |
| 2380 | { |
| 2381 | return -EINVAL; |
| 2382 | } |
| 2383 | |
| 2384 | if ( ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, wrqu->frag.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 2385 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 2386 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2387 | FL("failed to set ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2388 | return -EIO; |
| 2389 | } |
| 2390 | |
| 2391 | EXIT(); |
| 2392 | |
| 2393 | return 0; |
| 2394 | } |
| 2395 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2396 | static int iw_set_frag_threshold(struct net_device *dev, |
| 2397 | struct iw_request_info *info, |
| 2398 | union iwreq_data *wrqu, char *extra) |
| 2399 | { |
| 2400 | int ret; |
| 2401 | |
| 2402 | vos_ssr_protect(__func__); |
| 2403 | ret = __iw_set_frag_threshold(dev, info, wrqu, extra); |
| 2404 | vos_ssr_unprotect(__func__); |
| 2405 | |
| 2406 | return ret; |
| 2407 | } |
| 2408 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2409 | static int iw_get_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 | |
| 2417 | static int iw_set_power_mode(struct net_device *dev, |
| 2418 | struct iw_request_info *info, |
| 2419 | union iwreq_data *wrqu, char *extra) |
| 2420 | { |
| 2421 | ENTER(); |
| 2422 | return -EOPNOTSUPP; |
| 2423 | } |
| 2424 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2425 | static int __iw_get_range(struct net_device *dev, |
| 2426 | struct iw_request_info *info, |
| 2427 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2428 | { |
| 2429 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2430 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2431 | struct iw_range *range = (struct iw_range *) extra; |
| 2432 | |
| 2433 | v_U8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 2434 | |
| 2435 | v_U32_t num_channels = sizeof(channels); |
| 2436 | v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 2437 | v_U32_t a_len; |
| 2438 | v_U32_t b_len; |
| 2439 | v_U32_t active_phy_mode = 0; |
| 2440 | v_U8_t index = 0, i; |
| 2441 | |
| 2442 | ENTER(); |
| 2443 | |
| 2444 | wrqu->data.length = sizeof(struct iw_range); |
| 2445 | memset(range, 0, sizeof(struct iw_range)); |
| 2446 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 2447 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 2448 | { |
| 2449 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 2450 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 2451 | return -EBUSY; |
| 2452 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2453 | |
| 2454 | /*Get the phy mode*/ |
| 2455 | if (ccmCfgGetInt(hHal, |
| 2456 | WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS) |
| 2457 | { |
| 2458 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2459 | "active_phy_mode = %d", active_phy_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2460 | |
| 2461 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G) |
| 2462 | { |
| 2463 | /*Get the supported rates for 11G band*/ |
Jeff Johnson | 1611e58 | 2013-04-03 10:43:16 -0700 | [diff] [blame] | 2464 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2465 | if (ccmCfgGetStr(hHal, |
| 2466 | WNI_CFG_SUPPORTED_RATES_11A, |
| 2467 | supp_rates, &a_len) == eHAL_STATUS_SUCCESS) |
| 2468 | { |
| 2469 | if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN) |
| 2470 | { |
| 2471 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 2472 | } |
| 2473 | for (i = 0; i < a_len; i++) |
| 2474 | { |
| 2475 | range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000; |
| 2476 | } |
| 2477 | range->num_bitrates = a_len; |
| 2478 | } |
| 2479 | else |
| 2480 | { |
| 2481 | return -EIO; |
| 2482 | } |
| 2483 | } |
| 2484 | else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B) |
| 2485 | { |
| 2486 | /*Get the supported rates for 11B band*/ |
Jeff Johnson | 1611e58 | 2013-04-03 10:43:16 -0700 | [diff] [blame] | 2487 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2488 | if (ccmCfgGetStr(hHal, |
| 2489 | WNI_CFG_SUPPORTED_RATES_11B, |
| 2490 | supp_rates, &b_len) == eHAL_STATUS_SUCCESS) |
| 2491 | { |
| 2492 | if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN) |
| 2493 | { |
| 2494 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 2495 | } |
| 2496 | for (i = 0; i < b_len; i++) |
| 2497 | { |
| 2498 | range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000; |
| 2499 | } |
| 2500 | range->num_bitrates = b_len; |
| 2501 | } |
| 2502 | else |
| 2503 | { |
| 2504 | return -EIO; |
| 2505 | } |
| 2506 | } |
| 2507 | } |
| 2508 | |
| 2509 | range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX; |
| 2510 | range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN; |
| 2511 | range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX; |
| 2512 | |
| 2513 | range->encoding_size[0] = 5; |
| 2514 | range->encoding_size[1] = 13; |
| 2515 | range->num_encoding_sizes = 2; |
| 2516 | range->max_encoding_tokens = MAX_WEP_KEYS; |
| 2517 | |
| 2518 | // we support through Wireless Extensions 22 |
| 2519 | range->we_version_compiled = WIRELESS_EXT; |
| 2520 | range->we_version_source = 22; |
| 2521 | |
| 2522 | /*Supported Channels and Frequencies*/ |
| 2523 | if (ccmCfgGetStr((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels, &num_channels) != eHAL_STATUS_SUCCESS) |
| 2524 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 2525 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2526 | FL("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2527 | return -EIO; |
| 2528 | } |
| 2529 | if (num_channels > IW_MAX_FREQUENCIES) |
| 2530 | { |
| 2531 | num_channels = IW_MAX_FREQUENCIES; |
| 2532 | } |
| 2533 | |
| 2534 | range->num_channels = num_channels; |
| 2535 | range->num_frequency = num_channels; |
| 2536 | |
| 2537 | for (index=0; index < num_channels; index++) |
| 2538 | { |
| 2539 | v_U32_t frq_indx = 0; |
| 2540 | |
| 2541 | range->freq[index].i = channels[index]; |
| 2542 | while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE) |
| 2543 | { |
| 2544 | if(channels[index] == freq_chan_map[frq_indx].chan) |
| 2545 | { |
| 2546 | range->freq[index].m = freq_chan_map[frq_indx].freq * 100000; |
| 2547 | range->freq[index].e = 1; |
| 2548 | break; |
| 2549 | } |
| 2550 | frq_indx++; |
| 2551 | } |
| 2552 | } |
| 2553 | |
| 2554 | /* Event capability (kernel + driver) */ |
| 2555 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
| 2556 | IW_EVENT_CAPA_MASK(SIOCGIWAP) | |
| 2557 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); |
| 2558 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
| 2559 | |
| 2560 | /*Encryption capability*/ |
| 2561 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
| 2562 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
| 2563 | |
| 2564 | /* Txpower capability */ |
| 2565 | range->txpower_capa = IW_TXPOW_MWATT; |
| 2566 | |
| 2567 | /*Scanning capability*/ |
| 2568 | #if WIRELESS_EXT >= 22 |
| 2569 | range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL; |
| 2570 | #endif |
| 2571 | |
| 2572 | EXIT(); |
| 2573 | return 0; |
| 2574 | } |
| 2575 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2576 | static int iw_get_range(struct net_device *dev, |
| 2577 | struct iw_request_info *info, |
| 2578 | union iwreq_data *wrqu, char *extra) |
| 2579 | { |
| 2580 | int ret; |
| 2581 | |
| 2582 | vos_ssr_protect(__func__); |
| 2583 | ret = __iw_get_range(dev, info, wrqu, extra); |
| 2584 | vos_ssr_unprotect(__func__); |
| 2585 | |
| 2586 | return ret; |
| 2587 | } |
| 2588 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2589 | /* Callback function registered with PMC to know status of PMC request */ |
| 2590 | static void iw_power_callback_fn (void *pContext, eHalStatus status) |
| 2591 | { |
| 2592 | struct statsContext *pStatsContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2593 | |
| 2594 | if (NULL == pContext) |
| 2595 | { |
| 2596 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2597 | "%s: Bad param, pContext [%p]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2598 | __func__, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2599 | return; |
| 2600 | } |
| 2601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2602 | pStatsContext = (struct statsContext *)pContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2603 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2604 | /* there is a race condition that exists between this callback |
| 2605 | function and the caller since the caller could time out either |
| 2606 | before or while this code is executing. we use a spinlock to |
| 2607 | serialize these actions */ |
| 2608 | spin_lock(&hdd_context_lock); |
| 2609 | |
| 2610 | if (POWER_CONTEXT_MAGIC != pStatsContext->magic) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2611 | { |
| 2612 | /* the caller presumably timed out so there is nothing we can do */ |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2613 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2614 | hddLog(VOS_TRACE_LEVEL_WARN, |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2615 | "%s: Invalid context, magic [%08x]", |
| 2616 | __func__, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2617 | |
| 2618 | if (ioctl_debug) |
| 2619 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2620 | pr_info("%s: Invalid context, magic [%08x]\n", |
| 2621 | __func__, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2622 | } |
| 2623 | return; |
| 2624 | } |
| 2625 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2626 | /* context is valid so caller is still waiting */ |
| 2627 | |
| 2628 | /* paranoia: invalidate the magic */ |
| 2629 | pStatsContext->magic = 0; |
| 2630 | |
| 2631 | /* notify the caller */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2632 | complete(&pStatsContext->completion); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2633 | |
| 2634 | /* serialization is complete */ |
| 2635 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2636 | } |
| 2637 | |
| 2638 | /* Callback function for tx per hit */ |
| 2639 | void hdd_tx_per_hit_cb (void *pCallbackContext) |
| 2640 | { |
| 2641 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pCallbackContext; |
| 2642 | unsigned char tx_fail[16]; |
| 2643 | union iwreq_data wrqu; |
| 2644 | |
Kaushik, Sushant | c78ee81 | 2014-08-01 12:21:19 +0530 | [diff] [blame] | 2645 | if (NULL == pAdapter || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2646 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2647 | hddLog(LOGE, "hdd_tx_per_hit_cb: pAdapter is NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2648 | return; |
| 2649 | } |
| 2650 | memset(&wrqu, 0, sizeof(wrqu)); |
| 2651 | wrqu.data.length = strlcpy(tx_fail, "TX_FAIL", sizeof(tx_fail)); |
| 2652 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, tx_fail); |
| 2653 | } |
| 2654 | |
| 2655 | void hdd_GetClassA_statisticsCB(void *pStats, void *pContext) |
| 2656 | { |
| 2657 | struct statsContext *pStatsContext; |
| 2658 | tCsrGlobalClassAStatsInfo *pClassAStats; |
| 2659 | hdd_adapter_t *pAdapter; |
| 2660 | |
| 2661 | if (ioctl_debug) |
| 2662 | { |
| 2663 | pr_info("%s: pStats [%p] pContext [%p]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2664 | __func__, pStats, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2665 | } |
| 2666 | |
| 2667 | if ((NULL == pStats) || (NULL == pContext)) |
| 2668 | { |
| 2669 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2670 | "%s: Bad param, pStats [%p] pContext [%p]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2671 | __func__, pStats, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2672 | return; |
| 2673 | } |
| 2674 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2675 | pClassAStats = pStats; |
| 2676 | pStatsContext = pContext; |
| 2677 | pAdapter = pStatsContext->pAdapter; |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2678 | |
| 2679 | /* there is a race condition that exists between this callback |
| 2680 | function and the caller since the caller could time out either |
| 2681 | before or while this code is executing. we use a spinlock to |
| 2682 | serialize these actions */ |
| 2683 | spin_lock(&hdd_context_lock); |
| 2684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2685 | if ((NULL == pAdapter) || (STATS_CONTEXT_MAGIC != pStatsContext->magic)) |
| 2686 | { |
| 2687 | /* the caller presumably timed out so there is nothing we can do */ |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2688 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2689 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 2690 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2691 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2692 | if (ioctl_debug) |
| 2693 | { |
| 2694 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2695 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2696 | } |
| 2697 | return; |
| 2698 | } |
| 2699 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2700 | /* context is valid so caller is still waiting */ |
| 2701 | |
| 2702 | /* paranoia: invalidate the magic */ |
| 2703 | pStatsContext->magic = 0; |
| 2704 | |
| 2705 | /* copy over the stats. do so as a struct copy */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2706 | pAdapter->hdd_stats.ClassA_stat = *pClassAStats; |
| 2707 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2708 | /* notify the caller */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2709 | complete(&pStatsContext->completion); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2710 | |
| 2711 | /* serialization is complete */ |
| 2712 | spin_unlock(&hdd_context_lock); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2713 | } |
| 2714 | |
| 2715 | VOS_STATUS wlan_hdd_get_classAstats(hdd_adapter_t *pAdapter) |
| 2716 | { |
| 2717 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2718 | eHalStatus hstatus; |
| 2719 | long lrc; |
| 2720 | struct statsContext context; |
| 2721 | |
| 2722 | if (NULL == pAdapter) |
| 2723 | { |
| 2724 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__); |
| 2725 | return VOS_STATUS_E_FAULT; |
| 2726 | } |
| 2727 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 2728 | { |
| 2729 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 2730 | return VOS_STATUS_SUCCESS; |
| 2731 | } |
| 2732 | |
| 2733 | /* we are connected |
| 2734 | prepare our callback context */ |
| 2735 | init_completion(&context.completion); |
| 2736 | context.pAdapter = pAdapter; |
| 2737 | context.magic = STATS_CONTEXT_MAGIC; |
| 2738 | /* query only for Class A statistics (which include link speed) */ |
| 2739 | hstatus = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2740 | eCSR_HDD, |
| 2741 | SME_GLOBAL_CLASSA_STATS, |
| 2742 | hdd_GetClassA_statisticsCB, |
| 2743 | 0, // not periodic |
| 2744 | FALSE, //non-cached results |
| 2745 | pHddStaCtx->conn_info.staId[0], |
| 2746 | &context); |
| 2747 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 2748 | { |
| 2749 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2750 | "%s: Unable to retrieve Class A statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2751 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2752 | /* we'll returned a cached value below */ |
| 2753 | } |
| 2754 | else |
| 2755 | { |
| 2756 | /* request was sent -- wait for the response */ |
| 2757 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 2758 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2759 | if (lrc <= 0) |
| 2760 | { |
| 2761 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2762 | "%s: SME %s while retrieving Class A statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2763 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2764 | } |
| 2765 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2766 | |
| 2767 | /* either we never sent a request, we sent a request and received a |
| 2768 | response or we sent a request and timed out. if we never sent a |
| 2769 | request or if we sent a request and got a response, we want to |
| 2770 | clear the magic out of paranoia. if we timed out there is a |
| 2771 | race condition such that the callback function could be |
| 2772 | executing at the same time we are. of primary concern is if the |
| 2773 | callback function had already verified the "magic" but had not |
| 2774 | yet set the completion variable when a timeout occurred. we |
| 2775 | serialize these activities by invalidating the magic while |
| 2776 | holding a shared spinlock which will cause us to block if the |
| 2777 | callback is currently executing */ |
| 2778 | spin_lock(&hdd_context_lock); |
| 2779 | context.magic = 0; |
| 2780 | spin_unlock(&hdd_context_lock); |
| 2781 | |
| 2782 | /* either callback updated pAdapter stats or it has cached data */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2783 | return VOS_STATUS_SUCCESS; |
| 2784 | } |
| 2785 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2786 | static void hdd_get_station_statisticsCB(void *pStats, void *pContext) |
| 2787 | { |
| 2788 | struct statsContext *pStatsContext; |
| 2789 | tCsrSummaryStatsInfo *pSummaryStats; |
| 2790 | tCsrGlobalClassAStatsInfo *pClassAStats; |
| 2791 | hdd_adapter_t *pAdapter; |
| 2792 | |
| 2793 | if (ioctl_debug) |
| 2794 | { |
| 2795 | pr_info("%s: pStats [%p] pContext [%p]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2796 | __func__, pStats, pContext); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2797 | } |
| 2798 | |
| 2799 | if ((NULL == pStats) || (NULL == pContext)) |
| 2800 | { |
| 2801 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2802 | "%s: Bad param, pStats [%p] pContext [%p]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2803 | __func__, pStats, pContext); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2804 | return; |
| 2805 | } |
| 2806 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2807 | /* there is a race condition that exists between this callback |
| 2808 | function and the caller since the caller could time out either |
| 2809 | before or while this code is executing. we use a spinlock to |
| 2810 | serialize these actions */ |
| 2811 | spin_lock(&hdd_context_lock); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2812 | |
| 2813 | pSummaryStats = (tCsrSummaryStatsInfo *)pStats; |
| 2814 | pClassAStats = (tCsrGlobalClassAStatsInfo *)( pSummaryStats + 1 ); |
| 2815 | pStatsContext = pContext; |
| 2816 | pAdapter = pStatsContext->pAdapter; |
| 2817 | if ((NULL == pAdapter) || (STATS_CONTEXT_MAGIC != pStatsContext->magic)) |
| 2818 | { |
| 2819 | /* the caller presumably timed out so there is nothing we can do */ |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2820 | spin_unlock(&hdd_context_lock); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2821 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 2822 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2823 | __func__, pAdapter, pStatsContext->magic); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2824 | if (ioctl_debug) |
| 2825 | { |
| 2826 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2827 | __func__, pAdapter, pStatsContext->magic); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2828 | } |
| 2829 | return; |
| 2830 | } |
| 2831 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2832 | /* context is valid so caller is still waiting */ |
| 2833 | |
| 2834 | /* paranoia: invalidate the magic */ |
| 2835 | pStatsContext->magic = 0; |
| 2836 | |
| 2837 | /* copy over the stats. do so as a struct copy */ |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2838 | pAdapter->hdd_stats.summary_stat = *pSummaryStats; |
| 2839 | pAdapter->hdd_stats.ClassA_stat = *pClassAStats; |
| 2840 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2841 | /* notify the caller */ |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2842 | complete(&pStatsContext->completion); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2843 | |
| 2844 | /* serialization is complete */ |
| 2845 | spin_unlock(&hdd_context_lock); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2846 | } |
| 2847 | |
| 2848 | VOS_STATUS wlan_hdd_get_station_stats(hdd_adapter_t *pAdapter) |
| 2849 | { |
| 2850 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2851 | eHalStatus hstatus; |
| 2852 | long lrc; |
| 2853 | struct statsContext context; |
| 2854 | |
| 2855 | if (NULL == pAdapter) |
| 2856 | { |
| 2857 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__); |
| 2858 | return VOS_STATUS_SUCCESS; |
| 2859 | } |
| 2860 | |
| 2861 | /* we are connected |
| 2862 | prepare our callback context */ |
| 2863 | init_completion(&context.completion); |
| 2864 | context.pAdapter = pAdapter; |
| 2865 | context.magic = STATS_CONTEXT_MAGIC; |
| 2866 | |
| 2867 | /* query only for Summary & Class A statistics */ |
| 2868 | hstatus = sme_GetStatistics(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2869 | eCSR_HDD, |
| 2870 | SME_SUMMARY_STATS | |
| 2871 | SME_GLOBAL_CLASSA_STATS, |
| 2872 | hdd_get_station_statisticsCB, |
| 2873 | 0, // not periodic |
| 2874 | FALSE, //non-cached results |
| 2875 | pHddStaCtx->conn_info.staId[0], |
| 2876 | &context); |
| 2877 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 2878 | { |
| 2879 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2880 | "%s: Unable to retrieve statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2881 | __func__); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2882 | /* we'll return with cached values */ |
| 2883 | } |
| 2884 | else |
| 2885 | { |
| 2886 | /* request was sent -- wait for the response */ |
| 2887 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 2888 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2889 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2890 | if (lrc <= 0) |
| 2891 | { |
| 2892 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2893 | "%s: SME %s while retrieving statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2894 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2895 | } |
| 2896 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 2897 | |
| 2898 | /* either we never sent a request, we sent a request and received a |
| 2899 | response or we sent a request and timed out. if we never sent a |
| 2900 | request or if we sent a request and got a response, we want to |
| 2901 | clear the magic out of paranoia. if we timed out there is a |
| 2902 | race condition such that the callback function could be |
| 2903 | executing at the same time we are. of primary concern is if the |
| 2904 | callback function had already verified the "magic" but had not |
| 2905 | yet set the completion variable when a timeout occurred. we |
| 2906 | serialize these activities by invalidating the magic while |
| 2907 | holding a shared spinlock which will cause us to block if the |
| 2908 | callback is currently executing */ |
| 2909 | spin_lock(&hdd_context_lock); |
| 2910 | context.magic = 0; |
| 2911 | spin_unlock(&hdd_context_lock); |
| 2912 | |
| 2913 | /* either callback updated pAdapter stats or it has cached data */ |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2914 | return VOS_STATUS_SUCCESS; |
| 2915 | } |
| 2916 | |
| 2917 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2918 | /* |
| 2919 | * Support for the LINKSPEED private command |
| 2920 | * Per the WiFi framework the response must be of the form |
| 2921 | * "LinkSpeed xx" |
| 2922 | */ |
| 2923 | static int iw_get_linkspeed(struct net_device *dev, |
| 2924 | struct iw_request_info *info, |
| 2925 | union iwreq_data *wrqu, char *extra) |
| 2926 | { |
| 2927 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 2928 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2929 | char *pLinkSpeed = (char*)extra; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 2930 | int len = sizeof(v_U32_t) + 1; |
| 2931 | v_U32_t link_speed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2932 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 2933 | VOS_STATUS status; |
| 2934 | int rc, valid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2935 | |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 2936 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2937 | |
| 2938 | valid = wlan_hdd_validate_context(pHddCtx); |
| 2939 | |
| 2940 | if (0 != valid) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 2941 | { |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 2942 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid")); |
| 2943 | return valid; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 2944 | } |
| 2945 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2946 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 2947 | { |
| 2948 | /* we are not connected so we don't have a classAstats */ |
| 2949 | link_speed = 0; |
| 2950 | } |
| 2951 | else |
| 2952 | { |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 2953 | status = wlan_hdd_get_classAstats(pAdapter); |
| 2954 | |
| 2955 | if (!VOS_IS_STATUS_SUCCESS(status )) |
| 2956 | { |
| 2957 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Unable to retrieve SME statistics")); |
| 2958 | return -EINVAL; |
| 2959 | } |
| 2960 | |
| 2961 | /* Unit of link capacity is obtained from the TL API is MbpsX10 */ |
| 2962 | WLANTL_GetSTALinkCapacity(WLAN_HDD_GET_CTX(pAdapter)->pvosContext, |
| 2963 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], |
| 2964 | &link_speed); |
| 2965 | |
| 2966 | link_speed = link_speed / 10; |
| 2967 | |
| 2968 | if (0 == link_speed) |
| 2969 | { |
| 2970 | /* The linkspeed returned by HAL is in units of 500kbps. |
| 2971 | * converting it to mbps. |
| 2972 | * This is required to support legacy firmware which does |
| 2973 | * not return link capacity. |
| 2974 | */ |
| 2975 | link_speed = pAdapter->hdd_stats.ClassA_stat.tx_rate/2; |
| 2976 | } |
| 2977 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2978 | } |
| 2979 | |
| 2980 | wrqu->data.length = len; |
| 2981 | // return the linkspeed in the format required by the WiFi Framework |
Jeff Johnson | 0279779 | 2013-10-26 19:17:13 -0700 | [diff] [blame] | 2982 | rc = snprintf(pLinkSpeed, len, "%u", link_speed); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2983 | if ((rc < 0) || (rc >= len)) |
| 2984 | { |
| 2985 | // encoding or length error? |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 2986 | hddLog(VOS_TRACE_LEVEL_ERROR,FL("Unable to encode link speed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2987 | return -EIO; |
| 2988 | } |
| 2989 | |
| 2990 | /* a value is being successfully returned */ |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2991 | return rc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2992 | } |
| 2993 | |
Arif Hussain | 695279c | 2014-03-24 14:06:07 -0700 | [diff] [blame] | 2994 | /* |
| 2995 | * Helper function to return correct value for WLAN_GET_LINK_SPEED |
| 2996 | * |
| 2997 | */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 2998 | static int __iw_get_linkspeed_priv(struct net_device *dev, |
Arif Hussain | 695279c | 2014-03-24 14:06:07 -0700 | [diff] [blame] | 2999 | struct iw_request_info *info, |
| 3000 | union iwreq_data *wrqu, char *extra) |
| 3001 | { |
| 3002 | int rc; |
| 3003 | |
| 3004 | rc = iw_get_linkspeed(dev, info, wrqu, extra); |
| 3005 | |
| 3006 | if (rc < 0) |
| 3007 | return rc; |
| 3008 | |
| 3009 | /* a value is being successfully returned */ |
| 3010 | return 0; |
| 3011 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3012 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 3013 | static int iw_get_linkspeed_priv(struct net_device *dev, |
| 3014 | struct iw_request_info *info, |
| 3015 | union iwreq_data *wrqu, char *extra) |
| 3016 | { |
| 3017 | int ret; |
| 3018 | |
| 3019 | vos_ssr_protect(__func__); |
| 3020 | ret = __iw_get_linkspeed_priv(dev, info, wrqu, extra); |
| 3021 | vos_ssr_unprotect(__func__); |
| 3022 | |
| 3023 | return ret; |
| 3024 | } |
| 3025 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3026 | /* |
| 3027 | * Support for the RSSI & RSSI-APPROX private commands |
| 3028 | * Per the WiFi framework the response must be of the form |
| 3029 | * "<ssid> rssi <xx>" |
| 3030 | * unless we are not associated, in which case the response is |
| 3031 | * "OK" |
| 3032 | */ |
| 3033 | static int iw_get_rssi(struct net_device *dev, |
| 3034 | struct iw_request_info *info, |
| 3035 | union iwreq_data *wrqu, char *extra) |
| 3036 | { |
| 3037 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 3038 | char *cmd = extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3039 | int len = wrqu->data.length; |
| 3040 | v_S7_t s7Rssi = 0; |
| 3041 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3042 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
| 3043 | VOS_STATUS vosStatus; |
| 3044 | int rc; |
| 3045 | |
| 3046 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 3047 | (0 == ssidlen) || (ssidlen >= len)) |
| 3048 | { |
| 3049 | /* we are not connected or our SSID is too long |
| 3050 | so we cannot report an rssi */ |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 3051 | rc = scnprintf(cmd, len, "OK"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3052 | } |
| 3053 | else |
| 3054 | { |
| 3055 | /* we are connected with a valid SSID |
| 3056 | so we can write the SSID into the return buffer |
| 3057 | (note that it is not NUL-terminated) */ |
| 3058 | memcpy(cmd, pHddStaCtx->conn_info.SSID.SSID.ssId, ssidlen ); |
| 3059 | |
| 3060 | vosStatus = wlan_hdd_get_rssi(pAdapter, &s7Rssi); |
| 3061 | |
| 3062 | if (VOS_STATUS_SUCCESS == vosStatus) |
| 3063 | { |
| 3064 | /* append the rssi to the ssid in the format required by |
| 3065 | the WiFI Framework */ |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 3066 | rc = scnprintf(&cmd[ssidlen], len - ssidlen, " rssi %d", s7Rssi); |
c_hpothu | 72afb28 | 2014-02-17 12:55:36 +0530 | [diff] [blame] | 3067 | rc += ssidlen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3068 | } |
| 3069 | else |
| 3070 | { |
| 3071 | rc = -1; |
| 3072 | } |
| 3073 | } |
| 3074 | |
| 3075 | /* verify that we wrote a valid response */ |
| 3076 | if ((rc < 0) || (rc >= len)) |
| 3077 | { |
| 3078 | // encoding or length error? |
| 3079 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3080 | "%s: Unable to encode RSSI, got [%s]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3081 | __func__, cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3082 | return -EIO; |
| 3083 | } |
| 3084 | |
| 3085 | /* a value is being successfully returned */ |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3086 | return rc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3087 | } |
| 3088 | |
| 3089 | /* |
| 3090 | * Support for SoftAP channel range private command |
| 3091 | */ |
| 3092 | static int iw_softap_set_channel_range( struct net_device *dev, |
| 3093 | int startChannel, |
| 3094 | int endChannel, |
| 3095 | int band) |
| 3096 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3097 | VOS_STATUS status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3098 | int ret = 0; |
| 3099 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3100 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 3101 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3102 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3103 | |
| 3104 | status = WLANSAP_SetChannelRange(hHal, startChannel, endChannel, band); |
| 3105 | if (VOS_STATUS_SUCCESS != status) |
| 3106 | { |
| 3107 | ret = -EINVAL; |
| 3108 | } |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 3109 | pHddCtx->is_dynamic_channel_range_set = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3110 | return ret; |
| 3111 | } |
| 3112 | |
| 3113 | VOS_STATUS wlan_hdd_enter_bmps(hdd_adapter_t *pAdapter, int mode) |
| 3114 | { |
| 3115 | struct statsContext context; |
| 3116 | eHalStatus status; |
| 3117 | hdd_context_t *pHddCtx; |
| 3118 | |
| 3119 | if (NULL == pAdapter) |
| 3120 | { |
| 3121 | hddLog(VOS_TRACE_LEVEL_FATAL, "Adapter NULL"); |
| 3122 | return VOS_STATUS_E_FAULT; |
| 3123 | } |
| 3124 | |
| 3125 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "power mode=%d", mode); |
| 3126 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 6cd329b | 2014-03-19 20:39:13 +0530 | [diff] [blame] | 3127 | if (pHddCtx->isLogpInProgress) { |
| 3128 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3129 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3130 | return VOS_STATUS_E_FAILURE; |
| 3131 | } |
| 3132 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3133 | init_completion(&context.completion); |
| 3134 | |
| 3135 | context.pAdapter = pAdapter; |
| 3136 | context.magic = POWER_CONTEXT_MAGIC; |
| 3137 | |
| 3138 | if (DRIVER_POWER_MODE_ACTIVE == mode) |
| 3139 | { |
| 3140 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering " |
| 3141 | "Full Power", __func__); |
| 3142 | status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3143 | iw_power_callback_fn, &context, |
| 3144 | eSME_FULL_PWR_NEEDED_BY_HDD); |
| 3145 | // Enter Full power command received from GUI this means we are disconnected |
| 3146 | // Set PMC remainInPowerActiveTillDHCP flag to disable auto BMPS entry by PMC |
| 3147 | sme_SetDHCPTillPowerActiveFlag(pHddCtx->hHal, TRUE); |
| 3148 | if (eHAL_STATUS_PMC_PENDING == status) |
| 3149 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3150 | /* request was sent -- wait for the response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3151 | int lrc = wait_for_completion_interruptible_timeout( |
| 3152 | &context.completion, |
| 3153 | msecs_to_jiffies(WLAN_WAIT_TIME_POWER)); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3154 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3155 | if (lrc <= 0) |
| 3156 | { |
| 3157 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while requesting fullpower ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3158 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3159 | } |
| 3160 | } |
| 3161 | } |
| 3162 | else if (DRIVER_POWER_MODE_AUTO == mode) |
| 3163 | { |
| 3164 | if (pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 3165 | { |
| 3166 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering Bmps ", |
| 3167 | __func__); |
| 3168 | // Enter BMPS command received from GUI this means DHCP is completed |
| 3169 | // Clear PMC remainInPowerActiveTillDHCP flag to enable auto BMPS entry |
| 3170 | sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3171 | FALSE); |
| 3172 | status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3173 | iw_power_callback_fn, &context); |
| 3174 | if (eHAL_STATUS_PMC_PENDING == status) |
| 3175 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3176 | /* request was sent -- wait for the response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3177 | int lrc = wait_for_completion_interruptible_timeout( |
| 3178 | &context.completion, |
| 3179 | msecs_to_jiffies(WLAN_WAIT_TIME_POWER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3180 | if (lrc <= 0) |
| 3181 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3182 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3183 | "%s: SME %s while requesting BMPS", |
| 3184 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3185 | } |
| 3186 | } |
| 3187 | } |
| 3188 | else |
| 3189 | { |
| 3190 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "BMPS is not " |
| 3191 | "enabled in the cfg"); |
| 3192 | } |
| 3193 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3194 | |
| 3195 | /* either we never sent a request, we sent a request and received a |
| 3196 | response or we sent a request and timed out. if we never sent a |
| 3197 | request or if we sent a request and got a response, we want to |
| 3198 | clear the magic out of paranoia. if we timed out there is a |
| 3199 | race condition such that the callback function could be |
| 3200 | executing at the same time we are. of primary concern is if the |
| 3201 | callback function had already verified the "magic" but had not |
| 3202 | yet set the completion variable when a timeout occurred. we |
| 3203 | serialize these activities by invalidating the magic while |
| 3204 | holding a shared spinlock which will cause us to block if the |
| 3205 | callback is currently executing */ |
| 3206 | spin_lock(&hdd_context_lock); |
| 3207 | context.magic = 0; |
| 3208 | spin_unlock(&hdd_context_lock); |
| 3209 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3210 | return VOS_STATUS_SUCCESS; |
| 3211 | } |
| 3212 | |
| 3213 | VOS_STATUS wlan_hdd_exit_lowpower(hdd_context_t *pHddCtx, |
| 3214 | hdd_adapter_t *pAdapter) |
| 3215 | { |
| 3216 | VOS_STATUS vos_Status; |
| 3217 | |
| 3218 | if ((NULL == pAdapter) || (NULL == pHddCtx)) |
| 3219 | { |
| 3220 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid pointer"); |
| 3221 | return VOS_STATUS_E_FAULT; |
| 3222 | } |
| 3223 | |
| 3224 | /**Exit from Deep sleep or standby if we get the driver |
| 3225 | START cmd from android GUI |
| 3226 | */ |
| 3227 | if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop) |
| 3228 | { |
| 3229 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit " |
| 3230 | "from Stand by",__func__); |
| 3231 | vos_Status = hdd_exit_standby(pHddCtx); |
| 3232 | } |
| 3233 | else if (eHDD_SUSPEND_DEEP_SLEEP == pHddCtx->hdd_ps_state) |
| 3234 | { |
| 3235 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit " |
| 3236 | "from deep sleep",__func__); |
| 3237 | vos_Status = hdd_exit_deep_sleep(pHddCtx, pAdapter); |
| 3238 | } |
| 3239 | else |
| 3240 | { |
| 3241 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Not in standby or deep sleep. " |
| 3242 | "Ignore start cmd %d", __func__, pHddCtx->hdd_ps_state); |
| 3243 | vos_Status = VOS_STATUS_SUCCESS; |
| 3244 | } |
| 3245 | |
| 3246 | return vos_Status; |
| 3247 | } |
| 3248 | |
| 3249 | VOS_STATUS wlan_hdd_enter_lowpower(hdd_context_t *pHddCtx) |
| 3250 | { |
| 3251 | VOS_STATUS vos_Status = VOS_STATUS_E_FAILURE; |
| 3252 | |
| 3253 | if (NULL == pHddCtx) |
| 3254 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 3255 | hddLog(VOS_TRACE_LEVEL_ERROR, "HDD context NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3256 | return VOS_STATUS_E_FAULT; |
| 3257 | } |
| 3258 | |
| 3259 | if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop) |
| 3260 | { |
| 3261 | //Execute standby procedure. |
| 3262 | //Executing standby procedure will cause the STA to |
| 3263 | //disassociate first and then the chip will be put into standby. |
| 3264 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering Stand by mode"); |
| 3265 | vos_Status = hdd_enter_standby(pHddCtx); |
| 3266 | } |
| 3267 | else if (WLAN_MAP_DRIVER_STOP_TO_DEEP_SLEEP == |
| 3268 | pHddCtx->cfg_ini->nEnableDriverStop) |
| 3269 | { |
| 3270 | //Execute deep sleep procedure |
| 3271 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3272 | "deep sleep mode"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3273 | //Deep sleep not supported |
| 3274 | vos_Status = hdd_enter_standby(pHddCtx); |
| 3275 | } |
| 3276 | else |
| 3277 | { |
| 3278 | hddLog(VOS_TRACE_LEVEL_INFO_LOW, "%s: Driver stop is not enabled %d", |
| 3279 | __func__, pHddCtx->cfg_ini->nEnableDriverStop); |
| 3280 | vos_Status = VOS_STATUS_SUCCESS; |
| 3281 | } |
| 3282 | |
| 3283 | return vos_Status; |
| 3284 | } |
| 3285 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3286 | |
| 3287 | void* wlan_hdd_change_country_code_callback(void *pAdapter) |
| 3288 | { |
| 3289 | |
| 3290 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3291 | complete(&call_back_pAdapter->change_country_code); |
| 3292 | |
| 3293 | return NULL; |
| 3294 | } |
| 3295 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 3296 | static int __iw_set_priv(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3297 | struct iw_request_info *info, |
| 3298 | union iwreq_data *wrqu, char *extra) |
| 3299 | { |
| 3300 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3301 | char *cmd = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3302 | int cmd_len = wrqu->data.length; |
| 3303 | int ret = 0; |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3304 | int rc = 0; |
| 3305 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 3306 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3307 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3308 | |
| 3309 | ENTER(); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3310 | cmd = mem_alloc_copy_from_user_helper(wrqu->data.pointer, |
| 3311 | wrqu->data.length); |
| 3312 | if (NULL == cmd) |
| 3313 | { |
| 3314 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3315 | "mem_alloc_copy_from_user_helper fail"); |
| 3316 | return -ENOMEM; |
| 3317 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3318 | |
| 3319 | if (ioctl_debug) |
| 3320 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3321 | pr_info("%s: req [%s] len [%d]\n", __func__, cmd, cmd_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3322 | } |
| 3323 | |
Madan Mohan Koyyalamudi | f9bdd4e | 2012-10-30 18:05:03 -0700 | [diff] [blame] | 3324 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 3325 | "%s: ***Received %s cmd from Wi-Fi GUI***", __func__, cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3326 | |
| 3327 | if (pHddCtx->isLogpInProgress) { |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3328 | if (ioctl_debug) |
| 3329 | { |
| 3330 | pr_info("%s: RESTART in progress\n", __func__); |
| 3331 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3332 | |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3333 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3334 | "%s:LOGP in Progress. Ignore!!!",__func__); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3335 | kfree(cmd); |
| 3336 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3337 | } |
| 3338 | |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3339 | if (strncmp(cmd, "CSCAN", 5) == 0 ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3340 | { |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3341 | if (eHAL_STATUS_SUCCESS != iw_set_cscan(dev, info, wrqu, cmd)) { |
| 3342 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3343 | "%s: Error in iw_set_scan!", __func__); |
| 3344 | rc = -EINVAL; |
| 3345 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3346 | } |
| 3347 | else if( strcasecmp(cmd, "start") == 0 ) { |
| 3348 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3349 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Start command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3350 | /*Exit from Deep sleep or standby if we get the driver START cmd from android GUI*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3351 | |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3352 | vos_status = wlan_hdd_exit_lowpower(pHddCtx, pAdapter); |
| 3353 | if (vos_status == VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3354 | { |
| 3355 | union iwreq_data wrqu; |
| 3356 | char buf[10]; |
| 3357 | |
| 3358 | memset(&wrqu, 0, sizeof(wrqu)); |
| 3359 | wrqu.data.length = strlcpy(buf, "START", sizeof(buf)); |
| 3360 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 3361 | } |
| 3362 | else |
| 3363 | { |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3364 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: START CMD Status %d", __func__, vos_status); |
| 3365 | rc = -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3366 | } |
| 3367 | goto done; |
| 3368 | } |
| 3369 | else if( strcasecmp(cmd, "stop") == 0 ) |
| 3370 | { |
| 3371 | union iwreq_data wrqu; |
| 3372 | char buf[10]; |
| 3373 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3374 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Stop command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3375 | |
| 3376 | wlan_hdd_enter_lowpower(pHddCtx); |
| 3377 | memset(&wrqu, 0, sizeof(wrqu)); |
| 3378 | wrqu.data.length = strlcpy(buf, "STOP", sizeof(buf)); |
| 3379 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3380 | goto done; |
| 3381 | } |
| 3382 | else if (strcasecmp(cmd, "macaddr") == 0) |
| 3383 | { |
| 3384 | ret = snprintf(cmd, cmd_len, "Macaddr = " MAC_ADDRESS_STR, |
| 3385 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes)); |
| 3386 | } |
| 3387 | else if (strcasecmp(cmd, "scan-active") == 0) |
| 3388 | { |
c_hpothu | dbefd3e | 2014-04-28 15:59:47 +0530 | [diff] [blame] | 3389 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3390 | FL("making default scan to active")); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 3391 | pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3392 | ret = snprintf(cmd, cmd_len, "OK"); |
| 3393 | } |
| 3394 | else if (strcasecmp(cmd, "scan-passive") == 0) |
| 3395 | { |
c_hpothu | dbefd3e | 2014-04-28 15:59:47 +0530 | [diff] [blame] | 3396 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3397 | FL("making default scan to passive")); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 3398 | pHddCtx->scan_info.scan_mode = eSIR_PASSIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3399 | ret = snprintf(cmd, cmd_len, "OK"); |
| 3400 | } |
| 3401 | else if( strcasecmp(cmd, "scan-mode") == 0 ) |
| 3402 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 3403 | ret = snprintf(cmd, cmd_len, "ScanMode = %u", pHddCtx->scan_info.scan_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3404 | } |
| 3405 | else if( strcasecmp(cmd, "linkspeed") == 0 ) |
| 3406 | { |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3407 | ret = iw_get_linkspeed(dev, info, wrqu, cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3408 | } |
| 3409 | else if( strncasecmp(cmd, "COUNTRY", 7) == 0 ) { |
| 3410 | char *country_code; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3411 | long lrc; |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3412 | eHalStatus eHal_status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3413 | |
| 3414 | country_code = cmd + 8; |
| 3415 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3416 | init_completion(&pAdapter->change_country_code); |
| 3417 | |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3418 | eHal_status = sme_ChangeCountryCode(pHddCtx->hHal, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3419 | (void *)(tSmeChangeCountryCallback)wlan_hdd_change_country_code_callback, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3420 | country_code, |
| 3421 | pAdapter, |
Gopichand Nakkala | acd9411 | 2013-05-29 21:37:47 +0530 | [diff] [blame] | 3422 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 3423 | eSIR_TRUE, |
Gopichand Nakkala | acd9411 | 2013-05-29 21:37:47 +0530 | [diff] [blame] | 3424 | eSIR_TRUE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3425 | |
| 3426 | /* Wait for completion */ |
| 3427 | lrc = wait_for_completion_interruptible_timeout(&pAdapter->change_country_code, |
| 3428 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 3429 | |
| 3430 | if (lrc <= 0) |
| 3431 | { |
| 3432 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while setting country code ", |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3433 | __func__, "Timed out"); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3434 | } |
| 3435 | |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3436 | if (eHAL_STATUS_SUCCESS != eHal_status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3437 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3438 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3439 | "%s: SME Change Country code fail", __func__); |
| 3440 | kfree(cmd); |
| 3441 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3442 | } |
| 3443 | } |
| 3444 | else if( strncasecmp(cmd, "rssi", 4) == 0 ) |
| 3445 | { |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3446 | ret = iw_get_rssi(dev, info, wrqu, cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3447 | } |
| 3448 | else if( strncasecmp(cmd, "powermode", 9) == 0 ) { |
| 3449 | int mode; |
Wilson Yang | 1be3e65 | 2013-10-09 15:18:31 -0700 | [diff] [blame] | 3450 | char *ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3451 | |
Wilson Yang | 1be3e65 | 2013-10-09 15:18:31 -0700 | [diff] [blame] | 3452 | if (9 < cmd_len) |
| 3453 | { |
| 3454 | ptr = (char*)(cmd + 9); |
| 3455 | |
| 3456 | }else{ |
| 3457 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3458 | "CMD LENGTH %d is not correct",cmd_len); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3459 | kfree(cmd); |
| 3460 | return -EINVAL; |
Wilson Yang | 1be3e65 | 2013-10-09 15:18:31 -0700 | [diff] [blame] | 3461 | } |
| 3462 | |
| 3463 | if (1 != sscanf(ptr,"%d",&mode)) |
| 3464 | { |
| 3465 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3466 | "powermode input %s is not correct",ptr); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3467 | kfree(cmd); |
| 3468 | return -EIO; |
Wilson Yang | 1be3e65 | 2013-10-09 15:18:31 -0700 | [diff] [blame] | 3469 | } |
| 3470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3471 | wlan_hdd_enter_bmps(pAdapter, mode); |
| 3472 | /*TODO:Set the power mode*/ |
| 3473 | } |
| 3474 | else if (strncasecmp(cmd, "getpower", 8) == 0 ) { |
| 3475 | v_U32_t pmc_state; |
| 3476 | v_U16_t value; |
| 3477 | |
| 3478 | pmc_state = pmcGetPmcState(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
| 3479 | if(pmc_state == BMPS) { |
| 3480 | value = DRIVER_POWER_MODE_AUTO; |
| 3481 | } |
| 3482 | else { |
| 3483 | value = DRIVER_POWER_MODE_ACTIVE; |
| 3484 | } |
| 3485 | ret = snprintf(cmd, cmd_len, "powermode = %u", value); |
| 3486 | } |
| 3487 | else if( strncasecmp(cmd, "btcoexmode", 10) == 0 ) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3488 | hddLog( VOS_TRACE_LEVEL_INFO, "btcoexmode"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3489 | /*TODO: set the btcoexmode*/ |
| 3490 | } |
| 3491 | else if( strcasecmp(cmd, "btcoexstat") == 0 ) { |
| 3492 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3493 | hddLog(VOS_TRACE_LEVEL_INFO, "BtCoex Status"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3494 | /*TODO: Return the btcoex status*/ |
| 3495 | } |
| 3496 | else if( strcasecmp(cmd, "rxfilter-start") == 0 ) { |
| 3497 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3498 | hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Start command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3499 | |
| 3500 | /*TODO: Enable Rx data Filter*/ |
| 3501 | } |
| 3502 | else if( strcasecmp(cmd, "rxfilter-stop") == 0 ) { |
| 3503 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3504 | hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Stop command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3505 | |
| 3506 | /*TODO: Disable Rx data Filter*/ |
| 3507 | } |
| 3508 | else if( strcasecmp(cmd, "rxfilter-statistics") == 0 ) { |
| 3509 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3510 | hddLog( VOS_TRACE_LEVEL_INFO, "Rx Data Filter Statistics command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3511 | /*TODO: rxfilter-statistics*/ |
| 3512 | } |
| 3513 | else if( strncasecmp(cmd, "rxfilter-add", 12) == 0 ) { |
| 3514 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3515 | hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-add"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3516 | /*TODO: rxfilter-add*/ |
| 3517 | } |
| 3518 | else if( strncasecmp(cmd, "rxfilter-remove",15) == 0 ) { |
| 3519 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3520 | hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-remove"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3521 | /*TODO: rxfilter-remove*/ |
| 3522 | } |
| 3523 | #ifdef FEATURE_WLAN_SCAN_PNO |
Madan Mohan Koyyalamudi | 03978e1 | 2012-10-30 17:52:55 -0700 | [diff] [blame] | 3524 | else if( strncasecmp(cmd, "pnosetup", 8) == 0 ) { |
| 3525 | hddLog( VOS_TRACE_LEVEL_INFO, "pnosetup"); |
| 3526 | /*TODO: support pnosetup*/ |
| 3527 | } |
| 3528 | else if( strncasecmp(cmd, "pnoforce", 8) == 0 ) { |
| 3529 | hddLog( VOS_TRACE_LEVEL_INFO, "pnoforce"); |
| 3530 | /*TODO: support pnoforce*/ |
| 3531 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3532 | else if( strncasecmp(cmd, "pno",3) == 0 ) { |
| 3533 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3534 | hddLog( VOS_TRACE_LEVEL_INFO, "pno"); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3535 | vos_status = iw_set_pno(dev, info, wrqu, cmd, 3); |
| 3536 | kfree(cmd); |
| 3537 | return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3538 | } |
| 3539 | else if( strncasecmp(cmd, "rssifilter",10) == 0 ) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3540 | hddLog( VOS_TRACE_LEVEL_INFO, "rssifilter"); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3541 | vos_status = iw_set_rssi_filter(dev, info, wrqu, cmd, 10); |
| 3542 | kfree(cmd); |
| 3543 | return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3544 | } |
| 3545 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 3546 | else if( strncasecmp(cmd, "powerparams",11) == 0 ) { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3547 | hddLog( VOS_TRACE_LEVEL_INFO, "powerparams"); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3548 | vos_status = iw_set_power_params(dev, info, wrqu, cmd, 11); |
| 3549 | kfree(cmd); |
| 3550 | return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3551 | } |
| 3552 | else if( 0 == strncasecmp(cmd, "CONFIG-TX-TRACKING", 18) ) { |
| 3553 | tSirTxPerTrackingParam tTxPerTrackingParam; |
Wilson Yang | 1be3e65 | 2013-10-09 15:18:31 -0700 | [diff] [blame] | 3554 | char *ptr; |
| 3555 | |
| 3556 | if (18 < cmd_len) |
| 3557 | { |
| 3558 | ptr = (char*)(cmd + 18); |
| 3559 | }else{ |
| 3560 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3561 | "CMD LENGTH %d is not correct",cmd_len); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3562 | kfree(cmd); |
| 3563 | return -EINVAL; |
Wilson Yang | 1be3e65 | 2013-10-09 15:18:31 -0700 | [diff] [blame] | 3564 | } |
| 3565 | |
Jeff Johnson | 0279779 | 2013-10-26 19:17:13 -0700 | [diff] [blame] | 3566 | if (4 != sscanf(ptr,"%hhu %hhu %hhu %u", |
Wilson Yang | 1be3e65 | 2013-10-09 15:18:31 -0700 | [diff] [blame] | 3567 | &(tTxPerTrackingParam.ucTxPerTrackingEnable), |
| 3568 | &(tTxPerTrackingParam.ucTxPerTrackingPeriod), |
| 3569 | &(tTxPerTrackingParam.ucTxPerTrackingRatio), |
| 3570 | &(tTxPerTrackingParam.uTxPerTrackingWatermark))) |
| 3571 | { |
| 3572 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3573 | "CONFIG-TX-TRACKING %s input is not correct",ptr); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3574 | kfree(cmd); |
| 3575 | return -EIO; |
Wilson Yang | 1be3e65 | 2013-10-09 15:18:31 -0700 | [diff] [blame] | 3576 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3577 | |
| 3578 | // parameters checking |
| 3579 | // period has to be larger than 0 |
| 3580 | if (0 == tTxPerTrackingParam.ucTxPerTrackingPeriod) |
| 3581 | { |
| 3582 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Period input is not correct"); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3583 | kfree(cmd); |
| 3584 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3585 | } |
| 3586 | |
| 3587 | // use default value 5 is the input is not reasonable. in unit of 10% |
| 3588 | if ((tTxPerTrackingParam.ucTxPerTrackingRatio > TX_PER_TRACKING_MAX_RATIO) || (0 == tTxPerTrackingParam.ucTxPerTrackingRatio)) |
| 3589 | { |
| 3590 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Ratio input is not good. use default 5"); |
| 3591 | tTxPerTrackingParam.ucTxPerTrackingRatio = TX_PER_TRACKING_DEFAULT_RATIO; |
| 3592 | } |
| 3593 | |
| 3594 | // default is 5 |
| 3595 | if (0 == tTxPerTrackingParam.uTxPerTrackingWatermark) |
| 3596 | { |
| 3597 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Tx Packet number input is not good. use default 5"); |
| 3598 | tTxPerTrackingParam.uTxPerTrackingWatermark = TX_PER_TRACKING_DEFAULT_WATERMARK; |
| 3599 | } |
| 3600 | |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3601 | if (eHAL_STATUS_SUCCESS != |
| 3602 | sme_SetTxPerTracking(pHddCtx->hHal, |
| 3603 | hdd_tx_per_hit_cb, |
| 3604 | (void*)pAdapter, &tTxPerTrackingParam)) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3605 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Set Tx PER Tracking Failed!"); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3606 | rc = -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3607 | } |
| 3608 | } |
| 3609 | else { |
Madan Mohan Koyyalamudi | f9bdd4e | 2012-10-30 18:05:03 -0700 | [diff] [blame] | 3610 | hddLog( VOS_TRACE_LEVEL_WARN, "%s: Unsupported GUI command %s", |
| 3611 | __func__, cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3612 | } |
| 3613 | done: |
| 3614 | /* many of the commands write information back into the command |
| 3615 | string using snprintf(). check the return value here in one |
| 3616 | place */ |
| 3617 | if ((ret < 0) || (ret >= cmd_len)) |
| 3618 | { |
| 3619 | /* there was an encoding error or overflow */ |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3620 | rc = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3621 | } |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 3622 | else if (ret > 0) |
| 3623 | { |
| 3624 | if (copy_to_user(wrqu->data.pointer, cmd, ret)) |
| 3625 | { |
| 3626 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3627 | "%s: failed to copy data to user buffer", __func__); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3628 | kfree(cmd); |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 3629 | return -EFAULT; |
| 3630 | } |
| 3631 | wrqu->data.length = ret; |
| 3632 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3633 | |
| 3634 | if (ioctl_debug) |
| 3635 | { |
| 3636 | pr_info("%s: rsp [%s] len [%d] status %d\n", |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3637 | __func__, cmd, wrqu->data.length, rc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3638 | } |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3639 | kfree(cmd); |
| 3640 | return rc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3641 | } |
| 3642 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 3643 | static int iw_set_priv(struct net_device *dev, |
| 3644 | struct iw_request_info *info, |
| 3645 | union iwreq_data *wrqu, char *extra) |
| 3646 | { |
| 3647 | int ret; |
| 3648 | vos_ssr_protect(__func__); |
| 3649 | ret = __iw_set_priv(dev, info, wrqu, extra); |
| 3650 | vos_ssr_unprotect(__func__); |
| 3651 | |
| 3652 | return ret; |
| 3653 | } |
| 3654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3655 | static int iw_set_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 | |
| 3663 | static int iw_get_nick(struct net_device *dev, |
| 3664 | struct iw_request_info *info, |
| 3665 | union iwreq_data *wrqu, char *extra) |
| 3666 | { |
| 3667 | ENTER(); |
| 3668 | return 0; |
| 3669 | } |
| 3670 | |
| 3671 | static struct iw_statistics *get_wireless_stats(struct net_device *dev) |
| 3672 | { |
| 3673 | ENTER(); |
| 3674 | return NULL; |
| 3675 | } |
| 3676 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 3677 | static int __iw_set_encode(struct net_device *dev, |
| 3678 | struct iw_request_info *info, |
| 3679 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3680 | |
| 3681 | { |
| 3682 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3683 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3684 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3685 | struct iw_point *encoderq = &(wrqu->encoding); |
| 3686 | v_U32_t keyId; |
| 3687 | v_U8_t key_length; |
| 3688 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 3689 | v_BOOL_t fKeyPresent = 0; |
| 3690 | int i; |
| 3691 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3692 | |
| 3693 | |
| 3694 | ENTER(); |
| 3695 | |
| 3696 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3697 | { |
| 3698 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3699 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 3700 | return 0; |
| 3701 | } |
| 3702 | |
| 3703 | |
| 3704 | keyId = encoderq->flags & IW_ENCODE_INDEX; |
| 3705 | |
| 3706 | if(keyId) |
| 3707 | { |
| 3708 | if(keyId > MAX_WEP_KEYS) |
| 3709 | { |
| 3710 | return -EINVAL; |
| 3711 | } |
| 3712 | |
| 3713 | fKeyPresent = 1; |
| 3714 | keyId--; |
| 3715 | } |
| 3716 | else |
| 3717 | { |
| 3718 | fKeyPresent = 0; |
| 3719 | } |
| 3720 | |
| 3721 | |
| 3722 | if(wrqu->data.flags & IW_ENCODE_DISABLED) |
| 3723 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3724 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****iwconfig wlan0 key off*****"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3725 | if(!fKeyPresent) { |
| 3726 | |
| 3727 | for(i=0;i < CSR_MAX_NUM_KEY; i++) { |
| 3728 | |
| 3729 | if(pWextState->roamProfile.Keys.KeyMaterial[i]) |
| 3730 | pWextState->roamProfile.Keys.KeyLength[i] = 0; |
| 3731 | } |
| 3732 | } |
| 3733 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3734 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 3735 | pWextState->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 3736 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 3737 | |
| 3738 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 3739 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 3740 | |
| 3741 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 3742 | { |
| 3743 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 3744 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3745 | if(eHAL_STATUS_SUCCESS == status) |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 3746 | { |
| 3747 | long ret; |
| 3748 | ret = wait_for_completion_interruptible_timeout( |
| 3749 | &pAdapter->disconnect_comp_var, |
| 3750 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 3751 | if (ret <= 0) |
| 3752 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3753 | FL("failed wait on disconnect_comp_var %ld"), ret); |
| 3754 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3755 | } |
| 3756 | |
| 3757 | return status; |
| 3758 | |
| 3759 | } |
| 3760 | |
| 3761 | if (wrqu->data.flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED)) |
| 3762 | { |
| 3763 | hddLog(VOS_TRACE_LEVEL_INFO, "iwconfig wlan0 key on"); |
| 3764 | |
| 3765 | pHddStaCtx->conn_info.authType = (encoderq->flags & IW_ENCODE_RESTRICTED) ? eCSR_AUTH_TYPE_SHARED_KEY : eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3766 | |
| 3767 | } |
| 3768 | |
| 3769 | |
| 3770 | if(wrqu->data.length > 0) |
| 3771 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3772 | hddLog(VOS_TRACE_LEVEL_INFO, "%s : wrqu->data.length : %d",__func__,wrqu->data.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3773 | |
| 3774 | key_length = wrqu->data.length; |
| 3775 | |
| 3776 | /* IW_ENCODING_TOKEN_MAX is the value that is set for wrqu->data.length by iwconfig.c when 'iwconfig wlan0 key on' is issued.*/ |
| 3777 | |
| 3778 | if(5 == key_length) |
| 3779 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3780 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Call with WEP40,key_len=%d",__func__,key_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3781 | |
| 3782 | if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3783 | { |
| 3784 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
| 3785 | } |
| 3786 | else |
| 3787 | { |
| 3788 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3789 | } |
| 3790 | } |
| 3791 | else if(13 == key_length) |
| 3792 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3793 | hddLog(VOS_TRACE_LEVEL_INFO, "%s:Call with WEP104,key_len:%d",__func__,key_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3794 | |
| 3795 | if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3796 | { |
| 3797 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 3798 | } |
| 3799 | else |
| 3800 | { |
| 3801 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3802 | } |
| 3803 | } |
| 3804 | else |
| 3805 | { |
| 3806 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Invalid WEP key length :%d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3807 | __func__, key_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3808 | return -EINVAL; |
| 3809 | } |
| 3810 | |
| 3811 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 3812 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 3813 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 3814 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
| 3815 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 3816 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 3817 | |
| 3818 | if((eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) && |
| 3819 | ((eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) || |
| 3820 | (eCSR_AUTH_TYPE_SHARED_KEY == pHddStaCtx->conn_info.authType))) |
| 3821 | { |
| 3822 | |
| 3823 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[keyId][0],extra,key_length); |
| 3824 | |
| 3825 | pWextState->roamProfile.Keys.KeyLength[keyId] = (v_U8_t)key_length; |
| 3826 | pWextState->roamProfile.Keys.defaultIndex = (v_U8_t)keyId; |
| 3827 | |
| 3828 | return status; |
| 3829 | } |
| 3830 | } |
| 3831 | |
| 3832 | return 0; |
| 3833 | } |
| 3834 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 3835 | static int iw_set_encode(struct net_device *dev, |
| 3836 | struct iw_request_info *info, |
| 3837 | union iwreq_data *wrqu,char *extra) |
| 3838 | { |
| 3839 | int ret; |
| 3840 | |
| 3841 | vos_ssr_protect(__func__); |
| 3842 | ret = __iw_set_encode(dev, info, wrqu, extra); |
| 3843 | vos_ssr_unprotect(__func__); |
| 3844 | |
| 3845 | return ret; |
| 3846 | } |
| 3847 | |
| 3848 | static int __iw_get_encodeext(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3849 | struct iw_request_info *info, |
| 3850 | struct iw_point *dwrq, |
| 3851 | char *extra) |
| 3852 | { |
| 3853 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3854 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3855 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 3856 | int keyId; |
| 3857 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 3858 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
| 3859 | int i; |
| 3860 | |
| 3861 | ENTER(); |
| 3862 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3863 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3864 | { |
| 3865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3866 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3867 | return -EBUSY; |
| 3868 | } |
| 3869 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3870 | keyId = pRoamProfile->Keys.defaultIndex; |
| 3871 | |
| 3872 | if(keyId < 0 || keyId >= MAX_WEP_KEYS) |
| 3873 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3874 | hddLog(LOG1,"%s: Invalid keyId : %d",__func__,keyId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3875 | return -EINVAL; |
| 3876 | } |
| 3877 | |
| 3878 | if(pRoamProfile->Keys.KeyLength[keyId] > 0) |
| 3879 | { |
| 3880 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 3881 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
Bansidhar Gopalachari | 0a96a38 | 2013-07-24 16:55:34 +0530 | [diff] [blame] | 3882 | vos_mem_copy(extra, &(pRoamProfile->Keys.KeyMaterial[keyId][0]), |
| 3883 | pRoamProfile->Keys.KeyLength[keyId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3884 | } |
| 3885 | else |
| 3886 | { |
| 3887 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 3888 | } |
| 3889 | |
| 3890 | for(i=0; i < MAX_WEP_KEYS; i++) |
| 3891 | { |
| 3892 | if(pRoamProfile->Keys.KeyMaterial[i] == NULL) |
| 3893 | { |
| 3894 | continue; |
| 3895 | } |
| 3896 | else |
| 3897 | { |
| 3898 | break; |
| 3899 | } |
| 3900 | } |
| 3901 | |
| 3902 | if(MAX_WEP_KEYS == i) |
| 3903 | { |
| 3904 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 3905 | } |
| 3906 | else |
| 3907 | { |
| 3908 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 3909 | } |
| 3910 | |
| 3911 | encryptionType = pRoamProfile->EncryptionType.encryptionType[0]; |
| 3912 | |
| 3913 | if(eCSR_ENCRYPT_TYPE_NONE == encryptionType) |
| 3914 | { |
| 3915 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 3916 | } |
| 3917 | |
| 3918 | authType = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType; |
| 3919 | |
| 3920 | if(IW_AUTH_ALG_OPEN_SYSTEM == authType) |
| 3921 | { |
| 3922 | dwrq->flags |= IW_ENCODE_OPEN; |
| 3923 | } |
| 3924 | else |
| 3925 | { |
| 3926 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 3927 | } |
| 3928 | EXIT(); |
| 3929 | return 0; |
| 3930 | |
| 3931 | } |
| 3932 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 3933 | static int iw_get_encodeext(struct net_device *dev, |
| 3934 | struct iw_request_info *info, |
| 3935 | struct iw_point *dwrq, |
| 3936 | char *extra) |
| 3937 | { |
| 3938 | int ret; |
| 3939 | vos_ssr_protect(__func__); |
| 3940 | ret = __iw_get_encodeext(dev, info, dwrq, extra); |
| 3941 | vos_ssr_unprotect(__func__); |
| 3942 | |
| 3943 | return ret; |
| 3944 | } |
| 3945 | |
| 3946 | static int __iw_set_encodeext(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3947 | struct iw_request_info *info, |
| 3948 | union iwreq_data *wrqu, char *extra) |
| 3949 | { |
| 3950 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3951 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3952 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3953 | eHalStatus halStatus= eHAL_STATUS_SUCCESS; |
| 3954 | |
| 3955 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 3956 | v_U32_t status = 0; |
| 3957 | |
| 3958 | struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; |
| 3959 | |
| 3960 | v_U8_t groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3961 | |
| 3962 | int key_index; |
| 3963 | struct iw_point *encoding = &wrqu->encoding; |
| 3964 | tCsrRoamSetKey setKey; |
| 3965 | v_U32_t roamId= 0xFF; |
| 3966 | VOS_STATUS vos_status; |
| 3967 | |
| 3968 | ENTER(); |
| 3969 | |
| 3970 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3971 | { |
| 3972 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3973 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 3974 | return 0; |
| 3975 | } |
| 3976 | |
| 3977 | key_index = encoding->flags & IW_ENCODE_INDEX; |
| 3978 | |
| 3979 | if(key_index > 0) { |
| 3980 | |
| 3981 | /*Convert from 1-based to 0-based keying*/ |
| 3982 | key_index--; |
| 3983 | } |
| 3984 | if(!ext->key_len) { |
| 3985 | |
| 3986 | /*Set the encrytion type to NONE*/ |
| 3987 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 3988 | return status; |
| 3989 | } |
| 3990 | |
| 3991 | if(eConnectionState_NotConnected == pHddStaCtx->conn_info.connState && |
| 3992 | (IW_ENCODE_ALG_WEP == ext->alg)) |
| 3993 | { |
| 3994 | if(IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) { |
| 3995 | |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 3996 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3997 | ("Invalid Configuration:%s"),__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3998 | return -EINVAL; |
| 3999 | } |
| 4000 | else { |
| 4001 | /*Static wep, update the roam profile with the keys */ |
| 4002 | if(ext->key && (ext->key_len <= eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) && |
| 4003 | key_index < CSR_MAX_NUM_KEY) { |
| 4004 | vos_mem_copy(&pRoamProfile->Keys.KeyMaterial[key_index][0],ext->key,ext->key_len); |
| 4005 | pRoamProfile->Keys.KeyLength[key_index] = (v_U8_t)ext->key_len; |
| 4006 | |
| 4007 | if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) |
| 4008 | pRoamProfile->Keys.defaultIndex = (v_U8_t)key_index; |
| 4009 | |
| 4010 | } |
| 4011 | } |
| 4012 | return status; |
| 4013 | } |
| 4014 | |
| 4015 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 4016 | |
| 4017 | setKey.keyId = key_index; |
| 4018 | setKey.keyLength = ext->key_len; |
| 4019 | |
| 4020 | if(ext->key_len <= CSR_MAX_KEY_LEN) { |
| 4021 | vos_mem_copy(&setKey.Key[0],ext->key,ext->key_len); |
| 4022 | } |
| 4023 | |
| 4024 | if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
| 4025 | /*Key direction for group is RX only*/ |
| 4026 | setKey.keyDirection = eSIR_RX_ONLY; |
| 4027 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 4028 | } |
| 4029 | else { |
| 4030 | |
| 4031 | setKey.keyDirection = eSIR_TX_RX; |
| 4032 | vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN); |
| 4033 | } |
| 4034 | |
| 4035 | /*For supplicant pae role is zero*/ |
| 4036 | setKey.paeRole = 0; |
| 4037 | |
| 4038 | switch(ext->alg) |
| 4039 | { |
| 4040 | case IW_ENCODE_ALG_NONE: |
| 4041 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4042 | break; |
| 4043 | |
| 4044 | case IW_ENCODE_ALG_WEP: |
| 4045 | setKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104; |
| 4046 | break; |
| 4047 | |
| 4048 | case IW_ENCODE_ALG_TKIP: |
| 4049 | { |
| 4050 | v_U8_t *pKey = &setKey.Key[0]; |
| 4051 | |
| 4052 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 4053 | |
| 4054 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 4055 | |
| 4056 | /*Supplicant sends the 32bytes key in this order |
| 4057 | |
| 4058 | |--------------|----------|----------| |
| 4059 | | Tk1 |TX-MIC | RX Mic | |
| 4060 | |--------------|----------|----------| |
| 4061 | <---16bytes---><--8bytes--><--8bytes--> |
| 4062 | |
| 4063 | */ |
| 4064 | /*Sme expects the 32 bytes key to be in the below order |
| 4065 | |
| 4066 | |--------------|----------|----------| |
| 4067 | | Tk1 |RX-MIC | TX Mic | |
| 4068 | |--------------|----------|----------| |
| 4069 | <---16bytes---><--8bytes--><--8bytes--> |
| 4070 | */ |
| 4071 | /* Copy the Temporal Key 1 (TK1) */ |
| 4072 | vos_mem_copy(pKey,ext->key,16); |
| 4073 | |
| 4074 | /*Copy the rx mic first*/ |
| 4075 | vos_mem_copy(&pKey[16],&ext->key[24],8); |
| 4076 | |
| 4077 | /*Copy the tx mic */ |
| 4078 | vos_mem_copy(&pKey[24],&ext->key[16],8); |
| 4079 | |
| 4080 | } |
| 4081 | break; |
| 4082 | |
| 4083 | case IW_ENCODE_ALG_CCMP: |
| 4084 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 4085 | break; |
| 4086 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4087 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4088 | #define IW_ENCODE_ALG_KRK 6 |
| 4089 | case IW_ENCODE_ALG_KRK: |
| 4090 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 4091 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4092 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4093 | |
| 4094 | default: |
| 4095 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4096 | break; |
| 4097 | } |
| 4098 | |
| 4099 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4100 | ("%s:cipher_alg:%d key_len[%d] *pEncryptionType :%d"),__func__,(int)ext->alg,(int)ext->key_len,setKey.encType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4101 | |
| 4102 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 4103 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 4104 | is done. Save the key in the UMAC and include it in the ADD |
| 4105 | BSS request */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4106 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 4107 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4108 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 4109 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 4110 | "%s: Update PreAuth Key success", __func__); |
| 4111 | return 0; |
| 4112 | } |
| 4113 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 4114 | { |
| 4115 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4116 | "%s: Update PreAuth Key failed", __func__); |
| 4117 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4118 | } |
| 4119 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4120 | |
| 4121 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 4122 | |
| 4123 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 4124 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 4125 | { |
| 4126 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4127 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 4128 | __LINE__, vos_status ); |
| 4129 | |
| 4130 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 4131 | } |
| 4132 | |
| 4133 | halStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),pAdapter->sessionId, &setKey, &roamId ); |
| 4134 | |
| 4135 | if ( halStatus != eHAL_STATUS_SUCCESS ) |
| 4136 | { |
| 4137 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4138 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 4139 | __LINE__, halStatus ); |
| 4140 | |
| 4141 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 4142 | } |
| 4143 | |
| 4144 | return halStatus; |
| 4145 | } |
| 4146 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 4147 | static int iw_set_encodeext(struct net_device *dev, |
| 4148 | struct iw_request_info *info, |
| 4149 | union iwreq_data *wrqu, char *extra) |
| 4150 | { |
| 4151 | int ret; |
| 4152 | |
| 4153 | vos_ssr_protect(__func__); |
| 4154 | ret = __iw_set_encodeext(dev, info, wrqu, extra); |
| 4155 | vos_ssr_unprotect(__func__); |
| 4156 | |
| 4157 | return ret; |
| 4158 | } |
| 4159 | |
| 4160 | static int __iw_set_retry(struct net_device *dev, |
| 4161 | struct iw_request_info *info, |
| 4162 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4163 | { |
| 4164 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4165 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4166 | |
| 4167 | ENTER(); |
| 4168 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4169 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4170 | { |
| 4171 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4172 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4173 | return -EBUSY; |
| 4174 | } |
| 4175 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4176 | if(wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN || |
| 4177 | wrqu->retry.value > WNI_CFG_LONG_RETRY_LIMIT_STAMAX) { |
| 4178 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4179 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Invalid Retry-Limit=%d!!"),wrqu->retry.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4180 | |
| 4181 | return -EINVAL; |
| 4182 | } |
| 4183 | |
| 4184 | if(wrqu->retry.flags & IW_RETRY_LIMIT) { |
| 4185 | |
| 4186 | if((wrqu->retry.flags & IW_RETRY_LONG)) |
| 4187 | { |
| 4188 | if ( ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 4189 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 4190 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4191 | FL("failed to set ini parameter, WNI_CFG_LONG_RETRY_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4192 | return -EIO; |
| 4193 | } |
| 4194 | } |
| 4195 | else if((wrqu->retry.flags & IW_RETRY_SHORT)) |
| 4196 | { |
| 4197 | if ( ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 4198 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 4199 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4200 | FL("failed to set ini parameter, WNI_CFG_SHORT_RETRY_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4201 | return -EIO; |
| 4202 | } |
| 4203 | } |
| 4204 | } |
| 4205 | else |
| 4206 | { |
| 4207 | return -EOPNOTSUPP; |
| 4208 | } |
| 4209 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4210 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Set Retry-Limit=%d!!"),wrqu->retry.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4211 | |
| 4212 | EXIT(); |
| 4213 | |
| 4214 | return 0; |
| 4215 | |
| 4216 | } |
| 4217 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 4218 | static int iw_set_retry(struct net_device *dev, |
| 4219 | struct iw_request_info *info, |
| 4220 | union iwreq_data *wrqu, char *extra) |
| 4221 | { |
| 4222 | int ret; |
| 4223 | |
| 4224 | vos_ssr_protect(__func__); |
| 4225 | ret = __iw_set_retry(dev, info, wrqu, extra); |
| 4226 | vos_ssr_unprotect(__func__); |
| 4227 | |
| 4228 | return ret; |
| 4229 | } |
| 4230 | |
| 4231 | static int __iw_get_retry(struct net_device *dev, |
| 4232 | struct iw_request_info *info, |
| 4233 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4234 | { |
| 4235 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4236 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4237 | v_U32_t retry = 0; |
| 4238 | |
| 4239 | ENTER(); |
| 4240 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4241 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4242 | { |
| 4243 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4244 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4245 | return -EBUSY; |
| 4246 | } |
| 4247 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4248 | if((wrqu->retry.flags & IW_RETRY_LONG)) |
| 4249 | { |
| 4250 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; |
| 4251 | |
| 4252 | if ( ccmCfgGetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS ) |
| 4253 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 4254 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4255 | FL("failed to get ini parameter, WNI_CFG_LONG_RETRY_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4256 | return -EIO; |
| 4257 | } |
| 4258 | |
| 4259 | wrqu->retry.value = retry; |
| 4260 | } |
| 4261 | else if ((wrqu->retry.flags & IW_RETRY_SHORT)) |
| 4262 | { |
| 4263 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; |
| 4264 | |
| 4265 | if ( ccmCfgGetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS ) |
| 4266 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 4267 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4268 | FL("failed to get ini parameter, WNI_CFG_SHORT_RETRY_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4269 | return -EIO; |
| 4270 | } |
| 4271 | |
| 4272 | wrqu->retry.value = retry; |
| 4273 | } |
| 4274 | else { |
| 4275 | return -EOPNOTSUPP; |
| 4276 | } |
| 4277 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4278 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Retry-Limit=%d!!"),retry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4279 | |
| 4280 | EXIT(); |
| 4281 | |
| 4282 | return 0; |
| 4283 | } |
| 4284 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 4285 | static int iw_get_retry(struct net_device *dev, |
| 4286 | struct iw_request_info *info, |
| 4287 | union iwreq_data *wrqu, char *extra) |
| 4288 | { |
| 4289 | int ret; |
| 4290 | |
| 4291 | vos_ssr_protect(__func__); |
| 4292 | ret = __iw_get_retry(dev, info, wrqu, extra); |
| 4293 | vos_ssr_unprotect(__func__); |
| 4294 | |
| 4295 | return ret; |
| 4296 | } |
| 4297 | |
| 4298 | static int __iw_set_mlme(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4299 | struct iw_request_info *info, |
| 4300 | union iwreq_data *wrqu, |
| 4301 | char *extra) |
| 4302 | { |
| 4303 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4304 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4305 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
| 4306 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4307 | |
| 4308 | ENTER(); |
| 4309 | |
| 4310 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4311 | { |
| 4312 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4313 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 4314 | return 0; |
| 4315 | } |
| 4316 | |
| 4317 | //reason_code is unused. By default it is set to eCSR_DISCONNECT_REASON_UNSPECIFIED |
| 4318 | switch (mlme->cmd) { |
| 4319 | case IW_MLME_DISASSOC: |
| 4320 | case IW_MLME_DEAUTH: |
| 4321 | |
| 4322 | if( pHddStaCtx->conn_info.connState == eConnectionState_Associated ) |
| 4323 | { |
| 4324 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 4325 | |
| 4326 | if( mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE ) |
| 4327 | reason = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 4328 | |
| 4329 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 4330 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId,reason); |
| 4331 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4332 | if(eHAL_STATUS_SUCCESS == status) |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 4333 | { |
| 4334 | long ret; |
| 4335 | ret = wait_for_completion_interruptible_timeout( |
| 4336 | &pAdapter->disconnect_comp_var, |
| 4337 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 4338 | if (ret <= 0) |
| 4339 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4340 | FL("failed wait on disconnect_comp_var %ld"), ret); |
| 4341 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4342 | else |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4343 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate : csrRoamDisconnect failure returned %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4344 | __func__, (int)mlme->cmd, (int)status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4345 | |
| 4346 | /* Resetting authKeyMgmt */ |
| 4347 | (WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->authKeyMgmt = 0; |
| 4348 | |
| 4349 | netif_tx_disable(dev); |
| 4350 | netif_carrier_off(dev); |
| 4351 | |
| 4352 | } |
| 4353 | else |
| 4354 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4355 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate called but station is not in associated state", __func__, (int)mlme->cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4356 | } |
| 4357 | break; |
| 4358 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4359 | hddLog(LOGE,"%s %d Command should be Disassociate/Deauthenticate", __func__, (int)mlme->cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4360 | return -EINVAL; |
| 4361 | }//end of switch |
| 4362 | |
| 4363 | EXIT(); |
| 4364 | |
| 4365 | return status; |
| 4366 | |
| 4367 | } |
| 4368 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 4369 | static int iw_set_mlme(struct net_device *dev, |
| 4370 | struct iw_request_info *info, |
| 4371 | union iwreq_data *wrqu, |
| 4372 | char *extra) |
| 4373 | { |
| 4374 | int ret; |
| 4375 | |
| 4376 | vos_ssr_protect(__func__); |
| 4377 | ret = __iw_set_mlme(dev, info, wrqu, extra); |
| 4378 | vos_ssr_unprotect(__func__); |
| 4379 | |
| 4380 | return ret; |
| 4381 | } |
| 4382 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4383 | /* set param sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 4384 | static int __iw_setint_getnone(struct net_device *dev, |
| 4385 | struct iw_request_info *info, |
| 4386 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4387 | { |
| 4388 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4389 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4390 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4391 | int *value = (int *)extra; |
| 4392 | int sub_cmd = value[0]; |
| 4393 | int set_value = value[1]; |
| 4394 | int ret = 0; /* success */ |
| 4395 | int enable_pbm, enable_mp; |
| 4396 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 4397 | v_U8_t nEnableSuspendOld; |
| 4398 | #endif |
| 4399 | INIT_COMPLETION(pWextState->completion_var); |
| 4400 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4401 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4402 | { |
| 4403 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4404 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4405 | return -EBUSY; |
| 4406 | } |
| 4407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4408 | switch(sub_cmd) |
| 4409 | { |
| 4410 | case WE_SET_11D_STATE: |
| 4411 | { |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 4412 | tSmeConfigParams smeConfig; |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 4413 | memset(&smeConfig, 0x00, sizeof(smeConfig)); |
| 4414 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4415 | if((ENABLE_11D == set_value) || (DISABLE_11D == set_value)) { |
| 4416 | |
| 4417 | sme_GetConfigParam(hHal,&smeConfig); |
| 4418 | smeConfig.csrConfig.Is11dSupportEnabled = (v_BOOL_t)set_value; |
| 4419 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4420 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%d!!"),smeConfig.csrConfig.Is11dSupportEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4421 | |
| 4422 | sme_UpdateConfig(hHal,&smeConfig); |
| 4423 | } |
| 4424 | else { |
| 4425 | return -EINVAL; |
| 4426 | } |
| 4427 | break; |
| 4428 | } |
| 4429 | |
| 4430 | case WE_WOWL: |
| 4431 | { |
| 4432 | switch (set_value) |
| 4433 | { |
| 4434 | case 0x00: |
c_hpothu | 01484c0 | 2014-05-16 14:05:15 +0530 | [diff] [blame] | 4435 | hdd_exit_wowl(pAdapter, eWOWL_EXIT_USER); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4436 | break; |
| 4437 | case 0x01: |
| 4438 | case 0x02: |
| 4439 | case 0x03: |
| 4440 | enable_mp = (set_value & 0x01) ? 1 : 0; |
| 4441 | enable_pbm = (set_value & 0x02) ? 1 : 0; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4442 | hddLog(LOGE, "magic packet ? = %s pattern byte matching ? = %s", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4443 | (enable_mp ? "YES":"NO"), (enable_pbm ? "YES":"NO")); |
| 4444 | hdd_enter_wowl(pAdapter, enable_mp, enable_pbm); |
| 4445 | break; |
| 4446 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4447 | hddLog(LOGE, "Invalid arg %d in WE_WOWL IOCTL", set_value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4448 | ret = -EINVAL; |
| 4449 | break; |
| 4450 | } |
| 4451 | |
| 4452 | break; |
| 4453 | } |
| 4454 | case WE_SET_POWER: |
| 4455 | { |
| 4456 | switch (set_value) |
| 4457 | { |
| 4458 | case 0: //Full Power |
| 4459 | { |
| 4460 | struct statsContext context; |
| 4461 | eHalStatus status; |
| 4462 | |
| 4463 | init_completion(&context.completion); |
| 4464 | |
| 4465 | context.pAdapter = pAdapter; |
| 4466 | context.magic = POWER_CONTEXT_MAGIC; |
| 4467 | |
| 4468 | status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4469 | iw_power_callback_fn, &context, |
| 4470 | eSME_FULL_PWR_NEEDED_BY_HDD); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 4471 | if (eHAL_STATUS_PMC_PENDING == status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4472 | { |
| 4473 | int lrc = wait_for_completion_interruptible_timeout( |
| 4474 | &context.completion, |
| 4475 | msecs_to_jiffies(WLAN_WAIT_TIME_POWER)); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 4476 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4477 | if (lrc <= 0) |
| 4478 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 4479 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4480 | "%s: SME %s while requesting fullpower", |
| 4481 | __func__, (0 == lrc) ? |
| 4482 | "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4483 | } |
| 4484 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 4485 | /* either we have a response or we timed out. if we timed |
| 4486 | out there is a race condition such that the callback |
| 4487 | function could be executing at the same time we are. of |
| 4488 | primary concern is if the callback function had already |
| 4489 | verified the "magic" but had not yet set the completion |
| 4490 | variable when a timeout occurred. we serialize these |
| 4491 | activities by invalidating the magic while holding a |
| 4492 | shared spinlock which will cause us to block if the |
| 4493 | callback is currently executing */ |
| 4494 | spin_lock(&hdd_context_lock); |
| 4495 | context.magic = 0; |
| 4496 | spin_unlock(&hdd_context_lock); |
| 4497 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4498 | hddLog(LOGE, "iwpriv Full Power completed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4499 | break; |
| 4500 | } |
| 4501 | case 1: //Enable BMPS |
| 4502 | sme_EnablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 4503 | break; |
| 4504 | case 2: //Disable BMPS |
| 4505 | sme_DisablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 4506 | break; |
| 4507 | case 3: //Request Bmps |
| 4508 | { |
| 4509 | struct statsContext context; |
| 4510 | eHalStatus status; |
| 4511 | |
| 4512 | init_completion(&context.completion); |
| 4513 | |
| 4514 | context.pAdapter = pAdapter; |
| 4515 | context.magic = POWER_CONTEXT_MAGIC; |
| 4516 | |
| 4517 | status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 4518 | iw_power_callback_fn, &context); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 4519 | if (eHAL_STATUS_PMC_PENDING == status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4520 | { |
| 4521 | int lrc = wait_for_completion_interruptible_timeout( |
| 4522 | &context.completion, |
| 4523 | msecs_to_jiffies(WLAN_WAIT_TIME_POWER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4524 | if (lrc <= 0) |
| 4525 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 4526 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4527 | "%s: SME %s while requesting BMPS", |
| 4528 | __func__, (0 == lrc) ? "timeout" : |
| 4529 | "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4530 | } |
| 4531 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 4532 | /* either we have a response or we timed out. if we |
| 4533 | timed out there is a race condition such that the |
| 4534 | callback function could be executing at the same |
| 4535 | time we are. of primary concern is if the callback |
| 4536 | function had already verified the "magic" but had |
| 4537 | not yet set the completion variable when a timeout |
| 4538 | occurred. we serialize these activities by |
| 4539 | invalidating the magic while holding a shared |
| 4540 | spinlock which will cause us to block if the |
| 4541 | callback is currently executing */ |
| 4542 | spin_lock(&hdd_context_lock); |
| 4543 | context.magic = 0; |
| 4544 | spin_unlock(&hdd_context_lock); |
| 4545 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4546 | hddLog(LOGE, "iwpriv Request BMPS completed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4547 | break; |
| 4548 | } |
| 4549 | case 4: //Enable IMPS |
| 4550 | sme_EnablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 4551 | break; |
| 4552 | case 5: //Disable IMPS |
| 4553 | sme_DisablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 4554 | break; |
| 4555 | case 6: //Enable Standby |
| 4556 | sme_EnablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE); |
| 4557 | break; |
| 4558 | case 7: //Disable Standby |
| 4559 | sme_DisablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE); |
| 4560 | break; |
| 4561 | case 8: //Request Standby |
| 4562 | #ifdef CONFIG_HAS_EARLYSUSPEND |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4563 | #endif |
| 4564 | break; |
| 4565 | case 9: //Start Auto Bmps Timer |
| 4566 | sme_StartAutoBmpsTimer(hHal); |
| 4567 | break; |
| 4568 | case 10://Stop Auto BMPS Timer |
| 4569 | sme_StopAutoBmpsTimer(hHal); |
| 4570 | break; |
| 4571 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 4572 | case 11://suspend to standby |
| 4573 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 4574 | nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend; |
| 4575 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4576 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld; |
| 4577 | #endif |
| 4578 | break; |
| 4579 | case 12://suspend to deep sleep |
| 4580 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 4581 | nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend; |
| 4582 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4583 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld; |
| 4584 | #endif |
| 4585 | break; |
| 4586 | case 13://resume from suspend |
| 4587 | #ifdef CONFIG_HAS_EARLYSUSPEND |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4588 | #endif |
| 4589 | break; |
| 4590 | #endif |
| 4591 | case 14://reset wlan (power down/power up) |
| 4592 | vos_chipReset(NULL, VOS_FALSE, NULL, NULL, VOS_CHIP_RESET_UNKNOWN_EXCEPTION); |
| 4593 | break; |
| 4594 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4595 | hddLog(LOGE, "Invalid arg %d in WE_SET_POWER IOCTL", set_value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4596 | ret = -EINVAL; |
| 4597 | break; |
| 4598 | } |
| 4599 | break; |
| 4600 | } |
| 4601 | |
| 4602 | case WE_SET_MAX_ASSOC: |
| 4603 | { |
| 4604 | if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) || |
| 4605 | (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) |
| 4606 | { |
| 4607 | ret = -EINVAL; |
| 4608 | } |
| 4609 | else if ( ccmCfgSetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, |
| 4610 | set_value, NULL, eANI_BOOLEAN_FALSE) |
| 4611 | != eHAL_STATUS_SUCCESS ) |
| 4612 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 4613 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4614 | FL("failed to set ini parameter, WNI_CFG_ASSOC_STA_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4615 | ret = -EIO; |
| 4616 | } |
| 4617 | break; |
| 4618 | } |
| 4619 | |
| 4620 | case WE_SET_SAP_AUTO_CHANNEL_SELECTION: |
| 4621 | { |
| 4622 | if( 0 == set_value ) |
| 4623 | { |
| 4624 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 0; |
| 4625 | } |
| 4626 | else if ( 1 == set_value ) |
| 4627 | { |
| 4628 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 1; |
| 4629 | } |
| 4630 | else |
| 4631 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4632 | hddLog(LOGE, "Invalid arg %d in WE_SET_SAP_AUTO_CHANNEL_SELECTION IOCTL", set_value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4633 | ret = -EINVAL; |
| 4634 | } |
| 4635 | break; |
| 4636 | } |
| 4637 | |
| 4638 | case WE_SET_DATA_INACTIVITY_TO: |
| 4639 | { |
| 4640 | if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) || |
| 4641 | (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) || |
| 4642 | (ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 4643 | WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, |
| 4644 | set_value, |
| 4645 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)) |
| 4646 | { |
| 4647 | hddLog(LOGE,"Failure: Could not pass on " |
| 4648 | "WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT configuration info " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4649 | "to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4650 | ret = -EINVAL; |
| 4651 | } |
| 4652 | break; |
| 4653 | } |
| 4654 | case WE_SET_MAX_TX_POWER: |
| 4655 | { |
| 4656 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 4657 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 4658 | |
| 4659 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Setting maximum tx power %d dBm", |
| 4660 | __func__, set_value); |
| 4661 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, set_value) != |
| 4662 | eHAL_STATUS_SUCCESS ) |
| 4663 | { |
| 4664 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 4665 | __func__); |
| 4666 | return -EIO; |
| 4667 | } |
| 4668 | |
| 4669 | break; |
| 4670 | } |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 4671 | case WE_SET_MAX_TX_POWER_2_4: |
| 4672 | { |
| 4673 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4674 | "%s: Setting maximum tx power %d dBm for 2.4 GHz band", |
| 4675 | __func__, set_value); |
| 4676 | if (sme_SetMaxTxPowerPerBand(eCSR_BAND_24, set_value) != |
| 4677 | eHAL_STATUS_SUCCESS) |
| 4678 | { |
| 4679 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4680 | "%s: Setting maximum tx power failed for 2.4 GHz band", |
| 4681 | __func__); |
| 4682 | return -EIO; |
| 4683 | } |
| 4684 | |
| 4685 | break; |
| 4686 | } |
| 4687 | case WE_SET_MAX_TX_POWER_5_0: |
| 4688 | { |
| 4689 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 4690 | "%s: Setting maximum tx power %d dBm for 5.0 GHz band", |
| 4691 | __func__, set_value); |
| 4692 | if (sme_SetMaxTxPowerPerBand(eCSR_BAND_5G, set_value) != |
| 4693 | eHAL_STATUS_SUCCESS) |
| 4694 | { |
| 4695 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4696 | "%s: Setting maximum tx power failed for 5.0 GHz band", |
| 4697 | __func__); |
| 4698 | return -EIO; |
| 4699 | } |
| 4700 | |
| 4701 | break; |
| 4702 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4703 | case WE_SET_HIGHER_DTIM_TRANSITION: |
| 4704 | { |
| 4705 | if(!((set_value == eANI_BOOLEAN_FALSE) || |
| 4706 | (set_value == eANI_BOOLEAN_TRUE))) |
| 4707 | { |
| 4708 | hddLog(LOGE, "Dynamic DTIM Incorrect data:%d", set_value); |
| 4709 | ret = -EINVAL; |
| 4710 | } |
| 4711 | else |
| 4712 | { |
| 4713 | if(pAdapter->higherDtimTransition != set_value) |
| 4714 | { |
| 4715 | pAdapter->higherDtimTransition = set_value; |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4716 | hddLog(LOG1, "%s: higherDtimTransition set to :%d", __func__, pAdapter->higherDtimTransition); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4717 | } |
| 4718 | } |
| 4719 | |
| 4720 | break; |
| 4721 | } |
| 4722 | |
| 4723 | case WE_SET_TM_LEVEL: |
| 4724 | { |
| 4725 | hdd_context_t *hddCtxt = WLAN_HDD_GET_CTX(pAdapter); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 4726 | hddLog(VOS_TRACE_LEVEL_INFO, "Set Thermal Mitigation Level %d", (int)set_value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4727 | hddDevTmLevelChangedHandler(hddCtxt->parent_dev, set_value); |
| 4728 | |
| 4729 | break; |
| 4730 | } |
| 4731 | |
Kiet Lam | 46b8e4e | 2013-11-06 21:49:53 +0530 | [diff] [blame] | 4732 | case WE_ENABLE_STRICT_FCC_REG: |
| 4733 | { |
| 4734 | hdd_context_t *hddCtxt = WLAN_HDD_GET_CTX(pAdapter); |
| 4735 | struct wiphy *wiphy = NULL; |
| 4736 | long lrc; |
| 4737 | int status; |
| 4738 | |
| 4739 | wiphy = hddCtxt->wiphy; |
| 4740 | if(wiphy == NULL) |
| 4741 | { |
| 4742 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy is NULL ", __func__); |
| 4743 | break; |
| 4744 | } |
| 4745 | init_completion(&hddCtxt->wiphy_channel_update_event); |
| 4746 | |
| 4747 | hddCtxt->nEnableStrictRegulatoryForFCC = set_value; |
| 4748 | |
| 4749 | status = regulatory_hint(wiphy, "00"); |
| 4750 | if(status < 0) |
| 4751 | { |
| 4752 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Failure in setting regulatory rule ", __func__); |
| 4753 | break; |
| 4754 | } |
| 4755 | |
| 4756 | /* Wait for completion */ |
| 4757 | lrc = wait_for_completion_interruptible_timeout(&hddCtxt->wiphy_channel_update_event, |
| 4758 | msecs_to_jiffies(WLAN_WAIT_TIME_CHANNEL_UPDATE)); |
| 4759 | if (lrc <= 0) |
| 4760 | { |
| 4761 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while setting strict FCC regulatory rule ", |
| 4762 | __func__, (0 == lrc) ? "Timeout" : "Interrupt"); |
| 4763 | return (0 == lrc) ? -ETIMEDOUT : -EINTR; |
| 4764 | } |
| 4765 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: SUCCESS in setting strict FCC regulatory rule", __func__); |
| 4766 | |
| 4767 | break; |
| 4768 | } |
Tushnim Bhattacharyya | a3ba5a5 | 2014-01-30 11:37:33 -0800 | [diff] [blame] | 4769 | case WE_SET_DEBUG_LOG: |
| 4770 | { |
| 4771 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4772 | pHddCtx->cfg_ini->gEnableDebugLog = set_value; |
| 4773 | sme_UpdateConnectDebug(pHddCtx->hHal, set_value); |
| 4774 | break; |
| 4775 | } |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 4776 | #ifdef FEATURE_WLAN_TDLS |
| 4777 | case WE_SET_TDLS_OFF_CHAN: |
| 4778 | { |
| 4779 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4780 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Tdls offchannel num %d", |
| 4781 | __func__, set_value); |
| 4782 | ret = iw_set_tdlsoffchannel(pHddCtx, set_value); |
| 4783 | break; |
| 4784 | } |
| 4785 | case WE_SET_TDLS_SEC_OFF_CHAN_OFFSET: |
| 4786 | { |
| 4787 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4788 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Tdls sec offchan offset %d", |
| 4789 | __func__, set_value); |
| 4790 | ret = iw_set_tdlssecoffchanneloffset(pHddCtx, set_value); |
| 4791 | break; |
| 4792 | } |
| 4793 | case WE_SET_TDLS_OFF_CHAN_MODE: |
| 4794 | { |
| 4795 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Tdls offchannel mode %d", |
| 4796 | __func__, set_value); |
| 4797 | ret = iw_set_tdlsoffchannelmode(pAdapter, set_value); |
| 4798 | break; |
| 4799 | } |
| 4800 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 4801 | case WE_SET_SCAN_BAND_PREFERENCE: |
| 4802 | { |
| 4803 | tSmeConfigParams smeConfig; |
| 4804 | memset(&smeConfig, 0x00, sizeof(smeConfig)); |
| 4805 | if(pAdapter->device_mode != WLAN_HDD_INFRA_STATION) { |
| 4806 | ret = -EINVAL; |
| 4807 | break; |
| 4808 | } |
| 4809 | hddLog(LOG1, "WE_SET_BAND_PREFERRENCE val %d ", set_value); |
| 4810 | |
| 4811 | if (eCSR_BAND_ALL == set_value || |
| 4812 | eCSR_BAND_24 == set_value || eCSR_BAND_5G == set_value) { |
| 4813 | sme_GetConfigParam(hHal, &smeConfig); |
| 4814 | smeConfig.csrConfig.scanBandPreference = set_value; |
| 4815 | |
| 4816 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4817 | "set band scan preference = %d\n", |
| 4818 | smeConfig.csrConfig.scanBandPreference); |
| 4819 | |
| 4820 | sme_UpdateConfig(hHal, &smeConfig); |
| 4821 | } |
| 4822 | else { |
| 4823 | ret = -EINVAL; |
| 4824 | } |
| 4825 | break; |
| 4826 | } |
Kiet Lam | 46b8e4e | 2013-11-06 21:49:53 +0530 | [diff] [blame] | 4827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4828 | default: |
| 4829 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4830 | hddLog(LOGE, "Invalid IOCTL setvalue command %d value %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4831 | sub_cmd, set_value); |
| 4832 | break; |
| 4833 | } |
| 4834 | } |
| 4835 | |
| 4836 | return ret; |
| 4837 | } |
| 4838 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 4839 | static int iw_setint_getnone(struct net_device *dev, |
| 4840 | struct iw_request_info *info, |
| 4841 | union iwreq_data *wrqu, char *extra) |
| 4842 | { |
| 4843 | int ret; |
| 4844 | |
| 4845 | vos_ssr_protect(__func__); |
| 4846 | ret = __iw_setint_getnone(dev, info, wrqu, extra); |
| 4847 | vos_ssr_unprotect(__func__); |
| 4848 | |
| 4849 | return 0; |
| 4850 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4851 | /* set param sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 4852 | static int __iw_setchar_getnone(struct net_device *dev, |
| 4853 | struct iw_request_info *info, |
| 4854 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4855 | { |
| 4856 | VOS_STATUS vstatus; |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 4857 | int sub_cmd; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4858 | int ret = 0; /* success */ |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 4859 | char *pBuffer = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4860 | hdd_adapter_t *pAdapter = (netdev_priv(dev)); |
| 4861 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4862 | #ifdef WLAN_FEATURE_VOWIFI |
| 4863 | hdd_config_t *pConfig = pHddCtx->cfg_ini; |
| 4864 | #endif /* WLAN_FEATURE_VOWIFI */ |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 4865 | struct iw_point s_priv_data; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4866 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4867 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4868 | { |
| 4869 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4870 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4871 | return -EBUSY; |
| 4872 | } |
| 4873 | |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 4874 | /* helper function to get iwreq_data with compat handling. */ |
| 4875 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 4876 | { |
| 4877 | return -EINVAL; |
| 4878 | } |
| 4879 | |
| 4880 | /* make sure all params are correctly passed to function */ |
| 4881 | if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) |
| 4882 | { |
| 4883 | return -EINVAL; |
| 4884 | } |
| 4885 | |
| 4886 | sub_cmd = s_priv_data.flags; |
| 4887 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 4888 | /* ODD number is used for set, copy data using copy_from_user */ |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 4889 | pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer, |
| 4890 | s_priv_data.length); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 4891 | if (NULL == pBuffer) |
| 4892 | { |
| 4893 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4894 | "mem_alloc_copy_from_user_helper fail"); |
| 4895 | return -ENOMEM; |
| 4896 | } |
| 4897 | |
| 4898 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 4899 | "%s: Received length %d", __func__, s_priv_data.length); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 4900 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 4901 | "%s: Received data %s", __func__, pBuffer); |
| 4902 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4903 | switch(sub_cmd) |
| 4904 | { |
| 4905 | case WE_WOWL_ADD_PTRN: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4906 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "ADD_PTRN"); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 4907 | hdd_add_wowl_ptrn(pAdapter, pBuffer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4908 | break; |
| 4909 | case WE_WOWL_DEL_PTRN: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4910 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "DEL_PTRN"); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 4911 | hdd_del_wowl_ptrn(pAdapter, pBuffer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4912 | break; |
| 4913 | #if defined WLAN_FEATURE_VOWIFI |
| 4914 | case WE_NEIGHBOR_REPORT_REQUEST: |
| 4915 | { |
| 4916 | tRrmNeighborReq neighborReq; |
| 4917 | tRrmNeighborRspCallbackInfo callbackInfo; |
| 4918 | |
| 4919 | if (pConfig->fRrmEnable) |
| 4920 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4921 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Neighbor Request"); |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 4922 | neighborReq.no_ssid = (s_priv_data.length - 1) ? false : true ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4923 | if( !neighborReq.no_ssid ) |
| 4924 | { |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 4925 | neighborReq.ssid.length = (s_priv_data.length - 1) > 32 ? 32 : (s_priv_data.length - 1) ; |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 4926 | vos_mem_copy( neighborReq.ssid.ssId, pBuffer, neighborReq.ssid.length ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4927 | } |
| 4928 | |
| 4929 | callbackInfo.neighborRspCallback = NULL; |
| 4930 | callbackInfo.neighborRspCallbackContext = NULL; |
| 4931 | callbackInfo.timeout = 5000; //5 seconds |
| 4932 | sme_NeighborReportRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &neighborReq, &callbackInfo ); |
| 4933 | } |
| 4934 | else |
| 4935 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4936 | hddLog(LOGE, "%s: Ignoring neighbor request as RRM is not enabled", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4937 | ret = -EINVAL; |
| 4938 | } |
| 4939 | } |
| 4940 | break; |
| 4941 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4942 | case WE_SET_AP_WPS_IE: |
| 4943 | hddLog( LOGE, "Received WE_SET_AP_WPS_IE" ); |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 4944 | sme_updateP2pIe( WLAN_HDD_GET_HAL_CTX(pAdapter), pBuffer, s_priv_data.length ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4945 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4946 | case WE_SET_CONFIG: |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 4947 | vstatus = hdd_execute_config_command(pHddCtx, pBuffer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4948 | if (VOS_STATUS_SUCCESS != vstatus) |
| 4949 | { |
| 4950 | ret = -EINVAL; |
| 4951 | } |
| 4952 | break; |
| 4953 | default: |
| 4954 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4955 | hddLog(LOGE, "%s: Invalid sub command %d",__func__, sub_cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4956 | ret = -EINVAL; |
| 4957 | break; |
| 4958 | } |
| 4959 | } |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 4960 | kfree(pBuffer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4961 | return ret; |
| 4962 | } |
| 4963 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 4964 | static int iw_setchar_getnone(struct net_device *dev, |
| 4965 | struct iw_request_info *info, |
| 4966 | union iwreq_data *wrqu, char *extra) |
| 4967 | { |
| 4968 | int ret; |
| 4969 | |
| 4970 | vos_ssr_protect(__func__); |
| 4971 | ret = __iw_setchar_getnone(dev, info, wrqu, extra); |
| 4972 | vos_ssr_unprotect(__func__); |
| 4973 | |
| 4974 | return ret; |
| 4975 | } |
| 4976 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4977 | /* get param sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 4978 | static int __iw_setnone_getint(struct net_device *dev, |
| 4979 | struct iw_request_info *info, |
| 4980 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4981 | { |
| 4982 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4983 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Girish Gowli | 385be61 | 2014-09-18 11:17:20 +0530 | [diff] [blame] | 4984 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4985 | int *value = (int *)extra; |
| 4986 | int ret = 0; /* success */ |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 4987 | tSmeConfigParams smeConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4988 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4989 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4990 | { |
| 4991 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4992 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4993 | return -EBUSY; |
| 4994 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4995 | |
| 4996 | switch (value[0]) |
| 4997 | { |
| 4998 | case WE_GET_11D_STATE: |
| 4999 | { |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 5000 | tSmeConfigParams smeConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5001 | sme_GetConfigParam(hHal,&smeConfig); |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5002 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5003 | *value = smeConfig.csrConfig.Is11dSupportEnabled; |
| 5004 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5005 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%d!!"),*value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5006 | |
| 5007 | break; |
| 5008 | } |
| 5009 | |
| 5010 | case WE_IBSS_STATUS: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5011 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****Return IBSS Status*****"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5012 | break; |
| 5013 | |
| 5014 | case WE_PMC_STATE: |
| 5015 | { |
| 5016 | *value = pmcGetPmcState(hHal); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5017 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("PMC state=%d!!"),*value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5018 | break; |
| 5019 | } |
| 5020 | case WE_GET_WLAN_DBG: |
| 5021 | { |
| 5022 | vos_trace_display(); |
| 5023 | *value = 0; |
| 5024 | break; |
| 5025 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5026 | case WE_GET_MAX_ASSOC: |
| 5027 | { |
| 5028 | if (ccmCfgGetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, (tANI_U32 *)value) != eHAL_STATUS_SUCCESS) |
| 5029 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 5030 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 5031 | FL("failed to get ini parameter, WNI_CFG_ASSOC_STA_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5032 | ret = -EIO; |
| 5033 | } |
Girish Gowli | 385be61 | 2014-09-18 11:17:20 +0530 | [diff] [blame] | 5034 | #ifdef WLAN_SOFTAP_VSTA_FEATURE |
| 5035 | if (pHddCtx->cfg_ini->fEnableVSTASupport) |
| 5036 | { |
| 5037 | if (*value > VSTA_NUM_ASSOC_STA) |
| 5038 | { |
| 5039 | *value = VSTA_NUM_ASSOC_STA; |
| 5040 | } |
| 5041 | if ((pHddCtx->hddAdapters.count > VSTA_NUM_RESV_SELFSTA) && |
| 5042 | (*value > (VSTA_NUM_ASSOC_STA - |
| 5043 | (pHddCtx->hddAdapters.count - VSTA_NUM_RESV_SELFSTA)))) |
| 5044 | { |
| 5045 | *value = (VSTA_NUM_ASSOC_STA - |
| 5046 | (pHddCtx->hddAdapters.count - VSTA_NUM_RESV_SELFSTA)); |
| 5047 | } |
| 5048 | } |
| 5049 | else |
| 5050 | #endif |
| 5051 | { |
| 5052 | if (*value > NUM_ASSOC_STA) |
| 5053 | { |
| 5054 | *value = NUM_ASSOC_STA; |
| 5055 | } |
| 5056 | if ((pHddCtx->hddAdapters.count > NUM_RESV_SELFSTA) && |
| 5057 | (*value > (NUM_ASSOC_STA - |
| 5058 | (pHddCtx->hddAdapters.count - NUM_RESV_SELFSTA)))) |
| 5059 | { |
| 5060 | *value = (NUM_ASSOC_STA - |
| 5061 | (pHddCtx->hddAdapters.count - NUM_RESV_SELFSTA)); |
| 5062 | } |
| 5063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5064 | break; |
| 5065 | } |
| 5066 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5067 | case WE_GET_WDI_DBG: |
| 5068 | { |
| 5069 | wpalTraceDisplay(); |
| 5070 | *value = 0; |
| 5071 | break; |
| 5072 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5073 | |
| 5074 | case WE_GET_SAP_AUTO_CHANNEL_SELECTION: |
| 5075 | { |
| 5076 | *value = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection; |
| 5077 | break; |
| 5078 | } |
| 5079 | case WE_GET_CONCURRENCY_MODE: |
| 5080 | { |
| 5081 | *value = hdd_get_concurrency_mode ( ); |
| 5082 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5083 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("concurrency mode=%d"),*value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5084 | break; |
| 5085 | } |
| 5086 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 5087 | case WE_GET_SCAN_BAND_PREFERENCE: |
| 5088 | { |
| 5089 | sme_GetConfigParam(hHal, &smeConfig); |
| 5090 | *value = smeConfig.csrConfig.scanBandPreference; |
| 5091 | |
| 5092 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5093 | "scanBandPreference = %d\n", *value); |
| 5094 | break; |
| 5095 | } |
| 5096 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5097 | default: |
| 5098 | { |
| 5099 | hddLog(LOGE, "Invalid IOCTL get_value command %d ",value[0]); |
| 5100 | break; |
| 5101 | } |
| 5102 | } |
| 5103 | |
| 5104 | return ret; |
| 5105 | } |
| 5106 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 5107 | static int iw_setnone_getint(struct net_device *dev, |
| 5108 | struct iw_request_info *info, |
| 5109 | union iwreq_data *wrqu, char *extra) |
| 5110 | { |
| 5111 | int ret; |
| 5112 | |
| 5113 | vos_ssr_protect(__func__); |
| 5114 | ret = __iw_setnone_getint(dev, info, wrqu, extra); |
| 5115 | vos_ssr_unprotect(__func__); |
| 5116 | |
| 5117 | return ret; |
| 5118 | |
| 5119 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5120 | /* set param sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 5121 | int __iw_set_three_ints_getnone(struct net_device *dev, |
| 5122 | struct iw_request_info *info, |
| 5123 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5124 | { |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5125 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5126 | int *value = (int *)extra; |
| 5127 | int sub_cmd = value[0]; |
| 5128 | int ret = 0; |
| 5129 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5130 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 5131 | { |
| 5132 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5133 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 5134 | return -EBUSY; |
| 5135 | } |
| 5136 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5137 | switch(sub_cmd) |
| 5138 | { |
| 5139 | case WE_SET_WLAN_DBG: |
| 5140 | { |
| 5141 | vos_trace_setValue( value[1], value[2], value[3]); |
| 5142 | break; |
| 5143 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5144 | case WE_SET_WDI_DBG: |
| 5145 | { |
| 5146 | wpalTraceSetLevel( value[1], value[2], value[3]); |
| 5147 | break; |
| 5148 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5149 | case WE_SET_SAP_CHANNELS: |
| 5150 | { |
| 5151 | ret = iw_softap_set_channel_range( dev, value[1], value[2], value[3]); |
| 5152 | break; |
| 5153 | } |
| 5154 | |
| 5155 | default: |
| 5156 | { |
Jeff Johnson | 11e7703 | 2014-02-14 13:22:22 -0800 | [diff] [blame] | 5157 | hddLog(LOGE, "%s: Invalid IOCTL command %d", __func__, sub_cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5158 | break; |
| 5159 | } |
| 5160 | } |
| 5161 | return ret; |
| 5162 | } |
| 5163 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 5164 | int iw_set_three_ints_getnone(struct net_device *dev, |
| 5165 | struct iw_request_info *info, |
| 5166 | union iwreq_data *wrqu, char *extra) |
| 5167 | { |
| 5168 | int ret; |
| 5169 | |
| 5170 | vos_ssr_protect(__func__); |
| 5171 | ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra); |
| 5172 | vos_ssr_unprotect(__func__); |
| 5173 | |
| 5174 | return ret; |
| 5175 | } |
| 5176 | |
| 5177 | static int __iw_get_char_setnone(struct net_device *dev, |
| 5178 | struct iw_request_info *info, |
| 5179 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5180 | { |
| 5181 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5182 | int sub_cmd = wrqu->data.flags; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5183 | #ifdef WLAN_FEATURE_11W |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5184 | hdd_wext_state_t *pWextState; |
| 5185 | #endif |
| 5186 | |
| 5187 | if (pAdapter == NULL) |
| 5188 | { |
| 5189 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5190 | "%s: pAdapter is NULL!", __func__); |
| 5191 | return -EINVAL; |
| 5192 | } |
| 5193 | #ifdef WLAN_FEATURE_11W |
| 5194 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5195 | #endif |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5196 | |
Yue Ma | 3ede605 | 2013-08-29 00:33:26 -0700 | [diff] [blame] | 5197 | if (NULL == WLAN_HDD_GET_CTX(pAdapter)) |
| 5198 | { |
| 5199 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5200 | "%s: HDD Context is NULL!", __func__); |
| 5201 | |
| 5202 | return -EINVAL; |
| 5203 | } |
| 5204 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5205 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 5206 | { |
| 5207 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5208 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 5209 | return -EBUSY; |
| 5210 | } |
| 5211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5212 | switch(sub_cmd) |
| 5213 | { |
| 5214 | case WE_WLAN_VERSION: |
| 5215 | { |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 5216 | hdd_wlan_get_version(pAdapter, wrqu, extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5217 | break; |
| 5218 | } |
| 5219 | |
| 5220 | case WE_GET_STATS: |
| 5221 | { |
Sandeep Puligilla | 383bbfc | 2014-05-01 15:06:09 +0530 | [diff] [blame] | 5222 | tHalHandle hHal = NULL; |
| 5223 | tpAniSirGlobal pMac = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5224 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5225 | hdd_tx_rx_stats_t *pStats = &pAdapter->hdd_stats.hddTxRxStats; |
| 5226 | hdd_chip_reset_stats_t *pResetStats = &pHddCtx->hddChipResetStats; |
| 5227 | |
Sandeep Puligilla | 383bbfc | 2014-05-01 15:06:09 +0530 | [diff] [blame] | 5228 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5229 | snprintf(extra, WE_MAX_STR_LEN, |
| 5230 | "\nTransmit" |
| 5231 | "\ncalled %u, dropped %u, backpressured %u, queued %u" |
| 5232 | "\n dropped BK %u, BE %u, VI %u, VO %u" |
| 5233 | "\n classified BK %u, BE %u, VI %u, VO %u" |
| 5234 | "\nbackpressured BK %u, BE %u, VI %u, VO %u" |
| 5235 | "\n queued BK %u, BE %u, VI %u, VO %u" |
| 5236 | "\nfetched %u, empty %u, lowres %u, deqerr %u" |
Ravi Joshi | 4191463 | 2013-10-21 23:02:21 -0700 | [diff] [blame] | 5237 | "\ndequeued %u, depressured %u, deque-depressured %u, completed %u, flushed %u" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5238 | "\n fetched BK %u, BE %u, VI %u, VO %u" |
| 5239 | "\n dequeued BK %u, BE %u, VI %u, VO %u" |
| 5240 | "\n depressured BK %u, BE %u, VI %u, VO %u" |
Ravi Joshi | 4191463 | 2013-10-21 23:02:21 -0700 | [diff] [blame] | 5241 | "\nDeque depressured BK %u, BE %u, VI %u, VO %u" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5242 | "\n flushed BK %u, BE %u, VI %u, VO %u" |
| 5243 | "\n\nReceive" |
| 5244 | "\nchains %u, packets %u, dropped %u, delivered %u, refused %u" |
| 5245 | "\n\nResetsStats" |
| 5246 | "\n TotalLogp %u Cmd53 %u MutexRead %u MIF-Error %u FW-Heartbeat %u Others %u" |
| 5247 | "\n", |
| 5248 | pStats->txXmitCalled, |
| 5249 | pStats->txXmitDropped, |
| 5250 | pStats->txXmitBackPressured, |
| 5251 | pStats->txXmitQueued, |
| 5252 | |
| 5253 | pStats->txXmitDroppedAC[WLANTL_AC_BK], |
| 5254 | pStats->txXmitDroppedAC[WLANTL_AC_BE], |
| 5255 | pStats->txXmitDroppedAC[WLANTL_AC_VI], |
| 5256 | pStats->txXmitDroppedAC[WLANTL_AC_VO], |
| 5257 | |
| 5258 | pStats->txXmitClassifiedAC[WLANTL_AC_BK], |
| 5259 | pStats->txXmitClassifiedAC[WLANTL_AC_BE], |
| 5260 | pStats->txXmitClassifiedAC[WLANTL_AC_VI], |
| 5261 | pStats->txXmitClassifiedAC[WLANTL_AC_VO], |
| 5262 | |
| 5263 | pStats->txXmitBackPressuredAC[WLANTL_AC_BK], |
| 5264 | pStats->txXmitBackPressuredAC[WLANTL_AC_BE], |
| 5265 | pStats->txXmitBackPressuredAC[WLANTL_AC_VI], |
| 5266 | pStats->txXmitBackPressuredAC[WLANTL_AC_VO], |
| 5267 | |
| 5268 | pStats->txXmitQueuedAC[WLANTL_AC_BK], |
| 5269 | pStats->txXmitQueuedAC[WLANTL_AC_BE], |
| 5270 | pStats->txXmitQueuedAC[WLANTL_AC_VI], |
| 5271 | pStats->txXmitQueuedAC[WLANTL_AC_VO], |
| 5272 | |
| 5273 | pStats->txFetched, |
| 5274 | pStats->txFetchEmpty, |
| 5275 | pStats->txFetchLowResources, |
| 5276 | pStats->txFetchDequeueError, |
| 5277 | |
| 5278 | pStats->txFetchDequeued, |
| 5279 | pStats->txFetchDePressured, |
Ravi Joshi | 4191463 | 2013-10-21 23:02:21 -0700 | [diff] [blame] | 5280 | pStats->txDequeDePressured, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5281 | pStats->txCompleted, |
| 5282 | pStats->txFlushed, |
| 5283 | |
| 5284 | pStats->txFetchedAC[WLANTL_AC_BK], |
| 5285 | pStats->txFetchedAC[WLANTL_AC_BE], |
| 5286 | pStats->txFetchedAC[WLANTL_AC_VI], |
| 5287 | pStats->txFetchedAC[WLANTL_AC_VO], |
| 5288 | |
| 5289 | pStats->txFetchDequeuedAC[WLANTL_AC_BK], |
| 5290 | pStats->txFetchDequeuedAC[WLANTL_AC_BE], |
| 5291 | pStats->txFetchDequeuedAC[WLANTL_AC_VI], |
| 5292 | pStats->txFetchDequeuedAC[WLANTL_AC_VO], |
| 5293 | |
| 5294 | pStats->txFetchDePressuredAC[WLANTL_AC_BK], |
| 5295 | pStats->txFetchDePressuredAC[WLANTL_AC_BE], |
| 5296 | pStats->txFetchDePressuredAC[WLANTL_AC_VI], |
| 5297 | pStats->txFetchDePressuredAC[WLANTL_AC_VO], |
| 5298 | |
Ravi Joshi | 4191463 | 2013-10-21 23:02:21 -0700 | [diff] [blame] | 5299 | pStats->txDequeDePressuredAC[WLANTL_AC_BK], |
| 5300 | pStats->txDequeDePressuredAC[WLANTL_AC_BE], |
| 5301 | pStats->txDequeDePressuredAC[WLANTL_AC_VI], |
| 5302 | pStats->txDequeDePressuredAC[WLANTL_AC_VO], |
| 5303 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5304 | pStats->txFlushedAC[WLANTL_AC_BK], |
| 5305 | pStats->txFlushedAC[WLANTL_AC_BE], |
| 5306 | pStats->txFlushedAC[WLANTL_AC_VI], |
| 5307 | pStats->txFlushedAC[WLANTL_AC_VO], |
| 5308 | |
| 5309 | pStats->rxChains, |
| 5310 | pStats->rxPackets, |
| 5311 | pStats->rxDropped, |
| 5312 | pStats->rxDelivered, |
| 5313 | pStats->rxRefused, |
| 5314 | |
| 5315 | pResetStats->totalLogpResets, |
| 5316 | pResetStats->totalCMD53Failures, |
| 5317 | pResetStats->totalMutexReadFailures, |
| 5318 | pResetStats->totalMIFErrorFailures, |
| 5319 | pResetStats->totalFWHearbeatFailures, |
| 5320 | pResetStats->totalUnknownExceptions |
| 5321 | ); |
Sandeep Puligilla | 383bbfc | 2014-05-01 15:06:09 +0530 | [diff] [blame] | 5322 | wrqu->data.length = strlen(extra); |
| 5323 | |
| 5324 | hHal = WLAN_HDD_GET_HAL_CTX( pAdapter ); |
| 5325 | |
| 5326 | if (hHal) |
| 5327 | pMac = PMAC_STRUCT( hHal ); |
| 5328 | |
| 5329 | if (pMac && (wrqu->data.length < WE_MAX_STR_LEN)) { |
| 5330 | __u32 pmmStatsLength = WE_MAX_STR_LEN - wrqu->data.length; |
| 5331 | snprintf(extra+wrqu->data.length, pmmStatsLength, |
Rajesh Babu Prathipati | 6aa7cb8 | 2014-06-02 09:56:59 +0530 | [diff] [blame] | 5332 | "\n BMPS sleepcnt %lld, BMPS awakecnt %lld" |
| 5333 | "\n BMPS sleepreqfailcnt %lld, BMPS wakeupreqfailcnt %lld" |
| 5334 | "\n IMPS sleepcnt %lld, IMPS awakecnt %lld" |
| 5335 | "\n IMPS sleepreqfailcnt %lld, IMPS wakeupreqfailcnt %lld, IMPS lasterr %lld" |
Sandeep Puligilla | 383bbfc | 2014-05-01 15:06:09 +0530 | [diff] [blame] | 5336 | "\n", |
| 5337 | pMac->pmm.BmpscntSleep, |
| 5338 | pMac->pmm.BmpscntAwake, |
| 5339 | pMac->pmm.BmpsSleeReqFailCnt, |
| 5340 | pMac->pmm.BmpsWakeupReqFailCnt, |
| 5341 | pMac->pmm.ImpsCntSleep, |
| 5342 | pMac->pmm.ImpsCntAwake, |
| 5343 | pMac->pmm.ImpsSleepErrCnt, |
| 5344 | pMac->pmm.ImpsWakeupErrCnt, |
| 5345 | pMac->pmm.ImpsLastErr |
| 5346 | ); |
| 5347 | } |
| 5348 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5349 | wrqu->data.length = strlen(extra)+1; |
| 5350 | break; |
| 5351 | } |
| 5352 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5353 | /* The case prints the current state of the HDD, SME, CSR, PE, TL |
| 5354 | *it can be extended for WDI Global State as well. |
| 5355 | *And currently it only checks P2P_CLIENT adapter. |
| 5356 | *P2P_DEVICE and P2P_GO have not been added as of now. |
| 5357 | */ |
| 5358 | case WE_GET_STATES: |
| 5359 | { |
| 5360 | int buf = 0, len = 0; |
| 5361 | int adapter_num = 0; |
| 5362 | int count = 0, check = 1; |
| 5363 | |
| 5364 | tANI_U16 tlState; |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5365 | tHalHandle hHal = NULL; |
| 5366 | tpAniSirGlobal pMac = NULL; |
| 5367 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5368 | |
| 5369 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 5370 | hdd_adapter_t *useAdapter = NULL; |
| 5371 | |
| 5372 | /* Print wlan0 or p2p0 states based on the adapter_num |
| 5373 | *by using the correct adapter |
| 5374 | */ |
| 5375 | while ( adapter_num < 2 ) |
| 5376 | { |
| 5377 | if ( WLAN_ADAPTER == adapter_num ) |
| 5378 | { |
| 5379 | useAdapter = pAdapter; |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5380 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5381 | "\n\n wlan0 States:-"); |
| 5382 | len += buf; |
| 5383 | } |
| 5384 | else if ( P2P_ADAPTER == adapter_num ) |
| 5385 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5386 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5387 | "\n\n p2p0 States:-"); |
| 5388 | len += buf; |
| 5389 | |
| 5390 | if( !pHddCtx ) |
| 5391 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5392 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5393 | "\n pHddCtx is NULL"); |
| 5394 | len += buf; |
| 5395 | break; |
| 5396 | } |
| 5397 | |
| 5398 | /*Printing p2p0 states only in the case when the device is |
| 5399 | configured as a p2p_client*/ |
| 5400 | useAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 5401 | if ( !useAdapter ) |
| 5402 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5403 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5404 | "\n Device not configured as P2P_CLIENT."); |
| 5405 | len += buf; |
| 5406 | break; |
| 5407 | } |
| 5408 | } |
| 5409 | |
| 5410 | hHal = WLAN_HDD_GET_HAL_CTX( useAdapter ); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5411 | if (!hHal) { |
| 5412 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 5413 | "\n pMac is NULL"); |
| 5414 | len += buf; |
| 5415 | break; |
| 5416 | } |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5417 | pMac = PMAC_STRUCT( hHal ); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5418 | if (!pMac) { |
| 5419 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 5420 | "\n pMac is NULL"); |
| 5421 | len += buf; |
| 5422 | break; |
| 5423 | } |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5424 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR( useAdapter ); |
| 5425 | if( !pHddStaCtx ) |
| 5426 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5427 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5428 | "\n pHddStaCtx is NULL"); |
| 5429 | len += buf; |
| 5430 | break; |
| 5431 | } |
| 5432 | |
| 5433 | tlState = smeGetTLSTAState(hHal, pHddStaCtx->conn_info.staId[0]); |
| 5434 | |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5435 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5436 | "\n HDD Conn State - %s " |
| 5437 | "\n \n SME State:" |
| 5438 | "\n Neighbour Roam State - %s" |
| 5439 | "\n CSR State - %s" |
| 5440 | "\n CSR Substate - %s" |
| 5441 | "\n \n TL STA %d State: %s", |
| 5442 | macTraceGetHDDWlanConnState( |
| 5443 | pHddStaCtx->conn_info.connState), |
| 5444 | macTraceGetNeighbourRoamState( |
| 5445 | pMac->roam.neighborRoamInfo.neighborRoamState), |
| 5446 | macTraceGetcsrRoamState( |
| 5447 | pMac->roam.curState[useAdapter->sessionId]), |
| 5448 | macTraceGetcsrRoamSubState( |
| 5449 | pMac->roam.curSubState[useAdapter->sessionId]), |
| 5450 | pHddStaCtx->conn_info.staId[0], |
| 5451 | macTraceGetTLState(tlState) |
| 5452 | ); |
| 5453 | len += buf; |
| 5454 | adapter_num++; |
| 5455 | } |
| 5456 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5457 | if (pMac) { |
| 5458 | /* Printing Lim State starting with global lim states */ |
| 5459 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 5460 | "\n \n LIM STATES:-" |
| 5461 | "\n Global Sme State - %s "\ |
| 5462 | "\n Global mlm State - %s "\ |
| 5463 | "\n", |
| 5464 | macTraceGetLimSmeState(pMac->lim.gLimSmeState), |
| 5465 | macTraceGetLimMlmState(pMac->lim.gLimMlmState) |
| 5466 | ); |
| 5467 | len += buf; |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5468 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5469 | /*printing the PE Sme and Mlm states for valid lim sessions*/ |
| 5470 | while ( check < 3 && count < 255) |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5471 | { |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5472 | if ( pMac->lim.gpSession[count].valid ) |
| 5473 | { |
| 5474 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 5475 | "\n Lim Valid Session %d:-" |
| 5476 | "\n PE Sme State - %s " |
| 5477 | "\n PE Mlm State - %s " |
| 5478 | "\n", |
| 5479 | check, |
| 5480 | macTraceGetLimSmeState(pMac->lim.gpSession[count].limSmeState), |
| 5481 | macTraceGetLimMlmState(pMac->lim.gpSession[count].limMlmState) |
| 5482 | ); |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5483 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5484 | len += buf; |
| 5485 | check++; |
| 5486 | } |
| 5487 | count++; |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5488 | } |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5489 | } |
| 5490 | |
| 5491 | wrqu->data.length = strlen(extra)+1; |
| 5492 | break; |
| 5493 | } |
| 5494 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5495 | case WE_GET_CFG: |
| 5496 | { |
| 5497 | hdd_cfg_get_config(WLAN_HDD_GET_CTX(pAdapter), extra, WE_MAX_STR_LEN); |
| 5498 | wrqu->data.length = strlen(extra)+1; |
| 5499 | break; |
| 5500 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5501 | #ifdef WLAN_FEATURE_11AC |
| 5502 | case WE_GET_RSSI: |
| 5503 | { |
| 5504 | v_S7_t s7Rssi = 0; |
| 5505 | wlan_hdd_get_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 |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5511 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5512 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 5513 | case WE_GET_ROAM_RSSI: |
| 5514 | { |
| 5515 | v_S7_t s7Rssi = 0; |
| 5516 | wlan_hdd_get_roam_rssi(pAdapter, &s7Rssi); |
| 5517 | snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi); |
| 5518 | wrqu->data.length = strlen(extra)+1; |
| 5519 | break; |
| 5520 | } |
| 5521 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5522 | case WE_GET_WMM_STATUS: |
| 5523 | { |
| 5524 | snprintf(extra, WE_MAX_STR_LEN, |
| 5525 | "\nDir: 0=up, 1=down, 3=both\n" |
| 5526 | "|------------------------|\n" |
| 5527 | "|AC | ACM |Admitted| Dir |\n" |
| 5528 | "|------------------------|\n" |
| 5529 | "|VO | %d | %3s | %d |\n" |
| 5530 | "|VI | %d | %3s | %d |\n" |
| 5531 | "|BE | %d | %3s | %d |\n" |
| 5532 | "|BK | %d | %3s | %d |\n" |
| 5533 | "|------------------------|\n", |
| 5534 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessRequired, |
| 5535 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessAllowed?"YES":"NO", |
| 5536 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcTspecInfo.ts_info.direction, |
| 5537 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessRequired, |
| 5538 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessAllowed?"YES":"NO", |
| 5539 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcTspecInfo.ts_info.direction, |
| 5540 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessRequired, |
| 5541 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessAllowed?"YES":"NO", |
| 5542 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcTspecInfo.ts_info.direction, |
| 5543 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessRequired, |
| 5544 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessAllowed?"YES":"NO", |
| 5545 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcTspecInfo.ts_info.direction); |
| 5546 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5547 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5548 | wrqu->data.length = strlen(extra)+1; |
| 5549 | break; |
| 5550 | } |
| 5551 | case WE_GET_CHANNEL_LIST: |
| 5552 | { |
| 5553 | VOS_STATUS status; |
| 5554 | v_U8_t i, len; |
| 5555 | char* buf ; |
Sushant Kaushik | 10315f9 | 2014-04-29 11:30:25 +0530 | [diff] [blame] | 5556 | tANI_U8 pBuf[COUNTRY_CODE_LEN]; |
| 5557 | tANI_U8 uBufLen = COUNTRY_CODE_LEN; |
| 5558 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5559 | tChannelListInfo channel_list; |
| 5560 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5561 | memset(&channel_list, 0, sizeof(channel_list)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5562 | status = iw_softap_get_channel_list(dev, info, wrqu, (char *)&channel_list); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5563 | if ( !VOS_IS_STATUS_SUCCESS( status ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5564 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5565 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s GetChannelList Failed!!!",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5566 | return -EINVAL; |
| 5567 | } |
| 5568 | buf = extra; |
| 5569 | |
| 5570 | /** |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5571 | * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN. Maximum buffer |
| 5572 | * needed = 5 * number of channels. Check ifsufficient |
| 5573 | * buffer is available and then proceed to fill the buffer. |
| 5574 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5575 | if(WE_MAX_STR_LEN < (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) |
| 5576 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5577 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5578 | "%s Insufficient Buffer to populate channel list", |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5579 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5580 | return -EINVAL; |
| 5581 | } |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5582 | len = scnprintf(buf, WE_MAX_STR_LEN, "%u ", |
| 5583 | channel_list.num_channels); |
Sushant Kaushik | 10315f9 | 2014-04-29 11:30:25 +0530 | [diff] [blame] | 5584 | if( eHAL_STATUS_SUCCESS == sme_GetCountryCode(pHddCtx->hHal, pBuf, &uBufLen)) |
| 5585 | { |
| 5586 | //Printing Country code in getChannelList |
| 5587 | for(i= 0; i < COUNTRY_CODE_LEN; i++) |
| 5588 | { |
| 5589 | len += scnprintf(buf + len, WE_MAX_STR_LEN - len, |
| 5590 | "%c ", pBuf[i]); |
| 5591 | } |
| 5592 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5593 | for(i = 0 ; i < channel_list.num_channels; i++) |
| 5594 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 5595 | len += scnprintf(buf + len, WE_MAX_STR_LEN - len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5596 | "%u ", channel_list.channels[i]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5597 | } |
| 5598 | wrqu->data.length = strlen(extra)+1; |
| 5599 | |
| 5600 | break; |
| 5601 | } |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 5602 | #ifdef FEATURE_WLAN_TDLS |
| 5603 | case WE_GET_TDLS_PEERS: |
| 5604 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 5605 | wrqu->data.length = wlan_hdd_tdls_get_all_peers(pAdapter, extra, WE_MAX_STR_LEN)+1; |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 5606 | break; |
| 5607 | } |
| 5608 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 5609 | #ifdef WLAN_FEATURE_11W |
| 5610 | case WE_GET_11W_INFO: |
| 5611 | { |
| 5612 | hddLog(LOGE, "WE_GET_11W_ENABLED = %d", pWextState->roamProfile.MFPEnabled ); |
| 5613 | |
| 5614 | snprintf(extra, WE_MAX_STR_LEN, |
| 5615 | "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d" |
| 5616 | "\n Number of Unprotected Disassocs %d" |
| 5617 | "\n Number of Unprotected Deauths %d", |
| 5618 | (*pWextState->roamProfile.BSSIDs.bssid)[0], (*pWextState->roamProfile.BSSIDs.bssid)[1], |
| 5619 | (*pWextState->roamProfile.BSSIDs.bssid)[2], (*pWextState->roamProfile.BSSIDs.bssid)[3], |
| 5620 | (*pWextState->roamProfile.BSSIDs.bssid)[4], (*pWextState->roamProfile.BSSIDs.bssid)[5], |
| 5621 | pWextState->roamProfile.MFPEnabled, pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx, |
| 5622 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx); |
| 5623 | |
| 5624 | wrqu->data.length = strlen(extra)+1; |
| 5625 | break; |
| 5626 | } |
| 5627 | #endif |
Girish Gowli | dab72f1 | 2014-09-04 15:34:43 +0530 | [diff] [blame] | 5628 | case WE_GET_SNR: |
| 5629 | { |
| 5630 | v_S7_t s7snr = 0; |
| 5631 | int status = 0; |
| 5632 | hdd_context_t *pHddCtx; |
| 5633 | hdd_station_ctx_t *pHddStaCtx; |
| 5634 | |
| 5635 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5636 | status = wlan_hdd_validate_context(pHddCtx); |
| 5637 | if (0 != status) |
| 5638 | { |
| 5639 | hddLog(LOGE, "%s: getSNR: HDD context is not valid", __func__); |
| 5640 | return status; |
| 5641 | } |
| 5642 | |
| 5643 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5644 | |
| 5645 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
| 5646 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 5647 | { |
| 5648 | hddLog(LOGE, "%s: getSNR failed: Enable SNR Monitoring-%d," |
| 5649 | " ConnectionState-%d", __func__, |
| 5650 | pHddCtx->cfg_ini->fEnableSNRMonitoring, |
| 5651 | pHddStaCtx->conn_info.connState); |
| 5652 | return -ENONET; |
| 5653 | } |
| 5654 | |
| 5655 | /*update the stats in TL*/ |
| 5656 | wlan_hdd_get_station_stats(pAdapter); |
| 5657 | wlan_hdd_get_snr(pAdapter, &s7snr); |
| 5658 | snprintf(extra, WE_MAX_STR_LEN, "snr=%d",s7snr); |
| 5659 | wrqu->data.length = strlen(extra) + 1; |
| 5660 | break; |
| 5661 | } |
| 5662 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5663 | default: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5664 | { |
Jeff Johnson | 11e7703 | 2014-02-14 13:22:22 -0800 | [diff] [blame] | 5665 | hddLog(LOGE, "%s: Invalid IOCTL command %d", __func__, sub_cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5666 | break; |
| 5667 | } |
| 5668 | } |
| 5669 | |
| 5670 | return 0; |
| 5671 | } |
| 5672 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 5673 | static int iw_get_char_setnone(struct net_device *dev, |
| 5674 | struct iw_request_info *info, |
| 5675 | union iwreq_data *wrqu, char *extra) |
| 5676 | { |
| 5677 | int ret; |
| 5678 | |
| 5679 | vos_ssr_protect(__func__); |
| 5680 | ret = __iw_get_char_setnone(dev, info, wrqu, extra); |
| 5681 | vos_ssr_unprotect(__func__); |
| 5682 | |
| 5683 | return ret; |
| 5684 | } |
| 5685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5686 | /* action sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 5687 | static int __iw_setnone_getnone(struct net_device *dev, |
| 5688 | struct iw_request_info *info, |
| 5689 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5690 | { |
| 5691 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Girish Gowli | baf3f2b | 2014-06-14 18:02:54 +0530 | [diff] [blame] | 5692 | int sub_cmd; |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 5693 | int ret = 0; /* success */ |
Girish Gowli | baf3f2b | 2014-06-14 18:02:54 +0530 | [diff] [blame] | 5694 | struct iw_point s_priv_data; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5695 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5696 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 5697 | { |
| 5698 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5699 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 5700 | return -EBUSY; |
| 5701 | } |
| 5702 | |
Girish Gowli | baf3f2b | 2014-06-14 18:02:54 +0530 | [diff] [blame] | 5703 | /* helper function to get iwreq_data with compat handling. */ |
| 5704 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 5705 | { |
| 5706 | return -EINVAL; |
| 5707 | } |
| 5708 | |
| 5709 | sub_cmd = s_priv_data.flags; |
| 5710 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5711 | switch (sub_cmd) |
| 5712 | { |
| 5713 | case WE_CLEAR_STATS: |
| 5714 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5715 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: clearing", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5716 | memset(&pAdapter->stats, 0, sizeof(pAdapter->stats)); |
| 5717 | memset(&pAdapter->hdd_stats, 0, sizeof(pAdapter->hdd_stats)); |
| 5718 | break; |
| 5719 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5720 | case WE_INIT_AP: |
| 5721 | { |
Abhishek Singh | 98d2f80 | 2014-02-10 15:47:55 +0530 | [diff] [blame] | 5722 | /*FIX ME: Need to be revisited if multiple SAPs to be supported */ |
| 5723 | |
| 5724 | /* As Soft AP mode might been changed to STA already with |
| 5725 | * killing of Hostapd, need to find the adpater by name |
| 5726 | * rather than mode */ |
| 5727 | hdd_adapter_t* pAdapter_to_stop = |
| 5728 | hdd_get_adapter_by_name(WLAN_HDD_GET_CTX(pAdapter), "softap.0"); |
| 5729 | if( pAdapter_to_stop ) |
| 5730 | { |
| 5731 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5732 | "Adapter with name softap.0 already " |
| 5733 | "exist, ignoring the request.\nRemove the " |
| 5734 | "adapter and try again\n"); |
| 5735 | break; |
| 5736 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5737 | pr_info("Init AP trigger\n"); |
| 5738 | hdd_open_adapter( WLAN_HDD_GET_CTX(pAdapter), WLAN_HDD_SOFTAP, "softap.%d", |
| 5739 | wlan_hdd_get_intf_addr( WLAN_HDD_GET_CTX(pAdapter) ),TRUE); |
| 5740 | break; |
| 5741 | } |
| 5742 | case WE_STOP_AP: |
| 5743 | { |
| 5744 | /*FIX ME: Need to be revisited if multiple SAPs to be supported */ |
| 5745 | /* As Soft AP mode has been changed to STA already with killing of Hostapd, |
| 5746 | * this is a dead code and need to find the adpater by name rather than mode */ |
| 5747 | hdd_adapter_t* pAdapter_to_stop = |
| 5748 | hdd_get_adapter_by_name(WLAN_HDD_GET_CTX(pAdapter), "softap.0"); |
| 5749 | if( pAdapter_to_stop ) |
| 5750 | { |
| 5751 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5752 | |
| 5753 | pr_info("Stopping AP mode\n"); |
| 5754 | |
Gopichand Nakkala | fe7246d | 2013-06-10 17:43:37 +0530 | [diff] [blame] | 5755 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 5756 | { |
| 5757 | /* EXIT BMPS as fw cannot handle DEL_STA when its in BMPS */ |
| 5758 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE); |
| 5759 | } |
| 5760 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5761 | /*Make sure that pAdapter cleaned properly*/ |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 5762 | hdd_stop_adapter( pHddCtx, pAdapter_to_stop, VOS_TRUE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5763 | hdd_deinit_adapter( pHddCtx, pAdapter_to_stop ); |
| 5764 | memset(&pAdapter_to_stop->sessionCtx, 0, sizeof(pAdapter_to_stop->sessionCtx)); |
| 5765 | |
| 5766 | wlan_hdd_release_intf_addr(WLAN_HDD_GET_CTX(pAdapter), |
| 5767 | pAdapter_to_stop->macAddressCurrent.bytes); |
| 5768 | hdd_close_adapter(WLAN_HDD_GET_CTX(pAdapter), pAdapter_to_stop, |
| 5769 | TRUE); |
Gopichand Nakkala | fe7246d | 2013-06-10 17:43:37 +0530 | [diff] [blame] | 5770 | |
| 5771 | if (FALSE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 5772 | { |
| 5773 | /* put the device back into BMPS */ |
| 5774 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO); |
| 5775 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5776 | } |
| 5777 | else |
| 5778 | { |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 5779 | printk(KERN_ERR"SAP adapter not found to stop it!\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5780 | } |
| 5781 | |
| 5782 | break; |
| 5783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5784 | #ifdef WLAN_BTAMP_FEATURE |
| 5785 | case WE_ENABLE_AMP: |
| 5786 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5787 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: enabling AMP", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5788 | WLANBAP_RegisterWithHCI(pAdapter); |
| 5789 | break; |
| 5790 | } |
| 5791 | case WE_DISABLE_AMP: |
| 5792 | { |
| 5793 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 5794 | VOS_STATUS status; |
| 5795 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5796 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: disabling AMP", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5797 | |
| 5798 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 5799 | status = WLANBAP_StopAmp(); |
| 5800 | if(VOS_STATUS_SUCCESS != status ) |
| 5801 | { |
| 5802 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 5803 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 5804 | "%s: Failed to stop AMP", __func__); |
| 5805 | } |
| 5806 | else |
| 5807 | { |
| 5808 | //a state m/c implementation in PAL is TBD to avoid this delay |
| 5809 | msleep(500); |
| 5810 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 5811 | WLANBAP_DeregisterFromHCI(); |
| 5812 | } |
| 5813 | |
| 5814 | break; |
| 5815 | } |
| 5816 | #endif |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 5817 | case WE_ENABLE_DXE_STALL_DETECT: |
| 5818 | { |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 5819 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5820 | sme_transportDebug(hHal, VOS_FALSE, VOS_TRUE); |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 5821 | break; |
| 5822 | } |
| 5823 | case WE_DISPLAY_DXE_SNAP_SHOT: |
| 5824 | { |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 5825 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5826 | sme_transportDebug(hHal, VOS_TRUE, VOS_FALSE); |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 5827 | break; |
| 5828 | } |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 5829 | case WE_DISPLAY_DATAPATH_SNAP_SHOT: |
| 5830 | { |
| 5831 | hddLog(LOGE, "%s: called %d",__func__, sub_cmd); |
| 5832 | hdd_wmm_tx_snapshot(pAdapter); |
| 5833 | WLANTL_TLDebugMessage(VOS_TRUE); |
| 5834 | break; |
| 5835 | } |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 5836 | |
Sandeep Puligilla | a3e7695 | 2014-06-23 15:53:11 +0530 | [diff] [blame] | 5837 | case WE_SET_REASSOC_TRIGGER: |
| 5838 | { |
| 5839 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5840 | tpAniSirGlobal pMac = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5841 | v_U32_t roamId = 0; |
| 5842 | tCsrRoamModifyProfileFields modProfileFields; |
| 5843 | sme_GetModifyProfileFields(pMac, pAdapter->sessionId, &modProfileFields); |
| 5844 | sme_RoamReassoc(pMac, pAdapter->sessionId, NULL, modProfileFields, &roamId, 1); |
| 5845 | return 0; |
| 5846 | } |
| 5847 | |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 5848 | case WE_STOP_OBSS_SCAN: |
| 5849 | { |
| 5850 | /* 1.OBSS Scan is mandatory while operating in 2.4GHz |
| 5851 | 2.OBSS scan is stopped by Firmware during the disassociation |
| 5852 | 3.OBSS stop comamnd is added for debugging purpose*/ |
| 5853 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5854 | tpAniSirGlobal pMac; |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 5855 | |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 5856 | if (pAdapter == NULL) |
| 5857 | { |
| 5858 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5859 | " pAdapter is NULL "); |
Kaushik, Sushant | df30db2 | 2014-05-05 12:14:33 +0530 | [diff] [blame] | 5860 | return -EINVAL; |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 5861 | } |
| 5862 | pMac = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5863 | if (pMac == NULL) |
| 5864 | { |
| 5865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5866 | " pMac is NULL "); |
Kaushik, Sushant | df30db2 | 2014-05-05 12:14:33 +0530 | [diff] [blame] | 5867 | return -EINVAL; |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 5868 | } |
| 5869 | sme_HT40StopOBSSScan(pMac, pAdapter->sessionId); |
| 5870 | } |
| 5871 | break; |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 5872 | #ifdef DEBUG_ROAM_DELAY |
| 5873 | case WE_DUMP_ROAM_TIMER_LOG: |
| 5874 | { |
| 5875 | vos_dump_roam_time_log_service(); |
| 5876 | break; |
| 5877 | } |
Sandeep Puligilla | a3e7695 | 2014-06-23 15:53:11 +0530 | [diff] [blame] | 5878 | |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 5879 | case WE_RESET_ROAM_TIMER_LOG: |
| 5880 | { |
| 5881 | vos_reset_roam_timer_log(); |
| 5882 | break; |
| 5883 | } |
| 5884 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5885 | default: |
| 5886 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5887 | hddLog(LOGE, "%s: unknown ioctl %d", __func__, sub_cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5888 | break; |
| 5889 | } |
| 5890 | } |
| 5891 | |
| 5892 | return ret; |
| 5893 | } |
| 5894 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 5895 | static int iw_setnone_getnone(struct net_device *dev, |
| 5896 | struct iw_request_info *info, |
| 5897 | union iwreq_data *wrqu, char *extra) |
| 5898 | { |
| 5899 | int ret; |
| 5900 | |
| 5901 | vos_ssr_protect(__func__); |
| 5902 | ret = __iw_setnone_getnone(dev, info, wrqu, extra); |
| 5903 | vos_ssr_unprotect(__func__); |
| 5904 | |
| 5905 | return ret; |
| 5906 | } |
| 5907 | |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 5908 | void hdd_wmm_tx_snapshot(hdd_adapter_t *pAdapter) |
| 5909 | { |
| 5910 | /* |
| 5911 | * Function to display HDD WMM information |
| 5912 | * for Tx Queues. |
| 5913 | * Prints globala as well as per client depending |
| 5914 | * whether the clients are registered or not. |
| 5915 | */ |
| 5916 | int i = 0, j = 0; |
| 5917 | for ( i=0; i< NUM_TX_QUEUES; i++) |
| 5918 | { |
Madan Mohan Koyyalamudi | 2be9f0c | 2013-07-25 16:30:37 +0530 | [diff] [blame] | 5919 | spin_lock_bh(&pAdapter->wmm_tx_queue[i].lock); |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5920 | hddLog(LOGE, "HDD WMM TxQueue Info For AC: %d Count: %d PrevAdress:%p, NextAddress:%p", |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 5921 | i, pAdapter->wmm_tx_queue[i].count, |
| 5922 | pAdapter->wmm_tx_queue[i].anchor.prev, pAdapter->wmm_tx_queue[i].anchor.next); |
Madan Mohan Koyyalamudi | 2be9f0c | 2013-07-25 16:30:37 +0530 | [diff] [blame] | 5923 | spin_unlock_bh(&pAdapter->wmm_tx_queue[i].lock); |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 5924 | } |
| 5925 | |
| 5926 | for(i =0; i<WLAN_MAX_STA_COUNT; i++) |
| 5927 | { |
| 5928 | if(pAdapter->aStaInfo[i].isUsed) |
| 5929 | { |
| 5930 | hddLog(LOGE, "******STAIndex: %d*********", i); |
| 5931 | for ( j=0; j< NUM_TX_QUEUES; j++) |
| 5932 | { |
Madan Mohan Koyyalamudi | 2be9f0c | 2013-07-25 16:30:37 +0530 | [diff] [blame] | 5933 | spin_lock_bh(&pAdapter->aStaInfo[i].wmm_tx_queue[j].lock); |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 5934 | hddLog(LOGE, "HDD TxQueue Info For AC: %d Count: %d PrevAdress:%p, NextAddress:%p", |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 5935 | j, pAdapter->aStaInfo[i].wmm_tx_queue[j].count, |
| 5936 | pAdapter->aStaInfo[i].wmm_tx_queue[j].anchor.prev, |
| 5937 | pAdapter->aStaInfo[i].wmm_tx_queue[j].anchor.next); |
Madan Mohan Koyyalamudi | 2be9f0c | 2013-07-25 16:30:37 +0530 | [diff] [blame] | 5938 | spin_unlock_bh(&pAdapter->aStaInfo[i].wmm_tx_queue[j].lock); |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 5939 | } |
| 5940 | } |
| 5941 | } |
| 5942 | |
| 5943 | } |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 5944 | int __iw_set_var_ints_getnone(struct net_device *dev, |
| 5945 | struct iw_request_info *info, |
| 5946 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5947 | { |
| 5948 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5949 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Girish Gowli | d4522fd | 2014-06-14 17:20:27 +0530 | [diff] [blame] | 5950 | int sub_cmd; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5951 | int apps_args[MAX_VAR_ARGS] = {0}; |
Girish Gowli | d4522fd | 2014-06-14 17:20:27 +0530 | [diff] [blame] | 5952 | int num_args; |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 5953 | hdd_station_ctx_t *pStaCtx = NULL ; |
Mahesh A Saptasagar | 178ab1d | 2014-09-08 15:11:05 +0530 | [diff] [blame] | 5954 | hdd_context_t *pHddCtx = NULL; |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 5955 | hdd_ap_ctx_t *pAPCtx = NULL; |
| 5956 | int cmd = 0; |
| 5957 | int staId = 0; |
Mahesh A Saptasagar | 178ab1d | 2014-09-08 15:11:05 +0530 | [diff] [blame] | 5958 | int ret = 0; |
Girish Gowli | d4522fd | 2014-06-14 17:20:27 +0530 | [diff] [blame] | 5959 | struct iw_point s_priv_data; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5960 | |
Girish Gowli | d4522fd | 2014-06-14 17:20:27 +0530 | [diff] [blame] | 5961 | /* helper function to get iwreq_data with compat handling. */ |
| 5962 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 5963 | { |
| 5964 | return -EINVAL; |
| 5965 | } |
| 5966 | |
| 5967 | if (NULL == s_priv_data.pointer) |
| 5968 | { |
| 5969 | return -EINVAL; |
| 5970 | } |
| 5971 | |
| 5972 | sub_cmd = s_priv_data.flags; |
| 5973 | num_args = s_priv_data.length; |
| 5974 | |
| 5975 | hddLog(LOG1, "%s: Received length %d", __func__, s_priv_data.length); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5976 | |
Mahesh A Saptasagar | 178ab1d | 2014-09-08 15:11:05 +0530 | [diff] [blame] | 5977 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5978 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5979 | if (0 != ret) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5980 | { |
Mahesh A Saptasagar | 178ab1d | 2014-09-08 15:11:05 +0530 | [diff] [blame] | 5981 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5982 | "%s: HDD context is Null", __func__); |
| 5983 | return ret; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5984 | } |
| 5985 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5986 | if (num_args > MAX_VAR_ARGS) |
| 5987 | { |
| 5988 | num_args = MAX_VAR_ARGS; |
| 5989 | } |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 5990 | |
| 5991 | /* ODD number is used for set, copy data using copy_from_user */ |
Girish Gowli | d4522fd | 2014-06-14 17:20:27 +0530 | [diff] [blame] | 5992 | if (copy_from_user(apps_args, s_priv_data.pointer, (sizeof(int)) * num_args)) |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 5993 | { |
| 5994 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5995 | "%s: failed to copy data to user buffer", __func__); |
| 5996 | return -EFAULT; |
| 5997 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5998 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 5999 | if(( sub_cmd == WE_MCC_CONFIG_CREDENTIAL ) || |
| 6000 | (sub_cmd == WE_MCC_CONFIG_PARAMS )) |
| 6001 | { |
| 6002 | if(( pAdapter->device_mode == WLAN_HDD_INFRA_STATION )|| |
| 6003 | ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT )) |
| 6004 | { |
| 6005 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6006 | staId = pStaCtx->conn_info.staId[0]; |
| 6007 | } |
| 6008 | else if (( pAdapter->device_mode == WLAN_HDD_P2P_GO ) || |
| 6009 | ( pAdapter->device_mode == WLAN_HDD_SOFTAP )) |
| 6010 | { |
| 6011 | pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 6012 | staId = pAPCtx->uBCStaId; |
| 6013 | } |
| 6014 | else |
| 6015 | { |
| 6016 | hddLog(LOGE, "%s: Device mode %d not recognised", __FUNCTION__, pAdapter->device_mode); |
| 6017 | return 0; |
| 6018 | } |
| 6019 | } |
| 6020 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6021 | switch (sub_cmd) |
| 6022 | { |
| 6023 | case WE_LOG_DUMP_CMD: |
| 6024 | { |
| 6025 | hddLog(LOG1, "%s: LOG_DUMP %d arg1 %d arg2 %d arg3 %d arg4 %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6026 | __func__, apps_args[0], apps_args[1], apps_args[2], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6027 | apps_args[3], apps_args[4]); |
| 6028 | |
| 6029 | logPrintf(hHal, apps_args[0], apps_args[1], apps_args[2], |
| 6030 | apps_args[3], apps_args[4]); |
| 6031 | |
| 6032 | } |
| 6033 | break; |
| 6034 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6035 | case WE_P2P_NOA_CMD: |
| 6036 | { |
| 6037 | p2p_app_setP2pPs_t p2pNoA; |
| 6038 | |
| 6039 | p2pNoA.opp_ps = apps_args[0]; |
| 6040 | p2pNoA.ctWindow = apps_args[1]; |
| 6041 | p2pNoA.duration = apps_args[2]; |
| 6042 | p2pNoA.interval = apps_args[3]; |
| 6043 | p2pNoA.count = apps_args[4]; |
| 6044 | p2pNoA.single_noa_duration = apps_args[5]; |
| 6045 | p2pNoA.psSelection = apps_args[6]; |
| 6046 | |
| 6047 | hddLog(LOG1, "%s: P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d " |
| 6048 | "interval %d count %d single noa duration %d PsSelection %x", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6049 | __func__, apps_args[0], apps_args[1], apps_args[2], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6050 | apps_args[3], apps_args[4], apps_args[5], apps_args[6]); |
| 6051 | |
| 6052 | hdd_setP2pPs(dev, &p2pNoA); |
| 6053 | |
| 6054 | } |
| 6055 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6056 | |
Katya Nigam | c2f29dc | 2014-01-20 19:29:30 +0530 | [diff] [blame] | 6057 | case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD: |
| 6058 | { |
| 6059 | hddLog(LOG1, "%s: SELECTIVE_MODULE_LOG %d arg1 %d arg2", |
| 6060 | __func__, apps_args[0], apps_args[1]); |
| 6061 | vosTraceEnable(apps_args[0], apps_args[1]); |
| 6062 | } |
| 6063 | break; |
| 6064 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 6065 | case WE_MTRACE_DUMP_CMD: |
| 6066 | { |
| 6067 | hddLog(LOG1, "%s: MTRACE_DUMP code %d session %d count %d " |
| 6068 | "bitmask_of_module %d ", |
| 6069 | __func__, apps_args[0], apps_args[1], apps_args[2], |
| 6070 | apps_args[3]); |
| 6071 | vosTraceDumpAll((void*)hHal , apps_args[0], apps_args[1], |
| 6072 | apps_args[2], apps_args[3]); |
| 6073 | |
| 6074 | } |
| 6075 | break; |
| 6076 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 6077 | case WE_MCC_CONFIG_CREDENTIAL : |
| 6078 | { |
| 6079 | cmd = 287; //Command should be updated if there is any change |
| 6080 | // in the Riva dump command |
Kumar Anand | 90ca3dd | 2013-01-18 15:24:47 -0800 | [diff] [blame] | 6081 | if((apps_args[0] >= 40 ) && (apps_args[0] <= 160 )) |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 6082 | { |
| 6083 | logPrintf(hHal, cmd, staId, apps_args[0], apps_args[1], apps_args[2]); |
| 6084 | } |
| 6085 | else |
| 6086 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6087 | hddLog(LOGE, "%s : Enter valid MccCredential value between MIN :40 and MAX:160", __func__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 6088 | return 0; |
| 6089 | } |
| 6090 | } |
| 6091 | break; |
| 6092 | |
| 6093 | case WE_MCC_CONFIG_PARAMS : |
| 6094 | { |
| 6095 | cmd = 288; //command Should be updated if there is any change |
| 6096 | // in the Riva dump command |
| 6097 | hdd_validate_mcc_config(pAdapter, staId, apps_args[0], apps_args[1],apps_args[2]); |
| 6098 | } |
| 6099 | break; |
| 6100 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 6101 | #ifdef FEATURE_WLAN_TDLS |
| 6102 | case WE_TDLS_CONFIG_PARAMS : |
| 6103 | { |
| 6104 | tdls_config_params_t tdlsParams; |
| 6105 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 6106 | tdlsParams.tdls = apps_args[0]; |
| 6107 | tdlsParams.tx_period_t = apps_args[1]; |
| 6108 | tdlsParams.tx_packet_n = apps_args[2]; |
| 6109 | tdlsParams.discovery_period_t = apps_args[3]; |
| 6110 | tdlsParams.discovery_tries_n = apps_args[4]; |
| 6111 | tdlsParams.idle_timeout_t = apps_args[5]; |
| 6112 | tdlsParams.idle_packet_n = apps_args[6]; |
| 6113 | tdlsParams.rssi_hysteresis = apps_args[7]; |
| 6114 | tdlsParams.rssi_trigger_threshold = apps_args[8]; |
| 6115 | tdlsParams.rssi_teardown_threshold = apps_args[9]; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 6116 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 6117 | wlan_hdd_tdls_set_params(dev, &tdlsParams); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 6118 | } |
| 6119 | break; |
| 6120 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6121 | default: |
| 6122 | { |
Jeff Johnson | 11e7703 | 2014-02-14 13:22:22 -0800 | [diff] [blame] | 6123 | hddLog(LOGE, "%s: Invalid IOCTL command %d", |
| 6124 | __func__, sub_cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6125 | } |
| 6126 | break; |
| 6127 | } |
| 6128 | |
| 6129 | return 0; |
| 6130 | } |
| 6131 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6132 | int iw_set_var_ints_getnone(struct net_device *dev, |
| 6133 | struct iw_request_info *info, |
| 6134 | union iwreq_data *wrqu, char *extra) |
| 6135 | { |
| 6136 | int ret; |
| 6137 | vos_ssr_protect(__func__); |
| 6138 | ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra); |
| 6139 | vos_ssr_unprotect(__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6140 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6141 | return ret; |
| 6142 | } |
| 6143 | |
| 6144 | static int __iw_add_tspec(struct net_device *dev, |
| 6145 | struct iw_request_info *info, |
| 6146 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6147 | { |
| 6148 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6149 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6150 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra; |
| 6151 | int params[HDD_WLAN_WMM_PARAM_COUNT]; |
| 6152 | sme_QosWmmTspecInfo tSpec; |
| 6153 | v_U32_t handle; |
Girish Gowli | 1999398 | 2014-06-12 20:05:32 +0530 | [diff] [blame] | 6154 | struct iw_point s_priv_data; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6155 | |
| 6156 | // make sure the application is sufficiently priviledged |
| 6157 | // note that the kernel will do this for "set" ioctls, but since |
| 6158 | // this ioctl wants to return status to user space it must be |
| 6159 | // defined as a "get" ioctl |
| 6160 | if (!capable(CAP_NET_ADMIN)) |
| 6161 | { |
| 6162 | return -EPERM; |
| 6163 | } |
| 6164 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6165 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 6166 | { |
| 6167 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6168 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6169 | return -EBUSY; |
| 6170 | } |
| 6171 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6172 | // we must be associated in order to add a tspec |
| 6173 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 6174 | { |
| 6175 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6176 | return 0; |
| 6177 | } |
| 6178 | |
| 6179 | // since we are defined to be a "get" ioctl, and since the number |
| 6180 | // of params exceeds the number of params that wireless extensions |
Girish Gowli | 1999398 | 2014-06-12 20:05:32 +0530 | [diff] [blame] | 6181 | // will pass down in the iwreq_data, we must copy the "set" params. |
| 6182 | // We must handle the compat for iwreq_data in 32U/64K environment. |
| 6183 | |
| 6184 | // helper fucntion to get iwreq_data with compat handling. |
| 6185 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 6186 | { |
| 6187 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6188 | return 0; |
| 6189 | } |
| 6190 | |
| 6191 | // make sure all params are correctly passed to function |
| 6192 | if ((NULL == s_priv_data.pointer) || |
| 6193 | (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) |
| 6194 | { |
| 6195 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6196 | return 0; |
| 6197 | } |
| 6198 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6199 | // from user space ourselves |
Girish Gowli | 1999398 | 2014-06-12 20:05:32 +0530 | [diff] [blame] | 6200 | if (copy_from_user(¶ms, s_priv_data.pointer, sizeof(params))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6201 | { |
| 6202 | // hmmm, can't get them |
| 6203 | return -EIO; |
| 6204 | } |
| 6205 | |
| 6206 | // clear the tspec |
| 6207 | memset(&tSpec, 0, sizeof(tSpec)); |
| 6208 | |
| 6209 | // validate the handle |
| 6210 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 6211 | if (HDD_WMM_HANDLE_IMPLICIT == handle) |
| 6212 | { |
| 6213 | // that one is reserved |
| 6214 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6215 | return 0; |
| 6216 | } |
| 6217 | |
| 6218 | // validate the TID |
| 6219 | if (params[HDD_WLAN_WMM_PARAM_TID] > 7) |
| 6220 | { |
| 6221 | // out of range |
| 6222 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6223 | return 0; |
| 6224 | } |
| 6225 | tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID]; |
| 6226 | |
| 6227 | // validate the direction |
| 6228 | switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) |
| 6229 | { |
| 6230 | case HDD_WLAN_WMM_DIRECTION_UPSTREAM: |
| 6231 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK; |
| 6232 | break; |
| 6233 | |
| 6234 | case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM: |
| 6235 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK; |
| 6236 | break; |
| 6237 | |
| 6238 | case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL: |
| 6239 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH; |
| 6240 | break; |
| 6241 | |
| 6242 | default: |
| 6243 | // unknown |
| 6244 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6245 | return 0; |
| 6246 | } |
| 6247 | |
Madan Mohan Koyyalamudi | a5643d6 | 2013-09-25 14:37:55 +0530 | [diff] [blame] | 6248 | tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD]; |
| 6249 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6250 | // validate the user priority |
| 6251 | if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) |
| 6252 | { |
| 6253 | // out of range |
| 6254 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6255 | return 0; |
| 6256 | } |
| 6257 | tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY]; |
Kiet Lam | c6bef88 | 2013-11-11 17:07:36 +0530 | [diff] [blame] | 6258 | if(0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) |
| 6259 | { |
| 6260 | hddLog(VOS_TRACE_LEVEL_ERROR,"***ts_info.up out of bounds***"); |
| 6261 | return 0; |
| 6262 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6263 | |
Madan Mohan Koyyalamudi | c0c6238 | 2013-08-16 23:46:14 +0530 | [diff] [blame] | 6264 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 6265 | "%s:TS_INFO PSB %d UP %d !!!", __func__, |
| 6266 | tSpec.ts_info.psb, tSpec.ts_info.up); |
| 6267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6268 | tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE]; |
| 6269 | tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE]; |
| 6270 | tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE]; |
| 6271 | tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE]; |
| 6272 | tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE]; |
| 6273 | tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE]; |
| 6274 | tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE]; |
| 6275 | tSpec.surplus_bw_allowance = params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE]; |
| 6276 | tSpec.min_service_interval = params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL]; |
| 6277 | tSpec.max_service_interval = params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL]; |
| 6278 | tSpec.suspension_interval = params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL]; |
| 6279 | tSpec.inactivity_interval = params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL]; |
| 6280 | |
| 6281 | tSpec.ts_info.burst_size_defn = params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN]; |
| 6282 | |
| 6283 | // validate the ts info ack policy |
| 6284 | switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) |
| 6285 | { |
| 6286 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK: |
| 6287 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 6288 | break; |
| 6289 | |
| 6290 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK: |
| 6291 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK; |
| 6292 | break; |
| 6293 | |
| 6294 | default: |
| 6295 | // unknown |
| 6296 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6297 | return 0; |
| 6298 | } |
| 6299 | |
| 6300 | *pStatus = hdd_wmm_addts(pAdapter, handle, &tSpec); |
| 6301 | return 0; |
| 6302 | } |
| 6303 | |
| 6304 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6305 | static int iw_add_tspec(struct net_device *dev, |
| 6306 | struct iw_request_info *info, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6307 | union iwreq_data *wrqu, char *extra) |
| 6308 | { |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6309 | int ret; |
| 6310 | |
| 6311 | vos_ssr_protect(__func__); |
| 6312 | ret = __iw_add_tspec(dev, info, wrqu, extra); |
| 6313 | vos_ssr_unprotect(__func__); |
| 6314 | |
| 6315 | return ret; |
| 6316 | } |
| 6317 | |
| 6318 | static int __iw_del_tspec(struct net_device *dev, |
| 6319 | struct iw_request_info *info, |
| 6320 | union iwreq_data *wrqu, char *extra) |
| 6321 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6322 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6323 | int *params = (int *)extra; |
| 6324 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra; |
| 6325 | v_U32_t handle; |
| 6326 | |
| 6327 | // make sure the application is sufficiently priviledged |
| 6328 | // note that the kernel will do this for "set" ioctls, but since |
| 6329 | // this ioctl wants to return status to user space it must be |
| 6330 | // defined as a "get" ioctl |
| 6331 | if (!capable(CAP_NET_ADMIN)) |
| 6332 | { |
| 6333 | return -EPERM; |
| 6334 | } |
| 6335 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6336 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 6337 | { |
| 6338 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6339 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6340 | return -EBUSY; |
| 6341 | } |
| 6342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6343 | // although we are defined to be a "get" ioctl, the params we require |
| 6344 | // will fit in the iwreq_data, therefore unlike iw_add_tspec() there |
| 6345 | // is no need to copy the params from user space |
| 6346 | |
| 6347 | // validate the handle |
| 6348 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 6349 | if (HDD_WMM_HANDLE_IMPLICIT == handle) |
| 6350 | { |
| 6351 | // that one is reserved |
| 6352 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6353 | return 0; |
| 6354 | } |
| 6355 | |
| 6356 | *pStatus = hdd_wmm_delts(pAdapter, handle); |
| 6357 | return 0; |
| 6358 | } |
| 6359 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6360 | static int iw_del_tspec(struct net_device *dev, |
| 6361 | struct iw_request_info *info, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6362 | union iwreq_data *wrqu, char *extra) |
| 6363 | { |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6364 | int ret; |
| 6365 | |
| 6366 | vos_ssr_protect(__func__); |
| 6367 | ret = __iw_del_tspec(dev, info, wrqu, extra); |
| 6368 | vos_ssr_unprotect(__func__); |
| 6369 | |
| 6370 | return ret; |
| 6371 | } |
| 6372 | |
| 6373 | |
| 6374 | static int __iw_get_tspec(struct net_device *dev, |
| 6375 | struct iw_request_info *info, |
| 6376 | union iwreq_data *wrqu, char *extra) |
| 6377 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6378 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6379 | int *params = (int *)extra; |
| 6380 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra; |
| 6381 | v_U32_t handle; |
| 6382 | |
| 6383 | // although we are defined to be a "get" ioctl, the params we require |
| 6384 | // will fit in the iwreq_data, therefore unlike iw_add_tspec() there |
| 6385 | // is no need to copy the params from user space |
| 6386 | |
| 6387 | // validate the handle |
| 6388 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 6389 | if (HDD_WMM_HANDLE_IMPLICIT == handle) |
| 6390 | { |
| 6391 | // that one is reserved |
| 6392 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 6393 | return 0; |
| 6394 | } |
| 6395 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6396 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 6397 | { |
| 6398 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6399 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6400 | return -EBUSY; |
| 6401 | } |
| 6402 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6403 | *pStatus = hdd_wmm_checkts(pAdapter, handle); |
| 6404 | return 0; |
| 6405 | } |
| 6406 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6407 | static int iw_get_tspec(struct net_device *dev, |
| 6408 | struct iw_request_info *info, |
| 6409 | union iwreq_data *wrqu, char *extra) |
| 6410 | { |
| 6411 | int ret; |
| 6412 | |
| 6413 | vos_ssr_protect(__func__); |
| 6414 | ret = __iw_get_tspec(dev, info, wrqu, extra); |
| 6415 | vos_ssr_unprotect(__func__); |
| 6416 | |
| 6417 | return ret; |
| 6418 | } |
| 6419 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6420 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6421 | // |
| 6422 | // |
| 6423 | // Each time the supplicant has the auth_request or reassoc request |
| 6424 | // IEs ready. This is pushed to the driver. The driver will inturn use |
| 6425 | // it to send out the auth req and reassoc req for 11r FT Assoc. |
| 6426 | // |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6427 | static int __iw_set_fties(struct net_device *dev, |
| 6428 | struct iw_request_info *info, |
| 6429 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6430 | { |
| 6431 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6432 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6433 | //v_CONTEXT_t pVosContext; |
| 6434 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6435 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 6436 | { |
| 6437 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6438 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6439 | return -EBUSY; |
| 6440 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6441 | if (!wrqu->data.length) |
| 6442 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6443 | hddLog(LOGE, FL("called with 0 length IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6444 | return -EINVAL; |
| 6445 | } |
| 6446 | if (wrqu->data.pointer == NULL) |
| 6447 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6448 | hddLog(LOGE, FL("called with NULL IE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6449 | return -EINVAL; |
| 6450 | } |
| 6451 | |
| 6452 | // Added for debug on reception of Re-assoc Req. |
| 6453 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 6454 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6455 | hddLog(LOGE, FL("Called with Ie of length = %d when not associated"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6456 | wrqu->data.length); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6457 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6458 | } |
| 6459 | |
| 6460 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6461 | hddLog(LOGE, FL("%s called with Ie of length = %d"), __func__, wrqu->data.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6462 | #endif |
| 6463 | |
| 6464 | // Pass the received FT IEs to SME |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 6465 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, extra, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6466 | wrqu->data.length); |
| 6467 | |
| 6468 | return 0; |
| 6469 | } |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6470 | |
| 6471 | static int iw_set_fties(struct net_device *dev, |
| 6472 | struct iw_request_info *info, |
| 6473 | union iwreq_data *wrqu, char *extra) |
| 6474 | { |
| 6475 | int ret; |
| 6476 | |
| 6477 | vos_ssr_protect(__func__); |
| 6478 | ret = __iw_set_fties(dev, info, wrqu, extra); |
| 6479 | vos_ssr_unprotect(__func__); |
| 6480 | |
| 6481 | return ret; |
| 6482 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6483 | #endif |
| 6484 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6485 | static int __iw_set_dynamic_mcbc_filter(struct net_device *dev, |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 6486 | struct iw_request_info *info, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6487 | union iwreq_data *wrqu, char *extra) |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6488 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6489 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 6490 | tpRcvFltMcAddrList pRequest = (tpRcvFltMcAddrList)extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6491 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 6492 | tpSirWlanSetRxpFilters wlanRxpFilterParam; |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6493 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6494 | tpSirRcvFltMcAddrList mc_addr_list_ptr; |
| 6495 | int idx; |
| 6496 | eHalStatus ret_val; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6497 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6498 | if (pHddCtx->isLogpInProgress) |
| 6499 | { |
| 6500 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6501 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6502 | return -EBUSY; |
| 6503 | } |
| 6504 | |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6505 | if (HDD_MULTICAST_FILTER_LIST == pRequest->mcastBcastFilterSetting) |
| 6506 | { |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 6507 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6508 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6509 | mc_addr_list_ptr = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
| 6510 | if (NULL == mc_addr_list_ptr) |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 6511 | { |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6512 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6513 | "%s: vos_mem_alloc failed", __func__); |
| 6514 | return -ENOMEM; |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 6515 | } |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6516 | |
| 6517 | mc_addr_list_ptr->ulMulticastAddrCnt = pRequest->mcast_addr_cnt; |
| 6518 | |
| 6519 | if (mc_addr_list_ptr->ulMulticastAddrCnt > HDD_MAX_NUM_MULTICAST_ADDRESS) |
| 6520 | mc_addr_list_ptr->ulMulticastAddrCnt = HDD_MAX_NUM_MULTICAST_ADDRESS; |
| 6521 | |
| 6522 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s MC Addr List Cnt %d", __func__, |
| 6523 | mc_addr_list_ptr->ulMulticastAddrCnt); |
| 6524 | |
| 6525 | for (idx = 0; idx < mc_addr_list_ptr->ulMulticastAddrCnt; idx++) |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 6526 | { |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6527 | memcpy(&mc_addr_list_ptr->multicastAddr[idx], |
| 6528 | pRequest->multicastAddr[idx], HDD_WLAN_MAC_ADDR_LEN); |
| 6529 | |
| 6530 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s MC Addr for Idx %d ="MAC_ADDRESS_STR, __func__, |
| 6531 | idx, MAC_ADDR_ARRAY(mc_addr_list_ptr->multicastAddr[idx])); |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 6532 | } |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 6533 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6534 | ret_val = sme_8023MulticastList(hHal, pAdapter->sessionId, mc_addr_list_ptr); |
| 6535 | vos_mem_free(mc_addr_list_ptr); |
| 6536 | if (eHAL_STATUS_SUCCESS != ret_val) |
| 6537 | { |
| 6538 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to Set MC Address List", |
| 6539 | __func__); |
| 6540 | return -EINVAL; |
| 6541 | } |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 6542 | #endif //WLAN_FEATURE_PACKET_FILTERING |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6543 | } |
| 6544 | else |
| 6545 | { |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 6546 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6547 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 6548 | "%s: Set MC BC Filter Config request: %d suspend %d", |
| 6549 | __func__, pRequest->mcastBcastFilterSetting, |
| 6550 | pHddCtx->hdd_wlan_suspended); |
| 6551 | |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6552 | pHddCtx->configuredMcastBcastFilter = pRequest->mcastBcastFilterSetting; |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6553 | |
| 6554 | if (pHddCtx->hdd_wlan_suspended) |
| 6555 | { |
Jeff Johnson | ce3d75e | 2013-04-05 22:34:54 -0700 | [diff] [blame] | 6556 | wlanRxpFilterParam = vos_mem_malloc(sizeof(tSirWlanSetRxpFilters)); |
| 6557 | if (NULL == wlanRxpFilterParam) |
| 6558 | { |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6559 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | ce3d75e | 2013-04-05 22:34:54 -0700 | [diff] [blame] | 6560 | "%s: vos_mem_alloc failed", __func__); |
| 6561 | return -EINVAL; |
| 6562 | } |
| 6563 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6564 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 6565 | pRequest->mcastBcastFilterSetting; |
| 6566 | wlanRxpFilterParam->setMcstBcstFilter = TRUE; |
| 6567 | |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 6568 | hdd_conf_hostoffload(pAdapter, TRUE); |
| 6569 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 6570 | pHddCtx->configuredMcastBcastFilter; |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6571 | |
| 6572 | hddLog(VOS_TRACE_LEVEL_INFO, "%s:MC/BC changed Req %d Set %d En %d", |
| 6573 | __func__, |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6574 | pHddCtx->configuredMcastBcastFilter, |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6575 | wlanRxpFilterParam->configuredMcstBcstFilterSetting, |
| 6576 | wlanRxpFilterParam->setMcstBcstFilter); |
| 6577 | |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6578 | if (eHAL_STATUS_SUCCESS != |
| 6579 | sme_ConfigureRxpFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6580 | wlanRxpFilterParam)) |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6581 | { |
| 6582 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6583 | "%s: Failure to execute set HW MC/BC Filter request", |
| 6584 | __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 6585 | vos_mem_free(wlanRxpFilterParam); |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6586 | return -EINVAL; |
| 6587 | } |
| 6588 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6589 | } |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 6590 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6591 | |
| 6592 | return 0; |
| 6593 | } |
| 6594 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6595 | static int iw_set_dynamic_mcbc_filter(struct net_device *dev, |
| 6596 | struct iw_request_info *info, |
| 6597 | union iwreq_data *wrqu, char *extra) |
| 6598 | { |
| 6599 | int ret; |
| 6600 | |
| 6601 | vos_ssr_protect(__func__); |
| 6602 | ret = __iw_set_dynamic_mcbc_filter(dev, info, wrqu, extra); |
| 6603 | vos_ssr_unprotect(__func__); |
| 6604 | |
| 6605 | return ret; |
| 6606 | } |
| 6607 | |
| 6608 | static int __iw_clear_dynamic_mcbc_filter(struct net_device *dev, |
| 6609 | struct iw_request_info *info, |
| 6610 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6611 | { |
| 6612 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6613 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6614 | tpSirWlanSetRxpFilters wlanRxpFilterParam; |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6615 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: ", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6616 | |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6617 | //Reset the filter to INI value as we have to clear the dynamic filter |
| 6618 | pHddCtx->configuredMcastBcastFilter = pHddCtx->cfg_ini->mcastBcastFilterSetting; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6619 | |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6620 | //Configure FW with new setting |
| 6621 | if (pHddCtx->hdd_wlan_suspended) |
| 6622 | { |
| 6623 | wlanRxpFilterParam = vos_mem_malloc(sizeof(tSirWlanSetRxpFilters)); |
| 6624 | if (NULL == wlanRxpFilterParam) |
| 6625 | { |
| 6626 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6627 | "%s: vos_mem_alloc failed", __func__); |
| 6628 | return -EINVAL; |
| 6629 | } |
| 6630 | |
| 6631 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 6632 | pHddCtx->configuredMcastBcastFilter; |
| 6633 | wlanRxpFilterParam->setMcstBcstFilter = TRUE; |
| 6634 | |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 6635 | hdd_conf_hostoffload(pAdapter, TRUE); |
| 6636 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 6637 | pHddCtx->configuredMcastBcastFilter; |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 6638 | |
| 6639 | if (eHAL_STATUS_SUCCESS != |
| 6640 | sme_ConfigureRxpFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6641 | wlanRxpFilterParam)) |
| 6642 | { |
| 6643 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6644 | "%s: Failure to execute set HW MC/BC Filter request", |
| 6645 | __func__); |
| 6646 | vos_mem_free(wlanRxpFilterParam); |
| 6647 | return -EINVAL; |
| 6648 | } |
| 6649 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6650 | return 0; |
| 6651 | } |
| 6652 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6653 | |
| 6654 | static int iw_clear_dynamic_mcbc_filter(struct net_device *dev, |
| 6655 | struct iw_request_info *info, |
| 6656 | union iwreq_data *wrqu, char *extra) |
| 6657 | { |
| 6658 | int ret; |
| 6659 | |
| 6660 | vos_ssr_protect(__func__); |
| 6661 | ret = __iw_clear_dynamic_mcbc_filter(dev, info, wrqu, extra); |
| 6662 | vos_ssr_unprotect(__func__); |
| 6663 | |
| 6664 | return ret; |
| 6665 | } |
| 6666 | |
| 6667 | static int __iw_set_host_offload(struct net_device *dev, |
| 6668 | struct iw_request_info *info, |
| 6669 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6670 | { |
| 6671 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 6672 | tpHostOffloadRequest pRequest = (tpHostOffloadRequest) extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6673 | tSirHostOffloadReq offloadRequest; |
| 6674 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6675 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 6676 | { |
| 6677 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6678 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6679 | return -EBUSY; |
| 6680 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6681 | /* Debug display of request components. */ |
| 6682 | switch (pRequest->offloadType) |
| 6683 | { |
| 6684 | case WLAN_IPV4_ARP_REPLY_OFFLOAD: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6685 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Host offload request: ARP reply", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6686 | switch (pRequest->enableOrDisable) |
| 6687 | { |
| 6688 | case WLAN_OFFLOAD_DISABLE: |
| 6689 | hddLog(VOS_TRACE_LEVEL_WARN, " disable"); |
| 6690 | break; |
| 6691 | case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE: |
| 6692 | hddLog(VOS_TRACE_LEVEL_WARN, " BC Filtering enable"); |
| 6693 | case WLAN_OFFLOAD_ENABLE: |
| 6694 | hddLog(VOS_TRACE_LEVEL_WARN, " ARP offload enable"); |
| 6695 | hddLog(VOS_TRACE_LEVEL_WARN, " IP address: %d.%d.%d.%d", |
| 6696 | pRequest->params.hostIpv4Addr[0], pRequest->params.hostIpv4Addr[1], |
| 6697 | pRequest->params.hostIpv4Addr[2], pRequest->params.hostIpv4Addr[3]); |
| 6698 | } |
| 6699 | break; |
| 6700 | |
| 6701 | case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6702 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Host offload request: neighbor discovery", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6703 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6704 | switch (pRequest->enableOrDisable) |
| 6705 | { |
| 6706 | case WLAN_OFFLOAD_DISABLE: |
| 6707 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " disable"); |
| 6708 | break; |
| 6709 | case WLAN_OFFLOAD_ENABLE: |
| 6710 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " enable"); |
| 6711 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " IP address: %x:%x:%x:%x:%x:%x:%x:%x", |
| 6712 | *(v_U16_t *)(pRequest->params.hostIpv6Addr), |
| 6713 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 2), |
| 6714 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 4), |
| 6715 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 6), |
| 6716 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 8), |
| 6717 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 10), |
| 6718 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 12), |
| 6719 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 14)); |
| 6720 | } |
| 6721 | } |
| 6722 | |
| 6723 | /* Execute offload request. The reason that we can copy the request information |
| 6724 | from the ioctl structure to the SME structure is that they are laid out |
| 6725 | exactly the same. Otherwise, each piece of information would have to be |
| 6726 | copied individually. */ |
| 6727 | memcpy(&offloadRequest, pRequest, wrqu->data.length); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6728 | if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6729 | pAdapter->sessionId, &offloadRequest)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6730 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6731 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute host offload request", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6732 | __func__); |
| 6733 | return -EINVAL; |
| 6734 | } |
| 6735 | |
| 6736 | return 0; |
| 6737 | } |
| 6738 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6739 | static int iw_set_host_offload(struct net_device *dev, |
| 6740 | struct iw_request_info *info, |
| 6741 | union iwreq_data *wrqu, char *extra) |
| 6742 | { |
| 6743 | int ret; |
| 6744 | |
| 6745 | vos_ssr_protect(__func__); |
| 6746 | ret = __iw_set_host_offload(dev, info, wrqu, extra); |
| 6747 | vos_ssr_unprotect(__func__); |
| 6748 | |
| 6749 | return ret; |
| 6750 | } |
| 6751 | |
| 6752 | static int __iw_set_keepalive_params(struct net_device *dev, |
| 6753 | struct iw_request_info *info, |
| 6754 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6755 | { |
| 6756 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 6757 | tpKeepAliveRequest pRequest = (tpKeepAliveRequest) extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6758 | tSirKeepAliveReq keepaliveRequest; |
| 6759 | |
| 6760 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 6761 | { |
| 6762 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6763 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6764 | return 0; |
| 6765 | } |
| 6766 | |
| 6767 | /* Debug display of request components. */ |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 6768 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6769 | "%s: Set Keep Alive Request : TimePeriod %d size %zu", |
| 6770 | __func__, pRequest->timePeriod, sizeof(tKeepAliveRequest)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6771 | |
| 6772 | switch (pRequest->packetType) |
| 6773 | { |
| 6774 | case WLAN_KEEP_ALIVE_NULL_PKT: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6775 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Keep Alive Request: Tx NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6776 | break; |
| 6777 | |
| 6778 | case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP: |
| 6779 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6780 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Keep Alive Request: Tx UnSolicited ARP RSP", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6781 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6782 | |
| 6783 | hddLog(VOS_TRACE_LEVEL_WARN, " Host IP address: %d.%d.%d.%d", |
| 6784 | pRequest->hostIpv4Addr[0], pRequest->hostIpv4Addr[1], |
| 6785 | pRequest->hostIpv4Addr[2], pRequest->hostIpv4Addr[3]); |
| 6786 | |
| 6787 | hddLog(VOS_TRACE_LEVEL_WARN, " Dest IP address: %d.%d.%d.%d", |
| 6788 | pRequest->destIpv4Addr[0], pRequest->destIpv4Addr[1], |
| 6789 | pRequest->destIpv4Addr[2], pRequest->destIpv4Addr[3]); |
| 6790 | |
| 6791 | hddLog(VOS_TRACE_LEVEL_WARN, " Dest MAC address: %d:%d:%d:%d:%d:%d", |
| 6792 | pRequest->destMacAddr[0], pRequest->destMacAddr[1], |
| 6793 | pRequest->destMacAddr[2], pRequest->destMacAddr[3], |
| 6794 | pRequest->destMacAddr[4], pRequest->destMacAddr[5]); |
| 6795 | break; |
| 6796 | |
| 6797 | } |
| 6798 | |
| 6799 | /* Execute keep alive request. The reason that we can copy the request information |
| 6800 | from the ioctl structure to the SME structure is that they are laid out |
| 6801 | exactly the same. Otherwise, each piece of information would have to be |
| 6802 | copied individually. */ |
| 6803 | memcpy(&keepaliveRequest, pRequest, wrqu->data.length); |
| 6804 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6805 | hddLog(VOS_TRACE_LEVEL_ERROR, "set Keep: TP before SME %d", keepaliveRequest.timePeriod); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6806 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 6807 | if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6808 | pAdapter->sessionId, &keepaliveRequest)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6809 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6810 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Keep Alive", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6811 | __func__); |
| 6812 | return -EINVAL; |
| 6813 | } |
| 6814 | |
| 6815 | return 0; |
| 6816 | } |
| 6817 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6818 | static int iw_set_keepalive_params(struct net_device *dev, |
| 6819 | struct iw_request_info *info, |
| 6820 | union iwreq_data *wrqu, char *extra) |
| 6821 | { |
| 6822 | int ret; |
| 6823 | vos_ssr_protect(__func__); |
| 6824 | ret = __iw_set_keepalive_params(dev, info, wrqu, extra); |
| 6825 | vos_ssr_unprotect(__func__); |
| 6826 | |
| 6827 | return ret; |
| 6828 | } |
| 6829 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6830 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 6831 | int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6832 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6833 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6834 | tSirRcvPktFilterCfgType packetFilterSetReq = {0}; |
| 6835 | tSirRcvFltPktClearParam packetFilterClrReq = {0}; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6836 | int i=0; |
| 6837 | |
| 6838 | if (pHddCtx->cfg_ini->disablePacketFilter) |
| 6839 | { |
| 6840 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Packet Filtering Disabled. Returning ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6841 | __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6842 | return 0; |
| 6843 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6844 | if (pHddCtx->isLogpInProgress) |
| 6845 | { |
| 6846 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6847 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6848 | return -EBUSY; |
| 6849 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6850 | /* Debug display of request components. */ |
| 6851 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Packet Filter Request : FA %d params %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6852 | __func__, pRequest->filterAction, pRequest->numParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6853 | |
| 6854 | switch (pRequest->filterAction) |
| 6855 | { |
| 6856 | case HDD_RCV_FILTER_SET: |
| 6857 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Set Packet Filter Request for Id: %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6858 | __func__, pRequest->filterId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6859 | |
| 6860 | packetFilterSetReq.filterId = pRequest->filterId; |
| 6861 | if ( pRequest->numParams >= HDD_MAX_CMP_PER_PACKET_FILTER) |
| 6862 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6863 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Number of Params exceed Max limit %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6864 | __func__, pRequest->numParams); |
| 6865 | return -EINVAL; |
| 6866 | } |
| 6867 | packetFilterSetReq.numFieldParams = pRequest->numParams; |
| 6868 | packetFilterSetReq.coalesceTime = 0; |
| 6869 | packetFilterSetReq.filterType = 1; |
| 6870 | for (i=0; i < pRequest->numParams; i++) |
| 6871 | { |
| 6872 | packetFilterSetReq.paramsData[i].protocolLayer = pRequest->paramsData[i].protocolLayer; |
| 6873 | packetFilterSetReq.paramsData[i].cmpFlag = pRequest->paramsData[i].cmpFlag; |
| 6874 | packetFilterSetReq.paramsData[i].dataOffset = pRequest->paramsData[i].dataOffset; |
| 6875 | packetFilterSetReq.paramsData[i].dataLength = pRequest->paramsData[i].dataLength; |
| 6876 | packetFilterSetReq.paramsData[i].reserved = 0; |
| 6877 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6878 | hddLog(VOS_TRACE_LEVEL_INFO, "Proto %d Comp Flag %d Filter Type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6879 | pRequest->paramsData[i].protocolLayer, pRequest->paramsData[i].cmpFlag, |
| 6880 | packetFilterSetReq.filterType); |
| 6881 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6882 | hddLog(VOS_TRACE_LEVEL_INFO, "Data Offset %d Data Len %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6883 | pRequest->paramsData[i].dataOffset, pRequest->paramsData[i].dataLength); |
| 6884 | |
| 6885 | memcpy(&packetFilterSetReq.paramsData[i].compareData, |
| 6886 | pRequest->paramsData[i].compareData, pRequest->paramsData[i].dataLength); |
| 6887 | memcpy(&packetFilterSetReq.paramsData[i].dataMask, |
| 6888 | pRequest->paramsData[i].dataMask, pRequest->paramsData[i].dataLength); |
| 6889 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6890 | hddLog(VOS_TRACE_LEVEL_INFO, "CData %d CData %d CData %d CData %d CData %d CData %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6891 | pRequest->paramsData[i].compareData[0], pRequest->paramsData[i].compareData[1], |
| 6892 | pRequest->paramsData[i].compareData[2], pRequest->paramsData[i].compareData[3], |
| 6893 | pRequest->paramsData[i].compareData[4], pRequest->paramsData[i].compareData[5]); |
| 6894 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6895 | hddLog(VOS_TRACE_LEVEL_INFO, "MData %d MData %d MData %d MData %d MData %d MData %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6896 | pRequest->paramsData[i].dataMask[0], pRequest->paramsData[i].dataMask[1], |
| 6897 | pRequest->paramsData[i].dataMask[2], pRequest->paramsData[i].dataMask[3], |
| 6898 | pRequest->paramsData[i].dataMask[4], pRequest->paramsData[i].dataMask[5]); |
| 6899 | } |
| 6900 | |
Madan Mohan Koyyalamudi | 59a40c9 | 2012-09-24 14:13:16 -0700 | [diff] [blame] | 6901 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, &packetFilterSetReq, sessionId)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6902 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6903 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Set Filter", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6904 | __func__); |
| 6905 | return -EINVAL; |
| 6906 | } |
| 6907 | |
| 6908 | break; |
| 6909 | |
| 6910 | case HDD_RCV_FILTER_CLEAR: |
| 6911 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6912 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Clear Packet Filter Request for Id: %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6913 | __func__, pRequest->filterId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6914 | packetFilterClrReq.filterId = pRequest->filterId; |
Madan Mohan Koyyalamudi | 59a40c9 | 2012-09-24 14:13:16 -0700 | [diff] [blame] | 6915 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx->hHal, &packetFilterClrReq, sessionId)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6916 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6917 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Clear Filter", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6918 | __func__); |
| 6919 | return -EINVAL; |
| 6920 | } |
| 6921 | break; |
| 6922 | |
| 6923 | default : |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6924 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Packet Filter Request: Invalid %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6925 | __func__, pRequest->filterAction); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6926 | return -EINVAL; |
| 6927 | } |
| 6928 | return 0; |
| 6929 | } |
| 6930 | |
Gopichand Nakkala | 227c7f3 | 2013-06-26 22:44:57 +0530 | [diff] [blame] | 6931 | int wlan_hdd_setIPv6Filter(hdd_context_t *pHddCtx, tANI_U8 filterType, |
| 6932 | tANI_U8 sessionId) |
| 6933 | { |
| 6934 | tSirRcvPktFilterCfgType packetFilterSetReq = {0}; |
| 6935 | tSirRcvFltPktClearParam packetFilterClrReq = {0}; |
| 6936 | |
| 6937 | if (NULL == pHddCtx) |
| 6938 | { |
| 6939 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" NULL HDD Context Passed")); |
| 6940 | return -EINVAL; |
| 6941 | } |
| 6942 | |
| 6943 | if (pHddCtx->isLogpInProgress) |
| 6944 | { |
| 6945 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6946 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6947 | return -EBUSY; |
| 6948 | } |
| 6949 | |
| 6950 | if (pHddCtx->cfg_ini->disablePacketFilter) |
| 6951 | { |
| 6952 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6953 | "%s: Packet Filtering Disabled. Returning ", |
| 6954 | __func__ ); |
| 6955 | return -EINVAL; |
| 6956 | } |
| 6957 | |
| 6958 | switch (filterType) |
| 6959 | { |
| 6960 | /* For setting IPV6 MC and UC Filter we need to configure |
| 6961 | * 2 filters, one for MC and one for UC. |
| 6962 | * The Filter ID shouldn't be swapped, which results in making |
| 6963 | * UC Filter ineffective. |
| 6964 | * We have Hardcode all the values |
| 6965 | * |
| 6966 | * Reason for a seperate UC filter is because, driver need to |
| 6967 | * specify the FW that the specific filter is for unicast |
| 6968 | * otherwise FW will not pass the unicast frames by default |
| 6969 | * through the filter. This is required to avoid any performance |
| 6970 | * hits when no unicast filter is set and only MC/BC are set. |
| 6971 | * The way driver informs host is by using the MAC protocol |
| 6972 | * layer, CMP flag set to MAX, CMP Data set to 1. |
| 6973 | */ |
| 6974 | |
| 6975 | case HDD_FILTER_IPV6_MC_UC: |
| 6976 | /* Setting IPV6 MC Filter below |
| 6977 | */ |
| 6978 | packetFilterSetReq.filterType = HDD_RCV_FILTER_SET; |
| 6979 | packetFilterSetReq.filterId = HDD_FILTER_ID_IPV6_MC; |
| 6980 | packetFilterSetReq.numFieldParams = 2; |
| 6981 | packetFilterSetReq.paramsData[0].protocolLayer = |
| 6982 | HDD_FILTER_PROTO_TYPE_MAC; |
| 6983 | packetFilterSetReq.paramsData[0].cmpFlag = |
| 6984 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 6985 | packetFilterSetReq.paramsData[0].dataOffset = |
| 6986 | WLAN_HDD_80211_FRM_DA_OFFSET; |
| 6987 | packetFilterSetReq.paramsData[0].dataLength = 1; |
| 6988 | packetFilterSetReq.paramsData[0].compareData[0] = |
| 6989 | HDD_IPV6_MC_CMP_DATA; |
| 6990 | |
| 6991 | packetFilterSetReq.paramsData[1].protocolLayer = |
| 6992 | HDD_FILTER_PROTO_TYPE_ARP; |
| 6993 | packetFilterSetReq.paramsData[1].cmpFlag = |
| 6994 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 6995 | packetFilterSetReq.paramsData[1].dataOffset = ETH_ALEN; |
| 6996 | packetFilterSetReq.paramsData[1].dataLength = 2; |
| 6997 | packetFilterSetReq.paramsData[1].compareData[0] = |
| 6998 | HDD_IPV6_CMP_DATA_0; |
| 6999 | packetFilterSetReq.paramsData[1].compareData[1] = |
| 7000 | HDD_IPV6_CMP_DATA_1; |
| 7001 | |
| 7002 | |
| 7003 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, |
| 7004 | &packetFilterSetReq, sessionId)) |
| 7005 | { |
| 7006 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7007 | "%s: Failure to execute Set IPv6 Mulicast Filter", |
| 7008 | __func__); |
| 7009 | return -EINVAL; |
| 7010 | } |
| 7011 | |
| 7012 | memset( &packetFilterSetReq, 0, sizeof(tSirRcvPktFilterCfgType)); |
| 7013 | |
| 7014 | /* |
| 7015 | * Setting IPV6 UC Filter below |
| 7016 | */ |
| 7017 | packetFilterSetReq.filterType = HDD_RCV_FILTER_SET; |
| 7018 | packetFilterSetReq.filterId = HDD_FILTER_ID_IPV6_UC; |
| 7019 | packetFilterSetReq.numFieldParams = 2; |
| 7020 | packetFilterSetReq.paramsData[0].protocolLayer = |
| 7021 | HDD_FILTER_PROTO_TYPE_MAC; |
| 7022 | packetFilterSetReq.paramsData[0].cmpFlag = |
| 7023 | HDD_FILTER_CMP_TYPE_MAX; |
| 7024 | packetFilterSetReq.paramsData[0].dataOffset = 0; |
| 7025 | packetFilterSetReq.paramsData[0].dataLength = 1; |
| 7026 | packetFilterSetReq.paramsData[0].compareData[0] = |
| 7027 | HDD_IPV6_UC_CMP_DATA; |
| 7028 | |
| 7029 | packetFilterSetReq.paramsData[1].protocolLayer = |
| 7030 | HDD_FILTER_PROTO_TYPE_ARP; |
| 7031 | packetFilterSetReq.paramsData[1].cmpFlag = |
| 7032 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 7033 | packetFilterSetReq.paramsData[1].dataOffset = ETH_ALEN; |
| 7034 | packetFilterSetReq.paramsData[1].dataLength = 2; |
| 7035 | packetFilterSetReq.paramsData[1].compareData[0] = |
| 7036 | HDD_IPV6_CMP_DATA_0; |
| 7037 | packetFilterSetReq.paramsData[1].compareData[1] = |
| 7038 | HDD_IPV6_CMP_DATA_1; |
| 7039 | |
| 7040 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, |
| 7041 | &packetFilterSetReq, sessionId)) |
| 7042 | { |
| 7043 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7044 | "%s: Failure to execute Set IPv6 Unicast Filter", |
| 7045 | __func__); |
| 7046 | return -EINVAL; |
| 7047 | } |
| 7048 | |
| 7049 | break; |
| 7050 | |
| 7051 | case HDD_FILTER_IPV6_MC: |
| 7052 | /* |
| 7053 | * IPV6 UC Filter might be already set, |
| 7054 | * clear the UC Filter. As the Filter |
| 7055 | * IDs are static, we can directly clear it. |
| 7056 | */ |
| 7057 | packetFilterSetReq.filterType = HDD_RCV_FILTER_SET; |
| 7058 | packetFilterClrReq.filterId = HDD_FILTER_ID_IPV6_UC; |
| 7059 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx->hHal, |
| 7060 | &packetFilterClrReq, sessionId)) |
| 7061 | { |
| 7062 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7063 | "%s: Failure to execute Clear IPv6 Unicast Filter", |
| 7064 | __func__); |
| 7065 | return -EINVAL; |
| 7066 | } |
| 7067 | |
| 7068 | /* |
| 7069 | * Setting IPV6 MC Filter below |
| 7070 | */ |
| 7071 | packetFilterSetReq.filterId = HDD_FILTER_ID_IPV6_MC; |
| 7072 | packetFilterSetReq.numFieldParams = 2; |
| 7073 | packetFilterSetReq.paramsData[0].protocolLayer = |
| 7074 | HDD_FILTER_PROTO_TYPE_MAC; |
| 7075 | packetFilterSetReq.paramsData[0].cmpFlag = |
| 7076 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 7077 | packetFilterSetReq.paramsData[0].dataOffset = |
| 7078 | WLAN_HDD_80211_FRM_DA_OFFSET; |
| 7079 | packetFilterSetReq.paramsData[0].dataLength = 1; |
| 7080 | packetFilterSetReq.paramsData[0].compareData[0] = |
| 7081 | HDD_IPV6_MC_CMP_DATA; |
| 7082 | |
| 7083 | packetFilterSetReq.paramsData[1].protocolLayer = |
| 7084 | HDD_FILTER_PROTO_TYPE_ARP; |
| 7085 | packetFilterSetReq.paramsData[1].cmpFlag = |
| 7086 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 7087 | packetFilterSetReq.paramsData[1].dataOffset = ETH_ALEN; |
| 7088 | packetFilterSetReq.paramsData[1].dataLength = 2; |
| 7089 | packetFilterSetReq.paramsData[1].compareData[0] = |
| 7090 | HDD_IPV6_CMP_DATA_0; |
| 7091 | packetFilterSetReq.paramsData[1].compareData[1] = |
| 7092 | HDD_IPV6_CMP_DATA_1; |
| 7093 | |
| 7094 | |
| 7095 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, |
| 7096 | &packetFilterSetReq, sessionId)) |
| 7097 | { |
| 7098 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7099 | "%s: Failure to execute Set IPv6 Multicast Filter", |
| 7100 | __func__); |
| 7101 | return -EINVAL; |
| 7102 | } |
| 7103 | break; |
| 7104 | |
| 7105 | default : |
| 7106 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 7107 | "%s: Packet Filter Request: Invalid", |
| 7108 | __func__); |
| 7109 | return -EINVAL; |
| 7110 | } |
| 7111 | return 0; |
| 7112 | } |
| 7113 | |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 7114 | void wlan_hdd_set_mc_addr_list(hdd_adapter_t *pAdapter, v_U8_t set) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7115 | { |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 7116 | v_U8_t i; |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7117 | tpSirRcvFltMcAddrList pMulticastAddrs = NULL; |
Yue Ma | 3ede605 | 2013-08-29 00:33:26 -0700 | [diff] [blame] | 7118 | tHalHandle hHal = NULL; |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7119 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7120 | |
Yue Ma | 3ede605 | 2013-08-29 00:33:26 -0700 | [diff] [blame] | 7121 | if (NULL == pHddCtx) |
| 7122 | { |
| 7123 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD CTX is NULL")); |
| 7124 | return; |
| 7125 | } |
| 7126 | |
| 7127 | hHal = pHddCtx->hHal; |
| 7128 | |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7129 | if (NULL == hHal) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7130 | { |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7131 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HAL Handle is NULL")); |
| 7132 | return; |
| 7133 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7134 | |
| 7135 | /* Check if INI is enabled or not, other wise just return |
| 7136 | */ |
Madan Mohan Koyyalamudi | ac94c7e | 2013-08-12 09:37:34 +0530 | [diff] [blame] | 7137 | if (pHddCtx->cfg_ini->fEnableMCAddrList) |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7138 | { |
| 7139 | pMulticastAddrs = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
| 7140 | if (NULL == pMulticastAddrs) |
| 7141 | { |
| 7142 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Could not allocate Memory")); |
| 7143 | return; |
| 7144 | } |
| 7145 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7146 | if (set) |
| 7147 | { |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7148 | /* Following pre-conditions should be satisfied before wei |
| 7149 | * configure the MC address list. |
| 7150 | */ |
| 7151 | if (((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 7152 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) |
| 7153 | && pAdapter->mc_addr_list.mc_cnt |
| 7154 | && (eConnectionState_Associated == |
| 7155 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 7156 | { |
| 7157 | pMulticastAddrs->ulMulticastAddrCnt = |
| 7158 | pAdapter->mc_addr_list.mc_cnt; |
| 7159 | for (i = 0; i < pAdapter->mc_addr_list.mc_cnt; i++) |
| 7160 | { |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7161 | memcpy(pMulticastAddrs->multicastAddr[i], |
| 7162 | pAdapter->mc_addr_list.addr[i], |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7163 | sizeof(pAdapter->mc_addr_list.addr[i])); |
| 7164 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7165 | "%s: %s multicast filter: addr =" |
| 7166 | MAC_ADDRESS_STR, |
| 7167 | __func__, set ? "setting" : "clearing", |
| 7168 | MAC_ADDR_ARRAY(pMulticastAddrs->multicastAddr[i])); |
| 7169 | } |
| 7170 | /* Set multicast filter */ |
| 7171 | sme_8023MulticastList(hHal, pAdapter->sessionId, |
| 7172 | pMulticastAddrs); |
| 7173 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7174 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7175 | else |
| 7176 | { |
| 7177 | /* Need to clear only if it was previously configured |
| 7178 | */ |
| 7179 | if (pAdapter->mc_addr_list.isFilterApplied) |
| 7180 | { |
| 7181 | pMulticastAddrs->ulMulticastAddrCnt = 0; |
| 7182 | sme_8023MulticastList(hHal, pAdapter->sessionId, |
| 7183 | pMulticastAddrs); |
| 7184 | } |
| 7185 | |
| 7186 | } |
| 7187 | pAdapter->mc_addr_list.isFilterApplied = set ? TRUE : FALSE; |
Sameer Thalappil | b492efd | 2013-10-23 14:21:51 -0700 | [diff] [blame] | 7188 | vos_mem_free(pMulticastAddrs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7189 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7190 | else |
| 7191 | { |
| 7192 | hddLog(VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | ac94c7e | 2013-08-12 09:37:34 +0530 | [diff] [blame] | 7193 | FL("gMCAddrListEnable is not enabled in INI")); |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7194 | } |
| 7195 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7196 | } |
| 7197 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7198 | static int __iw_set_packet_filter_params(struct net_device *dev, |
| 7199 | struct iw_request_info *info, |
| 7200 | union iwreq_data *wrqu, char *extra) |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 7201 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7202 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 7203 | tpPacketFilterCfg pRequest = NULL; |
| 7204 | int ret; |
Girish Gowli | dfdf85e | 2014-06-12 21:01:35 +0530 | [diff] [blame] | 7205 | struct iw_point s_priv_data; |
| 7206 | |
| 7207 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 7208 | { |
| 7209 | return -EINVAL; |
| 7210 | } |
| 7211 | |
| 7212 | if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) |
| 7213 | { |
| 7214 | return -EINVAL; |
| 7215 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7216 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 7217 | /* ODD number is used for set, copy data using copy_from_user */ |
Girish Gowli | dfdf85e | 2014-06-12 21:01:35 +0530 | [diff] [blame] | 7218 | pRequest = mem_alloc_copy_from_user_helper(s_priv_data.pointer, |
| 7219 | s_priv_data.length); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 7220 | if (NULL == pRequest) |
| 7221 | { |
| 7222 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7223 | "mem_alloc_copy_from_user_helper fail"); |
| 7224 | return -ENOMEM; |
| 7225 | } |
| 7226 | |
| 7227 | ret = wlan_hdd_set_filter(WLAN_HDD_GET_CTX(pAdapter), pRequest, pAdapter->sessionId); |
| 7228 | kfree(pRequest); |
| 7229 | |
| 7230 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7231 | } |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7232 | |
| 7233 | static int iw_set_packet_filter_params(struct net_device *dev, |
| 7234 | struct iw_request_info *info, |
| 7235 | union iwreq_data *wrqu, char *extra) |
| 7236 | { |
| 7237 | int ret; |
| 7238 | |
| 7239 | vos_ssr_protect(__func__); |
| 7240 | ret = __iw_set_packet_filter_params(dev, info, wrqu, extra); |
| 7241 | vos_ssr_unprotect(__func__); |
| 7242 | |
| 7243 | return ret; |
| 7244 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7245 | #endif |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7246 | static int __iw_get_statistics(struct net_device *dev, |
| 7247 | struct iw_request_info *info, |
| 7248 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7249 | { |
| 7250 | |
| 7251 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 7252 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7253 | hdd_wext_state_t *pWextState; |
| 7254 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7255 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7256 | char *p = extra; |
| 7257 | int tlen = 0; |
| 7258 | tCsrSummaryStatsInfo *pStats = &(pAdapter->hdd_stats.summary_stat); |
| 7259 | |
| 7260 | tCsrGlobalClassAStatsInfo *aStats = &(pAdapter->hdd_stats.ClassA_stat); |
| 7261 | tCsrGlobalClassDStatsInfo *dStats = &(pAdapter->hdd_stats.ClassD_stat); |
| 7262 | |
| 7263 | ENTER(); |
| 7264 | |
| 7265 | if (pHddCtx->isLogpInProgress) { |
| 7266 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 7267 | return -EINVAL; |
| 7268 | } |
| 7269 | |
| 7270 | if (eConnectionState_Associated != (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) { |
| 7271 | |
| 7272 | wrqu->txpower.value = 0; |
| 7273 | } |
| 7274 | else { |
| 7275 | status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD, |
| 7276 | SME_SUMMARY_STATS | |
| 7277 | SME_GLOBAL_CLASSA_STATS | |
| 7278 | SME_GLOBAL_CLASSB_STATS | |
| 7279 | SME_GLOBAL_CLASSC_STATS | |
| 7280 | SME_GLOBAL_CLASSD_STATS | |
| 7281 | SME_PER_STA_STATS, |
| 7282 | hdd_StatisticsCB, 0, FALSE, |
| 7283 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter ); |
| 7284 | |
| 7285 | if (eHAL_STATUS_SUCCESS != status) |
| 7286 | { |
| 7287 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7288 | "%s: Unable to retrieve SME statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7289 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7290 | return -EINVAL; |
| 7291 | } |
| 7292 | |
| 7293 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7294 | |
| 7295 | vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS); |
| 7296 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 7297 | { |
| 7298 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7299 | "%s: SME timeout while retrieving statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7300 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7301 | /*Remove the SME statistics list by passing NULL in callback argument*/ |
| 7302 | status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD, |
| 7303 | SME_SUMMARY_STATS | |
| 7304 | SME_GLOBAL_CLASSA_STATS | |
| 7305 | SME_GLOBAL_CLASSB_STATS | |
| 7306 | SME_GLOBAL_CLASSC_STATS | |
| 7307 | SME_GLOBAL_CLASSD_STATS | |
| 7308 | SME_PER_STA_STATS, |
| 7309 | NULL, 0, FALSE, |
| 7310 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter ); |
| 7311 | |
| 7312 | return -EINVAL; |
| 7313 | } |
| 7314 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RETRY_CNT, |
| 7315 | (tANI_U8) sizeof (pStats->retry_cnt), |
| 7316 | (char*) &(pStats->retry_cnt[0]), |
| 7317 | tlen); |
| 7318 | |
| 7319 | FILL_TLV(p, (tANI_U8)WLAN_STATS_MUL_RETRY_CNT, |
| 7320 | (tANI_U8) sizeof (pStats->multiple_retry_cnt), |
| 7321 | (char*) &(pStats->multiple_retry_cnt[0]), |
| 7322 | tlen); |
| 7323 | |
| 7324 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_FRM_CNT, |
| 7325 | (tANI_U8) sizeof (pStats->tx_frm_cnt), |
| 7326 | (char*) &(pStats->tx_frm_cnt[0]), |
| 7327 | tlen); |
| 7328 | |
| 7329 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_FRM_CNT, |
| 7330 | (tANI_U8) sizeof (pStats->rx_frm_cnt), |
| 7331 | (char*) &(pStats->rx_frm_cnt), |
| 7332 | tlen); |
| 7333 | |
| 7334 | FILL_TLV(p, (tANI_U8)WLAN_STATS_FRM_DUP_CNT, |
| 7335 | (tANI_U8) sizeof (pStats->frm_dup_cnt), |
| 7336 | (char*) &(pStats->frm_dup_cnt), |
| 7337 | tlen); |
| 7338 | |
| 7339 | FILL_TLV(p, (tANI_U8)WLAN_STATS_FAIL_CNT, |
| 7340 | (tANI_U8) sizeof (pStats->fail_cnt), |
| 7341 | (char*) &(pStats->fail_cnt[0]), |
| 7342 | tlen); |
| 7343 | |
| 7344 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_FAIL_CNT, |
| 7345 | (tANI_U8) sizeof (pStats->rts_fail_cnt), |
| 7346 | (char*) &(pStats->rts_fail_cnt), |
| 7347 | tlen); |
| 7348 | |
| 7349 | FILL_TLV(p, (tANI_U8)WLAN_STATS_ACK_FAIL_CNT, |
| 7350 | (tANI_U8) sizeof (pStats->ack_fail_cnt), |
| 7351 | (char*) &(pStats->ack_fail_cnt), |
| 7352 | tlen); |
| 7353 | |
| 7354 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_SUC_CNT, |
| 7355 | (tANI_U8) sizeof (pStats->rts_succ_cnt), |
| 7356 | (char*) &(pStats->rts_succ_cnt), |
| 7357 | tlen); |
| 7358 | |
| 7359 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_DISCARD_CNT, |
| 7360 | (tANI_U8) sizeof (pStats->rx_discard_cnt), |
| 7361 | (char*) &(pStats->rx_discard_cnt), |
| 7362 | tlen); |
| 7363 | |
| 7364 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_ERROR_CNT, |
| 7365 | (tANI_U8) sizeof (pStats->rx_error_cnt), |
| 7366 | (char*) &(pStats->rx_error_cnt), |
| 7367 | tlen); |
| 7368 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7369 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BYTE_CNT, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7370 | (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]), |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7371 | (char*) &(dStats->tx_uc_byte_cnt[0]), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7372 | tlen); |
| 7373 | |
| 7374 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BYTE_CNT, |
| 7375 | (tANI_U8) sizeof (dStats->rx_byte_cnt), |
| 7376 | (char*) &(dStats->rx_byte_cnt), |
| 7377 | tlen); |
| 7378 | |
| 7379 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_RATE, |
| 7380 | (tANI_U8) sizeof (dStats->rx_rate), |
| 7381 | (char*) &(dStats->rx_rate), |
| 7382 | tlen); |
| 7383 | |
| 7384 | /* Transmit rate, in units of 500 kbit/sec */ |
| 7385 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_RATE, |
| 7386 | (tANI_U8) sizeof (aStats->tx_rate), |
| 7387 | (char*) &(aStats->tx_rate), |
| 7388 | tlen); |
| 7389 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7390 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_UC_BYTE_CNT, |
| 7391 | (tANI_U8) sizeof (dStats->rx_uc_byte_cnt[0]), |
| 7392 | (char*) &(dStats->rx_uc_byte_cnt[0]), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7393 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7394 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_MC_BYTE_CNT, |
| 7395 | (tANI_U8) sizeof (dStats->rx_mc_byte_cnt), |
| 7396 | (char*) &(dStats->rx_mc_byte_cnt), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7397 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7398 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BC_BYTE_CNT, |
| 7399 | (tANI_U8) sizeof (dStats->rx_bc_byte_cnt), |
| 7400 | (char*) &(dStats->rx_bc_byte_cnt), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7401 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7402 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_UC_BYTE_CNT, |
| 7403 | (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]), |
| 7404 | (char*) &(dStats->tx_uc_byte_cnt[0]), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7405 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7406 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_MC_BYTE_CNT, |
| 7407 | (tANI_U8) sizeof (dStats->tx_mc_byte_cnt), |
| 7408 | (char*) &(dStats->tx_mc_byte_cnt), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7409 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7410 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BC_BYTE_CNT, |
| 7411 | (tANI_U8) sizeof (dStats->tx_bc_byte_cnt), |
| 7412 | (char*) &(dStats->tx_bc_byte_cnt), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7413 | tlen); |
| 7414 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7415 | wrqu->data.length = tlen; |
| 7416 | |
| 7417 | } |
| 7418 | |
| 7419 | EXIT(); |
| 7420 | |
| 7421 | return 0; |
| 7422 | } |
| 7423 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7424 | static int iw_get_statistics(struct net_device *dev, |
| 7425 | struct iw_request_info *info, |
| 7426 | union iwreq_data *wrqu, char *extra) |
| 7427 | { |
| 7428 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7429 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7430 | vos_ssr_protect(__func__); |
| 7431 | ret = __iw_get_statistics(dev, info, wrqu, extra); |
| 7432 | vos_ssr_unprotect(__func__); |
| 7433 | |
| 7434 | return ret; |
| 7435 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7436 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 7437 | |
| 7438 | /*Max Len for PNO notification*/ |
| 7439 | #define MAX_PNO_NOTIFY_LEN 100 |
| 7440 | void found_pref_network_cb (void *callbackContext, |
| 7441 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 7442 | { |
| 7443 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 7444 | union iwreq_data wrqu; |
| 7445 | char buf[MAX_PNO_NOTIFY_LEN+1]; |
| 7446 | |
| 7447 | hddLog(VOS_TRACE_LEVEL_WARN, "A preferred network was found: %s with rssi: -%d", |
| 7448 | pPrefNetworkFoundInd->ssId.ssId, pPrefNetworkFoundInd->rssi); |
| 7449 | |
| 7450 | // create the event |
| 7451 | memset(&wrqu, 0, sizeof(wrqu)); |
| 7452 | memset(buf, 0, sizeof(buf)); |
| 7453 | |
| 7454 | snprintf(buf, MAX_PNO_NOTIFY_LEN, "QCOM: Found preferred network: %s with RSSI of -%u", |
| 7455 | pPrefNetworkFoundInd->ssId.ssId, |
| 7456 | (unsigned int)pPrefNetworkFoundInd->rssi); |
| 7457 | |
| 7458 | wrqu.data.pointer = buf; |
| 7459 | wrqu.data.length = strlen(buf); |
| 7460 | |
| 7461 | // send the event |
| 7462 | |
| 7463 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 7464 | |
| 7465 | } |
| 7466 | |
| 7467 | |
| 7468 | /*string based input*/ |
| 7469 | VOS_STATUS iw_set_pno(struct net_device *dev, struct iw_request_info *info, |
| 7470 | union iwreq_data *wrqu, char *extra, int nOffset) |
| 7471 | { |
| 7472 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7473 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Madan Mohan Koyyalamudi | 729972c | 2012-10-21 12:39:24 -0700 | [diff] [blame] | 7474 | /* pnoRequest is a large struct, so we make it static to avoid stack |
| 7475 | overflow. This API is only invoked via ioctl, so it is |
| 7476 | serialized by the kernel rtnl_lock and hence does not need to be |
| 7477 | reentrant */ |
| 7478 | static tSirPNOScanReq pnoRequest; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7479 | char *ptr; |
| 7480 | v_U8_t i,j, ucParams, ucMode; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7481 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7482 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 7483 | |
| 7484 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7485 | "PNO data len %d data %s", |
| 7486 | wrqu->data.length, |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 7487 | extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7488 | |
| 7489 | if (wrqu->data.length <= nOffset ) |
| 7490 | { |
| 7491 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "PNO input is not correct"); |
| 7492 | return VOS_STATUS_E_FAILURE; |
| 7493 | } |
| 7494 | |
| 7495 | pnoRequest.enable = 0; |
| 7496 | pnoRequest.ucNetworksCount = 0; |
| 7497 | /*----------------------------------------------------------------------- |
| 7498 | Input is string based and expected to be like this: |
| 7499 | |
| 7500 | <enabled> <netw_count> |
| 7501 | for each network: |
| 7502 | <ssid_len> <ssid> <authentication> <encryption> |
| 7503 | <ch_num> <channel_list optional> <bcast_type> <rssi_threshold> |
| 7504 | <scan_timers> <scan_time> <scan_repeat> <scan_time> <scan_repeat> |
| 7505 | |
| 7506 | e.g: |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 7507 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7508 | |
| 7509 | this translates into: |
| 7510 | ----------------------------- |
| 7511 | enable PNO |
| 7512 | look for 2 networks: |
| 7513 | test - with authentication type 0 and encryption type 0, |
| 7514 | that can be found on 3 channels: 1 6 and 11 , |
| 7515 | SSID bcast type is unknown (directed probe will be sent if AP not found) |
| 7516 | and must meet -40dBm RSSI |
| 7517 | |
| 7518 | test2 - with auth and enrytption type 4/4 |
| 7519 | that can be found on 6 channels 1, 2, 3, 4, 5 and 6 |
| 7520 | bcast type is non-bcast (directed probe will be sent) |
| 7521 | and must not meet any RSSI threshold |
| 7522 | |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 7523 | scan every 5 seconds 2 times, scan every 300 seconds until stopped |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7524 | -----------------------------------------------------------------------*/ |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 7525 | ptr = extra + nOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7526 | |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7527 | if (1 != sscanf(ptr,"%hhu%n", &(pnoRequest.enable), &nOffset)) |
| 7528 | { |
| 7529 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7530 | "PNO enable input is not valid %s",ptr); |
| 7531 | return VOS_STATUS_E_FAILURE; |
| 7532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7533 | |
| 7534 | if ( 0 == pnoRequest.enable ) |
| 7535 | { |
| 7536 | /*Disable PNO*/ |
| 7537 | memset(&pnoRequest, 0, sizeof(pnoRequest)); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7538 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7539 | &pnoRequest, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7540 | pAdapter->sessionId, |
| 7541 | found_pref_network_cb, pAdapter); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7542 | if (eHAL_STATUS_SUCCESS != status) |
| 7543 | { |
| 7544 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7545 | "%s: failed to disable PNO", __func__); |
| 7546 | return VOS_STATUS_E_FAILURE; |
| 7547 | } |
| 7548 | pHddCtx->isPnoEnable = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7549 | return VOS_STATUS_SUCCESS; |
| 7550 | } |
| 7551 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7552 | if (TRUE == pHddCtx->isPnoEnable) |
| 7553 | { |
| 7554 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7555 | FL("already PNO is enabled")); |
| 7556 | return -EBUSY; |
| 7557 | } |
| 7558 | pHddCtx->isPnoEnable = TRUE; |
| 7559 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7560 | ptr += nOffset; |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7561 | |
| 7562 | if (1 != sscanf(ptr,"%hhu %n", &(pnoRequest.ucNetworksCount), &nOffset)) |
| 7563 | { |
| 7564 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7565 | "PNO count input not valid %s",ptr); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7566 | goto error; |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7567 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7568 | |
| 7569 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7570 | "PNO enable %d networks count %d offset %d", |
| 7571 | pnoRequest.enable, |
| 7572 | pnoRequest.ucNetworksCount, |
| 7573 | nOffset); |
| 7574 | |
| 7575 | /* Parameters checking: |
| 7576 | ucNetworksCount has to be larger than 0*/ |
| 7577 | if (( 0 == pnoRequest.ucNetworksCount ) || |
| 7578 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 7579 | { |
| 7580 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Network input is not correct"); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7581 | goto error; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7582 | } |
| 7583 | |
| 7584 | ptr += nOffset; |
| 7585 | |
| 7586 | for ( i = 0; i < pnoRequest.ucNetworksCount; i++ ) |
| 7587 | { |
| 7588 | |
| 7589 | pnoRequest.aNetworks[i].ssId.length = 0; |
| 7590 | |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7591 | ucParams = sscanf(ptr,"%hhu %n", |
| 7592 | &(pnoRequest.aNetworks[i].ssId.length),&nOffset); |
| 7593 | |
| 7594 | if (1 != ucParams) |
| 7595 | { |
| 7596 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7597 | "PNO ssid length input is not valid %s",ptr); |
| 7598 | return VOS_STATUS_E_FAILURE; |
| 7599 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7600 | |
| 7601 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 7602 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
| 7603 | { |
| 7604 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7605 | "SSID Len %d is not correct for network %d", |
| 7606 | pnoRequest.aNetworks[i].ssId.length, i); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7607 | goto error; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7608 | } |
| 7609 | |
| 7610 | /*Advance to SSID*/ |
| 7611 | ptr += nOffset; |
| 7612 | |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 7613 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, ptr, |
Amar Singhal | 751e607 | 2013-01-24 16:02:56 -0800 | [diff] [blame] | 7614 | pnoRequest.aNetworks[i].ssId.length); |
| 7615 | ptr += pnoRequest.aNetworks[i].ssId.length; |
| 7616 | |
Jeff Johnson | 0279779 | 2013-10-26 19:17:13 -0700 | [diff] [blame] | 7617 | ucParams = sscanf(ptr,"%u %u %hhu %n", |
Amar Singhal | 751e607 | 2013-01-24 16:02:56 -0800 | [diff] [blame] | 7618 | &(pnoRequest.aNetworks[i].authentication), |
| 7619 | &(pnoRequest.aNetworks[i].encryption), |
| 7620 | &(pnoRequest.aNetworks[i].ucChannelCount), |
| 7621 | &nOffset); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7622 | |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7623 | if ( 3 != ucParams ) |
| 7624 | { |
| 7625 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7626 | "Incorrect cmd %s",ptr); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7627 | goto error; |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7628 | } |
| 7629 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7630 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 7631 | "PNO len %d ssid 0x%08x%08x%08x%08x%08x%08x%08x%08x" |
Amar Singhal | 751e607 | 2013-01-24 16:02:56 -0800 | [diff] [blame] | 7632 | "auth %d encry %d channel count %d offset %d", |
| 7633 | pnoRequest.aNetworks[i].ssId.length, |
| 7634 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[0]), |
| 7635 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[4]), |
| 7636 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[8]), |
| 7637 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[12]), |
| 7638 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[16]), |
| 7639 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[20]), |
| 7640 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[24]), |
| 7641 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[28]), |
| 7642 | pnoRequest.aNetworks[i].authentication, |
| 7643 | pnoRequest.aNetworks[i].encryption, |
| 7644 | pnoRequest.aNetworks[i].ucChannelCount, |
| 7645 | nOffset ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7647 | /*Advance to channel list*/ |
| 7648 | ptr += nOffset; |
| 7649 | |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7650 | if (SIR_PNO_MAX_NETW_CHANNELS < pnoRequest.aNetworks[i].ucChannelCount) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7651 | { |
| 7652 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7653 | "Incorrect number of channels"); |
| 7654 | return VOS_STATUS_E_FAILURE; |
| 7655 | } |
| 7656 | |
| 7657 | if ( 0 != pnoRequest.aNetworks[i].ucChannelCount) |
| 7658 | { |
| 7659 | for ( j = 0; j < pnoRequest.aNetworks[i].ucChannelCount; j++) |
| 7660 | { |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7661 | if (1 != sscanf(ptr,"%hhu %n", |
| 7662 | &(pnoRequest.aNetworks[i].aChannels[j]), |
| 7663 | &nOffset)) |
| 7664 | { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7665 | "PNO network channel input is not valid %s",ptr); |
| 7666 | return VOS_STATUS_E_FAILURE; |
| 7667 | } |
| 7668 | /*Advance to next channel number*/ |
| 7669 | ptr += nOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7670 | } |
| 7671 | } |
| 7672 | |
Jeff Johnson | 0279779 | 2013-10-26 19:17:13 -0700 | [diff] [blame] | 7673 | if (1 != sscanf(ptr,"%u %n", |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7674 | &(pnoRequest.aNetworks[i].bcastNetwType), |
| 7675 | &nOffset)) |
| 7676 | { |
| 7677 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7678 | "PNO broadcast network type input is not valid %s",ptr); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7679 | goto error; |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7680 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7681 | |
| 7682 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7683 | "PNO bcastNetwType %d offset %d", |
| 7684 | pnoRequest.aNetworks[i].bcastNetwType, |
| 7685 | nOffset ); |
| 7686 | |
| 7687 | /*Advance to rssi Threshold*/ |
| 7688 | ptr += nOffset; |
| 7689 | |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7690 | if (1 != sscanf(ptr,"%hhu %n", |
| 7691 | &(pnoRequest.aNetworks[i].rssiThreshold), |
| 7692 | &nOffset)) |
| 7693 | { |
| 7694 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7695 | "PNO rssi threshold input is not valid %s",ptr); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7696 | goto error; |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7698 | |
| 7699 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7700 | "PNO rssi %d offset %d", |
| 7701 | pnoRequest.aNetworks[i].rssiThreshold, |
| 7702 | nOffset ); |
| 7703 | /*Advance to next network*/ |
| 7704 | ptr += nOffset; |
| 7705 | }/*For ucNetworkCount*/ |
| 7706 | |
| 7707 | ucParams = sscanf(ptr,"%hhu %n", |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7708 | &(pnoRequest.scanTimers.ucScanTimersCount), |
| 7709 | &nOffset); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7710 | |
| 7711 | /*Read the scan timers*/ |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 7712 | if (( 1 == ucParams ) && ( pnoRequest.scanTimers.ucScanTimersCount > 0 )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7713 | { |
| 7714 | ptr += nOffset; |
| 7715 | |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 7716 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7717 | "Scan timer count %d offset %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7718 | pnoRequest.scanTimers.ucScanTimersCount, |
| 7719 | nOffset ); |
| 7720 | |
| 7721 | if ( SIR_PNO_MAX_SCAN_TIMERS < pnoRequest.scanTimers.ucScanTimersCount ) |
| 7722 | { |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 7723 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7724 | "Incorrect cmd - too many scan timers"); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7725 | goto error; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7726 | } |
| 7727 | |
| 7728 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++ ) |
| 7729 | { |
Jeff Johnson | 0279779 | 2013-10-26 19:17:13 -0700 | [diff] [blame] | 7730 | ucParams = sscanf(ptr,"%u %u %n", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7731 | &(pnoRequest.scanTimers.aTimerValues[i].uTimerValue), |
| 7732 | &( pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat), |
| 7733 | &nOffset); |
| 7734 | |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7735 | if (2 != ucParams) |
| 7736 | { |
| 7737 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7738 | "Incorrect cmd - diff params then expected %d", ucParams); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7739 | goto error; |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7740 | } |
| 7741 | |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 7742 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7743 | "PNO Timer value %d Timer repeat %d offset %d", |
| 7744 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7745 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat, |
| 7746 | nOffset ); |
| 7747 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7748 | ptr += nOffset; |
| 7749 | } |
| 7750 | |
| 7751 | } |
| 7752 | else |
| 7753 | { |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 7754 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7755 | "No scan timers provided param count %d scan timers %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7756 | ucParams, pnoRequest.scanTimers.ucScanTimersCount ); |
| 7757 | |
| 7758 | /*Scan timers defaults to 5 minutes*/ |
| 7759 | pnoRequest.scanTimers.ucScanTimersCount = 1; |
| 7760 | pnoRequest.scanTimers.aTimerValues[0].uTimerValue = 60; |
| 7761 | pnoRequest.scanTimers.aTimerValues[0].uTimerRepeat = 0; |
| 7762 | } |
| 7763 | |
Wilson Yang | 623f659 | 2013-10-08 16:33:37 -0700 | [diff] [blame] | 7764 | ucParams = sscanf(ptr,"%hhu %n",&(ucMode), &nOffset); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7765 | |
| 7766 | pnoRequest.modePNO = ucMode; |
| 7767 | /*for LA we just expose suspend option*/ |
| 7768 | if (( 1 != ucParams )||( ucMode >= SIR_PNO_MODE_MAX )) |
| 7769 | { |
| 7770 | pnoRequest.modePNO = SIR_PNO_MODE_ON_SUSPEND; |
| 7771 | } |
| 7772 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7773 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), &pnoRequest, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7774 | pAdapter->sessionId, |
| 7775 | found_pref_network_cb, pAdapter); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 7776 | if (eHAL_STATUS_SUCCESS == status) |
| 7777 | { |
| 7778 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7779 | "%s: PNO enabled", __func__); |
| 7780 | return VOS_STATUS_SUCCESS; |
| 7781 | } |
| 7782 | error: |
| 7783 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7784 | "%s: Failed to enable PNO", __func__); |
| 7785 | pHddCtx->isPnoEnable = FALSE; |
| 7786 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7787 | }/*iw_set_pno*/ |
| 7788 | |
| 7789 | VOS_STATUS iw_set_rssi_filter(struct net_device *dev, struct iw_request_info *info, |
| 7790 | union iwreq_data *wrqu, char *extra, int nOffset) |
| 7791 | { |
| 7792 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7793 | v_U8_t rssiThreshold = 0; |
| 7794 | v_U8_t nRead; |
| 7795 | |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 7796 | nRead = sscanf(extra + nOffset,"%hhu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7797 | &rssiThreshold); |
| 7798 | |
| 7799 | if ( 1 != nRead ) |
| 7800 | { |
| 7801 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 7802 | "Incorrect format"); |
| 7803 | return VOS_STATUS_E_FAILURE; |
| 7804 | } |
| 7805 | |
| 7806 | sme_SetRSSIFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), rssiThreshold); |
| 7807 | return VOS_STATUS_SUCCESS; |
| 7808 | } |
| 7809 | |
| 7810 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7811 | static int __iw_set_pno_priv(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7812 | struct iw_request_info *info, |
| 7813 | union iwreq_data *wrqu, char *extra) |
| 7814 | { |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7815 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7816 | |
| 7817 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7818 | "Set PNO Private"); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7819 | |
| 7820 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 7821 | { |
| 7822 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7823 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 7824 | return -EBUSY; |
| 7825 | } |
| 7826 | return iw_set_pno(dev,info,wrqu,extra,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7827 | } |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7828 | |
| 7829 | static int iw_set_pno_priv(struct net_device *dev, |
| 7830 | struct iw_request_info *info, |
| 7831 | union iwreq_data *wrqu, char *extra) |
| 7832 | { |
| 7833 | int ret; |
| 7834 | |
| 7835 | vos_ssr_protect(__func__); |
| 7836 | ret = __iw_set_pno_priv(dev, info, wrqu, extra); |
| 7837 | vos_ssr_unprotect(__func__); |
| 7838 | |
| 7839 | return ret; |
| 7840 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7841 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 7842 | |
| 7843 | //Common function to SetBand |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 7844 | int hdd_setBand(struct net_device *dev, u8 ui_band) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7845 | { |
| 7846 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7847 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7848 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 7849 | eCsrBand band; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7850 | eCsrBand currBand = eCSR_BAND_MAX; |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 7851 | eCsrBand connectedBand; |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 7852 | v_U8_t ret = SEND_CHANNEL_CHANGE_EVENT; |
| 7853 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7854 | |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 7855 | switch(ui_band) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7856 | { |
| 7857 | case WLAN_HDD_UI_BAND_AUTO: |
| 7858 | band = eCSR_BAND_ALL; |
| 7859 | break; |
| 7860 | case WLAN_HDD_UI_BAND_5_GHZ: |
| 7861 | band = eCSR_BAND_5G; |
| 7862 | break; |
| 7863 | case WLAN_HDD_UI_BAND_2_4_GHZ: |
| 7864 | band = eCSR_BAND_24; |
| 7865 | break; |
| 7866 | default: |
| 7867 | band = eCSR_BAND_MAX; |
| 7868 | } |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 7869 | connectedBand = |
| 7870 | hdd_connGetConnectedBand(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7871 | |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 7872 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change band to %u", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7873 | __func__, band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7874 | |
| 7875 | if (band == eCSR_BAND_MAX) |
| 7876 | { |
| 7877 | /* Received change band request with invalid band value */ |
| 7878 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 7879 | "%s: Invalid band value %u", __func__, ui_band); |
| 7880 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7881 | } |
| 7882 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7883 | if ( (band == eCSR_BAND_24 && pHddCtx->cfg_ini->nBandCapability==2) || |
| 7884 | (band == eCSR_BAND_5G && pHddCtx->cfg_ini->nBandCapability==1) || |
| 7885 | (band == eCSR_BAND_ALL && pHddCtx->cfg_ini->nBandCapability!=0)) |
| 7886 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 7887 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7888 | "%s: band value %u violate INI settings %u", __func__, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7889 | band, pHddCtx->cfg_ini->nBandCapability); |
| 7890 | return -EIO; |
| 7891 | } |
| 7892 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7893 | if (eHAL_STATUS_SUCCESS != sme_GetFreqBand(hHal, &currBand)) |
| 7894 | { |
| 7895 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7896 | "%s: Failed to get current band config", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7897 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7898 | return -EIO; |
| 7899 | } |
| 7900 | |
| 7901 | if (currBand != band) |
| 7902 | { |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 7903 | /* Return failure if current country code is world regulatory domain*/ |
| 7904 | if( (pMac->scan.countryCodeCurrent[0] == '0' && |
| 7905 | pMac->scan.countryCodeCurrent[1] == '0') ) |
| 7906 | { |
| 7907 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7908 | "%s: failed to set the band value to %u as country code is 00", |
| 7909 | __func__, band); |
| 7910 | return -EAGAIN; |
| 7911 | } |
| 7912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7913 | /* Change band request received. |
| 7914 | * Abort pending scan requests, flush the existing scan results, |
| 7915 | * and change the band capability |
| 7916 | */ |
| 7917 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7918 | "%s: Current band value = %u, new setting %u ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7919 | __func__, currBand, band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7920 | |
Srinivas, Dasari | 187ca4e | 2014-02-07 12:40:09 +0530 | [diff] [blame] | 7921 | /* We need to change the band and flush the scan results here itself |
| 7922 | * as we may get timeout for disconnection in which we will return |
| 7923 | * with out doing any of these |
| 7924 | */ |
| 7925 | if (eHAL_STATUS_SUCCESS != sme_SetFreqBand(hHal, (eCsrBand)band)) |
| 7926 | { |
| 7927 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 7928 | "%s: failed to set the band value to %u ", |
| 7929 | __func__, band); |
| 7930 | return -EINVAL; |
| 7931 | } |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 7932 | if(currBand == eCSR_BAND_24 || currBand == eCSR_BAND_5G) |
| 7933 | { |
| 7934 | v_COUNTRYCODE_t curr_country; |
| 7935 | curr_country[0]=pMac->scan.countryCodeCurrent[0]; |
| 7936 | curr_country[1]=pMac->scan.countryCodeCurrent[1]; |
| 7937 | |
| 7938 | /* As currunt band is already set to 2.4Ghz/5Ghz we dont have all channel |
| 7939 | * information available in NV so to get the channel information from kernel |
| 7940 | * we need to send regulatory hint for the currunt country |
| 7941 | * And to set the same country again we need to set the dummy country |
| 7942 | * first and then the actual country. |
| 7943 | */ |
| 7944 | |
| 7945 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 7946 | regulatory_hint_user("00", NL80211_USER_REG_HINT_USER); |
| 7947 | #else |
| 7948 | regulatory_hint_user("00"); |
| 7949 | #endif |
| 7950 | |
| 7951 | pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_TRUE; |
| 7952 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 7953 | regulatory_hint_user(curr_country, NL80211_USER_REG_HINT_USER); |
| 7954 | #else |
| 7955 | regulatory_hint_user(curr_country); |
| 7956 | #endif |
| 7957 | ret = DO_NOT_SEND_CHANNEL_CHANGE_EVENT; |
| 7958 | } |
| 7959 | else |
| 7960 | { |
| 7961 | vos_update_nv_table_from_wiphy_band((void *)pHddCtx, |
| 7962 | (void *)pHddCtx->wiphy, (eCsrBand)band); |
| 7963 | } |
| 7964 | |
Srinivas, Dasari | 187ca4e | 2014-02-07 12:40:09 +0530 | [diff] [blame] | 7965 | hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId, |
| 7966 | eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE); |
| 7967 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
| 7968 | |
| 7969 | if (band != eCSR_BAND_ALL && |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 7970 | hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)) && |
| 7971 | (connectedBand != band)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7972 | { |
| 7973 | hdd_station_ctx_t *pHddStaCtx = &(pAdapter)->sessionCtx.station; |
| 7974 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7975 | long lrc; |
| 7976 | |
| 7977 | /* STA already connected on current band, So issue disconnect first, |
| 7978 | * then change the band*/ |
| 7979 | |
| 7980 | hddLog(VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 7981 | "%s STA connected in band %u, Changing band to %u, Issuing Disconnect." |
| 7982 | " Set HDD connState to eConnectionState_NotConnected", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7983 | __func__, csrGetCurrentBand(hHal), band); |
| 7984 | |
| 7985 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 7986 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 7987 | |
| 7988 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7989 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 7990 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 7991 | if ( eHAL_STATUS_SUCCESS != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7992 | { |
| 7993 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7994 | "%s csrRoamDisconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7995 | __func__, (int)status ); |
| 7996 | return -EINVAL; |
| 7997 | } |
| 7998 | |
| 7999 | lrc = wait_for_completion_interruptible_timeout( |
| 8000 | &pAdapter->disconnect_comp_var, |
| 8001 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 8002 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8003 | if (lrc <= 0) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8004 | |
Srinivas Girigowda | cb4c641 | 2013-07-02 10:19:12 -0700 | [diff] [blame] | 8005 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: %s while waiting for csrRoamDisconnect ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8006 | __func__, (0 == lrc) ? "Timeout" : "Interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8007 | |
| 8008 | return (0 == lrc) ? -ETIMEDOUT : -EINTR; |
| 8009 | } |
| 8010 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8011 | } |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 8012 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8013 | } |
| 8014 | |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 8015 | int hdd_setBand_helper(struct net_device *dev, const char *command) |
| 8016 | { |
| 8017 | u8 band; |
| 8018 | |
| 8019 | /*convert the band value from ascii to integer*/ |
| 8020 | band = command[WLAN_HDD_UI_SET_BAND_VALUE_OFFSET] - '0'; |
| 8021 | |
| 8022 | return hdd_setBand(dev, band); |
| 8023 | |
| 8024 | } |
| 8025 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8026 | static int __iw_set_band_config(struct net_device *dev, |
| 8027 | struct iw_request_info *info, |
| 8028 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8029 | { |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8030 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 8031 | int *value = (int *)extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8032 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 8033 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8034 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8035 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 8036 | { |
| 8037 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8038 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 8039 | return -EBUSY; |
| 8040 | } |
| 8041 | |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 8042 | return hdd_setBand(dev, value[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8043 | } |
| 8044 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8045 | static int iw_set_band_config(struct net_device *dev, |
| 8046 | struct iw_request_info *info, |
| 8047 | union iwreq_data *wrqu, char *extra) |
| 8048 | { |
| 8049 | int ret; |
| 8050 | |
| 8051 | vos_ssr_protect(__func__); |
| 8052 | ret = __iw_set_band_config(dev, info, wrqu, extra); |
| 8053 | vos_ssr_unprotect(__func__); |
| 8054 | |
| 8055 | return ret; |
| 8056 | } |
| 8057 | |
| 8058 | static int __iw_set_power_params_priv(struct net_device *dev, |
| 8059 | struct iw_request_info *info, |
| 8060 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8061 | { |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 8062 | int ret; |
| 8063 | char *ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8064 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8065 | "Set power params Private"); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 8066 | /* ODD number is used for set, copy data using copy_from_user */ |
| 8067 | ptr = mem_alloc_copy_from_user_helper(wrqu->data.pointer, |
| 8068 | wrqu->data.length); |
| 8069 | if (NULL == ptr) |
| 8070 | { |
| 8071 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8072 | "mem_alloc_copy_from_user_helper fail"); |
| 8073 | return -ENOMEM; |
| 8074 | } |
| 8075 | |
| 8076 | ret = iw_set_power_params(dev, info, wrqu, ptr, 0); |
| 8077 | kfree(ptr); |
| 8078 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8079 | } |
| 8080 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8081 | static int iw_set_power_params_priv(struct net_device *dev, |
| 8082 | struct iw_request_info *info, |
| 8083 | union iwreq_data *wrqu, char *extra) |
| 8084 | { |
| 8085 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8086 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8087 | vos_ssr_protect(__func__); |
| 8088 | ret = __iw_set_power_params_priv(dev, info, wrqu, extra); |
| 8089 | vos_ssr_unprotect(__func__); |
| 8090 | |
| 8091 | return ret; |
| 8092 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8093 | |
| 8094 | /*string based input*/ |
| 8095 | VOS_STATUS iw_set_power_params(struct net_device *dev, struct iw_request_info *info, |
| 8096 | union iwreq_data *wrqu, char *extra, int nOffset) |
| 8097 | { |
| 8098 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8099 | tSirSetPowerParamsReq powerRequest; |
| 8100 | char *ptr; |
| 8101 | v_U8_t ucType; |
| 8102 | v_U32_t uTotalSize, uValue; |
| 8103 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 8104 | |
| 8105 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8106 | "Power Params data len %d data %s", |
| 8107 | wrqu->data.length, |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 8108 | extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8109 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8110 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 8111 | { |
| 8112 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8113 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 8114 | return -EBUSY; |
| 8115 | } |
| 8116 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8117 | if (wrqu->data.length <= nOffset ) |
| 8118 | { |
| 8119 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "set power param input is not correct"); |
| 8120 | return VOS_STATUS_E_FAILURE; |
| 8121 | } |
| 8122 | |
| 8123 | uTotalSize = wrqu->data.length - nOffset; |
| 8124 | |
| 8125 | /*----------------------------------------------------------------------- |
| 8126 | Input is string based and expected to be like this: |
| 8127 | |
| 8128 | <param_type> <param_value> <param_type> <param_value> ... |
| 8129 | |
| 8130 | e.g: |
| 8131 | 1 2 2 3 3 0 4 1 5 1 |
| 8132 | |
| 8133 | e.g. setting just a few: |
| 8134 | 1 2 4 1 |
| 8135 | |
| 8136 | parameter types: |
| 8137 | ----------------------------- |
| 8138 | 1 - Ignore DTIM |
| 8139 | 2 - Listen Interval |
| 8140 | 3 - Broadcast Multicas Filter |
| 8141 | 4 - Beacon Early Termination |
| 8142 | 5 - Beacon Early Termination Interval |
| 8143 | -----------------------------------------------------------------------*/ |
| 8144 | powerRequest.uIgnoreDTIM = SIR_NOCHANGE_POWER_VALUE; |
| 8145 | powerRequest.uListenInterval = SIR_NOCHANGE_POWER_VALUE; |
| 8146 | powerRequest.uBcastMcastFilter = SIR_NOCHANGE_POWER_VALUE; |
| 8147 | powerRequest.uEnableBET = SIR_NOCHANGE_POWER_VALUE; |
| 8148 | powerRequest.uBETInterval = SIR_NOCHANGE_POWER_VALUE; |
| 8149 | |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 8150 | ptr = extra + nOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8151 | |
| 8152 | while ( uTotalSize ) |
| 8153 | { |
Wilson Yang | 6f97145 | 2013-10-08 15:00:00 -0700 | [diff] [blame] | 8154 | if (1 != sscanf(ptr,"%hhu %n", &(ucType), &nOffset)) |
| 8155 | { |
| 8156 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8157 | "Invalid input parameter type %s",ptr); |
| 8158 | return VOS_STATUS_E_FAILURE; |
| 8159 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8160 | |
| 8161 | uTotalSize -= nOffset; |
| 8162 | |
| 8163 | if (!uTotalSize) |
| 8164 | { |
| 8165 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 8166 | "Invalid input parameter type : %d with no value at offset %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8167 | ucType, nOffset); |
| 8168 | return VOS_STATUS_E_FAILURE; |
| 8169 | } |
| 8170 | |
| 8171 | ptr += nOffset; |
Wilson Yang | 6f97145 | 2013-10-08 15:00:00 -0700 | [diff] [blame] | 8172 | |
Jeff Johnson | 0279779 | 2013-10-26 19:17:13 -0700 | [diff] [blame] | 8173 | if (1 != sscanf(ptr,"%u %n", &(uValue), &nOffset)) |
Wilson Yang | 6f97145 | 2013-10-08 15:00:00 -0700 | [diff] [blame] | 8174 | { |
| 8175 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8176 | "Invalid input parameter value %s",ptr); |
| 8177 | return VOS_STATUS_E_FAILURE; |
| 8178 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8179 | |
| 8180 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8181 | "Power request parameter %d value %d offset %d", |
| 8182 | ucType, uValue, nOffset); |
| 8183 | |
| 8184 | switch (ucType) |
| 8185 | { |
| 8186 | case eSIR_IGNORE_DTIM: |
| 8187 | powerRequest.uIgnoreDTIM = uValue; |
| 8188 | break; |
| 8189 | case eSIR_LISTEN_INTERVAL: |
| 8190 | powerRequest.uListenInterval = uValue; |
| 8191 | break; |
| 8192 | case eSIR_MCAST_BCAST_FILTER: |
| 8193 | powerRequest.uBcastMcastFilter = uValue; |
| 8194 | break; |
| 8195 | case eSIR_ENABLE_BET: |
| 8196 | powerRequest.uEnableBET = uValue; |
| 8197 | break; |
| 8198 | case eSIR_BET_INTERVAL: |
| 8199 | powerRequest.uBETInterval = uValue; |
| 8200 | break; |
| 8201 | default: |
| 8202 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 8203 | "Invalid input parameter type : %d with value: %d at offset %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8204 | ucType, uValue, nOffset); |
| 8205 | return VOS_STATUS_E_FAILURE; |
| 8206 | } |
| 8207 | |
| 8208 | uTotalSize -= nOffset; |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 8209 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8210 | "Power request parameter %d Total size", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8211 | uTotalSize); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8212 | ptr += nOffset; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8213 | /* This is added for dynamic Tele LI enable (0xF1) /disable (0xF0)*/ |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 8214 | if(!(uTotalSize - nOffset) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8215 | (powerRequest.uListenInterval != SIR_NOCHANGE_POWER_VALUE)) |
| 8216 | { |
| 8217 | uTotalSize = 0; |
| 8218 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8219 | |
| 8220 | }/*Go for as long as we have a valid string*/ |
| 8221 | |
| 8222 | /* put the device into full power*/ |
| 8223 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE); |
| 8224 | |
| 8225 | /* Apply the power save params*/ |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 8226 | sme_SetPowerParams( WLAN_HDD_GET_HAL_CTX(pAdapter), &powerRequest, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8227 | |
| 8228 | /* put the device back to power save*/ |
| 8229 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO); |
| 8230 | |
| 8231 | return VOS_STATUS_SUCCESS; |
| 8232 | }/*iw_set_power_params*/ |
| 8233 | |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 8234 | // tdlsoffchan |
| 8235 | #ifdef FEATURE_WLAN_TDLS |
| 8236 | |
| 8237 | static int iw_set_tdlsoffchannel(hdd_context_t *pHddCtx, int offchannel) |
| 8238 | { |
| 8239 | if (offchannel < 0 || offchannel > 165) |
| 8240 | { |
| 8241 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Invalid tdls off channel %u", |
| 8242 | __func__, offchannel); |
| 8243 | return -1; |
| 8244 | |
| 8245 | } |
| 8246 | |
| 8247 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls off channel from %d to %d", |
| 8248 | __func__, tdlsOffCh, offchannel); |
| 8249 | |
| 8250 | tdlsOffCh = offchannel; |
| 8251 | return 0; |
| 8252 | } |
| 8253 | |
| 8254 | static int iw_set_tdlssecoffchanneloffset(hdd_context_t *pHddCtx, int offchanoffset) |
| 8255 | { |
| 8256 | if (offchanoffset == 0) |
| 8257 | { |
| 8258 | tdlsOffChBwOffset = 0; |
| 8259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u", |
| 8260 | __func__, tdlsOffChBwOffset); |
| 8261 | |
| 8262 | return 0; |
| 8263 | |
| 8264 | } |
| 8265 | |
| 8266 | if ( offchanoffset == 40 ) |
| 8267 | { |
| 8268 | tdlsOffChBwOffset = 1; |
| 8269 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u", |
| 8270 | __func__, tdlsOffChBwOffset); |
| 8271 | |
| 8272 | return 0; |
| 8273 | |
| 8274 | } |
| 8275 | if (offchanoffset == -40) |
| 8276 | { |
| 8277 | tdlsOffChBwOffset = 3; |
| 8278 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u", |
| 8279 | __func__, tdlsOffChBwOffset); |
| 8280 | |
| 8281 | return 0; |
| 8282 | |
| 8283 | } |
| 8284 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Invalid tdls secondary off channel offset %d", |
| 8285 | __func__, offchanoffset); |
| 8286 | return -1; |
| 8287 | } |
| 8288 | |
| 8289 | static int iw_set_tdlsoffchannelmode(hdd_adapter_t *pAdapter, int offchanmode) |
| 8290 | { |
| 8291 | hddTdlsPeer_t *connPeer = NULL; |
| 8292 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8293 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8294 | |
| 8295 | if (offchanmode < 0 || offchanmode > 4) |
| 8296 | { |
| 8297 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8298 | "%s: Invalid tdls off channel mode %d", |
| 8299 | __func__, offchanmode); |
| 8300 | return -1; |
| 8301 | } |
| 8302 | |
| 8303 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 8304 | { |
| 8305 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8306 | "%s: tdls off channel mode req in not associated state %d", |
| 8307 | __func__, offchanmode); |
| 8308 | return -1; |
| 8309 | } |
| 8310 | |
| 8311 | if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode || |
| 8312 | eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode) |
| 8313 | { |
| 8314 | /* Send TDLS Channel Switch Request to connected peer */ |
| 8315 | connPeer = wlan_hdd_tdls_get_first_connected_peer(pAdapter); |
| 8316 | if (NULL == connPeer) { |
| 8317 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8318 | "%s: No TDLS Connected Peer", __func__); |
| 8319 | return -1; |
| 8320 | } |
| 8321 | } |
| 8322 | else |
| 8323 | { |
| 8324 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 8325 | "%s: TDLS Connection not supported", __func__); |
| 8326 | return -1; |
| 8327 | } |
| 8328 | |
| 8329 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8330 | ("%s: TDLS Channel Switch in swmode=%d"), |
| 8331 | __func__, offchanmode); |
| 8332 | |
| 8333 | switch (offchanmode) |
| 8334 | { |
| 8335 | case 1:/*Enable*/ |
| 8336 | case 2:/*Disable*/ |
| 8337 | { |
| 8338 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8339 | "%s: change tdls off channel mode %d tdls_off_channel %d offchanoffset %d ", |
| 8340 | __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset); |
| 8341 | if (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel) |
| 8342 | { |
| 8343 | |
| 8344 | sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8345 | pAdapter->sessionId, connPeer->peerMac, |
| 8346 | tdlsOffCh, tdlsOffChBwOffset, |
| 8347 | offchanmode); |
| 8348 | } |
| 8349 | else |
| 8350 | { |
| 8351 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8352 | "%s: TDLS Off Channel not supported", __func__); |
| 8353 | return -1; |
| 8354 | } |
| 8355 | break; |
| 8356 | } |
| 8357 | case 3: |
| 8358 | { |
| 8359 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8360 | "%s: change tdls off channel mode %d REJREQ 3 tdls_off_channel %d offchanoffset %d ", |
| 8361 | __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset); |
| 8362 | |
| 8363 | break; |
| 8364 | } |
| 8365 | case 4: |
| 8366 | { |
| 8367 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 8368 | "%s: change tdls off channel mode %d UNSOLRESP 4 tdls_off_channel %d offchanoffset %d ", |
| 8369 | __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset); |
| 8370 | break; |
| 8371 | } |
| 8372 | default: |
| 8373 | { |
| 8374 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8375 | "%s: change tdls off channel mode %d Not SET 0 tdls_off_channel %d offchanoffset %d ", |
| 8376 | __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset); |
| 8377 | break; |
| 8378 | } |
| 8379 | |
| 8380 | } |
| 8381 | |
| 8382 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls off channel mode to %u", |
| 8383 | __func__, offchanmode); |
| 8384 | return 0; |
| 8385 | } |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 8386 | #endif |
| 8387 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8388 | |
| 8389 | // Define the Wireless Extensions to the Linux Network Device structure |
| 8390 | // A number of these routines are NULL (meaning they are not implemented.) |
| 8391 | |
| 8392 | static const iw_handler we_handler[] = |
| 8393 | { |
| 8394 | (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */ |
| 8395 | (iw_handler) iw_get_name, /* SIOCGIWNAME */ |
| 8396 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 8397 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 8398 | (iw_handler) iw_set_freq, /* SIOCSIWFREQ */ |
| 8399 | (iw_handler) iw_get_freq, /* SIOCGIWFREQ */ |
| 8400 | (iw_handler) iw_set_mode, /* SIOCSIWMODE */ |
| 8401 | (iw_handler) iw_get_mode, /* SIOCGIWMODE */ |
| 8402 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 8403 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 8404 | (iw_handler) NULL, /* SIOCSIWRANGE */ |
| 8405 | (iw_handler) iw_get_range, /* SIOCGIWRANGE */ |
| 8406 | (iw_handler) iw_set_priv, /* SIOCSIWPRIV */ |
| 8407 | (iw_handler) NULL, /* SIOCGIWPRIV */ |
| 8408 | (iw_handler) NULL, /* SIOCSIWSTATS */ |
| 8409 | (iw_handler) NULL, /* SIOCGIWSTATS */ |
| 8410 | iw_handler_set_spy, /* SIOCSIWSPY */ |
| 8411 | iw_handler_get_spy, /* SIOCGIWSPY */ |
| 8412 | iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ |
| 8413 | iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ |
| 8414 | (iw_handler) iw_set_ap_address, /* SIOCSIWAP */ |
| 8415 | (iw_handler) iw_get_ap_address, /* SIOCGIWAP */ |
| 8416 | (iw_handler) iw_set_mlme, /* SIOCSIWMLME */ |
| 8417 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
| 8418 | (iw_handler) iw_set_scan, /* SIOCSIWSCAN */ |
| 8419 | (iw_handler) iw_get_scan, /* SIOCGIWSCAN */ |
| 8420 | (iw_handler) iw_set_essid, /* SIOCSIWESSID */ |
| 8421 | (iw_handler) iw_get_essid, /* SIOCGIWESSID */ |
| 8422 | (iw_handler) iw_set_nick, /* SIOCSIWNICKN */ |
| 8423 | (iw_handler) iw_get_nick, /* SIOCGIWNICKN */ |
| 8424 | (iw_handler) NULL, /* -- hole -- */ |
| 8425 | (iw_handler) NULL, /* -- hole -- */ |
| 8426 | (iw_handler) iw_set_bitrate, /* SIOCSIWRATE */ |
| 8427 | (iw_handler) iw_get_bitrate, /* SIOCGIWRATE */ |
| 8428 | (iw_handler) iw_set_rts_threshold,/* SIOCSIWRTS */ |
| 8429 | (iw_handler) iw_get_rts_threshold,/* SIOCGIWRTS */ |
| 8430 | (iw_handler) iw_set_frag_threshold, /* SIOCSIWFRAG */ |
| 8431 | (iw_handler) iw_get_frag_threshold, /* SIOCGIWFRAG */ |
| 8432 | (iw_handler) iw_set_tx_power, /* SIOCSIWTXPOW */ |
| 8433 | (iw_handler) iw_get_tx_power, /* SIOCGIWTXPOW */ |
| 8434 | (iw_handler) iw_set_retry, /* SIOCSIWRETRY */ |
| 8435 | (iw_handler) iw_get_retry, /* SIOCGIWRETRY */ |
| 8436 | (iw_handler) iw_set_encode, /* SIOCSIWENCODE */ |
| 8437 | (iw_handler) iw_get_encode, /* SIOCGIWENCODE */ |
| 8438 | (iw_handler) iw_set_power_mode, /* SIOCSIWPOWER */ |
| 8439 | (iw_handler) iw_get_power_mode, /* SIOCGIWPOWER */ |
| 8440 | (iw_handler) NULL, /* -- hole -- */ |
| 8441 | (iw_handler) NULL, /* -- hole -- */ |
| 8442 | (iw_handler) iw_set_genie, /* SIOCSIWGENIE */ |
| 8443 | (iw_handler) iw_get_genie, /* SIOCGIWGENIE */ |
| 8444 | (iw_handler) iw_set_auth, /* SIOCSIWAUTH */ |
| 8445 | (iw_handler) iw_get_auth, /* SIOCGIWAUTH */ |
| 8446 | (iw_handler) iw_set_encodeext, /* SIOCSIWENCODEEXT */ |
| 8447 | (iw_handler) iw_get_encodeext, /* SIOCGIWENCODEEXT */ |
| 8448 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 8449 | }; |
| 8450 | |
| 8451 | static const iw_handler we_private[] = { |
| 8452 | |
| 8453 | [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone, //set priv ioctl |
| 8454 | [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint, //get priv ioctl |
| 8455 | [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone, //get priv ioctl |
| 8456 | [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_three_ints_getnone, |
| 8457 | [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone, |
| 8458 | [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone, //action priv ioctl |
| 8459 | [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_var_ints_getnone, |
| 8460 | [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec, |
| 8461 | [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec, |
| 8462 | [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8463 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 8464 | [WLAN_PRIV_SET_OEM_DATA_REQ - SIOCIWFIRSTPRIV] = iw_set_oem_data_req, //oem data req Specifc |
| 8465 | [WLAN_PRIV_GET_OEM_DATA_RSP - SIOCIWFIRSTPRIV] = iw_get_oem_data_rsp, //oem data req Specifc |
| 8466 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8468 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8469 | [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties, |
| 8470 | #endif |
| 8471 | [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload, |
| 8472 | [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics, |
| 8473 | [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] = iw_set_keepalive_params |
| 8474 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 8475 | , |
| 8476 | [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] = iw_set_packet_filter_params |
| 8477 | #endif |
| 8478 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 8479 | , |
| 8480 | [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno_priv |
| 8481 | #endif |
| 8482 | , |
| 8483 | [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config, |
| 8484 | [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] = iw_set_dynamic_mcbc_filter, |
| 8485 | [WLAN_PRIV_CLEAR_MCBC_FILTER - SIOCIWFIRSTPRIV] = iw_clear_dynamic_mcbc_filter, |
| 8486 | [WLAN_SET_POWER_PARAMS - SIOCIWFIRSTPRIV] = iw_set_power_params_priv, |
Arif Hussain | 695279c | 2014-03-24 14:06:07 -0700 | [diff] [blame] | 8487 | [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed_priv, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8488 | }; |
| 8489 | |
| 8490 | /*Maximum command length can be only 15 */ |
| 8491 | static const struct iw_priv_args we_private_args[] = { |
| 8492 | |
| 8493 | /* handlers for main ioctl */ |
| 8494 | { WLAN_PRIV_SET_INT_GET_NONE, |
| 8495 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8496 | 0, |
| 8497 | "" }, |
| 8498 | |
| 8499 | /* handlers for sub-ioctl */ |
| 8500 | { WE_SET_11D_STATE, |
| 8501 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8502 | 0, |
| 8503 | "set11Dstate" }, |
| 8504 | |
| 8505 | { WE_WOWL, |
| 8506 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8507 | 0, |
| 8508 | "wowl" }, |
| 8509 | |
| 8510 | { WE_SET_POWER, |
| 8511 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8512 | 0, |
| 8513 | "setPower" }, |
| 8514 | |
| 8515 | { WE_SET_MAX_ASSOC, |
| 8516 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8517 | 0, |
| 8518 | "setMaxAssoc" }, |
| 8519 | |
| 8520 | { WE_SET_SAP_AUTO_CHANNEL_SELECTION, |
| 8521 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8522 | 0, |
| 8523 | "setAutoChannel" }, |
| 8524 | |
| 8525 | { WE_SET_DATA_INACTIVITY_TO, |
| 8526 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8527 | 0, |
| 8528 | "inactivityTO" }, |
| 8529 | |
| 8530 | { WE_SET_MAX_TX_POWER, |
| 8531 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8532 | 0, |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 8533 | "setMaxTxPower" }, |
| 8534 | |
| 8535 | { WE_SET_MAX_TX_POWER_2_4, |
| 8536 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8537 | 0, |
| 8538 | "setTxMaxPower2G" }, |
| 8539 | |
| 8540 | { WE_SET_MAX_TX_POWER_5_0, |
| 8541 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8542 | 0, |
| 8543 | "setTxMaxPower5G" }, |
Rajesh Chauhan | f22af96 | 2013-07-16 18:50:29 -0700 | [diff] [blame] | 8544 | |
| 8545 | /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA |
| 8546 | * as well to keep same syntax as in SAP. Now onwards, STA |
| 8547 | * will support both */ |
| 8548 | { WE_SET_MAX_TX_POWER, |
| 8549 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8550 | 0, |
| 8551 | "setTxMaxPower" }, |
| 8552 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8553 | /* set Higher DTIM Transition (DTIM1 to DTIM3) |
| 8554 | * 1 = enable and 0 = disable */ |
| 8555 | { |
| 8556 | WE_SET_HIGHER_DTIM_TRANSITION, |
| 8557 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8558 | 0, |
| 8559 | "setHDtimTransn" }, |
| 8560 | |
| 8561 | { WE_SET_TM_LEVEL, |
| 8562 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 8563 | 0, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8564 | "setTmLevel" }, |
| 8565 | |
Kiet Lam | 46b8e4e | 2013-11-06 21:49:53 +0530 | [diff] [blame] | 8566 | { WE_ENABLE_STRICT_FCC_REG, |
| 8567 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8568 | 0, |
| 8569 | "setStrictFCCreg" }, |
| 8570 | |
Tushnim Bhattacharyya | a3ba5a5 | 2014-01-30 11:37:33 -0800 | [diff] [blame] | 8571 | { WE_SET_DEBUG_LOG, |
| 8572 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8573 | 0, "setDbgLvl" }, |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 8574 | #ifdef FEATURE_WLAN_TDLS |
| 8575 | { |
| 8576 | WE_SET_TDLS_OFF_CHAN, |
| 8577 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8578 | 0, |
| 8579 | "tdlsoffchan" }, |
| 8580 | { |
| 8581 | WE_SET_TDLS_SEC_OFF_CHAN_OFFSET, |
| 8582 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8583 | 0, |
| 8584 | "tdlsecchnoffst" }, |
| 8585 | { |
| 8586 | WE_SET_TDLS_OFF_CHAN_MODE, |
| 8587 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8588 | 0, |
| 8589 | "tdlsoffchnmode" }, |
| 8590 | #endif |
Tushnim Bhattacharyya | a3ba5a5 | 2014-01-30 11:37:33 -0800 | [diff] [blame] | 8591 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 8592 | { WE_SET_SCAN_BAND_PREFERENCE, |
| 8593 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8594 | 0, "set_scan_pref" }, |
| 8595 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8596 | /* handlers for main ioctl */ |
| 8597 | { WLAN_PRIV_SET_NONE_GET_INT, |
| 8598 | 0, |
| 8599 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8600 | "" }, |
| 8601 | |
| 8602 | /* handlers for sub-ioctl */ |
| 8603 | { WE_GET_11D_STATE, |
| 8604 | 0, |
| 8605 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8606 | "get11Dstate" }, |
| 8607 | |
| 8608 | { WE_IBSS_STATUS, |
| 8609 | 0, |
| 8610 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8611 | "getAdhocStatus" }, |
| 8612 | |
| 8613 | { WE_PMC_STATE, |
| 8614 | 0, |
| 8615 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8616 | "pmcState" }, |
| 8617 | |
| 8618 | { WE_GET_WLAN_DBG, |
| 8619 | 0, |
| 8620 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8621 | "getwlandbg" }, |
| 8622 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8623 | { WE_GET_MAX_ASSOC, |
| 8624 | 0, |
| 8625 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8626 | "getMaxAssoc" }, |
| 8627 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8628 | { WE_GET_WDI_DBG, |
| 8629 | 0, |
| 8630 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8631 | "getwdidbg" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8632 | |
| 8633 | { WE_GET_SAP_AUTO_CHANNEL_SELECTION, |
| 8634 | 0, |
| 8635 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8636 | "getAutoChannel" }, |
| 8637 | |
| 8638 | { WE_GET_CONCURRENCY_MODE, |
| 8639 | 0, |
| 8640 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8641 | "getconcurrency" }, |
| 8642 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 8643 | { WE_GET_SCAN_BAND_PREFERENCE, |
| 8644 | 0, |
| 8645 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8646 | "get_scan_pref"}, |
| 8647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8648 | /* handlers for main ioctl */ |
| 8649 | { WLAN_PRIV_SET_CHAR_GET_NONE, |
| 8650 | IW_PRIV_TYPE_CHAR| 512, |
| 8651 | 0, |
| 8652 | "" }, |
| 8653 | |
| 8654 | /* handlers for sub-ioctl */ |
| 8655 | { WE_WOWL_ADD_PTRN, |
| 8656 | IW_PRIV_TYPE_CHAR| 512, |
| 8657 | 0, |
| 8658 | "wowlAddPtrn" }, |
| 8659 | |
| 8660 | { WE_WOWL_DEL_PTRN, |
| 8661 | IW_PRIV_TYPE_CHAR| 512, |
| 8662 | 0, |
| 8663 | "wowlDelPtrn" }, |
| 8664 | |
| 8665 | #if defined WLAN_FEATURE_VOWIFI |
| 8666 | /* handlers for sub-ioctl */ |
| 8667 | { WE_NEIGHBOR_REPORT_REQUEST, |
| 8668 | IW_PRIV_TYPE_CHAR | 512, |
| 8669 | 0, |
| 8670 | "neighbor" }, |
| 8671 | #endif |
| 8672 | { WE_SET_AP_WPS_IE, |
| 8673 | IW_PRIV_TYPE_CHAR| 512, |
| 8674 | 0, |
| 8675 | "set_ap_wps_ie" }, |
| 8676 | |
| 8677 | { WE_SET_CONFIG, |
| 8678 | IW_PRIV_TYPE_CHAR| 512, |
| 8679 | 0, |
| 8680 | "setConfig" }, |
| 8681 | |
| 8682 | /* handlers for main ioctl */ |
| 8683 | { WLAN_PRIV_SET_THREE_INT_GET_NONE, |
| 8684 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 8685 | 0, |
| 8686 | "" }, |
| 8687 | |
| 8688 | /* handlers for sub-ioctl */ |
| 8689 | { WE_SET_WLAN_DBG, |
| 8690 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 8691 | 0, |
| 8692 | "setwlandbg" }, |
| 8693 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8694 | { WE_SET_WDI_DBG, |
| 8695 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 8696 | 0, |
| 8697 | "setwdidbg" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8698 | |
| 8699 | { WE_SET_SAP_CHANNELS, |
| 8700 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 8701 | 0, |
| 8702 | "setsapchannels" }, |
| 8703 | |
| 8704 | /* handlers for main ioctl */ |
| 8705 | { WLAN_PRIV_GET_CHAR_SET_NONE, |
| 8706 | 0, |
| 8707 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8708 | "" }, |
| 8709 | |
| 8710 | /* handlers for sub-ioctl */ |
| 8711 | { WE_WLAN_VERSION, |
| 8712 | 0, |
| 8713 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8714 | "version" }, |
| 8715 | { WE_GET_STATS, |
| 8716 | 0, |
| 8717 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8718 | "getStats" }, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 8719 | { WE_GET_STATES, |
| 8720 | 0, |
| 8721 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8722 | "getHostStates" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8723 | { WE_GET_CFG, |
| 8724 | 0, |
| 8725 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8726 | "getConfig" }, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8727 | #ifdef WLAN_FEATURE_11AC |
| 8728 | { WE_GET_RSSI, |
| 8729 | 0, |
| 8730 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8731 | "getRSSI" }, |
| 8732 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8733 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8734 | { WE_GET_ROAM_RSSI, |
| 8735 | 0, |
| 8736 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8737 | "getRoamRSSI" }, |
| 8738 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8739 | { WE_GET_WMM_STATUS, |
| 8740 | 0, |
| 8741 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8742 | "getWmmStatus" }, |
| 8743 | { |
| 8744 | WE_GET_CHANNEL_LIST, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 8745 | 0, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8746 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8747 | "getChannelList" }, |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 8748 | #ifdef FEATURE_WLAN_TDLS |
| 8749 | { |
| 8750 | WE_GET_TDLS_PEERS, |
| 8751 | 0, |
| 8752 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8753 | "getTdlsPeers" }, |
| 8754 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8755 | #ifdef WLAN_FEATURE_11W |
| 8756 | { |
| 8757 | WE_GET_11W_INFO, |
| 8758 | 0, |
| 8759 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8760 | "getPMFInfo" }, |
| 8761 | #endif |
Girish Gowli | dab72f1 | 2014-09-04 15:34:43 +0530 | [diff] [blame] | 8762 | { WE_GET_SNR, |
| 8763 | 0, |
| 8764 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8765 | "getSNR" }, |
| 8766 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8767 | /* handlers for main ioctl */ |
| 8768 | { WLAN_PRIV_SET_NONE_GET_NONE, |
| 8769 | 0, |
| 8770 | 0, |
| 8771 | "" }, |
| 8772 | |
| 8773 | /* handlers for sub-ioctl */ |
| 8774 | { WE_CLEAR_STATS, |
| 8775 | 0, |
| 8776 | 0, |
| 8777 | "clearStats" }, |
| 8778 | { WE_INIT_AP, |
| 8779 | 0, |
| 8780 | 0, |
| 8781 | "initAP" }, |
| 8782 | { WE_STOP_AP, |
| 8783 | 0, |
| 8784 | 0, |
| 8785 | "exitAP" }, |
Girish Gowli | 345bff8 | 2014-06-09 20:05:24 +0530 | [diff] [blame] | 8786 | #ifdef WLAN_BTAMP_FEATURE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8787 | { WE_ENABLE_AMP, |
| 8788 | 0, |
| 8789 | 0, |
| 8790 | "enableAMP" }, |
| 8791 | { WE_DISABLE_AMP, |
| 8792 | 0, |
| 8793 | 0, |
| 8794 | "disableAMP" }, |
Girish Gowli | 345bff8 | 2014-06-09 20:05:24 +0530 | [diff] [blame] | 8795 | #endif /* WLAN_BTAMP_FEATURE */ |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 8796 | { WE_ENABLE_DXE_STALL_DETECT, |
| 8797 | 0, |
| 8798 | 0, |
| 8799 | "dxeStallDetect" }, |
| 8800 | { WE_DISPLAY_DXE_SNAP_SHOT, |
| 8801 | 0, |
| 8802 | 0, |
| 8803 | "dxeSnapshot" }, |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 8804 | { WE_DISPLAY_DATAPATH_SNAP_SHOT, |
| 8805 | 0, |
| 8806 | 0, |
| 8807 | "dataSnapshot"}, |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 8808 | { |
Sandeep Puligilla | a3e7695 | 2014-06-23 15:53:11 +0530 | [diff] [blame] | 8809 | WE_SET_REASSOC_TRIGGER, |
| 8810 | 0, |
| 8811 | 0, |
| 8812 | "reassoc" }, |
| 8813 | { |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 8814 | WE_STOP_OBSS_SCAN, |
| 8815 | 0, |
| 8816 | 0, |
| 8817 | "stopOBSSScan" }, |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 8818 | #ifdef DEBUG_ROAM_DELAY |
| 8819 | { |
| 8820 | WE_DUMP_ROAM_TIMER_LOG, |
| 8821 | 0, |
| 8822 | 0, |
| 8823 | "dumpRoamDelay" }, |
| 8824 | { |
| 8825 | WE_RESET_ROAM_TIMER_LOG, |
| 8826 | 0, |
| 8827 | 0, |
| 8828 | "resetRoamDelay" }, |
| 8829 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8830 | /* handlers for main ioctl */ |
| 8831 | { WLAN_PRIV_SET_VAR_INT_GET_NONE, |
| 8832 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 8833 | 0, |
| 8834 | "" }, |
| 8835 | |
| 8836 | /* handlers for sub-ioctl */ |
| 8837 | { WE_LOG_DUMP_CMD, |
| 8838 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 8839 | 0, |
| 8840 | "dump" }, |
| 8841 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 8842 | /* handlers for sub-ioctl */ |
Katya Nigam | c2f29dc | 2014-01-20 19:29:30 +0530 | [diff] [blame] | 8843 | { WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD, |
| 8844 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 8845 | 0, |
| 8846 | "setdumplog" }, |
| 8847 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 8848 | { WE_MTRACE_DUMP_CMD, |
| 8849 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 8850 | 0, |
| 8851 | "dumplog" }, |
| 8852 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 8853 | /* handlers for sub ioctl */ |
| 8854 | { |
| 8855 | WE_MCC_CONFIG_CREDENTIAL, |
| 8856 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 8857 | 0, |
| 8858 | "setMccCrdnl" }, |
| 8859 | |
| 8860 | /* handlers for sub ioctl */ |
| 8861 | { |
| 8862 | WE_MCC_CONFIG_PARAMS, |
| 8863 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 8864 | 0, |
| 8865 | "setMccConfig" }, |
| 8866 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 8867 | #ifdef FEATURE_WLAN_TDLS |
| 8868 | /* handlers for sub ioctl */ |
| 8869 | { |
| 8870 | WE_TDLS_CONFIG_PARAMS, |
| 8871 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 8872 | 0, |
| 8873 | "setTdlsConfig" }, |
| 8874 | #endif |
| 8875 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8876 | /* handlers for main ioctl */ |
| 8877 | { WLAN_PRIV_ADD_TSPEC, |
| 8878 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT, |
| 8879 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8880 | "addTspec" }, |
| 8881 | |
| 8882 | /* handlers for main ioctl */ |
| 8883 | { WLAN_PRIV_DEL_TSPEC, |
| 8884 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8885 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8886 | "delTspec" }, |
| 8887 | |
| 8888 | /* handlers for main ioctl */ |
| 8889 | { WLAN_PRIV_GET_TSPEC, |
| 8890 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8891 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 8892 | "getTspec" }, |
| 8893 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8894 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 8895 | /* handlers for main ioctl - OEM DATA */ |
| 8896 | { |
| 8897 | WLAN_PRIV_SET_OEM_DATA_REQ, |
| 8898 | IW_PRIV_TYPE_BYTE | sizeof(struct iw_oem_data_req) | IW_PRIV_SIZE_FIXED, |
| 8899 | 0, |
| 8900 | "set_oem_data_req" }, |
| 8901 | |
| 8902 | /* handlers for main ioctl - OEM DATA */ |
| 8903 | { |
| 8904 | WLAN_PRIV_GET_OEM_DATA_RSP, |
| 8905 | 0, |
| 8906 | IW_PRIV_TYPE_BYTE | MAX_OEM_DATA_RSP_LEN, |
| 8907 | "get_oem_data_rsp" }, |
| 8908 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8909 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8910 | /* handlers for main ioctl - host offload */ |
| 8911 | { |
| 8912 | WLAN_PRIV_SET_HOST_OFFLOAD, |
| 8913 | IW_PRIV_TYPE_BYTE | sizeof(tHostOffloadRequest), |
| 8914 | 0, |
| 8915 | "setHostOffload" }, |
| 8916 | |
| 8917 | { |
| 8918 | WLAN_GET_WLAN_STATISTICS, |
| 8919 | 0, |
| 8920 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 8921 | "getWlanStats" }, |
| 8922 | |
| 8923 | { |
| 8924 | WLAN_SET_KEEPALIVE_PARAMS, |
| 8925 | IW_PRIV_TYPE_BYTE | sizeof(tKeepAliveRequest), |
| 8926 | 0, |
| 8927 | "setKeepAlive" }, |
| 8928 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 8929 | { |
| 8930 | WLAN_SET_PACKET_FILTER_PARAMS, |
| 8931 | IW_PRIV_TYPE_BYTE | sizeof(tPacketFilterCfg), |
| 8932 | 0, |
| 8933 | "setPktFilter" }, |
| 8934 | #endif |
| 8935 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 8936 | { |
| 8937 | WLAN_SET_PNO, |
| 8938 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8939 | 0, |
| 8940 | "setpno" }, |
| 8941 | #endif |
| 8942 | { |
| 8943 | WLAN_SET_BAND_CONFIG, |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 8944 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8945 | 0, |
| 8946 | "SETBAND" }, |
| 8947 | /* handlers for dynamic MC BC ioctl */ |
| 8948 | { |
| 8949 | WLAN_PRIV_SET_MCBC_FILTER, |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8950 | IW_PRIV_TYPE_BYTE | sizeof(tRcvFltMcAddrList), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8951 | 0, |
| 8952 | "setMCBCFilter" }, |
| 8953 | { |
| 8954 | WLAN_PRIV_CLEAR_MCBC_FILTER, |
| 8955 | 0, |
| 8956 | 0, |
| 8957 | "clearMCBCFilter" }, |
| 8958 | { |
| 8959 | WLAN_SET_POWER_PARAMS, |
| 8960 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 8961 | 0, |
| 8962 | "setpowerparams" }, |
| 8963 | { |
| 8964 | WLAN_GET_LINK_SPEED, |
| 8965 | IW_PRIV_TYPE_CHAR | 18, |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 8966 | IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8967 | }; |
| 8968 | |
| 8969 | |
| 8970 | |
| 8971 | const struct iw_handler_def we_handler_def = { |
| 8972 | .num_standard = sizeof(we_handler) / sizeof(we_handler[0]), |
| 8973 | .num_private = sizeof(we_private) / sizeof(we_private[0]), |
| 8974 | .num_private_args = sizeof(we_private_args) / sizeof(we_private_args[0]), |
| 8975 | |
| 8976 | .standard = (iw_handler *)we_handler, |
| 8977 | .private = (iw_handler *)we_private, |
| 8978 | .private_args = we_private_args, |
| 8979 | .get_wireless_stats = get_wireless_stats, |
| 8980 | }; |
| 8981 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 8982 | int hdd_validate_mcc_config(hdd_adapter_t *pAdapter, v_UINT_t staId, v_UINT_t arg1, v_UINT_t arg2, v_UINT_t arg3) |
| 8983 | { |
| 8984 | v_U32_t cmd = 288; //Command to RIVA |
| 8985 | hdd_context_t *pHddCtx = NULL; |
| 8986 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8987 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8988 | /* |
| 8989 | *configMccParam : specify the bit which needs to be modified |
| 8990 | *allowed to update based on wlan_qcom_cfg.ini |
| 8991 | * configuration |
| 8992 | * Bit 0 : SCHEDULE_TIME_SLICE MIN : 5 MAX : 20 |
| 8993 | * Bit 1 : MAX_NULL_SEND_TIME MIN : 1 MAX : 10 |
| 8994 | * Bit 2 : TX_EARLY_STOP_TIME MIN : 1 MAX : 10 |
| 8995 | * Bit 3 : RX_DRAIN_TIME MIN : 1 MAX : 10 |
| 8996 | * Bit 4 : CHANNEL_SWITCH_TIME MIN : 1 MAX : 20 |
| 8997 | * Bit 5 : MIN_CHANNEL_TIME MIN : 5 MAX : 20 |
| 8998 | * Bit 6 : PARK_BEFORE_TBTT MIN : 1 MAX : 5 |
| 8999 | * Bit 7 : MIN_AFTER_DTIM MIN : 5 MAX : 15 |
| 9000 | * Bit 8 : TOO_CLOSE_MARGIN MIN : 1 MAX : 3 |
| 9001 | * Bit 9 : Reserved |
| 9002 | */ |
| 9003 | switch (arg1) |
| 9004 | { |
| 9005 | //Update MCC SCHEDULE_TIME_SLICE parameter |
| 9006 | case MCC_SCHEDULE_TIME_SLICE_CFG_PARAM : |
| 9007 | if( pHddCtx->cfg_ini->configMccParam & 0x0001) |
| 9008 | { |
| 9009 | if((arg2 >= 5) && (arg2 <= 20)) |
| 9010 | { |
| 9011 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 9012 | } |
| 9013 | else |
| 9014 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9015 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9016 | return 0; |
| 9017 | } |
| 9018 | } |
| 9019 | break; |
| 9020 | |
| 9021 | //Update MCC MAX_NULL_SEND_TIME parameter |
| 9022 | case MCC_MAX_NULL_SEND_TIME_CFG_PARAM : |
| 9023 | if( pHddCtx->cfg_ini->configMccParam & 0x0002) |
| 9024 | { |
| 9025 | if((arg2 >= 1) && (arg2 <= 10)) |
| 9026 | { |
| 9027 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 9028 | } |
| 9029 | else |
| 9030 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9031 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9032 | return 0; |
| 9033 | } |
| 9034 | } |
| 9035 | break; |
| 9036 | |
| 9037 | //Update MCC TX_EARLY_STOP_TIME parameter |
| 9038 | case MCC_TX_EARLY_STOP_TIME_CFG_PARAM : |
| 9039 | if( pHddCtx->cfg_ini->configMccParam & 0x0004) |
| 9040 | { |
| 9041 | if((arg2 >= 1) && (arg2 <= 10)) |
| 9042 | { |
| 9043 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 9044 | } |
| 9045 | else |
| 9046 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9047 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9048 | return 0; |
| 9049 | } |
| 9050 | } |
| 9051 | break; |
| 9052 | |
| 9053 | //Update MCC RX_DRAIN_TIME parameter |
| 9054 | case MCC_RX_DRAIN_TIME_CFG_PARAM : |
| 9055 | if( pHddCtx->cfg_ini->configMccParam & 0x0008) |
| 9056 | { |
| 9057 | if((arg2 >= 1) && (arg2 <= 10)) |
| 9058 | { |
| 9059 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 9060 | } |
| 9061 | else |
| 9062 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9063 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9064 | return 0; |
| 9065 | } |
| 9066 | } |
| 9067 | break; |
| 9068 | |
| 9069 | //Update MCC CHANNEL_SWITCH_TIME parameter |
| 9070 | case MCC_CHANNEL_SWITCH_TIME_CFG_PARAM : |
| 9071 | if( pHddCtx->cfg_ini->configMccParam & 0x0010) |
| 9072 | { |
| 9073 | if((arg2 >= 1) && (arg2 <= 20)) |
| 9074 | { |
| 9075 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 9076 | } |
| 9077 | else |
| 9078 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9079 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9080 | return 0; |
| 9081 | } |
| 9082 | } |
| 9083 | break; |
| 9084 | |
| 9085 | //Update MCC MIN_CHANNEL_TIME parameter |
| 9086 | case MCC_MIN_CHANNEL_TIME_CFG_PARAM : |
| 9087 | if( pHddCtx->cfg_ini->configMccParam & 0x0020) |
| 9088 | { |
| 9089 | if((arg2 >= 5) && (arg2 <= 20)) |
| 9090 | { |
| 9091 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 9092 | } |
| 9093 | else |
| 9094 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9095 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9096 | return 0; |
| 9097 | } |
| 9098 | } |
| 9099 | break; |
| 9100 | |
| 9101 | //Update MCC PARK_BEFORE_TBTT parameter |
| 9102 | case MCC_PARK_BEFORE_TBTT_CFG_PARAM : |
| 9103 | if( pHddCtx->cfg_ini->configMccParam & 0x0040) |
| 9104 | { |
| 9105 | if((arg2 >= 1) && (arg2 <= 5)) |
| 9106 | { |
| 9107 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 9108 | } |
| 9109 | else |
| 9110 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9111 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9112 | return 0; |
| 9113 | } |
| 9114 | } |
| 9115 | break; |
| 9116 | |
| 9117 | //Update MCC MIN_AFTER_DTIM parameter |
| 9118 | case MCC_MIN_AFTER_DTIM_CFG_PARAM : |
| 9119 | if( pHddCtx->cfg_ini->configMccParam & 0x0080) |
| 9120 | { |
| 9121 | if((arg2 >= 5) && (arg2 <= 15)) |
| 9122 | { |
| 9123 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 9124 | } |
| 9125 | else |
| 9126 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9127 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9128 | return 0; |
| 9129 | } |
| 9130 | } |
| 9131 | break; |
| 9132 | |
| 9133 | //Update MCC TOO_CLOSE_MARGIN parameter |
| 9134 | case MCC_TOO_CLOSE_MARGIN_CFG_PARAM : |
| 9135 | if( pHddCtx->cfg_ini->configMccParam & 0x0100) |
| 9136 | { |
| 9137 | if((arg2 >= 1) && (arg2 <= 3)) |
| 9138 | { |
| 9139 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 9140 | } |
| 9141 | else |
| 9142 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9143 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9144 | return 0; |
| 9145 | } |
| 9146 | } |
| 9147 | break; |
| 9148 | |
| 9149 | default : |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9150 | hddLog(LOGE, "%s : Uknown / Not allowed to configure parameter : %d", |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 9151 | __FUNCTION__,arg1); |
| 9152 | break; |
| 9153 | } |
| 9154 | return 0; |
| 9155 | } |
| 9156 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9157 | int hdd_set_wext(hdd_adapter_t *pAdapter) |
| 9158 | { |
| 9159 | hdd_wext_state_t *pwextBuf; |
| 9160 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9161 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9162 | |
| 9163 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9164 | |
| 9165 | // Now configure the roaming profile links. To SSID and bssid. |
| 9166 | pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0; |
| 9167 | pwextBuf->roamProfile.SSIDs.SSIDList = &pHddStaCtx->conn_info.SSID; |
| 9168 | |
| 9169 | pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0; |
| 9170 | pwextBuf->roamProfile.BSSIDs.bssid = &pHddStaCtx->conn_info.bssId; |
| 9171 | |
| 9172 | /*Set the numOfChannels to zero to scan all the channels*/ |
| 9173 | pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0; |
| 9174 | pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL; |
| 9175 | |
| 9176 | /* Default is no encryption */ |
| 9177 | pwextBuf->roamProfile.EncryptionType.numEntries = 1; |
| 9178 | pwextBuf->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 9179 | |
| 9180 | pwextBuf->roamProfile.mcEncryptionType.numEntries = 1; |
| 9181 | pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 9182 | |
| 9183 | pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 9184 | |
| 9185 | /* Default is no authentication */ |
| 9186 | pwextBuf->roamProfile.AuthType.numEntries = 1; |
| 9187 | pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 9188 | |
| 9189 | pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 9190 | pwextBuf->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 9191 | |
| 9192 | /*Set the default scan mode*/ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9193 | pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9194 | |
| 9195 | hdd_clearRoamProfileIe(pAdapter); |
| 9196 | |
| 9197 | return VOS_STATUS_SUCCESS; |
| 9198 | |
| 9199 | } |
| 9200 | |
| 9201 | int hdd_register_wext(struct net_device *dev) |
| 9202 | { |
| 9203 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9204 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9205 | VOS_STATUS status; |
| 9206 | |
| 9207 | ENTER(); |
| 9208 | |
| 9209 | // Zero the memory. This zeros the profile structure. |
| 9210 | memset(pwextBuf, 0,sizeof(hdd_wext_state_t)); |
| 9211 | |
| 9212 | init_completion(&(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->completion_var); |
| 9213 | |
| 9214 | |
| 9215 | status = hdd_set_wext(pAdapter); |
| 9216 | |
| 9217 | if(!VOS_IS_STATUS_SUCCESS(status)) { |
| 9218 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9219 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: hdd_set_wext failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9220 | return eHAL_STATUS_FAILURE; |
| 9221 | } |
| 9222 | |
| 9223 | if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->vosevent))) |
| 9224 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9225 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD vos event init failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9226 | return eHAL_STATUS_FAILURE; |
| 9227 | } |
| 9228 | |
| 9229 | if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->scanevent))) |
| 9230 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9231 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD scan event init failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9232 | return eHAL_STATUS_FAILURE; |
| 9233 | } |
| 9234 | |
| 9235 | // Register as a wireless device |
| 9236 | dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def; |
| 9237 | |
| 9238 | EXIT(); |
| 9239 | return 0; |
| 9240 | } |
| 9241 | |
| 9242 | int hdd_UnregisterWext(struct net_device *dev) |
| 9243 | { |
| 9244 | #if 0 |
| 9245 | hdd_wext_state_t *wextBuf; |
| 9246 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9247 | |
| 9248 | ENTER(); |
| 9249 | // Set up the pointer to the Wireless Extensions state structure |
| 9250 | wextBuf = pAdapter->pWextState; |
| 9251 | |
| 9252 | // De-allocate the Wireless Extensions state structure |
| 9253 | kfree(wextBuf); |
| 9254 | |
| 9255 | // Clear out the pointer to the Wireless Extensions state structure |
| 9256 | pAdapter->pWextState = NULL; |
| 9257 | |
| 9258 | EXIT(); |
| 9259 | #endif |
c_hpothu | 5f0b6eb | 2014-09-15 13:36:50 +0530 | [diff] [blame] | 9260 | |
| 9261 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"In %s", __func__); |
| 9262 | rtnl_lock(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9263 | dev->wireless_handlers = NULL; |
c_hpothu | 5f0b6eb | 2014-09-15 13:36:50 +0530 | [diff] [blame] | 9264 | rtnl_unlock(); |
| 9265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9266 | return 0; |
| 9267 | } |
| 9268 | |
| 9269 | |