Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, 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 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /** ------------------------------------------------------------------------ * |
| 43 | ------------------------------------------------------------------------ * |
| 44 | |
| 45 | |
| 46 | \file wlan_hdd_wext.c |
| 47 | |
| 48 | \brief Airgo Linux Wireless Extensions Common Control Plane Types and |
| 49 | interfaces. |
| 50 | |
| 51 | $Id: wlan_hdd_wext.c,v 1.34 2007/04/14 01:49:23 jimz Exp jimz $ |
| 52 | |
| 53 | Copyright (C) 2007 Airgo Networks, Incorporated |
| 54 | |
| 55 | This file defines all of the types that are utilized by the CCP module |
| 56 | of the "Portable" HDD. This file also includes the underlying Linux |
| 57 | Wireless Extensions Data types referred to by CCP. |
| 58 | |
| 59 | ======================================================================== */ |
| 60 | |
| 61 | #include <linux/version.h> |
| 62 | #include <linux/module.h> |
| 63 | #include <linux/kernel.h> |
| 64 | #include <linux/init.h> |
| 65 | #include <linux/wireless.h> |
| 66 | #include <wlan_hdd_includes.h> |
| 67 | #include <wlan_btc_svc.h> |
| 68 | #include <wlan_nlink_common.h> |
| 69 | #ifdef WLAN_BTAMP_FEATURE |
| 70 | #include <bap_hdd_main.h> |
| 71 | #endif |
| 72 | #include <vos_api.h> |
| 73 | #include <net/arp.h> |
| 74 | #include "ccmApi.h" |
| 75 | #include "sirParams.h" |
| 76 | #include "csrApi.h" |
| 77 | #include "csrInsideApi.h" |
| 78 | #if defined WLAN_FEATURE_VOWIFI |
| 79 | #include "smeRrmInternal.h" |
| 80 | #endif |
| 81 | #include <aniGlobal.h> |
| 82 | #include "dot11f.h" |
| 83 | #include <wlan_hdd_wowl.h> |
| 84 | #include <wlan_hdd_cfg.h> |
| 85 | #include <wlan_hdd_wmm.h> |
| 86 | #include "utilsApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | #include "wlan_hdd_p2p.h" |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 88 | #ifdef FEATURE_WLAN_TDLS |
| 89 | #include "wlan_hdd_tdls.h" |
| 90 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 91 | |
| 92 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 93 | #include <linux/earlysuspend.h> |
| 94 | #endif |
| 95 | #include "wlan_hdd_power.h" |
| 96 | #include "qwlan_version.h" |
| 97 | #include <vos_power.h> |
| 98 | #include "wlan_hdd_host_offload.h" |
| 99 | #include "wlan_hdd_keep_alive.h" |
| 100 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 101 | #include "wlan_hdd_packet_filtering.h" |
| 102 | #endif |
| 103 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 104 | #include <linux/wireless.h> |
| 105 | #include <net/cfg80211.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 106 | #include "wlan_qct_pal_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 107 | |
| 108 | #include "wlan_hdd_misc.h" |
| 109 | #include "bap_hdd_misc.h" |
| 110 | |
| 111 | #include "wlan_hdd_dev_pwr.h" |
| 112 | #include "qc_sap_ioctl.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 113 | |
| 114 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 115 | extern void hdd_suspend_wlan(struct early_suspend *wlan_suspend); |
| 116 | extern void hdd_resume_wlan(struct early_suspend *wlan_suspend); |
| 117 | #endif |
| 118 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 119 | #ifdef FEATURE_OEM_DATA_SUPPORT |
Madan Mohan Koyyalamudi | 7a4d931 | 2012-12-04 17:21:36 -0800 | [diff] [blame] | 120 | #define MAX_OEM_DATA_RSP_LEN 2047 |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 121 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 122 | |
| 123 | #define HDD_FINISH_ULA_TIME_OUT 800 |
| 124 | |
| 125 | extern int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand); |
| 126 | int hdd_setBand_helper(struct net_device *dev, tANI_U8* ptr); |
| 127 | |
Madan Mohan Koyyalamudi | dfd6aa8 | 2012-10-18 20:18:43 -0700 | [diff] [blame] | 128 | static int ioctl_debug; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 129 | module_param(ioctl_debug, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); |
| 130 | |
| 131 | struct statsContext |
| 132 | { |
| 133 | struct completion completion; |
| 134 | hdd_adapter_t *pAdapter; |
| 135 | unsigned int magic; |
| 136 | }; |
| 137 | |
| 138 | #define STATS_CONTEXT_MAGIC 0x53544154 //STAT |
| 139 | #define RSSI_CONTEXT_MAGIC 0x52535349 //RSSI |
| 140 | #define POWER_CONTEXT_MAGIC 0x504F5752 // POWR |
| 141 | |
| 142 | /* To Validate Channel against the Frequency and Vice-Versa */ |
| 143 | static const hdd_freq_chan_map_t freq_chan_map[] = { {2412, 1}, {2417, 2}, |
| 144 | {2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, {2442, 7}, {2447, 8}, |
| 145 | {2452, 9}, {2457, 10}, {2462, 11}, {2467 ,12}, {2472, 13}, |
| 146 | {2484, 14}, {4920, 240}, {4940, 244}, {4960, 248}, {4980, 252}, |
| 147 | {5040, 208}, {5060, 212}, {5080, 216}, {5180, 36}, {5200, 40}, {5220, 44}, |
| 148 | {5240, 48}, {5260, 52}, {5280, 56}, {5300, 60}, {5320, 64}, {5500, 100}, |
| 149 | {5520, 104}, {5540, 108}, {5560, 112}, {5580, 116}, {5600, 120}, |
| 150 | {5620, 124}, {5640, 128}, {5660, 132}, {5680, 136}, {5700, 140}, |
| 151 | {5745, 149}, {5765, 153}, {5785, 157}, {5805, 161}, {5825, 165} }; |
| 152 | |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 153 | #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] | 154 | |
| 155 | /* Private ioctls and their sub-ioctls */ |
| 156 | #define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0) |
| 157 | #define WE_SET_11D_STATE 1 |
| 158 | #define WE_WOWL 2 |
| 159 | #define WE_SET_POWER 3 |
| 160 | #define WE_SET_MAX_ASSOC 4 |
| 161 | #define WE_SET_SAP_AUTO_CHANNEL_SELECTION 5 |
| 162 | #define WE_SET_DATA_INACTIVITY_TO 6 |
| 163 | #define WE_SET_MAX_TX_POWER 7 |
| 164 | #define WE_SET_HIGHER_DTIM_TRANSITION 8 |
| 165 | #define WE_SET_TM_LEVEL 9 |
| 166 | |
| 167 | /* Private ioctls and their sub-ioctls */ |
| 168 | #define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1) |
| 169 | #define WE_GET_11D_STATE 1 |
| 170 | #define WE_IBSS_STATUS 2 |
| 171 | #define WE_PMC_STATE 3 |
| 172 | #define WE_GET_WLAN_DBG 4 |
| 173 | #define WE_MODULE_DOWN_IND 5 |
| 174 | #define WE_GET_MAX_ASSOC 6 |
| 175 | #define WE_GET_WDI_DBG 7 |
| 176 | #define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8 |
| 177 | #define WE_GET_CONCURRENCY_MODE 9 |
| 178 | /* Private ioctls and their sub-ioctls */ |
| 179 | #define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2) |
| 180 | |
| 181 | /* Private ioctls and their sub-ioctls */ |
| 182 | #define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3) |
| 183 | #define WE_WOWL_ADD_PTRN 1 |
| 184 | #define WE_WOWL_DEL_PTRN 2 |
| 185 | #if defined WLAN_FEATURE_VOWIFI |
| 186 | #define WE_NEIGHBOR_REPORT_REQUEST 3 |
| 187 | #endif |
| 188 | #define WE_SET_AP_WPS_IE 4 //This is called in station mode to set probe rsp ie. |
| 189 | #define WE_SET_CONFIG 5 |
| 190 | |
| 191 | /* Private ioctls and their sub-ioctls */ |
| 192 | #define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4) |
| 193 | #define WE_SET_WLAN_DBG 1 |
| 194 | #define WE_SET_WDI_DBG 2 |
| 195 | #define WE_SET_SAP_CHANNELS 3 |
| 196 | |
| 197 | /* Private ioctls and their sub-ioctls */ |
| 198 | #define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5) |
| 199 | #define WE_WLAN_VERSION 1 |
| 200 | #define WE_GET_STATS 2 |
| 201 | #define WE_GET_CFG 3 |
| 202 | #define WE_GET_WMM_STATUS 4 |
| 203 | #define WE_GET_CHANNEL_LIST 5 |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 204 | #ifdef WLAN_FEATURE_11AC |
| 205 | #define WE_GET_RSSI 6 |
| 206 | #endif |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 207 | #define WE_GET_ROAM_RSSI 7 |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 208 | #ifdef FEATURE_WLAN_TDLS |
| 209 | #define WE_GET_TDLS_PEERS 8 |
| 210 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 211 | #ifdef WLAN_FEATURE_11W |
| 212 | #define WE_GET_11W_INFO 9 |
| 213 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 214 | |
| 215 | /* Private ioctls and their sub-ioctls */ |
| 216 | #define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6) |
| 217 | #define WE_CLEAR_STATS 1 |
| 218 | #define WE_INIT_AP 2 |
| 219 | #define WE_STOP_AP 3 |
| 220 | #define WE_ENABLE_AMP 4 |
| 221 | #define WE_DISABLE_AMP 5 |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 222 | #define WE_ENABLE_DXE_STALL_DETECT 6 |
| 223 | #define WE_DISPLAY_DXE_SNAP_SHOT 7 |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 224 | #define WE_SET_REASSOC_TRIGGER 8 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 225 | |
| 226 | /* Private ioctls and their sub-ioctls */ |
| 227 | #define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7) |
| 228 | #define WE_LOG_DUMP_CMD 1 |
| 229 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 230 | #define WE_P2P_NOA_CMD 2 |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 231 | //IOCTL to configure MCC params |
| 232 | #define WE_MCC_CONFIG_CREDENTIAL 3 |
| 233 | #define WE_MCC_CONFIG_PARAMS 4 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 234 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 235 | #ifdef FEATURE_WLAN_TDLS |
| 236 | #define WE_TDLS_CONFIG_PARAMS 5 |
| 237 | #endif |
| 238 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 239 | #ifdef FEATURE_WLAN_TDLS |
| 240 | #undef MAX_VAR_ARGS |
| 241 | #define MAX_VAR_ARGS 10 |
| 242 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 243 | #define MAX_VAR_ARGS 7 |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 244 | #endif |
| 245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 246 | |
| 247 | /* Private ioctls (with no sub-ioctls) */ |
| 248 | /* note that they must be odd so that they have "get" semantics */ |
| 249 | #define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9) |
| 250 | #define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11) |
| 251 | #define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13) |
| 252 | |
| 253 | #ifdef FEATURE_WLAN_WAPI |
| 254 | /* Private ioctls EVEN NO: SET, ODD NO:GET */ |
| 255 | #define WLAN_PRIV_SET_WAPI_MODE (SIOCIWFIRSTPRIV + 8) |
| 256 | #define WLAN_PRIV_GET_WAPI_MODE (SIOCIWFIRSTPRIV + 16) |
| 257 | #define WLAN_PRIV_SET_WAPI_ASSOC_INFO (SIOCIWFIRSTPRIV + 10) |
| 258 | #define WLAN_PRIV_SET_WAPI_KEY (SIOCIWFIRSTPRIV + 12) |
| 259 | #define WLAN_PRIV_SET_WAPI_BKID (SIOCIWFIRSTPRIV + 14) |
| 260 | #define WLAN_PRIV_GET_WAPI_BKID (SIOCIWFIRSTPRIV + 15) |
| 261 | #define WAPI_PSK_AKM_SUITE 0x02721400 |
| 262 | #define WAPI_CERT_AKM_SUITE 0x01721400 |
| 263 | #endif |
| 264 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 265 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 266 | /* Private ioctls for setting the measurement configuration */ |
| 267 | #define WLAN_PRIV_SET_OEM_DATA_REQ (SIOCIWFIRSTPRIV + 17) |
| 268 | #define WLAN_PRIV_GET_OEM_DATA_RSP (SIOCIWFIRSTPRIV + 19) |
| 269 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 270 | |
| 271 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 272 | #define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20) |
| 273 | #endif |
| 274 | |
| 275 | /* Private ioctl for setting the host offload feature */ |
| 276 | #define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18) |
| 277 | |
| 278 | /* Private ioctl to get the statistics */ |
| 279 | #define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21) |
| 280 | |
| 281 | /* Private ioctl to set the Keep Alive Params */ |
| 282 | #define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22) |
| 283 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 284 | /* Private ioctl to set the Packet Filtering Params */ |
| 285 | #define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23) |
| 286 | #endif |
| 287 | |
| 288 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 289 | /* Private ioctl to get the statistics */ |
| 290 | #define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24) |
| 291 | #endif |
| 292 | |
| 293 | #define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25) /*Don't change this number*/ |
| 294 | |
| 295 | #define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26) |
| 296 | #define WLAN_PRIV_CLEAR_MCBC_FILTER (SIOCIWFIRSTPRIV + 27) |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 297 | /* Private ioctl to trigger reassociation */ |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 298 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 299 | #define WLAN_SET_POWER_PARAMS (SIOCIWFIRSTPRIV + 29) |
| 300 | #define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31) |
| 301 | |
| 302 | #define WLAN_STATS_INVALID 0 |
| 303 | #define WLAN_STATS_RETRY_CNT 1 |
| 304 | #define WLAN_STATS_MUL_RETRY_CNT 2 |
| 305 | #define WLAN_STATS_TX_FRM_CNT 3 |
| 306 | #define WLAN_STATS_RX_FRM_CNT 4 |
| 307 | #define WLAN_STATS_FRM_DUP_CNT 5 |
| 308 | #define WLAN_STATS_FAIL_CNT 6 |
| 309 | #define WLAN_STATS_RTS_FAIL_CNT 7 |
| 310 | #define WLAN_STATS_ACK_FAIL_CNT 8 |
| 311 | #define WLAN_STATS_RTS_SUC_CNT 9 |
| 312 | #define WLAN_STATS_RX_DISCARD_CNT 10 |
| 313 | #define WLAN_STATS_RX_ERROR_CNT 11 |
| 314 | #define WLAN_STATS_TX_BYTE_CNT 12 |
| 315 | |
| 316 | #define WLAN_STATS_RX_BYTE_CNT 13 |
| 317 | #define WLAN_STATS_RX_RATE 14 |
| 318 | #define WLAN_STATS_TX_RATE 15 |
| 319 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 320 | #define WLAN_STATS_RX_UC_BYTE_CNT 16 |
| 321 | #define WLAN_STATS_RX_MC_BYTE_CNT 17 |
| 322 | #define WLAN_STATS_RX_BC_BYTE_CNT 18 |
| 323 | #define WLAN_STATS_TX_UC_BYTE_CNT 19 |
| 324 | #define WLAN_STATS_TX_MC_BYTE_CNT 20 |
| 325 | #define WLAN_STATS_TX_BC_BYTE_CNT 21 |
| 326 | |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 327 | #define FILL_TLV(__p, __type, __size, __val, __tlen) do { \ |
| 328 | if ((__tlen + __size + 2) < WE_MAX_STR_LEN) \ |
| 329 | { \ |
| 330 | *__p++ = __type; \ |
| 331 | *__p++ = __size; \ |
| 332 | memcpy(__p, __val, __size); \ |
| 333 | __p += __size; \ |
| 334 | __tlen += __size + 2; \ |
| 335 | } \ |
| 336 | else \ |
| 337 | { \ |
| 338 | hddLog(VOS_TRACE_LEVEL_ERROR, "FILL_TLV Failed!!!\n"); \ |
| 339 | } \ |
| 340 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 341 | |
| 342 | #define VERSION_VALUE_MAX_LEN 32 |
| 343 | |
| 344 | #define TX_PER_TRACKING_DEFAULT_RATIO 5 |
| 345 | #define TX_PER_TRACKING_MAX_RATIO 10 |
| 346 | #define TX_PER_TRACKING_DEFAULT_WATERMARK 5 |
| 347 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 348 | /*MCC Configuration parameters */ |
| 349 | enum { |
| 350 | MCC_SCHEDULE_TIME_SLICE_CFG_PARAM = 1, |
| 351 | MCC_MAX_NULL_SEND_TIME_CFG_PARAM, |
| 352 | MCC_TX_EARLY_STOP_TIME_CFG_PARAM, |
| 353 | MCC_RX_DRAIN_TIME_CFG_PARAM, |
| 354 | MCC_CHANNEL_SWITCH_TIME_CFG_PARAM, |
| 355 | MCC_MIN_CHANNEL_TIME_CFG_PARAM, |
| 356 | MCC_PARK_BEFORE_TBTT_CFG_PARAM, |
| 357 | MCC_MIN_AFTER_DTIM_CFG_PARAM, |
| 358 | MCC_TOO_CLOSE_MARGIN_CFG_PARAM, |
| 359 | }; |
| 360 | |
| 361 | int hdd_validate_mcc_config(hdd_adapter_t *pAdapter, v_UINT_t staId, |
| 362 | v_UINT_t arg1, v_UINT_t arg2, v_UINT_t arg3); |
| 363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 364 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 365 | int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest, |
| 366 | v_U8_t sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 367 | #endif |
| 368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 369 | /**--------------------------------------------------------------------------- |
| 370 | |
| 371 | \brief hdd_wlan_get_version() - |
| 372 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 373 | This function use to get Wlan Driver, Firmware, & Hardware Version. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 374 | |
| 375 | \param - pAdapter Pointer to the adapter. |
| 376 | wrqu - Pointer to IOCTL REQUEST Data. |
| 377 | extra - Pointer to char |
| 378 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 379 | \return - none |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | |
| 381 | --------------------------------------------------------------------------*/ |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 382 | void hdd_wlan_get_version(hdd_adapter_t *pAdapter, union iwreq_data *wrqu, |
| 383 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 384 | { |
| 385 | VOS_STATUS status; |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 386 | tSirVersionString wcnss_SW_version; |
| 387 | tSirVersionString wcnss_HW_version; |
| 388 | char *pSWversion; |
| 389 | char *pHWversion; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 390 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 391 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 392 | status = sme_GetWcnssSoftwareVersion(hHal, wcnss_SW_version, |
| 393 | sizeof(wcnss_SW_version)); |
| 394 | if (VOS_IS_STATUS_SUCCESS(status)) |
| 395 | { |
| 396 | pSWversion = wcnss_SW_version; |
| 397 | } |
| 398 | else |
| 399 | { |
| 400 | pSWversion = "Unknown"; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | } |
| 402 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 403 | status = sme_GetWcnssHardwareVersion(hHal, wcnss_HW_version, |
| 404 | sizeof(wcnss_HW_version)); |
| 405 | if (VOS_IS_STATUS_SUCCESS(status)) |
| 406 | { |
| 407 | pHWversion = wcnss_HW_version; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 408 | } |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 409 | else |
| 410 | { |
| 411 | pHWversion = "Unknown"; |
| 412 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 413 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 414 | wrqu->data.length = snprintf(extra, WE_MAX_STR_LEN, |
| 415 | "Host SW:%s, FW:%s, HW:%s", |
| 416 | QWLAN_VERSIONSTR, |
| 417 | pSWversion, |
| 418 | pHWversion); |
| 419 | |
| 420 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 421 | } |
| 422 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 423 | int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu) |
| 424 | { |
| 425 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 426 | v_U32_t threshold = 0,status = 0; |
| 427 | |
| 428 | ENTER(); |
| 429 | |
| 430 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 431 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 432 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 433 | return status; |
| 434 | } |
| 435 | |
| 436 | if ( eHAL_STATUS_SUCCESS != |
| 437 | ccmCfgGetInt(hHal, WNI_CFG_RTS_THRESHOLD, &threshold) ) |
| 438 | { |
| 439 | return -EIO; |
| 440 | } |
| 441 | wrqu->rts.value = threshold; |
| 442 | |
| 443 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 444 | ("Rts-Threshold=%ld!!\n"), wrqu->rts.value); |
| 445 | |
| 446 | EXIT(); |
| 447 | |
| 448 | return 0; |
| 449 | } |
| 450 | |
| 451 | int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu) |
| 452 | { |
| 453 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 454 | v_U32_t threshold = 0,status = 0; |
| 455 | |
| 456 | ENTER(); |
| 457 | |
| 458 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 459 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 460 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 461 | return status; |
| 462 | } |
| 463 | |
| 464 | if ( ccmCfgGetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold) |
| 465 | != eHAL_STATUS_SUCCESS ) |
| 466 | { |
| 467 | return -EIO; |
| 468 | } |
| 469 | wrqu->frag.value = threshold; |
| 470 | |
| 471 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 472 | ("Frag-Threshold=%ld!!\n"), wrqu->frag.value); |
| 473 | |
| 474 | EXIT(); |
| 475 | |
| 476 | return 0; |
| 477 | } |
| 478 | |
| 479 | int hdd_wlan_get_freq(v_U32_t channel, v_U32_t *pfreq) |
| 480 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 481 | int i; |
| 482 | if (channel > 0) |
| 483 | { |
| 484 | for (i=0; i < FREQ_CHAN_MAP_TABLE_SIZE; i++) |
| 485 | { |
| 486 | if (channel == freq_chan_map[i].chan) |
| 487 | { |
| 488 | *pfreq = freq_chan_map[i].freq; |
| 489 | return 1; |
| 490 | } |
| 491 | } |
| 492 | } |
| 493 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 494 | ("Invalid channel no=%d!!\n"), channel); |
| 495 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | static v_BOOL_t |
| 499 | hdd_IsAuthTypeRSN( tHalHandle halHandle, eCsrAuthType authType) |
| 500 | { |
| 501 | v_BOOL_t rsnType = VOS_FALSE; |
| 502 | // is the authType supported? |
| 503 | switch (authType) |
| 504 | { |
| 505 | case eCSR_AUTH_TYPE_NONE: //never used |
| 506 | rsnType = eANI_BOOLEAN_FALSE; |
| 507 | break; |
| 508 | // MAC layer authentication types |
| 509 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 510 | rsnType = eANI_BOOLEAN_FALSE; |
| 511 | break; |
| 512 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 513 | rsnType = eANI_BOOLEAN_FALSE; |
| 514 | break; |
| 515 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 516 | rsnType = eANI_BOOLEAN_FALSE; |
| 517 | break; |
| 518 | |
| 519 | // Upper layer authentication types |
| 520 | case eCSR_AUTH_TYPE_WPA: |
| 521 | rsnType = eANI_BOOLEAN_TRUE; |
| 522 | break; |
| 523 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 524 | rsnType = eANI_BOOLEAN_TRUE; |
| 525 | break; |
| 526 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 527 | rsnType = eANI_BOOLEAN_TRUE; |
| 528 | break; |
| 529 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 530 | case eCSR_AUTH_TYPE_FT_RSN: |
| 531 | #endif |
| 532 | case eCSR_AUTH_TYPE_RSN: |
| 533 | rsnType = eANI_BOOLEAN_TRUE; |
| 534 | break; |
| 535 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 536 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 537 | #endif |
| 538 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 539 | #ifdef WLAN_FEATURE_11W |
| 540 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 541 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 542 | rsnType = eANI_BOOLEAN_TRUE; |
| 543 | break; |
| 544 | //case eCSR_AUTH_TYPE_FAILED: |
| 545 | case eCSR_AUTH_TYPE_UNKNOWN: |
| 546 | rsnType = eANI_BOOLEAN_FALSE; |
| 547 | break; |
| 548 | default: |
| 549 | hddLog(LOGE, FL("%s called with unknown authType - default to Open, None\n"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 550 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 551 | rsnType = eANI_BOOLEAN_FALSE; |
| 552 | break; |
| 553 | } |
| 554 | hddLog(LOGE, FL("%s called with authType: %d, returned: %d\n"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 555 | __func__, authType, rsnType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 556 | return rsnType; |
| 557 | } |
| 558 | |
| 559 | static void hdd_GetRssiCB( v_S7_t rssi, tANI_U32 staId, void *pContext ) |
| 560 | { |
| 561 | struct statsContext *pStatsContext; |
| 562 | hdd_adapter_t *pAdapter; |
| 563 | |
| 564 | if (ioctl_debug) |
| 565 | { |
| 566 | pr_info("%s: rssi [%d] STA [%d] pContext [%p]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 567 | __func__, (int)rssi, (int)staId, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | if (NULL == pContext) |
| 571 | { |
| 572 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 573 | "%s: Bad param, pContext [%p]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 574 | __func__, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 575 | return; |
| 576 | } |
| 577 | |
| 578 | /* there is a race condition that exists between this callback function |
| 579 | and the caller since the caller could time out either before or |
| 580 | while this code is executing. we'll assume the timeout hasn't |
| 581 | occurred, but we'll verify that right before we save our work */ |
| 582 | |
| 583 | pStatsContext = pContext; |
| 584 | pAdapter = pStatsContext->pAdapter; |
| 585 | if ((NULL == pAdapter) || (RSSI_CONTEXT_MAGIC != pStatsContext->magic)) |
| 586 | { |
| 587 | /* the caller presumably timed out so there is nothing we can do */ |
| 588 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 589 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 590 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 591 | if (ioctl_debug) |
| 592 | { |
| 593 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 594 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 595 | } |
| 596 | return; |
| 597 | } |
| 598 | |
| 599 | /* the race is on. caller could have timed out immediately after |
| 600 | we verified the magic, but if so, caller will wait a short time |
| 601 | for us to copy over the rssi */ |
| 602 | pAdapter->rssi = rssi; |
| 603 | |
| 604 | /* and notify the caller */ |
| 605 | complete(&pStatsContext->completion); |
| 606 | } |
| 607 | |
| 608 | VOS_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value) |
| 609 | { |
| 610 | struct statsContext context; |
| 611 | hdd_context_t *pHddCtx; |
| 612 | hdd_station_ctx_t *pHddStaCtx; |
| 613 | eHalStatus hstatus; |
| 614 | long lrc; |
| 615 | |
| 616 | if (NULL == pAdapter) |
| 617 | { |
| 618 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 619 | "%s: Invalid context, pAdapter", __func__); |
| 620 | return VOS_STATUS_E_FAULT; |
| 621 | } |
| 622 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 623 | { |
| 624 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 625 | /* return a cached value */ |
| 626 | *rssi_value = pAdapter->rssi; |
| 627 | return VOS_STATUS_SUCCESS; |
| 628 | } |
| 629 | |
| 630 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 631 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 632 | |
| 633 | init_completion(&context.completion); |
| 634 | context.pAdapter = pAdapter; |
| 635 | context.magic = RSSI_CONTEXT_MAGIC; |
| 636 | |
| 637 | hstatus = sme_GetRssi(pHddCtx->hHal, hdd_GetRssiCB, |
| 638 | pHddStaCtx->conn_info.staId[ 0 ], |
| 639 | pHddStaCtx->conn_info.bssId, |
| 640 | &context, pHddCtx->pvosContext); |
| 641 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 642 | { |
| 643 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 644 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 645 | /* we'll returned a cached value below */ |
| 646 | } |
| 647 | else |
| 648 | { |
| 649 | /* request was sent -- wait for the response */ |
| 650 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 651 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 652 | /* either we have a response or we timed out |
| 653 | either way, first invalidate our magic */ |
| 654 | context.magic = 0; |
| 655 | if (lrc <= 0) |
| 656 | { |
| 657 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while retrieving RSSI ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 658 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 659 | /* there is a race condition such that the callback |
| 660 | function could be executing at the same time we are. of |
| 661 | primary concern is if the callback function had already |
| 662 | verified the "magic" but hasn't yet set the completion |
| 663 | variable. Since the completion variable is on our |
| 664 | stack, we'll delay just a bit to make sure the data is |
| 665 | still valid if that is the case */ |
| 666 | msleep(50); |
| 667 | /* we'll now returned a cached value below */ |
| 668 | } |
| 669 | } |
| 670 | *rssi_value = pAdapter->rssi; |
| 671 | |
| 672 | return VOS_STATUS_SUCCESS; |
| 673 | } |
| 674 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 675 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 676 | |
| 677 | static void hdd_GetRoamRssiCB( v_S7_t rssi, tANI_U32 staId, void *pContext ) |
| 678 | { |
| 679 | struct statsContext *pStatsContext; |
| 680 | hdd_adapter_t *pAdapter; |
| 681 | if (ioctl_debug) |
| 682 | { |
| 683 | pr_info("%s: rssi [%d] STA [%d] pContext [%p]\n", |
| 684 | __func__, (int)rssi, (int)staId, pContext); |
| 685 | } |
| 686 | |
| 687 | if (NULL == pContext) |
| 688 | { |
| 689 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 690 | "%s: Bad param, pContext [%p]", |
| 691 | __func__, pContext); |
| 692 | return; |
| 693 | } |
| 694 | |
| 695 | /* there is a race condition that exists between this callback function |
| 696 | and the caller since the caller could time out either before or |
| 697 | while this code is executing. we'll assume the timeout hasn't |
| 698 | occurred, but we'll verify that right before we save our work */ |
| 699 | |
| 700 | pStatsContext = pContext; |
| 701 | pAdapter = pStatsContext->pAdapter; |
| 702 | if ((NULL == pAdapter) || (RSSI_CONTEXT_MAGIC != pStatsContext->magic)) |
| 703 | { |
| 704 | /* the caller presumably timed out so there is nothing we can do */ |
| 705 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 706 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
| 707 | __func__, pAdapter, pStatsContext->magic); |
| 708 | if (ioctl_debug) |
| 709 | { |
| 710 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
| 711 | __func__, pAdapter, pStatsContext->magic); |
| 712 | } |
| 713 | return; |
| 714 | } |
| 715 | |
| 716 | /* the race is on. caller could have timed out immediately after |
| 717 | we verified the magic, but if so, caller will wait a short time |
| 718 | for us to copy over the rssi */ |
| 719 | pAdapter->rssi = rssi; |
| 720 | |
| 721 | /* and notify the caller */ |
| 722 | complete(&pStatsContext->completion); |
| 723 | } |
| 724 | |
| 725 | |
| 726 | |
| 727 | VOS_STATUS wlan_hdd_get_roam_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value) |
| 728 | { |
| 729 | struct statsContext context; |
| 730 | hdd_context_t *pHddCtx = NULL; |
| 731 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 732 | eHalStatus hstatus; |
| 733 | long lrc; |
| 734 | |
| 735 | if (NULL == pAdapter) |
| 736 | { |
| 737 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 738 | "%s: Invalid context, pAdapter", __func__); |
| 739 | return VOS_STATUS_E_FAULT; |
| 740 | } |
| 741 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 742 | { |
| 743 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 744 | /* return a cached value */ |
| 745 | *rssi_value = pAdapter->rssi; |
| 746 | return VOS_STATUS_SUCCESS; |
| 747 | } |
| 748 | |
| 749 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 750 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 751 | |
| 752 | if(eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 753 | { |
| 754 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:Not associated!",__func__); |
| 755 | /* return a cached value */ |
| 756 | *rssi_value = 0; |
| 757 | return VOS_STATUS_SUCCESS; |
| 758 | } |
| 759 | init_completion(&context.completion); |
| 760 | context.pAdapter = pAdapter; |
| 761 | context.magic = RSSI_CONTEXT_MAGIC; |
| 762 | |
| 763 | hstatus = sme_GetRoamRssi(pHddCtx->hHal, hdd_GetRoamRssiCB, |
| 764 | pHddStaCtx->conn_info.staId[ 0 ], |
| 765 | pHddStaCtx->conn_info.bssId, |
| 766 | &context, pHddCtx->pvosContext); |
| 767 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 768 | { |
| 769 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI", |
| 770 | __func__); |
| 771 | /* we'll returned a cached value below */ |
| 772 | } |
| 773 | else |
| 774 | { |
| 775 | /* request was sent -- wait for the response */ |
| 776 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 777 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 778 | /* either we have a response or we timed out |
| 779 | either way, first invalidate our magic */ |
| 780 | context.magic = 0; |
| 781 | if (lrc <= 0) |
| 782 | { |
| 783 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while retrieving RSSI ", |
| 784 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
| 785 | /* there is a race condition such that the callback |
| 786 | function could be executing at the same time we are. of |
| 787 | primary concern is if the callback function had already |
| 788 | verified the "magic" but hasn't yet set the completion |
| 789 | variable. Since the completion variable is on our |
| 790 | stack, we'll delay just a bit to make sure the data is |
| 791 | still valid if that is the case */ |
| 792 | msleep(50); |
| 793 | /* we'll now returned a cached value below */ |
| 794 | } |
| 795 | } |
| 796 | *rssi_value = pAdapter->rssi; |
| 797 | |
| 798 | return VOS_STATUS_SUCCESS; |
| 799 | } |
| 800 | #endif |
| 801 | |
| 802 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 803 | void hdd_StatisticsCB( void *pStats, void *pContext ) |
| 804 | { |
| 805 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
| 806 | hdd_stats_t *pStatsCache = NULL; |
| 807 | hdd_wext_state_t *pWextState; |
| 808 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 809 | |
| 810 | tCsrSummaryStatsInfo *pSummaryStats = NULL; |
| 811 | tCsrGlobalClassAStatsInfo *pClassAStats = NULL; |
| 812 | tCsrGlobalClassBStatsInfo *pClassBStats = NULL; |
| 813 | tCsrGlobalClassCStatsInfo *pClassCStats = NULL; |
| 814 | tCsrGlobalClassDStatsInfo *pClassDStats = NULL; |
| 815 | tCsrPerStaStatsInfo *pPerStaStats = NULL; |
| 816 | |
| 817 | if (pAdapter!= NULL) |
| 818 | pStatsCache = &pAdapter->hdd_stats; |
| 819 | |
| 820 | |
| 821 | pSummaryStats = (tCsrSummaryStatsInfo *)pStats; |
| 822 | pClassAStats = (tCsrGlobalClassAStatsInfo *)( pSummaryStats + 1 ); |
| 823 | pClassBStats = (tCsrGlobalClassBStatsInfo *)( pClassAStats + 1 ); |
| 824 | pClassCStats = (tCsrGlobalClassCStatsInfo *)( pClassBStats + 1 ); |
| 825 | pClassDStats = (tCsrGlobalClassDStatsInfo *)( pClassCStats + 1 ); |
| 826 | pPerStaStats = (tCsrPerStaStatsInfo *)( pClassDStats + 1 ); |
| 827 | |
| 828 | if (pStatsCache!=NULL) |
| 829 | { |
| 830 | // and copy the stats into the cache we keep in the adapter instance structure |
| 831 | vos_mem_copy( &pStatsCache->summary_stat, pSummaryStats, sizeof( pStatsCache->summary_stat ) ); |
| 832 | vos_mem_copy( &pStatsCache->ClassA_stat, pClassAStats, sizeof( pStatsCache->ClassA_stat ) ); |
| 833 | vos_mem_copy( &pStatsCache->ClassB_stat, pClassBStats, sizeof( pStatsCache->ClassB_stat ) ); |
| 834 | vos_mem_copy( &pStatsCache->ClassC_stat, pClassCStats, sizeof( pStatsCache->ClassC_stat ) ); |
| 835 | vos_mem_copy( &pStatsCache->ClassD_stat, pClassDStats, sizeof( pStatsCache->ClassD_stat ) ); |
| 836 | vos_mem_copy( &pStatsCache->perStaStats, pPerStaStats, sizeof( pStatsCache->perStaStats ) ); |
| 837 | } |
| 838 | |
| 839 | if(pAdapter) |
| 840 | { |
| 841 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 842 | if(pWextState) |
| 843 | { |
| 844 | vos_status = vos_event_set(&pWextState->vosevent); |
| 845 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 846 | { |
| 847 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 848 | "%s: vos_event_set failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 849 | return; |
| 850 | } |
| 851 | } |
| 852 | } |
| 853 | } |
| 854 | |
| 855 | void ccmCfgSetCallback(tHalHandle halHandle, tANI_S32 result) |
| 856 | { |
| 857 | v_CONTEXT_t pVosContext; |
| 858 | hdd_context_t *pHddCtx; |
| 859 | VOS_STATUS hdd_reconnect_all_adapters( hdd_context_t *pHddCtx ); |
| 860 | #if 0 |
| 861 | hdd_wext_state_t *pWextState; |
| 862 | v_U32_t roamId; |
| 863 | #endif |
| 864 | |
| 865 | ENTER(); |
| 866 | |
| 867 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL); |
| 868 | |
| 869 | pHddCtx = (hdd_context_t*) vos_get_context(VOS_MODULE_ID_HDD,pVosContext); |
| 870 | if (NULL == pHddCtx) |
| 871 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 872 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid pHddCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 873 | return; |
| 874 | } |
| 875 | #if 0 |
| 876 | pWextState = pAdapter->pWextState; |
| 877 | #endif |
| 878 | |
| 879 | if (WNI_CFG_NEED_RESTART == result || WNI_CFG_NEED_RELOAD == result) |
| 880 | { |
| 881 | //TODO Verify is this is really used. If yes need to fix it. |
| 882 | hdd_reconnect_all_adapters( pHddCtx ); |
| 883 | #if 0 |
| 884 | pAdapter->conn_info.connState = eConnectionState_NotConnected; |
| 885 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 886 | vosStatus = sme_RoamDisconnect(halHandle, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 887 | |
| 888 | if(VOS_STATUS_SUCCESS == vosStatus) |
| 889 | wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var, |
| 890 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 891 | |
| 892 | sme_RoamConnect(halHandle, |
| 893 | pAdapter->sessionId, &(pWextState->roamProfile), |
| 894 | &roamId); |
| 895 | #endif |
| 896 | } |
| 897 | |
| 898 | EXIT(); |
| 899 | |
| 900 | } |
| 901 | |
| 902 | void hdd_clearRoamProfileIe( hdd_adapter_t *pAdapter) |
| 903 | { |
| 904 | int i = 0; |
| 905 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 906 | |
| 907 | /* clear WPA/RSN/WSC IE information in the profile */ |
| 908 | pWextState->roamProfile.nWPAReqIELength = 0; |
| 909 | pWextState->roamProfile.pWPAReqIE = (tANI_U8 *)NULL; |
| 910 | pWextState->roamProfile.nRSNReqIELength = 0; |
| 911 | pWextState->roamProfile.pRSNReqIE = (tANI_U8 *)NULL; |
| 912 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 913 | #ifdef FEATURE_WLAN_WAPI |
| 914 | pWextState->roamProfile.nWAPIReqIELength = 0; |
| 915 | pWextState->roamProfile.pWAPIReqIE = (tANI_U8 *)NULL; |
| 916 | #endif |
| 917 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 918 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
| 919 | pWextState->roamProfile.pAddIEScan = (tANI_U8 *)NULL; |
| 920 | pWextState->roamProfile.nAddIEScanLength = 0; |
| 921 | pWextState->roamProfile.pAddIEAssoc = (tANI_U8 *)NULL; |
| 922 | pWextState->roamProfile.nAddIEAssocLength = 0; |
| 923 | |
| 924 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 925 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 926 | = eCSR_ENCRYPT_TYPE_NONE; |
| 927 | |
| 928 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 929 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] |
| 930 | = eCSR_ENCRYPT_TYPE_NONE; |
| 931 | |
| 932 | pWextState->roamProfile.AuthType.numEntries = 1; |
| 933 | pWextState->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 934 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 935 | #ifdef WLAN_FEATURE_11W |
| 936 | pWextState->roamProfile.MFPEnabled = eANI_BOOLEAN_FALSE; |
| 937 | pWextState->roamProfile.MFPRequired = 0; |
| 938 | pWextState->roamProfile.MFPCapable = 0; |
| 939 | #endif |
| 940 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 941 | pWextState->authKeyMgmt = 0; |
| 942 | |
| 943 | for (i=0; i < CSR_MAX_NUM_KEY; i++) |
| 944 | { |
| 945 | if (pWextState->roamProfile.Keys.KeyMaterial[i]) |
| 946 | { |
| 947 | pWextState->roamProfile.Keys.KeyLength[i] = 0; |
| 948 | } |
| 949 | } |
| 950 | #ifdef FEATURE_WLAN_WAPI |
| 951 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_OPEN; |
| 952 | pAdapter->wapi_info.nWapiMode = 0; |
| 953 | #endif |
| 954 | |
| 955 | vos_mem_zero((void *)(pWextState->req_bssId), WNI_CFG_BSSID_LEN); |
| 956 | |
| 957 | } |
| 958 | |
| 959 | void wlan_hdd_ula_done_cb(v_VOID_t *callbackContext) |
| 960 | { |
| 961 | hdd_adapter_t *pAdapter = (hdd_adapter_t*)callbackContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 962 | |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 963 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 964 | { |
| 965 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 966 | "%s: Invalid pAdapter magic", __func__); |
| 967 | } |
| 968 | else |
| 969 | { |
| 970 | complete(&pAdapter->ula_complete); |
| 971 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 972 | } |
| 973 | |
| 974 | VOS_STATUS wlan_hdd_check_ula_done(hdd_adapter_t *pAdapter) |
| 975 | { |
| 976 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 977 | VOS_STATUS vos_status; |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 978 | unsigned long rc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 979 | |
| 980 | if (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated) |
| 981 | { |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 982 | INIT_COMPLETION(pAdapter->ula_complete); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 983 | |
| 984 | /*To avoid race condition between the set key and the last EAPOL |
| 985 | packet, notify TL to finish upper layer authentication incase if the |
| 986 | last EAPOL packet pending in the TL queue.*/ |
Tushnim Bhattacharyya | 39a8f18 | 2013-02-20 18:10:30 -0800 | [diff] [blame] | 987 | vos_status = WLANTL_Finish_ULA(wlan_hdd_ula_done_cb, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 988 | |
| 989 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 990 | { |
| 991 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 992 | "[%4d] WLANTL_Finish_ULA returned ERROR status= %d", |
| 993 | __LINE__, vos_status ); |
| 994 | return vos_status; |
| 995 | |
| 996 | } |
| 997 | |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 998 | rc = wait_for_completion_timeout(&pAdapter->ula_complete, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 999 | msecs_to_jiffies(HDD_FINISH_ULA_TIME_OUT)); |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1000 | if (0 == rc) |
| 1001 | { |
| 1002 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1003 | "%s: Timeout waiting for ULA to complete", __func__); |
| 1004 | /* we'll still fall through and return success since the |
| 1005 | * connection may still get established but is just taking |
| 1006 | * too long for us to wait */ |
| 1007 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1008 | } |
| 1009 | return VOS_STATUS_SUCCESS; |
| 1010 | } |
| 1011 | |
| 1012 | 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) |
| 1013 | { |
| 1014 | |
| 1015 | int left = ie_len; |
| 1016 | v_U8_t *ptr = ie; |
| 1017 | v_U8_t elem_id,elem_len; |
| 1018 | v_U8_t eid = 0xDD; |
| 1019 | |
| 1020 | if ( NULL == ie || 0 == ie_len ) |
| 1021 | return NULL; |
| 1022 | |
| 1023 | while(left >= 2) |
| 1024 | { |
| 1025 | elem_id = ptr[0]; |
| 1026 | elem_len = ptr[1]; |
| 1027 | left -= 2; |
| 1028 | if(elem_len > left) |
| 1029 | { |
| 1030 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1031 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | eid,elem_len,left); |
| 1033 | return NULL; |
| 1034 | } |
| 1035 | if (elem_id == eid) |
| 1036 | { |
| 1037 | if(memcmp( &ptr[2], oui, oui_size)==0) |
| 1038 | return ptr; |
| 1039 | } |
| 1040 | |
| 1041 | left -= elem_len; |
| 1042 | ptr += (elem_len + 2); |
| 1043 | } |
| 1044 | return NULL; |
| 1045 | } |
| 1046 | |
| 1047 | static int iw_set_commit(struct net_device *dev, struct iw_request_info *info, |
| 1048 | union iwreq_data *wrqu, char *extra) |
| 1049 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1050 | hddLog( LOG1, "In %s\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1051 | /* Do nothing for now */ |
| 1052 | return 0; |
| 1053 | } |
| 1054 | |
| 1055 | static int iw_get_name(struct net_device *dev, |
| 1056 | struct iw_request_info *info, |
| 1057 | char *wrqu, char *extra) |
| 1058 | { |
| 1059 | |
| 1060 | ENTER(); |
| 1061 | strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ); |
| 1062 | EXIT(); |
| 1063 | return 0; |
| 1064 | } |
| 1065 | |
| 1066 | static int iw_set_mode(struct net_device *dev, |
| 1067 | struct iw_request_info *info, |
| 1068 | union iwreq_data *wrqu, char *extra) |
| 1069 | { |
| 1070 | hdd_wext_state_t *pWextState; |
| 1071 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1072 | tCsrRoamProfile *pRoamProfile; |
| 1073 | eCsrRoamBssType LastBSSType; |
| 1074 | eMib_dot11DesiredBssType connectedBssType; |
| 1075 | hdd_config_t *pConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1076 | struct wireless_dev *wdev; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1077 | |
| 1078 | ENTER(); |
| 1079 | |
| 1080 | if (NULL == pAdapter) |
| 1081 | { |
| 1082 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 1083 | "%s: Invalid context, pAdapter", __func__); |
| 1084 | return 0; |
| 1085 | } |
| 1086 | |
| 1087 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1088 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1089 | return 0; |
| 1090 | } |
| 1091 | |
| 1092 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1093 | if (pWextState == NULL) |
| 1094 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1095 | hddLog (LOGE, "%s ERROR: Data Storage Corruption", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1096 | return -EINVAL; |
| 1097 | } |
| 1098 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1099 | wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1100 | pRoamProfile = &pWextState->roamProfile; |
| 1101 | LastBSSType = pRoamProfile->BSSType; |
| 1102 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1103 | hddLog( LOG1,"%s Old Bss type = %d", __func__, LastBSSType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1104 | |
| 1105 | switch (wrqu->mode) |
| 1106 | { |
| 1107 | case IW_MODE_ADHOC: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1108 | hddLog( LOG1,"%s Setting AP Mode as IW_MODE_ADHOC", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1109 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 1110 | // Set the phymode correctly for IBSS. |
| 1111 | pConfig = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 1112 | pWextState->roamProfile.phyMode = hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1113 | wdev->iftype = NL80211_IFTYPE_ADHOC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1114 | break; |
| 1115 | case IW_MODE_INFRA: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1116 | hddLog( LOG1, "%s Setting AP Mode as IW_MODE_INFRA", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1117 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1118 | wdev->iftype = NL80211_IFTYPE_STATION; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1119 | break; |
| 1120 | case IW_MODE_AUTO: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1121 | hddLog(LOG1,"%s Setting AP Mode as IW_MODE_AUTO", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1122 | pRoamProfile->BSSType = eCSR_BSS_TYPE_ANY; |
| 1123 | break; |
| 1124 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1125 | hddLog(LOG1,"%s Unknown AP Mode value", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1126 | return -EOPNOTSUPP; |
| 1127 | } |
| 1128 | |
| 1129 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 1130 | { |
| 1131 | //the BSS mode changed |
| 1132 | // We need to issue disconnect if connected or in IBSS disconnect state |
| 1133 | if ( hdd_connGetConnectedBssType( WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 1134 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 1135 | { |
| 1136 | VOS_STATUS vosStatus; |
| 1137 | // need to issue a disconnect to CSR. |
| 1138 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 1139 | vosStatus = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1140 | pAdapter->sessionId, |
| 1141 | eCSR_DISCONNECT_REASON_IBSS_LEAVE ); |
| 1142 | if(VOS_STATUS_SUCCESS == vosStatus) |
| 1143 | wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var, |
| 1144 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 1145 | } |
| 1146 | } |
| 1147 | |
| 1148 | |
| 1149 | |
| 1150 | EXIT(); |
| 1151 | return 0; |
| 1152 | } |
| 1153 | |
| 1154 | |
| 1155 | static int iw_get_mode(struct net_device *dev, |
| 1156 | struct iw_request_info *info, |
| 1157 | v_U32_t *uwrq, char *extra) |
| 1158 | { |
| 1159 | |
| 1160 | hdd_wext_state_t *pWextState; |
| 1161 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1162 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1163 | hddLog (LOG1, "In %s",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1164 | |
| 1165 | if (NULL == pAdapter) |
| 1166 | { |
| 1167 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 1168 | "%s: Invalid context, pAdapter", __func__); |
| 1169 | return 0; |
| 1170 | } |
| 1171 | |
| 1172 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1173 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1174 | return 0; |
| 1175 | } |
| 1176 | |
| 1177 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1178 | if (pWextState == NULL) |
| 1179 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1180 | hddLog (LOGE, "%s ERROR: Data Storage Corruption", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1181 | return -EINVAL; |
| 1182 | } |
| 1183 | |
| 1184 | switch (pWextState->roamProfile.BSSType) |
| 1185 | { |
| 1186 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1187 | hddLog(LOG1, "%s returns IW_MODE_INFRA\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1188 | *uwrq = IW_MODE_INFRA ; |
| 1189 | break; |
| 1190 | case eCSR_BSS_TYPE_IBSS: |
| 1191 | case eCSR_BSS_TYPE_START_IBSS: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1192 | hddLog( LOG1,"%s returns IW_MODE_ADHOC\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1193 | *uwrq= IW_MODE_ADHOC; |
| 1194 | break; |
| 1195 | case eCSR_BSS_TYPE_ANY: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1196 | hddLog( LOG1,"%s returns IW_MODE_AUTO\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1197 | *uwrq= IW_MODE_AUTO; |
| 1198 | break; |
| 1199 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1200 | hddLog( LOG1,"%s returns APMODE_UNKNOWN\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | break; |
| 1202 | } |
| 1203 | return 0; |
| 1204 | } |
| 1205 | |
| 1206 | static int iw_set_freq(struct net_device *dev, struct iw_request_info *info, |
| 1207 | union iwreq_data *wrqu, char *extra) |
| 1208 | { |
| 1209 | v_U32_t numChans = 0; |
| 1210 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 1211 | v_U32_t indx = 0; |
| 1212 | v_U32_t status = 0; |
| 1213 | |
| 1214 | hdd_wext_state_t *pWextState; |
| 1215 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1216 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1217 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1218 | tCsrRoamProfile * pRoamProfile; |
| 1219 | ENTER(); |
| 1220 | |
| 1221 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1222 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1223 | return status; |
| 1224 | } |
| 1225 | |
| 1226 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1227 | |
| 1228 | pRoamProfile = &pWextState->roamProfile; |
| 1229 | |
| 1230 | hddLog(LOG1,"setCHANNEL ioctl\n"); |
| 1231 | |
| 1232 | /* Link is up then return cant set channel*/ |
| 1233 | if(eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState || |
| 1234 | eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1235 | { |
| 1236 | hddLog( LOGE, "IBSS Associated\n"); |
| 1237 | return -EOPNOTSUPP; |
| 1238 | } |
| 1239 | |
| 1240 | /* Settings by Frequency as input */ |
| 1241 | if((wrqu->freq.e == 1) && (wrqu->freq.m >= (tANI_U32)2.412e8) && |
| 1242 | (wrqu->freq.m <= (tANI_U32)5.825e8)) |
| 1243 | { |
| 1244 | tANI_U32 freq = wrqu->freq.m / 100000; |
| 1245 | |
| 1246 | while ((indx < FREQ_CHAN_MAP_TABLE_SIZE) && (freq != freq_chan_map[indx].freq)) |
| 1247 | indx++; |
| 1248 | if (indx >= FREQ_CHAN_MAP_TABLE_SIZE) |
| 1249 | { |
| 1250 | return -EINVAL; |
| 1251 | } |
| 1252 | wrqu->freq.e = 0; |
| 1253 | wrqu->freq.m = freq_chan_map[indx].chan; |
| 1254 | |
| 1255 | } |
| 1256 | |
| 1257 | if (wrqu->freq.e == 0) |
| 1258 | { |
| 1259 | if((wrqu->freq.m < WNI_CFG_CURRENT_CHANNEL_STAMIN) || |
| 1260 | (wrqu->freq.m > WNI_CFG_CURRENT_CHANNEL_STAMAX)) |
| 1261 | { |
| 1262 | hddLog(LOG1,"%s: Channel [%d] is outside valid range from %d to %d\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1263 | __func__, wrqu->freq.m, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1264 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 1265 | return -EINVAL; |
| 1266 | } |
| 1267 | |
| 1268 | numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1269 | |
| 1270 | if (ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 1271 | validChan, &numChans) != eHAL_STATUS_SUCCESS){ |
| 1272 | return -EIO; |
| 1273 | } |
| 1274 | |
| 1275 | for (indx = 0; indx < numChans; indx++) { |
| 1276 | if (wrqu->freq.m == validChan[indx]){ |
| 1277 | break; |
| 1278 | } |
| 1279 | } |
| 1280 | } |
| 1281 | else{ |
| 1282 | |
| 1283 | return -EINVAL; |
| 1284 | } |
| 1285 | |
| 1286 | if(indx >= numChans) |
| 1287 | { |
| 1288 | return -EINVAL; |
| 1289 | } |
| 1290 | |
| 1291 | /* Set the Operational Channel */ |
| 1292 | numChans = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 1293 | pHddStaCtx->conn_info.operationChannel = wrqu->freq.m; |
| 1294 | pRoamProfile->ChannelInfo.ChannelList = &pHddStaCtx->conn_info.operationChannel; |
| 1295 | |
| 1296 | hddLog(LOG1,"pRoamProfile->operationChannel = %d\n", wrqu->freq.m); |
| 1297 | |
| 1298 | EXIT(); |
| 1299 | |
| 1300 | return status; |
| 1301 | } |
| 1302 | |
| 1303 | static int iw_get_freq(struct net_device *dev, struct iw_request_info *info, |
| 1304 | struct iw_freq *fwrq, char *extra) |
| 1305 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1306 | v_U32_t status = FALSE, channel = 0, freq = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1307 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1308 | tHalHandle hHal; |
| 1309 | hdd_wext_state_t *pWextState; |
| 1310 | tCsrRoamProfile * pRoamProfile; |
| 1311 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1312 | |
| 1313 | ENTER(); |
| 1314 | |
| 1315 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1316 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1317 | return status; |
| 1318 | } |
| 1319 | |
| 1320 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1321 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1322 | |
| 1323 | pRoamProfile = &pWextState->roamProfile; |
| 1324 | |
| 1325 | if( pHddStaCtx->conn_info.connState== eConnectionState_Associated ) |
| 1326 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1327 | if (sme_GetOperationChannel(hHal, &channel, pAdapter->sessionId) != eHAL_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | { |
| 1329 | return -EIO; |
| 1330 | } |
| 1331 | else |
| 1332 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1333 | status = hdd_wlan_get_freq(channel, &freq); |
| 1334 | if( TRUE == status ) |
| 1335 | { |
| 1336 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 1337 | * iwlist & iwconfig command shows frequency into proper |
| 1338 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 1339 | fwrq->m = freq; |
| 1340 | fwrq->e = MHZ; |
| 1341 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1342 | } |
| 1343 | } |
| 1344 | else |
| 1345 | { |
Madan Mohan Koyyalamudi | 99f9c66 | 2012-10-11 17:00:31 -0700 | [diff] [blame] | 1346 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 1347 | * iwlist & iwconfig command shows frequency into proper |
| 1348 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 1349 | fwrq->m = 0; |
| 1350 | fwrq->e = MHZ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1351 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1352 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1353 | } |
| 1354 | |
| 1355 | static int iw_get_tx_power(struct net_device *dev, |
| 1356 | struct iw_request_info *info, |
| 1357 | union iwreq_data *wrqu, char *extra) |
| 1358 | { |
| 1359 | |
| 1360 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1361 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1362 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1363 | |
| 1364 | if (pHddCtx->isLogpInProgress) |
| 1365 | { |
| 1366 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 1367 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1368 | return -EBUSY; |
| 1369 | } |
| 1370 | |
| 1371 | if(eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 1372 | { |
| 1373 | wrqu->txpower.value = 0; |
| 1374 | return 0; |
| 1375 | } |
| 1376 | wlan_hdd_get_classAstats(pAdapter); |
| 1377 | wrqu->txpower.value = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 1378 | |
| 1379 | return 0; |
| 1380 | } |
| 1381 | |
| 1382 | static int iw_set_tx_power(struct net_device *dev, |
| 1383 | struct iw_request_info *info, |
| 1384 | union iwreq_data *wrqu, char *extra) |
| 1385 | { |
| 1386 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1387 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1388 | |
| 1389 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 1390 | { |
| 1391 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1392 | return 0; |
| 1393 | } |
| 1394 | |
| 1395 | ENTER(); |
| 1396 | |
| 1397 | if ( ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, wrqu->txpower.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 1398 | { |
| 1399 | return -EIO; |
| 1400 | } |
| 1401 | |
| 1402 | EXIT(); |
| 1403 | |
| 1404 | return 0; |
| 1405 | } |
| 1406 | |
| 1407 | static int iw_get_bitrate(struct net_device *dev, |
| 1408 | struct iw_request_info *info, |
| 1409 | union iwreq_data *wrqu, char *extra) |
| 1410 | { |
| 1411 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 1412 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1413 | hdd_wext_state_t *pWextState; |
| 1414 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1415 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1416 | |
| 1417 | ENTER(); |
| 1418 | |
| 1419 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1420 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1421 | return status; |
| 1422 | } |
| 1423 | |
| 1424 | if(eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
| 1425 | wrqu->bitrate.value = 0; |
| 1426 | } |
| 1427 | else { |
| 1428 | status = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), eCSR_HDD, |
| 1429 | SME_SUMMARY_STATS | |
| 1430 | SME_GLOBAL_CLASSA_STATS | |
| 1431 | SME_GLOBAL_CLASSB_STATS | |
| 1432 | SME_GLOBAL_CLASSC_STATS | |
| 1433 | SME_GLOBAL_CLASSD_STATS | |
| 1434 | SME_PER_STA_STATS, |
| 1435 | hdd_StatisticsCB, 0, FALSE, |
| 1436 | pHddStaCtx->conn_info.staId[0], pAdapter ); |
| 1437 | |
| 1438 | if(eHAL_STATUS_SUCCESS != status) |
| 1439 | { |
| 1440 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1441 | "%s: Unable to retrieve statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1442 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1443 | return status; |
| 1444 | } |
| 1445 | |
| 1446 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1447 | |
| 1448 | vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS); |
| 1449 | |
| 1450 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1451 | { |
| 1452 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1453 | "%s: SME timeout while retrieving statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1454 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1455 | return VOS_STATUS_E_FAILURE; |
| 1456 | } |
| 1457 | |
| 1458 | wrqu->bitrate.value = pAdapter->hdd_stats.ClassA_stat.tx_rate*500*1000; |
| 1459 | } |
| 1460 | |
| 1461 | EXIT(); |
| 1462 | |
| 1463 | return vos_status; |
| 1464 | } |
| 1465 | /* ccm call back function */ |
| 1466 | |
| 1467 | static int iw_set_bitrate(struct net_device *dev, |
| 1468 | struct iw_request_info *info, |
| 1469 | union iwreq_data *wrqu, |
| 1470 | char *extra) |
| 1471 | { |
| 1472 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1473 | hdd_wext_state_t *pWextState; |
| 1474 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1475 | v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 1476 | v_U32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 1477 | v_U32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 1478 | v_U32_t i, rate; |
| 1479 | v_U32_t valid_rate = FALSE, active_phy_mode = 0; |
| 1480 | |
| 1481 | ENTER(); |
| 1482 | |
| 1483 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1484 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1485 | return 0; |
| 1486 | } |
| 1487 | |
| 1488 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1489 | |
| 1490 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 1491 | { |
| 1492 | return -ENXIO ; |
| 1493 | } |
| 1494 | |
| 1495 | rate = wrqu->bitrate.value; |
| 1496 | |
| 1497 | if (rate == -1) |
| 1498 | { |
| 1499 | rate = WNI_CFG_FIXED_RATE_AUTO; |
| 1500 | valid_rate = TRUE; |
| 1501 | } |
| 1502 | else if (ccmCfgGetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1503 | WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS) |
| 1504 | { |
| 1505 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G |
| 1506 | || active_phy_mode == WNI_CFG_DOT11_MODE_11B) |
| 1507 | { |
| 1508 | if ((ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1509 | WNI_CFG_SUPPORTED_RATES_11A, |
| 1510 | supp_rates, &a_len) == eHAL_STATUS_SUCCESS) && |
| 1511 | (ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1512 | WNI_CFG_SUPPORTED_RATES_11B, |
| 1513 | supp_rates, &b_len) == eHAL_STATUS_SUCCESS)) |
| 1514 | { |
| 1515 | for (i = 0; i < (b_len + a_len); ++i) |
| 1516 | { |
| 1517 | /* supported rates returned is double the actual rate so we divide it by 2 */ |
| 1518 | if ((supp_rates[i]&0x7F)/2 == rate) |
| 1519 | { |
| 1520 | valid_rate = TRUE; |
| 1521 | rate = i + WNI_CFG_FIXED_RATE_1MBPS; |
| 1522 | break; |
| 1523 | } |
| 1524 | } |
| 1525 | } |
| 1526 | } |
| 1527 | } |
| 1528 | if (valid_rate != TRUE) |
| 1529 | { |
| 1530 | return -EINVAL; |
| 1531 | } |
| 1532 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1533 | WNI_CFG_FIXED_RATE, rate, |
| 1534 | ccmCfgSetCallback,eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS) |
| 1535 | { |
| 1536 | return -EIO; |
| 1537 | } |
| 1538 | return 0; |
| 1539 | } |
| 1540 | |
| 1541 | |
| 1542 | static int iw_set_genie(struct net_device *dev, |
| 1543 | struct iw_request_info *info, |
| 1544 | union iwreq_data *wrqu, |
| 1545 | char *extra) |
| 1546 | { |
| 1547 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1548 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1549 | u_int8_t *genie; |
| 1550 | v_U16_t remLen; |
| 1551 | |
| 1552 | ENTER(); |
| 1553 | if(!wrqu->data.length) { |
| 1554 | hdd_clearRoamProfileIe(pAdapter); |
| 1555 | EXIT(); |
| 1556 | return 0; |
| 1557 | } |
| 1558 | |
| 1559 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1560 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1561 | return 0; |
| 1562 | } |
| 1563 | |
| 1564 | genie = wrqu->data.pointer; |
| 1565 | remLen = wrqu->data.length; |
| 1566 | |
| 1567 | hddLog(LOG1,"iw_set_genie ioctl IE[0x%X], LEN[%d]\n", genie[0], genie[1]); |
| 1568 | |
| 1569 | /* clear any previous genIE before this call */ |
| 1570 | memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) ); |
| 1571 | |
| 1572 | while (remLen >= 2) |
| 1573 | { |
| 1574 | v_U16_t eLen = 0; |
| 1575 | v_U8_t elementId; |
| 1576 | elementId = *genie++; |
| 1577 | eLen = *genie++; |
| 1578 | remLen -= 2; |
| 1579 | |
| 1580 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]\n", |
| 1581 | __func__, elementId, eLen); |
| 1582 | |
| 1583 | switch ( elementId ) |
| 1584 | { |
| 1585 | case IE_EID_VENDOR: |
| 1586 | if ((IE_LEN_SIZE+IE_EID_SIZE+IE_VENDOR_OUI_SIZE) > eLen) /* should have at least OUI */ |
| 1587 | return -EINVAL; |
| 1588 | |
| 1589 | if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
| 1590 | { |
| 1591 | v_U16_t curGenIELen = pWextState->genIE.length; |
| 1592 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS OUI(%02x %02x %02x %02x) IE(len %d)", |
| 1593 | __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2); |
| 1594 | |
| 1595 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) ) |
| 1596 | { |
| 1597 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. " |
| 1598 | "Need bigger buffer space\n"); |
| 1599 | VOS_ASSERT(0); |
| 1600 | return -ENOMEM; |
| 1601 | } |
| 1602 | // save to Additional IE ; it should be accumulated to handle WPS IE + other IE |
| 1603 | memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2); |
| 1604 | pWextState->genIE.length += eLen + 2; |
| 1605 | } |
| 1606 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 1607 | { |
| 1608 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 1609 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 1610 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)); |
| 1611 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 1612 | pWextState->roamProfile.nWPAReqIELength = eLen + 2; |
| 1613 | } |
| 1614 | else /* any vendorId except WPA IE should be accumulated to genIE */ |
| 1615 | { |
| 1616 | v_U16_t curGenIELen = pWextState->genIE.length; |
| 1617 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OUI(%02x %02x %02x %02x) IE(len %d)", |
| 1618 | __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2); |
| 1619 | |
| 1620 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) ) |
| 1621 | { |
| 1622 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. " |
| 1623 | "Need bigger buffer space\n"); |
| 1624 | VOS_ASSERT(0); |
| 1625 | return -ENOMEM; |
| 1626 | } |
| 1627 | // save to Additional IE ; it should be accumulated to handle WPS IE + other IE |
| 1628 | memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2); |
| 1629 | pWextState->genIE.length += eLen + 2; |
| 1630 | } |
| 1631 | break; |
| 1632 | case DOT11F_EID_RSN: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1633 | hddLog (LOG1, "%s Set RSN IE (len %d)",__func__, eLen+2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1634 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 1635 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)); |
| 1636 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 1637 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; |
| 1638 | break; |
| 1639 | |
| 1640 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1641 | hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, elementId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1642 | return 0; |
| 1643 | } |
| 1644 | genie += eLen; |
| 1645 | remLen -= eLen; |
| 1646 | } |
| 1647 | EXIT(); |
| 1648 | return 0; |
| 1649 | } |
| 1650 | |
| 1651 | static int iw_get_genie(struct net_device *dev, |
| 1652 | struct iw_request_info *info, |
| 1653 | union iwreq_data *wrqu, |
| 1654 | char *extra) |
| 1655 | { |
| 1656 | hdd_wext_state_t *pWextState; |
| 1657 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1658 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1659 | eHalStatus status; |
| 1660 | v_U32_t length = DOT11F_IE_RSN_MAX_LEN; |
| 1661 | v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN]; |
| 1662 | |
| 1663 | ENTER(); |
| 1664 | |
| 1665 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1666 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1667 | return 0; |
| 1668 | } |
| 1669 | |
| 1670 | |
| 1671 | hddLog(LOG1,"getGEN_IE ioctl\n"); |
| 1672 | |
| 1673 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1674 | |
| 1675 | if( pHddStaCtx->conn_info.connState == eConnectionState_NotConnected) |
| 1676 | { |
| 1677 | return -ENXIO; |
| 1678 | } |
| 1679 | |
| 1680 | // Return something ONLY if we are associated with an RSN or WPA network |
| 1681 | if ( VOS_TRUE != hdd_IsAuthTypeRSN(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1682 | pWextState->roamProfile.negotiatedAuthType)) |
| 1683 | { |
| 1684 | return -ENXIO; |
| 1685 | } |
| 1686 | |
| 1687 | // Actually retrieve the RSN IE from CSR. (We previously sent it down in the CSR Roam Profile.) |
| 1688 | status = csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1689 | pAdapter->sessionId, |
| 1690 | &length, |
| 1691 | genIeBytes); |
| 1692 | wrqu->data.length = VOS_MIN((u_int16_t) length, DOT11F_IE_RSN_MAX_LEN); |
| 1693 | |
| 1694 | vos_mem_copy( wrqu->data.pointer, (v_VOID_t*)genIeBytes, wrqu->data.length); |
| 1695 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1696 | hddLog(LOG1,"%s: RSN IE of %d bytes returned\n", __func__, wrqu->data.length ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1697 | |
| 1698 | EXIT(); |
| 1699 | |
| 1700 | return 0; |
| 1701 | } |
| 1702 | |
| 1703 | static int iw_get_encode(struct net_device *dev, |
| 1704 | struct iw_request_info *info, |
| 1705 | struct iw_point *dwrq, char *extra) |
| 1706 | { |
| 1707 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1708 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1709 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 1710 | int keyId; |
| 1711 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
| 1712 | int i; |
| 1713 | |
| 1714 | ENTER(); |
| 1715 | |
| 1716 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { |
| 1717 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1718 | return 0; |
| 1719 | } |
| 1720 | |
| 1721 | keyId = pRoamProfile->Keys.defaultIndex; |
| 1722 | |
| 1723 | if(keyId < 0 || keyId >= MAX_WEP_KEYS) |
| 1724 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1725 | hddLog(LOG1,"%s: Invalid keyId : %d\n",__func__,keyId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1726 | return -EINVAL; |
| 1727 | } |
| 1728 | |
| 1729 | if(pRoamProfile->Keys.KeyLength[keyId] > 0) |
| 1730 | { |
| 1731 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 1732 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
| 1733 | vos_mem_copy(extra,&(pRoamProfile->Keys.KeyMaterial[keyId][0]),pRoamProfile->Keys.KeyLength[keyId]); |
| 1734 | |
| 1735 | dwrq->flags |= (keyId + 1); |
| 1736 | |
| 1737 | } |
| 1738 | else |
| 1739 | { |
| 1740 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 1741 | } |
| 1742 | |
| 1743 | for(i=0; i < MAX_WEP_KEYS; i++) |
| 1744 | { |
| 1745 | if(pRoamProfile->Keys.KeyMaterial[i] == NULL) |
| 1746 | { |
| 1747 | continue; |
| 1748 | } |
| 1749 | else |
| 1750 | { |
| 1751 | break; |
| 1752 | } |
| 1753 | } |
| 1754 | |
| 1755 | if(MAX_WEP_KEYS == i) |
| 1756 | { |
| 1757 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 1758 | } |
| 1759 | |
| 1760 | authType = ((hdd_station_ctx_t*)WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType; |
| 1761 | |
| 1762 | if(eCSR_AUTH_TYPE_OPEN_SYSTEM == authType) |
| 1763 | { |
| 1764 | dwrq->flags |= IW_ENCODE_OPEN; |
| 1765 | } |
| 1766 | else |
| 1767 | { |
| 1768 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 1769 | } |
| 1770 | EXIT(); |
| 1771 | return 0; |
| 1772 | } |
| 1773 | |
| 1774 | #define PAE_ROLE_AUTHENTICATOR 1 // =1 for authenticator, |
| 1775 | #define PAE_ROLE_SUPPLICANT 0 // =0 for supplicant |
| 1776 | |
| 1777 | |
| 1778 | /* |
| 1779 | * This function sends a single 'key' to LIM at all time. |
| 1780 | */ |
| 1781 | |
| 1782 | static int iw_get_rts_threshold(struct net_device *dev, |
| 1783 | struct iw_request_info *info, |
| 1784 | union iwreq_data *wrqu, char *extra) |
| 1785 | { |
| 1786 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1787 | v_U32_t status = 0; |
| 1788 | |
| 1789 | status = hdd_wlan_get_rts_threshold(pAdapter,wrqu); |
| 1790 | |
| 1791 | return status; |
| 1792 | } |
| 1793 | |
| 1794 | static int iw_set_rts_threshold(struct net_device *dev, |
| 1795 | struct iw_request_info *info, |
| 1796 | union iwreq_data *wrqu, char *extra) |
| 1797 | { |
| 1798 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1799 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1800 | |
| 1801 | ENTER(); |
| 1802 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 1803 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 1804 | { |
| 1805 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 1806 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 1807 | return -EAGAIN; |
| 1808 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1809 | if ( wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX ) |
| 1810 | { |
| 1811 | return -EINVAL; |
| 1812 | } |
| 1813 | |
| 1814 | if ( ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, wrqu->rts.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 1815 | { |
| 1816 | return -EIO; |
| 1817 | } |
| 1818 | |
| 1819 | EXIT(); |
| 1820 | |
| 1821 | return 0; |
| 1822 | } |
| 1823 | |
| 1824 | static int iw_get_frag_threshold(struct net_device *dev, |
| 1825 | struct iw_request_info *info, |
| 1826 | union iwreq_data *wrqu, char *extra) |
| 1827 | { |
| 1828 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1829 | v_U32_t status = 0; |
| 1830 | |
| 1831 | status = hdd_wlan_get_frag_threshold(pAdapter,wrqu); |
| 1832 | |
| 1833 | return status; |
| 1834 | } |
| 1835 | |
| 1836 | static int iw_set_frag_threshold(struct net_device *dev, |
| 1837 | struct iw_request_info *info, |
| 1838 | union iwreq_data *wrqu, char *extra) |
| 1839 | { |
| 1840 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1841 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1842 | |
| 1843 | ENTER(); |
| 1844 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 1845 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 1846 | { |
| 1847 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1848 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 1849 | return -EBUSY; |
| 1850 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1851 | if ( wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX ) |
| 1852 | { |
| 1853 | return -EINVAL; |
| 1854 | } |
| 1855 | |
| 1856 | if ( ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, wrqu->frag.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 1857 | { |
| 1858 | return -EIO; |
| 1859 | } |
| 1860 | |
| 1861 | EXIT(); |
| 1862 | |
| 1863 | return 0; |
| 1864 | } |
| 1865 | |
| 1866 | static int iw_get_power_mode(struct net_device *dev, |
| 1867 | struct iw_request_info *info, |
| 1868 | union iwreq_data *wrqu, char *extra) |
| 1869 | { |
| 1870 | ENTER(); |
| 1871 | return -EOPNOTSUPP; |
| 1872 | } |
| 1873 | |
| 1874 | static int iw_set_power_mode(struct net_device *dev, |
| 1875 | struct iw_request_info *info, |
| 1876 | union iwreq_data *wrqu, char *extra) |
| 1877 | { |
| 1878 | ENTER(); |
| 1879 | return -EOPNOTSUPP; |
| 1880 | } |
| 1881 | |
| 1882 | static int iw_get_range(struct net_device *dev, struct iw_request_info *info, |
| 1883 | union iwreq_data *wrqu, char *extra) |
| 1884 | { |
| 1885 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1886 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1887 | struct iw_range *range = (struct iw_range *) extra; |
| 1888 | |
| 1889 | v_U8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 1890 | |
| 1891 | v_U32_t num_channels = sizeof(channels); |
| 1892 | v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 1893 | v_U32_t a_len; |
| 1894 | v_U32_t b_len; |
| 1895 | v_U32_t active_phy_mode = 0; |
| 1896 | v_U8_t index = 0, i; |
| 1897 | |
| 1898 | ENTER(); |
| 1899 | |
| 1900 | wrqu->data.length = sizeof(struct iw_range); |
| 1901 | memset(range, 0, sizeof(struct iw_range)); |
| 1902 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 1903 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 1904 | { |
| 1905 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1906 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 1907 | return -EBUSY; |
| 1908 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1909 | |
| 1910 | /*Get the phy mode*/ |
| 1911 | if (ccmCfgGetInt(hHal, |
| 1912 | WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS) |
| 1913 | { |
| 1914 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1915 | "active_phy_mode = %ld", active_phy_mode); |
| 1916 | |
| 1917 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G) |
| 1918 | { |
| 1919 | /*Get the supported rates for 11G band*/ |
Jeff Johnson | 1611e58 | 2013-04-03 10:43:16 -0700 | [diff] [blame] | 1920 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1921 | if (ccmCfgGetStr(hHal, |
| 1922 | WNI_CFG_SUPPORTED_RATES_11A, |
| 1923 | supp_rates, &a_len) == eHAL_STATUS_SUCCESS) |
| 1924 | { |
| 1925 | if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN) |
| 1926 | { |
| 1927 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 1928 | } |
| 1929 | for (i = 0; i < a_len; i++) |
| 1930 | { |
| 1931 | range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000; |
| 1932 | } |
| 1933 | range->num_bitrates = a_len; |
| 1934 | } |
| 1935 | else |
| 1936 | { |
| 1937 | return -EIO; |
| 1938 | } |
| 1939 | } |
| 1940 | else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B) |
| 1941 | { |
| 1942 | /*Get the supported rates for 11B band*/ |
Jeff Johnson | 1611e58 | 2013-04-03 10:43:16 -0700 | [diff] [blame] | 1943 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1944 | if (ccmCfgGetStr(hHal, |
| 1945 | WNI_CFG_SUPPORTED_RATES_11B, |
| 1946 | supp_rates, &b_len) == eHAL_STATUS_SUCCESS) |
| 1947 | { |
| 1948 | if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN) |
| 1949 | { |
| 1950 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 1951 | } |
| 1952 | for (i = 0; i < b_len; i++) |
| 1953 | { |
| 1954 | range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000; |
| 1955 | } |
| 1956 | range->num_bitrates = b_len; |
| 1957 | } |
| 1958 | else |
| 1959 | { |
| 1960 | return -EIO; |
| 1961 | } |
| 1962 | } |
| 1963 | } |
| 1964 | |
| 1965 | range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX; |
| 1966 | range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN; |
| 1967 | range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX; |
| 1968 | |
| 1969 | range->encoding_size[0] = 5; |
| 1970 | range->encoding_size[1] = 13; |
| 1971 | range->num_encoding_sizes = 2; |
| 1972 | range->max_encoding_tokens = MAX_WEP_KEYS; |
| 1973 | |
| 1974 | // we support through Wireless Extensions 22 |
| 1975 | range->we_version_compiled = WIRELESS_EXT; |
| 1976 | range->we_version_source = 22; |
| 1977 | |
| 1978 | /*Supported Channels and Frequencies*/ |
| 1979 | if (ccmCfgGetStr((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels, &num_channels) != eHAL_STATUS_SUCCESS) |
| 1980 | { |
| 1981 | return -EIO; |
| 1982 | } |
| 1983 | if (num_channels > IW_MAX_FREQUENCIES) |
| 1984 | { |
| 1985 | num_channels = IW_MAX_FREQUENCIES; |
| 1986 | } |
| 1987 | |
| 1988 | range->num_channels = num_channels; |
| 1989 | range->num_frequency = num_channels; |
| 1990 | |
| 1991 | for (index=0; index < num_channels; index++) |
| 1992 | { |
| 1993 | v_U32_t frq_indx = 0; |
| 1994 | |
| 1995 | range->freq[index].i = channels[index]; |
| 1996 | while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE) |
| 1997 | { |
| 1998 | if(channels[index] == freq_chan_map[frq_indx].chan) |
| 1999 | { |
| 2000 | range->freq[index].m = freq_chan_map[frq_indx].freq * 100000; |
| 2001 | range->freq[index].e = 1; |
| 2002 | break; |
| 2003 | } |
| 2004 | frq_indx++; |
| 2005 | } |
| 2006 | } |
| 2007 | |
| 2008 | /* Event capability (kernel + driver) */ |
| 2009 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
| 2010 | IW_EVENT_CAPA_MASK(SIOCGIWAP) | |
| 2011 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); |
| 2012 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
| 2013 | |
| 2014 | /*Encryption capability*/ |
| 2015 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
| 2016 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
| 2017 | |
| 2018 | /* Txpower capability */ |
| 2019 | range->txpower_capa = IW_TXPOW_MWATT; |
| 2020 | |
| 2021 | /*Scanning capability*/ |
| 2022 | #if WIRELESS_EXT >= 22 |
| 2023 | range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL; |
| 2024 | #endif |
| 2025 | |
| 2026 | EXIT(); |
| 2027 | return 0; |
| 2028 | } |
| 2029 | |
| 2030 | /* Callback function registered with PMC to know status of PMC request */ |
| 2031 | static void iw_power_callback_fn (void *pContext, eHalStatus status) |
| 2032 | { |
| 2033 | struct statsContext *pStatsContext; |
| 2034 | hdd_adapter_t *pAdapter; |
| 2035 | |
| 2036 | if (NULL == pContext) |
| 2037 | { |
| 2038 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2039 | "%s: Bad param, pContext [%p]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2040 | __func__, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2041 | return; |
| 2042 | } |
| 2043 | |
| 2044 | /* there is a race condition that exists between this callback function |
| 2045 | and the caller since the caller could time out either before or |
| 2046 | while this code is executing. we'll assume the timeout hasn't |
| 2047 | occurred, but we'll verify that right before we save our work */ |
| 2048 | |
| 2049 | pStatsContext = (struct statsContext *)pContext; |
| 2050 | pAdapter = pStatsContext->pAdapter; |
| 2051 | |
| 2052 | if ((NULL == pAdapter) || (POWER_CONTEXT_MAGIC != pStatsContext->magic)) |
| 2053 | { |
| 2054 | /* the caller presumably timed out so there is nothing we can do */ |
| 2055 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 2056 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2057 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2058 | |
| 2059 | if (ioctl_debug) |
| 2060 | { |
| 2061 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2062 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2063 | } |
| 2064 | return; |
| 2065 | } |
| 2066 | |
| 2067 | /* and notify the caller */ |
| 2068 | complete(&pStatsContext->completion); |
| 2069 | } |
| 2070 | |
| 2071 | /* Callback function for tx per hit */ |
| 2072 | void hdd_tx_per_hit_cb (void *pCallbackContext) |
| 2073 | { |
| 2074 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pCallbackContext; |
| 2075 | unsigned char tx_fail[16]; |
| 2076 | union iwreq_data wrqu; |
| 2077 | |
| 2078 | if (NULL == pAdapter) |
| 2079 | { |
| 2080 | hddLog(LOGE, "hdd_tx_per_hit_cb: pAdapter is NULL\n"); |
| 2081 | return; |
| 2082 | } |
| 2083 | memset(&wrqu, 0, sizeof(wrqu)); |
| 2084 | wrqu.data.length = strlcpy(tx_fail, "TX_FAIL", sizeof(tx_fail)); |
| 2085 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, tx_fail); |
| 2086 | } |
| 2087 | |
| 2088 | void hdd_GetClassA_statisticsCB(void *pStats, void *pContext) |
| 2089 | { |
| 2090 | struct statsContext *pStatsContext; |
| 2091 | tCsrGlobalClassAStatsInfo *pClassAStats; |
| 2092 | hdd_adapter_t *pAdapter; |
| 2093 | |
| 2094 | if (ioctl_debug) |
| 2095 | { |
| 2096 | pr_info("%s: pStats [%p] pContext [%p]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2097 | __func__, pStats, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2098 | } |
| 2099 | |
| 2100 | if ((NULL == pStats) || (NULL == pContext)) |
| 2101 | { |
| 2102 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2103 | "%s: Bad param, pStats [%p] pContext [%p]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2104 | __func__, pStats, pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2105 | return; |
| 2106 | } |
| 2107 | |
| 2108 | /* there is a race condition that exists between this callback function |
| 2109 | and the caller since the caller could time out either before or |
| 2110 | while this code is executing. we'll assume the timeout hasn't |
| 2111 | occurred, but we'll verify that right before we save our work */ |
| 2112 | |
| 2113 | pClassAStats = pStats; |
| 2114 | pStatsContext = pContext; |
| 2115 | pAdapter = pStatsContext->pAdapter; |
| 2116 | if ((NULL == pAdapter) || (STATS_CONTEXT_MAGIC != pStatsContext->magic)) |
| 2117 | { |
| 2118 | /* the caller presumably timed out so there is nothing we can do */ |
| 2119 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 2120 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2121 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2122 | if (ioctl_debug) |
| 2123 | { |
| 2124 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2125 | __func__, pAdapter, pStatsContext->magic); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2126 | } |
| 2127 | return; |
| 2128 | } |
| 2129 | |
| 2130 | /* the race is on. caller could have timed out immediately after |
| 2131 | we verified the magic, but if so, caller will wait a short time |
| 2132 | for us to copy over the stats. do so as a struct copy */ |
| 2133 | pAdapter->hdd_stats.ClassA_stat = *pClassAStats; |
| 2134 | |
| 2135 | /* and notify the caller */ |
| 2136 | complete(&pStatsContext->completion); |
| 2137 | } |
| 2138 | |
| 2139 | VOS_STATUS wlan_hdd_get_classAstats(hdd_adapter_t *pAdapter) |
| 2140 | { |
| 2141 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2142 | eHalStatus hstatus; |
| 2143 | long lrc; |
| 2144 | struct statsContext context; |
| 2145 | |
| 2146 | if (NULL == pAdapter) |
| 2147 | { |
| 2148 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__); |
| 2149 | return VOS_STATUS_E_FAULT; |
| 2150 | } |
| 2151 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 2152 | { |
| 2153 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 2154 | return VOS_STATUS_SUCCESS; |
| 2155 | } |
| 2156 | |
| 2157 | /* we are connected |
| 2158 | prepare our callback context */ |
| 2159 | init_completion(&context.completion); |
| 2160 | context.pAdapter = pAdapter; |
| 2161 | context.magic = STATS_CONTEXT_MAGIC; |
| 2162 | /* query only for Class A statistics (which include link speed) */ |
| 2163 | hstatus = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2164 | eCSR_HDD, |
| 2165 | SME_GLOBAL_CLASSA_STATS, |
| 2166 | hdd_GetClassA_statisticsCB, |
| 2167 | 0, // not periodic |
| 2168 | FALSE, //non-cached results |
| 2169 | pHddStaCtx->conn_info.staId[0], |
| 2170 | &context); |
| 2171 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 2172 | { |
| 2173 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2174 | "%s: Unable to retrieve Class A statistics ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2175 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2176 | /* we'll returned a cached value below */ |
| 2177 | } |
| 2178 | else |
| 2179 | { |
| 2180 | /* request was sent -- wait for the response */ |
| 2181 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 2182 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 2183 | /* either we have a response or we timed out |
| 2184 | either way, first invalidate our magic */ |
| 2185 | context.magic = 0; |
| 2186 | if (lrc <= 0) |
| 2187 | { |
| 2188 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2189 | "%s: SME %s while retrieving Class A statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2190 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2191 | /* there is a race condition such that the callback |
| 2192 | function could be executing at the same time we are. of |
| 2193 | primary concern is if the callback function had already |
| 2194 | verified the "magic" but hasn't yet set the completion |
| 2195 | variable. Since the completion variable is on our |
| 2196 | stack, we'll delay just a bit to make sure the data is |
| 2197 | still valid if that is the case */ |
| 2198 | msleep(50); |
| 2199 | } |
| 2200 | } |
| 2201 | return VOS_STATUS_SUCCESS; |
| 2202 | } |
| 2203 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2204 | static void hdd_get_station_statisticsCB(void *pStats, void *pContext) |
| 2205 | { |
| 2206 | struct statsContext *pStatsContext; |
| 2207 | tCsrSummaryStatsInfo *pSummaryStats; |
| 2208 | tCsrGlobalClassAStatsInfo *pClassAStats; |
| 2209 | hdd_adapter_t *pAdapter; |
| 2210 | |
| 2211 | if (ioctl_debug) |
| 2212 | { |
| 2213 | pr_info("%s: pStats [%p] pContext [%p]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2214 | __func__, pStats, pContext); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2215 | } |
| 2216 | |
| 2217 | if ((NULL == pStats) || (NULL == pContext)) |
| 2218 | { |
| 2219 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2220 | "%s: Bad param, pStats [%p] pContext [%p]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2221 | __func__, pStats, pContext); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2222 | return; |
| 2223 | } |
| 2224 | |
| 2225 | /* there is a race condition that exists between this callback function |
| 2226 | and the caller since the caller could time out either before or |
| 2227 | while this code is executing. we'll assume the timeout hasn't |
| 2228 | occurred, but we'll verify that right before we save our work */ |
| 2229 | |
| 2230 | pSummaryStats = (tCsrSummaryStatsInfo *)pStats; |
| 2231 | pClassAStats = (tCsrGlobalClassAStatsInfo *)( pSummaryStats + 1 ); |
| 2232 | pStatsContext = pContext; |
| 2233 | pAdapter = pStatsContext->pAdapter; |
| 2234 | if ((NULL == pAdapter) || (STATS_CONTEXT_MAGIC != pStatsContext->magic)) |
| 2235 | { |
| 2236 | /* the caller presumably timed out so there is nothing we can do */ |
| 2237 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 2238 | "%s: Invalid context, pAdapter [%p] magic [%08x]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2239 | __func__, pAdapter, pStatsContext->magic); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2240 | if (ioctl_debug) |
| 2241 | { |
| 2242 | pr_info("%s: Invalid context, pAdapter [%p] magic [%08x]\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2243 | __func__, pAdapter, pStatsContext->magic); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2244 | } |
| 2245 | return; |
| 2246 | } |
| 2247 | |
| 2248 | /* the race is on. caller could have timed out immediately after |
| 2249 | we verified the magic, but if so, caller will wait a short time |
| 2250 | for us to copy over the stats. do so as a struct copy */ |
| 2251 | pAdapter->hdd_stats.summary_stat = *pSummaryStats; |
| 2252 | pAdapter->hdd_stats.ClassA_stat = *pClassAStats; |
| 2253 | |
| 2254 | /* and notify the caller */ |
| 2255 | complete(&pStatsContext->completion); |
| 2256 | } |
| 2257 | |
| 2258 | VOS_STATUS wlan_hdd_get_station_stats(hdd_adapter_t *pAdapter) |
| 2259 | { |
| 2260 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2261 | eHalStatus hstatus; |
| 2262 | long lrc; |
| 2263 | struct statsContext context; |
| 2264 | |
| 2265 | if (NULL == pAdapter) |
| 2266 | { |
| 2267 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__); |
| 2268 | return VOS_STATUS_SUCCESS; |
| 2269 | } |
| 2270 | |
| 2271 | /* we are connected |
| 2272 | prepare our callback context */ |
| 2273 | init_completion(&context.completion); |
| 2274 | context.pAdapter = pAdapter; |
| 2275 | context.magic = STATS_CONTEXT_MAGIC; |
| 2276 | |
| 2277 | /* query only for Summary & Class A statistics */ |
| 2278 | hstatus = sme_GetStatistics(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2279 | eCSR_HDD, |
| 2280 | SME_SUMMARY_STATS | |
| 2281 | SME_GLOBAL_CLASSA_STATS, |
| 2282 | hdd_get_station_statisticsCB, |
| 2283 | 0, // not periodic |
| 2284 | FALSE, //non-cached results |
| 2285 | pHddStaCtx->conn_info.staId[0], |
| 2286 | &context); |
| 2287 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 2288 | { |
| 2289 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2290 | "%s: Unable to retrieve statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2291 | __func__); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2292 | /* we'll return with cached values */ |
| 2293 | } |
| 2294 | else |
| 2295 | { |
| 2296 | /* request was sent -- wait for the response */ |
| 2297 | lrc = wait_for_completion_interruptible_timeout(&context.completion, |
| 2298 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 2299 | /* either we have a response or we timed out |
| 2300 | either way, first invalidate our magic */ |
| 2301 | context.magic = 0; |
| 2302 | if (lrc <= 0) |
| 2303 | { |
| 2304 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2305 | "%s: SME %s while retrieving statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2306 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 2307 | /* there is a race condition such that the callback |
| 2308 | function could be executing at the same time we are. of |
| 2309 | primary concern is if the callback function had already |
| 2310 | verified the "magic" but hasn't yet set the completion |
| 2311 | variable. Since the completion variable is on our |
| 2312 | stack, we'll delay just a bit to make sure the data is |
| 2313 | still valid if that is the case */ |
| 2314 | msleep(50); |
| 2315 | } |
| 2316 | } |
| 2317 | return VOS_STATUS_SUCCESS; |
| 2318 | } |
| 2319 | |
| 2320 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2321 | /* |
| 2322 | * Support for the LINKSPEED private command |
| 2323 | * Per the WiFi framework the response must be of the form |
| 2324 | * "LinkSpeed xx" |
| 2325 | */ |
| 2326 | static int iw_get_linkspeed(struct net_device *dev, |
| 2327 | struct iw_request_info *info, |
| 2328 | union iwreq_data *wrqu, char *extra) |
| 2329 | { |
| 2330 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2331 | char *pLinkSpeed = (char*)extra; |
| 2332 | int len = sizeof(v_U16_t) + 1; |
| 2333 | v_U16_t link_speed; |
| 2334 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2335 | int rc; |
| 2336 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 2337 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 2338 | { |
| 2339 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2340 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 2341 | return -EBUSY; |
| 2342 | } |
| 2343 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2344 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 2345 | { |
| 2346 | /* we are not connected so we don't have a classAstats */ |
| 2347 | link_speed = 0; |
| 2348 | } |
| 2349 | else |
| 2350 | { |
| 2351 | wlan_hdd_get_classAstats(pAdapter); |
| 2352 | //The linkspeed returned by HAL is in units of 500kbps. |
| 2353 | //converting it to mbps |
| 2354 | link_speed = pAdapter->hdd_stats.ClassA_stat.tx_rate/2; |
| 2355 | } |
| 2356 | |
| 2357 | wrqu->data.length = len; |
| 2358 | // return the linkspeed in the format required by the WiFi Framework |
| 2359 | rc = snprintf(pLinkSpeed, len, "%u", link_speed); |
| 2360 | if ((rc < 0) || (rc >= len)) |
| 2361 | { |
| 2362 | // encoding or length error? |
| 2363 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2364 | "%s: Unable to encode link speed, got [%s]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2365 | __func__,pLinkSpeed); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2366 | return -EIO; |
| 2367 | } |
| 2368 | |
| 2369 | /* a value is being successfully returned */ |
| 2370 | return 0; |
| 2371 | } |
| 2372 | |
| 2373 | |
| 2374 | /* |
| 2375 | * Support for the RSSI & RSSI-APPROX private commands |
| 2376 | * Per the WiFi framework the response must be of the form |
| 2377 | * "<ssid> rssi <xx>" |
| 2378 | * unless we are not associated, in which case the response is |
| 2379 | * "OK" |
| 2380 | */ |
| 2381 | static int iw_get_rssi(struct net_device *dev, |
| 2382 | struct iw_request_info *info, |
| 2383 | union iwreq_data *wrqu, char *extra) |
| 2384 | { |
| 2385 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2386 | char *cmd = (char*)wrqu->data.pointer; |
| 2387 | int len = wrqu->data.length; |
| 2388 | v_S7_t s7Rssi = 0; |
| 2389 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2390 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
| 2391 | VOS_STATUS vosStatus; |
| 2392 | int rc; |
| 2393 | |
| 2394 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 2395 | (0 == ssidlen) || (ssidlen >= len)) |
| 2396 | { |
| 2397 | /* we are not connected or our SSID is too long |
| 2398 | so we cannot report an rssi */ |
| 2399 | rc = snprintf(cmd, len, "OK"); |
| 2400 | } |
| 2401 | else |
| 2402 | { |
| 2403 | /* we are connected with a valid SSID |
| 2404 | so we can write the SSID into the return buffer |
| 2405 | (note that it is not NUL-terminated) */ |
| 2406 | memcpy(cmd, pHddStaCtx->conn_info.SSID.SSID.ssId, ssidlen ); |
| 2407 | |
| 2408 | vosStatus = wlan_hdd_get_rssi(pAdapter, &s7Rssi); |
| 2409 | |
| 2410 | if (VOS_STATUS_SUCCESS == vosStatus) |
| 2411 | { |
| 2412 | /* append the rssi to the ssid in the format required by |
| 2413 | the WiFI Framework */ |
| 2414 | rc = snprintf(&cmd[ssidlen], len - ssidlen, " rssi %d", s7Rssi); |
| 2415 | } |
| 2416 | else |
| 2417 | { |
| 2418 | rc = -1; |
| 2419 | } |
| 2420 | } |
| 2421 | |
| 2422 | /* verify that we wrote a valid response */ |
| 2423 | if ((rc < 0) || (rc >= len)) |
| 2424 | { |
| 2425 | // encoding or length error? |
| 2426 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2427 | "%s: Unable to encode RSSI, got [%s]", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2428 | __func__, cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2429 | return -EIO; |
| 2430 | } |
| 2431 | |
| 2432 | /* a value is being successfully returned */ |
| 2433 | return 0; |
| 2434 | } |
| 2435 | |
| 2436 | /* |
| 2437 | * Support for SoftAP channel range private command |
| 2438 | */ |
| 2439 | static int iw_softap_set_channel_range( struct net_device *dev, |
| 2440 | int startChannel, |
| 2441 | int endChannel, |
| 2442 | int band) |
| 2443 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2444 | VOS_STATUS status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2445 | int ret = 0; |
| 2446 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 2447 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 2448 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 2449 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2450 | |
| 2451 | status = WLANSAP_SetChannelRange(hHal, startChannel, endChannel, band); |
| 2452 | if (VOS_STATUS_SUCCESS != status) |
| 2453 | { |
| 2454 | ret = -EINVAL; |
| 2455 | } |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 2456 | pHddCtx->is_dynamic_channel_range_set = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2457 | return ret; |
| 2458 | } |
| 2459 | |
| 2460 | VOS_STATUS wlan_hdd_enter_bmps(hdd_adapter_t *pAdapter, int mode) |
| 2461 | { |
| 2462 | struct statsContext context; |
| 2463 | eHalStatus status; |
| 2464 | hdd_context_t *pHddCtx; |
| 2465 | |
| 2466 | if (NULL == pAdapter) |
| 2467 | { |
| 2468 | hddLog(VOS_TRACE_LEVEL_FATAL, "Adapter NULL"); |
| 2469 | return VOS_STATUS_E_FAULT; |
| 2470 | } |
| 2471 | |
| 2472 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "power mode=%d", mode); |
| 2473 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2474 | init_completion(&context.completion); |
| 2475 | |
| 2476 | context.pAdapter = pAdapter; |
| 2477 | context.magic = POWER_CONTEXT_MAGIC; |
| 2478 | |
| 2479 | if (DRIVER_POWER_MODE_ACTIVE == mode) |
| 2480 | { |
| 2481 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering " |
| 2482 | "Full Power", __func__); |
| 2483 | status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2484 | iw_power_callback_fn, &context, |
| 2485 | eSME_FULL_PWR_NEEDED_BY_HDD); |
| 2486 | // Enter Full power command received from GUI this means we are disconnected |
| 2487 | // Set PMC remainInPowerActiveTillDHCP flag to disable auto BMPS entry by PMC |
| 2488 | sme_SetDHCPTillPowerActiveFlag(pHddCtx->hHal, TRUE); |
| 2489 | if (eHAL_STATUS_PMC_PENDING == status) |
| 2490 | { |
| 2491 | int lrc = wait_for_completion_interruptible_timeout( |
| 2492 | &context.completion, |
| 2493 | msecs_to_jiffies(WLAN_WAIT_TIME_POWER)); |
| 2494 | context.magic = 0; |
| 2495 | if (lrc <= 0) |
| 2496 | { |
| 2497 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while requesting fullpower ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2498 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2499 | /* there is a race condition such that the callback |
| 2500 | function could be executing at the same time we are. of |
| 2501 | primary concern is if the callback function had already |
| 2502 | verified the "magic" but hasn't yet set the completion |
| 2503 | variable. Since the completion variable is on our |
| 2504 | stack, we'll delay just a bit to make sure the data is |
| 2505 | still valid if that is the case */ |
| 2506 | msleep(50); |
| 2507 | /* we'll now returned a cached value below */ |
| 2508 | } |
| 2509 | } |
| 2510 | } |
| 2511 | else if (DRIVER_POWER_MODE_AUTO == mode) |
| 2512 | { |
| 2513 | if (pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 2514 | { |
| 2515 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering Bmps ", |
| 2516 | __func__); |
| 2517 | // Enter BMPS command received from GUI this means DHCP is completed |
| 2518 | // Clear PMC remainInPowerActiveTillDHCP flag to enable auto BMPS entry |
| 2519 | sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2520 | FALSE); |
| 2521 | status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2522 | iw_power_callback_fn, &context); |
| 2523 | if (eHAL_STATUS_PMC_PENDING == status) |
| 2524 | { |
| 2525 | int lrc = wait_for_completion_interruptible_timeout( |
| 2526 | &context.completion, |
| 2527 | msecs_to_jiffies(WLAN_WAIT_TIME_POWER)); |
| 2528 | context.magic = 0; |
| 2529 | if (lrc <= 0) |
| 2530 | { |
| 2531 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while requesting BMPS ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2532 | __func__, (0 == lrc) ? "timeout" : "interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2533 | /* there is a race condition such that the callback |
| 2534 | function could be executing at the same time we are. of |
| 2535 | primary concern is if the callback function had already |
| 2536 | verified the "magic" but hasn't yet set the completion |
| 2537 | variable. Since the completion variable is on our |
| 2538 | stack, we'll delay just a bit to make sure the data is |
| 2539 | still valid if that is the case */ |
| 2540 | msleep(50); |
| 2541 | /* we'll now returned a cached value below */ |
| 2542 | } |
| 2543 | } |
| 2544 | } |
| 2545 | else |
| 2546 | { |
| 2547 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "BMPS is not " |
| 2548 | "enabled in the cfg"); |
| 2549 | } |
| 2550 | } |
| 2551 | return VOS_STATUS_SUCCESS; |
| 2552 | } |
| 2553 | |
| 2554 | VOS_STATUS wlan_hdd_exit_lowpower(hdd_context_t *pHddCtx, |
| 2555 | hdd_adapter_t *pAdapter) |
| 2556 | { |
| 2557 | VOS_STATUS vos_Status; |
| 2558 | |
| 2559 | if ((NULL == pAdapter) || (NULL == pHddCtx)) |
| 2560 | { |
| 2561 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid pointer"); |
| 2562 | return VOS_STATUS_E_FAULT; |
| 2563 | } |
| 2564 | |
| 2565 | /**Exit from Deep sleep or standby if we get the driver |
| 2566 | START cmd from android GUI |
| 2567 | */ |
| 2568 | if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop) |
| 2569 | { |
| 2570 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit " |
| 2571 | "from Stand by",__func__); |
| 2572 | vos_Status = hdd_exit_standby(pHddCtx); |
| 2573 | } |
| 2574 | else if (eHDD_SUSPEND_DEEP_SLEEP == pHddCtx->hdd_ps_state) |
| 2575 | { |
| 2576 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit " |
| 2577 | "from deep sleep",__func__); |
| 2578 | vos_Status = hdd_exit_deep_sleep(pHddCtx, pAdapter); |
| 2579 | } |
| 2580 | else |
| 2581 | { |
| 2582 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Not in standby or deep sleep. " |
| 2583 | "Ignore start cmd %d", __func__, pHddCtx->hdd_ps_state); |
| 2584 | vos_Status = VOS_STATUS_SUCCESS; |
| 2585 | } |
| 2586 | |
| 2587 | return vos_Status; |
| 2588 | } |
| 2589 | |
| 2590 | VOS_STATUS wlan_hdd_enter_lowpower(hdd_context_t *pHddCtx) |
| 2591 | { |
| 2592 | VOS_STATUS vos_Status = VOS_STATUS_E_FAILURE; |
| 2593 | |
| 2594 | if (NULL == pHddCtx) |
| 2595 | { |
| 2596 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "HDD context NULL"); |
| 2597 | return VOS_STATUS_E_FAULT; |
| 2598 | } |
| 2599 | |
| 2600 | if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop) |
| 2601 | { |
| 2602 | //Execute standby procedure. |
| 2603 | //Executing standby procedure will cause the STA to |
| 2604 | //disassociate first and then the chip will be put into standby. |
| 2605 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering Stand by mode"); |
| 2606 | vos_Status = hdd_enter_standby(pHddCtx); |
| 2607 | } |
| 2608 | else if (WLAN_MAP_DRIVER_STOP_TO_DEEP_SLEEP == |
| 2609 | pHddCtx->cfg_ini->nEnableDriverStop) |
| 2610 | { |
| 2611 | //Execute deep sleep procedure |
| 2612 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering " |
| 2613 | "deep sleep mode\n"); |
| 2614 | //Deep sleep not supported |
| 2615 | vos_Status = hdd_enter_standby(pHddCtx); |
| 2616 | } |
| 2617 | else |
| 2618 | { |
| 2619 | hddLog(VOS_TRACE_LEVEL_INFO_LOW, "%s: Driver stop is not enabled %d", |
| 2620 | __func__, pHddCtx->cfg_ini->nEnableDriverStop); |
| 2621 | vos_Status = VOS_STATUS_SUCCESS; |
| 2622 | } |
| 2623 | |
| 2624 | return vos_Status; |
| 2625 | } |
| 2626 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2627 | |
| 2628 | void* wlan_hdd_change_country_code_callback(void *pAdapter) |
| 2629 | { |
| 2630 | |
| 2631 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 2632 | |
| 2633 | complete(&call_back_pAdapter->change_country_code); |
| 2634 | |
| 2635 | return NULL; |
| 2636 | } |
| 2637 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2638 | static int iw_set_priv(struct net_device *dev, |
| 2639 | struct iw_request_info *info, |
| 2640 | union iwreq_data *wrqu, char *extra) |
| 2641 | { |
| 2642 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2643 | char *cmd = (char*)wrqu->data.pointer; |
| 2644 | int cmd_len = wrqu->data.length; |
| 2645 | int ret = 0; |
| 2646 | int status = 0; |
| 2647 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2648 | |
| 2649 | ENTER(); |
| 2650 | |
| 2651 | if (ioctl_debug) |
| 2652 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2653 | pr_info("%s: req [%s] len [%d]\n", __func__, cmd, cmd_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2654 | } |
| 2655 | |
Madan Mohan Koyyalamudi | f9bdd4e | 2012-10-30 18:05:03 -0700 | [diff] [blame] | 2656 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 2657 | "%s: ***Received %s cmd from Wi-Fi GUI***", __func__, cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2658 | |
| 2659 | if (pHddCtx->isLogpInProgress) { |
| 2660 | if (ioctl_debug) |
| 2661 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2662 | pr_info("%s: RESTART in progress\n", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2663 | } |
| 2664 | |
| 2665 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2666 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 2667 | return status; |
| 2668 | } |
| 2669 | |
| 2670 | if(strncmp(cmd, "CSCAN",5) == 0 ) |
| 2671 | { |
| 2672 | status = iw_set_cscan(dev, info, wrqu, extra); |
| 2673 | } |
| 2674 | else if( strcasecmp(cmd, "start") == 0 ) { |
| 2675 | |
| 2676 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Start command\n"); |
| 2677 | /*Exit from Deep sleep or standby if we get the driver START cmd from android GUI*/ |
| 2678 | status = wlan_hdd_exit_lowpower(pHddCtx, pAdapter); |
| 2679 | |
| 2680 | if(status == VOS_STATUS_SUCCESS) |
| 2681 | { |
| 2682 | union iwreq_data wrqu; |
| 2683 | char buf[10]; |
| 2684 | |
| 2685 | memset(&wrqu, 0, sizeof(wrqu)); |
| 2686 | wrqu.data.length = strlcpy(buf, "START", sizeof(buf)); |
| 2687 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 2688 | } |
| 2689 | else |
| 2690 | { |
| 2691 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: START CMD Status %d", __func__, status); |
| 2692 | } |
| 2693 | goto done; |
| 2694 | } |
| 2695 | else if( strcasecmp(cmd, "stop") == 0 ) |
| 2696 | { |
| 2697 | union iwreq_data wrqu; |
| 2698 | char buf[10]; |
| 2699 | |
| 2700 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Stop command\n"); |
| 2701 | |
| 2702 | wlan_hdd_enter_lowpower(pHddCtx); |
| 2703 | memset(&wrqu, 0, sizeof(wrqu)); |
| 2704 | wrqu.data.length = strlcpy(buf, "STOP", sizeof(buf)); |
| 2705 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 2706 | status = VOS_STATUS_SUCCESS; |
| 2707 | goto done; |
| 2708 | } |
| 2709 | else if (strcasecmp(cmd, "macaddr") == 0) |
| 2710 | { |
| 2711 | ret = snprintf(cmd, cmd_len, "Macaddr = " MAC_ADDRESS_STR, |
| 2712 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes)); |
| 2713 | } |
| 2714 | else if (strcasecmp(cmd, "scan-active") == 0) |
| 2715 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2716 | pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2717 | ret = snprintf(cmd, cmd_len, "OK"); |
| 2718 | } |
| 2719 | else if (strcasecmp(cmd, "scan-passive") == 0) |
| 2720 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2721 | pHddCtx->scan_info.scan_mode = eSIR_PASSIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2722 | ret = snprintf(cmd, cmd_len, "OK"); |
| 2723 | } |
| 2724 | else if( strcasecmp(cmd, "scan-mode") == 0 ) |
| 2725 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 2726 | ret = snprintf(cmd, cmd_len, "ScanMode = %u", pHddCtx->scan_info.scan_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2727 | } |
| 2728 | else if( strcasecmp(cmd, "linkspeed") == 0 ) |
| 2729 | { |
| 2730 | status = iw_get_linkspeed(dev, info, wrqu, extra); |
| 2731 | } |
| 2732 | else if( strncasecmp(cmd, "COUNTRY", 7) == 0 ) { |
| 2733 | char *country_code; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2734 | long lrc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2735 | |
| 2736 | country_code = cmd + 8; |
| 2737 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2738 | init_completion(&pAdapter->change_country_code); |
| 2739 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2740 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2741 | (void *)(tSmeChangeCountryCallback)wlan_hdd_change_country_code_callback, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2742 | country_code, |
| 2743 | pAdapter, |
| 2744 | pHddCtx->pvosContext); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2745 | |
| 2746 | /* Wait for completion */ |
| 2747 | lrc = wait_for_completion_interruptible_timeout(&pAdapter->change_country_code, |
| 2748 | msecs_to_jiffies(WLAN_WAIT_TIME_STATS)); |
| 2749 | |
| 2750 | if (lrc <= 0) |
| 2751 | { |
| 2752 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while setting country code ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2753 | __func__, "Timed out"); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2754 | } |
| 2755 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2756 | if( 0 != status ) |
| 2757 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2758 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2759 | "%s: SME Change Country code fail \n",__func__); |
| 2760 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2761 | } |
| 2762 | } |
| 2763 | else if( strncasecmp(cmd, "rssi", 4) == 0 ) |
| 2764 | { |
| 2765 | status = iw_get_rssi(dev, info, wrqu, extra); |
| 2766 | } |
| 2767 | else if( strncasecmp(cmd, "powermode", 9) == 0 ) { |
| 2768 | int mode; |
| 2769 | char *ptr = (char*)(cmd + 9); |
| 2770 | |
| 2771 | sscanf(ptr,"%d",&mode); |
| 2772 | wlan_hdd_enter_bmps(pAdapter, mode); |
| 2773 | /*TODO:Set the power mode*/ |
| 2774 | } |
| 2775 | else if (strncasecmp(cmd, "getpower", 8) == 0 ) { |
| 2776 | v_U32_t pmc_state; |
| 2777 | v_U16_t value; |
| 2778 | |
| 2779 | pmc_state = pmcGetPmcState(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
| 2780 | if(pmc_state == BMPS) { |
| 2781 | value = DRIVER_POWER_MODE_AUTO; |
| 2782 | } |
| 2783 | else { |
| 2784 | value = DRIVER_POWER_MODE_ACTIVE; |
| 2785 | } |
| 2786 | ret = snprintf(cmd, cmd_len, "powermode = %u", value); |
| 2787 | } |
| 2788 | else if( strncasecmp(cmd, "btcoexmode", 10) == 0 ) { |
| 2789 | hddLog( VOS_TRACE_LEVEL_INFO, "btcoexmode\n"); |
| 2790 | /*TODO: set the btcoexmode*/ |
| 2791 | } |
| 2792 | else if( strcasecmp(cmd, "btcoexstat") == 0 ) { |
| 2793 | |
| 2794 | hddLog(VOS_TRACE_LEVEL_INFO, "BtCoex Status\n"); |
| 2795 | /*TODO: Return the btcoex status*/ |
| 2796 | } |
| 2797 | else if( strcasecmp(cmd, "rxfilter-start") == 0 ) { |
| 2798 | |
| 2799 | hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Start command\n"); |
| 2800 | |
| 2801 | /*TODO: Enable Rx data Filter*/ |
| 2802 | } |
| 2803 | else if( strcasecmp(cmd, "rxfilter-stop") == 0 ) { |
| 2804 | |
| 2805 | hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Stop command\n"); |
| 2806 | |
| 2807 | /*TODO: Disable Rx data Filter*/ |
| 2808 | } |
| 2809 | else if( strcasecmp(cmd, "rxfilter-statistics") == 0 ) { |
| 2810 | |
| 2811 | hddLog( VOS_TRACE_LEVEL_INFO, "Rx Data Filter Statistics command\n"); |
| 2812 | /*TODO: rxfilter-statistics*/ |
| 2813 | } |
| 2814 | else if( strncasecmp(cmd, "rxfilter-add", 12) == 0 ) { |
| 2815 | |
| 2816 | hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-add\n"); |
| 2817 | /*TODO: rxfilter-add*/ |
| 2818 | } |
| 2819 | else if( strncasecmp(cmd, "rxfilter-remove",15) == 0 ) { |
| 2820 | |
| 2821 | hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-remove\n"); |
| 2822 | /*TODO: rxfilter-remove*/ |
| 2823 | } |
| 2824 | #ifdef FEATURE_WLAN_SCAN_PNO |
Madan Mohan Koyyalamudi | 03978e1 | 2012-10-30 17:52:55 -0700 | [diff] [blame] | 2825 | else if( strncasecmp(cmd, "pnosetup", 8) == 0 ) { |
| 2826 | hddLog( VOS_TRACE_LEVEL_INFO, "pnosetup"); |
| 2827 | /*TODO: support pnosetup*/ |
| 2828 | } |
| 2829 | else if( strncasecmp(cmd, "pnoforce", 8) == 0 ) { |
| 2830 | hddLog( VOS_TRACE_LEVEL_INFO, "pnoforce"); |
| 2831 | /*TODO: support pnoforce*/ |
| 2832 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2833 | else if( strncasecmp(cmd, "pno",3) == 0 ) { |
| 2834 | |
| 2835 | hddLog( VOS_TRACE_LEVEL_INFO, "pno\n"); |
| 2836 | status = iw_set_pno(dev, info, wrqu, extra, 3); |
| 2837 | return status; |
| 2838 | } |
| 2839 | else if( strncasecmp(cmd, "rssifilter",10) == 0 ) { |
| 2840 | |
| 2841 | hddLog( VOS_TRACE_LEVEL_INFO, "rssifilter\n"); |
| 2842 | status = iw_set_rssi_filter(dev, info, wrqu, extra, 10); |
| 2843 | return status; |
| 2844 | } |
| 2845 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 2846 | else if( strncasecmp(cmd, "powerparams",11) == 0 ) { |
| 2847 | hddLog( VOS_TRACE_LEVEL_INFO, "powerparams\n"); |
| 2848 | status = iw_set_power_params(dev, info, wrqu, extra, 11); |
| 2849 | return status; |
| 2850 | } |
| 2851 | else if( 0 == strncasecmp(cmd, "CONFIG-TX-TRACKING", 18) ) { |
| 2852 | tSirTxPerTrackingParam tTxPerTrackingParam; |
| 2853 | char *ptr = (char*)(cmd + 18); |
| 2854 | sscanf(ptr,"%hhu %hhu %hhu %lu",&(tTxPerTrackingParam.ucTxPerTrackingEnable), &(tTxPerTrackingParam.ucTxPerTrackingPeriod), |
| 2855 | &(tTxPerTrackingParam.ucTxPerTrackingRatio), &(tTxPerTrackingParam.uTxPerTrackingWatermark)); |
| 2856 | |
| 2857 | // parameters checking |
| 2858 | // period has to be larger than 0 |
| 2859 | if (0 == tTxPerTrackingParam.ucTxPerTrackingPeriod) |
| 2860 | { |
| 2861 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Period input is not correct"); |
| 2862 | return VOS_STATUS_E_FAILURE; |
| 2863 | } |
| 2864 | |
| 2865 | // use default value 5 is the input is not reasonable. in unit of 10% |
| 2866 | if ((tTxPerTrackingParam.ucTxPerTrackingRatio > TX_PER_TRACKING_MAX_RATIO) || (0 == tTxPerTrackingParam.ucTxPerTrackingRatio)) |
| 2867 | { |
| 2868 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Ratio input is not good. use default 5"); |
| 2869 | tTxPerTrackingParam.ucTxPerTrackingRatio = TX_PER_TRACKING_DEFAULT_RATIO; |
| 2870 | } |
| 2871 | |
| 2872 | // default is 5 |
| 2873 | if (0 == tTxPerTrackingParam.uTxPerTrackingWatermark) |
| 2874 | { |
| 2875 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Tx Packet number input is not good. use default 5"); |
| 2876 | tTxPerTrackingParam.uTxPerTrackingWatermark = TX_PER_TRACKING_DEFAULT_WATERMARK; |
| 2877 | } |
| 2878 | |
| 2879 | status = sme_SetTxPerTracking(pHddCtx->hHal, hdd_tx_per_hit_cb, (void*)pAdapter, &tTxPerTrackingParam); |
| 2880 | if(status != eHAL_STATUS_SUCCESS){ |
| 2881 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Set Tx PER Tracking Failed!"); |
| 2882 | } |
| 2883 | } |
| 2884 | else { |
Madan Mohan Koyyalamudi | f9bdd4e | 2012-10-30 18:05:03 -0700 | [diff] [blame] | 2885 | hddLog( VOS_TRACE_LEVEL_WARN, "%s: Unsupported GUI command %s", |
| 2886 | __func__, cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2887 | } |
| 2888 | done: |
| 2889 | /* many of the commands write information back into the command |
| 2890 | string using snprintf(). check the return value here in one |
| 2891 | place */ |
| 2892 | if ((ret < 0) || (ret >= cmd_len)) |
| 2893 | { |
| 2894 | /* there was an encoding error or overflow */ |
| 2895 | status = -EIO; |
| 2896 | } |
| 2897 | |
| 2898 | if (ioctl_debug) |
| 2899 | { |
| 2900 | pr_info("%s: rsp [%s] len [%d] status %d\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2901 | __func__, cmd, wrqu->data.length, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2902 | } |
| 2903 | return status; |
| 2904 | |
| 2905 | } |
| 2906 | |
| 2907 | static int iw_set_nick(struct net_device *dev, |
| 2908 | struct iw_request_info *info, |
| 2909 | union iwreq_data *wrqu, char *extra) |
| 2910 | { |
| 2911 | ENTER(); |
| 2912 | return 0; |
| 2913 | } |
| 2914 | |
| 2915 | static int iw_get_nick(struct net_device *dev, |
| 2916 | struct iw_request_info *info, |
| 2917 | union iwreq_data *wrqu, char *extra) |
| 2918 | { |
| 2919 | ENTER(); |
| 2920 | return 0; |
| 2921 | } |
| 2922 | |
| 2923 | static struct iw_statistics *get_wireless_stats(struct net_device *dev) |
| 2924 | { |
| 2925 | ENTER(); |
| 2926 | return NULL; |
| 2927 | } |
| 2928 | |
| 2929 | static int iw_set_encode(struct net_device *dev,struct iw_request_info *info, |
| 2930 | union iwreq_data *wrqu,char *extra) |
| 2931 | |
| 2932 | { |
| 2933 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2934 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2935 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2936 | struct iw_point *encoderq = &(wrqu->encoding); |
| 2937 | v_U32_t keyId; |
| 2938 | v_U8_t key_length; |
| 2939 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 2940 | v_BOOL_t fKeyPresent = 0; |
| 2941 | int i; |
| 2942 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2943 | |
| 2944 | |
| 2945 | ENTER(); |
| 2946 | |
| 2947 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 2948 | { |
| 2949 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 2950 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 2951 | return 0; |
| 2952 | } |
| 2953 | |
| 2954 | |
| 2955 | keyId = encoderq->flags & IW_ENCODE_INDEX; |
| 2956 | |
| 2957 | if(keyId) |
| 2958 | { |
| 2959 | if(keyId > MAX_WEP_KEYS) |
| 2960 | { |
| 2961 | return -EINVAL; |
| 2962 | } |
| 2963 | |
| 2964 | fKeyPresent = 1; |
| 2965 | keyId--; |
| 2966 | } |
| 2967 | else |
| 2968 | { |
| 2969 | fKeyPresent = 0; |
| 2970 | } |
| 2971 | |
| 2972 | |
| 2973 | if(wrqu->data.flags & IW_ENCODE_DISABLED) |
| 2974 | { |
| 2975 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****iwconfig wlan0 key off*****\n"); |
| 2976 | if(!fKeyPresent) { |
| 2977 | |
| 2978 | for(i=0;i < CSR_MAX_NUM_KEY; i++) { |
| 2979 | |
| 2980 | if(pWextState->roamProfile.Keys.KeyMaterial[i]) |
| 2981 | pWextState->roamProfile.Keys.KeyLength[i] = 0; |
| 2982 | } |
| 2983 | } |
| 2984 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 2985 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 2986 | pWextState->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 2987 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 2988 | |
| 2989 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 2990 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 2991 | |
| 2992 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 2993 | { |
| 2994 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 2995 | 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] | 2996 | if(eHAL_STATUS_SUCCESS == status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2997 | wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var, |
| 2998 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 2999 | } |
| 3000 | |
| 3001 | return status; |
| 3002 | |
| 3003 | } |
| 3004 | |
| 3005 | if (wrqu->data.flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED)) |
| 3006 | { |
| 3007 | hddLog(VOS_TRACE_LEVEL_INFO, "iwconfig wlan0 key on"); |
| 3008 | |
| 3009 | pHddStaCtx->conn_info.authType = (encoderq->flags & IW_ENCODE_RESTRICTED) ? eCSR_AUTH_TYPE_SHARED_KEY : eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 3010 | |
| 3011 | } |
| 3012 | |
| 3013 | |
| 3014 | if(wrqu->data.length > 0) |
| 3015 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3016 | 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] | 3017 | |
| 3018 | key_length = wrqu->data.length; |
| 3019 | |
| 3020 | /* IW_ENCODING_TOKEN_MAX is the value that is set for wrqu->data.length by iwconfig.c when 'iwconfig wlan0 key on' is issued.*/ |
| 3021 | |
| 3022 | if(5 == key_length) |
| 3023 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3024 | 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] | 3025 | |
| 3026 | if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3027 | { |
| 3028 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
| 3029 | } |
| 3030 | else |
| 3031 | { |
| 3032 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 3033 | } |
| 3034 | } |
| 3035 | else if(13 == key_length) |
| 3036 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3037 | 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] | 3038 | |
| 3039 | if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 3040 | { |
| 3041 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 3042 | } |
| 3043 | else |
| 3044 | { |
| 3045 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 3046 | } |
| 3047 | } |
| 3048 | else |
| 3049 | { |
| 3050 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Invalid WEP key length :%d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3051 | __func__, key_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3052 | return -EINVAL; |
| 3053 | } |
| 3054 | |
| 3055 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 3056 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 3057 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 3058 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
| 3059 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 3060 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 3061 | |
| 3062 | if((eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) && |
| 3063 | ((eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) || |
| 3064 | (eCSR_AUTH_TYPE_SHARED_KEY == pHddStaCtx->conn_info.authType))) |
| 3065 | { |
| 3066 | |
| 3067 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[keyId][0],extra,key_length); |
| 3068 | |
| 3069 | pWextState->roamProfile.Keys.KeyLength[keyId] = (v_U8_t)key_length; |
| 3070 | pWextState->roamProfile.Keys.defaultIndex = (v_U8_t)keyId; |
| 3071 | |
| 3072 | return status; |
| 3073 | } |
| 3074 | } |
| 3075 | |
| 3076 | return 0; |
| 3077 | } |
| 3078 | |
| 3079 | static int iw_get_encodeext(struct net_device *dev, |
| 3080 | struct iw_request_info *info, |
| 3081 | struct iw_point *dwrq, |
| 3082 | char *extra) |
| 3083 | { |
| 3084 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3085 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3086 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 3087 | int keyId; |
| 3088 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 3089 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
| 3090 | int i; |
| 3091 | |
| 3092 | ENTER(); |
| 3093 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3094 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3095 | { |
| 3096 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3097 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3098 | return -EBUSY; |
| 3099 | } |
| 3100 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3101 | keyId = pRoamProfile->Keys.defaultIndex; |
| 3102 | |
| 3103 | if(keyId < 0 || keyId >= MAX_WEP_KEYS) |
| 3104 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3105 | hddLog(LOG1,"%s: Invalid keyId : %d\n",__func__,keyId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3106 | return -EINVAL; |
| 3107 | } |
| 3108 | |
| 3109 | if(pRoamProfile->Keys.KeyLength[keyId] > 0) |
| 3110 | { |
| 3111 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 3112 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
| 3113 | palCopyMemory(dev,extra,&(pRoamProfile->Keys.KeyMaterial[keyId][0]),pRoamProfile->Keys.KeyLength[keyId]); |
| 3114 | } |
| 3115 | else |
| 3116 | { |
| 3117 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 3118 | } |
| 3119 | |
| 3120 | for(i=0; i < MAX_WEP_KEYS; i++) |
| 3121 | { |
| 3122 | if(pRoamProfile->Keys.KeyMaterial[i] == NULL) |
| 3123 | { |
| 3124 | continue; |
| 3125 | } |
| 3126 | else |
| 3127 | { |
| 3128 | break; |
| 3129 | } |
| 3130 | } |
| 3131 | |
| 3132 | if(MAX_WEP_KEYS == i) |
| 3133 | { |
| 3134 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 3135 | } |
| 3136 | else |
| 3137 | { |
| 3138 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 3139 | } |
| 3140 | |
| 3141 | encryptionType = pRoamProfile->EncryptionType.encryptionType[0]; |
| 3142 | |
| 3143 | if(eCSR_ENCRYPT_TYPE_NONE == encryptionType) |
| 3144 | { |
| 3145 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 3146 | } |
| 3147 | |
| 3148 | authType = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType; |
| 3149 | |
| 3150 | if(IW_AUTH_ALG_OPEN_SYSTEM == authType) |
| 3151 | { |
| 3152 | dwrq->flags |= IW_ENCODE_OPEN; |
| 3153 | } |
| 3154 | else |
| 3155 | { |
| 3156 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 3157 | } |
| 3158 | EXIT(); |
| 3159 | return 0; |
| 3160 | |
| 3161 | } |
| 3162 | |
| 3163 | static int iw_set_encodeext(struct net_device *dev, |
| 3164 | struct iw_request_info *info, |
| 3165 | union iwreq_data *wrqu, char *extra) |
| 3166 | { |
| 3167 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3168 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3169 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3170 | eHalStatus halStatus= eHAL_STATUS_SUCCESS; |
| 3171 | |
| 3172 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 3173 | v_U32_t status = 0; |
| 3174 | |
| 3175 | struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; |
| 3176 | |
| 3177 | v_U8_t groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3178 | |
| 3179 | int key_index; |
| 3180 | struct iw_point *encoding = &wrqu->encoding; |
| 3181 | tCsrRoamSetKey setKey; |
| 3182 | v_U32_t roamId= 0xFF; |
| 3183 | VOS_STATUS vos_status; |
| 3184 | |
| 3185 | ENTER(); |
| 3186 | |
| 3187 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3188 | { |
| 3189 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3190 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 3191 | return 0; |
| 3192 | } |
| 3193 | |
| 3194 | key_index = encoding->flags & IW_ENCODE_INDEX; |
| 3195 | |
| 3196 | if(key_index > 0) { |
| 3197 | |
| 3198 | /*Convert from 1-based to 0-based keying*/ |
| 3199 | key_index--; |
| 3200 | } |
| 3201 | if(!ext->key_len) { |
| 3202 | |
| 3203 | /*Set the encrytion type to NONE*/ |
| 3204 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 3205 | return status; |
| 3206 | } |
| 3207 | |
| 3208 | if(eConnectionState_NotConnected == pHddStaCtx->conn_info.connState && |
| 3209 | (IW_ENCODE_ALG_WEP == ext->alg)) |
| 3210 | { |
| 3211 | if(IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) { |
| 3212 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3213 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,("Invalid Configuration:%s \n"),__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3214 | return -EINVAL; |
| 3215 | } |
| 3216 | else { |
| 3217 | /*Static wep, update the roam profile with the keys */ |
| 3218 | if(ext->key && (ext->key_len <= eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) && |
| 3219 | key_index < CSR_MAX_NUM_KEY) { |
| 3220 | vos_mem_copy(&pRoamProfile->Keys.KeyMaterial[key_index][0],ext->key,ext->key_len); |
| 3221 | pRoamProfile->Keys.KeyLength[key_index] = (v_U8_t)ext->key_len; |
| 3222 | |
| 3223 | if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) |
| 3224 | pRoamProfile->Keys.defaultIndex = (v_U8_t)key_index; |
| 3225 | |
| 3226 | } |
| 3227 | } |
| 3228 | return status; |
| 3229 | } |
| 3230 | |
| 3231 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 3232 | |
| 3233 | setKey.keyId = key_index; |
| 3234 | setKey.keyLength = ext->key_len; |
| 3235 | |
| 3236 | if(ext->key_len <= CSR_MAX_KEY_LEN) { |
| 3237 | vos_mem_copy(&setKey.Key[0],ext->key,ext->key_len); |
| 3238 | } |
| 3239 | |
| 3240 | if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
| 3241 | /*Key direction for group is RX only*/ |
| 3242 | setKey.keyDirection = eSIR_RX_ONLY; |
| 3243 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 3244 | } |
| 3245 | else { |
| 3246 | |
| 3247 | setKey.keyDirection = eSIR_TX_RX; |
| 3248 | vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN); |
| 3249 | } |
| 3250 | |
| 3251 | /*For supplicant pae role is zero*/ |
| 3252 | setKey.paeRole = 0; |
| 3253 | |
| 3254 | switch(ext->alg) |
| 3255 | { |
| 3256 | case IW_ENCODE_ALG_NONE: |
| 3257 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 3258 | break; |
| 3259 | |
| 3260 | case IW_ENCODE_ALG_WEP: |
| 3261 | setKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104; |
| 3262 | break; |
| 3263 | |
| 3264 | case IW_ENCODE_ALG_TKIP: |
| 3265 | { |
| 3266 | v_U8_t *pKey = &setKey.Key[0]; |
| 3267 | |
| 3268 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 3269 | |
| 3270 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 3271 | |
| 3272 | /*Supplicant sends the 32bytes key in this order |
| 3273 | |
| 3274 | |--------------|----------|----------| |
| 3275 | | Tk1 |TX-MIC | RX Mic | |
| 3276 | |--------------|----------|----------| |
| 3277 | <---16bytes---><--8bytes--><--8bytes--> |
| 3278 | |
| 3279 | */ |
| 3280 | /*Sme expects the 32 bytes key to be in the below order |
| 3281 | |
| 3282 | |--------------|----------|----------| |
| 3283 | | Tk1 |RX-MIC | TX Mic | |
| 3284 | |--------------|----------|----------| |
| 3285 | <---16bytes---><--8bytes--><--8bytes--> |
| 3286 | */ |
| 3287 | /* Copy the Temporal Key 1 (TK1) */ |
| 3288 | vos_mem_copy(pKey,ext->key,16); |
| 3289 | |
| 3290 | /*Copy the rx mic first*/ |
| 3291 | vos_mem_copy(&pKey[16],&ext->key[24],8); |
| 3292 | |
| 3293 | /*Copy the tx mic */ |
| 3294 | vos_mem_copy(&pKey[24],&ext->key[16],8); |
| 3295 | |
| 3296 | } |
| 3297 | break; |
| 3298 | |
| 3299 | case IW_ENCODE_ALG_CCMP: |
| 3300 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 3301 | break; |
| 3302 | |
| 3303 | #ifdef FEATURE_WLAN_CCX |
| 3304 | #define IW_ENCODE_ALG_KRK 6 |
| 3305 | case IW_ENCODE_ALG_KRK: |
| 3306 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 3307 | break; |
| 3308 | #endif /* FEATURE_WLAN_CCX */ |
| 3309 | |
| 3310 | default: |
| 3311 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 3312 | break; |
| 3313 | } |
| 3314 | |
| 3315 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3316 | ("%s:cipher_alg:%d key_len[%d] *pEncryptionType :%d \n"),__func__,(int)ext->alg,(int)ext->key_len,setKey.encType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3317 | |
| 3318 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3319 | /* The supplicant may attempt to set the PTK once pre-authentication is done. |
| 3320 | Save the key in the UMAC and include it in the ADD BSS request */ |
| 3321 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 3322 | if( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_WAIT ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3323 | { |
Gopichand Nakkala | d7d1365 | 2013-02-15 01:48:00 +0530 | [diff] [blame] | 3324 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3325 | } |
| 3326 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3327 | |
| 3328 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 3329 | |
| 3330 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 3331 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 3332 | { |
| 3333 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3334 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 3335 | __LINE__, vos_status ); |
| 3336 | |
| 3337 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3338 | } |
| 3339 | |
| 3340 | halStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),pAdapter->sessionId, &setKey, &roamId ); |
| 3341 | |
| 3342 | if ( halStatus != eHAL_STATUS_SUCCESS ) |
| 3343 | { |
| 3344 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3345 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 3346 | __LINE__, halStatus ); |
| 3347 | |
| 3348 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 3349 | } |
| 3350 | |
| 3351 | return halStatus; |
| 3352 | } |
| 3353 | |
| 3354 | static int iw_set_retry(struct net_device *dev, struct iw_request_info *info, |
| 3355 | union iwreq_data *wrqu, char *extra) |
| 3356 | { |
| 3357 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3358 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3359 | |
| 3360 | ENTER(); |
| 3361 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3362 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3363 | { |
| 3364 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3365 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3366 | return -EBUSY; |
| 3367 | } |
| 3368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3369 | if(wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN || |
| 3370 | wrqu->retry.value > WNI_CFG_LONG_RETRY_LIMIT_STAMAX) { |
| 3371 | |
| 3372 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Invalid Retry-Limit=%ld!!\n"),wrqu->retry.value); |
| 3373 | |
| 3374 | return -EINVAL; |
| 3375 | } |
| 3376 | |
| 3377 | if(wrqu->retry.flags & IW_RETRY_LIMIT) { |
| 3378 | |
| 3379 | if((wrqu->retry.flags & IW_RETRY_LONG)) |
| 3380 | { |
| 3381 | if ( ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 3382 | { |
| 3383 | return -EIO; |
| 3384 | } |
| 3385 | } |
| 3386 | else if((wrqu->retry.flags & IW_RETRY_SHORT)) |
| 3387 | { |
| 3388 | if ( ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 3389 | { |
| 3390 | return -EIO; |
| 3391 | } |
| 3392 | } |
| 3393 | } |
| 3394 | else |
| 3395 | { |
| 3396 | return -EOPNOTSUPP; |
| 3397 | } |
| 3398 | |
| 3399 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Set Retry-Limit=%ld!!\n"),wrqu->retry.value); |
| 3400 | |
| 3401 | EXIT(); |
| 3402 | |
| 3403 | return 0; |
| 3404 | |
| 3405 | } |
| 3406 | |
| 3407 | static int iw_get_retry(struct net_device *dev, struct iw_request_info *info, |
| 3408 | union iwreq_data *wrqu, char *extra) |
| 3409 | { |
| 3410 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3411 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3412 | v_U32_t retry = 0; |
| 3413 | |
| 3414 | ENTER(); |
| 3415 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3416 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3417 | { |
| 3418 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3419 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3420 | return -EBUSY; |
| 3421 | } |
| 3422 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3423 | if((wrqu->retry.flags & IW_RETRY_LONG)) |
| 3424 | { |
| 3425 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; |
| 3426 | |
| 3427 | if ( ccmCfgGetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS ) |
| 3428 | { |
| 3429 | return -EIO; |
| 3430 | } |
| 3431 | |
| 3432 | wrqu->retry.value = retry; |
| 3433 | } |
| 3434 | else if ((wrqu->retry.flags & IW_RETRY_SHORT)) |
| 3435 | { |
| 3436 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; |
| 3437 | |
| 3438 | if ( ccmCfgGetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS ) |
| 3439 | { |
| 3440 | return -EIO; |
| 3441 | } |
| 3442 | |
| 3443 | wrqu->retry.value = retry; |
| 3444 | } |
| 3445 | else { |
| 3446 | return -EOPNOTSUPP; |
| 3447 | } |
| 3448 | |
| 3449 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Retry-Limit=%ld!!\n"),retry); |
| 3450 | |
| 3451 | EXIT(); |
| 3452 | |
| 3453 | return 0; |
| 3454 | } |
| 3455 | |
| 3456 | static int iw_set_mlme(struct net_device *dev, |
| 3457 | struct iw_request_info *info, |
| 3458 | union iwreq_data *wrqu, |
| 3459 | char *extra) |
| 3460 | { |
| 3461 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3462 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3463 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
| 3464 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3465 | |
| 3466 | ENTER(); |
| 3467 | |
| 3468 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3469 | { |
| 3470 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3471 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 3472 | return 0; |
| 3473 | } |
| 3474 | |
| 3475 | //reason_code is unused. By default it is set to eCSR_DISCONNECT_REASON_UNSPECIFIED |
| 3476 | switch (mlme->cmd) { |
| 3477 | case IW_MLME_DISASSOC: |
| 3478 | case IW_MLME_DEAUTH: |
| 3479 | |
| 3480 | if( pHddStaCtx->conn_info.connState == eConnectionState_Associated ) |
| 3481 | { |
| 3482 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 3483 | |
| 3484 | if( mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE ) |
| 3485 | reason = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 3486 | |
| 3487 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 3488 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId,reason); |
| 3489 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3490 | if(eHAL_STATUS_SUCCESS == status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3491 | wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var, |
| 3492 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 3493 | else |
| 3494 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate : csrRoamDisconnect failure returned %d \n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3495 | __func__, (int)mlme->cmd, (int)status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3496 | |
| 3497 | /* Resetting authKeyMgmt */ |
| 3498 | (WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->authKeyMgmt = 0; |
| 3499 | |
| 3500 | netif_tx_disable(dev); |
| 3501 | netif_carrier_off(dev); |
| 3502 | |
| 3503 | } |
| 3504 | else |
| 3505 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3506 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate called but station is not in associated state \n", __func__, (int)mlme->cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3507 | } |
| 3508 | break; |
| 3509 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3510 | hddLog(LOGE,"%s %d Command should be Disassociate/Deauthenticate \n", __func__, (int)mlme->cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3511 | return -EINVAL; |
| 3512 | }//end of switch |
| 3513 | |
| 3514 | EXIT(); |
| 3515 | |
| 3516 | return status; |
| 3517 | |
| 3518 | } |
| 3519 | |
| 3520 | /* set param sub-ioctls */ |
| 3521 | static int iw_setint_getnone(struct net_device *dev, struct iw_request_info *info, |
| 3522 | union iwreq_data *wrqu, char *extra) |
| 3523 | { |
| 3524 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3525 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3526 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3527 | int *value = (int *)extra; |
| 3528 | int sub_cmd = value[0]; |
| 3529 | int set_value = value[1]; |
| 3530 | int ret = 0; /* success */ |
| 3531 | int enable_pbm, enable_mp; |
| 3532 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 3533 | v_U8_t nEnableSuspendOld; |
| 3534 | #endif |
| 3535 | INIT_COMPLETION(pWextState->completion_var); |
| 3536 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3537 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3538 | { |
| 3539 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3540 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3541 | return -EBUSY; |
| 3542 | } |
| 3543 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3544 | switch(sub_cmd) |
| 3545 | { |
| 3546 | case WE_SET_11D_STATE: |
| 3547 | { |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3548 | tSmeConfigParams smeConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3549 | if((ENABLE_11D == set_value) || (DISABLE_11D == set_value)) { |
| 3550 | |
| 3551 | sme_GetConfigParam(hHal,&smeConfig); |
| 3552 | smeConfig.csrConfig.Is11dSupportEnabled = (v_BOOL_t)set_value; |
| 3553 | |
| 3554 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%ld!!\n"),smeConfig.csrConfig.Is11dSupportEnabled); |
| 3555 | |
| 3556 | sme_UpdateConfig(hHal,&smeConfig); |
| 3557 | } |
| 3558 | else { |
| 3559 | return -EINVAL; |
| 3560 | } |
| 3561 | break; |
| 3562 | } |
| 3563 | |
| 3564 | case WE_WOWL: |
| 3565 | { |
| 3566 | switch (set_value) |
| 3567 | { |
| 3568 | case 0x00: |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3569 | hdd_exit_wowl(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3570 | break; |
| 3571 | case 0x01: |
| 3572 | case 0x02: |
| 3573 | case 0x03: |
| 3574 | enable_mp = (set_value & 0x01) ? 1 : 0; |
| 3575 | enable_pbm = (set_value & 0x02) ? 1 : 0; |
| 3576 | hddLog(LOGE, "magic packet ? = %s pattern byte matching ? = %s\n", |
| 3577 | (enable_mp ? "YES":"NO"), (enable_pbm ? "YES":"NO")); |
| 3578 | hdd_enter_wowl(pAdapter, enable_mp, enable_pbm); |
| 3579 | break; |
| 3580 | default: |
| 3581 | hddLog(LOGE, "Invalid arg %d in WE_WOWL IOCTL\n", set_value); |
| 3582 | ret = -EINVAL; |
| 3583 | break; |
| 3584 | } |
| 3585 | |
| 3586 | break; |
| 3587 | } |
| 3588 | case WE_SET_POWER: |
| 3589 | { |
| 3590 | switch (set_value) |
| 3591 | { |
| 3592 | case 0: //Full Power |
| 3593 | { |
| 3594 | struct statsContext context; |
| 3595 | eHalStatus status; |
| 3596 | |
| 3597 | init_completion(&context.completion); |
| 3598 | |
| 3599 | context.pAdapter = pAdapter; |
| 3600 | context.magic = POWER_CONTEXT_MAGIC; |
| 3601 | |
| 3602 | status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3603 | iw_power_callback_fn, &context, |
| 3604 | eSME_FULL_PWR_NEEDED_BY_HDD); |
| 3605 | if(eHAL_STATUS_PMC_PENDING == status) |
| 3606 | { |
| 3607 | int lrc = wait_for_completion_interruptible_timeout( |
| 3608 | &context.completion, |
| 3609 | msecs_to_jiffies(WLAN_WAIT_TIME_POWER)); |
| 3610 | context.magic = 0; |
| 3611 | if (lrc <= 0) |
| 3612 | { |
| 3613 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while " |
| 3614 | "requesting fullpower ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3615 | __func__, (0 == lrc) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3616 | "timeout" : "interrupt"); |
| 3617 | /* there is a race condition such that the callback |
| 3618 | function could be executing at the same time we are. of |
| 3619 | primary concern is if the callback function had already |
| 3620 | verified the "magic" but hasn't yet set the completion |
| 3621 | variable. Since the completion variable is on our |
| 3622 | stack, we'll delay just a bit to make sure the data is |
| 3623 | still valid if that is the case */ |
| 3624 | msleep(50); |
| 3625 | /* we'll now returned a cached value below */ |
| 3626 | } |
| 3627 | } |
| 3628 | hddLog(LOGE, "iwpriv Full Power completed\n"); |
| 3629 | break; |
| 3630 | } |
| 3631 | case 1: //Enable BMPS |
| 3632 | sme_EnablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 3633 | break; |
| 3634 | case 2: //Disable BMPS |
| 3635 | sme_DisablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 3636 | break; |
| 3637 | case 3: //Request Bmps |
| 3638 | { |
| 3639 | struct statsContext context; |
| 3640 | eHalStatus status; |
| 3641 | |
| 3642 | init_completion(&context.completion); |
| 3643 | |
| 3644 | context.pAdapter = pAdapter; |
| 3645 | context.magic = POWER_CONTEXT_MAGIC; |
| 3646 | |
| 3647 | status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3648 | iw_power_callback_fn, &context); |
| 3649 | if(eHAL_STATUS_PMC_PENDING == status) |
| 3650 | { |
| 3651 | int lrc = wait_for_completion_interruptible_timeout( |
| 3652 | &context.completion, |
| 3653 | msecs_to_jiffies(WLAN_WAIT_TIME_POWER)); |
| 3654 | context.magic = 0; |
| 3655 | if (lrc <= 0) |
| 3656 | { |
| 3657 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while " |
| 3658 | "requesting BMPS", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3659 | __func__, (0 == lrc) ? "timeout" : |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3660 | "interrupt"); |
| 3661 | /* there is a race condition such that the callback |
| 3662 | function could be executing at the same time we are. of |
| 3663 | primary concern is if the callback function had already |
| 3664 | verified the "magic" but hasn't yet set the completion |
| 3665 | variable. Since the completion variable is on our |
| 3666 | stack, we'll delay just a bit to make sure the data is |
| 3667 | still valid if that is the case */ |
| 3668 | msleep(50); |
| 3669 | /* we'll now returned a cached value below */ |
| 3670 | } |
| 3671 | } |
| 3672 | hddLog(LOGE, "iwpriv Request BMPS completed\n"); |
| 3673 | break; |
| 3674 | } |
| 3675 | case 4: //Enable IMPS |
| 3676 | sme_EnablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 3677 | break; |
| 3678 | case 5: //Disable IMPS |
| 3679 | sme_DisablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 3680 | break; |
| 3681 | case 6: //Enable Standby |
| 3682 | sme_EnablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE); |
| 3683 | break; |
| 3684 | case 7: //Disable Standby |
| 3685 | sme_DisablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE); |
| 3686 | break; |
| 3687 | case 8: //Request Standby |
| 3688 | #ifdef CONFIG_HAS_EARLYSUSPEND |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3689 | #endif |
| 3690 | break; |
| 3691 | case 9: //Start Auto Bmps Timer |
| 3692 | sme_StartAutoBmpsTimer(hHal); |
| 3693 | break; |
| 3694 | case 10://Stop Auto BMPS Timer |
| 3695 | sme_StopAutoBmpsTimer(hHal); |
| 3696 | break; |
| 3697 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 3698 | case 11://suspend to standby |
| 3699 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 3700 | nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend; |
| 3701 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3702 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld; |
| 3703 | #endif |
| 3704 | break; |
| 3705 | case 12://suspend to deep sleep |
| 3706 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 3707 | nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend; |
| 3708 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3709 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld; |
| 3710 | #endif |
| 3711 | break; |
| 3712 | case 13://resume from suspend |
| 3713 | #ifdef CONFIG_HAS_EARLYSUSPEND |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3714 | #endif |
| 3715 | break; |
| 3716 | #endif |
| 3717 | case 14://reset wlan (power down/power up) |
| 3718 | vos_chipReset(NULL, VOS_FALSE, NULL, NULL, VOS_CHIP_RESET_UNKNOWN_EXCEPTION); |
| 3719 | break; |
| 3720 | default: |
| 3721 | hddLog(LOGE, "Invalid arg %d in WE_SET_POWER IOCTL\n", set_value); |
| 3722 | ret = -EINVAL; |
| 3723 | break; |
| 3724 | } |
| 3725 | break; |
| 3726 | } |
| 3727 | |
| 3728 | case WE_SET_MAX_ASSOC: |
| 3729 | { |
| 3730 | if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) || |
| 3731 | (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) |
| 3732 | { |
| 3733 | ret = -EINVAL; |
| 3734 | } |
| 3735 | else if ( ccmCfgSetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, |
| 3736 | set_value, NULL, eANI_BOOLEAN_FALSE) |
| 3737 | != eHAL_STATUS_SUCCESS ) |
| 3738 | { |
| 3739 | ret = -EIO; |
| 3740 | } |
| 3741 | break; |
| 3742 | } |
| 3743 | |
| 3744 | case WE_SET_SAP_AUTO_CHANNEL_SELECTION: |
| 3745 | { |
| 3746 | if( 0 == set_value ) |
| 3747 | { |
| 3748 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 0; |
| 3749 | } |
| 3750 | else if ( 1 == set_value ) |
| 3751 | { |
| 3752 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 1; |
| 3753 | } |
| 3754 | else |
| 3755 | { |
| 3756 | hddLog(LOGE, "Invalid arg %d in WE_SET_SAP_AUTO_CHANNEL_SELECTION IOCTL\n", set_value); |
| 3757 | ret = -EINVAL; |
| 3758 | } |
| 3759 | break; |
| 3760 | } |
| 3761 | |
| 3762 | case WE_SET_DATA_INACTIVITY_TO: |
| 3763 | { |
| 3764 | if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) || |
| 3765 | (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) || |
| 3766 | (ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 3767 | WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, |
| 3768 | set_value, |
| 3769 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)) |
| 3770 | { |
| 3771 | hddLog(LOGE,"Failure: Could not pass on " |
| 3772 | "WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT configuration info " |
| 3773 | "to CCM\n"); |
| 3774 | ret = -EINVAL; |
| 3775 | } |
| 3776 | break; |
| 3777 | } |
| 3778 | case WE_SET_MAX_TX_POWER: |
| 3779 | { |
| 3780 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3781 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 3782 | |
| 3783 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Setting maximum tx power %d dBm", |
| 3784 | __func__, set_value); |
| 3785 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, set_value) != |
| 3786 | eHAL_STATUS_SUCCESS ) |
| 3787 | { |
| 3788 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 3789 | __func__); |
| 3790 | return -EIO; |
| 3791 | } |
| 3792 | |
| 3793 | break; |
| 3794 | } |
| 3795 | case WE_SET_HIGHER_DTIM_TRANSITION: |
| 3796 | { |
| 3797 | if(!((set_value == eANI_BOOLEAN_FALSE) || |
| 3798 | (set_value == eANI_BOOLEAN_TRUE))) |
| 3799 | { |
| 3800 | hddLog(LOGE, "Dynamic DTIM Incorrect data:%d", set_value); |
| 3801 | ret = -EINVAL; |
| 3802 | } |
| 3803 | else |
| 3804 | { |
| 3805 | if(pAdapter->higherDtimTransition != set_value) |
| 3806 | { |
| 3807 | pAdapter->higherDtimTransition = set_value; |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3808 | hddLog(LOG1, "%s: higherDtimTransition set to :%d", __func__, pAdapter->higherDtimTransition); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3809 | } |
| 3810 | } |
| 3811 | |
| 3812 | break; |
| 3813 | } |
| 3814 | |
| 3815 | case WE_SET_TM_LEVEL: |
| 3816 | { |
| 3817 | hdd_context_t *hddCtxt = WLAN_HDD_GET_CTX(pAdapter); |
| 3818 | hddLog(VOS_TRACE_LEVEL_INFO, "Set Thermal Mitigation Level %d", (int)set_value); |
| 3819 | hddDevTmLevelChangedHandler(hddCtxt->parent_dev, set_value); |
| 3820 | |
| 3821 | break; |
| 3822 | } |
| 3823 | |
| 3824 | default: |
| 3825 | { |
| 3826 | hddLog(LOGE, "Invalid IOCTL setvalue command %d value %d \n", |
| 3827 | sub_cmd, set_value); |
| 3828 | break; |
| 3829 | } |
| 3830 | } |
| 3831 | |
| 3832 | return ret; |
| 3833 | } |
| 3834 | |
| 3835 | /* set param sub-ioctls */ |
| 3836 | static int iw_setchar_getnone(struct net_device *dev, struct iw_request_info *info, |
| 3837 | union iwreq_data *wrqu, char *extra) |
| 3838 | { |
| 3839 | VOS_STATUS vstatus; |
| 3840 | int sub_cmd = wrqu->data.flags; |
| 3841 | int ret = 0; /* success */ |
| 3842 | hdd_adapter_t *pAdapter = (netdev_priv(dev)); |
| 3843 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3844 | #ifdef WLAN_FEATURE_VOWIFI |
| 3845 | hdd_config_t *pConfig = pHddCtx->cfg_ini; |
| 3846 | #endif /* WLAN_FEATURE_VOWIFI */ |
| 3847 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3848 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Received length %d", __func__, wrqu->data.length); |
| 3849 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Received data %s", __func__, (char*)wrqu->data.pointer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3850 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3851 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3852 | { |
| 3853 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3854 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3855 | return -EBUSY; |
| 3856 | } |
| 3857 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3858 | switch(sub_cmd) |
| 3859 | { |
| 3860 | case WE_WOWL_ADD_PTRN: |
| 3861 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "ADD_PTRN\n"); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3862 | hdd_add_wowl_ptrn(pAdapter, (char*)wrqu->data.pointer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3863 | break; |
| 3864 | case WE_WOWL_DEL_PTRN: |
| 3865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "DEL_PTRN\n"); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 3866 | hdd_del_wowl_ptrn(pAdapter, (char*)wrqu->data.pointer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3867 | break; |
| 3868 | #if defined WLAN_FEATURE_VOWIFI |
| 3869 | case WE_NEIGHBOR_REPORT_REQUEST: |
| 3870 | { |
| 3871 | tRrmNeighborReq neighborReq; |
| 3872 | tRrmNeighborRspCallbackInfo callbackInfo; |
| 3873 | |
| 3874 | if (pConfig->fRrmEnable) |
| 3875 | { |
| 3876 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Neighbor Request\n"); |
| 3877 | neighborReq.no_ssid = (wrqu->data.length - 1) ? false : true ; |
| 3878 | if( !neighborReq.no_ssid ) |
| 3879 | { |
| 3880 | neighborReq.ssid.length = (wrqu->data.length - 1) > 32 ? 32 : (wrqu->data.length - 1) ; |
| 3881 | vos_mem_copy( neighborReq.ssid.ssId, wrqu->data.pointer, neighborReq.ssid.length ); |
| 3882 | } |
| 3883 | |
| 3884 | callbackInfo.neighborRspCallback = NULL; |
| 3885 | callbackInfo.neighborRspCallbackContext = NULL; |
| 3886 | callbackInfo.timeout = 5000; //5 seconds |
| 3887 | sme_NeighborReportRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &neighborReq, &callbackInfo ); |
| 3888 | } |
| 3889 | else |
| 3890 | { |
| 3891 | hddLog(LOGE, "%s: Ignoring neighbor request as RRM is not enabled\n", __func__); |
| 3892 | ret = -EINVAL; |
| 3893 | } |
| 3894 | } |
| 3895 | break; |
| 3896 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3897 | case WE_SET_AP_WPS_IE: |
| 3898 | hddLog( LOGE, "Received WE_SET_AP_WPS_IE" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3899 | sme_updateP2pIe( WLAN_HDD_GET_HAL_CTX(pAdapter), wrqu->data.pointer, wrqu->data.length ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3900 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3901 | case WE_SET_CONFIG: |
| 3902 | vstatus = hdd_execute_config_command(pHddCtx, wrqu->data.pointer); |
| 3903 | if (VOS_STATUS_SUCCESS != vstatus) |
| 3904 | { |
| 3905 | ret = -EINVAL; |
| 3906 | } |
| 3907 | break; |
| 3908 | default: |
| 3909 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3910 | hddLog(LOGE, "%s: Invalid sub command %d\n",__func__, sub_cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3911 | ret = -EINVAL; |
| 3912 | break; |
| 3913 | } |
| 3914 | } |
| 3915 | return ret; |
| 3916 | } |
| 3917 | |
| 3918 | /* get param sub-ioctls */ |
| 3919 | static int iw_setnone_getint(struct net_device *dev, struct iw_request_info *info, |
| 3920 | union iwreq_data *wrqu, char *extra) |
| 3921 | { |
| 3922 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3923 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 3924 | int *value = (int *)extra; |
| 3925 | int ret = 0; /* success */ |
| 3926 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3927 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3928 | { |
| 3929 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 3930 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3931 | return -EBUSY; |
| 3932 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3933 | |
| 3934 | switch (value[0]) |
| 3935 | { |
| 3936 | case WE_GET_11D_STATE: |
| 3937 | { |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3938 | tSmeConfigParams smeConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3939 | |
| 3940 | sme_GetConfigParam(hHal,&smeConfig); |
| 3941 | |
| 3942 | *value = smeConfig.csrConfig.Is11dSupportEnabled; |
| 3943 | |
| 3944 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%ld!!\n"),*value); |
| 3945 | |
| 3946 | break; |
| 3947 | } |
| 3948 | |
| 3949 | case WE_IBSS_STATUS: |
| 3950 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****Return IBSS Status*****\n"); |
| 3951 | break; |
| 3952 | |
| 3953 | case WE_PMC_STATE: |
| 3954 | { |
| 3955 | *value = pmcGetPmcState(hHal); |
| 3956 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("PMC state=%ld!!\n"),*value); |
| 3957 | break; |
| 3958 | } |
| 3959 | case WE_GET_WLAN_DBG: |
| 3960 | { |
| 3961 | vos_trace_display(); |
| 3962 | *value = 0; |
| 3963 | break; |
| 3964 | } |
| 3965 | case WE_MODULE_DOWN_IND: |
| 3966 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3967 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: sending WLAN_MODULE_DOWN_IND", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3968 | send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0); |
| 3969 | #ifdef WLAN_BTAMP_FEATURE |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3970 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s: Take down AMP PAL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3971 | BSL_Deinit(vos_get_global_context(VOS_MODULE_ID_HDD, NULL)); |
| 3972 | #endif |
| 3973 | //WLANBAP_Close(vos_get_global_context(VOS_MODULE_ID_HDD, NULL)); |
| 3974 | |
| 3975 | *value = 0; |
| 3976 | break; |
| 3977 | } |
| 3978 | case WE_GET_MAX_ASSOC: |
| 3979 | { |
| 3980 | if (ccmCfgGetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, (tANI_U32 *)value) != eHAL_STATUS_SUCCESS) |
| 3981 | { |
| 3982 | ret = -EIO; |
| 3983 | } |
| 3984 | break; |
| 3985 | } |
| 3986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3987 | case WE_GET_WDI_DBG: |
| 3988 | { |
| 3989 | wpalTraceDisplay(); |
| 3990 | *value = 0; |
| 3991 | break; |
| 3992 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3993 | |
| 3994 | case WE_GET_SAP_AUTO_CHANNEL_SELECTION: |
| 3995 | { |
| 3996 | *value = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection; |
| 3997 | break; |
| 3998 | } |
| 3999 | case WE_GET_CONCURRENCY_MODE: |
| 4000 | { |
| 4001 | *value = hdd_get_concurrency_mode ( ); |
| 4002 | |
| 4003 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("concurrency mode=%d \n"),*value); |
| 4004 | break; |
| 4005 | } |
| 4006 | |
| 4007 | default: |
| 4008 | { |
| 4009 | hddLog(LOGE, "Invalid IOCTL get_value command %d ",value[0]); |
| 4010 | break; |
| 4011 | } |
| 4012 | } |
| 4013 | |
| 4014 | return ret; |
| 4015 | } |
| 4016 | |
| 4017 | /* set param sub-ioctls */ |
| 4018 | int iw_set_three_ints_getnone(struct net_device *dev, struct iw_request_info *info, |
| 4019 | union iwreq_data *wrqu, char *extra) |
| 4020 | { |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4021 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4022 | int *value = (int *)extra; |
| 4023 | int sub_cmd = value[0]; |
| 4024 | int ret = 0; |
| 4025 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4026 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4027 | { |
| 4028 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4029 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4030 | return -EBUSY; |
| 4031 | } |
| 4032 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4033 | switch(sub_cmd) |
| 4034 | { |
| 4035 | case WE_SET_WLAN_DBG: |
| 4036 | { |
| 4037 | vos_trace_setValue( value[1], value[2], value[3]); |
| 4038 | break; |
| 4039 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4040 | case WE_SET_WDI_DBG: |
| 4041 | { |
| 4042 | wpalTraceSetLevel( value[1], value[2], value[3]); |
| 4043 | break; |
| 4044 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4045 | case WE_SET_SAP_CHANNELS: |
| 4046 | { |
| 4047 | ret = iw_softap_set_channel_range( dev, value[1], value[2], value[3]); |
| 4048 | break; |
| 4049 | } |
| 4050 | |
| 4051 | default: |
| 4052 | { |
| 4053 | hddLog(LOGE, "Invalid IOCTL command %d \n", sub_cmd ); |
| 4054 | break; |
| 4055 | } |
| 4056 | } |
| 4057 | return ret; |
| 4058 | } |
| 4059 | |
| 4060 | static int iw_get_char_setnone(struct net_device *dev, struct iw_request_info *info, |
| 4061 | union iwreq_data *wrqu, char *extra) |
| 4062 | { |
| 4063 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4064 | int sub_cmd = wrqu->data.flags; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4065 | #ifdef WLAN_FEATURE_11W |
| 4066 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4067 | #endif |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4068 | |
| 4069 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4070 | { |
| 4071 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4072 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4073 | return -EBUSY; |
| 4074 | } |
| 4075 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4076 | switch(sub_cmd) |
| 4077 | { |
| 4078 | case WE_WLAN_VERSION: |
| 4079 | { |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 4080 | hdd_wlan_get_version(pAdapter, wrqu, extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4081 | break; |
| 4082 | } |
| 4083 | |
| 4084 | case WE_GET_STATS: |
| 4085 | { |
| 4086 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4087 | hdd_tx_rx_stats_t *pStats = &pAdapter->hdd_stats.hddTxRxStats; |
| 4088 | hdd_chip_reset_stats_t *pResetStats = &pHddCtx->hddChipResetStats; |
| 4089 | |
| 4090 | snprintf(extra, WE_MAX_STR_LEN, |
| 4091 | "\nTransmit" |
| 4092 | "\ncalled %u, dropped %u, backpressured %u, queued %u" |
| 4093 | "\n dropped BK %u, BE %u, VI %u, VO %u" |
| 4094 | "\n classified BK %u, BE %u, VI %u, VO %u" |
| 4095 | "\nbackpressured BK %u, BE %u, VI %u, VO %u" |
| 4096 | "\n queued BK %u, BE %u, VI %u, VO %u" |
| 4097 | "\nfetched %u, empty %u, lowres %u, deqerr %u" |
| 4098 | "\ndequeued %u, depressured %u, completed %u, flushed %u" |
| 4099 | "\n fetched BK %u, BE %u, VI %u, VO %u" |
| 4100 | "\n dequeued BK %u, BE %u, VI %u, VO %u" |
| 4101 | "\n depressured BK %u, BE %u, VI %u, VO %u" |
| 4102 | "\n flushed BK %u, BE %u, VI %u, VO %u" |
| 4103 | "\n\nReceive" |
| 4104 | "\nchains %u, packets %u, dropped %u, delivered %u, refused %u" |
| 4105 | "\n\nResetsStats" |
| 4106 | "\n TotalLogp %u Cmd53 %u MutexRead %u MIF-Error %u FW-Heartbeat %u Others %u" |
| 4107 | "\n", |
| 4108 | pStats->txXmitCalled, |
| 4109 | pStats->txXmitDropped, |
| 4110 | pStats->txXmitBackPressured, |
| 4111 | pStats->txXmitQueued, |
| 4112 | |
| 4113 | pStats->txXmitDroppedAC[WLANTL_AC_BK], |
| 4114 | pStats->txXmitDroppedAC[WLANTL_AC_BE], |
| 4115 | pStats->txXmitDroppedAC[WLANTL_AC_VI], |
| 4116 | pStats->txXmitDroppedAC[WLANTL_AC_VO], |
| 4117 | |
| 4118 | pStats->txXmitClassifiedAC[WLANTL_AC_BK], |
| 4119 | pStats->txXmitClassifiedAC[WLANTL_AC_BE], |
| 4120 | pStats->txXmitClassifiedAC[WLANTL_AC_VI], |
| 4121 | pStats->txXmitClassifiedAC[WLANTL_AC_VO], |
| 4122 | |
| 4123 | pStats->txXmitBackPressuredAC[WLANTL_AC_BK], |
| 4124 | pStats->txXmitBackPressuredAC[WLANTL_AC_BE], |
| 4125 | pStats->txXmitBackPressuredAC[WLANTL_AC_VI], |
| 4126 | pStats->txXmitBackPressuredAC[WLANTL_AC_VO], |
| 4127 | |
| 4128 | pStats->txXmitQueuedAC[WLANTL_AC_BK], |
| 4129 | pStats->txXmitQueuedAC[WLANTL_AC_BE], |
| 4130 | pStats->txXmitQueuedAC[WLANTL_AC_VI], |
| 4131 | pStats->txXmitQueuedAC[WLANTL_AC_VO], |
| 4132 | |
| 4133 | pStats->txFetched, |
| 4134 | pStats->txFetchEmpty, |
| 4135 | pStats->txFetchLowResources, |
| 4136 | pStats->txFetchDequeueError, |
| 4137 | |
| 4138 | pStats->txFetchDequeued, |
| 4139 | pStats->txFetchDePressured, |
| 4140 | pStats->txCompleted, |
| 4141 | pStats->txFlushed, |
| 4142 | |
| 4143 | pStats->txFetchedAC[WLANTL_AC_BK], |
| 4144 | pStats->txFetchedAC[WLANTL_AC_BE], |
| 4145 | pStats->txFetchedAC[WLANTL_AC_VI], |
| 4146 | pStats->txFetchedAC[WLANTL_AC_VO], |
| 4147 | |
| 4148 | pStats->txFetchDequeuedAC[WLANTL_AC_BK], |
| 4149 | pStats->txFetchDequeuedAC[WLANTL_AC_BE], |
| 4150 | pStats->txFetchDequeuedAC[WLANTL_AC_VI], |
| 4151 | pStats->txFetchDequeuedAC[WLANTL_AC_VO], |
| 4152 | |
| 4153 | pStats->txFetchDePressuredAC[WLANTL_AC_BK], |
| 4154 | pStats->txFetchDePressuredAC[WLANTL_AC_BE], |
| 4155 | pStats->txFetchDePressuredAC[WLANTL_AC_VI], |
| 4156 | pStats->txFetchDePressuredAC[WLANTL_AC_VO], |
| 4157 | |
| 4158 | pStats->txFlushedAC[WLANTL_AC_BK], |
| 4159 | pStats->txFlushedAC[WLANTL_AC_BE], |
| 4160 | pStats->txFlushedAC[WLANTL_AC_VI], |
| 4161 | pStats->txFlushedAC[WLANTL_AC_VO], |
| 4162 | |
| 4163 | pStats->rxChains, |
| 4164 | pStats->rxPackets, |
| 4165 | pStats->rxDropped, |
| 4166 | pStats->rxDelivered, |
| 4167 | pStats->rxRefused, |
| 4168 | |
| 4169 | pResetStats->totalLogpResets, |
| 4170 | pResetStats->totalCMD53Failures, |
| 4171 | pResetStats->totalMutexReadFailures, |
| 4172 | pResetStats->totalMIFErrorFailures, |
| 4173 | pResetStats->totalFWHearbeatFailures, |
| 4174 | pResetStats->totalUnknownExceptions |
| 4175 | ); |
| 4176 | wrqu->data.length = strlen(extra)+1; |
| 4177 | break; |
| 4178 | } |
| 4179 | |
| 4180 | case WE_GET_CFG: |
| 4181 | { |
| 4182 | hdd_cfg_get_config(WLAN_HDD_GET_CTX(pAdapter), extra, WE_MAX_STR_LEN); |
| 4183 | wrqu->data.length = strlen(extra)+1; |
| 4184 | break; |
| 4185 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4186 | #ifdef WLAN_FEATURE_11AC |
| 4187 | case WE_GET_RSSI: |
| 4188 | { |
| 4189 | v_S7_t s7Rssi = 0; |
| 4190 | wlan_hdd_get_rssi(pAdapter, &s7Rssi); |
| 4191 | snprintf(extra, WE_MAX_STR_LEN, "rssi=%d",s7Rssi); |
| 4192 | wrqu->data.length = strlen(extra)+1; |
| 4193 | break; |
| 4194 | } |
| 4195 | #endif |
| 4196 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 4197 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 4198 | case WE_GET_ROAM_RSSI: |
| 4199 | { |
| 4200 | v_S7_t s7Rssi = 0; |
| 4201 | wlan_hdd_get_roam_rssi(pAdapter, &s7Rssi); |
| 4202 | snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi); |
| 4203 | wrqu->data.length = strlen(extra)+1; |
| 4204 | break; |
| 4205 | } |
| 4206 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4207 | case WE_GET_WMM_STATUS: |
| 4208 | { |
| 4209 | snprintf(extra, WE_MAX_STR_LEN, |
| 4210 | "\nDir: 0=up, 1=down, 3=both\n" |
| 4211 | "|------------------------|\n" |
| 4212 | "|AC | ACM |Admitted| Dir |\n" |
| 4213 | "|------------------------|\n" |
| 4214 | "|VO | %d | %3s | %d |\n" |
| 4215 | "|VI | %d | %3s | %d |\n" |
| 4216 | "|BE | %d | %3s | %d |\n" |
| 4217 | "|BK | %d | %3s | %d |\n" |
| 4218 | "|------------------------|\n", |
| 4219 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessRequired, |
| 4220 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessAllowed?"YES":"NO", |
| 4221 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcTspecInfo.ts_info.direction, |
| 4222 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessRequired, |
| 4223 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessAllowed?"YES":"NO", |
| 4224 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcTspecInfo.ts_info.direction, |
| 4225 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessRequired, |
| 4226 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessAllowed?"YES":"NO", |
| 4227 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcTspecInfo.ts_info.direction, |
| 4228 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessRequired, |
| 4229 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessAllowed?"YES":"NO", |
| 4230 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcTspecInfo.ts_info.direction); |
| 4231 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4232 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4233 | wrqu->data.length = strlen(extra)+1; |
| 4234 | break; |
| 4235 | } |
| 4236 | case WE_GET_CHANNEL_LIST: |
| 4237 | { |
| 4238 | VOS_STATUS status; |
| 4239 | v_U8_t i, len; |
| 4240 | char* buf ; |
| 4241 | tChannelListInfo channel_list; |
| 4242 | |
| 4243 | status = iw_softap_get_channel_list(dev, info, wrqu, (char *)&channel_list); |
| 4244 | if ( !VOS_IS_STATUS_SUCCESS( status ) ) |
| 4245 | { |
| 4246 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s GetChannelList Failed!!!\n",__func__); |
| 4247 | return -EINVAL; |
| 4248 | } |
| 4249 | buf = extra; |
| 4250 | |
| 4251 | /** |
| 4252 | * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN. Maximum buffer |
| 4253 | * needed = 5 * number of channels. Check if sufficient buffer is available and |
| 4254 | * then proceed to fill the buffer. |
| 4255 | */ |
| 4256 | if(WE_MAX_STR_LEN < (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) |
| 4257 | { |
| 4258 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Insufficient Buffer to populate channel list\n",__func__); |
| 4259 | return -EINVAL; |
| 4260 | } |
| 4261 | len = snprintf(buf, 5, "%u ", channel_list.num_channels); |
| 4262 | buf += len; |
| 4263 | for(i = 0 ; i < channel_list.num_channels; i++) |
| 4264 | { |
| 4265 | len = snprintf(buf, 5, |
| 4266 | "%u ", channel_list.channels[i]); |
| 4267 | buf += len; |
| 4268 | } |
| 4269 | wrqu->data.length = strlen(extra)+1; |
| 4270 | |
| 4271 | break; |
| 4272 | } |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 4273 | #ifdef FEATURE_WLAN_TDLS |
| 4274 | case WE_GET_TDLS_PEERS: |
| 4275 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 4276 | 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] | 4277 | break; |
| 4278 | } |
| 4279 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4280 | #ifdef WLAN_FEATURE_11W |
| 4281 | case WE_GET_11W_INFO: |
| 4282 | { |
| 4283 | hddLog(LOGE, "WE_GET_11W_ENABLED = %d", pWextState->roamProfile.MFPEnabled ); |
| 4284 | |
| 4285 | snprintf(extra, WE_MAX_STR_LEN, |
| 4286 | "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d" |
| 4287 | "\n Number of Unprotected Disassocs %d" |
| 4288 | "\n Number of Unprotected Deauths %d", |
| 4289 | (*pWextState->roamProfile.BSSIDs.bssid)[0], (*pWextState->roamProfile.BSSIDs.bssid)[1], |
| 4290 | (*pWextState->roamProfile.BSSIDs.bssid)[2], (*pWextState->roamProfile.BSSIDs.bssid)[3], |
| 4291 | (*pWextState->roamProfile.BSSIDs.bssid)[4], (*pWextState->roamProfile.BSSIDs.bssid)[5], |
| 4292 | pWextState->roamProfile.MFPEnabled, pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx, |
| 4293 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx); |
| 4294 | |
| 4295 | wrqu->data.length = strlen(extra)+1; |
| 4296 | break; |
| 4297 | } |
| 4298 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4299 | default: |
| 4300 | { |
| 4301 | hddLog(LOGE, "Invalid IOCTL command %d \n", sub_cmd ); |
| 4302 | break; |
| 4303 | } |
| 4304 | } |
| 4305 | |
| 4306 | return 0; |
| 4307 | } |
| 4308 | |
| 4309 | /* action sub-ioctls */ |
| 4310 | static int iw_setnone_getnone(struct net_device *dev, struct iw_request_info *info, |
| 4311 | union iwreq_data *wrqu, char *extra) |
| 4312 | { |
| 4313 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4314 | int sub_cmd = wrqu->data.flags; |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 4315 | int ret = 0; /* success */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4316 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4317 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4318 | { |
| 4319 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4320 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4321 | return -EBUSY; |
| 4322 | } |
| 4323 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4324 | switch (sub_cmd) |
| 4325 | { |
| 4326 | case WE_CLEAR_STATS: |
| 4327 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4328 | 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] | 4329 | memset(&pAdapter->stats, 0, sizeof(pAdapter->stats)); |
| 4330 | memset(&pAdapter->hdd_stats, 0, sizeof(pAdapter->hdd_stats)); |
| 4331 | break; |
| 4332 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4333 | case WE_INIT_AP: |
| 4334 | { |
| 4335 | pr_info("Init AP trigger\n"); |
| 4336 | hdd_open_adapter( WLAN_HDD_GET_CTX(pAdapter), WLAN_HDD_SOFTAP, "softap.%d", |
| 4337 | wlan_hdd_get_intf_addr( WLAN_HDD_GET_CTX(pAdapter) ),TRUE); |
| 4338 | break; |
| 4339 | } |
| 4340 | case WE_STOP_AP: |
| 4341 | { |
| 4342 | /*FIX ME: Need to be revisited if multiple SAPs to be supported */ |
| 4343 | /* As Soft AP mode has been changed to STA already with killing of Hostapd, |
| 4344 | * this is a dead code and need to find the adpater by name rather than mode */ |
| 4345 | hdd_adapter_t* pAdapter_to_stop = |
| 4346 | hdd_get_adapter_by_name(WLAN_HDD_GET_CTX(pAdapter), "softap.0"); |
| 4347 | if( pAdapter_to_stop ) |
| 4348 | { |
| 4349 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4350 | |
| 4351 | pr_info("Stopping AP mode\n"); |
| 4352 | |
| 4353 | /*Make sure that pAdapter cleaned properly*/ |
| 4354 | hdd_stop_adapter( pHddCtx, pAdapter_to_stop ); |
| 4355 | hdd_deinit_adapter( pHddCtx, pAdapter_to_stop ); |
| 4356 | memset(&pAdapter_to_stop->sessionCtx, 0, sizeof(pAdapter_to_stop->sessionCtx)); |
| 4357 | |
| 4358 | wlan_hdd_release_intf_addr(WLAN_HDD_GET_CTX(pAdapter), |
| 4359 | pAdapter_to_stop->macAddressCurrent.bytes); |
| 4360 | hdd_close_adapter(WLAN_HDD_GET_CTX(pAdapter), pAdapter_to_stop, |
| 4361 | TRUE); |
| 4362 | } |
| 4363 | else |
| 4364 | { |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 4365 | printk(KERN_ERR"SAP adapter not found to stop it!\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4366 | } |
| 4367 | |
| 4368 | break; |
| 4369 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4370 | #ifdef WLAN_BTAMP_FEATURE |
| 4371 | case WE_ENABLE_AMP: |
| 4372 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4373 | 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] | 4374 | WLANBAP_RegisterWithHCI(pAdapter); |
| 4375 | break; |
| 4376 | } |
| 4377 | case WE_DISABLE_AMP: |
| 4378 | { |
| 4379 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 4380 | VOS_STATUS status; |
| 4381 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4382 | 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] | 4383 | |
| 4384 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 4385 | status = WLANBAP_StopAmp(); |
| 4386 | if(VOS_STATUS_SUCCESS != status ) |
| 4387 | { |
| 4388 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 4389 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 4390 | "%s: Failed to stop AMP", __func__); |
| 4391 | } |
| 4392 | else |
| 4393 | { |
| 4394 | //a state m/c implementation in PAL is TBD to avoid this delay |
| 4395 | msleep(500); |
| 4396 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 4397 | WLANBAP_DeregisterFromHCI(); |
| 4398 | } |
| 4399 | |
| 4400 | break; |
| 4401 | } |
| 4402 | #endif |
| 4403 | |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 4404 | case WE_ENABLE_DXE_STALL_DETECT: |
| 4405 | { |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 4406 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4407 | sme_transportDebug(hHal, VOS_FALSE, VOS_TRUE); |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 4408 | break; |
| 4409 | } |
| 4410 | case WE_DISPLAY_DXE_SNAP_SHOT: |
| 4411 | { |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 4412 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4413 | sme_transportDebug(hHal, VOS_TRUE, VOS_FALSE); |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 4414 | break; |
| 4415 | } |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 4416 | case WE_SET_REASSOC_TRIGGER: |
| 4417 | { |
| 4418 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4419 | tpAniSirGlobal pMac = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4420 | v_U32_t roamId = 0; |
| 4421 | tCsrRoamModifyProfileFields modProfileFields; |
| 4422 | sme_GetModifyProfileFields(pMac, pAdapter->sessionId, &modProfileFields); |
| 4423 | sme_RoamReassoc(pMac, pAdapter->sessionId, NULL, modProfileFields, &roamId, 1); |
| 4424 | return 0; |
| 4425 | } |
| 4426 | |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 4427 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4428 | default: |
| 4429 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4430 | hddLog(LOGE, "%s: unknown ioctl %d", __func__, sub_cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4431 | break; |
| 4432 | } |
| 4433 | } |
| 4434 | |
| 4435 | return ret; |
| 4436 | } |
| 4437 | |
| 4438 | int iw_set_var_ints_getnone(struct net_device *dev, struct iw_request_info *info, |
| 4439 | union iwreq_data *wrqu, char *extra) |
| 4440 | { |
| 4441 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4442 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4443 | int sub_cmd = wrqu->data.flags; |
| 4444 | int *value = (int*)wrqu->data.pointer; |
| 4445 | int apps_args[MAX_VAR_ARGS] = {0}; |
| 4446 | int num_args = wrqu->data.length; |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 4447 | hdd_station_ctx_t *pStaCtx = NULL ; |
| 4448 | hdd_ap_ctx_t *pAPCtx = NULL; |
| 4449 | int cmd = 0; |
| 4450 | int staId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4451 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4452 | hddLog(LOG1, "%s: Received length %d", __func__, wrqu->data.length); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4453 | |
| 4454 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4455 | { |
| 4456 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4457 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4458 | return -EBUSY; |
| 4459 | } |
| 4460 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4461 | if (num_args > MAX_VAR_ARGS) |
| 4462 | { |
| 4463 | num_args = MAX_VAR_ARGS; |
| 4464 | } |
| 4465 | vos_mem_copy(apps_args, value, (sizeof(int)) * num_args); |
| 4466 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 4467 | if(( sub_cmd == WE_MCC_CONFIG_CREDENTIAL ) || |
| 4468 | (sub_cmd == WE_MCC_CONFIG_PARAMS )) |
| 4469 | { |
| 4470 | if(( pAdapter->device_mode == WLAN_HDD_INFRA_STATION )|| |
| 4471 | ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT )) |
| 4472 | { |
| 4473 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4474 | staId = pStaCtx->conn_info.staId[0]; |
| 4475 | } |
| 4476 | else if (( pAdapter->device_mode == WLAN_HDD_P2P_GO ) || |
| 4477 | ( pAdapter->device_mode == WLAN_HDD_SOFTAP )) |
| 4478 | { |
| 4479 | pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 4480 | staId = pAPCtx->uBCStaId; |
| 4481 | } |
| 4482 | else |
| 4483 | { |
| 4484 | hddLog(LOGE, "%s: Device mode %d not recognised", __FUNCTION__, pAdapter->device_mode); |
| 4485 | return 0; |
| 4486 | } |
| 4487 | } |
| 4488 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4489 | switch (sub_cmd) |
| 4490 | { |
| 4491 | case WE_LOG_DUMP_CMD: |
| 4492 | { |
| 4493 | 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] | 4494 | __func__, apps_args[0], apps_args[1], apps_args[2], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4495 | apps_args[3], apps_args[4]); |
| 4496 | |
| 4497 | logPrintf(hHal, apps_args[0], apps_args[1], apps_args[2], |
| 4498 | apps_args[3], apps_args[4]); |
| 4499 | |
| 4500 | } |
| 4501 | break; |
| 4502 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4503 | case WE_P2P_NOA_CMD: |
| 4504 | { |
| 4505 | p2p_app_setP2pPs_t p2pNoA; |
| 4506 | |
| 4507 | p2pNoA.opp_ps = apps_args[0]; |
| 4508 | p2pNoA.ctWindow = apps_args[1]; |
| 4509 | p2pNoA.duration = apps_args[2]; |
| 4510 | p2pNoA.interval = apps_args[3]; |
| 4511 | p2pNoA.count = apps_args[4]; |
| 4512 | p2pNoA.single_noa_duration = apps_args[5]; |
| 4513 | p2pNoA.psSelection = apps_args[6]; |
| 4514 | |
| 4515 | hddLog(LOG1, "%s: P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d " |
| 4516 | "interval %d count %d single noa duration %d PsSelection %x", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4517 | __func__, apps_args[0], apps_args[1], apps_args[2], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4518 | apps_args[3], apps_args[4], apps_args[5], apps_args[6]); |
| 4519 | |
| 4520 | hdd_setP2pPs(dev, &p2pNoA); |
| 4521 | |
| 4522 | } |
| 4523 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4524 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 4525 | case WE_MCC_CONFIG_CREDENTIAL : |
| 4526 | { |
| 4527 | cmd = 287; //Command should be updated if there is any change |
| 4528 | // in the Riva dump command |
Kumar Anand | 90ca3dd | 2013-01-18 15:24:47 -0800 | [diff] [blame] | 4529 | if((apps_args[0] >= 40 ) && (apps_args[0] <= 160 )) |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 4530 | { |
| 4531 | logPrintf(hHal, cmd, staId, apps_args[0], apps_args[1], apps_args[2]); |
| 4532 | } |
| 4533 | else |
| 4534 | { |
Kumar Anand | 90ca3dd | 2013-01-18 15:24:47 -0800 | [diff] [blame] | 4535 | hddLog(LOGE, "%s : Enter valid MccCredential value between MIN :40 and MAX:160\n"); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 4536 | return 0; |
| 4537 | } |
| 4538 | } |
| 4539 | break; |
| 4540 | |
| 4541 | case WE_MCC_CONFIG_PARAMS : |
| 4542 | { |
| 4543 | cmd = 288; //command Should be updated if there is any change |
| 4544 | // in the Riva dump command |
| 4545 | hdd_validate_mcc_config(pAdapter, staId, apps_args[0], apps_args[1],apps_args[2]); |
| 4546 | } |
| 4547 | break; |
| 4548 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 4549 | #ifdef FEATURE_WLAN_TDLS |
| 4550 | case WE_TDLS_CONFIG_PARAMS : |
| 4551 | { |
| 4552 | tdls_config_params_t tdlsParams; |
| 4553 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 4554 | tdlsParams.tdls = apps_args[0]; |
| 4555 | tdlsParams.tx_period_t = apps_args[1]; |
| 4556 | tdlsParams.tx_packet_n = apps_args[2]; |
| 4557 | tdlsParams.discovery_period_t = apps_args[3]; |
| 4558 | tdlsParams.discovery_tries_n = apps_args[4]; |
| 4559 | tdlsParams.idle_timeout_t = apps_args[5]; |
| 4560 | tdlsParams.idle_packet_n = apps_args[6]; |
| 4561 | tdlsParams.rssi_hysteresis = apps_args[7]; |
| 4562 | tdlsParams.rssi_trigger_threshold = apps_args[8]; |
| 4563 | tdlsParams.rssi_teardown_threshold = apps_args[9]; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 4564 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 4565 | wlan_hdd_tdls_set_params(dev, &tdlsParams); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 4566 | } |
| 4567 | break; |
| 4568 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4569 | default: |
| 4570 | { |
| 4571 | hddLog(LOGE, "Invalid IOCTL command %d", sub_cmd ); |
| 4572 | } |
| 4573 | break; |
| 4574 | } |
| 4575 | |
| 4576 | return 0; |
| 4577 | } |
| 4578 | |
| 4579 | |
| 4580 | static int iw_add_tspec(struct net_device *dev, struct iw_request_info *info, |
| 4581 | union iwreq_data *wrqu, char *extra) |
| 4582 | { |
| 4583 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4584 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4585 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra; |
| 4586 | int params[HDD_WLAN_WMM_PARAM_COUNT]; |
| 4587 | sme_QosWmmTspecInfo tSpec; |
| 4588 | v_U32_t handle; |
| 4589 | |
| 4590 | // make sure the application is sufficiently priviledged |
| 4591 | // note that the kernel will do this for "set" ioctls, but since |
| 4592 | // this ioctl wants to return status to user space it must be |
| 4593 | // defined as a "get" ioctl |
| 4594 | if (!capable(CAP_NET_ADMIN)) |
| 4595 | { |
| 4596 | return -EPERM; |
| 4597 | } |
| 4598 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4599 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4600 | { |
| 4601 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4602 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4603 | return -EBUSY; |
| 4604 | } |
| 4605 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4606 | // we must be associated in order to add a tspec |
| 4607 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 4608 | { |
| 4609 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 4610 | return 0; |
| 4611 | } |
| 4612 | |
| 4613 | // since we are defined to be a "get" ioctl, and since the number |
| 4614 | // of params exceeds the number of params that wireless extensions |
| 4615 | // will pass down in the iwreq_data, we must copy the "set" params |
| 4616 | // from user space ourselves |
| 4617 | if (copy_from_user(¶ms, wrqu->data.pointer, sizeof(params))) |
| 4618 | { |
| 4619 | // hmmm, can't get them |
| 4620 | return -EIO; |
| 4621 | } |
| 4622 | |
| 4623 | // clear the tspec |
| 4624 | memset(&tSpec, 0, sizeof(tSpec)); |
| 4625 | |
| 4626 | // validate the handle |
| 4627 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 4628 | if (HDD_WMM_HANDLE_IMPLICIT == handle) |
| 4629 | { |
| 4630 | // that one is reserved |
| 4631 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 4632 | return 0; |
| 4633 | } |
| 4634 | |
| 4635 | // validate the TID |
| 4636 | if (params[HDD_WLAN_WMM_PARAM_TID] > 7) |
| 4637 | { |
| 4638 | // out of range |
| 4639 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 4640 | return 0; |
| 4641 | } |
| 4642 | tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID]; |
| 4643 | |
| 4644 | // validate the direction |
| 4645 | switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) |
| 4646 | { |
| 4647 | case HDD_WLAN_WMM_DIRECTION_UPSTREAM: |
| 4648 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK; |
| 4649 | break; |
| 4650 | |
| 4651 | case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM: |
| 4652 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK; |
| 4653 | break; |
| 4654 | |
| 4655 | case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL: |
| 4656 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH; |
| 4657 | break; |
| 4658 | |
| 4659 | default: |
| 4660 | // unknown |
| 4661 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 4662 | return 0; |
| 4663 | } |
| 4664 | |
| 4665 | // validate the user priority |
| 4666 | if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) |
| 4667 | { |
| 4668 | // out of range |
| 4669 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 4670 | return 0; |
| 4671 | } |
| 4672 | tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY]; |
| 4673 | |
| 4674 | tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE]; |
| 4675 | tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE]; |
| 4676 | tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE]; |
| 4677 | tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE]; |
| 4678 | tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE]; |
| 4679 | tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE]; |
| 4680 | tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE]; |
| 4681 | tSpec.surplus_bw_allowance = params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE]; |
| 4682 | tSpec.min_service_interval = params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL]; |
| 4683 | tSpec.max_service_interval = params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL]; |
| 4684 | tSpec.suspension_interval = params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL]; |
| 4685 | tSpec.inactivity_interval = params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL]; |
| 4686 | |
| 4687 | tSpec.ts_info.burst_size_defn = params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN]; |
| 4688 | |
| 4689 | // validate the ts info ack policy |
| 4690 | switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) |
| 4691 | { |
| 4692 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK: |
| 4693 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 4694 | break; |
| 4695 | |
| 4696 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK: |
| 4697 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK; |
| 4698 | break; |
| 4699 | |
| 4700 | default: |
| 4701 | // unknown |
| 4702 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 4703 | return 0; |
| 4704 | } |
| 4705 | |
| 4706 | *pStatus = hdd_wmm_addts(pAdapter, handle, &tSpec); |
| 4707 | return 0; |
| 4708 | } |
| 4709 | |
| 4710 | |
| 4711 | static int iw_del_tspec(struct net_device *dev, struct iw_request_info *info, |
| 4712 | union iwreq_data *wrqu, char *extra) |
| 4713 | { |
| 4714 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4715 | int *params = (int *)extra; |
| 4716 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra; |
| 4717 | v_U32_t handle; |
| 4718 | |
| 4719 | // make sure the application is sufficiently priviledged |
| 4720 | // note that the kernel will do this for "set" ioctls, but since |
| 4721 | // this ioctl wants to return status to user space it must be |
| 4722 | // defined as a "get" ioctl |
| 4723 | if (!capable(CAP_NET_ADMIN)) |
| 4724 | { |
| 4725 | return -EPERM; |
| 4726 | } |
| 4727 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4728 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4729 | { |
| 4730 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4731 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4732 | return -EBUSY; |
| 4733 | } |
| 4734 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4735 | // although we are defined to be a "get" ioctl, the params we require |
| 4736 | // will fit in the iwreq_data, therefore unlike iw_add_tspec() there |
| 4737 | // is no need to copy the params from user space |
| 4738 | |
| 4739 | // validate the handle |
| 4740 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 4741 | if (HDD_WMM_HANDLE_IMPLICIT == handle) |
| 4742 | { |
| 4743 | // that one is reserved |
| 4744 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 4745 | return 0; |
| 4746 | } |
| 4747 | |
| 4748 | *pStatus = hdd_wmm_delts(pAdapter, handle); |
| 4749 | return 0; |
| 4750 | } |
| 4751 | |
| 4752 | |
| 4753 | static int iw_get_tspec(struct net_device *dev, struct iw_request_info *info, |
| 4754 | union iwreq_data *wrqu, char *extra) |
| 4755 | { |
| 4756 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4757 | int *params = (int *)extra; |
| 4758 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra; |
| 4759 | v_U32_t handle; |
| 4760 | |
| 4761 | // although we are defined to be a "get" ioctl, the params we require |
| 4762 | // will fit in the iwreq_data, therefore unlike iw_add_tspec() there |
| 4763 | // is no need to copy the params from user space |
| 4764 | |
| 4765 | // validate the handle |
| 4766 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 4767 | if (HDD_WMM_HANDLE_IMPLICIT == handle) |
| 4768 | { |
| 4769 | // that one is reserved |
| 4770 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 4771 | return 0; |
| 4772 | } |
| 4773 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4774 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4775 | { |
| 4776 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4777 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4778 | return -EBUSY; |
| 4779 | } |
| 4780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4781 | *pStatus = hdd_wmm_checkts(pAdapter, handle); |
| 4782 | return 0; |
| 4783 | } |
| 4784 | |
| 4785 | |
| 4786 | #ifdef FEATURE_WLAN_WAPI |
| 4787 | static int iw_qcom_set_wapi_mode(struct net_device *dev, struct iw_request_info *info, |
| 4788 | union iwreq_data *wrqu, char *extra) |
| 4789 | { |
| 4790 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4791 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4792 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4793 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 4794 | |
| 4795 | WAPI_FUNCTION_MODE *pWapiMode = (WAPI_FUNCTION_MODE *)wrqu->data.pointer; |
| 4796 | |
| 4797 | hddLog(LOG1, "The function iw_qcom_set_wapi_mode called"); |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4798 | hddLog(LOG1, "%s: Received data %s", __func__, (char*)wrqu->data.pointer); |
| 4799 | hddLog(LOG1, "%s: Received length %d", __func__, wrqu->data.length); |
| 4800 | hddLog(LOG1, "%s: Input Data (wreq) WAPI Mode:%02d", __func__, pWapiMode->wapiMode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4801 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4802 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4803 | { |
| 4804 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4805 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4806 | return -EBUSY; |
| 4807 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4808 | |
| 4809 | if(WZC_ORIGINAL == pWapiMode->wapiMode) { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4810 | hddLog(LOG1, "%s: WAPI Mode Set to OFF", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4811 | /* Set Encryption mode to defualt , this allows next successfull non-WAPI Association */ |
| 4812 | pRoamProfile->EncryptionType.numEntries = 1; |
| 4813 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 4814 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 4815 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 4816 | |
| 4817 | pRoamProfile->AuthType.numEntries = 1; |
| 4818 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4819 | pRoamProfile->AuthType.authType[0] = pHddStaCtx->conn_info.authType; |
| 4820 | } |
| 4821 | else if(WAPI_EXTENTION == pWapiMode->wapiMode) { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4822 | hddLog(LOG1, "%s: WAPI Mode Set to ON", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4823 | } |
| 4824 | else |
| 4825 | return -EINVAL; |
| 4826 | |
| 4827 | pAdapter->wapi_info.nWapiMode = pWapiMode->wapiMode; |
| 4828 | |
| 4829 | return 0; |
| 4830 | } |
| 4831 | |
| 4832 | static int iw_qcom_get_wapi_mode(struct net_device *dev, struct iw_request_info *info, |
| 4833 | union iwreq_data *wrqu, char *extra) |
| 4834 | { |
| 4835 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4836 | WAPI_FUNCTION_MODE *pWapiMode = (WAPI_FUNCTION_MODE *)(extra); |
| 4837 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4838 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4839 | { |
| 4840 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4841 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4842 | return -EBUSY; |
| 4843 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4844 | hddLog(LOG1, "The function iw_qcom_get_wapi_mode called"); |
| 4845 | |
| 4846 | pWapiMode->wapiMode = pAdapter->wapi_info.nWapiMode; |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4847 | hddLog(LOG1, "%s: GET WAPI Mode Value:%02d", __func__, pWapiMode->wapiMode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4848 | printk("\nGET WAPI MODE:%d",pWapiMode->wapiMode); |
| 4849 | return 0; |
| 4850 | } |
| 4851 | |
| 4852 | static int iw_qcom_set_wapi_assoc_info(struct net_device *dev, struct iw_request_info *info, |
| 4853 | union iwreq_data *wrqu, char *extra) |
| 4854 | { |
| 4855 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4856 | // WAPI_AssocInfo *pWapiAssocInfo = (WAPI_AssocInfo *)(wrqu->data.pointer); |
| 4857 | WAPI_AssocInfo *pWapiAssocInfo = (WAPI_AssocInfo *)(extra); |
| 4858 | int i = 0, j = 0; |
| 4859 | hddLog(LOG1, "The function iw_qcom_set_wapi_assoc_info called"); |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4860 | hddLog(LOG1, "%s: Received length %d", __func__, wrqu->data.length); |
| 4861 | hddLog(LOG1, "%s: Received data %s", __func__, (char*)wrqu->data.pointer); |
| 4862 | hddLog(LOG1, "%s: Received data %s", __func__, (char*)extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4863 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4864 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4865 | { |
| 4866 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4867 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4868 | return -EBUSY; |
| 4869 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4870 | VOS_ASSERT(pWapiAssocInfo); |
| 4871 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4872 | hddLog(LOG1, "%s: INPUT DATA:\nElement ID:0x%02x Length:0x%02x Version:0x%04x\n",__func__,pWapiAssocInfo->elementID,pWapiAssocInfo->length,pWapiAssocInfo->version); |
| 4873 | hddLog(LOG1,"%s: akm Suite Cnt:0x%04x",__func__,pWapiAssocInfo->akmSuiteCount); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4874 | for(i =0 ; i < 16 ; i++) |
| 4875 | hddLog(LOG1,"akm suite[%02d]:0x%08lx",i,pWapiAssocInfo->akmSuite[i]); |
| 4876 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4877 | hddLog(LOG1,"%s: Unicast Suite Cnt:0x%04x",__func__,pWapiAssocInfo->unicastSuiteCount); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4878 | for(i =0 ; i < 16 ; i++) |
| 4879 | hddLog(LOG1, "Unicast suite[%02d]:0x%08lx",i,pWapiAssocInfo->unicastSuite[i]); |
| 4880 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4881 | hddLog(LOG1,"%s: Multicast suite:0x%08lx Wapi capa:0x%04x",__func__,pWapiAssocInfo->multicastSuite,pWapiAssocInfo->wapiCability); |
| 4882 | hddLog(LOG1, "%s: BKID Cnt:0x%04x\n",__func__,pWapiAssocInfo->bkidCount); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4883 | for(i = 0 ; i < 16 ; i++) { |
| 4884 | hddLog(LOG1, "BKID List[%02d].bkid:0x",i); |
| 4885 | for(j = 0 ; j < 16 ; j++) |
| 4886 | hddLog(LOG1,"%02x",pWapiAssocInfo->bkidList[i].bkid[j]); |
| 4887 | } |
| 4888 | |
| 4889 | /* We are not using the entire IE as provided by the supplicant. |
| 4890 | * This is being calculated by SME. This is the same as in the |
| 4891 | * case of WPA. Only the auth mode information needs to be |
| 4892 | * extracted here*/ |
| 4893 | if ( pWapiAssocInfo->akmSuite[0] == WAPI_PSK_AKM_SUITE ) { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4894 | hddLog(LOG1, "%s: WAPI AUTH MODE SET TO PSK",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4895 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
| 4896 | } |
| 4897 | |
| 4898 | if ( pWapiAssocInfo->akmSuite[0] == WAPI_CERT_AKM_SUITE) { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4899 | hddLog(LOG1, "%s: WAPI AUTH MODE SET TO CERTIFICATE",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4900 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 4901 | } |
| 4902 | return 0; |
| 4903 | } |
| 4904 | |
| 4905 | static int iw_qcom_set_wapi_key(struct net_device *dev, struct iw_request_info *info, |
| 4906 | union iwreq_data *wrqu, char *extra) |
| 4907 | { |
| 4908 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4909 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4910 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 4911 | tANI_U32 roamId = 0xFF; |
| 4912 | tANI_U8 *pKeyPtr = NULL; |
| 4913 | v_BOOL_t isConnected = TRUE; |
| 4914 | tCsrRoamSetKey setKey; |
| 4915 | int i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4916 | WLAN_WAPI_KEY *pWapiKey = (WLAN_WAPI_KEY *)(extra); |
| 4917 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4918 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 4919 | { |
| 4920 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 4921 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 4922 | return -EBUSY; |
| 4923 | } |
| 4924 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4925 | hddLog(LOG1, "The function iw_qcom_set_wapi_key called "); |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4926 | hddLog(LOG1, "%s: Received length %d", __func__, wrqu->data.length); |
| 4927 | hddLog(LOG1, "%s: Received data %s", __func__, (char*)wrqu->data.pointer); |
| 4928 | hddLog(LOG1, "%s: Received data %s", __func__, (char*)extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4929 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4930 | hddLog(LOG1,":s: INPUT DATA:\nKey Type:0x%02x Key Direction:0x%02x KEY ID:0x%02x\n", __func__,pWapiKey->keyType,pWapiKey->keyDirection,pWapiKey->keyId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4931 | hddLog(LOG1,"Add Index:0x"); |
| 4932 | for(i =0 ; i < 12 ; i++) |
| 4933 | hddLog(LOG1,"%02x",pWapiKey->addrIndex[i]); |
| 4934 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4935 | hddLog(LOG1,"\n%s: WAPI ENCRYPTION KEY LENGTH:0x%04x", __func__,pWapiKey->wpiekLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4936 | hddLog(LOG1, "WAPI ENCRYPTION KEY:0x"); |
| 4937 | for(i =0 ; i < 16 ; i++) |
| 4938 | hddLog(LOG1,"%02x",pWapiKey->wpiek[i]); |
| 4939 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4940 | hddLog(LOG1,"\n%s: WAPI INTEGRITY CHECK KEY LENGTH:0x%04x", __func__,pWapiKey->wpickLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4941 | hddLog(LOG1,"WAPI INTEGRITY CHECK KEY:0x"); |
| 4942 | for(i =0 ; i < 16 ; i++) |
| 4943 | hddLog(LOG1,"%02x",pWapiKey->wpick[i]); |
| 4944 | |
| 4945 | hddLog(LOG1,"\nWAPI PN NUMBER:0x"); |
| 4946 | for(i = 0 ; i < 16 ; i++) |
| 4947 | hddLog(LOG1,"%02x",pWapiKey->pn[i]); |
| 4948 | |
| 4949 | // Clear the setkey memory |
| 4950 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 4951 | // Store Key ID |
| 4952 | setKey.keyId = (unsigned char)( pWapiKey->keyId ); |
| 4953 | // SET WAPI Encryption |
| 4954 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; |
| 4955 | // Key Directionn both TX and RX |
| 4956 | setKey.keyDirection = eSIR_TX_RX; // Do WE NEED to update this based on Key Type as GRP/UNICAST?? |
| 4957 | // the PAE role |
| 4958 | setKey.paeRole = 0 ; |
| 4959 | |
| 4960 | switch ( pWapiKey->keyType ) |
| 4961 | { |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 4962 | case PAIRWISE_KEY: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4963 | { |
| 4964 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 4965 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 4966 | break; |
| 4967 | } |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 4968 | case GROUP_KEY: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4969 | { |
| 4970 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 4971 | break; |
| 4972 | } |
| 4973 | default: |
| 4974 | { |
| 4975 | //Any other option is invalid. |
| 4976 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4977 | "[%4d] %s() failed to Set Key. Invalid key type %d", __LINE__,__func__ , -1 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4978 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4979 | hddLog(LOGE," %s: Error WAPI Key Add Type",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4980 | halStatus = !eHAL_STATUS_SUCCESS; // NEED TO UPDATE THIS WITH CORRECT VALUE |
| 4981 | break; // NEED RETURN FROM HERE ???? |
| 4982 | } |
| 4983 | } |
| 4984 | |
| 4985 | // Concatenating the Encryption Key (EK) and the MIC key (CK): EK followed by CK |
| 4986 | setKey.keyLength = (v_U16_t)((pWapiKey->wpiekLen)+(pWapiKey->wpickLen)); |
| 4987 | pKeyPtr = setKey.Key; |
| 4988 | memcpy( pKeyPtr, pWapiKey->wpiek, pWapiKey->wpiekLen ); |
| 4989 | pKeyPtr += pWapiKey->wpiekLen; |
| 4990 | memcpy( pKeyPtr, pWapiKey->wpick, pWapiKey->wpickLen ); |
| 4991 | |
| 4992 | // Set the new key with SME. |
| 4993 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 4994 | |
| 4995 | if ( isConnected ) { |
| 4996 | halStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &setKey, &roamId ); |
| 4997 | if ( halStatus != eHAL_STATUS_SUCCESS ) |
| 4998 | { |
| 4999 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5000 | "[%4d] sme_RoamSetKey returned ERROR status= %d", __LINE__, halStatus ); |
| 5001 | |
| 5002 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 5003 | } |
| 5004 | } |
| 5005 | #if 0 /// NEED TO CHECK ON THIS |
| 5006 | else |
| 5007 | { |
| 5008 | // Store the keys in the adapter to be moved to the profile & passed to |
| 5009 | // SME in the ConnectRequest if we are not yet in connected state. |
| 5010 | memcpy( &pAdapter->setKey[ setKey.keyId ], &setKey, sizeof( setKey ) ); |
| 5011 | pAdapter->fKeySet[ setKey.keyId ] = TRUE; |
| 5012 | |
| 5013 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_MED, |
| 5014 | " Saving key [idx= %d] to apply when moving to connected state ", |
| 5015 | setKey.keyId ); |
| 5016 | |
| 5017 | } |
| 5018 | #endif |
| 5019 | return halStatus; |
| 5020 | } |
| 5021 | |
| 5022 | static int iw_qcom_set_wapi_bkid(struct net_device *dev, struct iw_request_info *info, |
| 5023 | union iwreq_data *wrqu, char *extra) |
| 5024 | { |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5025 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5026 | #ifdef WLAN_DEBUG |
| 5027 | int i = 0; |
| 5028 | WLAN_BKID_LIST *pBkid = ( WLAN_BKID_LIST *) (wrqu->data.pointer); |
| 5029 | #endif |
| 5030 | |
| 5031 | hddLog(LOG1, "The function iw_qcom_set_wapi_bkid called"); |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5032 | hddLog(LOG1, "%s: Received length %d", __func__, wrqu->data.length); |
| 5033 | hddLog(LOG1, "%s: Received data %s", __func__, (char*)wrqu->data.pointer); |
| 5034 | hddLog(LOG1, "%s: Received data %s", __func__, (char*)extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5035 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5036 | hddLog(LOG1,"%s: INPUT DATA:\n BKID Length:0x%08lx\n", __func__,pBkid->length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5037 | hddLog(LOG1,"%s: BKID Cnt:0x%04lx",pBkid->BKIDCount); |
| 5038 | |
| 5039 | hddLog(LOG1,"BKID KEY LIST[0]:0x"); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5040 | |
| 5041 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 5042 | { |
| 5043 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5044 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 5045 | return -EBUSY; |
| 5046 | } |
| 5047 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5048 | #ifdef WLAN_DEBUG |
| 5049 | for(i =0 ; i < 16 ; i++) |
| 5050 | hddLog(LOG1,"%02x",pBkid->BKID[0].bkid[i]); |
| 5051 | #endif |
| 5052 | |
| 5053 | return 0; |
| 5054 | } |
| 5055 | |
| 5056 | static int iw_qcom_get_wapi_bkid(struct net_device *dev, struct iw_request_info *info, |
| 5057 | union iwreq_data *wrqu, char *extra) |
| 5058 | { |
| 5059 | /* Yet to implement this function, 19th April 2010 */ |
| 5060 | hddLog(LOG1, "The function iw_qcom_get_wapi_bkid called "); |
| 5061 | |
| 5062 | return 0; |
| 5063 | } |
| 5064 | #endif /* FEATURE_WLAN_WAPI */ |
| 5065 | |
| 5066 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5067 | // |
| 5068 | // |
| 5069 | // Each time the supplicant has the auth_request or reassoc request |
| 5070 | // IEs ready. This is pushed to the driver. The driver will inturn use |
| 5071 | // it to send out the auth req and reassoc req for 11r FT Assoc. |
| 5072 | // |
| 5073 | static int iw_set_fties(struct net_device *dev, struct iw_request_info *info, |
| 5074 | union iwreq_data *wrqu, char *extra) |
| 5075 | { |
| 5076 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5077 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5078 | //v_CONTEXT_t pVosContext; |
| 5079 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5080 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 5081 | { |
| 5082 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5083 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 5084 | return -EBUSY; |
| 5085 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5086 | if (!wrqu->data.length) |
| 5087 | { |
| 5088 | hddLog(LOGE, FL("%s called with 0 length IEs\n")); |
| 5089 | return -EINVAL; |
| 5090 | } |
| 5091 | if (wrqu->data.pointer == NULL) |
| 5092 | { |
| 5093 | hddLog(LOGE, FL("%s called with NULL IE\n")); |
| 5094 | return -EINVAL; |
| 5095 | } |
| 5096 | |
| 5097 | // Added for debug on reception of Re-assoc Req. |
| 5098 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 5099 | { |
| 5100 | hddLog(LOGE, FL("Called with Ie of length = %d when not associated\n"), |
| 5101 | wrqu->data.length); |
| 5102 | hddLog(LOGE, FL("Should be Re-assoc Req IEs\n")); |
| 5103 | } |
| 5104 | |
| 5105 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
| 5106 | hddLog(LOGE, FL("%s called with Ie of length = %d\n"), __func__, wrqu->data.length); |
| 5107 | #endif |
| 5108 | |
| 5109 | // Pass the received FT IEs to SME |
| 5110 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, wrqu->data.pointer, |
| 5111 | wrqu->data.length); |
| 5112 | |
| 5113 | return 0; |
| 5114 | } |
| 5115 | #endif |
| 5116 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5117 | static int iw_set_dynamic_mcbc_filter(struct net_device *dev, |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5118 | struct iw_request_info *info, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5119 | union iwreq_data *wrqu, char *extra) |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5120 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5121 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5122 | tpRcvFltMcAddrList pRequest = (tpRcvFltMcAddrList)wrqu->data.pointer; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5123 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5124 | tpSirWlanSetRxpFilters wlanRxpFilterParam; |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5125 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyyalamudi | 51d87f7 | 2012-09-24 12:05:23 -0700 | [diff] [blame] | 5126 | VOS_STATUS vstatus = VOS_STATUS_E_FAILURE; |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5127 | tpSirRcvFltMcAddrList mc_addr_list_ptr; |
| 5128 | int idx; |
| 5129 | eHalStatus ret_val; |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 5130 | tANI_U8 mcastBcastFilterSetting; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5131 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5132 | if (pHddCtx->isLogpInProgress) |
| 5133 | { |
| 5134 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5135 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 5136 | return -EBUSY; |
| 5137 | } |
| 5138 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5139 | if (HDD_MULTICAST_FILTER_LIST == pRequest->mcastBcastFilterSetting) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5140 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5141 | mc_addr_list_ptr = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
| 5142 | if (NULL == mc_addr_list_ptr) |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5143 | { |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5144 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5145 | "%s: vos_mem_alloc failed", __func__); |
| 5146 | return -ENOMEM; |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5147 | } |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5148 | |
| 5149 | mc_addr_list_ptr->ulMulticastAddrCnt = pRequest->mcast_addr_cnt; |
| 5150 | |
| 5151 | if (mc_addr_list_ptr->ulMulticastAddrCnt > HDD_MAX_NUM_MULTICAST_ADDRESS) |
| 5152 | mc_addr_list_ptr->ulMulticastAddrCnt = HDD_MAX_NUM_MULTICAST_ADDRESS; |
| 5153 | |
| 5154 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s MC Addr List Cnt %d", __func__, |
| 5155 | mc_addr_list_ptr->ulMulticastAddrCnt); |
| 5156 | |
| 5157 | for (idx = 0; idx < mc_addr_list_ptr->ulMulticastAddrCnt; idx++) |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5158 | { |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5159 | memcpy(&mc_addr_list_ptr->multicastAddr[idx], |
| 5160 | pRequest->multicastAddr[idx], HDD_WLAN_MAC_ADDR_LEN); |
| 5161 | |
| 5162 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s MC Addr for Idx %d ="MAC_ADDRESS_STR, __func__, |
| 5163 | idx, MAC_ADDR_ARRAY(mc_addr_list_ptr->multicastAddr[idx])); |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5164 | } |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5165 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5166 | ret_val = sme_8023MulticastList(hHal, pAdapter->sessionId, mc_addr_list_ptr); |
| 5167 | vos_mem_free(mc_addr_list_ptr); |
| 5168 | if (eHAL_STATUS_SUCCESS != ret_val) |
| 5169 | { |
| 5170 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to Set MC Address List", |
| 5171 | __func__); |
| 5172 | return -EINVAL; |
| 5173 | } |
| 5174 | } else { |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5175 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5176 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 5177 | "%s: Set MC BC Filter Config request: %d suspend %d", |
| 5178 | __func__, pRequest->mcastBcastFilterSetting, |
| 5179 | pHddCtx->hdd_wlan_suspended); |
| 5180 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5181 | pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting = |
| 5182 | pRequest->mcastBcastFilterSetting; |
| 5183 | pHddCtx->dynamic_mcbc_filter.enableCfg = TRUE; |
| 5184 | |
| 5185 | if (pHddCtx->hdd_wlan_suspended) |
| 5186 | { |
Jeff Johnson | ce3d75e | 2013-04-05 22:34:54 -0700 | [diff] [blame^] | 5187 | wlanRxpFilterParam = vos_mem_malloc(sizeof(tSirWlanSetRxpFilters)); |
| 5188 | if (NULL == wlanRxpFilterParam) |
| 5189 | { |
| 5190 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 5191 | "%s: vos_mem_alloc failed", __func__); |
| 5192 | return -EINVAL; |
| 5193 | } |
| 5194 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5195 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 5196 | pRequest->mcastBcastFilterSetting; |
| 5197 | wlanRxpFilterParam->setMcstBcstFilter = TRUE; |
| 5198 | |
| 5199 | if ((pHddCtx->cfg_ini->fhostArpOffload) && |
| 5200 | (eConnectionState_Associated == |
| 5201 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 5202 | { |
| 5203 | vstatus = hdd_conf_hostarpoffload(pAdapter, TRUE); |
| 5204 | if (!VOS_IS_STATUS_SUCCESS(vstatus)) |
| 5205 | { |
| 5206 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5207 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
| 5208 | __func__, vstatus); |
| 5209 | } |
| 5210 | else |
| 5211 | { |
| 5212 | if (HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST == |
| 5213 | pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting) |
| 5214 | { |
| 5215 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 5216 | HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST; |
| 5217 | } |
| 5218 | else if (HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST == |
| 5219 | pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting) |
| 5220 | { |
| 5221 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 5222 | HDD_MCASTBCASTFILTER_FILTER_NONE; |
| 5223 | } |
| 5224 | } |
| 5225 | } |
| 5226 | |
| 5227 | hddLog(VOS_TRACE_LEVEL_INFO, "%s:MC/BC changed Req %d Set %d En %d", |
| 5228 | __func__, |
| 5229 | pHddCtx->dynamic_mcbc_filter.mcastBcastFilterSetting, |
| 5230 | wlanRxpFilterParam->configuredMcstBcstFilterSetting, |
| 5231 | wlanRxpFilterParam->setMcstBcstFilter); |
| 5232 | |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 5233 | mcastBcastFilterSetting = wlanRxpFilterParam->configuredMcstBcstFilterSetting; |
| 5234 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5235 | if (eHAL_STATUS_SUCCESS != sme_ConfigureRxpFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5236 | wlanRxpFilterParam)) |
| 5237 | { |
| 5238 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5239 | "%s: Failure to execute set HW MC/BC Filter request", |
| 5240 | __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 5241 | vos_mem_free(wlanRxpFilterParam); |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5242 | return -EINVAL; |
| 5243 | } |
| 5244 | |
| 5245 | pHddCtx->dynamic_mcbc_filter.mcBcFilterSuspend = |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 5246 | mcastBcastFilterSetting; |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 5247 | } |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5248 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5249 | |
| 5250 | return 0; |
| 5251 | } |
| 5252 | |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 5253 | static int iw_clear_dynamic_mcbc_filter(struct net_device *dev, |
| 5254 | struct iw_request_info *info, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5255 | union iwreq_data *wrqu, char *extra) |
| 5256 | { |
| 5257 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5258 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5259 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5260 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: ", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5261 | |
| 5262 | pHddCtx->dynamic_mcbc_filter.enableCfg = FALSE; |
| 5263 | |
| 5264 | return 0; |
| 5265 | } |
| 5266 | |
| 5267 | static int iw_set_host_offload(struct net_device *dev, struct iw_request_info *info, |
| 5268 | union iwreq_data *wrqu, char *extra) |
| 5269 | { |
| 5270 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5271 | tpHostOffloadRequest pRequest = (tpHostOffloadRequest)wrqu->data.pointer; |
| 5272 | tSirHostOffloadReq offloadRequest; |
| 5273 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5274 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 5275 | { |
| 5276 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5277 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 5278 | return -EBUSY; |
| 5279 | } |
| 5280 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5281 | /* Debug display of request components. */ |
| 5282 | switch (pRequest->offloadType) |
| 5283 | { |
| 5284 | case WLAN_IPV4_ARP_REPLY_OFFLOAD: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5285 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Host offload request: ARP reply", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5286 | switch (pRequest->enableOrDisable) |
| 5287 | { |
| 5288 | case WLAN_OFFLOAD_DISABLE: |
| 5289 | hddLog(VOS_TRACE_LEVEL_WARN, " disable"); |
| 5290 | break; |
| 5291 | case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE: |
| 5292 | hddLog(VOS_TRACE_LEVEL_WARN, " BC Filtering enable"); |
| 5293 | case WLAN_OFFLOAD_ENABLE: |
| 5294 | hddLog(VOS_TRACE_LEVEL_WARN, " ARP offload enable"); |
| 5295 | hddLog(VOS_TRACE_LEVEL_WARN, " IP address: %d.%d.%d.%d", |
| 5296 | pRequest->params.hostIpv4Addr[0], pRequest->params.hostIpv4Addr[1], |
| 5297 | pRequest->params.hostIpv4Addr[2], pRequest->params.hostIpv4Addr[3]); |
| 5298 | } |
| 5299 | break; |
| 5300 | |
| 5301 | case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD: |
| 5302 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Host offload request: neighbor discovery\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5303 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5304 | switch (pRequest->enableOrDisable) |
| 5305 | { |
| 5306 | case WLAN_OFFLOAD_DISABLE: |
| 5307 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " disable"); |
| 5308 | break; |
| 5309 | case WLAN_OFFLOAD_ENABLE: |
| 5310 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " enable"); |
| 5311 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " IP address: %x:%x:%x:%x:%x:%x:%x:%x", |
| 5312 | *(v_U16_t *)(pRequest->params.hostIpv6Addr), |
| 5313 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 2), |
| 5314 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 4), |
| 5315 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 6), |
| 5316 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 8), |
| 5317 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 10), |
| 5318 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 12), |
| 5319 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 14)); |
| 5320 | } |
| 5321 | } |
| 5322 | |
| 5323 | /* Execute offload request. The reason that we can copy the request information |
| 5324 | from the ioctl structure to the SME structure is that they are laid out |
| 5325 | exactly the same. Otherwise, each piece of information would have to be |
| 5326 | copied individually. */ |
| 5327 | memcpy(&offloadRequest, pRequest, wrqu->data.length); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5328 | if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5329 | pAdapter->sessionId, &offloadRequest)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5330 | { |
| 5331 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute host offload request\n", |
| 5332 | __func__); |
| 5333 | return -EINVAL; |
| 5334 | } |
| 5335 | |
| 5336 | return 0; |
| 5337 | } |
| 5338 | |
| 5339 | static int iw_set_keepalive_params(struct net_device *dev, struct iw_request_info *info, |
| 5340 | union iwreq_data *wrqu, char *extra) |
| 5341 | { |
| 5342 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5343 | tpKeepAliveRequest pRequest = (tpKeepAliveRequest)wrqu->data.pointer; |
| 5344 | tSirKeepAliveReq keepaliveRequest; |
| 5345 | |
| 5346 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 5347 | { |
| 5348 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5349 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5350 | return 0; |
| 5351 | } |
| 5352 | |
| 5353 | /* Debug display of request components. */ |
| 5354 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Set Keep Alive Request : TimePeriod %d size %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5355 | __func__,pRequest->timePeriod, sizeof(tKeepAliveRequest)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5356 | |
| 5357 | switch (pRequest->packetType) |
| 5358 | { |
| 5359 | case WLAN_KEEP_ALIVE_NULL_PKT: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5360 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Keep Alive Request: Tx NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5361 | break; |
| 5362 | |
| 5363 | case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP: |
| 5364 | |
| 5365 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Keep Alive Request: Tx UnSolicited ARP RSP\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5366 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5367 | |
| 5368 | hddLog(VOS_TRACE_LEVEL_WARN, " Host IP address: %d.%d.%d.%d", |
| 5369 | pRequest->hostIpv4Addr[0], pRequest->hostIpv4Addr[1], |
| 5370 | pRequest->hostIpv4Addr[2], pRequest->hostIpv4Addr[3]); |
| 5371 | |
| 5372 | hddLog(VOS_TRACE_LEVEL_WARN, " Dest IP address: %d.%d.%d.%d", |
| 5373 | pRequest->destIpv4Addr[0], pRequest->destIpv4Addr[1], |
| 5374 | pRequest->destIpv4Addr[2], pRequest->destIpv4Addr[3]); |
| 5375 | |
| 5376 | hddLog(VOS_TRACE_LEVEL_WARN, " Dest MAC address: %d:%d:%d:%d:%d:%d", |
| 5377 | pRequest->destMacAddr[0], pRequest->destMacAddr[1], |
| 5378 | pRequest->destMacAddr[2], pRequest->destMacAddr[3], |
| 5379 | pRequest->destMacAddr[4], pRequest->destMacAddr[5]); |
| 5380 | break; |
| 5381 | |
| 5382 | } |
| 5383 | |
| 5384 | /* Execute keep alive request. The reason that we can copy the request information |
| 5385 | from the ioctl structure to the SME structure is that they are laid out |
| 5386 | exactly the same. Otherwise, each piece of information would have to be |
| 5387 | copied individually. */ |
| 5388 | memcpy(&keepaliveRequest, pRequest, wrqu->data.length); |
| 5389 | |
| 5390 | hddLog(VOS_TRACE_LEVEL_ERROR, "set Keep: TP before SME %d\n", keepaliveRequest.timePeriod); |
| 5391 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5392 | if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5393 | pAdapter->sessionId, &keepaliveRequest)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5394 | { |
| 5395 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Keep Alive\n", |
| 5396 | __func__); |
| 5397 | return -EINVAL; |
| 5398 | } |
| 5399 | |
| 5400 | return 0; |
| 5401 | } |
| 5402 | |
| 5403 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5404 | int wlan_hdd_set_filter(hdd_context_t *pHddCtx, tpPacketFilterCfg pRequest, |
| 5405 | tANI_U8 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5406 | { |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5407 | tSirRcvPktFilterCfgType packetFilterSetReq = {0}; |
| 5408 | tSirRcvFltPktClearParam packetFilterClrReq = {0}; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5409 | int i=0; |
| 5410 | |
| 5411 | if (pHddCtx->cfg_ini->disablePacketFilter) |
| 5412 | { |
| 5413 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Packet Filtering Disabled. Returning ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5414 | __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5415 | return 0; |
| 5416 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5417 | if (pHddCtx->isLogpInProgress) |
| 5418 | { |
| 5419 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 5420 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 5421 | return -EBUSY; |
| 5422 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5423 | /* Debug display of request components. */ |
| 5424 | 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] | 5425 | __func__, pRequest->filterAction, pRequest->numParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5426 | |
| 5427 | switch (pRequest->filterAction) |
| 5428 | { |
| 5429 | case HDD_RCV_FILTER_SET: |
| 5430 | 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] | 5431 | __func__, pRequest->filterId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5432 | |
| 5433 | packetFilterSetReq.filterId = pRequest->filterId; |
| 5434 | if ( pRequest->numParams >= HDD_MAX_CMP_PER_PACKET_FILTER) |
| 5435 | { |
| 5436 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Number of Params exceed Max limit %d\n", |
| 5437 | __func__, pRequest->numParams); |
| 5438 | return -EINVAL; |
| 5439 | } |
| 5440 | packetFilterSetReq.numFieldParams = pRequest->numParams; |
| 5441 | packetFilterSetReq.coalesceTime = 0; |
| 5442 | packetFilterSetReq.filterType = 1; |
| 5443 | for (i=0; i < pRequest->numParams; i++) |
| 5444 | { |
| 5445 | packetFilterSetReq.paramsData[i].protocolLayer = pRequest->paramsData[i].protocolLayer; |
| 5446 | packetFilterSetReq.paramsData[i].cmpFlag = pRequest->paramsData[i].cmpFlag; |
| 5447 | packetFilterSetReq.paramsData[i].dataOffset = pRequest->paramsData[i].dataOffset; |
| 5448 | packetFilterSetReq.paramsData[i].dataLength = pRequest->paramsData[i].dataLength; |
| 5449 | packetFilterSetReq.paramsData[i].reserved = 0; |
| 5450 | |
| 5451 | hddLog(VOS_TRACE_LEVEL_INFO, "Proto %d Comp Flag %d Filter Type\n", |
| 5452 | pRequest->paramsData[i].protocolLayer, pRequest->paramsData[i].cmpFlag, |
| 5453 | packetFilterSetReq.filterType); |
| 5454 | |
| 5455 | hddLog(VOS_TRACE_LEVEL_INFO, "Data Offset %d Data Len %d\n", |
| 5456 | pRequest->paramsData[i].dataOffset, pRequest->paramsData[i].dataLength); |
| 5457 | |
| 5458 | memcpy(&packetFilterSetReq.paramsData[i].compareData, |
| 5459 | pRequest->paramsData[i].compareData, pRequest->paramsData[i].dataLength); |
| 5460 | memcpy(&packetFilterSetReq.paramsData[i].dataMask, |
| 5461 | pRequest->paramsData[i].dataMask, pRequest->paramsData[i].dataLength); |
| 5462 | |
| 5463 | hddLog(VOS_TRACE_LEVEL_INFO, "CData %d CData %d CData %d CData %d CData %d CData %d\n", |
| 5464 | pRequest->paramsData[i].compareData[0], pRequest->paramsData[i].compareData[1], |
| 5465 | pRequest->paramsData[i].compareData[2], pRequest->paramsData[i].compareData[3], |
| 5466 | pRequest->paramsData[i].compareData[4], pRequest->paramsData[i].compareData[5]); |
| 5467 | |
| 5468 | hddLog(VOS_TRACE_LEVEL_INFO, "MData %d MData %d MData %d MData %d MData %d MData %d\n", |
| 5469 | pRequest->paramsData[i].dataMask[0], pRequest->paramsData[i].dataMask[1], |
| 5470 | pRequest->paramsData[i].dataMask[2], pRequest->paramsData[i].dataMask[3], |
| 5471 | pRequest->paramsData[i].dataMask[4], pRequest->paramsData[i].dataMask[5]); |
| 5472 | } |
| 5473 | |
Madan Mohan Koyyalamudi | 59a40c9 | 2012-09-24 14:13:16 -0700 | [diff] [blame] | 5474 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, &packetFilterSetReq, sessionId)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5475 | { |
| 5476 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Set Filter\n", |
| 5477 | __func__); |
| 5478 | return -EINVAL; |
| 5479 | } |
| 5480 | |
| 5481 | break; |
| 5482 | |
| 5483 | case HDD_RCV_FILTER_CLEAR: |
| 5484 | |
| 5485 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Clear Packet Filter Request for Id: %d\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5486 | __func__, pRequest->filterId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5487 | packetFilterClrReq.filterId = pRequest->filterId; |
Madan Mohan Koyyalamudi | 59a40c9 | 2012-09-24 14:13:16 -0700 | [diff] [blame] | 5488 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx->hHal, &packetFilterClrReq, sessionId)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5489 | { |
| 5490 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Clear Filter\n", |
| 5491 | __func__); |
| 5492 | return -EINVAL; |
| 5493 | } |
| 5494 | break; |
| 5495 | |
| 5496 | default : |
| 5497 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Packet Filter Request: Invalid %d\n", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5498 | __func__, pRequest->filterAction); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5499 | return -EINVAL; |
| 5500 | } |
| 5501 | return 0; |
| 5502 | } |
| 5503 | |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 5504 | 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] | 5505 | { |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 5506 | v_U8_t filterAction; |
| 5507 | tPacketFilterCfg request; |
| 5508 | v_U8_t i; |
| 5509 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5510 | |
| 5511 | filterAction = set ? HDD_RCV_FILTER_SET : HDD_RCV_FILTER_CLEAR; |
| 5512 | |
| 5513 | /*set mulitcast addr list*/ |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 5514 | for (i = 0; i < pAdapter->mc_addr_list.mc_cnt; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5515 | { |
| 5516 | memset(&request, 0, sizeof (tPacketFilterCfg)); |
| 5517 | request.filterAction = filterAction; |
| 5518 | request.filterId = i; |
| 5519 | if (set) |
| 5520 | { |
| 5521 | request.numParams = 1; |
| 5522 | request.paramsData[0].protocolLayer = HDD_FILTER_PROTO_TYPE_MAC; |
| 5523 | request.paramsData[0].cmpFlag = HDD_FILTER_CMP_TYPE_EQUAL; |
| 5524 | request.paramsData[0].dataOffset = WLAN_HDD_80211_FRM_DA_OFFSET; |
| 5525 | request.paramsData[0].dataLength = ETH_ALEN; |
| 5526 | memcpy(&(request.paramsData[0].compareData[0]), |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 5527 | &(pAdapter->mc_addr_list.addr[i][0]), ETH_ALEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5528 | /*set mulitcast filters*/ |
| 5529 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5530 | "%s: %s multicast filter: addr =" |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 5531 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5532 | __func__, set ? "setting" : "clearing", |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 5533 | MAC_ADDR_ARRAY(request.paramsData[0].compareData)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5534 | } |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 5535 | wlan_hdd_set_filter(pHddCtx, &request, pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5536 | } |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 5537 | pAdapter->mc_addr_list.isFilterApplied = set ? TRUE : FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5538 | } |
| 5539 | |
| 5540 | static int iw_set_packet_filter_params(struct net_device *dev, struct iw_request_info *info, |
| 5541 | union iwreq_data *wrqu, char *extra) |
| 5542 | { |
| 5543 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5544 | tpPacketFilterCfg pRequest = (tpPacketFilterCfg)wrqu->data.pointer; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5545 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5546 | return wlan_hdd_set_filter(WLAN_HDD_GET_CTX(pAdapter), pRequest, pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5547 | } |
| 5548 | #endif |
| 5549 | static int iw_get_statistics(struct net_device *dev, |
| 5550 | struct iw_request_info *info, |
| 5551 | union iwreq_data *wrqu, char *extra) |
| 5552 | { |
| 5553 | |
| 5554 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 5555 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5556 | hdd_wext_state_t *pWextState; |
| 5557 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5558 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5559 | char *p = extra; |
| 5560 | int tlen = 0; |
| 5561 | tCsrSummaryStatsInfo *pStats = &(pAdapter->hdd_stats.summary_stat); |
| 5562 | |
| 5563 | tCsrGlobalClassAStatsInfo *aStats = &(pAdapter->hdd_stats.ClassA_stat); |
| 5564 | tCsrGlobalClassDStatsInfo *dStats = &(pAdapter->hdd_stats.ClassD_stat); |
| 5565 | |
| 5566 | ENTER(); |
| 5567 | |
| 5568 | if (pHddCtx->isLogpInProgress) { |
| 5569 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 5570 | return -EINVAL; |
| 5571 | } |
| 5572 | |
| 5573 | if (eConnectionState_Associated != (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) { |
| 5574 | |
| 5575 | wrqu->txpower.value = 0; |
| 5576 | } |
| 5577 | else { |
| 5578 | status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD, |
| 5579 | SME_SUMMARY_STATS | |
| 5580 | SME_GLOBAL_CLASSA_STATS | |
| 5581 | SME_GLOBAL_CLASSB_STATS | |
| 5582 | SME_GLOBAL_CLASSC_STATS | |
| 5583 | SME_GLOBAL_CLASSD_STATS | |
| 5584 | SME_PER_STA_STATS, |
| 5585 | hdd_StatisticsCB, 0, FALSE, |
| 5586 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter ); |
| 5587 | |
| 5588 | if (eHAL_STATUS_SUCCESS != status) |
| 5589 | { |
| 5590 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5591 | "%s: Unable to retrieve SME statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5592 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5593 | return -EINVAL; |
| 5594 | } |
| 5595 | |
| 5596 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5597 | |
| 5598 | vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS); |
| 5599 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 5600 | { |
| 5601 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5602 | "%s: SME timeout while retrieving statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5603 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5604 | /*Remove the SME statistics list by passing NULL in callback argument*/ |
| 5605 | status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD, |
| 5606 | SME_SUMMARY_STATS | |
| 5607 | SME_GLOBAL_CLASSA_STATS | |
| 5608 | SME_GLOBAL_CLASSB_STATS | |
| 5609 | SME_GLOBAL_CLASSC_STATS | |
| 5610 | SME_GLOBAL_CLASSD_STATS | |
| 5611 | SME_PER_STA_STATS, |
| 5612 | NULL, 0, FALSE, |
| 5613 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter ); |
| 5614 | |
| 5615 | return -EINVAL; |
| 5616 | } |
| 5617 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RETRY_CNT, |
| 5618 | (tANI_U8) sizeof (pStats->retry_cnt), |
| 5619 | (char*) &(pStats->retry_cnt[0]), |
| 5620 | tlen); |
| 5621 | |
| 5622 | FILL_TLV(p, (tANI_U8)WLAN_STATS_MUL_RETRY_CNT, |
| 5623 | (tANI_U8) sizeof (pStats->multiple_retry_cnt), |
| 5624 | (char*) &(pStats->multiple_retry_cnt[0]), |
| 5625 | tlen); |
| 5626 | |
| 5627 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_FRM_CNT, |
| 5628 | (tANI_U8) sizeof (pStats->tx_frm_cnt), |
| 5629 | (char*) &(pStats->tx_frm_cnt[0]), |
| 5630 | tlen); |
| 5631 | |
| 5632 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_FRM_CNT, |
| 5633 | (tANI_U8) sizeof (pStats->rx_frm_cnt), |
| 5634 | (char*) &(pStats->rx_frm_cnt), |
| 5635 | tlen); |
| 5636 | |
| 5637 | FILL_TLV(p, (tANI_U8)WLAN_STATS_FRM_DUP_CNT, |
| 5638 | (tANI_U8) sizeof (pStats->frm_dup_cnt), |
| 5639 | (char*) &(pStats->frm_dup_cnt), |
| 5640 | tlen); |
| 5641 | |
| 5642 | FILL_TLV(p, (tANI_U8)WLAN_STATS_FAIL_CNT, |
| 5643 | (tANI_U8) sizeof (pStats->fail_cnt), |
| 5644 | (char*) &(pStats->fail_cnt[0]), |
| 5645 | tlen); |
| 5646 | |
| 5647 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_FAIL_CNT, |
| 5648 | (tANI_U8) sizeof (pStats->rts_fail_cnt), |
| 5649 | (char*) &(pStats->rts_fail_cnt), |
| 5650 | tlen); |
| 5651 | |
| 5652 | FILL_TLV(p, (tANI_U8)WLAN_STATS_ACK_FAIL_CNT, |
| 5653 | (tANI_U8) sizeof (pStats->ack_fail_cnt), |
| 5654 | (char*) &(pStats->ack_fail_cnt), |
| 5655 | tlen); |
| 5656 | |
| 5657 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_SUC_CNT, |
| 5658 | (tANI_U8) sizeof (pStats->rts_succ_cnt), |
| 5659 | (char*) &(pStats->rts_succ_cnt), |
| 5660 | tlen); |
| 5661 | |
| 5662 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_DISCARD_CNT, |
| 5663 | (tANI_U8) sizeof (pStats->rx_discard_cnt), |
| 5664 | (char*) &(pStats->rx_discard_cnt), |
| 5665 | tlen); |
| 5666 | |
| 5667 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_ERROR_CNT, |
| 5668 | (tANI_U8) sizeof (pStats->rx_error_cnt), |
| 5669 | (char*) &(pStats->rx_error_cnt), |
| 5670 | tlen); |
| 5671 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5672 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BYTE_CNT, |
| 5673 | (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]), |
| 5674 | (char*) &(dStats->tx_uc_byte_cnt[0]), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5675 | tlen); |
| 5676 | |
| 5677 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BYTE_CNT, |
| 5678 | (tANI_U8) sizeof (dStats->rx_byte_cnt), |
| 5679 | (char*) &(dStats->rx_byte_cnt), |
| 5680 | tlen); |
| 5681 | |
| 5682 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_RATE, |
| 5683 | (tANI_U8) sizeof (dStats->rx_rate), |
| 5684 | (char*) &(dStats->rx_rate), |
| 5685 | tlen); |
| 5686 | |
| 5687 | /* Transmit rate, in units of 500 kbit/sec */ |
| 5688 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_RATE, |
| 5689 | (tANI_U8) sizeof (aStats->tx_rate), |
| 5690 | (char*) &(aStats->tx_rate), |
| 5691 | tlen); |
| 5692 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5693 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_UC_BYTE_CNT, |
| 5694 | (tANI_U8) sizeof (dStats->rx_uc_byte_cnt[0]), |
| 5695 | (char*) &(dStats->rx_uc_byte_cnt[0]), |
| 5696 | tlen); |
| 5697 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_MC_BYTE_CNT, |
| 5698 | (tANI_U8) sizeof (dStats->rx_mc_byte_cnt), |
| 5699 | (char*) &(dStats->rx_mc_byte_cnt), |
| 5700 | tlen); |
| 5701 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BC_BYTE_CNT, |
| 5702 | (tANI_U8) sizeof (dStats->rx_bc_byte_cnt), |
| 5703 | (char*) &(dStats->rx_bc_byte_cnt), |
| 5704 | tlen); |
| 5705 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_UC_BYTE_CNT, |
| 5706 | (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]), |
| 5707 | (char*) &(dStats->tx_uc_byte_cnt[0]), |
| 5708 | tlen); |
| 5709 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_MC_BYTE_CNT, |
| 5710 | (tANI_U8) sizeof (dStats->tx_mc_byte_cnt), |
| 5711 | (char*) &(dStats->tx_mc_byte_cnt), |
| 5712 | tlen); |
| 5713 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BC_BYTE_CNT, |
| 5714 | (tANI_U8) sizeof (dStats->tx_bc_byte_cnt), |
| 5715 | (char*) &(dStats->tx_bc_byte_cnt), |
| 5716 | tlen); |
| 5717 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5718 | wrqu->data.length = tlen; |
| 5719 | |
| 5720 | } |
| 5721 | |
| 5722 | EXIT(); |
| 5723 | |
| 5724 | return 0; |
| 5725 | } |
| 5726 | |
| 5727 | |
| 5728 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5729 | |
| 5730 | /*Max Len for PNO notification*/ |
| 5731 | #define MAX_PNO_NOTIFY_LEN 100 |
| 5732 | void found_pref_network_cb (void *callbackContext, |
| 5733 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 5734 | { |
| 5735 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 5736 | union iwreq_data wrqu; |
| 5737 | char buf[MAX_PNO_NOTIFY_LEN+1]; |
| 5738 | |
| 5739 | hddLog(VOS_TRACE_LEVEL_WARN, "A preferred network was found: %s with rssi: -%d", |
| 5740 | pPrefNetworkFoundInd->ssId.ssId, pPrefNetworkFoundInd->rssi); |
| 5741 | |
| 5742 | // create the event |
| 5743 | memset(&wrqu, 0, sizeof(wrqu)); |
| 5744 | memset(buf, 0, sizeof(buf)); |
| 5745 | |
| 5746 | snprintf(buf, MAX_PNO_NOTIFY_LEN, "QCOM: Found preferred network: %s with RSSI of -%u", |
| 5747 | pPrefNetworkFoundInd->ssId.ssId, |
| 5748 | (unsigned int)pPrefNetworkFoundInd->rssi); |
| 5749 | |
| 5750 | wrqu.data.pointer = buf; |
| 5751 | wrqu.data.length = strlen(buf); |
| 5752 | |
| 5753 | // send the event |
| 5754 | |
| 5755 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 5756 | |
| 5757 | } |
| 5758 | |
| 5759 | |
| 5760 | /*string based input*/ |
| 5761 | VOS_STATUS iw_set_pno(struct net_device *dev, struct iw_request_info *info, |
| 5762 | union iwreq_data *wrqu, char *extra, int nOffset) |
| 5763 | { |
| 5764 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Madan Mohan Koyyalamudi | 729972c | 2012-10-21 12:39:24 -0700 | [diff] [blame] | 5765 | /* pnoRequest is a large struct, so we make it static to avoid stack |
| 5766 | overflow. This API is only invoked via ioctl, so it is |
| 5767 | serialized by the kernel rtnl_lock and hence does not need to be |
| 5768 | reentrant */ |
| 5769 | static tSirPNOScanReq pnoRequest; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5770 | char *ptr; |
| 5771 | v_U8_t i,j, ucParams, ucMode; |
| 5772 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 5773 | |
| 5774 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5775 | "PNO data len %d data %s", |
| 5776 | wrqu->data.length, |
| 5777 | wrqu->data.pointer); |
| 5778 | |
| 5779 | if (wrqu->data.length <= nOffset ) |
| 5780 | { |
| 5781 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "PNO input is not correct"); |
| 5782 | return VOS_STATUS_E_FAILURE; |
| 5783 | } |
| 5784 | |
| 5785 | pnoRequest.enable = 0; |
| 5786 | pnoRequest.ucNetworksCount = 0; |
| 5787 | /*----------------------------------------------------------------------- |
| 5788 | Input is string based and expected to be like this: |
| 5789 | |
| 5790 | <enabled> <netw_count> |
| 5791 | for each network: |
| 5792 | <ssid_len> <ssid> <authentication> <encryption> |
| 5793 | <ch_num> <channel_list optional> <bcast_type> <rssi_threshold> |
| 5794 | <scan_timers> <scan_time> <scan_repeat> <scan_time> <scan_repeat> |
| 5795 | |
| 5796 | e.g: |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 5797 | 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] | 5798 | |
| 5799 | this translates into: |
| 5800 | ----------------------------- |
| 5801 | enable PNO |
| 5802 | look for 2 networks: |
| 5803 | test - with authentication type 0 and encryption type 0, |
| 5804 | that can be found on 3 channels: 1 6 and 11 , |
| 5805 | SSID bcast type is unknown (directed probe will be sent if AP not found) |
| 5806 | and must meet -40dBm RSSI |
| 5807 | |
| 5808 | test2 - with auth and enrytption type 4/4 |
| 5809 | that can be found on 6 channels 1, 2, 3, 4, 5 and 6 |
| 5810 | bcast type is non-bcast (directed probe will be sent) |
| 5811 | and must not meet any RSSI threshold |
| 5812 | |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 5813 | scan every 5 seconds 2 times, scan every 300 seconds until stopped |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5814 | -----------------------------------------------------------------------*/ |
| 5815 | ptr = (char*)(wrqu->data.pointer + nOffset); |
| 5816 | |
| 5817 | sscanf(ptr,"%hhu%n", &(pnoRequest.enable), &nOffset); |
| 5818 | |
| 5819 | if ( 0 == pnoRequest.enable ) |
| 5820 | { |
| 5821 | /*Disable PNO*/ |
| 5822 | memset(&pnoRequest, 0, sizeof(pnoRequest)); |
| 5823 | sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), &pnoRequest, |
| 5824 | pAdapter->sessionId, |
| 5825 | found_pref_network_cb, pAdapter); |
| 5826 | return VOS_STATUS_SUCCESS; |
| 5827 | } |
| 5828 | |
| 5829 | ptr += nOffset; |
| 5830 | sscanf(ptr,"%hhu %n", &(pnoRequest.ucNetworksCount), &nOffset); |
| 5831 | |
| 5832 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5833 | "PNO enable %d networks count %d offset %d", |
| 5834 | pnoRequest.enable, |
| 5835 | pnoRequest.ucNetworksCount, |
| 5836 | nOffset); |
| 5837 | |
| 5838 | /* Parameters checking: |
| 5839 | ucNetworksCount has to be larger than 0*/ |
| 5840 | if (( 0 == pnoRequest.ucNetworksCount ) || |
| 5841 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
| 5842 | { |
| 5843 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Network input is not correct"); |
| 5844 | return VOS_STATUS_E_FAILURE; |
| 5845 | } |
| 5846 | |
| 5847 | ptr += nOffset; |
| 5848 | |
| 5849 | for ( i = 0; i < pnoRequest.ucNetworksCount; i++ ) |
| 5850 | { |
| 5851 | |
| 5852 | pnoRequest.aNetworks[i].ssId.length = 0; |
| 5853 | |
| 5854 | sscanf(ptr,"%hhu %n", |
| 5855 | &(pnoRequest.aNetworks[i].ssId.length), &nOffset); |
| 5856 | |
| 5857 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 5858 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
| 5859 | { |
| 5860 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5861 | "SSID Len %d is not correct for network %d", |
| 5862 | pnoRequest.aNetworks[i].ssId.length, i); |
| 5863 | return VOS_STATUS_E_FAILURE; |
| 5864 | } |
| 5865 | |
| 5866 | /*Advance to SSID*/ |
| 5867 | ptr += nOffset; |
| 5868 | |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 5869 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, ptr, |
Amar Singhal | 751e607 | 2013-01-24 16:02:56 -0800 | [diff] [blame] | 5870 | pnoRequest.aNetworks[i].ssId.length); |
| 5871 | ptr += pnoRequest.aNetworks[i].ssId.length; |
| 5872 | |
| 5873 | ucParams = sscanf(ptr,"%lu %lu %hhu %n", |
| 5874 | &(pnoRequest.aNetworks[i].authentication), |
| 5875 | &(pnoRequest.aNetworks[i].encryption), |
| 5876 | &(pnoRequest.aNetworks[i].ucChannelCount), |
| 5877 | &nOffset); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5878 | |
| 5879 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Amar Singhal | 751e607 | 2013-01-24 16:02:56 -0800 | [diff] [blame] | 5880 | "PNO len %d ssid 0x%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx" |
| 5881 | "auth %d encry %d channel count %d offset %d", |
| 5882 | pnoRequest.aNetworks[i].ssId.length, |
| 5883 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[0]), |
| 5884 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[4]), |
| 5885 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[8]), |
| 5886 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[12]), |
| 5887 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[16]), |
| 5888 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[20]), |
| 5889 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[24]), |
| 5890 | *((v_U32_t *) &pnoRequest.aNetworks[i].ssId.ssId[28]), |
| 5891 | pnoRequest.aNetworks[i].authentication, |
| 5892 | pnoRequest.aNetworks[i].encryption, |
| 5893 | pnoRequest.aNetworks[i].ucChannelCount, |
| 5894 | nOffset ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5895 | |
Amar Singhal | 751e607 | 2013-01-24 16:02:56 -0800 | [diff] [blame] | 5896 | if ( 3 != ucParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5897 | { |
| 5898 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 5899 | "Incorrect cmd"); |
| 5900 | return VOS_STATUS_E_FAILURE; |
| 5901 | } |
| 5902 | |
| 5903 | /*Advance to channel list*/ |
| 5904 | ptr += nOffset; |
| 5905 | |
| 5906 | if ( SIR_PNO_MAX_NETW_CHANNELS < pnoRequest.aNetworks[i].ucChannelCount ) |
| 5907 | { |
| 5908 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 5909 | "Incorrect number of channels"); |
| 5910 | return VOS_STATUS_E_FAILURE; |
| 5911 | } |
| 5912 | |
| 5913 | if ( 0 != pnoRequest.aNetworks[i].ucChannelCount) |
| 5914 | { |
| 5915 | for ( j = 0; j < pnoRequest.aNetworks[i].ucChannelCount; j++) |
| 5916 | { |
| 5917 | sscanf(ptr,"%hhu %n", |
| 5918 | &(pnoRequest.aNetworks[i].aChannels[j]), &nOffset); |
| 5919 | /*Advance to next channel number*/ |
| 5920 | ptr += nOffset; |
| 5921 | } |
| 5922 | } |
| 5923 | |
| 5924 | sscanf(ptr,"%lu %n", |
| 5925 | &(pnoRequest.aNetworks[i].bcastNetwType), &nOffset); |
| 5926 | |
| 5927 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5928 | "PNO bcastNetwType %d offset %d", |
| 5929 | pnoRequest.aNetworks[i].bcastNetwType, |
| 5930 | nOffset ); |
| 5931 | |
| 5932 | /*Advance to rssi Threshold*/ |
| 5933 | ptr += nOffset; |
| 5934 | |
| 5935 | sscanf(ptr,"%hhu %n", |
| 5936 | &(pnoRequest.aNetworks[i].rssiThreshold), &nOffset); |
| 5937 | |
| 5938 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5939 | "PNO rssi %d offset %d", |
| 5940 | pnoRequest.aNetworks[i].rssiThreshold, |
| 5941 | nOffset ); |
| 5942 | /*Advance to next network*/ |
| 5943 | ptr += nOffset; |
| 5944 | }/*For ucNetworkCount*/ |
| 5945 | |
| 5946 | ucParams = sscanf(ptr,"%hhu %n", |
| 5947 | &(pnoRequest.scanTimers.ucScanTimersCount), &nOffset); |
| 5948 | |
| 5949 | /*Read the scan timers*/ |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 5950 | if (( 1 == ucParams ) && ( pnoRequest.scanTimers.ucScanTimersCount > 0 )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5951 | { |
| 5952 | ptr += nOffset; |
| 5953 | |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 5954 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5955 | "Scan timer count %d offset %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5956 | pnoRequest.scanTimers.ucScanTimersCount, |
| 5957 | nOffset ); |
| 5958 | |
| 5959 | if ( SIR_PNO_MAX_SCAN_TIMERS < pnoRequest.scanTimers.ucScanTimersCount ) |
| 5960 | { |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 5961 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5962 | "Incorrect cmd - too many scan timers"); |
| 5963 | return VOS_STATUS_E_FAILURE; |
| 5964 | } |
| 5965 | |
| 5966 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++ ) |
| 5967 | { |
| 5968 | ucParams = sscanf(ptr,"%lu %lu %n", |
| 5969 | &(pnoRequest.scanTimers.aTimerValues[i].uTimerValue), |
| 5970 | &( pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat), |
| 5971 | &nOffset); |
| 5972 | |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 5973 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5974 | "PNO Timer value %d Timer repeat %d offset %d", |
| 5975 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5976 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat, |
| 5977 | nOffset ); |
| 5978 | |
| 5979 | if ( 2 != ucParams ) |
| 5980 | { |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 5981 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5982 | "Incorrect cmd - diff params then expected %d", ucParams); |
| 5983 | return VOS_STATUS_E_FAILURE; |
| 5984 | } |
| 5985 | |
| 5986 | ptr += nOffset; |
| 5987 | } |
| 5988 | |
| 5989 | } |
| 5990 | else |
| 5991 | { |
Jeff Johnson | 8301aa1 | 2013-03-28 14:27:29 -0700 | [diff] [blame] | 5992 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 5993 | "No scan timers provided param count %d scan timers %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5994 | ucParams, pnoRequest.scanTimers.ucScanTimersCount ); |
| 5995 | |
| 5996 | /*Scan timers defaults to 5 minutes*/ |
| 5997 | pnoRequest.scanTimers.ucScanTimersCount = 1; |
| 5998 | pnoRequest.scanTimers.aTimerValues[0].uTimerValue = 60; |
| 5999 | pnoRequest.scanTimers.aTimerValues[0].uTimerRepeat = 0; |
| 6000 | } |
| 6001 | |
| 6002 | ucParams = sscanf(ptr,"%hhu %n", |
| 6003 | &(ucMode), &nOffset); |
| 6004 | |
| 6005 | pnoRequest.modePNO = ucMode; |
| 6006 | /*for LA we just expose suspend option*/ |
| 6007 | if (( 1 != ucParams )||( ucMode >= SIR_PNO_MODE_MAX )) |
| 6008 | { |
| 6009 | pnoRequest.modePNO = SIR_PNO_MODE_ON_SUSPEND; |
| 6010 | } |
| 6011 | |
| 6012 | sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), &pnoRequest, |
| 6013 | pAdapter->sessionId, |
| 6014 | found_pref_network_cb, pAdapter); |
| 6015 | |
| 6016 | return VOS_STATUS_SUCCESS; |
| 6017 | }/*iw_set_pno*/ |
| 6018 | |
| 6019 | VOS_STATUS iw_set_rssi_filter(struct net_device *dev, struct iw_request_info *info, |
| 6020 | union iwreq_data *wrqu, char *extra, int nOffset) |
| 6021 | { |
| 6022 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6023 | v_U8_t rssiThreshold = 0; |
| 6024 | v_U8_t nRead; |
| 6025 | |
| 6026 | nRead = sscanf(wrqu->data.pointer + nOffset,"%hhu", |
| 6027 | &rssiThreshold); |
| 6028 | |
| 6029 | if ( 1 != nRead ) |
| 6030 | { |
| 6031 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 6032 | "Incorrect format"); |
| 6033 | return VOS_STATUS_E_FAILURE; |
| 6034 | } |
| 6035 | |
| 6036 | sme_SetRSSIFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), rssiThreshold); |
| 6037 | return VOS_STATUS_SUCCESS; |
| 6038 | } |
| 6039 | |
| 6040 | |
| 6041 | static int iw_set_pno_priv(struct net_device *dev, |
| 6042 | struct iw_request_info *info, |
| 6043 | union iwreq_data *wrqu, char *extra) |
| 6044 | { |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6045 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6046 | |
| 6047 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6048 | "Set PNO Private"); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6049 | |
| 6050 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 6051 | { |
| 6052 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6053 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6054 | return -EBUSY; |
| 6055 | } |
| 6056 | return iw_set_pno(dev,info,wrqu,extra,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6057 | } |
| 6058 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 6059 | |
| 6060 | //Common function to SetBand |
| 6061 | int hdd_setBand_helper(struct net_device *dev, tANI_U8* ptr) |
| 6062 | { |
| 6063 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6064 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6065 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6066 | tANI_U8 band = 0; |
| 6067 | eCsrBand currBand = eCSR_BAND_MAX; |
| 6068 | |
| 6069 | band = ptr[WLAN_HDD_UI_SET_BAND_VALUE_OFFSET] - '0'; /*convert the band value from ascii to integer*/ |
| 6070 | |
| 6071 | switch(band) |
| 6072 | { |
| 6073 | case WLAN_HDD_UI_BAND_AUTO: |
| 6074 | band = eCSR_BAND_ALL; |
| 6075 | break; |
| 6076 | case WLAN_HDD_UI_BAND_5_GHZ: |
| 6077 | band = eCSR_BAND_5G; |
| 6078 | break; |
| 6079 | case WLAN_HDD_UI_BAND_2_4_GHZ: |
| 6080 | band = eCSR_BAND_24; |
| 6081 | break; |
| 6082 | default: |
| 6083 | band = eCSR_BAND_MAX; |
| 6084 | } |
| 6085 | |
| 6086 | 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] | 6087 | __func__, band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6088 | |
| 6089 | if (band == eCSR_BAND_MAX) |
| 6090 | { |
| 6091 | /* Received change band request with invalid band value */ |
| 6092 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6093 | "%s: Invalid band value %u", __func__, band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6094 | return -EIO; |
| 6095 | } |
| 6096 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6097 | if ( (band == eCSR_BAND_24 && pHddCtx->cfg_ini->nBandCapability==2) || |
| 6098 | (band == eCSR_BAND_5G && pHddCtx->cfg_ini->nBandCapability==1) || |
| 6099 | (band == eCSR_BAND_ALL && pHddCtx->cfg_ini->nBandCapability!=0)) |
| 6100 | { |
| 6101 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6102 | "%s: band value %u violate INI settings %u", __func__, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 6103 | band, pHddCtx->cfg_ini->nBandCapability); |
| 6104 | return -EIO; |
| 6105 | } |
| 6106 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6107 | if (eHAL_STATUS_SUCCESS != sme_GetFreqBand(hHal, &currBand)) |
| 6108 | { |
| 6109 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6110 | "%s: Failed to get current band config", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6111 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6112 | return -EIO; |
| 6113 | } |
| 6114 | |
| 6115 | if (currBand != band) |
| 6116 | { |
| 6117 | /* Change band request received. |
| 6118 | * Abort pending scan requests, flush the existing scan results, |
| 6119 | * and change the band capability |
| 6120 | */ |
| 6121 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6122 | "%s: Current band value = %u, new setting %u ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6123 | __func__, currBand, band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6124 | |
| 6125 | if (hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) |
| 6126 | { |
| 6127 | hdd_station_ctx_t *pHddStaCtx = &(pAdapter)->sessionCtx.station; |
| 6128 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6129 | long lrc; |
| 6130 | |
| 6131 | /* STA already connected on current band, So issue disconnect first, |
| 6132 | * then change the band*/ |
| 6133 | |
| 6134 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 6135 | "%s STA connected in band %u, Changing band to %u, Issuing Disconnect", |
| 6136 | __func__, csrGetCurrentBand(hHal), band); |
| 6137 | |
| 6138 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 6139 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 6140 | |
| 6141 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6142 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6143 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 6144 | if ( eHAL_STATUS_SUCCESS != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6145 | { |
| 6146 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6147 | "%s csrRoamDisconnect failure, returned %d \n", |
| 6148 | __func__, (int)status ); |
| 6149 | return -EINVAL; |
| 6150 | } |
| 6151 | |
| 6152 | lrc = wait_for_completion_interruptible_timeout( |
| 6153 | &pAdapter->disconnect_comp_var, |
| 6154 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 6155 | |
| 6156 | if(lrc <= 0) { |
| 6157 | |
| 6158 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: %s while while waiting for csrRoamDisconnect ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6159 | __func__, (0 == lrc) ? "Timeout" : "Interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6160 | |
| 6161 | return (0 == lrc) ? -ETIMEDOUT : -EINTR; |
| 6162 | } |
| 6163 | } |
| 6164 | |
| 6165 | hdd_abort_mac_scan(pHddCtx); |
| 6166 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 6167 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 6168 | sme_UpdateBgScanConfigIniChannelList(hHal, (eCsrBand) band); |
| 6169 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6170 | if(eHAL_STATUS_SUCCESS != sme_SetFreqBand(hHal, (eCsrBand)band)) |
| 6171 | { |
| 6172 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6173 | "%s: failed to set the band value to %u ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6174 | __func__, band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6175 | return -EINVAL; |
| 6176 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6177 | wlan_hdd_cfg80211_update_band(pHddCtx->wiphy, (eCsrBand)band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6178 | } |
| 6179 | return 0; |
| 6180 | } |
| 6181 | |
| 6182 | static int iw_set_band_config(struct net_device *dev, |
| 6183 | struct iw_request_info *info, |
| 6184 | union iwreq_data *wrqu, char *extra) |
| 6185 | { |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6186 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6187 | tANI_U8 *ptr = (tANI_U8*)wrqu->data.pointer; |
| 6188 | int ret = 0; |
| 6189 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 6190 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,"%s: ", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6191 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6192 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 6193 | { |
| 6194 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6195 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6196 | return -EBUSY; |
| 6197 | } |
| 6198 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6199 | if (memcmp(ptr, "SETBAND ", 8) == 0) |
| 6200 | { |
| 6201 | /* Change band request received */ |
| 6202 | ret = hdd_setBand_helper(dev, ptr); |
| 6203 | return ret; |
| 6204 | |
| 6205 | } |
| 6206 | return 0; |
| 6207 | } |
| 6208 | |
| 6209 | static int iw_set_power_params_priv(struct net_device *dev, |
| 6210 | struct iw_request_info *info, |
| 6211 | union iwreq_data *wrqu, char *extra) |
| 6212 | { |
| 6213 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6214 | "Set power params Private"); |
| 6215 | return iw_set_power_params(dev,info,wrqu,extra,0); |
| 6216 | } |
| 6217 | |
| 6218 | |
| 6219 | |
| 6220 | /*string based input*/ |
| 6221 | VOS_STATUS iw_set_power_params(struct net_device *dev, struct iw_request_info *info, |
| 6222 | union iwreq_data *wrqu, char *extra, int nOffset) |
| 6223 | { |
| 6224 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6225 | tSirSetPowerParamsReq powerRequest; |
| 6226 | char *ptr; |
| 6227 | v_U8_t ucType; |
| 6228 | v_U32_t uTotalSize, uValue; |
| 6229 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 6230 | |
| 6231 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6232 | "Power Params data len %d data %s", |
| 6233 | wrqu->data.length, |
| 6234 | wrqu->data.pointer); |
| 6235 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6236 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 6237 | { |
| 6238 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 6239 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 6240 | return -EBUSY; |
| 6241 | } |
| 6242 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6243 | if (wrqu->data.length <= nOffset ) |
| 6244 | { |
| 6245 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "set power param input is not correct"); |
| 6246 | return VOS_STATUS_E_FAILURE; |
| 6247 | } |
| 6248 | |
| 6249 | uTotalSize = wrqu->data.length - nOffset; |
| 6250 | |
| 6251 | /*----------------------------------------------------------------------- |
| 6252 | Input is string based and expected to be like this: |
| 6253 | |
| 6254 | <param_type> <param_value> <param_type> <param_value> ... |
| 6255 | |
| 6256 | e.g: |
| 6257 | 1 2 2 3 3 0 4 1 5 1 |
| 6258 | |
| 6259 | e.g. setting just a few: |
| 6260 | 1 2 4 1 |
| 6261 | |
| 6262 | parameter types: |
| 6263 | ----------------------------- |
| 6264 | 1 - Ignore DTIM |
| 6265 | 2 - Listen Interval |
| 6266 | 3 - Broadcast Multicas Filter |
| 6267 | 4 - Beacon Early Termination |
| 6268 | 5 - Beacon Early Termination Interval |
| 6269 | -----------------------------------------------------------------------*/ |
| 6270 | powerRequest.uIgnoreDTIM = SIR_NOCHANGE_POWER_VALUE; |
| 6271 | powerRequest.uListenInterval = SIR_NOCHANGE_POWER_VALUE; |
| 6272 | powerRequest.uBcastMcastFilter = SIR_NOCHANGE_POWER_VALUE; |
| 6273 | powerRequest.uEnableBET = SIR_NOCHANGE_POWER_VALUE; |
| 6274 | powerRequest.uBETInterval = SIR_NOCHANGE_POWER_VALUE; |
| 6275 | |
| 6276 | ptr = (char*)(wrqu->data.pointer + nOffset); |
| 6277 | |
| 6278 | while ( uTotalSize ) |
| 6279 | { |
| 6280 | sscanf(ptr,"%hhu %n", &(ucType), &nOffset); |
| 6281 | |
| 6282 | uTotalSize -= nOffset; |
| 6283 | |
| 6284 | if (!uTotalSize) |
| 6285 | { |
| 6286 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 6287 | "Invalid input parameter type : %d with no value at offset %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6288 | ucType, nOffset); |
| 6289 | return VOS_STATUS_E_FAILURE; |
| 6290 | } |
| 6291 | |
| 6292 | ptr += nOffset; |
| 6293 | sscanf(ptr,"%lu %n", &(uValue), &nOffset); |
| 6294 | |
| 6295 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6296 | "Power request parameter %d value %d offset %d", |
| 6297 | ucType, uValue, nOffset); |
| 6298 | |
| 6299 | switch (ucType) |
| 6300 | { |
| 6301 | case eSIR_IGNORE_DTIM: |
| 6302 | powerRequest.uIgnoreDTIM = uValue; |
| 6303 | break; |
| 6304 | case eSIR_LISTEN_INTERVAL: |
| 6305 | powerRequest.uListenInterval = uValue; |
| 6306 | break; |
| 6307 | case eSIR_MCAST_BCAST_FILTER: |
| 6308 | powerRequest.uBcastMcastFilter = uValue; |
| 6309 | break; |
| 6310 | case eSIR_ENABLE_BET: |
| 6311 | powerRequest.uEnableBET = uValue; |
| 6312 | break; |
| 6313 | case eSIR_BET_INTERVAL: |
| 6314 | powerRequest.uBETInterval = uValue; |
| 6315 | break; |
| 6316 | default: |
| 6317 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 6318 | "Invalid input parameter type : %d with value: %d at offset %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6319 | ucType, uValue, nOffset); |
| 6320 | return VOS_STATUS_E_FAILURE; |
| 6321 | } |
| 6322 | |
| 6323 | uTotalSize -= nOffset; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6324 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6325 | "Power request parameter %d Total size", |
| 6326 | uTotalSize); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6327 | ptr += nOffset; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6328 | /* This is added for dynamic Tele LI enable (0xF1) /disable (0xF0)*/ |
| 6329 | if(!(uTotalSize - nOffset) && |
| 6330 | (powerRequest.uListenInterval != SIR_NOCHANGE_POWER_VALUE)) |
| 6331 | { |
| 6332 | uTotalSize = 0; |
| 6333 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6334 | |
| 6335 | }/*Go for as long as we have a valid string*/ |
| 6336 | |
| 6337 | /* put the device into full power*/ |
| 6338 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE); |
| 6339 | |
| 6340 | /* Apply the power save params*/ |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 6341 | sme_SetPowerParams( WLAN_HDD_GET_HAL_CTX(pAdapter), &powerRequest, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6342 | |
| 6343 | /* put the device back to power save*/ |
| 6344 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO); |
| 6345 | |
| 6346 | return VOS_STATUS_SUCCESS; |
| 6347 | }/*iw_set_power_params*/ |
| 6348 | |
| 6349 | |
| 6350 | // Define the Wireless Extensions to the Linux Network Device structure |
| 6351 | // A number of these routines are NULL (meaning they are not implemented.) |
| 6352 | |
| 6353 | static const iw_handler we_handler[] = |
| 6354 | { |
| 6355 | (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */ |
| 6356 | (iw_handler) iw_get_name, /* SIOCGIWNAME */ |
| 6357 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 6358 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 6359 | (iw_handler) iw_set_freq, /* SIOCSIWFREQ */ |
| 6360 | (iw_handler) iw_get_freq, /* SIOCGIWFREQ */ |
| 6361 | (iw_handler) iw_set_mode, /* SIOCSIWMODE */ |
| 6362 | (iw_handler) iw_get_mode, /* SIOCGIWMODE */ |
| 6363 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 6364 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 6365 | (iw_handler) NULL, /* SIOCSIWRANGE */ |
| 6366 | (iw_handler) iw_get_range, /* SIOCGIWRANGE */ |
| 6367 | (iw_handler) iw_set_priv, /* SIOCSIWPRIV */ |
| 6368 | (iw_handler) NULL, /* SIOCGIWPRIV */ |
| 6369 | (iw_handler) NULL, /* SIOCSIWSTATS */ |
| 6370 | (iw_handler) NULL, /* SIOCGIWSTATS */ |
| 6371 | iw_handler_set_spy, /* SIOCSIWSPY */ |
| 6372 | iw_handler_get_spy, /* SIOCGIWSPY */ |
| 6373 | iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ |
| 6374 | iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ |
| 6375 | (iw_handler) iw_set_ap_address, /* SIOCSIWAP */ |
| 6376 | (iw_handler) iw_get_ap_address, /* SIOCGIWAP */ |
| 6377 | (iw_handler) iw_set_mlme, /* SIOCSIWMLME */ |
| 6378 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
| 6379 | (iw_handler) iw_set_scan, /* SIOCSIWSCAN */ |
| 6380 | (iw_handler) iw_get_scan, /* SIOCGIWSCAN */ |
| 6381 | (iw_handler) iw_set_essid, /* SIOCSIWESSID */ |
| 6382 | (iw_handler) iw_get_essid, /* SIOCGIWESSID */ |
| 6383 | (iw_handler) iw_set_nick, /* SIOCSIWNICKN */ |
| 6384 | (iw_handler) iw_get_nick, /* SIOCGIWNICKN */ |
| 6385 | (iw_handler) NULL, /* -- hole -- */ |
| 6386 | (iw_handler) NULL, /* -- hole -- */ |
| 6387 | (iw_handler) iw_set_bitrate, /* SIOCSIWRATE */ |
| 6388 | (iw_handler) iw_get_bitrate, /* SIOCGIWRATE */ |
| 6389 | (iw_handler) iw_set_rts_threshold,/* SIOCSIWRTS */ |
| 6390 | (iw_handler) iw_get_rts_threshold,/* SIOCGIWRTS */ |
| 6391 | (iw_handler) iw_set_frag_threshold, /* SIOCSIWFRAG */ |
| 6392 | (iw_handler) iw_get_frag_threshold, /* SIOCGIWFRAG */ |
| 6393 | (iw_handler) iw_set_tx_power, /* SIOCSIWTXPOW */ |
| 6394 | (iw_handler) iw_get_tx_power, /* SIOCGIWTXPOW */ |
| 6395 | (iw_handler) iw_set_retry, /* SIOCSIWRETRY */ |
| 6396 | (iw_handler) iw_get_retry, /* SIOCGIWRETRY */ |
| 6397 | (iw_handler) iw_set_encode, /* SIOCSIWENCODE */ |
| 6398 | (iw_handler) iw_get_encode, /* SIOCGIWENCODE */ |
| 6399 | (iw_handler) iw_set_power_mode, /* SIOCSIWPOWER */ |
| 6400 | (iw_handler) iw_get_power_mode, /* SIOCGIWPOWER */ |
| 6401 | (iw_handler) NULL, /* -- hole -- */ |
| 6402 | (iw_handler) NULL, /* -- hole -- */ |
| 6403 | (iw_handler) iw_set_genie, /* SIOCSIWGENIE */ |
| 6404 | (iw_handler) iw_get_genie, /* SIOCGIWGENIE */ |
| 6405 | (iw_handler) iw_set_auth, /* SIOCSIWAUTH */ |
| 6406 | (iw_handler) iw_get_auth, /* SIOCGIWAUTH */ |
| 6407 | (iw_handler) iw_set_encodeext, /* SIOCSIWENCODEEXT */ |
| 6408 | (iw_handler) iw_get_encodeext, /* SIOCGIWENCODEEXT */ |
| 6409 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 6410 | }; |
| 6411 | |
| 6412 | static const iw_handler we_private[] = { |
| 6413 | |
| 6414 | [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone, //set priv ioctl |
| 6415 | [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint, //get priv ioctl |
| 6416 | [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone, //get priv ioctl |
| 6417 | [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_three_ints_getnone, |
| 6418 | [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone, |
| 6419 | [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone, //action priv ioctl |
| 6420 | [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_var_ints_getnone, |
| 6421 | [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec, |
| 6422 | [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec, |
| 6423 | [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6424 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 6425 | [WLAN_PRIV_SET_OEM_DATA_REQ - SIOCIWFIRSTPRIV] = iw_set_oem_data_req, //oem data req Specifc |
| 6426 | [WLAN_PRIV_GET_OEM_DATA_RSP - SIOCIWFIRSTPRIV] = iw_get_oem_data_rsp, //oem data req Specifc |
| 6427 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6428 | |
| 6429 | #ifdef FEATURE_WLAN_WAPI |
| 6430 | [WLAN_PRIV_SET_WAPI_MODE - SIOCIWFIRSTPRIV] = iw_qcom_set_wapi_mode, |
| 6431 | [WLAN_PRIV_GET_WAPI_MODE - SIOCIWFIRSTPRIV] = iw_qcom_get_wapi_mode, |
| 6432 | [WLAN_PRIV_SET_WAPI_ASSOC_INFO - SIOCIWFIRSTPRIV] = iw_qcom_set_wapi_assoc_info, |
| 6433 | [WLAN_PRIV_SET_WAPI_KEY - SIOCIWFIRSTPRIV] = iw_qcom_set_wapi_key, |
| 6434 | [WLAN_PRIV_SET_WAPI_BKID - SIOCIWFIRSTPRIV] = iw_qcom_set_wapi_bkid, |
| 6435 | [WLAN_PRIV_GET_WAPI_BKID - SIOCIWFIRSTPRIV] = iw_qcom_get_wapi_bkid, |
| 6436 | #endif /* FEATURE_WLAN_WAPI */ |
| 6437 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6438 | [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties, |
| 6439 | #endif |
| 6440 | [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload, |
| 6441 | [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics, |
| 6442 | [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] = iw_set_keepalive_params |
| 6443 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 6444 | , |
| 6445 | [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] = iw_set_packet_filter_params |
| 6446 | #endif |
| 6447 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 6448 | , |
| 6449 | [WLAN_SET_PNO - SIOCIWFIRSTPRIV] = iw_set_pno_priv |
| 6450 | #endif |
| 6451 | , |
| 6452 | [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config, |
| 6453 | [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] = iw_set_dynamic_mcbc_filter, |
| 6454 | [WLAN_PRIV_CLEAR_MCBC_FILTER - SIOCIWFIRSTPRIV] = iw_clear_dynamic_mcbc_filter, |
| 6455 | [WLAN_SET_POWER_PARAMS - SIOCIWFIRSTPRIV] = iw_set_power_params_priv, |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6456 | [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6457 | }; |
| 6458 | |
| 6459 | /*Maximum command length can be only 15 */ |
| 6460 | static const struct iw_priv_args we_private_args[] = { |
| 6461 | |
| 6462 | /* handlers for main ioctl */ |
| 6463 | { WLAN_PRIV_SET_INT_GET_NONE, |
| 6464 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6465 | 0, |
| 6466 | "" }, |
| 6467 | |
| 6468 | /* handlers for sub-ioctl */ |
| 6469 | { WE_SET_11D_STATE, |
| 6470 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6471 | 0, |
| 6472 | "set11Dstate" }, |
| 6473 | |
| 6474 | { WE_WOWL, |
| 6475 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6476 | 0, |
| 6477 | "wowl" }, |
| 6478 | |
| 6479 | { WE_SET_POWER, |
| 6480 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6481 | 0, |
| 6482 | "setPower" }, |
| 6483 | |
| 6484 | { WE_SET_MAX_ASSOC, |
| 6485 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6486 | 0, |
| 6487 | "setMaxAssoc" }, |
| 6488 | |
| 6489 | { WE_SET_SAP_AUTO_CHANNEL_SELECTION, |
| 6490 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6491 | 0, |
| 6492 | "setAutoChannel" }, |
| 6493 | |
| 6494 | { WE_SET_DATA_INACTIVITY_TO, |
| 6495 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6496 | 0, |
| 6497 | "inactivityTO" }, |
| 6498 | |
| 6499 | { WE_SET_MAX_TX_POWER, |
| 6500 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6501 | 0, |
| 6502 | "setMaxTxPower" }, |
| 6503 | /* set Higher DTIM Transition (DTIM1 to DTIM3) |
| 6504 | * 1 = enable and 0 = disable */ |
| 6505 | { |
| 6506 | WE_SET_HIGHER_DTIM_TRANSITION, |
| 6507 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6508 | 0, |
| 6509 | "setHDtimTransn" }, |
| 6510 | |
| 6511 | { WE_SET_TM_LEVEL, |
| 6512 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6513 | 0, |
| 6514 | "setTmLevel" }, |
| 6515 | |
| 6516 | /* handlers for main ioctl */ |
| 6517 | { WLAN_PRIV_SET_NONE_GET_INT, |
| 6518 | 0, |
| 6519 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6520 | "" }, |
| 6521 | |
| 6522 | /* handlers for sub-ioctl */ |
| 6523 | { WE_GET_11D_STATE, |
| 6524 | 0, |
| 6525 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6526 | "get11Dstate" }, |
| 6527 | |
| 6528 | { WE_IBSS_STATUS, |
| 6529 | 0, |
| 6530 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6531 | "getAdhocStatus" }, |
| 6532 | |
| 6533 | { WE_PMC_STATE, |
| 6534 | 0, |
| 6535 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6536 | "pmcState" }, |
| 6537 | |
| 6538 | { WE_GET_WLAN_DBG, |
| 6539 | 0, |
| 6540 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6541 | "getwlandbg" }, |
| 6542 | |
| 6543 | { WE_MODULE_DOWN_IND, |
| 6544 | 0, |
| 6545 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6546 | "moduleDownInd" }, |
| 6547 | |
| 6548 | { WE_GET_MAX_ASSOC, |
| 6549 | 0, |
| 6550 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6551 | "getMaxAssoc" }, |
| 6552 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6553 | { WE_GET_WDI_DBG, |
| 6554 | 0, |
| 6555 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6556 | "getwdidbg" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6557 | |
| 6558 | { WE_GET_SAP_AUTO_CHANNEL_SELECTION, |
| 6559 | 0, |
| 6560 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6561 | "getAutoChannel" }, |
| 6562 | |
| 6563 | { WE_GET_CONCURRENCY_MODE, |
| 6564 | 0, |
| 6565 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6566 | "getconcurrency" }, |
| 6567 | |
| 6568 | /* handlers for main ioctl */ |
| 6569 | { WLAN_PRIV_SET_CHAR_GET_NONE, |
| 6570 | IW_PRIV_TYPE_CHAR| 512, |
| 6571 | 0, |
| 6572 | "" }, |
| 6573 | |
| 6574 | /* handlers for sub-ioctl */ |
| 6575 | { WE_WOWL_ADD_PTRN, |
| 6576 | IW_PRIV_TYPE_CHAR| 512, |
| 6577 | 0, |
| 6578 | "wowlAddPtrn" }, |
| 6579 | |
| 6580 | { WE_WOWL_DEL_PTRN, |
| 6581 | IW_PRIV_TYPE_CHAR| 512, |
| 6582 | 0, |
| 6583 | "wowlDelPtrn" }, |
| 6584 | |
| 6585 | #if defined WLAN_FEATURE_VOWIFI |
| 6586 | /* handlers for sub-ioctl */ |
| 6587 | { WE_NEIGHBOR_REPORT_REQUEST, |
| 6588 | IW_PRIV_TYPE_CHAR | 512, |
| 6589 | 0, |
| 6590 | "neighbor" }, |
| 6591 | #endif |
| 6592 | { WE_SET_AP_WPS_IE, |
| 6593 | IW_PRIV_TYPE_CHAR| 512, |
| 6594 | 0, |
| 6595 | "set_ap_wps_ie" }, |
| 6596 | |
| 6597 | { WE_SET_CONFIG, |
| 6598 | IW_PRIV_TYPE_CHAR| 512, |
| 6599 | 0, |
| 6600 | "setConfig" }, |
| 6601 | |
| 6602 | /* handlers for main ioctl */ |
| 6603 | { WLAN_PRIV_SET_THREE_INT_GET_NONE, |
| 6604 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 6605 | 0, |
| 6606 | "" }, |
| 6607 | |
| 6608 | /* handlers for sub-ioctl */ |
| 6609 | { WE_SET_WLAN_DBG, |
| 6610 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 6611 | 0, |
| 6612 | "setwlandbg" }, |
| 6613 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6614 | { WE_SET_WDI_DBG, |
| 6615 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 6616 | 0, |
| 6617 | "setwdidbg" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6618 | |
| 6619 | { WE_SET_SAP_CHANNELS, |
| 6620 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 6621 | 0, |
| 6622 | "setsapchannels" }, |
| 6623 | |
| 6624 | /* handlers for main ioctl */ |
| 6625 | { WLAN_PRIV_GET_CHAR_SET_NONE, |
| 6626 | 0, |
| 6627 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6628 | "" }, |
| 6629 | |
| 6630 | /* handlers for sub-ioctl */ |
| 6631 | { WE_WLAN_VERSION, |
| 6632 | 0, |
| 6633 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6634 | "version" }, |
| 6635 | { WE_GET_STATS, |
| 6636 | 0, |
| 6637 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6638 | "getStats" }, |
| 6639 | { WE_GET_CFG, |
| 6640 | 0, |
| 6641 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6642 | "getConfig" }, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6643 | #ifdef WLAN_FEATURE_11AC |
| 6644 | { WE_GET_RSSI, |
| 6645 | 0, |
| 6646 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6647 | "getRSSI" }, |
| 6648 | #endif |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 6649 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 6650 | { WE_GET_ROAM_RSSI, |
| 6651 | 0, |
| 6652 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6653 | "getRoamRSSI" }, |
| 6654 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6655 | { WE_GET_WMM_STATUS, |
| 6656 | 0, |
| 6657 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6658 | "getWmmStatus" }, |
| 6659 | { |
| 6660 | WE_GET_CHANNEL_LIST, |
| 6661 | 0, |
| 6662 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6663 | "getChannelList" }, |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 6664 | #ifdef FEATURE_WLAN_TDLS |
| 6665 | { |
| 6666 | WE_GET_TDLS_PEERS, |
| 6667 | 0, |
| 6668 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6669 | "getTdlsPeers" }, |
| 6670 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6671 | #ifdef WLAN_FEATURE_11W |
| 6672 | { |
| 6673 | WE_GET_11W_INFO, |
| 6674 | 0, |
| 6675 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6676 | "getPMFInfo" }, |
| 6677 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6678 | /* handlers for main ioctl */ |
| 6679 | { WLAN_PRIV_SET_NONE_GET_NONE, |
| 6680 | 0, |
| 6681 | 0, |
| 6682 | "" }, |
| 6683 | |
| 6684 | /* handlers for sub-ioctl */ |
| 6685 | { WE_CLEAR_STATS, |
| 6686 | 0, |
| 6687 | 0, |
| 6688 | "clearStats" }, |
| 6689 | { WE_INIT_AP, |
| 6690 | 0, |
| 6691 | 0, |
| 6692 | "initAP" }, |
| 6693 | { WE_STOP_AP, |
| 6694 | 0, |
| 6695 | 0, |
| 6696 | "exitAP" }, |
| 6697 | { WE_ENABLE_AMP, |
| 6698 | 0, |
| 6699 | 0, |
| 6700 | "enableAMP" }, |
| 6701 | { WE_DISABLE_AMP, |
| 6702 | 0, |
| 6703 | 0, |
| 6704 | "disableAMP" }, |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 6705 | { WE_ENABLE_DXE_STALL_DETECT, |
| 6706 | 0, |
| 6707 | 0, |
| 6708 | "dxeStallDetect" }, |
| 6709 | { WE_DISPLAY_DXE_SNAP_SHOT, |
| 6710 | 0, |
| 6711 | 0, |
| 6712 | "dxeSnapshot" }, |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 6713 | { |
| 6714 | WE_SET_REASSOC_TRIGGER, |
| 6715 | 0, |
| 6716 | 0, |
| 6717 | "reassoc" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6718 | |
| 6719 | /* handlers for main ioctl */ |
| 6720 | { WLAN_PRIV_SET_VAR_INT_GET_NONE, |
| 6721 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 6722 | 0, |
| 6723 | "" }, |
| 6724 | |
| 6725 | /* handlers for sub-ioctl */ |
| 6726 | { WE_LOG_DUMP_CMD, |
| 6727 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 6728 | 0, |
| 6729 | "dump" }, |
| 6730 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 6731 | /* handlers for sub ioctl */ |
| 6732 | { |
| 6733 | WE_MCC_CONFIG_CREDENTIAL, |
| 6734 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 6735 | 0, |
| 6736 | "setMccCrdnl" }, |
| 6737 | |
| 6738 | /* handlers for sub ioctl */ |
| 6739 | { |
| 6740 | WE_MCC_CONFIG_PARAMS, |
| 6741 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 6742 | 0, |
| 6743 | "setMccConfig" }, |
| 6744 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 6745 | #ifdef FEATURE_WLAN_TDLS |
| 6746 | /* handlers for sub ioctl */ |
| 6747 | { |
| 6748 | WE_TDLS_CONFIG_PARAMS, |
| 6749 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 6750 | 0, |
| 6751 | "setTdlsConfig" }, |
| 6752 | #endif |
| 6753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6754 | /* handlers for main ioctl */ |
| 6755 | { WLAN_PRIV_ADD_TSPEC, |
| 6756 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT, |
| 6757 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6758 | "addTspec" }, |
| 6759 | |
| 6760 | /* handlers for main ioctl */ |
| 6761 | { WLAN_PRIV_DEL_TSPEC, |
| 6762 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6763 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6764 | "delTspec" }, |
| 6765 | |
| 6766 | /* handlers for main ioctl */ |
| 6767 | { WLAN_PRIV_GET_TSPEC, |
| 6768 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6769 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6770 | "getTspec" }, |
| 6771 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6772 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 6773 | /* handlers for main ioctl - OEM DATA */ |
| 6774 | { |
| 6775 | WLAN_PRIV_SET_OEM_DATA_REQ, |
| 6776 | IW_PRIV_TYPE_BYTE | sizeof(struct iw_oem_data_req) | IW_PRIV_SIZE_FIXED, |
| 6777 | 0, |
| 6778 | "set_oem_data_req" }, |
| 6779 | |
| 6780 | /* handlers for main ioctl - OEM DATA */ |
| 6781 | { |
| 6782 | WLAN_PRIV_GET_OEM_DATA_RSP, |
| 6783 | 0, |
| 6784 | IW_PRIV_TYPE_BYTE | MAX_OEM_DATA_RSP_LEN, |
| 6785 | "get_oem_data_rsp" }, |
| 6786 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6787 | |
| 6788 | #ifdef FEATURE_WLAN_WAPI |
| 6789 | /* handlers for main ioctl SET_WAPI_MODE */ |
| 6790 | { WLAN_PRIV_SET_WAPI_MODE, |
| 6791 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6792 | 0, |
| 6793 | "SET_WAPI_MODE" }, |
| 6794 | |
| 6795 | /* handlers for main ioctl GET_WAPI_MODE */ |
| 6796 | { WLAN_PRIV_GET_WAPI_MODE, |
| 6797 | 0, |
| 6798 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 6799 | "GET_WAPI_MODE" }, |
| 6800 | |
| 6801 | /* handlers for main ioctl SET_ASSOC_INFO */ |
| 6802 | { WLAN_PRIV_SET_WAPI_ASSOC_INFO, |
| 6803 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 400, |
| 6804 | 0, |
| 6805 | "SET_WAPI_ASSOC" }, |
| 6806 | |
| 6807 | /* handlers for main ioctl SET_WAPI_KEY */ |
| 6808 | { WLAN_PRIV_SET_WAPI_KEY, |
| 6809 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 71, |
| 6810 | 0, |
| 6811 | "SET_WAPI_KEY" }, |
| 6812 | |
| 6813 | /* handlers for main ioctl SET_WAPI_BKID */ |
| 6814 | { WLAN_PRIV_SET_WAPI_BKID, |
| 6815 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 24, |
| 6816 | 0, |
| 6817 | "SET_WAPI_BKID" }, |
| 6818 | |
| 6819 | /* handlers for main ioctl GET_WAPI_BKID */ |
| 6820 | { WLAN_PRIV_GET_WAPI_BKID, |
| 6821 | 0, |
| 6822 | IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | 24, |
| 6823 | "GET_WAPI_BKID" }, |
| 6824 | #endif /* FEATURE_WLAN_WAPI */ |
| 6825 | |
| 6826 | /* handlers for main ioctl - host offload */ |
| 6827 | { |
| 6828 | WLAN_PRIV_SET_HOST_OFFLOAD, |
| 6829 | IW_PRIV_TYPE_BYTE | sizeof(tHostOffloadRequest), |
| 6830 | 0, |
| 6831 | "setHostOffload" }, |
| 6832 | |
| 6833 | { |
| 6834 | WLAN_GET_WLAN_STATISTICS, |
| 6835 | 0, |
| 6836 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 6837 | "getWlanStats" }, |
| 6838 | |
| 6839 | { |
| 6840 | WLAN_SET_KEEPALIVE_PARAMS, |
| 6841 | IW_PRIV_TYPE_BYTE | sizeof(tKeepAliveRequest), |
| 6842 | 0, |
| 6843 | "setKeepAlive" }, |
| 6844 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 6845 | { |
| 6846 | WLAN_SET_PACKET_FILTER_PARAMS, |
| 6847 | IW_PRIV_TYPE_BYTE | sizeof(tPacketFilterCfg), |
| 6848 | 0, |
| 6849 | "setPktFilter" }, |
| 6850 | #endif |
| 6851 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 6852 | { |
| 6853 | WLAN_SET_PNO, |
| 6854 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6855 | 0, |
| 6856 | "setpno" }, |
| 6857 | #endif |
| 6858 | { |
| 6859 | WLAN_SET_BAND_CONFIG, |
| 6860 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6861 | 0, |
| 6862 | "SETBAND" }, |
| 6863 | /* handlers for dynamic MC BC ioctl */ |
| 6864 | { |
| 6865 | WLAN_PRIV_SET_MCBC_FILTER, |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 6866 | IW_PRIV_TYPE_BYTE | sizeof(tRcvFltMcAddrList), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6867 | 0, |
| 6868 | "setMCBCFilter" }, |
| 6869 | { |
| 6870 | WLAN_PRIV_CLEAR_MCBC_FILTER, |
| 6871 | 0, |
| 6872 | 0, |
| 6873 | "clearMCBCFilter" }, |
| 6874 | { |
| 6875 | WLAN_SET_POWER_PARAMS, |
| 6876 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 6877 | 0, |
| 6878 | "setpowerparams" }, |
| 6879 | { |
| 6880 | WLAN_GET_LINK_SPEED, |
| 6881 | IW_PRIV_TYPE_CHAR | 18, |
| 6882 | IW_PRIV_TYPE_CHAR | 3, "getLinkSpeed" }, |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 6883 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6884 | }; |
| 6885 | |
| 6886 | |
| 6887 | |
| 6888 | const struct iw_handler_def we_handler_def = { |
| 6889 | .num_standard = sizeof(we_handler) / sizeof(we_handler[0]), |
| 6890 | .num_private = sizeof(we_private) / sizeof(we_private[0]), |
| 6891 | .num_private_args = sizeof(we_private_args) / sizeof(we_private_args[0]), |
| 6892 | |
| 6893 | .standard = (iw_handler *)we_handler, |
| 6894 | .private = (iw_handler *)we_private, |
| 6895 | .private_args = we_private_args, |
| 6896 | .get_wireless_stats = get_wireless_stats, |
| 6897 | }; |
| 6898 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 6899 | 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) |
| 6900 | { |
| 6901 | v_U32_t cmd = 288; //Command to RIVA |
| 6902 | hdd_context_t *pHddCtx = NULL; |
| 6903 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6904 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6905 | /* |
| 6906 | *configMccParam : specify the bit which needs to be modified |
| 6907 | *allowed to update based on wlan_qcom_cfg.ini |
| 6908 | * configuration |
| 6909 | * Bit 0 : SCHEDULE_TIME_SLICE MIN : 5 MAX : 20 |
| 6910 | * Bit 1 : MAX_NULL_SEND_TIME MIN : 1 MAX : 10 |
| 6911 | * Bit 2 : TX_EARLY_STOP_TIME MIN : 1 MAX : 10 |
| 6912 | * Bit 3 : RX_DRAIN_TIME MIN : 1 MAX : 10 |
| 6913 | * Bit 4 : CHANNEL_SWITCH_TIME MIN : 1 MAX : 20 |
| 6914 | * Bit 5 : MIN_CHANNEL_TIME MIN : 5 MAX : 20 |
| 6915 | * Bit 6 : PARK_BEFORE_TBTT MIN : 1 MAX : 5 |
| 6916 | * Bit 7 : MIN_AFTER_DTIM MIN : 5 MAX : 15 |
| 6917 | * Bit 8 : TOO_CLOSE_MARGIN MIN : 1 MAX : 3 |
| 6918 | * Bit 9 : Reserved |
| 6919 | */ |
| 6920 | switch (arg1) |
| 6921 | { |
| 6922 | //Update MCC SCHEDULE_TIME_SLICE parameter |
| 6923 | case MCC_SCHEDULE_TIME_SLICE_CFG_PARAM : |
| 6924 | if( pHddCtx->cfg_ini->configMccParam & 0x0001) |
| 6925 | { |
| 6926 | if((arg2 >= 5) && (arg2 <= 20)) |
| 6927 | { |
| 6928 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 6929 | } |
| 6930 | else |
| 6931 | { |
| 6932 | hddLog(LOGE, "%s : Enter a valid MCC configuration value\n",__FUNCTION__); |
| 6933 | return 0; |
| 6934 | } |
| 6935 | } |
| 6936 | break; |
| 6937 | |
| 6938 | //Update MCC MAX_NULL_SEND_TIME parameter |
| 6939 | case MCC_MAX_NULL_SEND_TIME_CFG_PARAM : |
| 6940 | if( pHddCtx->cfg_ini->configMccParam & 0x0002) |
| 6941 | { |
| 6942 | if((arg2 >= 1) && (arg2 <= 10)) |
| 6943 | { |
| 6944 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 6945 | } |
| 6946 | else |
| 6947 | { |
| 6948 | hddLog(LOGE, "%s : Enter a valid MCC configuration value\n",__FUNCTION__); |
| 6949 | return 0; |
| 6950 | } |
| 6951 | } |
| 6952 | break; |
| 6953 | |
| 6954 | //Update MCC TX_EARLY_STOP_TIME parameter |
| 6955 | case MCC_TX_EARLY_STOP_TIME_CFG_PARAM : |
| 6956 | if( pHddCtx->cfg_ini->configMccParam & 0x0004) |
| 6957 | { |
| 6958 | if((arg2 >= 1) && (arg2 <= 10)) |
| 6959 | { |
| 6960 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 6961 | } |
| 6962 | else |
| 6963 | { |
| 6964 | hddLog(LOGE, "%s : Enter a valid MCC configuration value\n",__FUNCTION__); |
| 6965 | return 0; |
| 6966 | } |
| 6967 | } |
| 6968 | break; |
| 6969 | |
| 6970 | //Update MCC RX_DRAIN_TIME parameter |
| 6971 | case MCC_RX_DRAIN_TIME_CFG_PARAM : |
| 6972 | if( pHddCtx->cfg_ini->configMccParam & 0x0008) |
| 6973 | { |
| 6974 | if((arg2 >= 1) && (arg2 <= 10)) |
| 6975 | { |
| 6976 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 6977 | } |
| 6978 | else |
| 6979 | { |
| 6980 | hddLog(LOGE, "%s : Enter a valid MCC configuration value\n",__FUNCTION__); |
| 6981 | return 0; |
| 6982 | } |
| 6983 | } |
| 6984 | break; |
| 6985 | |
| 6986 | //Update MCC CHANNEL_SWITCH_TIME parameter |
| 6987 | case MCC_CHANNEL_SWITCH_TIME_CFG_PARAM : |
| 6988 | if( pHddCtx->cfg_ini->configMccParam & 0x0010) |
| 6989 | { |
| 6990 | if((arg2 >= 1) && (arg2 <= 20)) |
| 6991 | { |
| 6992 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 6993 | } |
| 6994 | else |
| 6995 | { |
| 6996 | hddLog(LOGE, "%s : Enter a valid MCC configuration value\n",__FUNCTION__); |
| 6997 | return 0; |
| 6998 | } |
| 6999 | } |
| 7000 | break; |
| 7001 | |
| 7002 | //Update MCC MIN_CHANNEL_TIME parameter |
| 7003 | case MCC_MIN_CHANNEL_TIME_CFG_PARAM : |
| 7004 | if( pHddCtx->cfg_ini->configMccParam & 0x0020) |
| 7005 | { |
| 7006 | if((arg2 >= 5) && (arg2 <= 20)) |
| 7007 | { |
| 7008 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 7009 | } |
| 7010 | else |
| 7011 | { |
| 7012 | hddLog(LOGE, "%s : Enter a valid MCC configuration value\n",__FUNCTION__); |
| 7013 | return 0; |
| 7014 | } |
| 7015 | } |
| 7016 | break; |
| 7017 | |
| 7018 | //Update MCC PARK_BEFORE_TBTT parameter |
| 7019 | case MCC_PARK_BEFORE_TBTT_CFG_PARAM : |
| 7020 | if( pHddCtx->cfg_ini->configMccParam & 0x0040) |
| 7021 | { |
| 7022 | if((arg2 >= 1) && (arg2 <= 5)) |
| 7023 | { |
| 7024 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 7025 | } |
| 7026 | else |
| 7027 | { |
| 7028 | hddLog(LOGE, "%s : Enter a valid MCC configuration value\n",__FUNCTION__); |
| 7029 | return 0; |
| 7030 | } |
| 7031 | } |
| 7032 | break; |
| 7033 | |
| 7034 | //Update MCC MIN_AFTER_DTIM parameter |
| 7035 | case MCC_MIN_AFTER_DTIM_CFG_PARAM : |
| 7036 | if( pHddCtx->cfg_ini->configMccParam & 0x0080) |
| 7037 | { |
| 7038 | if((arg2 >= 5) && (arg2 <= 15)) |
| 7039 | { |
| 7040 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 7041 | } |
| 7042 | else |
| 7043 | { |
| 7044 | hddLog(LOGE, "%s : Enter a valid MCC configuration value\n",__FUNCTION__); |
| 7045 | return 0; |
| 7046 | } |
| 7047 | } |
| 7048 | break; |
| 7049 | |
| 7050 | //Update MCC TOO_CLOSE_MARGIN parameter |
| 7051 | case MCC_TOO_CLOSE_MARGIN_CFG_PARAM : |
| 7052 | if( pHddCtx->cfg_ini->configMccParam & 0x0100) |
| 7053 | { |
| 7054 | if((arg2 >= 1) && (arg2 <= 3)) |
| 7055 | { |
| 7056 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 7057 | } |
| 7058 | else |
| 7059 | { |
| 7060 | hddLog(LOGE, "%s : Enter a valid MCC configuration value\n",__FUNCTION__); |
| 7061 | return 0; |
| 7062 | } |
| 7063 | } |
| 7064 | break; |
| 7065 | |
| 7066 | default : |
| 7067 | hddLog(LOGE, "%s : Uknown / Not allowed to configure parameter : %d\n", |
| 7068 | __FUNCTION__,arg1); |
| 7069 | break; |
| 7070 | } |
| 7071 | return 0; |
| 7072 | } |
| 7073 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7074 | int hdd_set_wext(hdd_adapter_t *pAdapter) |
| 7075 | { |
| 7076 | hdd_wext_state_t *pwextBuf; |
| 7077 | 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] | 7078 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7079 | |
| 7080 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7081 | |
| 7082 | // Now configure the roaming profile links. To SSID and bssid. |
| 7083 | pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0; |
| 7084 | pwextBuf->roamProfile.SSIDs.SSIDList = &pHddStaCtx->conn_info.SSID; |
| 7085 | |
| 7086 | pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0; |
| 7087 | pwextBuf->roamProfile.BSSIDs.bssid = &pHddStaCtx->conn_info.bssId; |
| 7088 | |
| 7089 | /*Set the numOfChannels to zero to scan all the channels*/ |
| 7090 | pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0; |
| 7091 | pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL; |
| 7092 | |
| 7093 | /* Default is no encryption */ |
| 7094 | pwextBuf->roamProfile.EncryptionType.numEntries = 1; |
| 7095 | pwextBuf->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 7096 | |
| 7097 | pwextBuf->roamProfile.mcEncryptionType.numEntries = 1; |
| 7098 | pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 7099 | |
| 7100 | pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 7101 | |
| 7102 | /* Default is no authentication */ |
| 7103 | pwextBuf->roamProfile.AuthType.numEntries = 1; |
| 7104 | pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 7105 | |
| 7106 | pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 7107 | pwextBuf->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 7108 | |
| 7109 | /*Set the default scan mode*/ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 7110 | pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7111 | |
| 7112 | hdd_clearRoamProfileIe(pAdapter); |
| 7113 | |
| 7114 | return VOS_STATUS_SUCCESS; |
| 7115 | |
| 7116 | } |
| 7117 | |
| 7118 | int hdd_register_wext(struct net_device *dev) |
| 7119 | { |
| 7120 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7121 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 7122 | VOS_STATUS status; |
| 7123 | |
| 7124 | ENTER(); |
| 7125 | |
| 7126 | // Zero the memory. This zeros the profile structure. |
| 7127 | memset(pwextBuf, 0,sizeof(hdd_wext_state_t)); |
| 7128 | |
| 7129 | init_completion(&(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->completion_var); |
| 7130 | |
| 7131 | |
| 7132 | status = hdd_set_wext(pAdapter); |
| 7133 | |
| 7134 | if(!VOS_IS_STATUS_SUCCESS(status)) { |
| 7135 | |
| 7136 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: hdd_set_wext failed!!\n")); |
| 7137 | return eHAL_STATUS_FAILURE; |
| 7138 | } |
| 7139 | |
| 7140 | if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->vosevent))) |
| 7141 | { |
| 7142 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD vos event init failed!!\n")); |
| 7143 | return eHAL_STATUS_FAILURE; |
| 7144 | } |
| 7145 | |
| 7146 | if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->scanevent))) |
| 7147 | { |
| 7148 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD scan event init failed!!\n")); |
| 7149 | return eHAL_STATUS_FAILURE; |
| 7150 | } |
| 7151 | |
| 7152 | // Register as a wireless device |
| 7153 | dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def; |
| 7154 | |
| 7155 | EXIT(); |
| 7156 | return 0; |
| 7157 | } |
| 7158 | |
| 7159 | int hdd_UnregisterWext(struct net_device *dev) |
| 7160 | { |
| 7161 | #if 0 |
| 7162 | hdd_wext_state_t *wextBuf; |
| 7163 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7164 | |
| 7165 | ENTER(); |
| 7166 | // Set up the pointer to the Wireless Extensions state structure |
| 7167 | wextBuf = pAdapter->pWextState; |
| 7168 | |
| 7169 | // De-allocate the Wireless Extensions state structure |
| 7170 | kfree(wextBuf); |
| 7171 | |
| 7172 | // Clear out the pointer to the Wireless Extensions state structure |
| 7173 | pAdapter->pWextState = NULL; |
| 7174 | |
| 7175 | EXIT(); |
| 7176 | #endif |
| 7177 | dev->wireless_handlers = NULL; |
| 7178 | return 0; |
| 7179 | } |
| 7180 | |
| 7181 | |