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