Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Yeshwanth Sriram Guntuka | 8856621 | 2019-04-17 15:02:33 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 26 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 27 | |
| 28 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 29 | |
| 30 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 31 | /** ------------------------------------------------------------------------ * |
| 32 | ------------------------------------------------------------------------ * |
| 33 | |
| 34 | |
| 35 | \file wlan_hdd_wext.c |
| 36 | |
| 37 | \brief Airgo Linux Wireless Extensions Common Control Plane Types and |
| 38 | interfaces. |
| 39 | |
| 40 | $Id: wlan_hdd_wext.c,v 1.34 2007/04/14 01:49:23 jimz Exp jimz $ |
| 41 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | This file defines all of the types that are utilized by the CCP module |
| 43 | of the "Portable" HDD. This file also includes the underlying Linux |
| 44 | Wireless Extensions Data types referred to by CCP. |
| 45 | |
| 46 | ======================================================================== */ |
| 47 | |
| 48 | #include <linux/version.h> |
| 49 | #include <linux/module.h> |
| 50 | #include <linux/kernel.h> |
| 51 | #include <linux/init.h> |
| 52 | #include <linux/wireless.h> |
Anand N Sunkad | 0a3436f | 2015-05-01 14:22:19 +0530 | [diff] [blame] | 53 | #include <linux/wcnss_wlan.h> |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 54 | #include <macTrace.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | #include <wlan_hdd_includes.h> |
| 56 | #include <wlan_btc_svc.h> |
| 57 | #include <wlan_nlink_common.h> |
| 58 | #ifdef WLAN_BTAMP_FEATURE |
| 59 | #include <bap_hdd_main.h> |
| 60 | #endif |
| 61 | #include <vos_api.h> |
| 62 | #include <net/arp.h> |
| 63 | #include "ccmApi.h" |
| 64 | #include "sirParams.h" |
| 65 | #include "csrApi.h" |
| 66 | #include "csrInsideApi.h" |
| 67 | #if defined WLAN_FEATURE_VOWIFI |
| 68 | #include "smeRrmInternal.h" |
| 69 | #endif |
| 70 | #include <aniGlobal.h> |
| 71 | #include "dot11f.h" |
| 72 | #include <wlan_hdd_wowl.h> |
| 73 | #include <wlan_hdd_cfg.h> |
| 74 | #include <wlan_hdd_wmm.h> |
| 75 | #include "utilsApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 76 | #include "wlan_hdd_p2p.h" |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 77 | #ifdef FEATURE_WLAN_TDLS |
| 78 | #include "wlan_hdd_tdls.h" |
| 79 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 80 | |
| 81 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 82 | #include <linux/earlysuspend.h> |
| 83 | #endif |
| 84 | #include "wlan_hdd_power.h" |
| 85 | #include "qwlan_version.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 86 | #include "wlan_hdd_host_offload.h" |
| 87 | #include "wlan_hdd_keep_alive.h" |
| 88 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 89 | #include "wlan_hdd_packet_filtering.h" |
| 90 | #endif |
| 91 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 92 | #include <linux/wireless.h> |
| 93 | #include <net/cfg80211.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 94 | #include "wlan_qct_pal_trace.h" |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 95 | #include "wlan_qct_tl.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 96 | |
| 97 | #include "wlan_hdd_misc.h" |
| 98 | #include "bap_hdd_misc.h" |
| 99 | |
| 100 | #include "wlan_hdd_dev_pwr.h" |
| 101 | #include "qc_sap_ioctl.h" |
Gopichand Nakkala | fe7246d | 2013-06-10 17:43:37 +0530 | [diff] [blame] | 102 | #include "sme_Api.h" |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 103 | #include "vos_trace.h" |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 104 | #include "wlan_hdd_assoc.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 106 | #include "vos_utils.h" |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 107 | #include "sapInternal.h" |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 108 | #include "wlan_hdd_request_manager.h" |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 109 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 111 | extern void hdd_suspend_wlan(struct early_suspend *wlan_suspend); |
| 112 | extern void hdd_resume_wlan(struct early_suspend *wlan_suspend); |
| 113 | #endif |
| 114 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 115 | #ifdef FEATURE_OEM_DATA_SUPPORT |
Madan Mohan Koyyalamudi | 7a4d931 | 2012-12-04 17:21:36 -0800 | [diff] [blame] | 116 | #define MAX_OEM_DATA_RSP_LEN 2047 |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 117 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 118 | |
| 119 | #define HDD_FINISH_ULA_TIME_OUT 800 |
Sushant Kaushik | 10315f9 | 2014-04-29 11:30:25 +0530 | [diff] [blame] | 120 | #define COUNTRY_CODE_LEN 2 |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 121 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 122 | |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 123 | // tdlsoffchan |
| 124 | #ifdef FEATURE_WLAN_TDLS |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 125 | static int tdlsOffCh = 1; |
| 126 | static int tdlsOffChBwOffset = 0; |
| 127 | #endif |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 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 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 132 | /* To Validate Channel against the Frequency and Vice-Versa */ |
| 133 | static const hdd_freq_chan_map_t freq_chan_map[] = { {2412, 1}, {2417, 2}, |
| 134 | {2422, 3}, {2427, 4}, {2432, 5}, {2437, 6}, {2442, 7}, {2447, 8}, |
| 135 | {2452, 9}, {2457, 10}, {2462, 11}, {2467 ,12}, {2472, 13}, |
| 136 | {2484, 14}, {4920, 240}, {4940, 244}, {4960, 248}, {4980, 252}, |
| 137 | {5040, 208}, {5060, 212}, {5080, 216}, {5180, 36}, {5200, 40}, {5220, 44}, |
| 138 | {5240, 48}, {5260, 52}, {5280, 56}, {5300, 60}, {5320, 64}, {5500, 100}, |
| 139 | {5520, 104}, {5540, 108}, {5560, 112}, {5580, 116}, {5600, 120}, |
| 140 | {5620, 124}, {5640, 128}, {5660, 132}, {5680, 136}, {5700, 140}, |
Manjunathappa Prakash | 009dcb4 | 2014-03-07 15:29:22 -0800 | [diff] [blame] | 141 | {5720, 144}, {5745, 149}, {5765, 153}, {5785, 157}, {5805, 161}, |
| 142 | {5825, 165} }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 143 | |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 144 | #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] | 145 | |
| 146 | /* Private ioctls and their sub-ioctls */ |
| 147 | #define WLAN_PRIV_SET_INT_GET_NONE (SIOCIWFIRSTPRIV + 0) |
| 148 | #define WE_SET_11D_STATE 1 |
| 149 | #define WE_WOWL 2 |
| 150 | #define WE_SET_POWER 3 |
| 151 | #define WE_SET_MAX_ASSOC 4 |
| 152 | #define WE_SET_SAP_AUTO_CHANNEL_SELECTION 5 |
| 153 | #define WE_SET_DATA_INACTIVITY_TO 6 |
| 154 | #define WE_SET_MAX_TX_POWER 7 |
| 155 | #define WE_SET_HIGHER_DTIM_TRANSITION 8 |
| 156 | #define WE_SET_TM_LEVEL 9 |
Kiet Lam | 46b8e4e | 2013-11-06 21:49:53 +0530 | [diff] [blame] | 157 | #define WE_ENABLE_STRICT_FCC_REG 10 |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 158 | #define WE_SET_MAX_TX_POWER_2_4 11 |
| 159 | #define WE_SET_MAX_TX_POWER_5_0 12 |
Tushnim Bhattacharyya | a3ba5a5 | 2014-01-30 11:37:33 -0800 | [diff] [blame] | 160 | /* Private IOCTL for debug connection issues */ |
| 161 | #define WE_SET_DEBUG_LOG 13 |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 162 | // tdlsoffchan |
| 163 | #ifdef FEATURE_WLAN_TDLS |
| 164 | #define WE_SET_TDLS_OFF_CHAN 14 |
| 165 | #define WE_SET_TDLS_SEC_OFF_CHAN_OFFSET 15 |
| 166 | #define WE_SET_TDLS_OFF_CHAN_MODE 16 |
| 167 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 168 | #define WE_SET_SCAN_BAND_PREFERENCE 17 |
Abhishek Singh | 01c73d1 | 2015-03-12 15:13:44 +0530 | [diff] [blame] | 169 | #define WE_SET_MIRACAST_VENDOR_CONFIG 18 |
Siddharth Bhal | 678a934 | 2015-02-27 01:12:56 +0530 | [diff] [blame] | 170 | #define WE_GET_FRAME_LOG 19 |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 171 | #ifdef FEATURE_WLAN_TDLS |
| 172 | #define WE_SET_TDLS_2040_BSS_COEXISTENCE 20 |
| 173 | #endif |
Abhishek Singh | 41988ba | 2015-05-25 19:42:29 +0530 | [diff] [blame] | 174 | #define WE_SET_RTS_CTS_HTVHT 21 |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 175 | #define WE_SET_MONITOR_STATE 22 |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 176 | #define WE_SET_PKT_STATS_ENABLE_DISABLE 23 |
Hanumantha Reddy Pothula | 519a1ea | 2015-12-09 14:06:03 +0530 | [diff] [blame] | 177 | #define WE_SET_PROXIMITY_ENABLE 24 |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 178 | #define WE_CAP_TSF 25 |
SaidiReddy Yenuga | 9c1a614 | 2017-02-06 16:30:04 +0530 | [diff] [blame] | 179 | #define WE_SET_MODULATED_DTIM 26 |
SaidiReddy Yenuga | c341fbf | 2017-02-01 20:22:45 +0530 | [diff] [blame] | 180 | #define WLAN_SET_DYNNAMIC_AGGREGATION 27 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | |
| 182 | /* Private ioctls and their sub-ioctls */ |
| 183 | #define WLAN_PRIV_SET_NONE_GET_INT (SIOCIWFIRSTPRIV + 1) |
| 184 | #define WE_GET_11D_STATE 1 |
| 185 | #define WE_IBSS_STATUS 2 |
| 186 | #define WE_PMC_STATE 3 |
| 187 | #define WE_GET_WLAN_DBG 4 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 188 | #define WE_GET_MAX_ASSOC 6 |
| 189 | #define WE_GET_WDI_DBG 7 |
| 190 | #define WE_GET_SAP_AUTO_CHANNEL_SELECTION 8 |
| 191 | #define WE_GET_CONCURRENCY_MODE 9 |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 192 | #define WE_GET_SCAN_BAND_PREFERENCE 10 |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 193 | #define WE_GET_ANTENA_DIVERSITY_SELECTION 11 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 194 | /* Private ioctls and their sub-ioctls */ |
| 195 | #define WLAN_PRIV_SET_INT_GET_INT (SIOCIWFIRSTPRIV + 2) |
| 196 | |
| 197 | /* Private ioctls and their sub-ioctls */ |
| 198 | #define WLAN_PRIV_SET_CHAR_GET_NONE (SIOCIWFIRSTPRIV + 3) |
| 199 | #define WE_WOWL_ADD_PTRN 1 |
| 200 | #define WE_WOWL_DEL_PTRN 2 |
| 201 | #if defined WLAN_FEATURE_VOWIFI |
| 202 | #define WE_NEIGHBOR_REPORT_REQUEST 3 |
| 203 | #endif |
| 204 | #define WE_SET_AP_WPS_IE 4 //This is called in station mode to set probe rsp ie. |
| 205 | #define WE_SET_CONFIG 5 |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 206 | #define WE_SET_ENCRYPT_MSG 6 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 207 | |
| 208 | /* Private ioctls and their sub-ioctls */ |
| 209 | #define WLAN_PRIV_SET_THREE_INT_GET_NONE (SIOCIWFIRSTPRIV + 4) |
| 210 | #define WE_SET_WLAN_DBG 1 |
| 211 | #define WE_SET_WDI_DBG 2 |
| 212 | #define WE_SET_SAP_CHANNELS 3 |
| 213 | |
| 214 | /* Private ioctls and their sub-ioctls */ |
| 215 | #define WLAN_PRIV_GET_CHAR_SET_NONE (SIOCIWFIRSTPRIV + 5) |
| 216 | #define WE_WLAN_VERSION 1 |
| 217 | #define WE_GET_STATS 2 |
| 218 | #define WE_GET_CFG 3 |
| 219 | #define WE_GET_WMM_STATUS 4 |
| 220 | #define WE_GET_CHANNEL_LIST 5 |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 221 | #ifdef WLAN_FEATURE_11AC |
| 222 | #define WE_GET_RSSI 6 |
| 223 | #endif |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 224 | #define WE_GET_ROAM_RSSI 7 |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 225 | #ifdef FEATURE_WLAN_TDLS |
| 226 | #define WE_GET_TDLS_PEERS 8 |
| 227 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 228 | #ifdef WLAN_FEATURE_11W |
| 229 | #define WE_GET_11W_INFO 9 |
| 230 | #endif |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 231 | #define WE_GET_STATES 10 |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 232 | #ifdef WLAN_FEATURE_RMC |
| 233 | #define WE_GET_IBSS_STA_INFO 11 |
| 234 | #endif |
| 235 | #define WE_GET_SNR 12 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 236 | |
Padma, Santhosh Kumar | 8dcdb70 | 2015-10-20 14:06:21 +0530 | [diff] [blame] | 237 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 238 | #define WE_GET_OEM_DATA_CAP 13 |
| 239 | #endif |
| 240 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 241 | /* Private ioctls and their sub-ioctls */ |
| 242 | #define WLAN_PRIV_SET_NONE_GET_NONE (SIOCIWFIRSTPRIV + 6) |
| 243 | #define WE_CLEAR_STATS 1 |
| 244 | #define WE_INIT_AP 2 |
| 245 | #define WE_STOP_AP 3 |
Girish Gowli | 345bff8 | 2014-06-09 20:05:24 +0530 | [diff] [blame] | 246 | #ifdef WLAN_BTAMP_FEATURE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 247 | #define WE_ENABLE_AMP 4 |
| 248 | #define WE_DISABLE_AMP 5 |
Girish Gowli | 345bff8 | 2014-06-09 20:05:24 +0530 | [diff] [blame] | 249 | #endif /* WLAN_BTAMP_FEATURE */ |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 250 | #define WE_ENABLE_DXE_STALL_DETECT 6 |
| 251 | #define WE_DISPLAY_DXE_SNAP_SHOT 7 |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 252 | #define WE_SET_REASSOC_TRIGGER 8 |
Sandeep Puligilla | a3e7695 | 2014-06-23 15:53:11 +0530 | [diff] [blame] | 253 | #define WE_DISPLAY_DATAPATH_SNAP_SHOT 9 |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 254 | #ifdef WLAN_FEATURE_RMC |
| 255 | #define WE_IBSS_GET_PEER_INFO_ALL 10 |
| 256 | #endif |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 257 | #define WE_STOP_OBSS_SCAN 11 |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 258 | #define WE_DUMP_ROAM_TIMER_LOG 12 |
| 259 | #define WE_RESET_ROAM_TIMER_LOG 13 |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 260 | #define WE_GET_FW_LOGS 14 |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 261 | #define WE_GET_FW_MEMDUMP 15 |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 262 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 263 | /* Private ioctls and their sub-ioctls */ |
| 264 | #define WLAN_PRIV_SET_VAR_INT_GET_NONE (SIOCIWFIRSTPRIV + 7) |
| 265 | #define WE_LOG_DUMP_CMD 1 |
| 266 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 267 | #define WE_P2P_NOA_CMD 2 |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 268 | //IOCTL to configure MCC params |
| 269 | #define WE_MCC_CONFIG_CREDENTIAL 3 |
| 270 | #define WE_MCC_CONFIG_PARAMS 4 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 271 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 272 | #ifdef FEATURE_WLAN_TDLS |
| 273 | #define WE_TDLS_CONFIG_PARAMS 5 |
| 274 | #endif |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 275 | #ifdef WLAN_FEATURE_RMC |
| 276 | #define WE_IBSS_GET_PEER_INFO 6 |
| 277 | #endif |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 278 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 279 | #define WE_MTRACE_DUMP_CMD 8 |
Katya Nigam | c2f29dc | 2014-01-20 19:29:30 +0530 | [diff] [blame] | 280 | #define WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD 9 |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 281 | #define WE_CONFIGURE_MONITOR_MODE 10 |
| 282 | #define WE_SET_MONITOR_MODE_FILTER 11 |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 283 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 284 | #ifdef FEATURE_WLAN_TDLS |
| 285 | #undef MAX_VAR_ARGS |
| 286 | #define MAX_VAR_ARGS 10 |
| 287 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 288 | #define MAX_VAR_ARGS 7 |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 289 | #endif |
| 290 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 291 | /* Private ioctls (with no sub-ioctls) */ |
| 292 | /* note that they must be odd so that they have "get" semantics */ |
| 293 | #define WLAN_PRIV_ADD_TSPEC (SIOCIWFIRSTPRIV + 9) |
| 294 | #define WLAN_PRIV_DEL_TSPEC (SIOCIWFIRSTPRIV + 11) |
| 295 | #define WLAN_PRIV_GET_TSPEC (SIOCIWFIRSTPRIV + 13) |
| 296 | |
Girish Gowli | 464c9c8 | 2014-06-09 19:47:53 +0530 | [diff] [blame] | 297 | /* (SIOCIWFIRSTPRIV + 8) is currently unused */ |
| 298 | /* (SIOCIWFIRSTPRIV + 16) is currently unused */ |
| 299 | /* (SIOCIWFIRSTPRIV + 10) is currently unused */ |
| 300 | /* (SIOCIWFIRSTPRIV + 12) is currently unused */ |
| 301 | /* (SIOCIWFIRSTPRIV + 14) is currently unused */ |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 302 | #define WLAN_PRIV_SET_NONE_GET_THREE_INT (SIOCIWFIRSTPRIV + 15) |
| 303 | #define WE_GET_TSF 1 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 304 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 305 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 306 | /* Private ioctls for setting the measurement configuration */ |
| 307 | #define WLAN_PRIV_SET_OEM_DATA_REQ (SIOCIWFIRSTPRIV + 17) |
| 308 | #define WLAN_PRIV_GET_OEM_DATA_RSP (SIOCIWFIRSTPRIV + 19) |
| 309 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 310 | |
| 311 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 312 | #define WLAN_PRIV_SET_FTIES (SIOCIWFIRSTPRIV + 20) |
| 313 | #endif |
| 314 | |
| 315 | /* Private ioctl for setting the host offload feature */ |
| 316 | #define WLAN_PRIV_SET_HOST_OFFLOAD (SIOCIWFIRSTPRIV + 18) |
| 317 | |
| 318 | /* Private ioctl to get the statistics */ |
| 319 | #define WLAN_GET_WLAN_STATISTICS (SIOCIWFIRSTPRIV + 21) |
| 320 | |
| 321 | /* Private ioctl to set the Keep Alive Params */ |
| 322 | #define WLAN_SET_KEEPALIVE_PARAMS (SIOCIWFIRSTPRIV + 22) |
| 323 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 324 | /* Private ioctl to set the Packet Filtering Params */ |
| 325 | #define WLAN_SET_PACKET_FILTER_PARAMS (SIOCIWFIRSTPRIV + 23) |
| 326 | #endif |
| 327 | |
| 328 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 329 | /* Private ioctl to get the statistics */ |
| 330 | #define WLAN_SET_PNO (SIOCIWFIRSTPRIV + 24) |
| 331 | #endif |
| 332 | |
| 333 | #define WLAN_SET_BAND_CONFIG (SIOCIWFIRSTPRIV + 25) /*Don't change this number*/ |
| 334 | |
| 335 | #define WLAN_PRIV_SET_MCBC_FILTER (SIOCIWFIRSTPRIV + 26) |
| 336 | #define WLAN_PRIV_CLEAR_MCBC_FILTER (SIOCIWFIRSTPRIV + 27) |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 337 | /* Private ioctl to trigger reassociation */ |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 338 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 339 | #define WLAN_SET_POWER_PARAMS (SIOCIWFIRSTPRIV + 29) |
| 340 | #define WLAN_GET_LINK_SPEED (SIOCIWFIRSTPRIV + 31) |
| 341 | |
| 342 | #define WLAN_STATS_INVALID 0 |
| 343 | #define WLAN_STATS_RETRY_CNT 1 |
| 344 | #define WLAN_STATS_MUL_RETRY_CNT 2 |
| 345 | #define WLAN_STATS_TX_FRM_CNT 3 |
| 346 | #define WLAN_STATS_RX_FRM_CNT 4 |
| 347 | #define WLAN_STATS_FRM_DUP_CNT 5 |
| 348 | #define WLAN_STATS_FAIL_CNT 6 |
| 349 | #define WLAN_STATS_RTS_FAIL_CNT 7 |
| 350 | #define WLAN_STATS_ACK_FAIL_CNT 8 |
| 351 | #define WLAN_STATS_RTS_SUC_CNT 9 |
| 352 | #define WLAN_STATS_RX_DISCARD_CNT 10 |
| 353 | #define WLAN_STATS_RX_ERROR_CNT 11 |
| 354 | #define WLAN_STATS_TX_BYTE_CNT 12 |
| 355 | |
| 356 | #define WLAN_STATS_RX_BYTE_CNT 13 |
| 357 | #define WLAN_STATS_RX_RATE 14 |
| 358 | #define WLAN_STATS_TX_RATE 15 |
| 359 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 360 | #define WLAN_STATS_RX_UC_BYTE_CNT 16 |
| 361 | #define WLAN_STATS_RX_MC_BYTE_CNT 17 |
| 362 | #define WLAN_STATS_RX_BC_BYTE_CNT 18 |
| 363 | #define WLAN_STATS_TX_UC_BYTE_CNT 19 |
| 364 | #define WLAN_STATS_TX_MC_BYTE_CNT 20 |
| 365 | #define WLAN_STATS_TX_BC_BYTE_CNT 21 |
| 366 | |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 367 | #define FILL_TLV(__p, __type, __size, __val, __tlen) do { \ |
| 368 | if ((__tlen + __size + 2) < WE_MAX_STR_LEN) \ |
| 369 | { \ |
| 370 | *__p++ = __type; \ |
| 371 | *__p++ = __size; \ |
| 372 | memcpy(__p, __val, __size); \ |
| 373 | __p += __size; \ |
| 374 | __tlen += __size + 2; \ |
| 375 | } \ |
| 376 | else \ |
| 377 | { \ |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 378 | hddLog(VOS_TRACE_LEVEL_ERROR, "FILL_TLV Failed!!!"); \ |
Madan Mohan Koyyalamudi | c0d1b3f | 2012-11-13 10:41:07 -0800 | [diff] [blame] | 379 | } \ |
| 380 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 381 | |
| 382 | #define VERSION_VALUE_MAX_LEN 32 |
| 383 | |
| 384 | #define TX_PER_TRACKING_DEFAULT_RATIO 5 |
| 385 | #define TX_PER_TRACKING_MAX_RATIO 10 |
| 386 | #define TX_PER_TRACKING_DEFAULT_WATERMARK 5 |
| 387 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 388 | #define WLAN_ADAPTER 0 |
| 389 | #define P2P_ADAPTER 1 |
| 390 | |
Hanumantha Reddy Pothula | 519a1ea | 2015-12-09 14:06:03 +0530 | [diff] [blame] | 391 | #define TX_PWR_MIN 6 |
| 392 | #define TX_PWR_MAX 22 |
| 393 | #define TX_PWR_DEF 50 |
| 394 | |
SaidiReddy Yenuga | c341fbf | 2017-02-01 20:22:45 +0530 | [diff] [blame] | 395 | /* Dynamic Aggregation */ |
| 396 | #define DISABLE_AGGREGATION 0 |
| 397 | #define ENABLE_AGGREGATION 1 |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 398 | /* |
| 399 | * When supplicant sends SETBAND ioctl it queries for channels from |
| 400 | * cfg80211 layer by sending itself EVENT_CHANNEL_LIST_CHANGED command. |
| 401 | * This is not required if the return type from ioctl is |
| 402 | * DO_NOT_SEND_CHANNEL_CHANGE_EVENT as wiphy will send channel change |
| 403 | * event as part of regulatory_hint. |
| 404 | */ |
| 405 | enum { |
| 406 | SEND_CHANNEL_CHANGE_EVENT = 0, |
| 407 | DO_NOT_SEND_CHANNEL_CHANGE_EVENT, |
| 408 | }; |
| 409 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 410 | /*MCC Configuration parameters */ |
| 411 | enum { |
| 412 | MCC_SCHEDULE_TIME_SLICE_CFG_PARAM = 1, |
| 413 | MCC_MAX_NULL_SEND_TIME_CFG_PARAM, |
| 414 | MCC_TX_EARLY_STOP_TIME_CFG_PARAM, |
| 415 | MCC_RX_DRAIN_TIME_CFG_PARAM, |
| 416 | MCC_CHANNEL_SWITCH_TIME_CFG_PARAM, |
| 417 | MCC_MIN_CHANNEL_TIME_CFG_PARAM, |
| 418 | MCC_PARK_BEFORE_TBTT_CFG_PARAM, |
| 419 | MCC_MIN_AFTER_DTIM_CFG_PARAM, |
| 420 | MCC_TOO_CLOSE_MARGIN_CFG_PARAM, |
| 421 | }; |
| 422 | |
| 423 | int hdd_validate_mcc_config(hdd_adapter_t *pAdapter, v_UINT_t staId, |
| 424 | v_UINT_t arg1, v_UINT_t arg2, v_UINT_t arg3); |
| 425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 426 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 427 | int wlan_hdd_set_filter(hdd_adapter_t *pAdapter, tpPacketFilterCfg pRequest); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 428 | #endif |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 429 | static int get_fwr_memdump(struct net_device *, |
| 430 | struct iw_request_info *, |
| 431 | union iwreq_data *, char *); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 432 | /**--------------------------------------------------------------------------- |
| 433 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 434 | \brief mem_alloc_copy_from_user_helper - |
| 435 | |
| 436 | Helper function to allocate buffer and copy user data. |
| 437 | |
| 438 | \param - wrqu - Pointer to IOCTL Data. |
| 439 | len - size |
| 440 | |
| 441 | \return - On Success pointer to buffer, On failure NULL |
| 442 | |
| 443 | --------------------------------------------------------------------------*/ |
Girish Gowli | 86c471e | 2014-06-17 19:28:05 +0530 | [diff] [blame] | 444 | void *mem_alloc_copy_from_user_helper(const void *wrqu_data, size_t len) |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 445 | { |
| 446 | u8 *ptr = NULL; |
| 447 | |
| 448 | /* in order to protect the code, an extra byte is post appended to the buffer |
| 449 | * and the null termination is added. However, when allocating (len+1) byte |
| 450 | * of memory, we need to make sure that there is no uint overflow when doing |
| 451 | * addition. In theory check len < UINT_MAX protects the uint overflow. For |
| 452 | * wlan private ioctl, the buffer size is much less than UINT_MAX, as a good |
| 453 | * guess, now, it is assumed that the private command buffer size is no |
| 454 | * greater than 4K (4096 bytes). So we use 4096 as the upper boundary for now. |
| 455 | */ |
| 456 | if (len > MAX_USER_COMMAND_SIZE) |
| 457 | { |
| 458 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 459 | "Invalid length"); |
| 460 | return NULL; |
| 461 | } |
| 462 | |
| 463 | ptr = kmalloc(len + 1, GFP_KERNEL); |
| 464 | if (NULL == ptr) |
| 465 | { |
| 466 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 467 | "unable to allocate memory"); |
| 468 | return NULL; |
| 469 | } |
| 470 | |
| 471 | if (copy_from_user(ptr, wrqu_data, len)) |
| 472 | { |
| 473 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 474 | "%s: failed to copy data to user buffer", __func__); |
| 475 | kfree(ptr); |
| 476 | return NULL; |
| 477 | } |
| 478 | ptr[len] = '\0'; |
| 479 | return ptr; |
| 480 | } |
| 481 | |
Girish Gowli | 488ef49 | 2014-06-12 18:44:33 +0530 | [diff] [blame] | 482 | // Function to handle and get compatible struct iw_point passed to ioctl. |
| 483 | int hdd_priv_get_data(struct iw_point *p_priv_data, |
| 484 | union iwreq_data *wrqu) |
| 485 | { |
| 486 | if ((NULL == p_priv_data) || (NULL == wrqu)) |
| 487 | { |
| 488 | return -EINVAL; |
| 489 | } |
| 490 | |
| 491 | #ifdef CONFIG_COMPAT |
| 492 | if (is_compat_task()) |
| 493 | { |
| 494 | struct compat_iw_point *p_compat_priv_data; |
| 495 | |
| 496 | // Compat task: typecast to campat structure and copy the members. |
| 497 | p_compat_priv_data = (struct compat_iw_point *) &wrqu->data; |
| 498 | |
| 499 | p_priv_data->pointer = compat_ptr(p_compat_priv_data->pointer); |
| 500 | p_priv_data->length = p_compat_priv_data->length; |
| 501 | p_priv_data->flags = p_compat_priv_data->flags; |
| 502 | }//if(is_compat_task()) |
| 503 | else |
| 504 | { |
| 505 | #endif //#ifdef CONFIG_COMPAT |
| 506 | |
| 507 | // Non compat task: directly copy the structure. |
| 508 | memcpy(p_priv_data, &wrqu->data, sizeof(struct iw_point)); |
| 509 | |
| 510 | #ifdef CONFIG_COMPAT |
| 511 | }//else of - if(is_compat_task()) |
| 512 | #endif //#ifdef CONFIG_COMPAT |
| 513 | |
| 514 | return 0; |
| 515 | } |
| 516 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 517 | /**--------------------------------------------------------------------------- |
| 518 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 519 | \brief hdd_wlan_get_version() - |
| 520 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 521 | This function use to get Wlan Driver, Firmware, & Hardware Version. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 522 | |
| 523 | \param - pAdapter Pointer to the adapter. |
| 524 | wrqu - Pointer to IOCTL REQUEST Data. |
| 525 | extra - Pointer to char |
| 526 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 527 | \return - none |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 528 | |
| 529 | --------------------------------------------------------------------------*/ |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 530 | void hdd_wlan_get_version(hdd_adapter_t *pAdapter, union iwreq_data *wrqu, |
| 531 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 532 | { |
| 533 | VOS_STATUS status; |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 534 | tSirVersionString wcnss_SW_version; |
| 535 | tSirVersionString wcnss_HW_version; |
Anand N Sunkad | 0a3436f | 2015-05-01 14:22:19 +0530 | [diff] [blame] | 536 | tSirVersionString iris_name; |
| 537 | char *pIRISversion; |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 538 | char *pSWversion; |
| 539 | char *pHWversion; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 540 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 541 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 542 | status = sme_GetWcnssSoftwareVersion(hHal, wcnss_SW_version, |
| 543 | sizeof(wcnss_SW_version)); |
| 544 | if (VOS_IS_STATUS_SUCCESS(status)) |
| 545 | { |
| 546 | pSWversion = wcnss_SW_version; |
| 547 | } |
| 548 | else |
| 549 | { |
| 550 | pSWversion = "Unknown"; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 551 | } |
| 552 | |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 553 | status = sme_GetWcnssHardwareVersion(hHal, wcnss_HW_version, |
| 554 | sizeof(wcnss_HW_version)); |
| 555 | if (VOS_IS_STATUS_SUCCESS(status)) |
| 556 | { |
| 557 | pHWversion = wcnss_HW_version; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 558 | } |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 559 | else |
| 560 | { |
| 561 | pHWversion = "Unknown"; |
| 562 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 563 | |
Anand N Sunkad | 0a3436f | 2015-05-01 14:22:19 +0530 | [diff] [blame] | 564 | status = wcnss_get_iris_name(iris_name); |
| 565 | |
| 566 | if (!status) { |
| 567 | pIRISversion = iris_name; |
| 568 | } else { |
| 569 | pIRISversion = "Unknown"; |
| 570 | } |
| 571 | |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 572 | wrqu->data.length = scnprintf(extra, WE_MAX_STR_LEN, |
Anand N Sunkad | 0a3436f | 2015-05-01 14:22:19 +0530 | [diff] [blame] | 573 | "Host SW:%s, FW:%s, HW:%s, IRIS_HW:%s", |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 574 | QWLAN_VERSIONSTR, |
| 575 | pSWversion, |
Anand N Sunkad | 0a3436f | 2015-05-01 14:22:19 +0530 | [diff] [blame] | 576 | pHWversion, pIRISversion); |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 577 | |
| 578 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 579 | } |
| 580 | |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 581 | #ifdef WLAN_FEATURE_RMC |
| 582 | void hdd_get_ibss_peer_info_cb(v_VOID_t *pUserData, v_VOID_t *pPeerInfoRsp) |
| 583 | { |
| 584 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pUserData; |
| 585 | tSirPeerInfoRspParams *pPeerInfo = (tSirPeerInfoRspParams *)pPeerInfoRsp; |
| 586 | hdd_station_ctx_t *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 587 | v_U8_t i; |
| 588 | |
| 589 | if (NULL != pPeerInfo && eHAL_STATUS_SUCCESS == pPeerInfo->status) |
| 590 | { |
| 591 | pStaCtx->ibss_peer_info.status = pPeerInfo->status; |
| 592 | pStaCtx->ibss_peer_info.numIBSSPeers = pPeerInfo->numPeers; |
| 593 | for (i = 0; i < pPeerInfo->numPeers; i++) |
| 594 | { |
| 595 | memcpy(&pStaCtx->ibss_peer_info.ibssPeerList[i], |
| 596 | &pPeerInfo->peerInfoParams[i], sizeof(hdd_ibss_peer_info_params_t)); |
| 597 | } |
| 598 | } |
| 599 | else |
| 600 | { |
| 601 | hddLog(LOGE, |
| 602 | FL("PEER_INFO_CMD_STATUS is not SUCCESS")); |
| 603 | } |
| 604 | |
| 605 | complete(&pAdapter->ibss_peer_info_comp); |
| 606 | } |
| 607 | |
| 608 | v_MACADDR_t* hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter, v_U8_t staIdx) |
| 609 | { |
| 610 | v_U8_t idx; |
| 611 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 612 | |
| 613 | for ( idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++ ) |
| 614 | { |
| 615 | if ( 0 != pHddStaCtx->conn_info.staId[ idx ] && |
| 616 | staIdx == pHddStaCtx->conn_info.staId[ idx ]) |
| 617 | { |
| 618 | return (&pHddStaCtx->conn_info.peerMacAddress[ idx ]); |
| 619 | } |
| 620 | } |
| 621 | return NULL; |
| 622 | } |
| 623 | |
| 624 | eHalStatus hdd_wlan_get_ibss_peer_info(hdd_adapter_t *pAdapter, v_U8_t staIdx) |
| 625 | { |
| 626 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 627 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 628 | hdd_station_ctx_t *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 629 | hdd_ibss_peer_info_t *pPeerInfo = &pStaCtx->ibss_peer_info; |
| 630 | |
| 631 | status = sme_RequestIBSSPeerInfo(hHal, pAdapter, hdd_get_ibss_peer_info_cb, |
| 632 | VOS_FALSE, staIdx); |
| 633 | |
| 634 | INIT_COMPLETION(pAdapter->ibss_peer_info_comp); |
| 635 | |
| 636 | if (eHAL_STATUS_SUCCESS == status) |
| 637 | { |
| 638 | long ret; |
| 639 | ret = wait_for_completion_interruptible_timeout |
| 640 | (&pAdapter->ibss_peer_info_comp, |
| 641 | msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT)); |
| 642 | if (ret <= 0) |
| 643 | { |
| 644 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 645 | FL("failed wait on ibss_peer_info_comp %ld"), ret); |
| 646 | return eHAL_STATUS_FAILURE; |
| 647 | } |
| 648 | |
| 649 | /** Print the peer info */ |
| 650 | pr_info("pPeerInfo->numIBSSPeers = %d ", pPeerInfo->numIBSSPeers); |
| 651 | pr_info("============================================================"); |
| 652 | { |
| 653 | v_MACADDR_t *macAddr = hdd_wlan_get_ibss_mac_addr_from_staid(pAdapter, |
| 654 | staIdx); |
| 655 | v_U32_t txRateMbps = ((pPeerInfo->ibssPeerList[0].txRate)*500*1000)/1000000; |
| 656 | |
| 657 | if (NULL != macAddr) |
| 658 | { |
| 659 | pr_info("PEER ADDR :" MAC_ADDRESS_STR " TxRate: %d Mbps RSSI: %d", |
| 660 | MAC_ADDR_ARRAY(macAddr->bytes), |
| 661 | (int)txRateMbps, (int)pPeerInfo->ibssPeerList[0].rssi); |
| 662 | } |
| 663 | else |
| 664 | { |
| 665 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 666 | " ERROR: PEER MAC ADDRESS NOT FOUND "); |
| 667 | } |
| 668 | } |
| 669 | } |
| 670 | else |
| 671 | { |
| 672 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 673 | "%s: Warning: sme_RequestIBSSPeerInfo Request failed", __func__); |
| 674 | } |
| 675 | |
| 676 | return status; |
| 677 | } |
| 678 | |
| 679 | eHalStatus hdd_wlan_get_ibss_peer_info_all(hdd_adapter_t *pAdapter) |
| 680 | { |
| 681 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 682 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 683 | hdd_station_ctx_t *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 684 | hdd_ibss_peer_info_t *pPeerInfo = &pStaCtx->ibss_peer_info; |
| 685 | int i; |
| 686 | |
| 687 | status = sme_RequestIBSSPeerInfo(hHal, pAdapter, hdd_get_ibss_peer_info_cb, |
| 688 | VOS_TRUE, 0xFF); |
| 689 | INIT_COMPLETION(pAdapter->ibss_peer_info_comp); |
| 690 | |
| 691 | if (eHAL_STATUS_SUCCESS == status) |
| 692 | { |
| 693 | long ret; |
| 694 | ret = wait_for_completion_interruptible_timeout |
| 695 | (&pAdapter->ibss_peer_info_comp, |
| 696 | msecs_to_jiffies(IBSS_PEER_INFO_REQ_TIMOEUT)); |
| 697 | if (ret <= 0) |
| 698 | { |
| 699 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 700 | FL("failed wait on ibss_peer_info_comp %ld"), ret); |
| 701 | return eHAL_STATUS_FAILURE; |
| 702 | } |
| 703 | |
| 704 | /** Print the peer info */ |
| 705 | pr_info("pPeerInfo->numIBSSPeers = %d ", (int)pPeerInfo->numIBSSPeers); |
| 706 | pr_info("============================================================"); |
| 707 | for (i = 0; i < pPeerInfo->numIBSSPeers; i++) |
| 708 | { |
| 709 | v_U8_t staIdx = pPeerInfo->ibssPeerList[i].staIdx; |
| 710 | v_MACADDR_t *macAddr = hdd_wlan_get_ibss_mac_addr_from_staid(pAdapter, |
| 711 | staIdx); |
| 712 | v_U32_t txRateMbps = ((pPeerInfo->ibssPeerList[0].txRate)*500*1000)/1000000; |
| 713 | |
| 714 | pr_info("STAIDX:%d ", (int)pPeerInfo->ibssPeerList[i].staIdx); |
| 715 | if (NULL != macAddr) |
| 716 | { |
| 717 | pr_info(" PEER ADDR :" MAC_ADDRESS_STR " TxRate: %d Mbps RSSI: %d", |
| 718 | MAC_ADDR_ARRAY(macAddr->bytes), |
| 719 | (int)txRateMbps, (int)pPeerInfo->ibssPeerList[i].rssi); |
| 720 | } |
| 721 | else |
| 722 | { |
| 723 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 724 | " ERROR: PEER MAC ADDRESS NOT FOUND "); |
| 725 | } |
| 726 | } |
| 727 | } |
| 728 | else |
| 729 | { |
| 730 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 731 | "%s: Warning: sme_RequestIBSSPeerInfo Request failed", __func__); |
| 732 | } |
| 733 | |
| 734 | return status; |
| 735 | } |
| 736 | #endif /* WLAN_FEATURE_RMC */ |
| 737 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 738 | int hdd_wlan_get_rts_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu) |
| 739 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 740 | tHalHandle hHal; |
| 741 | hdd_context_t *pHddCtx; |
| 742 | v_U32_t threshold = 0; |
| 743 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 744 | |
| 745 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 746 | if (NULL == pAdapter) |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 747 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 748 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 749 | "%s: Adapter is NULL",__func__); |
| 750 | return -EINVAL; |
| 751 | } |
| 752 | |
| 753 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 754 | ret = wlan_hdd_validate_context(pHddCtx); |
| 755 | if (0 != ret) |
| 756 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 757 | return ret; |
| 758 | } |
| 759 | |
| 760 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 761 | if (NULL == hHal) |
| 762 | { |
| 763 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 764 | "%s: Hal Context is NULL",__func__); |
| 765 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 766 | } |
| 767 | |
| 768 | if ( eHAL_STATUS_SUCCESS != |
| 769 | ccmCfgGetInt(hHal, WNI_CFG_RTS_THRESHOLD, &threshold) ) |
| 770 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 771 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 772 | FL("failed to get ini parameter, WNI_CFG_RTS_THRESHOLD")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 773 | return -EIO; |
| 774 | } |
| 775 | wrqu->rts.value = threshold; |
| 776 | |
| 777 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 778 | ("Rts-Threshold=%d!!"), wrqu->rts.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 779 | |
| 780 | EXIT(); |
| 781 | |
| 782 | return 0; |
| 783 | } |
| 784 | |
| 785 | int hdd_wlan_get_frag_threshold(hdd_adapter_t *pAdapter, union iwreq_data *wrqu) |
| 786 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 787 | tHalHandle hHal; |
| 788 | hdd_context_t *pHddCtx; |
| 789 | v_U32_t threshold = 0, status = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 790 | |
| 791 | ENTER(); |
| 792 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 793 | if (NULL == pAdapter) |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 794 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 795 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 796 | "%s: Adapter is NULL",__func__); |
| 797 | return -EINVAL; |
| 798 | } |
| 799 | |
| 800 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 801 | status = wlan_hdd_validate_context(pHddCtx); |
| 802 | if (0 != status) |
| 803 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 804 | return status; |
| 805 | } |
| 806 | |
| 807 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 808 | if (NULL == hHal) |
| 809 | { |
| 810 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 811 | "%s: Hal Context is NULL",__func__); |
| 812 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | } |
| 814 | |
| 815 | if ( ccmCfgGetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, &threshold) |
| 816 | != eHAL_STATUS_SUCCESS ) |
| 817 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 818 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 819 | FL("failed to get ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 820 | return -EIO; |
| 821 | } |
| 822 | wrqu->frag.value = threshold; |
| 823 | |
| 824 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 825 | ("Frag-Threshold=%d!!"), wrqu->frag.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 826 | |
| 827 | EXIT(); |
| 828 | |
| 829 | return 0; |
| 830 | } |
| 831 | |
| 832 | int hdd_wlan_get_freq(v_U32_t channel, v_U32_t *pfreq) |
| 833 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 834 | int i; |
| 835 | if (channel > 0) |
| 836 | { |
| 837 | for (i=0; i < FREQ_CHAN_MAP_TABLE_SIZE; i++) |
| 838 | { |
| 839 | if (channel == freq_chan_map[i].chan) |
| 840 | { |
| 841 | *pfreq = freq_chan_map[i].freq; |
Ashish Kumar Dhanotiya | 95e5bc2 | 2018-04-19 17:06:33 +0530 | [diff] [blame] | 842 | return 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 843 | } |
| 844 | } |
| 845 | } |
| 846 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 847 | ("Invalid channel no=%d!!"), channel); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 848 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 849 | } |
| 850 | |
| 851 | static v_BOOL_t |
| 852 | hdd_IsAuthTypeRSN( tHalHandle halHandle, eCsrAuthType authType) |
| 853 | { |
| 854 | v_BOOL_t rsnType = VOS_FALSE; |
| 855 | // is the authType supported? |
| 856 | switch (authType) |
| 857 | { |
| 858 | case eCSR_AUTH_TYPE_NONE: //never used |
| 859 | rsnType = eANI_BOOLEAN_FALSE; |
| 860 | break; |
| 861 | // MAC layer authentication types |
| 862 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 863 | rsnType = eANI_BOOLEAN_FALSE; |
| 864 | break; |
| 865 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 866 | rsnType = eANI_BOOLEAN_FALSE; |
| 867 | break; |
| 868 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 869 | rsnType = eANI_BOOLEAN_FALSE; |
| 870 | break; |
| 871 | |
| 872 | // Upper layer authentication types |
| 873 | case eCSR_AUTH_TYPE_WPA: |
| 874 | rsnType = eANI_BOOLEAN_TRUE; |
| 875 | break; |
| 876 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 877 | rsnType = eANI_BOOLEAN_TRUE; |
| 878 | break; |
| 879 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 880 | rsnType = eANI_BOOLEAN_TRUE; |
| 881 | break; |
| 882 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 883 | case eCSR_AUTH_TYPE_FT_RSN: |
| 884 | #endif |
| 885 | case eCSR_AUTH_TYPE_RSN: |
| 886 | rsnType = eANI_BOOLEAN_TRUE; |
| 887 | break; |
| 888 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 889 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 890 | #endif |
| 891 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 892 | #ifdef WLAN_FEATURE_11W |
| 893 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 894 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 895 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 896 | rsnType = eANI_BOOLEAN_TRUE; |
| 897 | break; |
| 898 | //case eCSR_AUTH_TYPE_FAILED: |
| 899 | case eCSR_AUTH_TYPE_UNKNOWN: |
| 900 | rsnType = eANI_BOOLEAN_FALSE; |
| 901 | break; |
| 902 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 903 | hddLog(LOGE, FL("%s called with unknown authType - default to Open, None"), |
| 904 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 905 | rsnType = eANI_BOOLEAN_FALSE; |
| 906 | break; |
| 907 | } |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 908 | hddLog(LOGE, FL("%s called with authType: %d, returned: %d"), |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 909 | __func__, authType, rsnType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 910 | return rsnType; |
| 911 | } |
| 912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 913 | |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 914 | struct snr_priv { |
| 915 | int8_t snr; |
| 916 | }; |
| 917 | |
| 918 | /** |
| 919 | * hdd_get_snr_cb() - "Get SNR" callback function |
| 920 | * @snr: Current SNR of the station |
| 921 | * @sta_id: ID of the station |
| 922 | * @context: opaque context originally passed to SME. HDD always passes |
| 923 | * a cookie for the request context |
| 924 | * |
| 925 | * Return: None |
| 926 | */ |
| 927 | static void hdd_get_snr_cb(tANI_S8 snr, tANI_U32 staId, void *context) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 928 | { |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 929 | struct hdd_request *request; |
| 930 | struct snr_priv *priv; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 931 | |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 932 | request = hdd_request_get(context); |
| 933 | if (!request) { |
| 934 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Obsolete request")); |
| 935 | return; |
| 936 | } |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 937 | |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 938 | /* propagate response back to requesting thread */ |
| 939 | priv = hdd_request_priv(request); |
| 940 | priv->snr = snr; |
| 941 | hdd_request_complete(request); |
| 942 | hdd_request_put(request); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 943 | } |
| 944 | |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 945 | struct rssi_priv { |
| 946 | v_S7_t rssi; |
| 947 | }; |
| 948 | |
| 949 | static void hdd_get_rssi_cb( v_S7_t rssi, tANI_U32 staId, void *context ) |
| 950 | { |
| 951 | struct hdd_request *request; |
| 952 | struct rssi_priv *priv; |
| 953 | |
| 954 | if (ioctl_debug) { |
| 955 | pr_info("%s: rssi [%d] STA [%d] context [%pK]\n", |
| 956 | __func__, (int)rssi, (int)staId, context); |
| 957 | } |
| 958 | |
| 959 | request = hdd_request_get(context); |
| 960 | if (!request) { |
| 961 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Obsolete request")); |
| 962 | return; |
| 963 | } |
| 964 | |
| 965 | priv = hdd_request_priv(request); |
| 966 | priv->rssi = rssi; |
| 967 | |
| 968 | hdd_request_complete(request); |
| 969 | hdd_request_put(request); |
| 970 | } |
| 971 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 972 | VOS_STATUS wlan_hdd_get_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value) |
| 973 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 974 | hdd_context_t *pHddCtx; |
| 975 | hdd_station_ctx_t *pHddStaCtx; |
| 976 | eHalStatus hstatus; |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 977 | int ret; |
| 978 | void *cookie; |
| 979 | struct hdd_request *request; |
| 980 | struct rssi_priv *priv; |
| 981 | static const struct hdd_request_params params = { |
| 982 | .priv_size = sizeof(*priv), |
| 983 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 984 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 985 | |
| 986 | if (NULL == pAdapter) |
| 987 | { |
| 988 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 989 | "%s: Invalid context, pAdapter", __func__); |
| 990 | return VOS_STATUS_E_FAULT; |
| 991 | } |
| 992 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 993 | { |
| 994 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 995 | /* return a cached value */ |
| 996 | *rssi_value = pAdapter->rssi; |
| 997 | return VOS_STATUS_SUCCESS; |
| 998 | } |
| 999 | |
| 1000 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1001 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1002 | |
mukul sharma | 8aec69b | 2015-06-10 22:28:43 +0530 | [diff] [blame] | 1003 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 1004 | { |
Sachin Ahuja | 3d47fcd | 2015-08-28 16:02:06 +0530 | [diff] [blame] | 1005 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:Not associated, rssi on Disconnect : %d", |
| 1006 | __func__, pAdapter->rssi_on_disconnect); |
| 1007 | *rssi_value = pAdapter->rssi_on_disconnect; |
mukul sharma | 8aec69b | 2015-06-10 22:28:43 +0530 | [diff] [blame] | 1008 | return VOS_STATUS_SUCCESS; |
| 1009 | } |
| 1010 | |
| 1011 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 1012 | { |
| 1013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1014 | "%s: Roaming in progress, hence return last cached RSSI", __func__); |
| 1015 | *rssi_value = pAdapter->rssi; |
| 1016 | return VOS_STATUS_SUCCESS; |
| 1017 | } |
| 1018 | |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 1019 | request = hdd_request_alloc(¶ms); |
| 1020 | if (!request) { |
| 1021 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 1022 | return VOS_STATUS_E_NOMEM; |
| 1023 | } |
| 1024 | cookie = hdd_request_cookie(request); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1025 | |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 1026 | hstatus = sme_GetRssi(pHddCtx->hHal, hdd_get_rssi_cb, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1027 | pHddStaCtx->conn_info.staId[ 0 ], |
| 1028 | pHddStaCtx->conn_info.bssId, |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 1029 | cookie, pHddCtx->pvosContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1030 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 1031 | { |
| 1032 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1033 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | /* we'll returned a cached value below */ |
| 1035 | } |
| 1036 | else |
| 1037 | { |
| 1038 | /* request was sent -- wait for the response */ |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 1039 | ret = hdd_request_wait_for_response(request); |
| 1040 | if (ret) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1041 | { |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 1042 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1043 | FL("SME timeout while retrieving RSSI")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1044 | /* we'll now returned a cached value below */ |
| 1045 | } |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 1046 | else |
| 1047 | { |
| 1048 | priv = hdd_request_priv(request); |
| 1049 | pAdapter->rssi = priv->rssi; |
| 1050 | /* |
| 1051 | * copy over the rssi.FW will return RSSI as -100 if |
| 1052 | * there are no samples to calculate the averag RSSI |
| 1053 | */ |
| 1054 | if (priv->rssi != -100) |
| 1055 | pAdapter->rssi = priv->rssi; |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 1056 | |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 1057 | if (pAdapter->rssi > 0) |
| 1058 | pAdapter->rssi = 0; |
| 1059 | } |
| 1060 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 1061 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1062 | *rssi_value = pAdapter->rssi; |
Rajeev Kumar Sirasanagandla | 4819c18 | 2016-11-28 22:25:48 +0530 | [diff] [blame] | 1063 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1064 | "%s: RSSI = %d", __func__, *rssi_value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1065 | |
Hanumanth Reddy Pothula | 084e45b | 2018-04-05 18:02:55 +0530 | [diff] [blame] | 1066 | /* |
| 1067 | * either we never sent a request, we sent a request and received a |
| 1068 | * response or we sent a request and timed out. Regardless we are |
| 1069 | * done with the request. |
| 1070 | */ |
| 1071 | hdd_request_put(request); |
| 1072 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1073 | return VOS_STATUS_SUCCESS; |
| 1074 | } |
Siddharth Bhal | 6424617 | 2015-02-27 01:04:37 +0530 | [diff] [blame] | 1075 | /**--------------------------------------------------------------------------- |
| 1076 | |
| 1077 | \brief wlan_hdd_get_frame_logs() - |
| 1078 | |
| 1079 | This function use to get Frames log. |
| 1080 | |
| 1081 | \param - pAdapter Pointer to the adapter. |
| 1082 | flag - Specify type of request. Clear and Send request are |
| 1083 | supported. |
| 1084 | |
| 1085 | \return - none |
| 1086 | |
| 1087 | --------------------------------------------------------------------------*/ |
| 1088 | VOS_STATUS wlan_hdd_get_frame_logs(hdd_adapter_t *pAdapter, v_U8_t flag) |
| 1089 | { |
Siddharth Bhal | 6424617 | 2015-02-27 01:04:37 +0530 | [diff] [blame] | 1090 | hdd_context_t *pHddCtx; |
| 1091 | eHalStatus hstatus; |
Siddharth Bhal | 6424617 | 2015-02-27 01:04:37 +0530 | [diff] [blame] | 1092 | |
| 1093 | if (NULL == pAdapter) |
| 1094 | { |
| 1095 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 1096 | "%s: Invalid context, pAdapter", __func__); |
| 1097 | return VOS_STATUS_E_FAULT; |
| 1098 | } |
| 1099 | |
| 1100 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1101 | if (!pHddCtx->mgmt_frame_logging) |
| 1102 | { |
Abhishek Singh | a7d80b1 | 2016-02-03 15:27:20 +0530 | [diff] [blame] | 1103 | hddLog(LOGW, FL("Frame Logging not init!")); |
Siddharth Bhal | 6424617 | 2015-02-27 01:04:37 +0530 | [diff] [blame] | 1104 | return VOS_STATUS_E_AGAIN; |
| 1105 | } |
| 1106 | |
Siddharth Bhal | 4507c26 | 2015-04-29 20:20:42 +0530 | [diff] [blame] | 1107 | if ((flag != WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR) && |
| 1108 | (flag != WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR) && |
| 1109 | (flag != WLAN_HDD_GET_FRAME_LOG_CMD_BMU_TRACING)) |
Siddharth Bhal | 6424617 | 2015-02-27 01:04:37 +0530 | [diff] [blame] | 1110 | { |
| 1111 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Incorrect getFrame params!", __func__); |
| 1112 | return VOS_STATUS_E_INVAL; |
| 1113 | } |
| 1114 | |
Siddharth Bhal | 4507c26 | 2015-04-29 20:20:42 +0530 | [diff] [blame] | 1115 | if ((flag == WLAN_HDD_GET_FRAME_LOG_CMD_BMU_TRACING) && |
| 1116 | (!pHddCtx->cfg_ini->enableBMUHWtracing)) |
| 1117 | { |
| 1118 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: BMUHW Tracing not enabled!", __func__); |
| 1119 | return VOS_STATUS_E_INVAL; |
| 1120 | } |
| 1121 | |
Abhishek Singh | 611295e | 2015-07-09 11:11:54 +0530 | [diff] [blame] | 1122 | hstatus = sme_GetFramesLog(pHddCtx->hHal, flag); |
Siddharth Bhal | 6424617 | 2015-02-27 01:04:37 +0530 | [diff] [blame] | 1123 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 1124 | { |
| 1125 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to get Frame Logs", __func__); |
Abhishek Singh | 611295e | 2015-07-09 11:11:54 +0530 | [diff] [blame] | 1126 | return VOS_STATUS_E_FAILURE; |
Siddharth Bhal | 6424617 | 2015-02-27 01:04:37 +0530 | [diff] [blame] | 1127 | } |
Siddharth Bhal | 6424617 | 2015-02-27 01:04:37 +0530 | [diff] [blame] | 1128 | |
| 1129 | return VOS_STATUS_SUCCESS; |
| 1130 | } |
| 1131 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1132 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1133 | VOS_STATUS wlan_hdd_get_snr(hdd_adapter_t *pAdapter, v_S7_t *snr) |
| 1134 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1135 | hdd_context_t *pHddCtx; |
| 1136 | hdd_station_ctx_t *pHddStaCtx; |
| 1137 | eHalStatus hstatus; |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 1138 | int ret; |
| 1139 | void *cookie; |
| 1140 | struct hdd_request *request; |
| 1141 | struct snr_priv *priv; |
| 1142 | static const struct hdd_request_params params = { |
| 1143 | .priv_size = sizeof(*priv), |
| 1144 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 1145 | }; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1146 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1147 | ENTER(); |
| 1148 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1149 | if (NULL == pAdapter) |
| 1150 | { |
| 1151 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1152 | "%s: Invalid context, pAdapter", __func__); |
| 1153 | return VOS_STATUS_E_FAULT; |
| 1154 | } |
| 1155 | |
| 1156 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1157 | |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 1158 | ret = wlan_hdd_validate_context(pHddCtx); |
| 1159 | if (0 != ret) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1160 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1161 | return VOS_STATUS_E_FAULT; |
| 1162 | } |
| 1163 | |
| 1164 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1165 | if (NULL == pHddStaCtx) |
| 1166 | { |
| 1167 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is not valid")); |
| 1168 | return VOS_STATUS_E_FAULT; |
| 1169 | } |
| 1170 | |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 1171 | request = hdd_request_alloc(¶ms); |
| 1172 | if (!request) { |
| 1173 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 1174 | return VOS_STATUS_E_FAULT; |
| 1175 | } |
| 1176 | cookie = hdd_request_cookie(request); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1177 | |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 1178 | hstatus = sme_GetSnr(pHddCtx->hHal, hdd_get_snr_cb, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1179 | pHddStaCtx->conn_info.staId[ 0 ], |
| 1180 | pHddStaCtx->conn_info.bssId, |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 1181 | cookie); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1182 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 1183 | { |
| 1184 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI", |
| 1185 | __func__); |
| 1186 | /* we'll returned a cached value below */ |
| 1187 | } |
| 1188 | else |
| 1189 | { |
| 1190 | /* request was sent -- wait for the response */ |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 1191 | ret = hdd_request_wait_for_response(request); |
| 1192 | if (ret) { |
| 1193 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1194 | FL("SME timed out while retrieving SNR")); |
| 1195 | /* we'll now returned a cached value below */ |
| 1196 | } else { |
| 1197 | /* update the adapter with the fresh results */ |
| 1198 | priv = hdd_request_priv(request); |
| 1199 | pAdapter->snr = priv->snr; |
| 1200 | } |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1201 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 1202 | |
Hanumanth Reddy Pothula | 81b4326 | 2018-03-15 16:57:36 +0530 | [diff] [blame] | 1203 | /* |
| 1204 | * either we never sent a request, we sent a request and |
| 1205 | * received a response or we sent a request and timed out. |
| 1206 | * regardless we are done with the request. |
| 1207 | */ |
| 1208 | hdd_request_put(request); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 1209 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1210 | *snr = pAdapter->snr; |
| 1211 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1212 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 1213 | return VOS_STATUS_SUCCESS; |
| 1214 | } |
Sachin Ahuja | 3d47fcd | 2015-08-28 16:02:06 +0530 | [diff] [blame] | 1215 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1216 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1217 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1218 | VOS_STATUS wlan_hdd_get_roam_rssi(hdd_adapter_t *pAdapter, v_S7_t *rssi_value) |
| 1219 | { |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1220 | hdd_context_t *pHddCtx = NULL; |
| 1221 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 1222 | eHalStatus hstatus; |
Hanumanth Reddy Pothula | a88659e | 2018-04-09 18:45:14 +0530 | [diff] [blame] | 1223 | int ret; |
| 1224 | void *cookie; |
| 1225 | struct hdd_request *request; |
| 1226 | struct rssi_priv *priv; |
| 1227 | static const struct hdd_request_params params = { |
| 1228 | .priv_size = sizeof(*priv), |
| 1229 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 1230 | }; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1231 | |
| 1232 | if (NULL == pAdapter) |
| 1233 | { |
| 1234 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 1235 | "%s: Invalid context, pAdapter", __func__); |
| 1236 | return VOS_STATUS_E_FAULT; |
| 1237 | } |
| 1238 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 1239 | { |
| 1240 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 1241 | /* return a cached value */ |
| 1242 | *rssi_value = pAdapter->rssi; |
| 1243 | return VOS_STATUS_SUCCESS; |
| 1244 | } |
| 1245 | |
| 1246 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1247 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1248 | |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 1249 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1250 | { |
| 1251 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:Not associated!",__func__); |
| 1252 | /* return a cached value */ |
| 1253 | *rssi_value = 0; |
| 1254 | return VOS_STATUS_SUCCESS; |
| 1255 | } |
Kanchanapally, Vidyullatha | d883c65 | 2014-05-09 21:17:04 +0530 | [diff] [blame] | 1256 | |
| 1257 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 1258 | { |
| 1259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1260 | "%s: Roaming in progress, hence return last cached RSSI", __func__); |
| 1261 | *rssi_value = pAdapter->rssi; |
| 1262 | return VOS_STATUS_SUCCESS; |
| 1263 | } |
| 1264 | |
Hanumanth Reddy Pothula | a88659e | 2018-04-09 18:45:14 +0530 | [diff] [blame] | 1265 | request = hdd_request_alloc(¶ms); |
| 1266 | if (!request) { |
| 1267 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 1268 | return VOS_STATUS_E_NOMEM; |
| 1269 | } |
| 1270 | cookie = hdd_request_cookie(request); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1271 | |
Hanumanth Reddy Pothula | a88659e | 2018-04-09 18:45:14 +0530 | [diff] [blame] | 1272 | hstatus = sme_GetRoamRssi(pHddCtx->hHal, hdd_get_rssi_cb, |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1273 | pHddStaCtx->conn_info.staId[ 0 ], |
| 1274 | pHddStaCtx->conn_info.bssId, |
Hanumanth Reddy Pothula | a88659e | 2018-04-09 18:45:14 +0530 | [diff] [blame] | 1275 | cookie, pHddCtx->pvosContext); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1276 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 1277 | { |
| 1278 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve RSSI", |
| 1279 | __func__); |
| 1280 | /* we'll returned a cached value below */ |
| 1281 | } |
| 1282 | else |
| 1283 | { |
Hanumanth Reddy Pothula | a88659e | 2018-04-09 18:45:14 +0530 | [diff] [blame] | 1284 | ret = hdd_request_wait_for_response(request); |
| 1285 | if(ret) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1286 | /* request was sent -- wait for the response */ |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1287 | { |
Hanumanth Reddy Pothula | a88659e | 2018-04-09 18:45:14 +0530 | [diff] [blame] | 1288 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1289 | FL(" SME timeout while retrieving RSSI")); |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1290 | /* we'll now returned a cached value below */ |
| 1291 | } |
Hanumanth Reddy Pothula | a88659e | 2018-04-09 18:45:14 +0530 | [diff] [blame] | 1292 | else |
| 1293 | { |
| 1294 | priv = hdd_request_priv(request); |
| 1295 | pAdapter->rssi = priv->rssi; |
| 1296 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1297 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 1298 | |
Hanumanth Reddy Pothula | a88659e | 2018-04-09 18:45:14 +0530 | [diff] [blame] | 1299 | /* |
| 1300 | * either we never sent a request, we sent a request and received a |
| 1301 | * response or we sent a request and timed out. Regardless we are |
| 1302 | * done with the request. |
| 1303 | */ |
| 1304 | hdd_request_put(request); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 1305 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 1306 | *rssi_value = pAdapter->rssi; |
| 1307 | |
| 1308 | return VOS_STATUS_SUCCESS; |
| 1309 | } |
| 1310 | #endif |
| 1311 | |
| 1312 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1313 | void hdd_StatisticsCB( void *pStats, void *pContext ) |
| 1314 | { |
| 1315 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pContext; |
| 1316 | hdd_stats_t *pStatsCache = NULL; |
| 1317 | hdd_wext_state_t *pWextState; |
| 1318 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 1319 | |
| 1320 | tCsrSummaryStatsInfo *pSummaryStats = NULL; |
| 1321 | tCsrGlobalClassAStatsInfo *pClassAStats = NULL; |
| 1322 | tCsrGlobalClassBStatsInfo *pClassBStats = NULL; |
| 1323 | tCsrGlobalClassCStatsInfo *pClassCStats = NULL; |
| 1324 | tCsrGlobalClassDStatsInfo *pClassDStats = NULL; |
| 1325 | tCsrPerStaStatsInfo *pPerStaStats = NULL; |
| 1326 | |
| 1327 | if (pAdapter!= NULL) |
| 1328 | pStatsCache = &pAdapter->hdd_stats; |
| 1329 | |
| 1330 | |
| 1331 | pSummaryStats = (tCsrSummaryStatsInfo *)pStats; |
| 1332 | pClassAStats = (tCsrGlobalClassAStatsInfo *)( pSummaryStats + 1 ); |
| 1333 | pClassBStats = (tCsrGlobalClassBStatsInfo *)( pClassAStats + 1 ); |
| 1334 | pClassCStats = (tCsrGlobalClassCStatsInfo *)( pClassBStats + 1 ); |
| 1335 | pClassDStats = (tCsrGlobalClassDStatsInfo *)( pClassCStats + 1 ); |
| 1336 | pPerStaStats = (tCsrPerStaStatsInfo *)( pClassDStats + 1 ); |
| 1337 | |
| 1338 | if (pStatsCache!=NULL) |
| 1339 | { |
| 1340 | // and copy the stats into the cache we keep in the adapter instance structure |
| 1341 | vos_mem_copy( &pStatsCache->summary_stat, pSummaryStats, sizeof( pStatsCache->summary_stat ) ); |
| 1342 | vos_mem_copy( &pStatsCache->ClassA_stat, pClassAStats, sizeof( pStatsCache->ClassA_stat ) ); |
| 1343 | vos_mem_copy( &pStatsCache->ClassB_stat, pClassBStats, sizeof( pStatsCache->ClassB_stat ) ); |
| 1344 | vos_mem_copy( &pStatsCache->ClassC_stat, pClassCStats, sizeof( pStatsCache->ClassC_stat ) ); |
| 1345 | vos_mem_copy( &pStatsCache->ClassD_stat, pClassDStats, sizeof( pStatsCache->ClassD_stat ) ); |
| 1346 | vos_mem_copy( &pStatsCache->perStaStats, pPerStaStats, sizeof( pStatsCache->perStaStats ) ); |
| 1347 | } |
| 1348 | |
| 1349 | if(pAdapter) |
| 1350 | { |
| 1351 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1352 | if(pWextState) |
| 1353 | { |
| 1354 | vos_status = vos_event_set(&pWextState->vosevent); |
| 1355 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 1356 | { |
| 1357 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1358 | "%s: vos_event_set failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1359 | return; |
| 1360 | } |
| 1361 | } |
| 1362 | } |
| 1363 | } |
| 1364 | |
| 1365 | void ccmCfgSetCallback(tHalHandle halHandle, tANI_S32 result) |
| 1366 | { |
| 1367 | v_CONTEXT_t pVosContext; |
| 1368 | hdd_context_t *pHddCtx; |
| 1369 | VOS_STATUS hdd_reconnect_all_adapters( hdd_context_t *pHddCtx ); |
| 1370 | #if 0 |
| 1371 | hdd_wext_state_t *pWextState; |
| 1372 | v_U32_t roamId; |
| 1373 | #endif |
| 1374 | |
| 1375 | ENTER(); |
| 1376 | |
| 1377 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS,NULL); |
| 1378 | |
| 1379 | pHddCtx = (hdd_context_t*) vos_get_context(VOS_MODULE_ID_HDD,pVosContext); |
| 1380 | if (NULL == pHddCtx) |
| 1381 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1382 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid pHddCtx", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1383 | return; |
| 1384 | } |
| 1385 | #if 0 |
| 1386 | pWextState = pAdapter->pWextState; |
| 1387 | #endif |
| 1388 | |
| 1389 | if (WNI_CFG_NEED_RESTART == result || WNI_CFG_NEED_RELOAD == result) |
| 1390 | { |
| 1391 | //TODO Verify is this is really used. If yes need to fix it. |
| 1392 | hdd_reconnect_all_adapters( pHddCtx ); |
| 1393 | #if 0 |
| 1394 | pAdapter->conn_info.connState = eConnectionState_NotConnected; |
| 1395 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 1396 | vosStatus = sme_RoamDisconnect(halHandle, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 1397 | |
| 1398 | if(VOS_STATUS_SUCCESS == vosStatus) |
| 1399 | wait_for_completion_interruptible_timeout(&pAdapter->disconnect_comp_var, |
| 1400 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 1401 | |
| 1402 | sme_RoamConnect(halHandle, |
| 1403 | pAdapter->sessionId, &(pWextState->roamProfile), |
| 1404 | &roamId); |
| 1405 | #endif |
| 1406 | } |
| 1407 | |
| 1408 | EXIT(); |
| 1409 | |
| 1410 | } |
| 1411 | |
| 1412 | void hdd_clearRoamProfileIe( hdd_adapter_t *pAdapter) |
| 1413 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1414 | hdd_wext_state_t *pWextState= WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1415 | |
| 1416 | /* clear WPA/RSN/WSC IE information in the profile */ |
| 1417 | pWextState->roamProfile.nWPAReqIELength = 0; |
| 1418 | pWextState->roamProfile.pWPAReqIE = (tANI_U8 *)NULL; |
| 1419 | pWextState->roamProfile.nRSNReqIELength = 0; |
| 1420 | pWextState->roamProfile.pRSNReqIE = (tANI_U8 *)NULL; |
| 1421 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1422 | #ifdef FEATURE_WLAN_WAPI |
| 1423 | pWextState->roamProfile.nWAPIReqIELength = 0; |
| 1424 | pWextState->roamProfile.pWAPIReqIE = (tANI_U8 *)NULL; |
| 1425 | #endif |
| 1426 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1427 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 1428 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1429 | pWextState->roamProfile.nAddIEScanLength = 0; |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 1430 | memset(pWextState->roamProfile.addIEScan, 0 , SIR_MAC_MAX_ADD_IE_LENGTH+2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1431 | pWextState->roamProfile.pAddIEAssoc = (tANI_U8 *)NULL; |
| 1432 | pWextState->roamProfile.nAddIEAssocLength = 0; |
| 1433 | |
| 1434 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 1435 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 1436 | = eCSR_ENCRYPT_TYPE_NONE; |
| 1437 | |
| 1438 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 1439 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] |
| 1440 | = eCSR_ENCRYPT_TYPE_NONE; |
| 1441 | |
| 1442 | pWextState->roamProfile.AuthType.numEntries = 1; |
| 1443 | pWextState->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1444 | |
Abhishek Singh | b3e376c | 2017-01-04 15:27:13 +0530 | [diff] [blame] | 1445 | vos_mem_zero((pWextState->roamProfile.bssid_hint), WNI_CFG_BSSID_LEN); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1446 | #ifdef WLAN_FEATURE_11W |
| 1447 | pWextState->roamProfile.MFPEnabled = eANI_BOOLEAN_FALSE; |
| 1448 | pWextState->roamProfile.MFPRequired = 0; |
| 1449 | pWextState->roamProfile.MFPCapable = 0; |
| 1450 | #endif |
| 1451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1452 | pWextState->authKeyMgmt = 0; |
| 1453 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 1454 | vos_mem_zero(&pWextState->roamProfile.Keys, |
| 1455 | sizeof(pWextState->roamProfile.Keys)); |
| 1456 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1457 | #ifdef FEATURE_WLAN_WAPI |
| 1458 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_OPEN; |
| 1459 | pAdapter->wapi_info.nWapiMode = 0; |
| 1460 | #endif |
| 1461 | |
| 1462 | vos_mem_zero((void *)(pWextState->req_bssId), WNI_CFG_BSSID_LEN); |
| 1463 | |
| 1464 | } |
| 1465 | |
| 1466 | void wlan_hdd_ula_done_cb(v_VOID_t *callbackContext) |
| 1467 | { |
| 1468 | hdd_adapter_t *pAdapter = (hdd_adapter_t*)callbackContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1469 | |
Nirav Shah | f6bd267 | 2015-03-11 12:53:15 +0530 | [diff] [blame] | 1470 | if ( (pAdapter == NULL) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1471 | { |
| 1472 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | f6bd267 | 2015-03-11 12:53:15 +0530 | [diff] [blame] | 1473 | "%s: Invalid pAdapter magic/ pAdapter is NULL", __func__); |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1474 | } |
| 1475 | else |
| 1476 | { |
| 1477 | complete(&pAdapter->ula_complete); |
| 1478 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1479 | } |
| 1480 | |
| 1481 | VOS_STATUS wlan_hdd_check_ula_done(hdd_adapter_t *pAdapter) |
| 1482 | { |
| 1483 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1484 | VOS_STATUS vos_status; |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1485 | unsigned long rc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1486 | |
| 1487 | if (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated) |
| 1488 | { |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1489 | INIT_COMPLETION(pAdapter->ula_complete); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1490 | |
| 1491 | /*To avoid race condition between the set key and the last EAPOL |
| 1492 | packet, notify TL to finish upper layer authentication incase if the |
| 1493 | last EAPOL packet pending in the TL queue.*/ |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 1494 | vos_status = WLANTL_Finish_ULA(wlan_hdd_ula_done_cb, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1495 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 1496 | if ( vos_status != VOS_STATUS_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1497 | { |
| 1498 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1499 | "[%4d] WLANTL_Finish_ULA returned ERROR status= %d", |
| 1500 | __LINE__, vos_status ); |
| 1501 | return vos_status; |
| 1502 | |
| 1503 | } |
| 1504 | |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1505 | rc = wait_for_completion_timeout(&pAdapter->ula_complete, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1506 | msecs_to_jiffies(HDD_FINISH_ULA_TIME_OUT)); |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1507 | if (rc <= 0) |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1508 | { |
| 1509 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1510 | FL("failure wait on ULA to complete %ld"), rc); |
Jeff Johnson | 9efb9aa | 2013-03-15 13:59:27 -0700 | [diff] [blame] | 1511 | /* we'll still fall through and return success since the |
| 1512 | * connection may still get established but is just taking |
| 1513 | * too long for us to wait */ |
| 1514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1515 | } |
| 1516 | return VOS_STATUS_SUCCESS; |
| 1517 | } |
| 1518 | |
| 1519 | 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) |
| 1520 | { |
| 1521 | |
| 1522 | int left = ie_len; |
| 1523 | v_U8_t *ptr = ie; |
| 1524 | v_U8_t elem_id,elem_len; |
| 1525 | v_U8_t eid = 0xDD; |
| 1526 | |
| 1527 | if ( NULL == ie || 0 == ie_len ) |
| 1528 | return NULL; |
| 1529 | |
| 1530 | while(left >= 2) |
| 1531 | { |
| 1532 | elem_id = ptr[0]; |
| 1533 | elem_len = ptr[1]; |
| 1534 | left -= 2; |
| 1535 | if(elem_len > left) |
| 1536 | { |
| 1537 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 1538 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1539 | eid,elem_len,left); |
| 1540 | return NULL; |
| 1541 | } |
SaidiReddy Yenuga | 764a9d2 | 2017-05-26 18:37:53 +0530 | [diff] [blame] | 1542 | if ((elem_id == eid) && (elem_len >= oui_size)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1543 | { |
| 1544 | if(memcmp( &ptr[2], oui, oui_size)==0) |
| 1545 | return ptr; |
| 1546 | } |
| 1547 | |
| 1548 | left -= elem_len; |
| 1549 | ptr += (elem_len + 2); |
| 1550 | } |
| 1551 | return NULL; |
| 1552 | } |
| 1553 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 1554 | static int __iw_set_commit(struct net_device *dev, struct iw_request_info *info, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1555 | union iwreq_data *wrqu, char *extra) |
| 1556 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1557 | hdd_adapter_t *pAdapter; |
| 1558 | hdd_context_t *pHddCtx; |
| 1559 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1560 | |
| 1561 | ENTER(); |
| 1562 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1563 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1564 | if (NULL == pAdapter) |
| 1565 | { |
| 1566 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1567 | "%s: pAdapter is NULL\n", __func__); |
| 1568 | return -EINVAL; |
| 1569 | } |
| 1570 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1571 | ret = wlan_hdd_validate_context(pHddCtx); |
| 1572 | if (0 != ret) |
| 1573 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1574 | return ret; |
| 1575 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1576 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1577 | /* Do nothing for now */ |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1578 | |
| 1579 | EXIT(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1580 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1581 | } |
| 1582 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 1583 | static int iw_set_commit(struct net_device *dev, struct iw_request_info *info, |
| 1584 | union iwreq_data *wrqu, char *extra) |
| 1585 | { |
| 1586 | int ret; |
| 1587 | |
| 1588 | vos_ssr_protect(__func__); |
| 1589 | ret = __iw_set_commit(dev, info, wrqu, extra); |
| 1590 | vos_ssr_unprotect(__func__); |
| 1591 | |
| 1592 | return ret; |
| 1593 | } |
| 1594 | |
| 1595 | static int __iw_get_name(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1596 | struct iw_request_info *info, |
| 1597 | char *wrqu, char *extra) |
| 1598 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1599 | hdd_adapter_t *pAdapter; |
| 1600 | hdd_context_t *pHddCtx; |
| 1601 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1602 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1603 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1604 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1605 | if (NULL == pAdapter) |
| 1606 | { |
| 1607 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1608 | "%s: pAdapter is NULL\n", __func__); |
| 1609 | return -EINVAL; |
| 1610 | } |
| 1611 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1612 | ret = wlan_hdd_validate_context(pHddCtx); |
| 1613 | if (0 != ret) |
| 1614 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1615 | return ret; |
| 1616 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1617 | strlcpy(wrqu, "Qcom:802.11n", IFNAMSIZ); |
| 1618 | EXIT(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1619 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1620 | } |
| 1621 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 1622 | static int iw_get_name(struct net_device *dev, |
| 1623 | struct iw_request_info *info, |
| 1624 | char *wrqu, char *extra) |
| 1625 | { |
| 1626 | int ret; |
| 1627 | |
| 1628 | vos_ssr_protect(__func__); |
| 1629 | ret = __iw_get_name(dev, info, wrqu, extra); |
| 1630 | vos_ssr_unprotect(__func__); |
| 1631 | |
| 1632 | return ret; |
| 1633 | } |
| 1634 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1635 | static int __iw_set_freq(struct net_device *dev, |
| 1636 | struct iw_request_info *info, |
| 1637 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1638 | { |
| 1639 | v_U32_t numChans = 0; |
| 1640 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 1641 | v_U32_t indx = 0; |
| 1642 | v_U32_t status = 0; |
| 1643 | |
| 1644 | hdd_wext_state_t *pWextState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1645 | hdd_adapter_t *pAdapter; |
| 1646 | hdd_context_t *pHddCtx; |
| 1647 | tHalHandle hHal; |
| 1648 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1649 | tCsrRoamProfile * pRoamProfile; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1650 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1651 | ENTER(); |
| 1652 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1653 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1654 | if (NULL == pAdapter) |
| 1655 | { |
| 1656 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1657 | "%s:Invalid Adapter",__func__); |
| 1658 | return -EINVAL; |
| 1659 | } |
| 1660 | |
| 1661 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1662 | status = wlan_hdd_validate_context(pHddCtx); |
| 1663 | if (0 != status) |
| 1664 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1665 | return status; |
| 1666 | } |
| 1667 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1668 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1669 | if (NULL == hHal) |
| 1670 | { |
| 1671 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1672 | "%s: Hal Context is NULL",__func__); |
| 1673 | return -EINVAL; |
| 1674 | } |
| 1675 | |
| 1676 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1677 | if (NULL == pHddStaCtx) |
| 1678 | { |
| 1679 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1680 | "%s:STA context is NULL",__func__); |
| 1681 | return -EINVAL; |
| 1682 | } |
| 1683 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1684 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1685 | if (NULL == pWextState) |
| 1686 | { |
| 1687 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1688 | "%s: pWextState is NULL",__func__); |
| 1689 | return -EINVAL; |
| 1690 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1691 | |
| 1692 | pRoamProfile = &pWextState->roamProfile; |
| 1693 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1694 | hddLog(LOG1,"setCHANNEL ioctl"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1695 | |
| 1696 | /* Link is up then return cant set channel*/ |
| 1697 | if(eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState || |
| 1698 | eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1699 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1700 | hddLog( LOGE, "IBSS Associated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1701 | return -EOPNOTSUPP; |
| 1702 | } |
| 1703 | |
| 1704 | /* Settings by Frequency as input */ |
| 1705 | if((wrqu->freq.e == 1) && (wrqu->freq.m >= (tANI_U32)2.412e8) && |
| 1706 | (wrqu->freq.m <= (tANI_U32)5.825e8)) |
| 1707 | { |
| 1708 | tANI_U32 freq = wrqu->freq.m / 100000; |
| 1709 | |
| 1710 | while ((indx < FREQ_CHAN_MAP_TABLE_SIZE) && (freq != freq_chan_map[indx].freq)) |
| 1711 | indx++; |
| 1712 | if (indx >= FREQ_CHAN_MAP_TABLE_SIZE) |
| 1713 | { |
| 1714 | return -EINVAL; |
| 1715 | } |
| 1716 | wrqu->freq.e = 0; |
| 1717 | wrqu->freq.m = freq_chan_map[indx].chan; |
| 1718 | |
| 1719 | } |
| 1720 | |
| 1721 | if (wrqu->freq.e == 0) |
| 1722 | { |
| 1723 | if((wrqu->freq.m < WNI_CFG_CURRENT_CHANNEL_STAMIN) || |
| 1724 | (wrqu->freq.m > WNI_CFG_CURRENT_CHANNEL_STAMAX)) |
| 1725 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1726 | hddLog(LOG1,"%s: Channel [%d] is outside valid range from %d to %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1727 | __func__, wrqu->freq.m, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1728 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 1729 | return -EINVAL; |
| 1730 | } |
| 1731 | |
| 1732 | numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 1733 | |
| 1734 | if (ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 1735 | validChan, &numChans) != eHAL_STATUS_SUCCESS){ |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1736 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 1737 | FL("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1738 | return -EIO; |
| 1739 | } |
| 1740 | |
| 1741 | for (indx = 0; indx < numChans; indx++) { |
| 1742 | if (wrqu->freq.m == validChan[indx]){ |
| 1743 | break; |
| 1744 | } |
| 1745 | } |
| 1746 | } |
| 1747 | else{ |
| 1748 | |
| 1749 | return -EINVAL; |
| 1750 | } |
| 1751 | |
| 1752 | if(indx >= numChans) |
| 1753 | { |
| 1754 | return -EINVAL; |
| 1755 | } |
| 1756 | |
| 1757 | /* Set the Operational Channel */ |
| 1758 | numChans = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 1759 | pHddStaCtx->conn_info.operationChannel = wrqu->freq.m; |
| 1760 | pRoamProfile->ChannelInfo.ChannelList = &pHddStaCtx->conn_info.operationChannel; |
| 1761 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1762 | hddLog(LOG1,"pRoamProfile->operationChannel = %d", wrqu->freq.m); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1763 | |
| 1764 | EXIT(); |
| 1765 | |
| 1766 | return status; |
| 1767 | } |
| 1768 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1769 | static int iw_set_freq(struct net_device *dev, |
| 1770 | struct iw_request_info *info, |
| 1771 | union iwreq_data *wrqu, char *extra) |
| 1772 | { |
| 1773 | int ret; |
| 1774 | |
| 1775 | vos_ssr_protect(__func__); |
| 1776 | ret = __iw_set_freq(dev, info, wrqu, extra); |
| 1777 | vos_ssr_unprotect(__func__); |
| 1778 | |
| 1779 | return ret; |
| 1780 | } |
| 1781 | |
| 1782 | static int __iw_get_freq(struct net_device *dev, |
| 1783 | struct iw_request_info *info, |
| 1784 | struct iw_freq *fwrq, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1785 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1786 | v_U32_t status = FALSE, channel = 0, freq = 0; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1787 | hdd_adapter_t *pAdapter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1788 | tHalHandle hHal; |
| 1789 | hdd_wext_state_t *pWextState; |
| 1790 | tCsrRoamProfile * pRoamProfile; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1791 | hdd_station_ctx_t *pHddStaCtx; |
| 1792 | hdd_context_t *pHddCtx; |
| 1793 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1794 | |
| 1795 | ENTER(); |
| 1796 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1797 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1798 | if (NULL == pAdapter) |
| 1799 | { |
| 1800 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1801 | "%s: Adapter is NULL", __func__); |
| 1802 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1803 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1804 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1805 | ret = wlan_hdd_validate_context(pHddCtx); |
| 1806 | if (0 != ret) |
| 1807 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1808 | return ret; |
| 1809 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1810 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1811 | if (NULL == hHal) |
| 1812 | { |
| 1813 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1814 | "%s: Hal Context is NULL",__func__); |
| 1815 | return -EINVAL; |
| 1816 | } |
| 1817 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1818 | if (NULL == pHddStaCtx) |
| 1819 | { |
| 1820 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1821 | "%s: HddStaCtx is NULL", __func__); |
| 1822 | return -EINVAL; |
| 1823 | } |
| 1824 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1825 | if (NULL == pWextState) |
| 1826 | { |
| 1827 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1828 | "%s: pWextState is NULL",__func__); |
| 1829 | return -EINVAL; |
| 1830 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1831 | pRoamProfile = &pWextState->roamProfile; |
| 1832 | |
| 1833 | if( pHddStaCtx->conn_info.connState== eConnectionState_Associated ) |
| 1834 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1835 | if (sme_GetOperationChannel(hHal, &channel, pAdapter->sessionId) != eHAL_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1836 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1837 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1838 | FL("failed to get operating channel %u"), pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1839 | return -EIO; |
| 1840 | } |
| 1841 | else |
| 1842 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1843 | status = hdd_wlan_get_freq(channel, &freq); |
Ashish Kumar Dhanotiya | 95e5bc2 | 2018-04-19 17:06:33 +0530 | [diff] [blame] | 1844 | if( 0 == status ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1845 | { |
| 1846 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 1847 | * iwlist & iwconfig command shows frequency into proper |
| 1848 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 1849 | fwrq->m = freq; |
| 1850 | fwrq->e = MHZ; |
| 1851 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1852 | } |
| 1853 | } |
| 1854 | else |
| 1855 | { |
Madan Mohan Koyyalamudi | 99f9c66 | 2012-10-11 17:00:31 -0700 | [diff] [blame] | 1856 | /* Set Exponent parameter as 6 (MHZ) in struct iw_freq |
| 1857 | * iwlist & iwconfig command shows frequency into proper |
| 1858 | * format (2.412 GHz instead of 246.2 MHz)*/ |
| 1859 | fwrq->m = 0; |
| 1860 | fwrq->e = MHZ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1861 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1862 | |
| 1863 | EXIT(); |
| 1864 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1865 | } |
| 1866 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1867 | static int iw_get_freq(struct net_device *dev, |
| 1868 | struct iw_request_info *info, |
| 1869 | struct iw_freq *fwrq, char *extra) |
| 1870 | { |
| 1871 | int ret; |
| 1872 | |
| 1873 | vos_ssr_protect(__func__); |
| 1874 | ret = __iw_get_freq(dev, info, fwrq, extra); |
| 1875 | vos_ssr_unprotect(__func__); |
| 1876 | |
| 1877 | return ret; |
| 1878 | } |
| 1879 | |
| 1880 | static int __iw_get_tx_power(struct net_device *dev, |
| 1881 | struct iw_request_info *info, |
| 1882 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1883 | { |
| 1884 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1885 | hdd_adapter_t *pAdapter; |
| 1886 | hdd_context_t *pHddCtx; |
| 1887 | hdd_station_ctx_t *pHddStaCtx; |
| 1888 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1889 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1890 | ENTER(); |
| 1891 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1892 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1893 | if (NULL == pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1894 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1895 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1896 | "%s: Adapter is NULL",__func__); |
| 1897 | return -EINVAL; |
| 1898 | } |
| 1899 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1900 | ret = wlan_hdd_validate_context(pHddCtx); |
| 1901 | if (0 != ret) |
| 1902 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1903 | return ret; |
| 1904 | } |
| 1905 | |
| 1906 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1907 | if (NULL == pHddStaCtx) |
| 1908 | { |
| 1909 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1910 | "%s: STA Context is NULL",__func__); |
| 1911 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1912 | } |
| 1913 | |
| 1914 | if(eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 1915 | { |
| 1916 | wrqu->txpower.value = 0; |
| 1917 | return 0; |
| 1918 | } |
| 1919 | wlan_hdd_get_classAstats(pAdapter); |
| 1920 | wrqu->txpower.value = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 1921 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1922 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1923 | return 0; |
| 1924 | } |
| 1925 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1926 | static int iw_get_tx_power(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1927 | struct iw_request_info *info, |
| 1928 | union iwreq_data *wrqu, char *extra) |
| 1929 | { |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1930 | int ret; |
| 1931 | |
| 1932 | vos_ssr_protect(__func__); |
| 1933 | ret = __iw_get_tx_power(dev, info, wrqu, extra); |
| 1934 | vos_ssr_unprotect(__func__); |
| 1935 | |
| 1936 | return ret; |
| 1937 | } |
| 1938 | |
| 1939 | static int __iw_set_tx_power(struct net_device *dev, |
| 1940 | struct iw_request_info *info, |
| 1941 | union iwreq_data *wrqu, char *extra) |
| 1942 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1943 | hdd_adapter_t *pAdapter; |
| 1944 | tHalHandle hHal; |
| 1945 | hdd_context_t *pHddCtx; |
| 1946 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1947 | |
| 1948 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1949 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1950 | if (NULL == pAdapter) |
| 1951 | { |
| 1952 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1953 | "%s: Adapter is NULL",__func__); |
| 1954 | return -EINVAL; |
| 1955 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1957 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1958 | ret = wlan_hdd_validate_context(pHddCtx); |
| 1959 | if (0 != ret) |
| 1960 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 1961 | return ret; |
| 1962 | } |
| 1963 | |
| 1964 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1965 | if (NULL == hHal) |
| 1966 | { |
| 1967 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1968 | "%s: Hal Context is NULL",__func__); |
| 1969 | return -EINVAL; |
| 1970 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1971 | if ( ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, wrqu->txpower.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 1972 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 1973 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1974 | FL("failed to set ini parameter, WNI_CFG_CURRENT_TX_POWER_LEVEL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1975 | return -EIO; |
| 1976 | } |
| 1977 | |
| 1978 | EXIT(); |
| 1979 | |
| 1980 | return 0; |
| 1981 | } |
| 1982 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 1983 | static int iw_set_tx_power(struct net_device *dev, |
| 1984 | struct iw_request_info *info, |
| 1985 | union iwreq_data *wrqu, char *extra) |
| 1986 | { |
| 1987 | int ret; |
| 1988 | |
| 1989 | vos_ssr_protect(__func__); |
| 1990 | ret = __iw_set_tx_power(dev, info, wrqu, extra); |
| 1991 | vos_ssr_unprotect(__func__); |
| 1992 | |
| 1993 | return ret; |
| 1994 | } |
| 1995 | |
| 1996 | static int __iw_get_bitrate(struct net_device *dev, |
| 1997 | struct iw_request_info *info, |
| 1998 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1999 | { |
| 2000 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 2001 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2002 | hdd_wext_state_t *pWextState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2003 | hdd_adapter_t *pAdapter; |
| 2004 | hdd_context_t *pHddCtx; |
| 2005 | hdd_station_ctx_t *pHddStaCtx; |
| 2006 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2007 | |
| 2008 | ENTER(); |
| 2009 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2010 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2011 | if (NULL == pAdapter) |
| 2012 | { |
| 2013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2014 | "%s: Adapter is NULL",__func__); |
| 2015 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2016 | } |
| 2017 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2018 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2019 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2020 | if (0 != ret) |
| 2021 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2022 | return ret; |
| 2023 | } |
| 2024 | |
| 2025 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2026 | if (NULL == pHddStaCtx) |
| 2027 | { |
| 2028 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2029 | "%s: STA Context is NULL",__func__); |
| 2030 | return -EINVAL; |
| 2031 | } |
| 2032 | |
| 2033 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2034 | wrqu->bitrate.value = 0; |
| 2035 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2036 | else |
| 2037 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2038 | status = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), eCSR_HDD, |
| 2039 | SME_SUMMARY_STATS | |
| 2040 | SME_GLOBAL_CLASSA_STATS | |
| 2041 | SME_GLOBAL_CLASSB_STATS | |
| 2042 | SME_GLOBAL_CLASSC_STATS | |
| 2043 | SME_GLOBAL_CLASSD_STATS | |
| 2044 | SME_PER_STA_STATS, |
| 2045 | hdd_StatisticsCB, 0, FALSE, |
| 2046 | pHddStaCtx->conn_info.staId[0], pAdapter ); |
| 2047 | |
| 2048 | if(eHAL_STATUS_SUCCESS != status) |
| 2049 | { |
| 2050 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2051 | "%s: Unable to retrieve statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2052 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2053 | return status; |
| 2054 | } |
| 2055 | |
| 2056 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2057 | if (NULL == pWextState) |
| 2058 | { |
| 2059 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2060 | "%s: pWextState is NULL",__func__); |
| 2061 | return -EINVAL; |
| 2062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2063 | |
| 2064 | vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS); |
| 2065 | |
| 2066 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 2067 | { |
| 2068 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2069 | "%s: SME timeout while retrieving statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2070 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2071 | return VOS_STATUS_E_FAILURE; |
| 2072 | } |
| 2073 | |
| 2074 | wrqu->bitrate.value = pAdapter->hdd_stats.ClassA_stat.tx_rate*500*1000; |
| 2075 | } |
| 2076 | |
| 2077 | EXIT(); |
| 2078 | |
| 2079 | return vos_status; |
| 2080 | } |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2081 | |
| 2082 | static int iw_get_bitrate(struct net_device *dev, |
| 2083 | struct iw_request_info *info, |
| 2084 | union iwreq_data *wrqu, char *extra) |
| 2085 | { |
| 2086 | int ret; |
| 2087 | |
| 2088 | vos_ssr_protect(__func__); |
| 2089 | ret = __iw_get_bitrate(dev, info, wrqu, extra); |
| 2090 | vos_ssr_unprotect(__func__); |
| 2091 | |
| 2092 | return ret; |
| 2093 | } |
| 2094 | |
| 2095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2096 | /* ccm call back function */ |
| 2097 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2098 | static int __iw_set_bitrate(struct net_device *dev, |
| 2099 | struct iw_request_info *info, |
| 2100 | union iwreq_data *wrqu, |
| 2101 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2102 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2103 | hdd_adapter_t *pAdapter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2104 | hdd_wext_state_t *pWextState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2105 | hdd_station_ctx_t *pHddStaCtx; |
| 2106 | hdd_context_t *pHddCtx; |
Ashish Kumar Dhanotiya | aa9e38c | 2018-05-23 20:23:24 +0530 | [diff] [blame] | 2107 | v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN + |
| 2108 | WNI_CFG_SUPPORTED_RATES_11B_LEN]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2109 | v_U32_t a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 2110 | v_U32_t b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 2111 | v_U32_t i, rate; |
| 2112 | v_U32_t valid_rate = FALSE, active_phy_mode = 0; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2113 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2114 | |
| 2115 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2116 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2117 | if (NULL == pAdapter) |
| 2118 | { |
| 2119 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2120 | "%s: Adapter is NULL",__func__); |
| 2121 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2122 | } |
| 2123 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2124 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2125 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2126 | if (0 != ret) |
| 2127 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2128 | return ret; |
| 2129 | } |
| 2130 | |
| 2131 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2132 | if (NULL == pHddStaCtx) |
| 2133 | { |
| 2134 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2135 | "%s: STA Context is NULL",__func__); |
| 2136 | return -EINVAL; |
| 2137 | } |
| 2138 | |
| 2139 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2140 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2141 | if (NULL == pWextState) |
| 2142 | { |
| 2143 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2144 | "%s: pWextState is NULL",__func__); |
| 2145 | return -EINVAL; |
| 2146 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2147 | |
| 2148 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 2149 | { |
| 2150 | return -ENXIO ; |
| 2151 | } |
| 2152 | |
| 2153 | rate = wrqu->bitrate.value; |
| 2154 | |
| 2155 | if (rate == -1) |
| 2156 | { |
| 2157 | rate = WNI_CFG_FIXED_RATE_AUTO; |
| 2158 | valid_rate = TRUE; |
| 2159 | } |
| 2160 | else if (ccmCfgGetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2161 | WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS) |
| 2162 | { |
| 2163 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G |
| 2164 | || active_phy_mode == WNI_CFG_DOT11_MODE_11B) |
| 2165 | { |
| 2166 | if ((ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2167 | WNI_CFG_SUPPORTED_RATES_11A, |
| 2168 | supp_rates, &a_len) == eHAL_STATUS_SUCCESS) && |
| 2169 | (ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2170 | WNI_CFG_SUPPORTED_RATES_11B, |
Ashish Kumar Dhanotiya | aa9e38c | 2018-05-23 20:23:24 +0530 | [diff] [blame] | 2171 | supp_rates + a_len, &b_len) == eHAL_STATUS_SUCCESS)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2172 | { |
| 2173 | for (i = 0; i < (b_len + a_len); ++i) |
| 2174 | { |
| 2175 | /* supported rates returned is double the actual rate so we divide it by 2 */ |
| 2176 | if ((supp_rates[i]&0x7F)/2 == rate) |
| 2177 | { |
| 2178 | valid_rate = TRUE; |
| 2179 | rate = i + WNI_CFG_FIXED_RATE_1MBPS; |
| 2180 | break; |
| 2181 | } |
| 2182 | } |
| 2183 | } |
| 2184 | } |
| 2185 | } |
| 2186 | if (valid_rate != TRUE) |
| 2187 | { |
| 2188 | return -EINVAL; |
| 2189 | } |
| 2190 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2191 | WNI_CFG_FIXED_RATE, rate, |
| 2192 | ccmCfgSetCallback,eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS) |
| 2193 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 2194 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2195 | FL("failed to set ini parameter, WNI_CFG_FIXED_RATE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2196 | return -EIO; |
| 2197 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2198 | |
| 2199 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2200 | return 0; |
| 2201 | } |
| 2202 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2203 | static int iw_set_bitrate(struct net_device *dev, |
| 2204 | struct iw_request_info *info, |
| 2205 | union iwreq_data *wrqu, |
| 2206 | char *extra) |
| 2207 | { |
| 2208 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2210 | vos_ssr_protect(__func__); |
| 2211 | ret = __iw_set_bitrate(dev, info, wrqu, extra); |
| 2212 | vos_ssr_unprotect(__func__); |
| 2213 | |
| 2214 | return ret; |
| 2215 | } |
| 2216 | |
| 2217 | static int __iw_set_genie(struct net_device *dev, |
| 2218 | struct iw_request_info *info, |
| 2219 | union iwreq_data *wrqu, |
| 2220 | char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2221 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2222 | hdd_adapter_t *pAdapter; |
| 2223 | hdd_context_t *pHddCtx; |
| 2224 | hdd_wext_state_t *pWextState; |
| 2225 | u_int8_t *genie = NULL; |
| 2226 | u_int8_t *base_genie = NULL; |
| 2227 | v_U16_t remLen; |
| 2228 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2229 | |
| 2230 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2231 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2232 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2233 | if (NULL == pAdapter) |
| 2234 | { |
| 2235 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2236 | "%s: Adapter is NULL",__func__); |
| 2237 | return -EINVAL; |
| 2238 | } |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2239 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2240 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2241 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2242 | if (0 != ret) |
| 2243 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2244 | return ret; |
| 2245 | } |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2246 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2247 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2248 | if (NULL == pWextState) |
| 2249 | { |
| 2250 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2251 | "%s: pWextState is NULL",__func__); |
| 2252 | return -EINVAL; |
| 2253 | } |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2254 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2255 | if (!wrqu->data.length) { |
| 2256 | hdd_clearRoamProfileIe(pAdapter); |
| 2257 | EXIT(); |
| 2258 | return 0; |
| 2259 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2260 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2261 | base_genie = mem_alloc_copy_from_user_helper(wrqu->data.pointer, |
| 2262 | wrqu->data.length); |
| 2263 | if (NULL == base_genie) |
| 2264 | { |
| 2265 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2266 | "mem_alloc_copy_from_user_helper fail"); |
| 2267 | return -ENOMEM; |
| 2268 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2269 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2270 | genie = base_genie; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2271 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2272 | remLen = wrqu->data.length; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2273 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2274 | hddLog(LOG1,"iw_set_genie ioctl IE[0x%X], LEN[%d]", genie[0], genie[1]); |
| 2275 | |
| 2276 | /* clear any previous genIE before this call */ |
| 2277 | memset( &pWextState->genIE, 0, sizeof(pWextState->genIE) ); |
| 2278 | |
| 2279 | while (remLen >= 2) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2280 | { |
| 2281 | v_U16_t eLen = 0; |
| 2282 | v_U8_t elementId; |
| 2283 | elementId = *genie++; |
| 2284 | eLen = *genie++; |
| 2285 | remLen -= 2; |
| 2286 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2287 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2288 | __func__, elementId, eLen); |
| 2289 | |
Pothula Hanumantha Reddy | f5278fc | 2016-12-28 17:55:19 +0530 | [diff] [blame] | 2290 | if (remLen < eLen) { |
| 2291 | hddLog(LOGE, "Remaining len: %u less than ie len: %u", |
| 2292 | remLen, eLen); |
| 2293 | ret = -EINVAL; |
| 2294 | goto exit; |
| 2295 | } |
| 2296 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2297 | switch ( elementId ) |
| 2298 | { |
| 2299 | case IE_EID_VENDOR: |
| 2300 | if ((IE_LEN_SIZE+IE_EID_SIZE+IE_VENDOR_OUI_SIZE) > eLen) /* should have at least OUI */ |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2301 | { |
Mahesh A Saptasagar | 73730f0 | 2015-10-28 13:08:42 +0530 | [diff] [blame] | 2302 | ret = -EINVAL; |
| 2303 | goto exit; |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2304 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2305 | |
| 2306 | if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
| 2307 | { |
| 2308 | v_U16_t curGenIELen = pWextState->genIE.length; |
| 2309 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS OUI(%02x %02x %02x %02x) IE(len %d)", |
| 2310 | __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2); |
| 2311 | |
| 2312 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) ) |
| 2313 | { |
| 2314 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2315 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2316 | VOS_ASSERT(0); |
Mahesh A Saptasagar | 73730f0 | 2015-10-28 13:08:42 +0530 | [diff] [blame] | 2317 | ret = -EINVAL; |
| 2318 | goto exit; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2319 | } |
| 2320 | // save to Additional IE ; it should be accumulated to handle WPS IE + other IE |
| 2321 | memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2); |
| 2322 | pWextState->genIE.length += eLen + 2; |
| 2323 | } |
| 2324 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 2325 | { |
| 2326 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
Mahesh A Saptasagar | 73730f0 | 2015-10-28 13:08:42 +0530 | [diff] [blame] | 2327 | if ((eLen + 2) > (sizeof(pWextState->WPARSNIE))) |
| 2328 | { |
| 2329 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. " |
| 2330 | "Need bigger buffer space"); |
| 2331 | ret = -EINVAL; |
| 2332 | VOS_ASSERT(0); |
| 2333 | goto exit; |
| 2334 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2335 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 2336 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)); |
| 2337 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 2338 | pWextState->roamProfile.nWPAReqIELength = eLen + 2; |
| 2339 | } |
| 2340 | else /* any vendorId except WPA IE should be accumulated to genIE */ |
| 2341 | { |
| 2342 | v_U16_t curGenIELen = pWextState->genIE.length; |
| 2343 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OUI(%02x %02x %02x %02x) IE(len %d)", |
| 2344 | __func__, genie[0], genie[1], genie[2], genie[3], eLen + 2); |
| 2345 | |
| 2346 | if( SIR_MAC_MAX_IE_LENGTH < (pWextState->genIE.length + eLen) ) |
| 2347 | { |
| 2348 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2349 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2350 | VOS_ASSERT(0); |
Mahesh A Saptasagar | 73730f0 | 2015-10-28 13:08:42 +0530 | [diff] [blame] | 2351 | ret = -ENOMEM; |
| 2352 | goto exit; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2353 | } |
| 2354 | // save to Additional IE ; it should be accumulated to handle WPS IE + other IE |
| 2355 | memcpy( pWextState->genIE.addIEdata + curGenIELen, genie - 2, eLen + 2); |
| 2356 | pWextState->genIE.length += eLen + 2; |
| 2357 | } |
| 2358 | break; |
| 2359 | case DOT11F_EID_RSN: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2360 | hddLog (LOG1, "%s Set RSN IE (len %d)",__func__, eLen+2); |
Mahesh A Saptasagar | 73730f0 | 2015-10-28 13:08:42 +0530 | [diff] [blame] | 2361 | if ((eLen + 2) > (sizeof(pWextState->WPARSNIE))) |
| 2362 | { |
| 2363 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate genIE. " |
| 2364 | "Need bigger buffer space"); |
| 2365 | ret = -EINVAL; |
| 2366 | VOS_ASSERT(0); |
| 2367 | goto exit; |
| 2368 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2369 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 2370 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)); |
| 2371 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 2372 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; |
| 2373 | break; |
| 2374 | |
| 2375 | default: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2376 | hddLog (LOGE, "%s Set UNKNOWN IE %X",__func__, elementId); |
Mahesh A Saptasagar | 73730f0 | 2015-10-28 13:08:42 +0530 | [diff] [blame] | 2377 | goto exit; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2378 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2379 | remLen -= eLen; |
Pothula Hanumantha Reddy | f5278fc | 2016-12-28 17:55:19 +0530 | [diff] [blame] | 2380 | |
| 2381 | /* Move genie only if next element is present */ |
| 2382 | if (remLen >= 2) |
| 2383 | genie += eLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2384 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2385 | |
Mahesh A Saptasagar | 73730f0 | 2015-10-28 13:08:42 +0530 | [diff] [blame] | 2386 | exit: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2387 | EXIT(); |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 2388 | kfree(base_genie); |
Mahesh A Saptasagar | 73730f0 | 2015-10-28 13:08:42 +0530 | [diff] [blame] | 2389 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2390 | } |
| 2391 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2392 | static int iw_set_genie(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2393 | struct iw_request_info *info, |
| 2394 | union iwreq_data *wrqu, |
| 2395 | char *extra) |
| 2396 | { |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2397 | int ret; |
| 2398 | |
| 2399 | vos_ssr_protect(__func__); |
| 2400 | ret = __iw_set_genie(dev, info, wrqu, extra); |
| 2401 | vos_ssr_unprotect(__func__); |
| 2402 | |
| 2403 | return ret; |
| 2404 | } |
| 2405 | |
| 2406 | static int __iw_get_genie(struct net_device *dev, |
| 2407 | struct iw_request_info *info, |
| 2408 | union iwreq_data *wrqu, |
| 2409 | char *extra) |
| 2410 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2411 | hdd_wext_state_t *pWextState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2412 | hdd_context_t *pHddCtx; |
| 2413 | hdd_adapter_t *pAdapter; |
| 2414 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2415 | eHalStatus status; |
| 2416 | v_U32_t length = DOT11F_IE_RSN_MAX_LEN; |
| 2417 | v_U8_t genIeBytes[DOT11F_IE_RSN_MAX_LEN]; |
| 2418 | |
| 2419 | ENTER(); |
| 2420 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2421 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2422 | if (NULL == pAdapter) |
| 2423 | { |
| 2424 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2425 | "%s: Adapter is NULL",__func__); |
| 2426 | return -EINVAL; |
| 2427 | } |
| 2428 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2429 | status = wlan_hdd_validate_context(pHddCtx); |
| 2430 | if (0 != status) |
| 2431 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2432 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2433 | } |
| 2434 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2435 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2436 | if (NULL == pWextState) |
| 2437 | { |
| 2438 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2439 | "%s: pWextState is NULL",__func__); |
| 2440 | return -EINVAL; |
| 2441 | } |
| 2442 | |
| 2443 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2444 | if (NULL == pHddStaCtx) |
| 2445 | { |
| 2446 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2447 | "%s: STA Context is NULL",__func__); |
| 2448 | return -EINVAL; |
| 2449 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2450 | |
| 2451 | if( pHddStaCtx->conn_info.connState == eConnectionState_NotConnected) |
| 2452 | { |
| 2453 | return -ENXIO; |
| 2454 | } |
| 2455 | |
| 2456 | // Return something ONLY if we are associated with an RSN or WPA network |
| 2457 | if ( VOS_TRUE != hdd_IsAuthTypeRSN(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2458 | pWextState->roamProfile.negotiatedAuthType)) |
| 2459 | { |
| 2460 | return -ENXIO; |
| 2461 | } |
| 2462 | |
| 2463 | // Actually retrieve the RSN IE from CSR. (We previously sent it down in the CSR Roam Profile.) |
| 2464 | status = csrRoamGetWpaRsnReqIE(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2465 | pAdapter->sessionId, |
| 2466 | &length, |
| 2467 | genIeBytes); |
Manjeet Singh | 715d47e | 2016-08-02 19:08:02 +0530 | [diff] [blame] | 2468 | if (eHAL_STATUS_SUCCESS != status) { |
| 2469 | hddLog(LOGE, FL("failed to get WPA-RSN IE data")); |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 2470 | return -EFAULT; |
| 2471 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2472 | |
Manjeet Singh | 715d47e | 2016-08-02 19:08:02 +0530 | [diff] [blame] | 2473 | wrqu->data.length = length; |
| 2474 | if (length > DOT11F_IE_RSN_MAX_LEN) { |
| 2475 | hddLog(LOGE, |
| 2476 | FL("invalid buffer length length:%d"), length); |
| 2477 | return -E2BIG; |
| 2478 | } |
| 2479 | |
| 2480 | vos_mem_copy( extra, (v_VOID_t*)genIeBytes, length); |
| 2481 | |
| 2482 | hddLog(LOG1, FL("RSN IE of %d bytes returned"), wrqu->data.length ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2483 | |
| 2484 | EXIT(); |
| 2485 | |
| 2486 | return 0; |
| 2487 | } |
| 2488 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2489 | static int iw_get_genie(struct net_device *dev, |
| 2490 | struct iw_request_info *info, |
| 2491 | union iwreq_data *wrqu, |
| 2492 | char *extra) |
| 2493 | { |
| 2494 | int ret; |
| 2495 | |
| 2496 | vos_ssr_protect(__func__); |
| 2497 | ret = __iw_get_genie(dev, info, wrqu, extra); |
| 2498 | vos_ssr_unprotect(__func__); |
| 2499 | |
| 2500 | return ret; |
| 2501 | } |
| 2502 | |
| 2503 | |
| 2504 | static int __iw_get_encode(struct net_device *dev, |
| 2505 | struct iw_request_info *info, |
| 2506 | struct iw_point *dwrq, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2507 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2508 | hdd_adapter_t *pAdapter; |
| 2509 | hdd_context_t *pHddCtx; |
| 2510 | hdd_wext_state_t *pWextState; |
| 2511 | tCsrRoamProfile *pRoamProfile; |
| 2512 | int keyId, i, ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2513 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2514 | |
| 2515 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2516 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2517 | if (NULL == pAdapter) |
| 2518 | { |
| 2519 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2520 | "%s: Adapter is NULL",__func__); |
| 2521 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2522 | } |
| 2523 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2524 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2525 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2526 | if (0 != ret) |
| 2527 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2528 | return ret; |
| 2529 | } |
| 2530 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 2531 | if (NULL == pWextState) |
| 2532 | { |
| 2533 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2534 | "%s: pWextState is NULL",__func__); |
| 2535 | return -EINVAL; |
| 2536 | } |
| 2537 | |
| 2538 | pRoamProfile = &(pWextState->roamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2539 | keyId = pRoamProfile->Keys.defaultIndex; |
| 2540 | |
| 2541 | if(keyId < 0 || keyId >= MAX_WEP_KEYS) |
| 2542 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 2543 | hddLog(LOG1,"%s: Invalid keyId : %d",__func__,keyId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2544 | return -EINVAL; |
| 2545 | } |
| 2546 | |
| 2547 | if(pRoamProfile->Keys.KeyLength[keyId] > 0) |
| 2548 | { |
| 2549 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 2550 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
| 2551 | vos_mem_copy(extra,&(pRoamProfile->Keys.KeyMaterial[keyId][0]),pRoamProfile->Keys.KeyLength[keyId]); |
| 2552 | |
| 2553 | dwrq->flags |= (keyId + 1); |
| 2554 | |
| 2555 | } |
| 2556 | else |
| 2557 | { |
| 2558 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 2559 | } |
| 2560 | |
| 2561 | for(i=0; i < MAX_WEP_KEYS; i++) |
| 2562 | { |
| 2563 | if(pRoamProfile->Keys.KeyMaterial[i] == NULL) |
| 2564 | { |
| 2565 | continue; |
| 2566 | } |
| 2567 | else |
| 2568 | { |
| 2569 | break; |
| 2570 | } |
| 2571 | } |
| 2572 | |
| 2573 | if(MAX_WEP_KEYS == i) |
| 2574 | { |
| 2575 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 2576 | } |
| 2577 | |
| 2578 | authType = ((hdd_station_ctx_t*)WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType; |
| 2579 | |
| 2580 | if(eCSR_AUTH_TYPE_OPEN_SYSTEM == authType) |
| 2581 | { |
| 2582 | dwrq->flags |= IW_ENCODE_OPEN; |
| 2583 | } |
| 2584 | else |
| 2585 | { |
| 2586 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 2587 | } |
| 2588 | EXIT(); |
| 2589 | return 0; |
| 2590 | } |
| 2591 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2592 | static int iw_get_encode(struct net_device *dev, |
| 2593 | struct iw_request_info *info, |
| 2594 | struct iw_point *dwrq, char *extra) |
| 2595 | { |
| 2596 | int ret; |
| 2597 | |
| 2598 | vos_ssr_protect(__func__); |
| 2599 | ret = __iw_get_encode(dev, info, dwrq, extra); |
| 2600 | vos_ssr_unprotect(__func__); |
| 2601 | |
| 2602 | return ret; |
| 2603 | } |
| 2604 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2605 | #define PAE_ROLE_AUTHENTICATOR 1 // =1 for authenticator, |
| 2606 | #define PAE_ROLE_SUPPLICANT 0 // =0 for supplicant |
| 2607 | |
| 2608 | |
| 2609 | /* |
| 2610 | * This function sends a single 'key' to LIM at all time. |
| 2611 | */ |
| 2612 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2613 | static int __iw_get_rts_threshold(struct net_device *dev, |
| 2614 | struct iw_request_info *info, |
| 2615 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2616 | { |
| 2617 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2618 | v_U32_t status = 0; |
| 2619 | |
| 2620 | status = hdd_wlan_get_rts_threshold(pAdapter,wrqu); |
| 2621 | |
| 2622 | return status; |
| 2623 | } |
| 2624 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2625 | static int iw_get_rts_threshold(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2626 | struct iw_request_info *info, |
| 2627 | union iwreq_data *wrqu, char *extra) |
| 2628 | { |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2629 | int ret; |
| 2630 | |
| 2631 | vos_ssr_protect(__func__); |
| 2632 | ret = __iw_get_rts_threshold(dev, info, wrqu, extra); |
| 2633 | vos_ssr_unprotect(__func__); |
| 2634 | |
| 2635 | return ret; |
| 2636 | } |
| 2637 | |
| 2638 | static int __iw_set_rts_threshold(struct net_device *dev, |
| 2639 | struct iw_request_info *info, |
| 2640 | union iwreq_data *wrqu, char *extra) |
| 2641 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2642 | hdd_adapter_t *pAdapter; |
| 2643 | hdd_context_t *pHddCtx; |
| 2644 | tHalHandle hHal; |
| 2645 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2646 | |
| 2647 | ENTER(); |
| 2648 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2649 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2650 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 2651 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2652 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2653 | "%s: Adapter is NULL",__func__); |
| 2654 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 2655 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2656 | |
| 2657 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2658 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2659 | if (0 != ret) |
| 2660 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2661 | return ret; |
| 2662 | } |
| 2663 | |
| 2664 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2665 | if (NULL == hHal) |
| 2666 | { |
| 2667 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2668 | "%s: Hal Context is NULL",__func__); |
| 2669 | return -EINVAL; |
| 2670 | } |
| 2671 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2672 | if ( wrqu->rts.value < WNI_CFG_RTS_THRESHOLD_STAMIN || wrqu->rts.value > WNI_CFG_RTS_THRESHOLD_STAMAX ) |
| 2673 | { |
| 2674 | return -EINVAL; |
| 2675 | } |
| 2676 | |
| 2677 | if ( ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, wrqu->rts.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 2678 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 2679 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2680 | FL("failed to set ini parameter, WNI_CFG_RTS_THRESHOLD")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2681 | return -EIO; |
| 2682 | } |
| 2683 | |
| 2684 | EXIT(); |
| 2685 | |
| 2686 | return 0; |
| 2687 | } |
| 2688 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2689 | static int iw_set_rts_threshold(struct net_device *dev, |
| 2690 | struct iw_request_info *info, |
| 2691 | union iwreq_data *wrqu, char *extra) |
| 2692 | { |
| 2693 | int ret; |
| 2694 | |
| 2695 | vos_ssr_protect(__func__); |
| 2696 | ret = __iw_set_rts_threshold(dev, info, wrqu, extra); |
| 2697 | vos_ssr_unprotect(__func__); |
| 2698 | |
| 2699 | return ret; |
| 2700 | } |
| 2701 | |
| 2702 | static int __iw_get_frag_threshold(struct net_device *dev, |
| 2703 | struct iw_request_info *info, |
| 2704 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2705 | { |
| 2706 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2707 | v_U32_t status = 0; |
| 2708 | |
| 2709 | status = hdd_wlan_get_frag_threshold(pAdapter,wrqu); |
| 2710 | |
| 2711 | return status; |
| 2712 | } |
| 2713 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2714 | static int iw_get_frag_threshold(struct net_device *dev, |
| 2715 | struct iw_request_info *info, |
| 2716 | union iwreq_data *wrqu, char *extra) |
| 2717 | { |
| 2718 | int ret; |
| 2719 | |
| 2720 | vos_ssr_protect(__func__); |
| 2721 | ret = __iw_get_frag_threshold(dev, info, wrqu, extra); |
| 2722 | vos_ssr_unprotect(__func__); |
| 2723 | |
| 2724 | return ret; |
| 2725 | } |
| 2726 | |
| 2727 | static int __iw_set_frag_threshold(struct net_device *dev, |
| 2728 | struct iw_request_info *info, |
| 2729 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2730 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2731 | hdd_adapter_t *pAdapter; |
| 2732 | hdd_context_t *pHddCtx; |
| 2733 | tHalHandle hHal; |
| 2734 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2735 | |
| 2736 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2737 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2738 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 2739 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2740 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2741 | "%s: Adapter is NULL",__func__); |
| 2742 | return -EINVAL; |
| 2743 | } |
| 2744 | |
| 2745 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2746 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2747 | if (0 != ret) |
| 2748 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2749 | return ret; |
| 2750 | } |
| 2751 | |
| 2752 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2753 | if (NULL == hHal) |
| 2754 | { |
| 2755 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2756 | "%s: Hal Context is NULL",__func__); |
| 2757 | return -EINVAL; |
| 2758 | } |
| 2759 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2760 | if ( wrqu->frag.value < WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN || wrqu->frag.value > WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX ) |
| 2761 | { |
| 2762 | return -EINVAL; |
| 2763 | } |
| 2764 | |
| 2765 | if ( ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, wrqu->frag.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 2766 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 2767 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2768 | FL("failed to set ini parameter, WNI_CFG_FRAGMENTATION_THRESHOLD")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2769 | return -EIO; |
| 2770 | } |
| 2771 | |
| 2772 | EXIT(); |
| 2773 | |
| 2774 | return 0; |
| 2775 | } |
| 2776 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2777 | static int iw_set_frag_threshold(struct net_device *dev, |
| 2778 | struct iw_request_info *info, |
| 2779 | union iwreq_data *wrqu, char *extra) |
| 2780 | { |
| 2781 | int ret; |
| 2782 | |
| 2783 | vos_ssr_protect(__func__); |
| 2784 | ret = __iw_set_frag_threshold(dev, info, wrqu, extra); |
| 2785 | vos_ssr_unprotect(__func__); |
| 2786 | |
| 2787 | return ret; |
| 2788 | } |
| 2789 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 2790 | static int __iw_get_power_mode(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2791 | struct iw_request_info *info, |
| 2792 | union iwreq_data *wrqu, char *extra) |
| 2793 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2794 | hdd_adapter_t *pAdapter; |
| 2795 | hdd_context_t *pHddCtx; |
| 2796 | int ret = 0; |
| 2797 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2798 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2799 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2800 | if (NULL == pAdapter) |
| 2801 | { |
| 2802 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2803 | "%s: Adapter is NULL",__func__); |
| 2804 | return -EINVAL; |
| 2805 | } |
| 2806 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2807 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2808 | if (0 != ret) |
| 2809 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2810 | return ret; |
| 2811 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2812 | |
| 2813 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2814 | return -EOPNOTSUPP; |
| 2815 | } |
| 2816 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 2817 | static int iw_get_power_mode(struct net_device *dev, |
| 2818 | struct iw_request_info *info, |
| 2819 | union iwreq_data *wrqu, char *extra) |
| 2820 | { |
| 2821 | int ret; |
| 2822 | |
| 2823 | vos_ssr_protect(__func__); |
| 2824 | ret = __iw_get_power_mode(dev, info, wrqu, extra); |
| 2825 | vos_ssr_unprotect(__func__); |
| 2826 | |
| 2827 | return ret; |
| 2828 | } |
| 2829 | static int __iw_set_power_mode(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2830 | struct iw_request_info *info, |
| 2831 | union iwreq_data *wrqu, char *extra) |
| 2832 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2833 | hdd_adapter_t *pAdapter; |
| 2834 | hdd_context_t *pHddCtx; |
| 2835 | int ret = 0; |
| 2836 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2837 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2838 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2839 | if (NULL == pAdapter) |
| 2840 | { |
| 2841 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2842 | "%s: Adapter is NULL",__func__); |
| 2843 | return -EINVAL; |
| 2844 | } |
| 2845 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2846 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2847 | if (0 != ret) |
| 2848 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2849 | return ret; |
| 2850 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2851 | |
| 2852 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2853 | return -EOPNOTSUPP; |
| 2854 | } |
| 2855 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 2856 | static int iw_set_power_mode(struct net_device *dev, |
| 2857 | struct iw_request_info *info, |
| 2858 | union iwreq_data *wrqu, char *extra) |
| 2859 | { |
| 2860 | int ret; |
| 2861 | |
| 2862 | vos_ssr_protect(__func__); |
| 2863 | ret = __iw_set_power_mode(dev, info, wrqu, extra); |
| 2864 | vos_ssr_unprotect(__func__); |
| 2865 | |
| 2866 | return ret; |
| 2867 | } |
| 2868 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 2869 | static int __iw_get_range(struct net_device *dev, |
| 2870 | struct iw_request_info *info, |
| 2871 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2872 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2873 | hdd_adapter_t *pAdapter; |
| 2874 | tHalHandle hHal; |
| 2875 | hdd_context_t *pHddCtx; |
| 2876 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2877 | struct iw_range *range = (struct iw_range *) extra; |
| 2878 | |
| 2879 | v_U8_t channels[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 2880 | |
| 2881 | v_U32_t num_channels = sizeof(channels); |
| 2882 | v_U8_t supp_rates[WNI_CFG_SUPPORTED_RATES_11A_LEN]; |
| 2883 | v_U32_t a_len; |
| 2884 | v_U32_t b_len; |
| 2885 | v_U32_t active_phy_mode = 0; |
| 2886 | v_U8_t index = 0, i; |
| 2887 | |
| 2888 | ENTER(); |
| 2889 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2890 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 2891 | if (NULL == pAdapter) |
| 2892 | { |
| 2893 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2894 | "%s: pAdapter is NULL", __func__); |
| 2895 | return -EINVAL; |
| 2896 | } |
| 2897 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2898 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2899 | if (0 != ret) |
| 2900 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 2901 | return ret; |
| 2902 | } |
| 2903 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 2904 | if (NULL == hHal) |
| 2905 | { |
| 2906 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 2907 | "%s: pAdapter is NULL", __func__); |
| 2908 | return -EINVAL; |
| 2909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2910 | wrqu->data.length = sizeof(struct iw_range); |
| 2911 | memset(range, 0, sizeof(struct iw_range)); |
| 2912 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2913 | /*Get the phy mode*/ |
| 2914 | if (ccmCfgGetInt(hHal, |
| 2915 | WNI_CFG_DOT11_MODE, &active_phy_mode) == eHAL_STATUS_SUCCESS) |
| 2916 | { |
| 2917 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 2918 | "active_phy_mode = %d", active_phy_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2919 | |
| 2920 | if (active_phy_mode == WNI_CFG_DOT11_MODE_11A || active_phy_mode == WNI_CFG_DOT11_MODE_11G) |
| 2921 | { |
| 2922 | /*Get the supported rates for 11G band*/ |
Jeff Johnson | 1611e58 | 2013-04-03 10:43:16 -0700 | [diff] [blame] | 2923 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2924 | if (ccmCfgGetStr(hHal, |
| 2925 | WNI_CFG_SUPPORTED_RATES_11A, |
| 2926 | supp_rates, &a_len) == eHAL_STATUS_SUCCESS) |
| 2927 | { |
| 2928 | if (a_len > WNI_CFG_SUPPORTED_RATES_11A_LEN) |
| 2929 | { |
| 2930 | a_len = WNI_CFG_SUPPORTED_RATES_11A_LEN; |
| 2931 | } |
| 2932 | for (i = 0; i < a_len; i++) |
| 2933 | { |
| 2934 | range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000; |
| 2935 | } |
| 2936 | range->num_bitrates = a_len; |
| 2937 | } |
| 2938 | else |
| 2939 | { |
| 2940 | return -EIO; |
| 2941 | } |
| 2942 | } |
| 2943 | else if (active_phy_mode == WNI_CFG_DOT11_MODE_11B) |
| 2944 | { |
| 2945 | /*Get the supported rates for 11B band*/ |
Jeff Johnson | 1611e58 | 2013-04-03 10:43:16 -0700 | [diff] [blame] | 2946 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2947 | if (ccmCfgGetStr(hHal, |
| 2948 | WNI_CFG_SUPPORTED_RATES_11B, |
| 2949 | supp_rates, &b_len) == eHAL_STATUS_SUCCESS) |
| 2950 | { |
| 2951 | if (b_len > WNI_CFG_SUPPORTED_RATES_11B_LEN) |
| 2952 | { |
| 2953 | b_len = WNI_CFG_SUPPORTED_RATES_11B_LEN; |
| 2954 | } |
| 2955 | for (i = 0; i < b_len; i++) |
| 2956 | { |
| 2957 | range->bitrate[i] = ((supp_rates[i] & 0x7F) / 2) * 1000000; |
| 2958 | } |
| 2959 | range->num_bitrates = b_len; |
| 2960 | } |
| 2961 | else |
| 2962 | { |
| 2963 | return -EIO; |
| 2964 | } |
| 2965 | } |
| 2966 | } |
| 2967 | |
| 2968 | range->max_rts = WNI_CFG_RTS_THRESHOLD_STAMAX; |
| 2969 | range->min_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN; |
| 2970 | range->max_frag = WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX; |
| 2971 | |
| 2972 | range->encoding_size[0] = 5; |
| 2973 | range->encoding_size[1] = 13; |
| 2974 | range->num_encoding_sizes = 2; |
| 2975 | range->max_encoding_tokens = MAX_WEP_KEYS; |
| 2976 | |
| 2977 | // we support through Wireless Extensions 22 |
| 2978 | range->we_version_compiled = WIRELESS_EXT; |
| 2979 | range->we_version_source = 22; |
| 2980 | |
| 2981 | /*Supported Channels and Frequencies*/ |
| 2982 | if (ccmCfgGetStr((hHal), WNI_CFG_VALID_CHANNEL_LIST, channels, &num_channels) != eHAL_STATUS_SUCCESS) |
| 2983 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 2984 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 2985 | FL("failed to get ini parameter, WNI_CFG_VALID_CHANNEL_LIST")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2986 | return -EIO; |
| 2987 | } |
| 2988 | if (num_channels > IW_MAX_FREQUENCIES) |
| 2989 | { |
| 2990 | num_channels = IW_MAX_FREQUENCIES; |
| 2991 | } |
| 2992 | |
| 2993 | range->num_channels = num_channels; |
| 2994 | range->num_frequency = num_channels; |
| 2995 | |
| 2996 | for (index=0; index < num_channels; index++) |
| 2997 | { |
| 2998 | v_U32_t frq_indx = 0; |
| 2999 | |
| 3000 | range->freq[index].i = channels[index]; |
| 3001 | while (frq_indx < FREQ_CHAN_MAP_TABLE_SIZE) |
| 3002 | { |
| 3003 | if(channels[index] == freq_chan_map[frq_indx].chan) |
| 3004 | { |
| 3005 | range->freq[index].m = freq_chan_map[frq_indx].freq * 100000; |
| 3006 | range->freq[index].e = 1; |
| 3007 | break; |
| 3008 | } |
| 3009 | frq_indx++; |
| 3010 | } |
| 3011 | } |
| 3012 | |
| 3013 | /* Event capability (kernel + driver) */ |
| 3014 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | |
| 3015 | IW_EVENT_CAPA_MASK(SIOCGIWAP) | |
| 3016 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); |
| 3017 | range->event_capa[1] = IW_EVENT_CAPA_K_1; |
| 3018 | |
| 3019 | /*Encryption capability*/ |
| 3020 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
| 3021 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
| 3022 | |
| 3023 | /* Txpower capability */ |
| 3024 | range->txpower_capa = IW_TXPOW_MWATT; |
| 3025 | |
| 3026 | /*Scanning capability*/ |
| 3027 | #if WIRELESS_EXT >= 22 |
| 3028 | range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE | IW_SCAN_CAPA_CHANNEL; |
| 3029 | #endif |
| 3030 | |
| 3031 | EXIT(); |
| 3032 | return 0; |
| 3033 | } |
| 3034 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 3035 | static int iw_get_range(struct net_device *dev, |
| 3036 | struct iw_request_info *info, |
| 3037 | union iwreq_data *wrqu, char *extra) |
| 3038 | { |
| 3039 | int ret; |
| 3040 | |
| 3041 | vos_ssr_protect(__func__); |
| 3042 | ret = __iw_get_range(dev, info, wrqu, extra); |
| 3043 | vos_ssr_unprotect(__func__); |
| 3044 | |
| 3045 | return ret; |
| 3046 | } |
| 3047 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3048 | /* Callback function for tx per hit */ |
| 3049 | void hdd_tx_per_hit_cb (void *pCallbackContext) |
| 3050 | { |
| 3051 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)pCallbackContext; |
| 3052 | unsigned char tx_fail[16]; |
| 3053 | union iwreq_data wrqu; |
| 3054 | |
Kaushik, Sushant | c78ee81 | 2014-08-01 12:21:19 +0530 | [diff] [blame] | 3055 | if (NULL == pAdapter || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3056 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3057 | hddLog(LOGE, "hdd_tx_per_hit_cb: pAdapter is NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3058 | return; |
| 3059 | } |
| 3060 | memset(&wrqu, 0, sizeof(wrqu)); |
| 3061 | wrqu.data.length = strlcpy(tx_fail, "TX_FAIL", sizeof(tx_fail)); |
| 3062 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, tx_fail); |
| 3063 | } |
| 3064 | |
Hanumanth Reddy Pothula | 42981db | 2018-04-05 17:27:39 +0530 | [diff] [blame] | 3065 | void hdd_get_class_a_statistics_cb(void *stats, void *context) |
| 3066 | { |
| 3067 | struct hdd_request *request; |
| 3068 | struct stats_class_a_ctx *priv; |
| 3069 | |
| 3070 | if (ioctl_debug) { |
| 3071 | pr_info("%s: stats [%pK] context [%pK]\n", |
| 3072 | __func__, stats, context); |
| 3073 | } |
| 3074 | |
| 3075 | if (NULL == stats) { |
| 3076 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3077 | "%s: Bad param, stats [%pK]", |
| 3078 | __func__, stats); |
| 3079 | return; |
| 3080 | } |
| 3081 | |
| 3082 | request = hdd_request_get(context); |
| 3083 | if (!request) { |
| 3084 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Obsolete request")); |
| 3085 | return; |
| 3086 | } |
| 3087 | |
| 3088 | priv = hdd_request_priv(request); |
| 3089 | |
| 3090 | /* copy over the stats. do so as a struct copy */ |
| 3091 | priv->class_a_stats = *(tCsrGlobalClassAStatsInfo *)stats; |
| 3092 | |
| 3093 | hdd_request_complete(request); |
| 3094 | hdd_request_put(request); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3095 | } |
| 3096 | |
| 3097 | VOS_STATUS wlan_hdd_get_classAstats(hdd_adapter_t *pAdapter) |
| 3098 | { |
| 3099 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3100 | eHalStatus hstatus; |
Hanumanth Reddy Pothula | 42981db | 2018-04-05 17:27:39 +0530 | [diff] [blame] | 3101 | int ret; |
| 3102 | void *cookie; |
| 3103 | struct hdd_request *request; |
| 3104 | struct stats_class_a_ctx *priv; |
| 3105 | static const struct hdd_request_params params = { |
| 3106 | .priv_size = sizeof(*priv), |
| 3107 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 3108 | }; |
| 3109 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3110 | |
| 3111 | if (NULL == pAdapter) |
| 3112 | { |
| 3113 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__); |
| 3114 | return VOS_STATUS_E_FAULT; |
| 3115 | } |
| 3116 | if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) |
| 3117 | { |
| 3118 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:LOGP in Progress. Ignore!!!",__func__); |
| 3119 | return VOS_STATUS_SUCCESS; |
| 3120 | } |
| 3121 | |
Hanumanth Reddy Pothula | 42981db | 2018-04-05 17:27:39 +0530 | [diff] [blame] | 3122 | request = hdd_request_alloc(¶ms); |
| 3123 | if (!request) { |
| 3124 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 3125 | return VOS_STATUS_E_NOMEM; |
| 3126 | } |
| 3127 | cookie = hdd_request_cookie(request); |
| 3128 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3129 | /* query only for Class A statistics (which include link speed) */ |
| 3130 | hstatus = sme_GetStatistics( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3131 | eCSR_HDD, |
| 3132 | SME_GLOBAL_CLASSA_STATS, |
Hanumanth Reddy Pothula | 42981db | 2018-04-05 17:27:39 +0530 | [diff] [blame] | 3133 | hdd_get_class_a_statistics_cb, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3134 | 0, // not periodic |
| 3135 | FALSE, //non-cached results |
| 3136 | pHddStaCtx->conn_info.staId[0], |
Hanumanth Reddy Pothula | 42981db | 2018-04-05 17:27:39 +0530 | [diff] [blame] | 3137 | cookie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3138 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 3139 | { |
| 3140 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3141 | "%s: Unable to retrieve Class A statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3142 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3143 | /* we'll returned a cached value below */ |
| 3144 | } |
| 3145 | else |
| 3146 | { |
Hanumanth Reddy Pothula | 42981db | 2018-04-05 17:27:39 +0530 | [diff] [blame] | 3147 | /* request was sent -- wait for the response */ |
| 3148 | ret = hdd_request_wait_for_response(request); |
| 3149 | if (ret) |
| 3150 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3151 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Hanumanth Reddy Pothula | 42981db | 2018-04-05 17:27:39 +0530 | [diff] [blame] | 3152 | FL("SME timeout while retrieving Class A statistics")); |
| 3153 | } |
| 3154 | else |
| 3155 | { |
| 3156 | priv = hdd_request_priv(request); |
| 3157 | pAdapter->hdd_stats.ClassA_stat = priv->class_a_stats; |
| 3158 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3159 | } |
| 3160 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3161 | |
Hanumanth Reddy Pothula | 42981db | 2018-04-05 17:27:39 +0530 | [diff] [blame] | 3162 | /* |
| 3163 | * either we never sent a request, we sent a request and received a |
| 3164 | * response or we sent a request and timed out. Regardless we are |
| 3165 | * done with the request. |
| 3166 | */ |
| 3167 | hdd_request_put(request); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3168 | |
| 3169 | /* either callback updated pAdapter stats or it has cached data */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3170 | return VOS_STATUS_SUCCESS; |
| 3171 | } |
| 3172 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3173 | struct stats_ctx { |
| 3174 | tCsrSummaryStatsInfo summary_stats; |
| 3175 | tCsrGlobalClassAStatsInfo class_a_stats; |
| 3176 | }; |
| 3177 | |
| 3178 | static void hdd_get_station_statistics_cb(void *stats, void *context) |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3179 | { |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3180 | tCsrSummaryStatsInfo *summary_stats; |
| 3181 | tCsrGlobalClassAStatsInfo *class_a_stats; |
| 3182 | struct hdd_request *request; |
| 3183 | struct stats_ctx *priv; |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3184 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3185 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3186 | if (ioctl_debug) { |
| 3187 | pr_info("%s: stats [%pK] context [%pK]\n", |
| 3188 | __func__, stats, context); |
| 3189 | } |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3190 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3191 | if (NULL == stats) { |
| 3192 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3193 | "%s: Bad param, stats [%pK]", |
| 3194 | __func__, stats); |
| 3195 | return; |
| 3196 | } |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3197 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3198 | request = hdd_request_get(context); |
| 3199 | if (!request) { |
| 3200 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Obsolete request")); |
| 3201 | return; |
| 3202 | } |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3203 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3204 | summary_stats = (tCsrSummaryStatsInfo *)stats; |
| 3205 | class_a_stats = (tCsrGlobalClassAStatsInfo *)(summary_stats + 1); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3206 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3207 | priv = hdd_request_priv(request); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3208 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3209 | /* copy over the stats. do so as a struct copy */ |
| 3210 | priv->summary_stats = *summary_stats; |
| 3211 | priv->class_a_stats = *class_a_stats; |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3212 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3213 | hdd_request_complete(request); |
| 3214 | hdd_request_put(request); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3215 | } |
| 3216 | |
| 3217 | VOS_STATUS wlan_hdd_get_station_stats(hdd_adapter_t *pAdapter) |
| 3218 | { |
Hanumanth Reddy Pothula | 9b2038f | 2017-08-03 16:37:42 +0530 | [diff] [blame] | 3219 | hdd_station_ctx_t *pHddStaCtx; |
| 3220 | hdd_ap_ctx_t *sap_ctx; |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3221 | eHalStatus hstatus; |
Hanumanth Reddy Pothula | 9b2038f | 2017-08-03 16:37:42 +0530 | [diff] [blame] | 3222 | tANI_U8 sta_id; |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3223 | int ret; |
| 3224 | void *cookie; |
| 3225 | struct hdd_request *request; |
| 3226 | struct stats_ctx *priv; |
| 3227 | static const struct hdd_request_params params = { |
| 3228 | .priv_size = sizeof(*priv), |
| 3229 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 3230 | }; |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3231 | |
| 3232 | if (NULL == pAdapter) |
| 3233 | { |
| 3234 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Padapter is NULL", __func__); |
| 3235 | return VOS_STATUS_SUCCESS; |
| 3236 | } |
| 3237 | |
Hanumanth Reddy Pothula | 9b2038f | 2017-08-03 16:37:42 +0530 | [diff] [blame] | 3238 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) { |
| 3239 | sap_ctx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 3240 | sta_id = sap_ctx->uBCStaId; |
| 3241 | } else { |
| 3242 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3243 | sta_id = pHddStaCtx->conn_info.staId[0]; |
| 3244 | } |
| 3245 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3246 | request = hdd_request_alloc(¶ms); |
| 3247 | if (!request) { |
| 3248 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 3249 | return VOS_STATUS_E_NOMEM; |
| 3250 | } |
| 3251 | cookie = hdd_request_cookie(request); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3252 | |
| 3253 | /* query only for Summary & Class A statistics */ |
| 3254 | hstatus = sme_GetStatistics(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3255 | eCSR_HDD, |
| 3256 | SME_SUMMARY_STATS | |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 3257 | SME_GLOBAL_CLASSA_STATS | |
| 3258 | SME_PER_PKT_STATS, |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3259 | hdd_get_station_statistics_cb, |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3260 | 0, // not periodic |
| 3261 | FALSE, //non-cached results |
Hanumanth Reddy Pothula | 9b2038f | 2017-08-03 16:37:42 +0530 | [diff] [blame] | 3262 | sta_id, |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3263 | cookie); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3264 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 3265 | { |
| 3266 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3267 | "%s: Unable to retrieve statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3268 | __func__); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3269 | /* we'll return with cached values */ |
| 3270 | } |
| 3271 | else |
| 3272 | { |
| 3273 | /* request was sent -- wait for the response */ |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3274 | ret = hdd_request_wait_for_response(request); |
| 3275 | if (ret) |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3276 | { |
| 3277 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3278 | FL("SME timeout while retrieving statistics")); |
| 3279 | } |
| 3280 | else |
| 3281 | { |
| 3282 | priv = hdd_request_priv(request); |
| 3283 | pAdapter->hdd_stats.summary_stat = priv->summary_stats; |
| 3284 | pAdapter->hdd_stats.ClassA_stat = priv->class_a_stats; |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3285 | } |
| 3286 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3287 | |
Hanumanth Reddy Pothula | 1045523 | 2018-04-05 16:06:04 +0530 | [diff] [blame] | 3288 | /* |
| 3289 | * either we never sent a request, we sent a request and received a |
| 3290 | * response or we sent a request and timed out. Regardless we are |
| 3291 | * done with the request. |
| 3292 | */ |
| 3293 | hdd_request_put(request); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3294 | |
| 3295 | /* either callback updated pAdapter stats or it has cached data */ |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 3296 | return VOS_STATUS_SUCCESS; |
| 3297 | } |
| 3298 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3299 | /* |
| 3300 | * Support for the LINKSPEED private command |
| 3301 | * Per the WiFi framework the response must be of the form |
| 3302 | * "LinkSpeed xx" |
| 3303 | */ |
| 3304 | static int iw_get_linkspeed(struct net_device *dev, |
| 3305 | struct iw_request_info *info, |
| 3306 | union iwreq_data *wrqu, char *extra) |
| 3307 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3308 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3309 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3310 | char *pLinkSpeed = (char*)extra; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3311 | int len = sizeof(v_U32_t) + 1; |
| 3312 | v_U32_t link_speed; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3313 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3314 | VOS_STATUS status; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3315 | int rc, valid = 0; |
| 3316 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3317 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3318 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3319 | if (NULL == pAdapter) |
| 3320 | { |
| 3321 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3322 | "%s: Adapter is NULL",__func__); |
| 3323 | return -EINVAL; |
| 3324 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3325 | |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3326 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3327 | valid = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3328 | if (0 != valid) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3329 | { |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3330 | return valid; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 3331 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 3332 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3333 | if (NULL == pHddStaCtx) |
| 3334 | { |
| 3335 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3336 | "%s: STA Context is NULL",__func__); |
| 3337 | return -EINVAL; |
| 3338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3339 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 3340 | { |
| 3341 | /* we are not connected so we don't have a classAstats */ |
| 3342 | link_speed = 0; |
| 3343 | } |
| 3344 | else |
| 3345 | { |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3346 | status = wlan_hdd_get_classAstats(pAdapter); |
| 3347 | |
| 3348 | if (!VOS_IS_STATUS_SUCCESS(status )) |
| 3349 | { |
| 3350 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Unable to retrieve SME statistics")); |
| 3351 | return -EINVAL; |
| 3352 | } |
| 3353 | |
| 3354 | /* Unit of link capacity is obtained from the TL API is MbpsX10 */ |
| 3355 | WLANTL_GetSTALinkCapacity(WLAN_HDD_GET_CTX(pAdapter)->pvosContext, |
| 3356 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], |
| 3357 | &link_speed); |
| 3358 | |
| 3359 | link_speed = link_speed / 10; |
| 3360 | |
| 3361 | if (0 == link_speed) |
| 3362 | { |
| 3363 | /* The linkspeed returned by HAL is in units of 500kbps. |
| 3364 | * converting it to mbps. |
| 3365 | * This is required to support legacy firmware which does |
| 3366 | * not return link capacity. |
| 3367 | */ |
| 3368 | link_speed = pAdapter->hdd_stats.ClassA_stat.tx_rate/2; |
| 3369 | } |
| 3370 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3371 | } |
| 3372 | |
| 3373 | wrqu->data.length = len; |
| 3374 | // return the linkspeed in the format required by the WiFi Framework |
Jeff Johnson | 0279779 | 2013-10-26 19:17:13 -0700 | [diff] [blame] | 3375 | rc = snprintf(pLinkSpeed, len, "%u", link_speed); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3376 | if ((rc < 0) || (rc >= len)) |
| 3377 | { |
| 3378 | // encoding or length error? |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 3379 | hddLog(VOS_TRACE_LEVEL_ERROR,FL("Unable to encode link speed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3380 | return -EIO; |
| 3381 | } |
| 3382 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3383 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3384 | /* a value is being successfully returned */ |
Arif Hussain | 24bfa70 | 2014-01-22 13:51:30 -0800 | [diff] [blame] | 3385 | return rc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3386 | } |
| 3387 | |
Arif Hussain | 695279c | 2014-03-24 14:06:07 -0700 | [diff] [blame] | 3388 | /* |
| 3389 | * Helper function to return correct value for WLAN_GET_LINK_SPEED |
| 3390 | * |
| 3391 | */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 3392 | static int __iw_get_linkspeed_priv(struct net_device *dev, |
Arif Hussain | 695279c | 2014-03-24 14:06:07 -0700 | [diff] [blame] | 3393 | struct iw_request_info *info, |
| 3394 | union iwreq_data *wrqu, char *extra) |
| 3395 | { |
| 3396 | int rc; |
| 3397 | |
| 3398 | rc = iw_get_linkspeed(dev, info, wrqu, extra); |
| 3399 | |
| 3400 | if (rc < 0) |
| 3401 | return rc; |
| 3402 | |
| 3403 | /* a value is being successfully returned */ |
| 3404 | return 0; |
| 3405 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3406 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 3407 | static int iw_get_linkspeed_priv(struct net_device *dev, |
| 3408 | struct iw_request_info *info, |
| 3409 | union iwreq_data *wrqu, char *extra) |
| 3410 | { |
| 3411 | int ret; |
| 3412 | |
| 3413 | vos_ssr_protect(__func__); |
| 3414 | ret = __iw_get_linkspeed_priv(dev, info, wrqu, extra); |
| 3415 | vos_ssr_unprotect(__func__); |
| 3416 | |
| 3417 | return ret; |
| 3418 | } |
| 3419 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3420 | /* |
SaidiReddy Yenuga | e265093 | 2016-08-30 15:34:43 +0530 | [diff] [blame] | 3421 | * Support for the RSSI & RSSI-APPROX private commands |
| 3422 | * Per the WiFi framework the response must be of the form |
| 3423 | * "<ssid> rssi <xx>" |
| 3424 | * unless we are not associated, in which case the response is |
| 3425 | * "OK" |
| 3426 | */ |
| 3427 | static int iw_get_rssi(struct net_device *dev, |
| 3428 | struct iw_request_info *info, |
| 3429 | union iwreq_data *wrqu, char *extra) |
| 3430 | { |
| 3431 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3432 | char *cmd = extra; |
| 3433 | int len = wrqu->data.length; |
| 3434 | v_S7_t s7Rssi = 0; |
| 3435 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3436 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
| 3437 | VOS_STATUS vosStatus; |
| 3438 | int rc; |
| 3439 | |
| 3440 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 3441 | (0 == ssidlen) || (ssidlen >= len)) |
| 3442 | { |
| 3443 | /* we are not connected or our SSID is too long |
| 3444 | so we cannot report an rssi */ |
| 3445 | rc = scnprintf(cmd, len, "OK"); |
| 3446 | } |
| 3447 | else |
| 3448 | { |
| 3449 | /* we are connected with a valid SSID |
| 3450 | so we can write the SSID into the return buffer |
| 3451 | (note that it is not NUL-terminated) */ |
| 3452 | memcpy(cmd, pHddStaCtx->conn_info.SSID.SSID.ssId, ssidlen ); |
| 3453 | |
Hanumanth Reddy Pothula | 01abc50 | 2016-08-30 15:34:43 +0530 | [diff] [blame] | 3454 | wlan_hdd_get_station_stats(pAdapter); |
SaidiReddy Yenuga | e265093 | 2016-08-30 15:34:43 +0530 | [diff] [blame] | 3455 | vosStatus = wlan_hdd_get_rssi(pAdapter, &s7Rssi); |
| 3456 | |
| 3457 | if (VOS_STATUS_SUCCESS == vosStatus) |
| 3458 | { |
| 3459 | /* append the rssi to the ssid in the format required by |
| 3460 | the WiFI Framework */ |
| 3461 | rc = scnprintf(&cmd[ssidlen], len - ssidlen, " rssi %d", s7Rssi); |
| 3462 | rc += ssidlen; |
| 3463 | } |
| 3464 | else |
| 3465 | { |
| 3466 | rc = -1; |
| 3467 | } |
| 3468 | } |
| 3469 | |
| 3470 | /* verify that we wrote a valid response */ |
| 3471 | if ((rc < 0) || (rc >= len)) |
| 3472 | { |
| 3473 | // encoding or length error? |
| 3474 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3475 | "%s: Unable to encode RSSI, got [%s]", |
| 3476 | __func__, cmd); |
| 3477 | return -EIO; |
| 3478 | } |
| 3479 | |
| 3480 | /* a value is being successfully returned */ |
| 3481 | return rc; |
| 3482 | } |
| 3483 | |
| 3484 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3485 | * Support for SoftAP channel range private command |
| 3486 | */ |
| 3487 | static int iw_softap_set_channel_range( struct net_device *dev, |
| 3488 | int startChannel, |
| 3489 | int endChannel, |
| 3490 | int band) |
| 3491 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3492 | VOS_STATUS status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3493 | int ret = 0; |
| 3494 | hdd_adapter_t *pHostapdAdapter = (netdev_priv(dev)); |
| 3495 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 3496 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
| 3497 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3498 | |
| 3499 | status = WLANSAP_SetChannelRange(hHal, startChannel, endChannel, band); |
| 3500 | if (VOS_STATUS_SUCCESS != status) |
| 3501 | { |
| 3502 | ret = -EINVAL; |
| 3503 | } |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 3504 | pHddCtx->is_dynamic_channel_range_set = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3505 | return ret; |
| 3506 | } |
| 3507 | |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 3508 | static uint8 chartohex(char c) |
| 3509 | { |
| 3510 | uint8 val = 0; |
| 3511 | if (c >= '0' && c <= '9') |
| 3512 | val = c - '0'; |
| 3513 | else if (c >= 'a' && c <= 'f') |
| 3514 | val = c - 'a' + 10; |
| 3515 | else if (c >= 'A' && c <= 'F') |
| 3516 | val = c - 'A' + 10; |
| 3517 | else |
| 3518 | hddLog(VOS_TRACE_LEVEL_ERROR, "Not a valid hex char"); |
| 3519 | |
| 3520 | return val; |
| 3521 | } |
| 3522 | |
| 3523 | uint8 getByte(char **buf) |
| 3524 | { |
| 3525 | uint8 byte = 0; |
| 3526 | char *temp = *buf; |
| 3527 | byte = chartohex(*temp) * 16; |
| 3528 | temp++; |
| 3529 | byte += chartohex(*temp); |
| 3530 | temp++; |
| 3531 | *buf = temp; |
| 3532 | return byte; |
| 3533 | } |
| 3534 | |
| 3535 | static void parse_Bufferforpkt(tSirpkt80211 *pkt, u8 *pBuffer, u16 len) |
| 3536 | { |
| 3537 | tSir80211Header *macHeader; |
| 3538 | int i = 0, j = 0, length = 0; |
| 3539 | uint8 byte = 0; |
| 3540 | char *temp = pBuffer; |
| 3541 | uint16 fragNum = 0; |
Srinivas Dasari | 2382de6 | 2015-01-22 15:00:04 +0530 | [diff] [blame] | 3542 | char *pHeader; |
| 3543 | tSir80211Header header; |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 3544 | |
| 3545 | macHeader = &pkt->macHeader; |
| 3546 | |
| 3547 | pkt->encParams.keyParams.key[0].keyId = *temp - '0'; |
| 3548 | |
| 3549 | temp++; |
| 3550 | |
| 3551 | hddLog(VOS_TRACE_LEVEL_ERROR, "Input Message to encrypt"); |
| 3552 | hddLog(VOS_TRACE_LEVEL_ERROR, "Key Id : %d", |
| 3553 | pkt->encParams.keyParams.key[0].keyId); |
| 3554 | |
| 3555 | for (i = 0; i< 16; i++) { |
| 3556 | pkt->encParams.keyParams.key[0].key[i] |
| 3557 | = getByte(&temp); |
| 3558 | } |
| 3559 | |
| 3560 | print_hex_dump(KERN_INFO, "Key : ", DUMP_PREFIX_NONE, 16, 1, |
| 3561 | &pkt->encParams.keyParams.key[0].key[0], 16, 0); |
| 3562 | |
| 3563 | for (i = 0; i< 6; i++) { |
| 3564 | pkt->encParams.pn[i] |
| 3565 | = getByte(&temp); |
| 3566 | } |
| 3567 | |
| 3568 | print_hex_dump(KERN_INFO, "PN : ", DUMP_PREFIX_NONE, 16, 1, |
| 3569 | &pkt->encParams.pn[0], 6, 0); |
| 3570 | |
| 3571 | for (i = 0, j= 5; i< 3; i++, j--) { |
| 3572 | byte = pkt->encParams.pn[i]; |
| 3573 | pkt->encParams.pn[i] = pkt->encParams.pn[j]; |
| 3574 | pkt->encParams.pn[j] = byte; |
| 3575 | } |
| 3576 | |
| 3577 | length = getByte(&temp); |
Hema Aparna Medicharla | 2db8331 | 2015-03-09 15:58:21 +0530 | [diff] [blame] | 3578 | if (length > sizeof(tSir80211Header)) |
| 3579 | length = sizeof(tSir80211Header); |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 3580 | |
Srinivas Dasari | 2382de6 | 2015-01-22 15:00:04 +0530 | [diff] [blame] | 3581 | pHeader = temp; |
| 3582 | vos_mem_zero(&header, sizeof(tSir80211Header)); |
| 3583 | for (i = 0; i < length; i++) { |
| 3584 | *((uint8 *)&header + i) = getByte(&pHeader); |
| 3585 | } |
| 3586 | |
| 3587 | print_hex_dump(KERN_INFO, "Header : ", DUMP_PREFIX_NONE, 16, 1, |
| 3588 | (char *)&header, length, 0); |
| 3589 | |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 3590 | byte = getByte(&temp); |
| 3591 | |
| 3592 | macHeader->frameCtrl.protVer = byte & 0x3; |
| 3593 | macHeader->frameCtrl.type = (byte >> 2) & 0x3; |
| 3594 | macHeader->frameCtrl.subType = (byte >> 4) & 0xF; |
| 3595 | |
| 3596 | byte = getByte(&temp); |
| 3597 | macHeader->frameCtrl.toDS = (byte) & 0x1; |
| 3598 | macHeader->frameCtrl.fromDS = (byte >> 1) & 0x1; |
| 3599 | macHeader->frameCtrl.moreFrag = (byte >> 2) & 0x1; |
| 3600 | macHeader->frameCtrl.retry = (byte >> 3) & 0x1; |
| 3601 | macHeader->frameCtrl.powerMgmt = (byte >> 4) & 0x1; |
| 3602 | macHeader->frameCtrl.moreData = (byte >> 5) & 0x1; |
| 3603 | macHeader->frameCtrl.wep = (byte >> 6) & 0x1; |
| 3604 | macHeader->frameCtrl.order = (byte >> 7) & 0x1; |
| 3605 | |
| 3606 | hddLog(VOS_TRACE_LEVEL_INFO, "macHeader->frameCtrl.protVer : %x " |
| 3607 | "macHeader->frameCtrl.type : %x " |
| 3608 | "macHeader->frameCtrl.subType : %x " |
| 3609 | "macHeader->frameCtrl.toDS : %x " |
| 3610 | "macHeader->frameCtrl.fromDS : %x " |
| 3611 | "macHeader->frameCtrl.moreFrag : %x " |
| 3612 | "macHeader->frameCtrl.retry : %x " |
| 3613 | "macHeader->frameCtrl.powerMgmt : %x " |
| 3614 | "macHeader->frameCtrl.MoreData : %x " |
| 3615 | "macHeader->frameCtrl.wep : %x " |
| 3616 | "macHeader->frameCtrl.order : %x " |
| 3617 | , macHeader->frameCtrl.protVer |
| 3618 | , macHeader->frameCtrl.type |
| 3619 | , macHeader->frameCtrl.subType |
| 3620 | , macHeader->frameCtrl.toDS |
| 3621 | , macHeader->frameCtrl.fromDS |
| 3622 | , macHeader->frameCtrl.moreFrag |
| 3623 | , macHeader->frameCtrl.retry |
| 3624 | , macHeader->frameCtrl.powerMgmt |
| 3625 | , macHeader->frameCtrl.moreData |
| 3626 | , macHeader->frameCtrl.wep |
| 3627 | , macHeader->frameCtrl.order); |
| 3628 | |
| 3629 | |
| 3630 | macHeader->usDurationId = getByte(&temp); |
| 3631 | macHeader->usDurationId += getByte(&temp) << 8; |
| 3632 | |
| 3633 | macHeader->vA1[0] = getByte(&temp); |
| 3634 | macHeader->vA1[1] = getByte(&temp); |
| 3635 | macHeader->vA1[2] = getByte(&temp); |
| 3636 | macHeader->vA1[3] = getByte(&temp); |
| 3637 | macHeader->vA1[4] = getByte(&temp); |
| 3638 | macHeader->vA1[5] = getByte(&temp); |
| 3639 | |
| 3640 | macHeader->vA2[0] = getByte(&temp); |
| 3641 | macHeader->vA2[1] = getByte(&temp); |
| 3642 | macHeader->vA2[2] = getByte(&temp); |
| 3643 | macHeader->vA2[3] = getByte(&temp); |
| 3644 | macHeader->vA2[4] = getByte(&temp); |
| 3645 | macHeader->vA2[5] = getByte(&temp); |
| 3646 | |
| 3647 | macHeader->vA3[0] = getByte(&temp); |
| 3648 | macHeader->vA3[1] = getByte(&temp); |
| 3649 | macHeader->vA3[2] = getByte(&temp); |
| 3650 | macHeader->vA3[3] = getByte(&temp); |
| 3651 | macHeader->vA3[4] = getByte(&temp); |
| 3652 | macHeader->vA3[5] = getByte(&temp); |
| 3653 | |
| 3654 | macHeader->sSeqCtrl = getByte(&temp); |
| 3655 | fragNum = macHeader->sSeqCtrl & 0xF; |
| 3656 | macHeader->sSeqCtrl >>= 4; |
| 3657 | |
| 3658 | macHeader->sSeqCtrl += getByte(&temp) << 4; |
| 3659 | |
| 3660 | macHeader->sSeqCtrl |= fragNum << 12; |
| 3661 | |
| 3662 | if (length == 30 || length == 32) { |
| 3663 | macHeader->optvA4[0] = getByte(&temp); |
| 3664 | macHeader->optvA4[1] = getByte(&temp); |
| 3665 | macHeader->optvA4[2] = getByte(&temp); |
| 3666 | macHeader->optvA4[3] = getByte(&temp); |
| 3667 | macHeader->optvA4[4] = getByte(&temp); |
| 3668 | macHeader->optvA4[5] = getByte(&temp); |
| 3669 | } |
| 3670 | |
| 3671 | if (length == 26 || length == 32) { |
| 3672 | macHeader->usQosCtrl = getByte(&temp); |
| 3673 | macHeader->usQosCtrl += getByte(&temp) << 8; |
| 3674 | } |
| 3675 | |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 3676 | //parse payload |
| 3677 | length = getByte(&temp); |
| 3678 | length += getByte(&temp) << 8; |
| 3679 | hddLog(VOS_TRACE_LEVEL_INFO,"Payload length : %d", length); |
| 3680 | |
Manjeet Singh | 5830f14 | 2016-11-21 18:21:17 +0530 | [diff] [blame] | 3681 | if (length >= WLAN_DISA_MAX_PAYLOAD_SIZE) |
| 3682 | length = WLAN_DISA_MAX_PAYLOAD_SIZE; |
| 3683 | |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 3684 | pkt->data.length = length; |
| 3685 | |
| 3686 | for (i = 0; i< length; i++) { |
| 3687 | pkt->data.data[i] = getByte(&temp); |
| 3688 | } |
| 3689 | |
| 3690 | print_hex_dump(KERN_INFO, "Data : ", DUMP_PREFIX_NONE, 16, 1, |
| 3691 | &pkt->data.data[0], pkt->data.length, 0); |
| 3692 | } |
| 3693 | |
| 3694 | /**--------------------------------------------------------------------------- |
| 3695 | |
| 3696 | \brief hdd_encrypt_msg_cb() - Callback function for DISA |
| 3697 | encrypt message request |
| 3698 | This is an asynchronous callback function from SME when the encrypted data |
| 3699 | is received |
| 3700 | |
| 3701 | \pEncInfoRsp -> Encrypted data info |
| 3702 | |
| 3703 | \return - 0 for success non-zero for failure |
| 3704 | --------------------------------------------------------------------------*/ |
| 3705 | static void |
| 3706 | hdd_encrypt_msg_cb(v_VOID_t *pUserData, v_VOID_t *pEncInfoRsp) |
| 3707 | { |
| 3708 | tpSetEncryptedDataRspParams pEncryptedDataRsp; |
| 3709 | |
| 3710 | pEncryptedDataRsp = (tpSetEncryptedDataRspParams)pEncInfoRsp; |
| 3711 | |
| 3712 | hddLog(VOS_TRACE_LEVEL_ERROR, "Encrypted Message"); |
| 3713 | hddLog(VOS_TRACE_LEVEL_ERROR, "Length : %d", |
| 3714 | pEncryptedDataRsp->encryptedPayload.length); |
| 3715 | hddLog(VOS_TRACE_LEVEL_ERROR, " Encrypted Data: "); |
| 3716 | print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, |
| 3717 | pEncryptedDataRsp->encryptedPayload.data, |
| 3718 | pEncryptedDataRsp->encryptedPayload.length, 0); |
| 3719 | } |
| 3720 | |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 3721 | /** |
| 3722 | * iw_power_callback_func() - Callback function registered with PMC |
| 3723 | * @context: cookie originally registered with PMC |
| 3724 | * @status: status code indicated by PMC state machine |
| 3725 | * |
| 3726 | * Return: None |
| 3727 | */ |
| 3728 | static void iw_power_callback_func(void *context, eHalStatus status) |
| 3729 | { |
| 3730 | struct hdd_request *request = hdd_request_get(context); |
| 3731 | |
| 3732 | if (!request) { |
| 3733 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3734 | "%s: Obsolete request", __func__); |
| 3735 | return; |
| 3736 | } |
| 3737 | |
| 3738 | hdd_request_complete(request); |
| 3739 | hdd_request_put(request); |
| 3740 | } |
| 3741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3742 | VOS_STATUS wlan_hdd_enter_bmps(hdd_adapter_t *pAdapter, int mode) |
| 3743 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3744 | eHalStatus status; |
| 3745 | hdd_context_t *pHddCtx; |
Ganesh Kondabattini | ea07578 | 2015-09-23 19:13:56 +0530 | [diff] [blame] | 3746 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Hanumanth Reddy Pothula | 731ebf7 | 2018-04-06 14:34:49 +0530 | [diff] [blame] | 3747 | int ret; |
| 3748 | void *cookie; |
| 3749 | struct hdd_request *request; |
| 3750 | static const struct hdd_request_params params = { |
| 3751 | .priv_size = 0, |
| 3752 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 3753 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3754 | |
| 3755 | if (NULL == pAdapter) |
| 3756 | { |
| 3757 | hddLog(VOS_TRACE_LEVEL_FATAL, "Adapter NULL"); |
| 3758 | return VOS_STATUS_E_FAULT; |
| 3759 | } |
| 3760 | |
| 3761 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "power mode=%d", mode); |
| 3762 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 6cd329b | 2014-03-19 20:39:13 +0530 | [diff] [blame] | 3763 | if (pHddCtx->isLogpInProgress) { |
| 3764 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3765 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 3766 | return VOS_STATUS_E_FAILURE; |
| 3767 | } |
| 3768 | |
Hanumanth Reddy Pothula | 731ebf7 | 2018-04-06 14:34:49 +0530 | [diff] [blame] | 3769 | request = hdd_request_alloc(¶ms); |
| 3770 | if (!request) { |
| 3771 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 3772 | return VOS_STATUS_E_NOMEM; |
| 3773 | } |
| 3774 | cookie = hdd_request_cookie(request); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3775 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3776 | |
| 3777 | if (DRIVER_POWER_MODE_ACTIVE == mode) |
| 3778 | { |
| 3779 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering " |
| 3780 | "Full Power", __func__); |
| 3781 | status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumanth Reddy Pothula | 731ebf7 | 2018-04-06 14:34:49 +0530 | [diff] [blame] | 3782 | iw_power_callback_func, cookie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3783 | eSME_FULL_PWR_NEEDED_BY_HDD); |
| 3784 | // Enter Full power command received from GUI this means we are disconnected |
| 3785 | // Set PMC remainInPowerActiveTillDHCP flag to disable auto BMPS entry by PMC |
| 3786 | sme_SetDHCPTillPowerActiveFlag(pHddCtx->hHal, TRUE); |
| 3787 | if (eHAL_STATUS_PMC_PENDING == status) |
| 3788 | { |
Hanumanth Reddy Pothula | 731ebf7 | 2018-04-06 14:34:49 +0530 | [diff] [blame] | 3789 | ret = hdd_request_wait_for_response(request); |
| 3790 | if (ret) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3791 | { |
Hanumanth Reddy Pothula | 731ebf7 | 2018-04-06 14:34:49 +0530 | [diff] [blame] | 3792 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3793 | FL("SME timeout while requesting fullpower")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3794 | } |
| 3795 | } |
| 3796 | } |
| 3797 | else if (DRIVER_POWER_MODE_AUTO == mode) |
| 3798 | { |
Abhishek Singh | 69c97a2 | 2015-10-23 15:42:45 +0530 | [diff] [blame] | 3799 | /* If this is called by hdd_suspend_wlan or hdd_resume_wlan, driver |
| 3800 | * was already in BMPS state and thus either STA or P2P-CLI is in |
| 3801 | * associated state and authenticated, so even if STA connState is |
| 3802 | * not associated it can be assumed that P2P-CLI is associated and |
| 3803 | * authenticated. Thus driver can enter BMPS. And even if we try to enter |
| 3804 | * BMPS with no adaptor in associated state, pmcRequestBmps will check |
| 3805 | * if all condition are satisfied for entering BMPS. |
| 3806 | */ |
| 3807 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 3808 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Ganesh Kondabattini | ea07578 | 2015-09-23 19:13:56 +0530 | [diff] [blame] | 3809 | { |
Abhishek Singh | 69c97a2 | 2015-10-23 15:42:45 +0530 | [diff] [blame] | 3810 | hddLog(LOGE, |
| 3811 | FL("Station is associated but, still not Authenticated ignore " |
| 3812 | "power save mode")); |
Ganesh Kondabattini | ea07578 | 2015-09-23 19:13:56 +0530 | [diff] [blame] | 3813 | return VOS_STATUS_E_AGAIN; |
| 3814 | } |
| 3815 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3816 | if (pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 3817 | { |
| 3818 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering Bmps ", |
| 3819 | __func__); |
| 3820 | // Enter BMPS command received from GUI this means DHCP is completed |
| 3821 | // Clear PMC remainInPowerActiveTillDHCP flag to enable auto BMPS entry |
| 3822 | sme_SetDHCPTillPowerActiveFlag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3823 | FALSE); |
| 3824 | status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumanth Reddy Pothula | 731ebf7 | 2018-04-06 14:34:49 +0530 | [diff] [blame] | 3825 | iw_power_callback_func, cookie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3826 | if (eHAL_STATUS_PMC_PENDING == status) |
| 3827 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3828 | /* request was sent -- wait for the response */ |
Hanumanth Reddy Pothula | 731ebf7 | 2018-04-06 14:34:49 +0530 | [diff] [blame] | 3829 | ret = hdd_request_wait_for_response(request); |
| 3830 | if (ret) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3831 | { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3832 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Hanumanth Reddy Pothula | 731ebf7 | 2018-04-06 14:34:49 +0530 | [diff] [blame] | 3833 | FL("SME timeout while requesting bmps")); |
| 3834 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3835 | } |
| 3836 | } |
| 3837 | else |
| 3838 | { |
| 3839 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "BMPS is not " |
| 3840 | "enabled in the cfg"); |
| 3841 | } |
| 3842 | } |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3843 | |
Hanumanth Reddy Pothula | 731ebf7 | 2018-04-06 14:34:49 +0530 | [diff] [blame] | 3844 | /* |
| 3845 | * either we never sent a request, we sent a request and received a |
| 3846 | * response or we sent a request and timed out. Regardless we are |
| 3847 | * done with the request. |
| 3848 | */ |
| 3849 | hdd_request_put(request); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 3850 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3851 | return VOS_STATUS_SUCCESS; |
| 3852 | } |
| 3853 | |
| 3854 | VOS_STATUS wlan_hdd_exit_lowpower(hdd_context_t *pHddCtx, |
| 3855 | hdd_adapter_t *pAdapter) |
| 3856 | { |
| 3857 | VOS_STATUS vos_Status; |
| 3858 | |
| 3859 | if ((NULL == pAdapter) || (NULL == pHddCtx)) |
| 3860 | { |
| 3861 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid pointer"); |
| 3862 | return VOS_STATUS_E_FAULT; |
| 3863 | } |
| 3864 | |
| 3865 | /**Exit from Deep sleep or standby if we get the driver |
| 3866 | START cmd from android GUI |
| 3867 | */ |
| 3868 | if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop) |
| 3869 | { |
| 3870 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit " |
| 3871 | "from Stand by",__func__); |
| 3872 | vos_Status = hdd_exit_standby(pHddCtx); |
| 3873 | } |
| 3874 | else if (eHDD_SUSPEND_DEEP_SLEEP == pHddCtx->hdd_ps_state) |
| 3875 | { |
| 3876 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: WLAN being exit " |
| 3877 | "from deep sleep",__func__); |
| 3878 | vos_Status = hdd_exit_deep_sleep(pHddCtx, pAdapter); |
| 3879 | } |
| 3880 | else |
| 3881 | { |
| 3882 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Not in standby or deep sleep. " |
| 3883 | "Ignore start cmd %d", __func__, pHddCtx->hdd_ps_state); |
| 3884 | vos_Status = VOS_STATUS_SUCCESS; |
| 3885 | } |
| 3886 | |
| 3887 | return vos_Status; |
| 3888 | } |
| 3889 | |
| 3890 | VOS_STATUS wlan_hdd_enter_lowpower(hdd_context_t *pHddCtx) |
| 3891 | { |
| 3892 | VOS_STATUS vos_Status = VOS_STATUS_E_FAILURE; |
| 3893 | |
| 3894 | if (NULL == pHddCtx) |
| 3895 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 3896 | hddLog(VOS_TRACE_LEVEL_ERROR, "HDD context NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3897 | return VOS_STATUS_E_FAULT; |
| 3898 | } |
| 3899 | |
| 3900 | if (WLAN_MAP_DRIVER_STOP_TO_STANDBY == pHddCtx->cfg_ini->nEnableDriverStop) |
| 3901 | { |
| 3902 | //Execute standby procedure. |
| 3903 | //Executing standby procedure will cause the STA to |
| 3904 | //disassociate first and then the chip will be put into standby. |
| 3905 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering Stand by mode"); |
| 3906 | vos_Status = hdd_enter_standby(pHddCtx); |
| 3907 | } |
| 3908 | else if (WLAN_MAP_DRIVER_STOP_TO_DEEP_SLEEP == |
| 3909 | pHddCtx->cfg_ini->nEnableDriverStop) |
| 3910 | { |
| 3911 | //Execute deep sleep procedure |
| 3912 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Wlan driver entering " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 3913 | "deep sleep mode"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3914 | //Deep sleep not supported |
| 3915 | vos_Status = hdd_enter_standby(pHddCtx); |
| 3916 | } |
| 3917 | else |
| 3918 | { |
| 3919 | hddLog(VOS_TRACE_LEVEL_INFO_LOW, "%s: Driver stop is not enabled %d", |
| 3920 | __func__, pHddCtx->cfg_ini->nEnableDriverStop); |
| 3921 | vos_Status = VOS_STATUS_SUCCESS; |
| 3922 | } |
| 3923 | |
| 3924 | return vos_Status; |
| 3925 | } |
| 3926 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3927 | |
| 3928 | void* wlan_hdd_change_country_code_callback(void *pAdapter) |
| 3929 | { |
| 3930 | |
| 3931 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3932 | complete(&call_back_pAdapter->change_country_code); |
| 3933 | |
| 3934 | return NULL; |
| 3935 | } |
| 3936 | |
SaidiReddy Yenuga | e265093 | 2016-08-30 15:34:43 +0530 | [diff] [blame] | 3937 | static int __iw_set_priv(struct net_device *dev, |
| 3938 | struct iw_request_info *info, |
| 3939 | union iwreq_data *wrqu, char *extra) |
| 3940 | { |
| 3941 | hdd_adapter_t *pAdapter; |
| 3942 | char *cmd = NULL; |
| 3943 | int cmd_len = wrqu->data.length; |
| 3944 | int rc = 0, ret = 0; |
| 3945 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 3946 | |
| 3947 | hdd_context_t *pHddCtx; |
| 3948 | |
| 3949 | ENTER(); |
| 3950 | |
| 3951 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3952 | if (NULL == pAdapter) |
| 3953 | { |
| 3954 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3955 | "mem_alloc_copy_from_user_helper fail"); |
| 3956 | return -EINVAL; |
| 3957 | } |
| 3958 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 3959 | rc = wlan_hdd_validate_context(pHddCtx); |
| 3960 | if (0 != rc) |
| 3961 | { |
| 3962 | return rc; |
| 3963 | } |
| 3964 | |
| 3965 | cmd = mem_alloc_copy_from_user_helper(wrqu->data.pointer, |
| 3966 | wrqu->data.length); |
| 3967 | if (NULL == cmd) |
| 3968 | { |
| 3969 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3970 | "mem_alloc_copy_from_user_helper fail"); |
| 3971 | return -ENOMEM; |
| 3972 | } |
| 3973 | |
| 3974 | if (ioctl_debug) |
| 3975 | { |
| 3976 | pr_info("%s: req [%s] len [%d]\n", __func__, cmd, cmd_len); |
| 3977 | } |
| 3978 | |
| 3979 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 3980 | "%s: ***Received %s cmd from Wi-Fi GUI***", __func__, cmd); |
| 3981 | |
| 3982 | if (strncmp(cmd, "CSCAN", 5) == 0 ) |
| 3983 | { |
| 3984 | if (eHAL_STATUS_SUCCESS != iw_set_cscan(dev, info, wrqu, cmd)) { |
| 3985 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3986 | "%s: Error in iw_set_scan!", __func__); |
| 3987 | rc = -EINVAL; |
| 3988 | } |
| 3989 | } |
| 3990 | else if( strcasecmp(cmd, "start") == 0 ) { |
| 3991 | |
| 3992 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Start command"); |
| 3993 | /*Exit from Deep sleep or standby if we get the driver START cmd from android GUI*/ |
| 3994 | |
| 3995 | vos_status = wlan_hdd_exit_lowpower(pHddCtx, pAdapter); |
| 3996 | if (vos_status == VOS_STATUS_SUCCESS) |
| 3997 | { |
| 3998 | union iwreq_data wrqu; |
| 3999 | char buf[10]; |
| 4000 | |
| 4001 | memset(&wrqu, 0, sizeof(wrqu)); |
| 4002 | wrqu.data.length = strlcpy(buf, "START", sizeof(buf)); |
| 4003 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4004 | } |
| 4005 | else |
| 4006 | { |
| 4007 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: START CMD Status %d", __func__, vos_status); |
| 4008 | rc = -EIO; |
| 4009 | } |
| 4010 | goto done; |
| 4011 | } |
| 4012 | else if( strcasecmp(cmd, "stop") == 0 ) |
| 4013 | { |
| 4014 | union iwreq_data wrqu; |
| 4015 | char buf[10]; |
| 4016 | |
| 4017 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "Stop command"); |
| 4018 | |
| 4019 | wlan_hdd_enter_lowpower(pHddCtx); |
| 4020 | memset(&wrqu, 0, sizeof(wrqu)); |
| 4021 | wrqu.data.length = strlcpy(buf, "STOP", sizeof(buf)); |
| 4022 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4023 | goto done; |
| 4024 | } |
| 4025 | else if (strcasecmp(cmd, "macaddr") == 0) |
| 4026 | { |
| 4027 | ret = snprintf(cmd, cmd_len, "Macaddr = " MAC_ADDRESS_STR, |
| 4028 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes)); |
| 4029 | } |
| 4030 | else if (strcasecmp(cmd, "scan-active") == 0) |
| 4031 | { |
| 4032 | hddLog(LOG1, |
| 4033 | FL("making default scan to active")); |
| 4034 | pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
| 4035 | ret = snprintf(cmd, cmd_len, "OK"); |
| 4036 | } |
| 4037 | else if (strcasecmp(cmd, "scan-passive") == 0) |
| 4038 | { |
| 4039 | hddLog(LOG1, |
| 4040 | FL("making default scan to passive")); |
| 4041 | pHddCtx->scan_info.scan_mode = eSIR_PASSIVE_SCAN; |
| 4042 | ret = snprintf(cmd, cmd_len, "OK"); |
| 4043 | } |
| 4044 | else if( strcasecmp(cmd, "scan-mode") == 0 ) |
| 4045 | { |
| 4046 | ret = snprintf(cmd, cmd_len, "ScanMode = %u", pHddCtx->scan_info.scan_mode); |
| 4047 | } |
| 4048 | else if( strcasecmp(cmd, "linkspeed") == 0 ) |
| 4049 | { |
| 4050 | ret = iw_get_linkspeed(dev, info, wrqu, cmd); |
| 4051 | } |
| 4052 | else if( strncasecmp(cmd, "rssi", 4) == 0 ) |
| 4053 | { |
| 4054 | ret = iw_get_rssi(dev, info, wrqu, cmd); |
| 4055 | } |
| 4056 | else if( strncasecmp(cmd, "powermode", 9) == 0 ) { |
| 4057 | int mode; |
| 4058 | char *ptr; |
| 4059 | |
| 4060 | if (9 < cmd_len) |
| 4061 | { |
| 4062 | ptr = (char*)(cmd + 9); |
| 4063 | |
| 4064 | }else{ |
| 4065 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4066 | "CMD LENGTH %d is not correct",cmd_len); |
| 4067 | kfree(cmd); |
| 4068 | return -EINVAL; |
| 4069 | } |
| 4070 | |
| 4071 | if (1 != sscanf(ptr,"%d",&mode)) |
| 4072 | { |
| 4073 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4074 | "powermode input %s is not correct",ptr); |
| 4075 | kfree(cmd); |
| 4076 | return -EIO; |
| 4077 | } |
| 4078 | |
| 4079 | wlan_hdd_enter_bmps(pAdapter, mode); |
| 4080 | /*TODO:Set the power mode*/ |
| 4081 | } |
| 4082 | else if (strncasecmp(cmd, "getpower", 8) == 0 ) { |
| 4083 | v_U32_t pmc_state; |
| 4084 | v_U16_t value; |
| 4085 | |
| 4086 | pmc_state = pmcGetPmcState(WLAN_HDD_GET_HAL_CTX(pAdapter)); |
| 4087 | if(pmc_state == BMPS) { |
| 4088 | value = DRIVER_POWER_MODE_AUTO; |
| 4089 | } |
| 4090 | else { |
| 4091 | value = DRIVER_POWER_MODE_ACTIVE; |
| 4092 | } |
| 4093 | ret = snprintf(cmd, cmd_len, "powermode = %u", value); |
| 4094 | } |
| 4095 | else if( strncasecmp(cmd, "btcoexmode", 10) == 0 ) { |
| 4096 | hddLog( VOS_TRACE_LEVEL_INFO, "btcoexmode"); |
| 4097 | /*TODO: set the btcoexmode*/ |
| 4098 | } |
| 4099 | else if( strcasecmp(cmd, "btcoexstat") == 0 ) { |
| 4100 | |
| 4101 | hddLog(VOS_TRACE_LEVEL_INFO, "BtCoex Status"); |
| 4102 | /*TODO: Return the btcoex status*/ |
| 4103 | } |
| 4104 | else if( strcasecmp(cmd, "rxfilter-start") == 0 ) { |
| 4105 | |
| 4106 | hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Start command"); |
| 4107 | |
| 4108 | /*TODO: Enable Rx data Filter*/ |
| 4109 | } |
| 4110 | else if( strcasecmp(cmd, "rxfilter-stop") == 0 ) { |
| 4111 | |
| 4112 | hddLog(VOS_TRACE_LEVEL_INFO, "Rx Data Filter Stop command"); |
| 4113 | |
| 4114 | /*TODO: Disable Rx data Filter*/ |
| 4115 | } |
| 4116 | else if( strcasecmp(cmd, "rxfilter-statistics") == 0 ) { |
| 4117 | |
| 4118 | hddLog( VOS_TRACE_LEVEL_INFO, "Rx Data Filter Statistics command"); |
| 4119 | /*TODO: rxfilter-statistics*/ |
| 4120 | } |
| 4121 | else if( strncasecmp(cmd, "rxfilter-add", 12) == 0 ) { |
| 4122 | |
| 4123 | hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-add"); |
| 4124 | /*TODO: rxfilter-add*/ |
| 4125 | } |
| 4126 | else if( strncasecmp(cmd, "rxfilter-remove",15) == 0 ) { |
| 4127 | |
| 4128 | hddLog( VOS_TRACE_LEVEL_INFO, "rxfilter-remove"); |
| 4129 | /*TODO: rxfilter-remove*/ |
| 4130 | } |
| 4131 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 4132 | else if( strncasecmp(cmd, "pnosetup", 8) == 0 ) { |
| 4133 | hddLog( VOS_TRACE_LEVEL_INFO, "pnosetup"); |
| 4134 | /*TODO: support pnosetup*/ |
| 4135 | } |
| 4136 | else if( strncasecmp(cmd, "pnoforce", 8) == 0 ) { |
| 4137 | hddLog( VOS_TRACE_LEVEL_INFO, "pnoforce"); |
| 4138 | /*TODO: support pnoforce*/ |
| 4139 | } |
SaidiReddy Yenuga | e265093 | 2016-08-30 15:34:43 +0530 | [diff] [blame] | 4140 | else if( strncasecmp(cmd, "rssifilter",10) == 0 ) { |
| 4141 | hddLog( VOS_TRACE_LEVEL_INFO, "rssifilter"); |
| 4142 | vos_status = iw_set_rssi_filter(dev, info, wrqu, cmd, 10); |
| 4143 | kfree(cmd); |
| 4144 | return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL; |
| 4145 | } |
| 4146 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 4147 | else if( strncasecmp(cmd, "powerparams",11) == 0 ) { |
| 4148 | hddLog( VOS_TRACE_LEVEL_INFO, "powerparams"); |
| 4149 | vos_status = iw_set_power_params(dev, info, wrqu, cmd, 11); |
| 4150 | kfree(cmd); |
| 4151 | return (vos_status == VOS_STATUS_SUCCESS) ? 0 : -EINVAL; |
| 4152 | } |
| 4153 | else if( 0 == strncasecmp(cmd, "CONFIG-TX-TRACKING", 18) ) { |
| 4154 | tSirTxPerTrackingParam tTxPerTrackingParam; |
| 4155 | char *ptr; |
| 4156 | |
| 4157 | if (18 < cmd_len) |
| 4158 | { |
| 4159 | ptr = (char*)(cmd + 18); |
| 4160 | }else{ |
| 4161 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4162 | "CMD LENGTH %d is not correct",cmd_len); |
| 4163 | kfree(cmd); |
| 4164 | return -EINVAL; |
| 4165 | } |
| 4166 | |
| 4167 | if (4 != sscanf(ptr,"%hhu %hhu %hhu %u", |
| 4168 | &(tTxPerTrackingParam.ucTxPerTrackingEnable), |
| 4169 | &(tTxPerTrackingParam.ucTxPerTrackingPeriod), |
| 4170 | &(tTxPerTrackingParam.ucTxPerTrackingRatio), |
| 4171 | &(tTxPerTrackingParam.uTxPerTrackingWatermark))) |
| 4172 | { |
| 4173 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4174 | "CONFIG-TX-TRACKING %s input is not correct",ptr); |
| 4175 | kfree(cmd); |
| 4176 | return -EIO; |
| 4177 | } |
| 4178 | |
| 4179 | // parameters checking |
| 4180 | // period has to be larger than 0 |
| 4181 | if (0 == tTxPerTrackingParam.ucTxPerTrackingPeriod) |
| 4182 | { |
| 4183 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Period input is not correct"); |
| 4184 | kfree(cmd); |
| 4185 | return -EIO; |
| 4186 | } |
| 4187 | |
| 4188 | // use default value 5 is the input is not reasonable. in unit of 10% |
| 4189 | if ((tTxPerTrackingParam.ucTxPerTrackingRatio > TX_PER_TRACKING_MAX_RATIO) || (0 == tTxPerTrackingParam.ucTxPerTrackingRatio)) |
| 4190 | { |
| 4191 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Ratio input is not good. use default 5"); |
| 4192 | tTxPerTrackingParam.ucTxPerTrackingRatio = TX_PER_TRACKING_DEFAULT_RATIO; |
| 4193 | } |
| 4194 | |
| 4195 | // default is 5 |
| 4196 | if (0 == tTxPerTrackingParam.uTxPerTrackingWatermark) |
| 4197 | { |
| 4198 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Tx Packet number input is not good. use default 5"); |
| 4199 | tTxPerTrackingParam.uTxPerTrackingWatermark = TX_PER_TRACKING_DEFAULT_WATERMARK; |
| 4200 | } |
| 4201 | |
| 4202 | if (eHAL_STATUS_SUCCESS != |
| 4203 | sme_SetTxPerTracking(pHddCtx->hHal, |
| 4204 | hdd_tx_per_hit_cb, |
| 4205 | (void*)pAdapter, &tTxPerTrackingParam)) { |
| 4206 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "Set Tx PER Tracking Failed!"); |
| 4207 | rc = -EIO; |
| 4208 | } |
| 4209 | } |
| 4210 | else { |
| 4211 | hddLog( VOS_TRACE_LEVEL_WARN, "%s: Unsupported GUI command %s", |
| 4212 | __func__, cmd); |
| 4213 | } |
| 4214 | done: |
| 4215 | /* many of the commands write information back into the command |
| 4216 | string using snprintf(). check the return value here in one |
| 4217 | place */ |
| 4218 | if ((ret < 0) || (ret >= cmd_len)) |
| 4219 | { |
| 4220 | /* there was an encoding error or overflow */ |
| 4221 | rc = -EINVAL; |
| 4222 | } |
| 4223 | else if (ret > 0) |
| 4224 | { |
| 4225 | if (copy_to_user(wrqu->data.pointer, cmd, ret)) |
| 4226 | { |
| 4227 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4228 | "%s: failed to copy data to user buffer", __func__); |
| 4229 | kfree(cmd); |
| 4230 | return -EFAULT; |
| 4231 | } |
| 4232 | wrqu->data.length = ret; |
| 4233 | } |
| 4234 | |
| 4235 | if (ioctl_debug) |
| 4236 | { |
| 4237 | pr_info("%s: rsp [%s] len [%d] status %d\n", |
| 4238 | __func__, cmd, wrqu->data.length, rc); |
| 4239 | } |
| 4240 | kfree(cmd); |
| 4241 | EXIT(); |
| 4242 | return rc; |
| 4243 | } |
| 4244 | |
| 4245 | static int iw_set_priv(struct net_device *dev, |
| 4246 | struct iw_request_info *info, |
| 4247 | union iwreq_data *wrqu, char *extra) |
| 4248 | { |
| 4249 | int ret; |
| 4250 | vos_ssr_protect(__func__); |
| 4251 | ret = __iw_set_priv(dev, info, wrqu, extra); |
| 4252 | vos_ssr_unprotect(__func__); |
| 4253 | |
| 4254 | return ret; |
| 4255 | } |
| 4256 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4257 | static int __iw_set_nick(struct net_device *dev, |
| 4258 | struct iw_request_info *info, |
| 4259 | union iwreq_data *wrqu, char *extra) |
| 4260 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4261 | hdd_adapter_t *pAdapter; |
| 4262 | hdd_context_t *pHddCtx; |
| 4263 | int ret = 0; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4264 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4265 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4266 | |
| 4267 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4268 | if (NULL == pAdapter) |
| 4269 | { |
| 4270 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4271 | "%s: Adapter is NULL",__func__); |
| 4272 | return -EINVAL; |
| 4273 | } |
| 4274 | |
| 4275 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4276 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4277 | if (0 != ret) |
| 4278 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4279 | return ret; |
| 4280 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4281 | EXIT(); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4282 | return 0; |
| 4283 | } |
| 4284 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4285 | static int iw_set_nick(struct net_device *dev, |
| 4286 | struct iw_request_info *info, |
| 4287 | union iwreq_data *wrqu, char *extra) |
| 4288 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4289 | int ret; |
| 4290 | |
| 4291 | vos_ssr_protect(__func__); |
| 4292 | ret = __iw_set_nick(dev, info, wrqu, extra); |
| 4293 | vos_ssr_unprotect(__func__); |
| 4294 | |
| 4295 | return ret; |
| 4296 | } |
| 4297 | |
| 4298 | static int __iw_get_nick(struct net_device *dev, |
| 4299 | struct iw_request_info *info, |
| 4300 | union iwreq_data *wrqu, char *extra) |
| 4301 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4302 | hdd_adapter_t *pAdapter; |
| 4303 | hdd_context_t *pHddCtx; |
| 4304 | int ret = 0; |
| 4305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4306 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4307 | |
| 4308 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4309 | if (NULL == pAdapter) |
| 4310 | { |
| 4311 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4312 | "%s: Adapter is NULL",__func__); |
| 4313 | return -EINVAL; |
| 4314 | } |
| 4315 | |
| 4316 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4317 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4318 | if (0 != ret) |
| 4319 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4320 | return ret; |
| 4321 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4322 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4323 | return 0; |
| 4324 | } |
| 4325 | |
| 4326 | static int iw_get_nick(struct net_device *dev, |
| 4327 | struct iw_request_info *info, |
| 4328 | union iwreq_data *wrqu, char *extra) |
| 4329 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4330 | int ret; |
| 4331 | |
| 4332 | vos_ssr_protect(__func__); |
| 4333 | ret = __iw_get_nick(dev, info, wrqu, extra); |
| 4334 | vos_ssr_unprotect(__func__); |
| 4335 | |
| 4336 | return ret; |
| 4337 | } |
| 4338 | |
Hanumantha Reddy Pothula | 55de0ea | 2015-10-19 16:50:53 +0530 | [diff] [blame] | 4339 | /* cat /proc/net/wireless invokes this function to get wireless stats */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4340 | static struct iw_statistics * __get_wireless_stats(struct net_device *dev) |
| 4341 | { |
Hanumantha Reddy Pothula | 55de0ea | 2015-10-19 16:50:53 +0530 | [diff] [blame] | 4342 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4343 | hdd_context_t *pHddCtx; |
| 4344 | hdd_station_ctx_t *pHddStaCtx; |
| 4345 | v_S7_t snr = 0, rssi = 0; |
| 4346 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4347 | |
| 4348 | ENTER(); |
| 4349 | |
| 4350 | if (NULL == pAdapter) |
| 4351 | { |
| 4352 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4353 | "%s: Adapter is NULL",__func__); |
| 4354 | return NULL; |
| 4355 | } |
| 4356 | |
| 4357 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4358 | status = wlan_hdd_validate_context(pHddCtx); |
| 4359 | if (0 != status) |
| 4360 | { |
| 4361 | return NULL; |
| 4362 | } |
| 4363 | |
| 4364 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4365 | if (NULL == pHddStaCtx) |
| 4366 | { |
| 4367 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4368 | "%s: STA Context is NULL",__func__); |
| 4369 | return NULL; |
| 4370 | } |
| 4371 | |
| 4372 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 4373 | { |
| 4374 | wlan_hdd_get_station_stats(pAdapter); |
| 4375 | wlan_hdd_get_snr(pAdapter, &snr); |
| 4376 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 4377 | |
| 4378 | vos_mem_zero(&pAdapter->iwStats, sizeof(pAdapter->iwStats)); |
| 4379 | pAdapter->iwStats.status = 0; |
| 4380 | pAdapter->iwStats.qual.qual = snr; |
| 4381 | pAdapter->iwStats.qual.level = rssi; |
| 4382 | pAdapter->iwStats.qual.noise = rssi - snr; |
| 4383 | pAdapter->iwStats.discard.code = 0; |
| 4384 | pAdapter->iwStats.discard.retries= 0; |
| 4385 | pAdapter->iwStats.miss.beacon = 0; |
| 4386 | pAdapter->iwStats.qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; |
| 4387 | } |
| 4388 | else |
| 4389 | { |
| 4390 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 4391 | FL("not in associated state: %d"), pHddStaCtx->conn_info.connState); |
| 4392 | return NULL; |
| 4393 | } |
| 4394 | |
| 4395 | EXIT(); |
| 4396 | return &(pAdapter->iwStats); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4397 | } |
| 4398 | |
| 4399 | static struct iw_statistics *get_wireless_stats(struct net_device *dev) |
| 4400 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 4401 | |
| 4402 | struct iw_statistics *stats; |
| 4403 | |
| 4404 | vos_ssr_protect(__func__); |
| 4405 | stats = __get_wireless_stats(dev); |
| 4406 | vos_ssr_unprotect(__func__); |
| 4407 | |
| 4408 | return stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4409 | } |
| 4410 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 4411 | static int __iw_set_encode(struct net_device *dev, |
| 4412 | struct iw_request_info *info, |
| 4413 | union iwreq_data *wrqu,char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4414 | |
| 4415 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4416 | hdd_adapter_t *pAdapter; |
| 4417 | hdd_station_ctx_t *pHddStaCtx; |
| 4418 | hdd_wext_state_t *pWextState; |
| 4419 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4420 | struct iw_point *encoderq = &(wrqu->encoding); |
| 4421 | v_U32_t keyId; |
| 4422 | v_U8_t key_length; |
| 4423 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4424 | v_BOOL_t fKeyPresent = 0; |
| 4425 | int i; |
| 4426 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4427 | |
| 4428 | |
| 4429 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4430 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4431 | if (NULL == pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4432 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4433 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4434 | "%s: Adapter is NULL",__func__); |
| 4435 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4436 | } |
| 4437 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4438 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4439 | status = wlan_hdd_validate_context(pHddCtx); |
| 4440 | if (0 != status) |
| 4441 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4442 | return status; |
| 4443 | } |
| 4444 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4445 | if (NULL == pWextState) |
| 4446 | { |
| 4447 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4448 | "%s: pWextState is NULL ",__func__); |
| 4449 | return -EINVAL; |
| 4450 | } |
| 4451 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4452 | if (NULL == pHddStaCtx) |
| 4453 | { |
| 4454 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4455 | "%s: STA Context is NULL",__func__); |
| 4456 | return -EINVAL; |
| 4457 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4458 | |
| 4459 | keyId = encoderq->flags & IW_ENCODE_INDEX; |
| 4460 | |
| 4461 | if(keyId) |
| 4462 | { |
| 4463 | if(keyId > MAX_WEP_KEYS) |
| 4464 | { |
| 4465 | return -EINVAL; |
| 4466 | } |
| 4467 | |
| 4468 | fKeyPresent = 1; |
| 4469 | keyId--; |
| 4470 | } |
| 4471 | else |
| 4472 | { |
| 4473 | fKeyPresent = 0; |
| 4474 | } |
| 4475 | |
| 4476 | |
| 4477 | if(wrqu->data.flags & IW_ENCODE_DISABLED) |
| 4478 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4479 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****iwconfig wlan0 key off*****"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | if(!fKeyPresent) { |
| 4481 | |
| 4482 | for(i=0;i < CSR_MAX_NUM_KEY; i++) { |
| 4483 | |
| 4484 | if(pWextState->roamProfile.Keys.KeyMaterial[i]) |
| 4485 | pWextState->roamProfile.Keys.KeyLength[i] = 0; |
| 4486 | } |
| 4487 | } |
| 4488 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4489 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 4490 | pWextState->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 4491 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 4492 | |
| 4493 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4494 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4495 | |
| 4496 | if(eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 4497 | { |
| 4498 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 4499 | 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] | 4500 | if(eHAL_STATUS_SUCCESS == status) |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 4501 | { |
| 4502 | long ret; |
| 4503 | ret = wait_for_completion_interruptible_timeout( |
| 4504 | &pAdapter->disconnect_comp_var, |
| 4505 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 4506 | if (ret <= 0) |
| 4507 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4508 | FL("failed wait on disconnect_comp_var %ld"), ret); |
| 4509 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4510 | } |
| 4511 | |
| 4512 | return status; |
| 4513 | |
| 4514 | } |
| 4515 | |
| 4516 | if (wrqu->data.flags & (IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED)) |
| 4517 | { |
| 4518 | hddLog(VOS_TRACE_LEVEL_INFO, "iwconfig wlan0 key on"); |
| 4519 | |
| 4520 | pHddStaCtx->conn_info.authType = (encoderq->flags & IW_ENCODE_RESTRICTED) ? eCSR_AUTH_TYPE_SHARED_KEY : eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4521 | |
| 4522 | } |
| 4523 | |
| 4524 | |
| 4525 | if(wrqu->data.length > 0) |
| 4526 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4527 | 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] | 4528 | |
| 4529 | key_length = wrqu->data.length; |
| 4530 | |
| 4531 | /* IW_ENCODING_TOKEN_MAX is the value that is set for wrqu->data.length by iwconfig.c when 'iwconfig wlan0 key on' is issued.*/ |
| 4532 | |
| 4533 | if(5 == key_length) |
| 4534 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4535 | 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] | 4536 | |
| 4537 | if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 4538 | { |
| 4539 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
| 4540 | } |
| 4541 | else |
| 4542 | { |
| 4543 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 4544 | } |
| 4545 | } |
| 4546 | else if(13 == key_length) |
| 4547 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4548 | 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] | 4549 | |
| 4550 | if((IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType)) |
| 4551 | { |
| 4552 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 4553 | } |
| 4554 | else |
| 4555 | { |
| 4556 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4557 | } |
| 4558 | } |
| 4559 | else |
| 4560 | { |
| 4561 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Invalid WEP key length :%d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 4562 | __func__, key_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4563 | return -EINVAL; |
| 4564 | } |
| 4565 | |
| 4566 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 4567 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 4568 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 4569 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
| 4570 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 4571 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 4572 | |
| 4573 | if((eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) && |
| 4574 | ((eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) || |
| 4575 | (eCSR_AUTH_TYPE_SHARED_KEY == pHddStaCtx->conn_info.authType))) |
| 4576 | { |
| 4577 | |
| 4578 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[keyId][0],extra,key_length); |
| 4579 | |
| 4580 | pWextState->roamProfile.Keys.KeyLength[keyId] = (v_U8_t)key_length; |
| 4581 | pWextState->roamProfile.Keys.defaultIndex = (v_U8_t)keyId; |
| 4582 | |
| 4583 | return status; |
| 4584 | } |
| 4585 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4586 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4587 | return 0; |
| 4588 | } |
| 4589 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 4590 | static int iw_set_encode(struct net_device *dev, |
| 4591 | struct iw_request_info *info, |
| 4592 | union iwreq_data *wrqu,char *extra) |
| 4593 | { |
| 4594 | int ret; |
| 4595 | |
| 4596 | vos_ssr_protect(__func__); |
| 4597 | ret = __iw_set_encode(dev, info, wrqu, extra); |
| 4598 | vos_ssr_unprotect(__func__); |
| 4599 | |
| 4600 | return ret; |
| 4601 | } |
| 4602 | |
| 4603 | static int __iw_get_encodeext(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4604 | struct iw_request_info *info, |
| 4605 | struct iw_point *dwrq, |
| 4606 | char *extra) |
| 4607 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4608 | hdd_adapter_t *pAdapter; |
| 4609 | hdd_wext_state_t *pWextState; |
| 4610 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4611 | int keyId; |
| 4612 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 4613 | eCsrAuthType authType = eCSR_AUTH_TYPE_NONE; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4614 | int i, ret = 0; |
| 4615 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4616 | |
| 4617 | ENTER(); |
| 4618 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4619 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4620 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4621 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4622 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4623 | "%s: Adapter is NULL",__func__); |
| 4624 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4625 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4626 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4627 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4628 | if (0 != ret) |
| 4629 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4630 | return ret; |
| 4631 | } |
| 4632 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4633 | if (NULL == pWextState) |
| 4634 | { |
| 4635 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4636 | "%s: pWextState is NULL",__func__); |
| 4637 | return -EINVAL; |
| 4638 | } |
| 4639 | pRoamProfile = &(pWextState->roamProfile); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4640 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4641 | keyId = pRoamProfile->Keys.defaultIndex; |
| 4642 | |
| 4643 | if(keyId < 0 || keyId >= MAX_WEP_KEYS) |
| 4644 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4645 | hddLog(LOG1,"%s: Invalid keyId : %d",__func__,keyId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4646 | return -EINVAL; |
| 4647 | } |
| 4648 | |
| 4649 | if(pRoamProfile->Keys.KeyLength[keyId] > 0) |
| 4650 | { |
| 4651 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 4652 | dwrq->length = pRoamProfile->Keys.KeyLength[keyId]; |
Bansidhar Gopalachari | 0a96a38 | 2013-07-24 16:55:34 +0530 | [diff] [blame] | 4653 | vos_mem_copy(extra, &(pRoamProfile->Keys.KeyMaterial[keyId][0]), |
| 4654 | pRoamProfile->Keys.KeyLength[keyId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4655 | } |
| 4656 | else |
| 4657 | { |
| 4658 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 4659 | } |
| 4660 | |
| 4661 | for(i=0; i < MAX_WEP_KEYS; i++) |
| 4662 | { |
| 4663 | if(pRoamProfile->Keys.KeyMaterial[i] == NULL) |
| 4664 | { |
| 4665 | continue; |
| 4666 | } |
| 4667 | else |
| 4668 | { |
| 4669 | break; |
| 4670 | } |
| 4671 | } |
| 4672 | |
| 4673 | if(MAX_WEP_KEYS == i) |
| 4674 | { |
| 4675 | dwrq->flags |= IW_ENCODE_NOKEY; |
| 4676 | } |
| 4677 | else |
| 4678 | { |
| 4679 | dwrq->flags |= IW_ENCODE_ENABLED; |
| 4680 | } |
| 4681 | |
| 4682 | encryptionType = pRoamProfile->EncryptionType.encryptionType[0]; |
| 4683 | |
| 4684 | if(eCSR_ENCRYPT_TYPE_NONE == encryptionType) |
| 4685 | { |
| 4686 | dwrq->flags |= IW_ENCODE_DISABLED; |
| 4687 | } |
| 4688 | |
| 4689 | authType = (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.authType; |
| 4690 | |
| 4691 | if(IW_AUTH_ALG_OPEN_SYSTEM == authType) |
| 4692 | { |
| 4693 | dwrq->flags |= IW_ENCODE_OPEN; |
| 4694 | } |
| 4695 | else |
| 4696 | { |
| 4697 | dwrq->flags |= IW_ENCODE_RESTRICTED; |
| 4698 | } |
| 4699 | EXIT(); |
| 4700 | return 0; |
| 4701 | |
| 4702 | } |
| 4703 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 4704 | static int iw_get_encodeext(struct net_device *dev, |
| 4705 | struct iw_request_info *info, |
| 4706 | struct iw_point *dwrq, |
| 4707 | char *extra) |
| 4708 | { |
| 4709 | int ret; |
| 4710 | vos_ssr_protect(__func__); |
| 4711 | ret = __iw_get_encodeext(dev, info, dwrq, extra); |
| 4712 | vos_ssr_unprotect(__func__); |
| 4713 | |
| 4714 | return ret; |
| 4715 | } |
| 4716 | |
| 4717 | static int __iw_set_encodeext(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4718 | struct iw_request_info *info, |
| 4719 | union iwreq_data *wrqu, char *extra) |
| 4720 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4721 | hdd_adapter_t *pAdapter; |
| 4722 | hdd_station_ctx_t *pHddStaCtx; |
| 4723 | hdd_wext_state_t *pWextState; |
| 4724 | hdd_context_t *pHddCtx; |
| 4725 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4726 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4727 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4728 | v_U32_t status = 0; |
| 4729 | |
| 4730 | struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; |
| 4731 | |
| 4732 | v_U8_t groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 4733 | |
| 4734 | int key_index; |
| 4735 | struct iw_point *encoding = &wrqu->encoding; |
| 4736 | tCsrRoamSetKey setKey; |
| 4737 | v_U32_t roamId= 0xFF; |
| 4738 | VOS_STATUS vos_status; |
| 4739 | |
| 4740 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4741 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4742 | if (NULL == pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4743 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4744 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4745 | "%s: Adapter is NULL",__func__); |
| 4746 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4747 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4748 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4749 | status = wlan_hdd_validate_context(pHddCtx); |
| 4750 | if (0 != status) |
| 4751 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4752 | return status; |
| 4753 | } |
| 4754 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 4755 | if (NULL == pHddStaCtx) |
| 4756 | { |
| 4757 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4758 | "%s: STA Context is NULL",__func__); |
| 4759 | return -EINVAL; |
| 4760 | } |
| 4761 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4762 | if (NULL == pWextState) |
| 4763 | { |
| 4764 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4765 | "%s: pWextState is NULL",__func__); |
| 4766 | return -EINVAL; |
| 4767 | } |
| 4768 | pRoamProfile = &pWextState->roamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4769 | key_index = encoding->flags & IW_ENCODE_INDEX; |
| 4770 | |
| 4771 | if(key_index > 0) { |
| 4772 | |
| 4773 | /*Convert from 1-based to 0-based keying*/ |
| 4774 | key_index--; |
| 4775 | } |
| 4776 | if(!ext->key_len) { |
| 4777 | |
| 4778 | /*Set the encrytion type to NONE*/ |
| 4779 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 4780 | return status; |
| 4781 | } |
| 4782 | |
| 4783 | if(eConnectionState_NotConnected == pHddStaCtx->conn_info.connState && |
| 4784 | (IW_ENCODE_ALG_WEP == ext->alg)) |
| 4785 | { |
| 4786 | if(IW_AUTH_KEY_MGMT_802_1X == pWextState->authKeyMgmt) { |
| 4787 | |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 4788 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4789 | ("Invalid Configuration:%s"),__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4790 | return -EINVAL; |
| 4791 | } |
| 4792 | else { |
| 4793 | /*Static wep, update the roam profile with the keys */ |
| 4794 | if(ext->key && (ext->key_len <= eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES) && |
| 4795 | key_index < CSR_MAX_NUM_KEY) { |
| 4796 | vos_mem_copy(&pRoamProfile->Keys.KeyMaterial[key_index][0],ext->key,ext->key_len); |
| 4797 | pRoamProfile->Keys.KeyLength[key_index] = (v_U8_t)ext->key_len; |
| 4798 | |
| 4799 | if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) |
| 4800 | pRoamProfile->Keys.defaultIndex = (v_U8_t)key_index; |
| 4801 | |
| 4802 | } |
| 4803 | } |
| 4804 | return status; |
| 4805 | } |
| 4806 | |
| 4807 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 4808 | |
| 4809 | setKey.keyId = key_index; |
| 4810 | setKey.keyLength = ext->key_len; |
| 4811 | |
| 4812 | if(ext->key_len <= CSR_MAX_KEY_LEN) { |
| 4813 | vos_mem_copy(&setKey.Key[0],ext->key,ext->key_len); |
| 4814 | } |
| 4815 | |
| 4816 | if(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { |
| 4817 | /*Key direction for group is RX only*/ |
| 4818 | setKey.keyDirection = eSIR_RX_ONLY; |
| 4819 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 4820 | } |
| 4821 | else { |
| 4822 | |
| 4823 | setKey.keyDirection = eSIR_TX_RX; |
| 4824 | vos_mem_copy(setKey.peerMac,ext->addr.sa_data,WNI_CFG_BSSID_LEN); |
| 4825 | } |
| 4826 | |
| 4827 | /*For supplicant pae role is zero*/ |
| 4828 | setKey.paeRole = 0; |
| 4829 | |
| 4830 | switch(ext->alg) |
| 4831 | { |
| 4832 | case IW_ENCODE_ALG_NONE: |
| 4833 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4834 | break; |
| 4835 | |
| 4836 | case IW_ENCODE_ALG_WEP: |
| 4837 | setKey.encType = (ext->key_len== 5) ? eCSR_ENCRYPT_TYPE_WEP40:eCSR_ENCRYPT_TYPE_WEP104; |
| 4838 | break; |
| 4839 | |
| 4840 | case IW_ENCODE_ALG_TKIP: |
| 4841 | { |
| 4842 | v_U8_t *pKey = &setKey.Key[0]; |
| 4843 | |
| 4844 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 4845 | |
| 4846 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 4847 | |
| 4848 | /*Supplicant sends the 32bytes key in this order |
| 4849 | |
| 4850 | |--------------|----------|----------| |
| 4851 | | Tk1 |TX-MIC | RX Mic | |
| 4852 | |--------------|----------|----------| |
| 4853 | <---16bytes---><--8bytes--><--8bytes--> |
| 4854 | |
| 4855 | */ |
| 4856 | /*Sme expects the 32 bytes key to be in the below order |
| 4857 | |
| 4858 | |--------------|----------|----------| |
| 4859 | | Tk1 |RX-MIC | TX Mic | |
| 4860 | |--------------|----------|----------| |
| 4861 | <---16bytes---><--8bytes--><--8bytes--> |
| 4862 | */ |
| 4863 | /* Copy the Temporal Key 1 (TK1) */ |
| 4864 | vos_mem_copy(pKey,ext->key,16); |
| 4865 | |
| 4866 | /*Copy the rx mic first*/ |
| 4867 | vos_mem_copy(&pKey[16],&ext->key[24],8); |
| 4868 | |
| 4869 | /*Copy the tx mic */ |
| 4870 | vos_mem_copy(&pKey[24],&ext->key[16],8); |
| 4871 | |
| 4872 | } |
| 4873 | break; |
| 4874 | |
| 4875 | case IW_ENCODE_ALG_CCMP: |
| 4876 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 4877 | break; |
| 4878 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4879 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4880 | #define IW_ENCODE_ALG_KRK 6 |
| 4881 | case IW_ENCODE_ALG_KRK: |
| 4882 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 4883 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4884 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4885 | |
| 4886 | default: |
| 4887 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 4888 | break; |
| 4889 | } |
| 4890 | |
| 4891 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4892 | ("%s:cipher_alg:%d key_len[%d] *pEncryptionType :%d"),__func__,(int)ext->alg,(int)ext->key_len,setKey.encType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4893 | |
| 4894 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 4895 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 4896 | is done. Save the key in the UMAC and include it in the ADD |
| 4897 | BSS request */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4898 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 4899 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4900 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 4901 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 4902 | "%s: Update PreAuth Key success", __func__); |
| 4903 | return 0; |
| 4904 | } |
| 4905 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 4906 | { |
| 4907 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4908 | "%s: Update PreAuth Key failed", __func__); |
| 4909 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4910 | } |
| 4911 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4912 | |
| 4913 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 4914 | |
| 4915 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 4916 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 4917 | { |
| 4918 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4919 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 4920 | __LINE__, vos_status ); |
| 4921 | |
| 4922 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 4923 | } |
| 4924 | |
| 4925 | halStatus = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter),pAdapter->sessionId, &setKey, &roamId ); |
| 4926 | |
| 4927 | if ( halStatus != eHAL_STATUS_SUCCESS ) |
| 4928 | { |
| 4929 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4930 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 4931 | __LINE__, halStatus ); |
| 4932 | |
| 4933 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 4934 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4935 | EXIT(); |
| 4936 | return halStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4937 | } |
| 4938 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 4939 | static int iw_set_encodeext(struct net_device *dev, |
| 4940 | struct iw_request_info *info, |
| 4941 | union iwreq_data *wrqu, char *extra) |
| 4942 | { |
| 4943 | int ret; |
| 4944 | |
| 4945 | vos_ssr_protect(__func__); |
| 4946 | ret = __iw_set_encodeext(dev, info, wrqu, extra); |
| 4947 | vos_ssr_unprotect(__func__); |
| 4948 | |
| 4949 | return ret; |
| 4950 | } |
| 4951 | |
| 4952 | static int __iw_set_retry(struct net_device *dev, |
| 4953 | struct iw_request_info *info, |
| 4954 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4955 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4956 | hdd_adapter_t *pAdapter; |
| 4957 | tHalHandle hHal; |
| 4958 | hdd_context_t *pHddCtx; |
| 4959 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4960 | |
| 4961 | ENTER(); |
| 4962 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4963 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4964 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4965 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4966 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4967 | "%s: Adapter is NULL",__func__); |
| 4968 | return -EINVAL; |
| 4969 | } |
| 4970 | |
| 4971 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 4972 | ret = wlan_hdd_validate_context(pHddCtx); |
| 4973 | if (0 != ret) |
| 4974 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 4975 | return ret; |
| 4976 | } |
| 4977 | |
| 4978 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 4979 | if (NULL == hHal) |
| 4980 | { |
| 4981 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 4982 | "%s: Hal Context is NULL",__func__); |
| 4983 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 4984 | } |
| 4985 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4986 | if(wrqu->retry.value < WNI_CFG_LONG_RETRY_LIMIT_STAMIN || |
| 4987 | wrqu->retry.value > WNI_CFG_LONG_RETRY_LIMIT_STAMAX) { |
| 4988 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 4989 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Invalid Retry-Limit=%d!!"),wrqu->retry.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4990 | |
| 4991 | return -EINVAL; |
| 4992 | } |
| 4993 | |
| 4994 | if(wrqu->retry.flags & IW_RETRY_LIMIT) { |
| 4995 | |
| 4996 | if((wrqu->retry.flags & IW_RETRY_LONG)) |
| 4997 | { |
| 4998 | if ( ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 4999 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 5000 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5001 | FL("failed to set ini parameter, WNI_CFG_LONG_RETRY_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5002 | return -EIO; |
| 5003 | } |
| 5004 | } |
| 5005 | else if((wrqu->retry.flags & IW_RETRY_SHORT)) |
| 5006 | { |
| 5007 | if ( ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, wrqu->retry.value, ccmCfgSetCallback, eANI_BOOLEAN_TRUE) != eHAL_STATUS_SUCCESS ) |
| 5008 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 5009 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5010 | FL("failed to set ini parameter, WNI_CFG_SHORT_RETRY_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5011 | return -EIO; |
| 5012 | } |
| 5013 | } |
| 5014 | } |
| 5015 | else |
| 5016 | { |
| 5017 | return -EOPNOTSUPP; |
| 5018 | } |
| 5019 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5020 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Set Retry-Limit=%d!!"),wrqu->retry.value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5021 | |
| 5022 | EXIT(); |
| 5023 | |
| 5024 | return 0; |
| 5025 | |
| 5026 | } |
| 5027 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 5028 | static int iw_set_retry(struct net_device *dev, |
| 5029 | struct iw_request_info *info, |
| 5030 | union iwreq_data *wrqu, char *extra) |
| 5031 | { |
| 5032 | int ret; |
| 5033 | |
| 5034 | vos_ssr_protect(__func__); |
| 5035 | ret = __iw_set_retry(dev, info, wrqu, extra); |
| 5036 | vos_ssr_unprotect(__func__); |
| 5037 | |
| 5038 | return ret; |
| 5039 | } |
| 5040 | |
| 5041 | static int __iw_get_retry(struct net_device *dev, |
| 5042 | struct iw_request_info *info, |
| 5043 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5044 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5045 | hdd_adapter_t *pAdapter; |
| 5046 | hdd_context_t *pHddCtx; |
| 5047 | tHalHandle hHal; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5048 | v_U32_t retry = 0; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5049 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5050 | |
| 5051 | ENTER(); |
| 5052 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5053 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5054 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5055 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5056 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5057 | "%s: Adapter is NULL",__func__); |
| 5058 | return -EINVAL; |
| 5059 | } |
| 5060 | |
| 5061 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5062 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5063 | if (0 != ret) |
| 5064 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5065 | return ret; |
| 5066 | } |
| 5067 | |
| 5068 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5069 | if (NULL == hHal) |
| 5070 | { |
| 5071 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5072 | "%s: Hal Context is NULL",__func__); |
| 5073 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5074 | } |
| 5075 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5076 | if((wrqu->retry.flags & IW_RETRY_LONG)) |
| 5077 | { |
| 5078 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG; |
| 5079 | |
| 5080 | if ( ccmCfgGetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS ) |
| 5081 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 5082 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 5083 | FL("failed to get ini parameter, WNI_CFG_LONG_RETRY_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5084 | return -EIO; |
| 5085 | } |
| 5086 | |
| 5087 | wrqu->retry.value = retry; |
| 5088 | } |
| 5089 | else if ((wrqu->retry.flags & IW_RETRY_SHORT)) |
| 5090 | { |
| 5091 | wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT; |
| 5092 | |
| 5093 | if ( ccmCfgGetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, &retry) != eHAL_STATUS_SUCCESS ) |
| 5094 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 5095 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 5096 | FL("failed to get ini parameter, WNI_CFG_SHORT_RETRY_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5097 | return -EIO; |
| 5098 | } |
| 5099 | |
| 5100 | wrqu->retry.value = retry; |
| 5101 | } |
| 5102 | else { |
| 5103 | return -EOPNOTSUPP; |
| 5104 | } |
| 5105 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5106 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("Retry-Limit=%d!!"),retry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5107 | |
| 5108 | EXIT(); |
| 5109 | |
| 5110 | return 0; |
| 5111 | } |
| 5112 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 5113 | static int iw_get_retry(struct net_device *dev, |
| 5114 | struct iw_request_info *info, |
| 5115 | union iwreq_data *wrqu, char *extra) |
| 5116 | { |
| 5117 | int ret; |
| 5118 | |
| 5119 | vos_ssr_protect(__func__); |
| 5120 | ret = __iw_get_retry(dev, info, wrqu, extra); |
| 5121 | vos_ssr_unprotect(__func__); |
| 5122 | |
| 5123 | return ret; |
| 5124 | } |
| 5125 | |
| 5126 | static int __iw_set_mlme(struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5127 | struct iw_request_info *info, |
| 5128 | union iwreq_data *wrqu, |
| 5129 | char *extra) |
| 5130 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5131 | hdd_adapter_t *pAdapter; |
| 5132 | hdd_context_t *pHddCtx; |
| 5133 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5134 | struct iw_mlme *mlme = (struct iw_mlme *)extra; |
| 5135 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5136 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5137 | |
| 5138 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5139 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5140 | if (NULL == pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5141 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5142 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5143 | "%s:Adapter is NULL",__func__); |
| 5144 | return -EINVAL; |
| 5145 | } |
| 5146 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5147 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5148 | if (0 != ret) |
| 5149 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5150 | return ret; |
| 5151 | } |
| 5152 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 5153 | if (NULL == pHddStaCtx) |
| 5154 | { |
| 5155 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5156 | "%s:STA context is NULL",__func__); |
| 5157 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5158 | } |
| 5159 | |
| 5160 | //reason_code is unused. By default it is set to eCSR_DISCONNECT_REASON_UNSPECIFIED |
| 5161 | switch (mlme->cmd) { |
| 5162 | case IW_MLME_DISASSOC: |
| 5163 | case IW_MLME_DEAUTH: |
| 5164 | |
| 5165 | if( pHddStaCtx->conn_info.connState == eConnectionState_Associated ) |
| 5166 | { |
| 5167 | eCsrRoamDisconnectReason reason = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 5168 | |
| 5169 | if( mlme->reason_code == HDD_REASON_MICHAEL_MIC_FAILURE ) |
| 5170 | reason = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 5171 | |
| 5172 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 5173 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId,reason); |
| 5174 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 5175 | if(eHAL_STATUS_SUCCESS == status) |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 5176 | { |
| 5177 | long ret; |
| 5178 | ret = wait_for_completion_interruptible_timeout( |
| 5179 | &pAdapter->disconnect_comp_var, |
| 5180 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 5181 | if (ret <= 0) |
| 5182 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5183 | FL("failed wait on disconnect_comp_var %ld"), ret); |
| 5184 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5185 | else |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5186 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate : csrRoamDisconnect failure returned %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5187 | __func__, (int)mlme->cmd, (int)status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5188 | |
| 5189 | /* Resetting authKeyMgmt */ |
| 5190 | (WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->authKeyMgmt = 0; |
| 5191 | |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 5192 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5193 | netif_tx_disable(dev); |
| 5194 | netif_carrier_off(dev); |
| 5195 | |
| 5196 | } |
| 5197 | else |
| 5198 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5199 | hddLog(LOGE,"%s %d Command Disassociate/Deauthenticate called but station is not in associated state", __func__, (int)mlme->cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5200 | } |
| 5201 | break; |
| 5202 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5203 | hddLog(LOGE,"%s %d Command should be Disassociate/Deauthenticate", __func__, (int)mlme->cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5204 | return -EINVAL; |
| 5205 | }//end of switch |
| 5206 | |
| 5207 | EXIT(); |
| 5208 | |
| 5209 | return status; |
| 5210 | |
| 5211 | } |
| 5212 | |
Mahesh A Saptasagar | c06673e | 2014-08-13 15:55:42 +0530 | [diff] [blame] | 5213 | static int iw_set_mlme(struct net_device *dev, |
| 5214 | struct iw_request_info *info, |
| 5215 | union iwreq_data *wrqu, |
| 5216 | char *extra) |
| 5217 | { |
| 5218 | int ret; |
| 5219 | |
| 5220 | vos_ssr_protect(__func__); |
| 5221 | ret = __iw_set_mlme(dev, info, wrqu, extra); |
| 5222 | vos_ssr_unprotect(__func__); |
| 5223 | |
| 5224 | return ret; |
| 5225 | } |
| 5226 | |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 5227 | int wlan_hdd_set_proximity(int set_value, tHalHandle hal) |
Hanumantha Reddy Pothula | 166676a | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5228 | { |
| 5229 | sHwCalValues hwCalValues; |
| 5230 | uint16 hwCalTxPower; |
| 5231 | uint8 txPwr = TX_PWR_DEF; |
| 5232 | |
| 5233 | hddLog(LOG1, FL("WE_SET_PROXIMITY_ENABLE: %d"), set_value); |
| 5234 | |
| 5235 | if (TRUE == set_value) { |
| 5236 | if(vos_nv_read( VNV_HW_CAL_VALUES, &hwCalValues, |
| 5237 | NULL, sizeof(sHwCalValues) ) |
| 5238 | != VOS_STATUS_SUCCESS) { |
| 5239 | return -EINVAL; |
| 5240 | } |
| 5241 | hwCalTxPower = (uint16)(hwCalValues.calData.hwParam7 >> 16); |
| 5242 | |
| 5243 | hddLog(LOG1, FL("hwCalTxPower:%x nv_data:%x"), |
| 5244 | hwCalTxPower, hwCalValues.calData.hwParam7); |
| 5245 | |
| 5246 | txPwr = (int8)(hwCalTxPower & 0x00FF); |
| 5247 | txPwr = txPwr/10; |
Hanumanth Reddy Pothula | 82c02ab | 2017-01-31 16:29:53 +0530 | [diff] [blame] | 5248 | if (txPwr == 0) |
| 5249 | txPwr = TX_PWR_DEF; |
| 5250 | else if (txPwr < TX_PWR_MIN) |
Hanumantha Reddy Pothula | 166676a | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5251 | txPwr = TX_PWR_MIN; |
Hanumanth Reddy Pothula | 82c02ab | 2017-01-31 16:29:53 +0530 | [diff] [blame] | 5252 | else if (txPwr > TX_PWR_MAX) |
Hanumantha Reddy Pothula | 166676a | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5253 | txPwr = TX_PWR_MAX; |
| 5254 | |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 5255 | if (sme_SetMaxTxPowerPerBand(eCSR_BAND_24, txPwr, hal) != |
Hanumantha Reddy Pothula | 166676a | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5256 | eHAL_STATUS_SUCCESS) { |
| 5257 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5258 | FL("Setting tx power failed for 2.4GHz band %d"), txPwr); |
| 5259 | return -EIO; |
| 5260 | } |
| 5261 | |
| 5262 | txPwr = (int8)((hwCalTxPower >> 8) & 0x00FF); |
| 5263 | txPwr /= 10; |
Hanumanth Reddy Pothula | 82c02ab | 2017-01-31 16:29:53 +0530 | [diff] [blame] | 5264 | if (txPwr == 0) |
| 5265 | txPwr = TX_PWR_DEF; |
| 5266 | else if (txPwr < TX_PWR_MIN) |
Hanumantha Reddy Pothula | 166676a | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5267 | txPwr = TX_PWR_MIN; |
Hanumanth Reddy Pothula | 82c02ab | 2017-01-31 16:29:53 +0530 | [diff] [blame] | 5268 | else if (txPwr > TX_PWR_MAX) |
Hanumantha Reddy Pothula | 166676a | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5269 | txPwr = TX_PWR_MAX; |
| 5270 | |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 5271 | if (sme_SetMaxTxPowerPerBand(eCSR_BAND_5G, txPwr, hal) != |
Hanumantha Reddy Pothula | 166676a | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5272 | eHAL_STATUS_SUCCESS) { |
| 5273 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5274 | FL("setting tx power failed for 5GHz band %d"), txPwr); |
| 5275 | return -EIO; |
| 5276 | } |
| 5277 | } |
| 5278 | else if(FALSE == set_value) { |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 5279 | if (sme_SetMaxTxPowerPerBand(eCSR_BAND_24, txPwr, hal) != |
Hanumantha Reddy Pothula | 166676a | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5280 | eHAL_STATUS_SUCCESS) { |
| 5281 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5282 | FL("Setting tx power failed for 2.4GHz band %d"), txPwr); |
| 5283 | return -EIO; |
| 5284 | } |
| 5285 | |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 5286 | if (sme_SetMaxTxPowerPerBand(eCSR_BAND_5G, txPwr, hal) != |
Hanumantha Reddy Pothula | 166676a | 2016-01-08 15:39:47 +0530 | [diff] [blame] | 5287 | eHAL_STATUS_SUCCESS) { |
| 5288 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5289 | FL("setting tx power failed for 5GHz band %d"), txPwr); |
| 5290 | return -EIO; |
| 5291 | } |
| 5292 | } |
| 5293 | else { |
| 5294 | return -EINVAL; |
| 5295 | } |
| 5296 | |
| 5297 | return eHAL_STATUS_SUCCESS; |
| 5298 | } |
SaidiReddy Yenuga | c341fbf | 2017-02-01 20:22:45 +0530 | [diff] [blame] | 5299 | |
| 5300 | static int hdd_set_dynamic_aggregation(int value, hdd_adapter_t *adapter) |
| 5301 | { |
| 5302 | int ret = 0; |
| 5303 | tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); |
| 5304 | tDelBaParams del_session; |
| 5305 | |
| 5306 | del_session.session_id = adapter->sessionId; |
| 5307 | hddLog(LOG1, FL("WLAN_SET_DYNNAMIC_AGGREGATION: %d"), value); |
| 5308 | |
| 5309 | if ((value == DISABLE_AGGREGATION) || (value == ENABLE_AGGREGATION)) |
| 5310 | { |
| 5311 | ret = ccmCfgSetInt(hal, WNI_CFG_ENABLE_TX_RX_AGGREGATION, |
| 5312 | value,NULL, eANI_BOOLEAN_FALSE); |
| 5313 | if (ret != eHAL_STATUS_SUCCESS) |
| 5314 | { |
| 5315 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5316 | FL("failed to set ini parameter, WNI_CFG_ENABLE_TX_RX_AGGREGATION")); |
| 5317 | return -EIO; |
| 5318 | } |
| 5319 | |
| 5320 | } else { |
| 5321 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5322 | FL("Invalid command input")); |
| 5323 | return -EINVAL; |
| 5324 | } |
| 5325 | ret = sme_del_sta_ba_session_req(hal, del_session); |
| 5326 | if (ret != VOS_STATUS_SUCCESS) { |
| 5327 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("send ba session req fail")); |
| 5328 | return -EINVAL; |
| 5329 | } |
| 5330 | |
| 5331 | EXIT(); |
| 5332 | return ret; |
| 5333 | } |
| 5334 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5335 | static int |
| 5336 | wlan_hdd_sta_mon_op(hdd_context_t *hdd_ctx, uint32_t set_value, |
| 5337 | hdd_adapter_t *mon_adapter, hdd_mon_ctx_t *mon_ctx) |
| 5338 | { |
| 5339 | hdd_station_ctx_t *sta_ctx; |
| 5340 | VOS_STATUS disable_bmps_status; |
| 5341 | hdd_adapter_t *sta_adapter; |
| 5342 | v_CONTEXT_t vos_ctx = (WLAN_HDD_GET_CTX(mon_adapter))->pvosContext; |
| 5343 | |
| 5344 | if (!test_bit(DEVICE_IFACE_OPENED, &mon_adapter->event_flags)) { |
| 5345 | hddLog(LOGE, FL("Monitor Interface is not OPENED")); |
| 5346 | return -EINVAL; |
| 5347 | } |
| 5348 | |
| 5349 | if (set_value == MON_MODE_STOP) { |
| 5350 | if (wlan_hdd_check_monitor_state(hdd_ctx)) |
| 5351 | return 0; |
| 5352 | return -EINVAL; |
| 5353 | } |
| 5354 | |
| 5355 | sta_adapter = hdd_get_adapter(hdd_ctx, WLAN_HDD_INFRA_STATION); |
| 5356 | if (!sta_adapter) { |
| 5357 | hddLog(LOGE, FL("No Station adapter")); |
| 5358 | return -EINVAL; |
| 5359 | } |
| 5360 | |
| 5361 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(sta_adapter); |
| 5362 | if (!sta_ctx || !hdd_connIsConnected(sta_ctx)) { |
| 5363 | hddLog(LOGE, FL("STA is not connected")); |
| 5364 | return -EINVAL; |
| 5365 | } |
| 5366 | |
| 5367 | if (hdd_isConnectionInProgress(hdd_ctx, NULL, NULL)) { |
| 5368 | hddLog(LOGE, FL("Roaming or set-key is in progress")); |
| 5369 | return -EBUSY; |
| 5370 | } |
| 5371 | |
| 5372 | hdd_disable_roaming(hdd_ctx); |
| 5373 | |
| 5374 | hddLog(LOG1, FL("Disable BMPS")); |
| 5375 | disable_bmps_status = hdd_disable_bmps_imps(hdd_ctx, |
| 5376 | WLAN_HDD_INFRA_STATION); |
| 5377 | if (disable_bmps_status != VOS_STATUS_SUCCESS) { |
| 5378 | hddLog(LOGE, FL("Cannot start monitor mode")); |
| 5379 | hdd_restore_roaming(hdd_ctx); |
| 5380 | return -EINVAL; |
| 5381 | } |
| 5382 | |
| 5383 | mon_ctx->ChannelNo = sta_ctx->conn_info.operationChannel; |
| 5384 | |
| 5385 | /* |
| 5386 | * In STA + Mon mode, firmware should not consider ChannelBW |
| 5387 | */ |
| 5388 | mon_ctx->ChannelBW = 0; |
| 5389 | mon_ctx->crcCheckEnabled = 0; |
| 5390 | wlan_hdd_mon_set_typesubtype(mon_ctx, 100); |
| 5391 | mon_ctx->is80211to803ConReq = 0; |
| 5392 | WLANTL_SetIsConversionReq(vos_ctx, 0); |
| 5393 | mon_adapter->dev->type = ARPHRD_IEEE80211_RADIOTAP; |
| 5394 | |
| 5395 | mon_ctx->state = MON_MODE_START; |
| 5396 | return 0; |
| 5397 | } |
| 5398 | |
| 5399 | /* set param sub-ioctls */ |
| 5400 | static int __iw_mon_setint_getnone(struct net_device *dev, |
| 5401 | struct iw_request_info *info, |
| 5402 | union iwreq_data *wrqu, char *extra) |
| 5403 | { |
| 5404 | hdd_adapter_t *adapter; |
| 5405 | hdd_context_t *hdd_ctx; |
| 5406 | hdd_mon_ctx_t *mon_ctx; |
| 5407 | int *value = (int *)extra; |
| 5408 | int sub_cmd = value[0]; |
| 5409 | int set_value = value[1]; |
| 5410 | int ret = 0; /* success */ |
| 5411 | tVOS_CONCURRENCY_MODE concurrency_mode; |
| 5412 | |
| 5413 | ENTER(); |
| 5414 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5415 | if (!adapter || adapter->device_mode != WLAN_HDD_MONITOR) |
| 5416 | return -EINVAL; |
| 5417 | |
| 5418 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 5419 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5420 | if (ret) |
| 5421 | return ret; |
| 5422 | |
| 5423 | concurrency_mode = hdd_ctx->concurrency_mode; |
| 5424 | if (concurrency_mode != VOS_STA_MON) { |
| 5425 | hddLog(LOGE, "invalid concurrency mode %d", concurrency_mode); |
| 5426 | return -EINVAL; |
| 5427 | } |
| 5428 | |
| 5429 | switch(sub_cmd) { |
| 5430 | |
| 5431 | case WE_SET_MONITOR_STATE: |
| 5432 | { |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 5433 | void *cookie; |
| 5434 | struct hdd_request *request; |
| 5435 | static const struct hdd_request_params params = { |
| 5436 | .priv_size = 0, |
| 5437 | .timeout_ms = MON_MODE_MSG_TIMEOUT, |
| 5438 | }; |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5439 | |
| 5440 | mon_ctx = WLAN_HDD_GET_MONITOR_CTX_PTR(adapter); |
| 5441 | if(!mon_ctx) { |
| 5442 | hddLog(LOGE, "Monitor Context NULL"); |
| 5443 | ret = -EIO; |
| 5444 | break; |
| 5445 | } |
| 5446 | |
| 5447 | if (mon_ctx->state == set_value) { |
| 5448 | hddLog(LOGE, FL("already in same mode curr_mode:%d req_mode: %d"), |
| 5449 | mon_ctx->state, set_value); |
| 5450 | break; |
| 5451 | } |
| 5452 | |
| 5453 | ret = wlan_hdd_sta_mon_op(hdd_ctx, set_value, |
| 5454 | adapter,mon_ctx); |
| 5455 | if (ret) |
| 5456 | break; |
| 5457 | |
| 5458 | mon_ctx->state = set_value; |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 5459 | request = hdd_request_alloc(¶ms); |
| 5460 | if (!request) { |
| 5461 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 5462 | ret = -ENOMEM; |
| 5463 | break; |
| 5464 | } |
| 5465 | cookie = hdd_request_cookie(request); |
| 5466 | if (wlan_hdd_mon_postMsg(cookie, mon_ctx, |
| 5467 | hdd_mon_post_msg_cb) |
| 5468 | != VOS_STATUS_SUCCESS) { |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5469 | hddLog(LOGE, FL("failed to post MON MODE REQ")); |
| 5470 | mon_ctx->state = |
| 5471 | (mon_ctx->state==MON_MODE_START) ? |
| 5472 | MON_MODE_STOP : MON_MODE_START; |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5473 | ret = -EIO; |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 5474 | } else { |
| 5475 | ret = hdd_request_wait_for_response(request); |
| 5476 | if (ret){ |
| 5477 | hddLog(LOGE, FL("failed to wait on monitor mode completion %d"), |
| 5478 | ret); |
| 5479 | } else if (mon_ctx->state == MON_MODE_STOP) { |
| 5480 | hddLog(LOG1, FL("Enable BMPS")); |
| 5481 | hdd_enable_bmps_imps(hdd_ctx); |
| 5482 | hdd_restore_roaming(hdd_ctx); |
| 5483 | } |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5484 | } |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 5485 | hdd_request_put(request); |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5486 | } |
| 5487 | break; |
| 5488 | |
| 5489 | default: |
| 5490 | { |
| 5491 | hddLog(LOGE, "Invalid IOCTL setvalue command %d value %d", |
| 5492 | sub_cmd, set_value); |
| 5493 | } |
| 5494 | break; |
| 5495 | } |
| 5496 | |
| 5497 | EXIT(); |
| 5498 | return ret; |
| 5499 | } |
| 5500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5501 | /* set param sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 5502 | static int __iw_setint_getnone(struct net_device *dev, |
| 5503 | struct iw_request_info *info, |
| 5504 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5505 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5506 | hdd_adapter_t *pAdapter; |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5507 | tHalHandle hHal = NULL; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5508 | hdd_wext_state_t *pWextState; |
| 5509 | hdd_context_t *pHddCtx; |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 5510 | hdd_mon_ctx_t *pMonCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5511 | int *value = (int *)extra; |
| 5512 | int sub_cmd = value[0]; |
| 5513 | int set_value = value[1]; |
| 5514 | int ret = 0; /* success */ |
| 5515 | int enable_pbm, enable_mp; |
| 5516 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 5517 | v_U8_t nEnableSuspendOld; |
| 5518 | #endif |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5519 | void *cookie; |
| 5520 | struct hdd_request *request; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5521 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5522 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5523 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5524 | if (NULL == pAdapter) |
| 5525 | { |
| 5526 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5527 | "%s: Adapter is NULL",__func__); |
| 5528 | return -EINVAL; |
| 5529 | } |
| 5530 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5531 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5532 | if (0 != ret) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5533 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5534 | return ret; |
| 5535 | } |
Abhishek Singh | 2b05585 | 2015-10-07 14:14:13 +0530 | [diff] [blame] | 5536 | |
Katya Nigam | eae74b6 | 2015-05-28 17:19:16 +0530 | [diff] [blame] | 5537 | if ( VOS_MONITOR_MODE != hdd_get_conparam()) |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 5538 | { |
Sravan Kumar Kairam | 57ea7b1 | 2015-12-07 12:09:35 +0530 | [diff] [blame] | 5539 | /* In monitor mode hHal is NULL */ |
| 5540 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 5541 | if (NULL == hHal) |
| 5542 | { |
| 5543 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5544 | "%s: Hal Context is NULL",__func__); |
| 5545 | return -EINVAL; |
| 5546 | } |
Katya Nigam | eae74b6 | 2015-05-28 17:19:16 +0530 | [diff] [blame] | 5547 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5548 | if (NULL == pWextState) |
| 5549 | { |
| 5550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5551 | "%s: pWextState is NULL",__func__); |
| 5552 | return -EINVAL; |
| 5553 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 5554 | |
Katya Nigam | eae74b6 | 2015-05-28 17:19:16 +0530 | [diff] [blame] | 5555 | INIT_COMPLETION(pWextState->completion_var); |
| 5556 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5557 | switch(sub_cmd) |
| 5558 | { |
| 5559 | case WE_SET_11D_STATE: |
| 5560 | { |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 5561 | tSmeConfigParams smeConfig; |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 5562 | memset(&smeConfig, 0x00, sizeof(smeConfig)); |
| 5563 | |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5564 | if(((ENABLE_11D == set_value) || (DISABLE_11D == set_value)) && |
| 5565 | (hHal)) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5566 | sme_GetConfigParam(hHal,&smeConfig); |
| 5567 | smeConfig.csrConfig.Is11dSupportEnabled = (v_BOOL_t)set_value; |
| 5568 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5569 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%d!!"),smeConfig.csrConfig.Is11dSupportEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5570 | |
| 5571 | sme_UpdateConfig(hHal,&smeConfig); |
| 5572 | } |
| 5573 | else { |
| 5574 | return -EINVAL; |
| 5575 | } |
| 5576 | break; |
| 5577 | } |
| 5578 | |
| 5579 | case WE_WOWL: |
| 5580 | { |
| 5581 | switch (set_value) |
| 5582 | { |
| 5583 | case 0x00: |
c_hpothu | 01484c0 | 2014-05-16 14:05:15 +0530 | [diff] [blame] | 5584 | hdd_exit_wowl(pAdapter, eWOWL_EXIT_USER); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5585 | break; |
| 5586 | case 0x01: |
| 5587 | case 0x02: |
| 5588 | case 0x03: |
| 5589 | enable_mp = (set_value & 0x01) ? 1 : 0; |
| 5590 | enable_pbm = (set_value & 0x02) ? 1 : 0; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5591 | hddLog(LOGE, "magic packet ? = %s pattern byte matching ? = %s", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5592 | (enable_mp ? "YES":"NO"), (enable_pbm ? "YES":"NO")); |
| 5593 | hdd_enter_wowl(pAdapter, enable_mp, enable_pbm); |
| 5594 | break; |
| 5595 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5596 | hddLog(LOGE, "Invalid arg %d in WE_WOWL IOCTL", set_value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5597 | ret = -EINVAL; |
| 5598 | break; |
| 5599 | } |
| 5600 | |
| 5601 | break; |
| 5602 | } |
| 5603 | case WE_SET_POWER: |
| 5604 | { |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 5605 | if (wlan_hdd_check_monitor_state(pHddCtx)) { |
| 5606 | hddLog(LOGE, FL("setPower not allowed in STA + MON")); |
| 5607 | ret = -EOPNOTSUPP; |
| 5608 | break; |
| 5609 | } |
| 5610 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5611 | switch (set_value) |
| 5612 | { |
| 5613 | case 0: //Full Power |
| 5614 | { |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5615 | eHalStatus status = eHAL_STATUS_FAILURE; |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5616 | static const struct hdd_request_params params = { |
| 5617 | .priv_size = 0, |
| 5618 | .timeout_ms = WLAN_WAIT_TIME_POWER, |
| 5619 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5620 | |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5621 | if (NULL == hHal) |
| 5622 | return -EINVAL; |
| 5623 | |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5624 | request = hdd_request_alloc(¶ms); |
| 5625 | if (!request) { |
| 5626 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5627 | FL("Request allocation failure")); |
| 5628 | return VOS_STATUS_E_NOMEM; |
| 5629 | } |
| 5630 | cookie = hdd_request_cookie(request); |
| 5631 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5632 | status = sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5633 | iw_power_callback_func, cookie, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5634 | eSME_FULL_PWR_NEEDED_BY_HDD); |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5635 | |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 5636 | if (eHAL_STATUS_PMC_PENDING == status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5637 | { |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5638 | ret = hdd_request_wait_for_response(request); |
| 5639 | if (ret) { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 5640 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5641 | FL("SME timeout while requesting bmps")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5642 | } |
| 5643 | } |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5644 | |
| 5645 | /* |
| 5646 | * either we never sent a request, we sent a request and |
| 5647 | * received a response or we sent a request and timed out. |
| 5648 | * Regardless we are done with the request. |
| 5649 | */ |
| 5650 | hdd_request_put(request); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 5651 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5652 | hddLog(LOGE, "iwpriv Full Power completed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5653 | break; |
| 5654 | } |
| 5655 | case 1: //Enable BMPS |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5656 | if (hHal) |
| 5657 | sme_EnablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 5658 | else |
| 5659 | ret = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5660 | break; |
| 5661 | case 2: //Disable BMPS |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5662 | if (hHal) |
| 5663 | sme_DisablePowerSave(hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 5664 | else |
| 5665 | ret = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5666 | break; |
| 5667 | case 3: //Request Bmps |
| 5668 | { |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5669 | eHalStatus status = eHAL_STATUS_FAILURE; |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5670 | static const struct hdd_request_params params = { |
| 5671 | .priv_size = 0, |
| 5672 | .timeout_ms = WLAN_WAIT_TIME_POWER, |
| 5673 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5674 | |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5675 | if (NULL == hHal) |
| 5676 | return -EINVAL; |
| 5677 | |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5678 | request = hdd_request_alloc(¶ms); |
| 5679 | if (!request) { |
| 5680 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5681 | FL("Request allocation failure")); |
| 5682 | return VOS_STATUS_E_NOMEM; |
| 5683 | } |
| 5684 | cookie = hdd_request_cookie(request); |
| 5685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5686 | status = sme_RequestBmps(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5687 | iw_power_callback_func, cookie); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 5688 | if (eHAL_STATUS_PMC_PENDING == status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5689 | { |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5690 | ret = hdd_request_wait_for_response(request); |
| 5691 | if (ret) { |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 5692 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5693 | FL("SME timeout while requesting fullpower")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5694 | } |
| 5695 | } |
Hanumanth Reddy Pothula | 00022c1 | 2018-04-05 18:54:35 +0530 | [diff] [blame] | 5696 | |
| 5697 | /* |
| 5698 | * either we never sent a request, we sent a request and |
| 5699 | * received a response or we sent a request and timed out. |
| 5700 | * Regardless we are done with the request. |
| 5701 | */ |
| 5702 | hdd_request_put(request); |
Jeff Johnson | 72a4051 | 2013-12-19 10:14:15 -0800 | [diff] [blame] | 5703 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5704 | hddLog(LOGE, "iwpriv Request BMPS completed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5705 | break; |
| 5706 | } |
| 5707 | case 4: //Enable IMPS |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5708 | if (hHal) |
| 5709 | sme_EnablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 5710 | else |
| 5711 | ret = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5712 | break; |
| 5713 | case 5: //Disable IMPS |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5714 | if (hHal) |
| 5715 | sme_DisablePowerSave(hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 5716 | else |
| 5717 | ret = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5718 | break; |
| 5719 | case 6: //Enable Standby |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5720 | if (hHal) |
| 5721 | sme_EnablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE); |
| 5722 | else |
| 5723 | ret = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5724 | break; |
| 5725 | case 7: //Disable Standby |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5726 | if (hHal) |
| 5727 | sme_DisablePowerSave(hHal, ePMC_STANDBY_MODE_POWER_SAVE); |
| 5728 | else |
| 5729 | ret = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5730 | break; |
| 5731 | case 8: //Request Standby |
| 5732 | #ifdef CONFIG_HAS_EARLYSUSPEND |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5733 | #endif |
| 5734 | break; |
| 5735 | case 9: //Start Auto Bmps Timer |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5736 | if (hHal) |
| 5737 | sme_StartAutoBmpsTimer(hHal); |
| 5738 | else |
| 5739 | ret = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5740 | break; |
| 5741 | case 10://Stop Auto BMPS Timer |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5742 | if (hHal) |
| 5743 | sme_StopAutoBmpsTimer(hHal); |
| 5744 | else |
| 5745 | ret = -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5746 | break; |
| 5747 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 5748 | case 11://suspend to standby |
| 5749 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 5750 | nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend; |
| 5751 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5752 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld; |
| 5753 | #endif |
| 5754 | break; |
| 5755 | case 12://suspend to deep sleep |
| 5756 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 5757 | nEnableSuspendOld = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend; |
| 5758 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5759 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->nEnableSuspend = nEnableSuspendOld; |
| 5760 | #endif |
| 5761 | break; |
| 5762 | case 13://resume from suspend |
| 5763 | #ifdef CONFIG_HAS_EARLYSUSPEND |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5764 | #endif |
| 5765 | break; |
| 5766 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5767 | default: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5768 | hddLog(LOGE, "Invalid arg %d in WE_SET_POWER IOCTL", set_value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5769 | ret = -EINVAL; |
| 5770 | break; |
| 5771 | } |
| 5772 | break; |
| 5773 | } |
| 5774 | |
| 5775 | case WE_SET_MAX_ASSOC: |
| 5776 | { |
| 5777 | if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) || |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5778 | (WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value) || |
| 5779 | (NULL == hHal)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5780 | { |
| 5781 | ret = -EINVAL; |
| 5782 | } |
| 5783 | else if ( ccmCfgSetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, |
| 5784 | set_value, NULL, eANI_BOOLEAN_FALSE) |
| 5785 | != eHAL_STATUS_SUCCESS ) |
| 5786 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 5787 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 5788 | FL("failed to set ini parameter, WNI_CFG_ASSOC_STA_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5789 | ret = -EIO; |
| 5790 | } |
| 5791 | break; |
| 5792 | } |
| 5793 | |
| 5794 | case WE_SET_SAP_AUTO_CHANNEL_SELECTION: |
| 5795 | { |
| 5796 | if( 0 == set_value ) |
| 5797 | { |
| 5798 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 0; |
| 5799 | } |
| 5800 | else if ( 1 == set_value ) |
| 5801 | { |
| 5802 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection = 1; |
| 5803 | } |
| 5804 | else |
| 5805 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5806 | hddLog(LOGE, "Invalid arg %d in WE_SET_SAP_AUTO_CHANNEL_SELECTION IOCTL", set_value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5807 | ret = -EINVAL; |
| 5808 | } |
| 5809 | break; |
| 5810 | } |
| 5811 | |
| 5812 | case WE_SET_DATA_INACTIVITY_TO: |
| 5813 | { |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5814 | if (NULL == hHal) |
| 5815 | return -EINVAL; |
| 5816 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5817 | if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) || |
| 5818 | (set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) || |
| 5819 | (ccmCfgSetInt((WLAN_HDD_GET_CTX(pAdapter))->hHal, |
| 5820 | WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, |
| 5821 | set_value, |
| 5822 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)) |
| 5823 | { |
| 5824 | hddLog(LOGE,"Failure: Could not pass on " |
| 5825 | "WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT configuration info " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 5826 | "to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5827 | ret = -EINVAL; |
| 5828 | } |
| 5829 | break; |
| 5830 | } |
| 5831 | case WE_SET_MAX_TX_POWER: |
| 5832 | { |
| 5833 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 5834 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 5835 | |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5836 | if (NULL == hHal) |
| 5837 | return -EINVAL; |
| 5838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5839 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Setting maximum tx power %d dBm", |
| 5840 | __func__, set_value); |
| 5841 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, set_value) != |
| 5842 | eHAL_STATUS_SUCCESS ) |
| 5843 | { |
| 5844 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 5845 | __func__); |
| 5846 | return -EIO; |
| 5847 | } |
| 5848 | |
| 5849 | break; |
| 5850 | } |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 5851 | case WE_SET_MAX_TX_POWER_2_4: |
| 5852 | { |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 5853 | if (NULL == hHal) |
| 5854 | return -EINVAL; |
| 5855 | |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 5856 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5857 | "%s: Setting maximum tx power %d dBm for 2.4 GHz band", |
| 5858 | __func__, set_value); |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 5859 | if (sme_SetMaxTxPowerPerBand(eCSR_BAND_24, set_value, hHal) != |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 5860 | eHAL_STATUS_SUCCESS) |
| 5861 | { |
| 5862 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5863 | "%s: Setting maximum tx power failed for 2.4 GHz band", |
| 5864 | __func__); |
| 5865 | return -EIO; |
| 5866 | } |
| 5867 | |
| 5868 | break; |
| 5869 | } |
| 5870 | case WE_SET_MAX_TX_POWER_5_0: |
| 5871 | { |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 5872 | if (NULL == hHal) |
| 5873 | return -EINVAL; |
| 5874 | |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 5875 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 5876 | "%s: Setting maximum tx power %d dBm for 5.0 GHz band", |
| 5877 | __func__, set_value); |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 5878 | if (sme_SetMaxTxPowerPerBand(eCSR_BAND_5G, set_value, hHal) != |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 5879 | eHAL_STATUS_SUCCESS) |
| 5880 | { |
| 5881 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5882 | "%s: Setting maximum tx power failed for 5.0 GHz band", |
| 5883 | __func__); |
| 5884 | return -EIO; |
| 5885 | } |
| 5886 | |
| 5887 | break; |
| 5888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5889 | case WE_SET_HIGHER_DTIM_TRANSITION: |
| 5890 | { |
| 5891 | if(!((set_value == eANI_BOOLEAN_FALSE) || |
| 5892 | (set_value == eANI_BOOLEAN_TRUE))) |
| 5893 | { |
| 5894 | hddLog(LOGE, "Dynamic DTIM Incorrect data:%d", set_value); |
| 5895 | ret = -EINVAL; |
| 5896 | } |
| 5897 | else |
| 5898 | { |
| 5899 | if(pAdapter->higherDtimTransition != set_value) |
| 5900 | { |
| 5901 | pAdapter->higherDtimTransition = set_value; |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 5902 | hddLog(LOG1, "%s: higherDtimTransition set to :%d", __func__, pAdapter->higherDtimTransition); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5903 | } |
| 5904 | } |
| 5905 | |
| 5906 | break; |
| 5907 | } |
| 5908 | |
| 5909 | case WE_SET_TM_LEVEL: |
| 5910 | { |
| 5911 | hdd_context_t *hddCtxt = WLAN_HDD_GET_CTX(pAdapter); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 5912 | hddLog(VOS_TRACE_LEVEL_INFO, "Set Thermal Mitigation Level %d", (int)set_value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5913 | hddDevTmLevelChangedHandler(hddCtxt->parent_dev, set_value); |
| 5914 | |
| 5915 | break; |
| 5916 | } |
| 5917 | |
Kiet Lam | 46b8e4e | 2013-11-06 21:49:53 +0530 | [diff] [blame] | 5918 | case WE_ENABLE_STRICT_FCC_REG: |
| 5919 | { |
| 5920 | hdd_context_t *hddCtxt = WLAN_HDD_GET_CTX(pAdapter); |
| 5921 | struct wiphy *wiphy = NULL; |
| 5922 | long lrc; |
| 5923 | int status; |
| 5924 | |
| 5925 | wiphy = hddCtxt->wiphy; |
| 5926 | if(wiphy == NULL) |
| 5927 | { |
| 5928 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy is NULL ", __func__); |
| 5929 | break; |
| 5930 | } |
| 5931 | init_completion(&hddCtxt->wiphy_channel_update_event); |
| 5932 | |
| 5933 | hddCtxt->nEnableStrictRegulatoryForFCC = set_value; |
| 5934 | |
| 5935 | status = regulatory_hint(wiphy, "00"); |
| 5936 | if(status < 0) |
| 5937 | { |
| 5938 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Failure in setting regulatory rule ", __func__); |
| 5939 | break; |
| 5940 | } |
| 5941 | |
| 5942 | /* Wait for completion */ |
| 5943 | lrc = wait_for_completion_interruptible_timeout(&hddCtxt->wiphy_channel_update_event, |
| 5944 | msecs_to_jiffies(WLAN_WAIT_TIME_CHANNEL_UPDATE)); |
| 5945 | if (lrc <= 0) |
| 5946 | { |
| 5947 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: SME %s while setting strict FCC regulatory rule ", |
| 5948 | __func__, (0 == lrc) ? "Timeout" : "Interrupt"); |
| 5949 | return (0 == lrc) ? -ETIMEDOUT : -EINTR; |
| 5950 | } |
| 5951 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: SUCCESS in setting strict FCC regulatory rule", __func__); |
| 5952 | |
| 5953 | break; |
| 5954 | } |
Tushnim Bhattacharyya | a3ba5a5 | 2014-01-30 11:37:33 -0800 | [diff] [blame] | 5955 | case WE_SET_DEBUG_LOG: |
| 5956 | { |
| 5957 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5958 | pHddCtx->cfg_ini->gEnableDebugLog = set_value; |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 5959 | if (hHal) |
| 5960 | sme_UpdateConnectDebug(pHddCtx->hHal, set_value); |
| 5961 | else |
| 5962 | ret = -1; |
Tushnim Bhattacharyya | a3ba5a5 | 2014-01-30 11:37:33 -0800 | [diff] [blame] | 5963 | break; |
| 5964 | } |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 5965 | #ifdef FEATURE_WLAN_TDLS |
| 5966 | case WE_SET_TDLS_OFF_CHAN: |
| 5967 | { |
| 5968 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5969 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Tdls offchannel num %d", |
| 5970 | __func__, set_value); |
| 5971 | ret = iw_set_tdlsoffchannel(pHddCtx, set_value); |
| 5972 | break; |
| 5973 | } |
| 5974 | case WE_SET_TDLS_SEC_OFF_CHAN_OFFSET: |
| 5975 | { |
| 5976 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 5977 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Tdls sec offchan offset %d", |
| 5978 | __func__, set_value); |
| 5979 | ret = iw_set_tdlssecoffchanneloffset(pHddCtx, set_value); |
| 5980 | break; |
| 5981 | } |
| 5982 | case WE_SET_TDLS_OFF_CHAN_MODE: |
| 5983 | { |
| 5984 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Tdls offchannel mode %d", |
| 5985 | __func__, set_value); |
| 5986 | ret = iw_set_tdlsoffchannelmode(pAdapter, set_value); |
| 5987 | break; |
| 5988 | } |
| 5989 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 5990 | case WE_SET_SCAN_BAND_PREFERENCE: |
| 5991 | { |
| 5992 | tSmeConfigParams smeConfig; |
| 5993 | memset(&smeConfig, 0x00, sizeof(smeConfig)); |
| 5994 | if(pAdapter->device_mode != WLAN_HDD_INFRA_STATION) { |
| 5995 | ret = -EINVAL; |
| 5996 | break; |
| 5997 | } |
| 5998 | hddLog(LOG1, "WE_SET_BAND_PREFERRENCE val %d ", set_value); |
| 5999 | |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 6000 | if ((eCSR_BAND_ALL == set_value || |
| 6001 | eCSR_BAND_24 == set_value || eCSR_BAND_5G == set_value) && |
| 6002 | (hHal)) { |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6003 | sme_GetConfigParam(hHal, &smeConfig); |
| 6004 | smeConfig.csrConfig.scanBandPreference = set_value; |
| 6005 | |
| 6006 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6007 | "set band scan preference = %d\n", |
| 6008 | smeConfig.csrConfig.scanBandPreference); |
| 6009 | |
| 6010 | sme_UpdateConfig(hHal, &smeConfig); |
| 6011 | } |
| 6012 | else { |
| 6013 | ret = -EINVAL; |
| 6014 | } |
| 6015 | break; |
| 6016 | } |
Abhishek Singh | 01c73d1 | 2015-03-12 15:13:44 +0530 | [diff] [blame] | 6017 | /* The WE_SET_MIRACAST_VENDOR_CONFIG IOCTL should be set before the |
| 6018 | * connection happens so that the params can take effect during |
| 6019 | * association. Also this should not be used in STA+p2p concurrency |
| 6020 | * as the param will also effect the STA mode. |
| 6021 | */ |
| 6022 | case WE_SET_MIRACAST_VENDOR_CONFIG: |
| 6023 | { |
| 6024 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kiet Lam | 46b8e4e | 2013-11-06 21:49:53 +0530 | [diff] [blame] | 6025 | |
Abhishek Singh | 01c73d1 | 2015-03-12 15:13:44 +0530 | [diff] [blame] | 6026 | hddLog(LOG1, FL( |
| 6027 | "Set Miracast vendor tuning %d"), set_value); |
| 6028 | |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 6029 | if (NULL == hHal) |
| 6030 | return -EINVAL; |
| 6031 | |
Abhishek Singh | 01c73d1 | 2015-03-12 15:13:44 +0530 | [diff] [blame] | 6032 | if (1 == set_value || 0 == set_value) |
| 6033 | { |
| 6034 | if (eHAL_STATUS_SUCCESS != sme_SetMiracastVendorConfig(pHddCtx->hHal, |
| 6035 | pHddCtx->cfg_ini->numBuffAdvert, set_value)) |
| 6036 | { |
| 6037 | hddLog( LOGE, FL("set vendor miracast config failed")); |
| 6038 | ret = -EIO; |
| 6039 | } |
| 6040 | } |
| 6041 | else |
| 6042 | { |
| 6043 | hddLog(LOGE, |
| 6044 | FL("Invalid value %d in WE_SET_MIRACAST_VENDOR_CONFIG IOCTL"), set_value); |
| 6045 | ret = -EINVAL; |
| 6046 | } |
Abhishek Singh | 01c73d1 | 2015-03-12 15:13:44 +0530 | [diff] [blame] | 6047 | break; |
| 6048 | } |
Siddharth Bhal | 678a934 | 2015-02-27 01:12:56 +0530 | [diff] [blame] | 6049 | |
| 6050 | case WE_GET_FRAME_LOG: |
| 6051 | { |
| 6052 | if (wlan_hdd_get_frame_logs(pAdapter, set_value) |
| 6053 | != VOS_STATUS_SUCCESS) |
| 6054 | { |
| 6055 | ret = -EINVAL; |
| 6056 | } |
| 6057 | break; |
| 6058 | } |
| 6059 | |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 6060 | case WE_SET_TDLS_2040_BSS_COEXISTENCE: |
| 6061 | { |
| 6062 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6063 | "%s: TDLS_2040_BSS_COEXISTENCE %d", __func__, set_value); |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 6064 | if ((set_value == 0 || set_value == 1) && (hHal)) |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 6065 | { |
| 6066 | sme_SetTdls2040BSSCoexistence(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6067 | set_value); |
| 6068 | } |
| 6069 | else |
| 6070 | ret = -EINVAL; |
| 6071 | |
| 6072 | break; |
| 6073 | } |
Abhishek Singh | 41988ba | 2015-05-25 19:42:29 +0530 | [diff] [blame] | 6074 | /* Bit mask value to enable RTS/CTS for different modes |
| 6075 | * for 2.4 GHz, HT20 - 0x0001, for 2.4 GHz, HT40 - 0x0002 |
| 6076 | * for 2.4 GHz, VHT20 - 0x0004, for 2.4 GHz, VHT40 - 0x0008 |
| 6077 | * for 5 GHz, HT20 - 0x0100, for 5 GHz, HT40 - 0x0200 |
| 6078 | * for 5 GHz, VHT20 - 0x0400, for 5 GHz, VHT40 - 0x0800 |
| 6079 | * for 5 GHz, VHT80 - 0x1000 |
| 6080 | */ |
| 6081 | case WE_SET_RTS_CTS_HTVHT: |
| 6082 | { |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 6083 | |
Abhishek Singh | 41988ba | 2015-05-25 19:42:29 +0530 | [diff] [blame] | 6084 | hddLog( LOG1, FL("WE_SET_RTS_CTS_HTVHT set value %d"), set_value); |
| 6085 | |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 6086 | if (NULL == hHal) |
| 6087 | return -EINVAL; |
| 6088 | |
Abhishek Singh | 41988ba | 2015-05-25 19:42:29 +0530 | [diff] [blame] | 6089 | if (eHAL_STATUS_SUCCESS != |
| 6090 | sme_SetRtsCtsHtVht( pHddCtx->hHal, set_value)) |
| 6091 | { |
| 6092 | hddLog( LOGE, FL("set WE_SET_RTS_CTS_HTVHT failed")); |
| 6093 | ret = -EINVAL; |
| 6094 | } |
| 6095 | break; |
| 6096 | } |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 6097 | case WE_SET_MONITOR_STATE: |
| 6098 | { |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6099 | tVOS_CON_MODE mode = hdd_get_conparam(); |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 6100 | int ret; |
| 6101 | void *cookie; |
| 6102 | struct hdd_request *request; |
| 6103 | static const struct hdd_request_params params = { |
| 6104 | .priv_size = 0, |
| 6105 | .timeout_ms = MON_MODE_MSG_TIMEOUT, |
| 6106 | }; |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6107 | |
| 6108 | if( VOS_MONITOR_MODE != mode) |
| 6109 | { |
| 6110 | hddLog(LOGE, "invalid mode %d", mode); |
| 6111 | ret = -EIO; |
Abhishek Singh | 10b209b | 2016-02-10 12:34:41 +0530 | [diff] [blame] | 6112 | break; |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6113 | } |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 6114 | |
| 6115 | pMonCtx = WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter); |
| 6116 | if( pMonCtx == NULL ) |
| 6117 | { |
| 6118 | hddLog(LOGE, "Monitor Context NULL"); |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6119 | ret = -EIO; |
Abhishek Singh | 10b209b | 2016-02-10 12:34:41 +0530 | [diff] [blame] | 6120 | break; |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6121 | } |
| 6122 | if (pMonCtx->state == set_value) |
| 6123 | { |
| 6124 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6125 | FL("already in same mode curr_mode:%d req_mode: %d"), |
| 6126 | pMonCtx->state, set_value); |
| 6127 | break; |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 6128 | } |
| 6129 | pMonCtx->state = set_value; |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 6130 | request = hdd_request_alloc(¶ms); |
| 6131 | if (!request) { |
| 6132 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 6133 | ret = -ENOMEM; |
| 6134 | break; |
| 6135 | } |
| 6136 | cookie = hdd_request_cookie(request); |
| 6137 | |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6138 | if (VOS_STATUS_SUCCESS != |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 6139 | wlan_hdd_mon_postMsg(cookie, pMonCtx, |
| 6140 | hdd_mon_post_msg_cb)) { |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6141 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6142 | FL("failed to post MON MODE REQ")); |
| 6143 | pMonCtx->state = (pMonCtx->state==MON_MODE_START)? |
| 6144 | MON_MODE_STOP : MON_MODE_START; |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6145 | ret = -EIO; |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 6146 | } else { |
| 6147 | ret = hdd_request_wait_for_response(request); |
| 6148 | if (ret) { |
| 6149 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6150 | FL("failed to wait on monitor mode completion %d"), |
| 6151 | ret); |
| 6152 | } |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6153 | } |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 6154 | hdd_request_put(request); |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 6155 | break; |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 6156 | } |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 6157 | case WE_SET_PKT_STATS_ENABLE_DISABLE: |
| 6158 | { |
| 6159 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6160 | tAniWifiStartLog start_log; |
| 6161 | if (!pHddCtx->cfg_ini->wlanPerPktStatsLogEnable || |
| 6162 | !vos_isPktStatsEnabled()) |
| 6163 | { |
| 6164 | hddLog(LOGE, FL("per pkt stats not enabled")); |
| 6165 | return -EINVAL; |
| 6166 | } |
| 6167 | hddLog(LOG1, FL("Set Pkt Stats %d"), set_value); |
| 6168 | |
| 6169 | if (1 == set_value || 0 == set_value) |
| 6170 | { |
| 6171 | start_log.ringId = RING_ID_PER_PACKET_STATS; |
| 6172 | start_log.flag = 0; |
| 6173 | if (set_value) |
| 6174 | start_log.verboseLevel = WLAN_LOG_LEVEL_ACTIVE; |
| 6175 | else |
| 6176 | start_log.verboseLevel = WLAN_LOG_LEVEL_OFF; |
| 6177 | |
| 6178 | vos_set_ring_log_level(start_log.ringId, start_log.verboseLevel); |
| 6179 | } |
| 6180 | else |
| 6181 | { |
| 6182 | hddLog(LOGE, |
| 6183 | FL("Invalid value %d in WE_SET_PKT_STATS_ENABLE_DISABLE IOCTL"), |
| 6184 | set_value); |
| 6185 | ret = -EINVAL; |
| 6186 | } |
| 6187 | break; |
| 6188 | } |
Hanumantha Reddy Pothula | 519a1ea | 2015-12-09 14:06:03 +0530 | [diff] [blame] | 6189 | case WE_SET_PROXIMITY_ENABLE: |
| 6190 | { |
Padma, Santhosh Kumar | 42511ea | 2016-10-17 17:30:41 +0530 | [diff] [blame] | 6191 | if (NULL == hHal) |
| 6192 | return -EINVAL; |
| 6193 | |
| 6194 | ret = wlan_hdd_set_proximity(set_value, hHal); |
Hanumantha Reddy Pothula | 519a1ea | 2015-12-09 14:06:03 +0530 | [diff] [blame] | 6195 | break; |
| 6196 | } |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 6197 | case WE_CAP_TSF: |
| 6198 | { |
| 6199 | if (NULL == hHal) |
| 6200 | return -EINVAL; |
| 6201 | |
| 6202 | ret = hdd_capture_tsf(pAdapter, (uint32_t *)&set_value, 1); |
| 6203 | break; |
| 6204 | } |
SaidiReddy Yenuga | 9c1a614 | 2017-02-06 16:30:04 +0530 | [diff] [blame] | 6205 | case WE_SET_MODULATED_DTIM: |
| 6206 | { |
| 6207 | if ((set_value < CFG_ENABLE_MODULATED_DTIM_MIN) || |
| 6208 | (set_value > CFG_ENABLE_MODULATED_DTIM_MAX)) { |
| 6209 | hddLog(LOGE, FL("Invalid value %d in gEnableModuleDTIM"), |
| 6210 | set_value); |
| 6211 | return -EINVAL; |
| 6212 | } else { |
| 6213 | ret = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini-> |
| 6214 | enableModulatedDTIM = set_value; |
| 6215 | } |
SaidiReddy Yenuga | c341fbf | 2017-02-01 20:22:45 +0530 | [diff] [blame] | 6216 | } |
| 6217 | case WLAN_SET_DYNNAMIC_AGGREGATION: |
| 6218 | { |
| 6219 | if (NULL == hHal) |
| 6220 | return -EINVAL; |
| 6221 | |
| 6222 | ret = hdd_set_dynamic_aggregation(set_value, pAdapter); |
SaidiReddy Yenuga | 9c1a614 | 2017-02-06 16:30:04 +0530 | [diff] [blame] | 6223 | break; |
| 6224 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6225 | default: |
| 6226 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6227 | hddLog(LOGE, "Invalid IOCTL setvalue command %d value %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6228 | sub_cmd, set_value); |
| 6229 | break; |
| 6230 | } |
| 6231 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6232 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6233 | return ret; |
| 6234 | } |
| 6235 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6236 | static int iw_setint_getnone(struct net_device *dev, |
| 6237 | struct iw_request_info *info, |
| 6238 | union iwreq_data *wrqu, char *extra) |
| 6239 | { |
| 6240 | int ret; |
| 6241 | |
| 6242 | vos_ssr_protect(__func__); |
| 6243 | ret = __iw_setint_getnone(dev, info, wrqu, extra); |
| 6244 | vos_ssr_unprotect(__func__); |
| 6245 | |
| 6246 | return 0; |
| 6247 | } |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 6248 | |
| 6249 | static |
| 6250 | int iw_mon_setint_getnone(struct net_device *dev, |
| 6251 | struct iw_request_info *info, |
| 6252 | union iwreq_data *wrqu, char *extra) |
| 6253 | { |
| 6254 | int ret; |
| 6255 | |
| 6256 | vos_ssr_protect(__func__); |
| 6257 | ret = __iw_mon_setint_getnone(dev, info, wrqu, extra); |
| 6258 | vos_ssr_unprotect(__func__); |
| 6259 | |
| 6260 | return 0; |
| 6261 | } |
| 6262 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6263 | /* set param sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6264 | static int __iw_setchar_getnone(struct net_device *dev, |
| 6265 | struct iw_request_info *info, |
| 6266 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6267 | { |
| 6268 | VOS_STATUS vstatus; |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 6269 | int sub_cmd; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6270 | int ret = 0; /* success */ |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 6271 | char *pBuffer = NULL; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6272 | hdd_adapter_t *pAdapter; |
| 6273 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6274 | #ifdef WLAN_FEATURE_VOWIFI |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6275 | hdd_config_t *pConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6276 | #endif /* WLAN_FEATURE_VOWIFI */ |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 6277 | struct iw_point s_priv_data; |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 6278 | tSirpkt80211 *pkt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6279 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6280 | ENTER(); |
Hanumantha Reddy Pothula | e60df52 | 2015-10-27 21:41:43 +0530 | [diff] [blame] | 6281 | |
| 6282 | if (!capable(CAP_NET_ADMIN)) |
| 6283 | { |
| 6284 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6285 | FL("permission check failed")); |
| 6286 | return -EPERM; |
| 6287 | } |
| 6288 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6289 | pAdapter = (netdev_priv(dev)); |
| 6290 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6291 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6292 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6293 | "%s: Adapter is NULL",__func__); |
| 6294 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6295 | } |
| 6296 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6297 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6298 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6299 | if (0 != ret) |
| 6300 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6301 | return ret; |
| 6302 | } |
| 6303 | #ifdef WLAN_FEATURE_VOWIFI |
| 6304 | pConfig = pHddCtx->cfg_ini; |
| 6305 | #endif |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 6306 | /* helper function to get iwreq_data with compat handling. */ |
| 6307 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 6308 | { |
| 6309 | return -EINVAL; |
| 6310 | } |
| 6311 | |
| 6312 | /* make sure all params are correctly passed to function */ |
| 6313 | if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) |
| 6314 | { |
| 6315 | return -EINVAL; |
| 6316 | } |
| 6317 | |
| 6318 | sub_cmd = s_priv_data.flags; |
| 6319 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 6320 | /* ODD number is used for set, copy data using copy_from_user */ |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 6321 | pBuffer = mem_alloc_copy_from_user_helper(s_priv_data.pointer, |
| 6322 | s_priv_data.length); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 6323 | if (NULL == pBuffer) |
| 6324 | { |
| 6325 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6326 | "mem_alloc_copy_from_user_helper fail"); |
| 6327 | return -ENOMEM; |
| 6328 | } |
| 6329 | |
| 6330 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 6331 | "%s: Received length %d", __func__, s_priv_data.length); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 6332 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6333 | "%s: Received data %s", __func__, pBuffer); |
| 6334 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6335 | switch(sub_cmd) |
| 6336 | { |
| 6337 | case WE_WOWL_ADD_PTRN: |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 6338 | if (wlan_hdd_check_monitor_state(pHddCtx)) { |
| 6339 | hddLog(LOGE, FL("wowlAddPtrn not allowed in STA + MON")); |
| 6340 | ret = -EOPNOTSUPP; |
| 6341 | break; |
| 6342 | } |
| 6343 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6344 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "ADD_PTRN"); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 6345 | hdd_add_wowl_ptrn(pAdapter, pBuffer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6346 | break; |
| 6347 | case WE_WOWL_DEL_PTRN: |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 6348 | if (wlan_hdd_check_monitor_state(pHddCtx)) { |
| 6349 | hddLog(LOGE, FL("wowlDelPtrn not allowed in STA + MON")); |
| 6350 | ret = -EOPNOTSUPP; |
| 6351 | break; |
| 6352 | } |
| 6353 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6354 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "DEL_PTRN"); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 6355 | hdd_del_wowl_ptrn(pAdapter, pBuffer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6356 | break; |
| 6357 | #if defined WLAN_FEATURE_VOWIFI |
| 6358 | case WE_NEIGHBOR_REPORT_REQUEST: |
| 6359 | { |
| 6360 | tRrmNeighborReq neighborReq; |
| 6361 | tRrmNeighborRspCallbackInfo callbackInfo; |
| 6362 | |
| 6363 | if (pConfig->fRrmEnable) |
| 6364 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6365 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Neighbor Request"); |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 6366 | neighborReq.no_ssid = (s_priv_data.length - 1) ? false : true ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6367 | if( !neighborReq.no_ssid ) |
| 6368 | { |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 6369 | neighborReq.ssid.length = (s_priv_data.length - 1) > 32 ? 32 : (s_priv_data.length - 1) ; |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 6370 | vos_mem_copy( neighborReq.ssid.ssId, pBuffer, neighborReq.ssid.length ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6371 | } |
| 6372 | |
| 6373 | callbackInfo.neighborRspCallback = NULL; |
| 6374 | callbackInfo.neighborRspCallbackContext = NULL; |
| 6375 | callbackInfo.timeout = 5000; //5 seconds |
| 6376 | sme_NeighborReportRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &neighborReq, &callbackInfo ); |
| 6377 | } |
| 6378 | else |
| 6379 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6380 | hddLog(LOGE, "%s: Ignoring neighbor request as RRM is not enabled", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6381 | ret = -EINVAL; |
| 6382 | } |
| 6383 | } |
| 6384 | break; |
| 6385 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6386 | case WE_SET_AP_WPS_IE: |
| 6387 | hddLog( LOGE, "Received WE_SET_AP_WPS_IE" ); |
Girish Gowli | 552fc07 | 2014-06-14 18:26:16 +0530 | [diff] [blame] | 6388 | sme_updateP2pIe( WLAN_HDD_GET_HAL_CTX(pAdapter), pBuffer, s_priv_data.length ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6389 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6390 | case WE_SET_CONFIG: |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 6391 | vstatus = hdd_execute_config_command(pHddCtx, pBuffer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6392 | if (VOS_STATUS_SUCCESS != vstatus) |
| 6393 | { |
| 6394 | ret = -EINVAL; |
| 6395 | } |
| 6396 | break; |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 6397 | case WE_SET_ENCRYPT_MSG: |
| 6398 | pkt = vos_mem_malloc(sizeof(tSirpkt80211)); |
| 6399 | if (NULL == pkt) |
| 6400 | { |
| 6401 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6402 | "%s: vos_mem_alloc failed", __func__); |
Abhishek Singh | 2b05585 | 2015-10-07 14:14:13 +0530 | [diff] [blame] | 6403 | ret = -ENOMEM; |
| 6404 | break; |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 6405 | } |
| 6406 | |
| 6407 | memset(pkt, 0, sizeof(tSirpkt80211)); |
| 6408 | |
| 6409 | if (FALSE == sme_IsFeatureSupportedByFW(DISA)) { |
| 6410 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6411 | FL("Firmware is not DISA capable")); |
| 6412 | ret = -EINVAL; |
| 6413 | vos_mem_free(pkt); |
| 6414 | break; |
| 6415 | } |
| 6416 | |
| 6417 | parse_Bufferforpkt(pkt, pBuffer, wrqu->data.length); |
| 6418 | |
| 6419 | ret = sme_Encryptmsgsend(pHddCtx->hHal, (u8 *)pkt, |
| 6420 | sizeof(tSirpkt80211), hdd_encrypt_msg_cb); |
| 6421 | if (eHAL_STATUS_SUCCESS != ret) { |
| 6422 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6423 | FL("SENDEncryptMSG: fail to post WDA cmd")); |
| 6424 | ret = -EINVAL; |
| 6425 | } |
| 6426 | vos_mem_free(pkt); |
| 6427 | |
| 6428 | break; |
| 6429 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6430 | default: |
| 6431 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6432 | hddLog(LOGE, "%s: Invalid sub command %d",__func__, sub_cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6433 | ret = -EINVAL; |
| 6434 | break; |
| 6435 | } |
| 6436 | } |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 6437 | kfree(pBuffer); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6438 | |
| 6439 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6440 | return ret; |
| 6441 | } |
| 6442 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6443 | static int iw_setchar_getnone(struct net_device *dev, |
| 6444 | struct iw_request_info *info, |
| 6445 | union iwreq_data *wrqu, char *extra) |
| 6446 | { |
| 6447 | int ret; |
| 6448 | |
| 6449 | vos_ssr_protect(__func__); |
| 6450 | ret = __iw_setchar_getnone(dev, info, wrqu, extra); |
| 6451 | vos_ssr_unprotect(__func__); |
| 6452 | |
| 6453 | return ret; |
| 6454 | } |
| 6455 | |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6456 | struct get_antenna_idx_priv { |
| 6457 | int antenna_id; |
| 6458 | }; |
| 6459 | |
| 6460 | static void hdd_get_current_antenna_index_cb(int antenna_id, void *context) |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6461 | { |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6462 | struct hdd_request *request; |
| 6463 | struct get_antenna_idx_priv *priv; |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6464 | |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6465 | request = hdd_request_get(context); |
| 6466 | if (!request) { |
| 6467 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Obsolete request")); |
| 6468 | return; |
| 6469 | } |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6470 | |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6471 | priv = hdd_request_priv(request); |
| 6472 | priv->antenna_id = antenna_id; |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6473 | |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6474 | hdd_request_complete(request); |
| 6475 | hdd_request_put(request); |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6476 | |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6477 | } |
| 6478 | |
| 6479 | static VOS_STATUS wlan_hdd_get_current_antenna_index(hdd_adapter_t *pAdapter, |
| 6480 | int *antennaIndex) |
| 6481 | { |
| 6482 | hdd_context_t *pHddCtx; |
| 6483 | eHalStatus halStatus; |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6484 | int ret; |
| 6485 | void *cookie; |
| 6486 | struct hdd_request *request; |
| 6487 | struct get_antenna_idx_priv *priv; |
| 6488 | static const struct hdd_request_params params = { |
| 6489 | .priv_size = sizeof(*priv), |
| 6490 | .timeout_ms = WLAN_WAIT_TIME_STATS, |
| 6491 | }; |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6492 | |
| 6493 | ENTER(); |
| 6494 | if (NULL == pAdapter) |
| 6495 | { |
| 6496 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 6497 | "%s: Invalid context, pAdapter", __func__); |
| 6498 | return VOS_STATUS_E_FAULT; |
| 6499 | } |
| 6500 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6501 | if (0 != (wlan_hdd_validate_context(pHddCtx))) |
| 6502 | { |
| 6503 | return VOS_STATUS_E_FAULT; |
| 6504 | } |
| 6505 | if (TRUE != sme_IsFeatureSupportedByFW(ANTENNA_DIVERSITY_SELECTION)) |
| 6506 | { |
| 6507 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6508 | "%s: ANTENNA_DIVERSITY_SELECTION is not supported by Firwmare", |
| 6509 | __func__); |
| 6510 | return VOS_STATUS_E_NOSUPPORT; |
| 6511 | } |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6512 | |
| 6513 | request = hdd_request_alloc(¶ms); |
| 6514 | if (!request) { |
| 6515 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 6516 | return VOS_STATUS_E_NOMEM; |
| 6517 | } |
| 6518 | cookie = hdd_request_cookie(request); |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6519 | |
| 6520 | halStatus = sme_GetCurrentAntennaIndex(pHddCtx->hHal, |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6521 | hdd_get_current_antenna_index_cb, |
| 6522 | cookie, pAdapter->sessionId); |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6523 | if (eHAL_STATUS_SUCCESS != halStatus) |
| 6524 | { |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6525 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Unable to retrieve Antenna Index", |
| 6526 | __func__); |
| 6527 | /* we'll returned a cached value below */ |
| 6528 | *antennaIndex = -1; |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6529 | } |
| 6530 | else |
| 6531 | { |
| 6532 | /* request was sent -- wait for the response */ |
Hanumanth Reddy Pothula | 543559a | 2018-05-02 13:06:40 +0530 | [diff] [blame] | 6533 | ret = hdd_request_wait_for_response(request); |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6534 | if (ret) |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6535 | { |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6536 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6537 | FL("SME timeout while retrieving Antenna Index")); |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6538 | *antennaIndex = -1; |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6539 | } |
| 6540 | else |
| 6541 | { |
| 6542 | priv = hdd_request_priv(request); |
| 6543 | pAdapter->antennaIndex = priv->antenna_id; |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6544 | } |
| 6545 | } |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6546 | |
Hanumanth Reddy Pothula | 308d99d | 2018-04-09 19:14:26 +0530 | [diff] [blame] | 6547 | if (*antennaIndex != -1) |
| 6548 | *antennaIndex = pAdapter->antennaIndex; |
| 6549 | |
| 6550 | /* |
| 6551 | * either we never sent a request, we sent a request and received a |
| 6552 | * response or we sent a request and timed out. Regardless we are |
| 6553 | * done with the request. |
| 6554 | */ |
| 6555 | hdd_request_put(request); |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6556 | |
| 6557 | EXIT(); |
| 6558 | return VOS_STATUS_SUCCESS; |
| 6559 | } |
| 6560 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6561 | /* get param sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6562 | static int __iw_setnone_getint(struct net_device *dev, |
| 6563 | struct iw_request_info *info, |
| 6564 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6565 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6566 | hdd_adapter_t *pAdapter; |
| 6567 | tHalHandle hHal; |
| 6568 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6569 | int *value = (int *)extra; |
| 6570 | int ret = 0; /* success */ |
| 6571 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6572 | ENTER(); |
| 6573 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6574 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6575 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6576 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6577 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6578 | "%s: Adapter is NULL",__func__); |
| 6579 | return -EINVAL; |
| 6580 | } |
| 6581 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6582 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6583 | if (0 != ret) |
| 6584 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6585 | return ret; |
| 6586 | } |
| 6587 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6588 | if (NULL == hHal) |
| 6589 | { |
| 6590 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6591 | "%s: Hal Context is NULL",__func__); |
| 6592 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6593 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6594 | |
| 6595 | switch (value[0]) |
| 6596 | { |
| 6597 | case WE_GET_11D_STATE: |
| 6598 | { |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 6599 | tSmeConfigParams smeConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6600 | sme_GetConfigParam(hHal,&smeConfig); |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 6601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6602 | *value = smeConfig.csrConfig.Is11dSupportEnabled; |
| 6603 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6604 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("11D state=%d!!"),*value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6605 | |
| 6606 | break; |
| 6607 | } |
| 6608 | |
| 6609 | case WE_IBSS_STATUS: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6610 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "****Return IBSS Status*****"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6611 | break; |
| 6612 | |
| 6613 | case WE_PMC_STATE: |
| 6614 | { |
| 6615 | *value = pmcGetPmcState(hHal); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6616 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("PMC state=%d!!"),*value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6617 | break; |
| 6618 | } |
| 6619 | case WE_GET_WLAN_DBG: |
| 6620 | { |
| 6621 | vos_trace_display(); |
| 6622 | *value = 0; |
| 6623 | break; |
| 6624 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6625 | case WE_GET_MAX_ASSOC: |
| 6626 | { |
| 6627 | if (ccmCfgGetInt(hHal, WNI_CFG_ASSOC_STA_LIMIT, (tANI_U32 *)value) != eHAL_STATUS_SUCCESS) |
| 6628 | { |
c_hpothu | b824544 | 2013-11-20 23:41:09 +0530 | [diff] [blame] | 6629 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 6630 | FL("failed to get ini parameter, WNI_CFG_ASSOC_STA_LIMIT")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6631 | ret = -EIO; |
| 6632 | } |
Girish Gowli | 385be61 | 2014-09-18 11:17:20 +0530 | [diff] [blame] | 6633 | #ifdef WLAN_SOFTAP_VSTA_FEATURE |
| 6634 | if (pHddCtx->cfg_ini->fEnableVSTASupport) |
| 6635 | { |
| 6636 | if (*value > VSTA_NUM_ASSOC_STA) |
| 6637 | { |
| 6638 | *value = VSTA_NUM_ASSOC_STA; |
| 6639 | } |
| 6640 | if ((pHddCtx->hddAdapters.count > VSTA_NUM_RESV_SELFSTA) && |
| 6641 | (*value > (VSTA_NUM_ASSOC_STA - |
| 6642 | (pHddCtx->hddAdapters.count - VSTA_NUM_RESV_SELFSTA)))) |
| 6643 | { |
| 6644 | *value = (VSTA_NUM_ASSOC_STA - |
| 6645 | (pHddCtx->hddAdapters.count - VSTA_NUM_RESV_SELFSTA)); |
| 6646 | } |
| 6647 | } |
| 6648 | else |
| 6649 | #endif |
| 6650 | { |
| 6651 | if (*value > NUM_ASSOC_STA) |
| 6652 | { |
| 6653 | *value = NUM_ASSOC_STA; |
| 6654 | } |
| 6655 | if ((pHddCtx->hddAdapters.count > NUM_RESV_SELFSTA) && |
| 6656 | (*value > (NUM_ASSOC_STA - |
| 6657 | (pHddCtx->hddAdapters.count - NUM_RESV_SELFSTA)))) |
| 6658 | { |
| 6659 | *value = (NUM_ASSOC_STA - |
| 6660 | (pHddCtx->hddAdapters.count - NUM_RESV_SELFSTA)); |
| 6661 | } |
| 6662 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6663 | break; |
| 6664 | } |
| 6665 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6666 | case WE_GET_WDI_DBG: |
| 6667 | { |
| 6668 | wpalTraceDisplay(); |
| 6669 | *value = 0; |
| 6670 | break; |
| 6671 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6672 | |
| 6673 | case WE_GET_SAP_AUTO_CHANNEL_SELECTION: |
| 6674 | { |
| 6675 | *value = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->apAutoChannelSelection; |
| 6676 | break; |
| 6677 | } |
| 6678 | case WE_GET_CONCURRENCY_MODE: |
| 6679 | { |
| 6680 | *value = hdd_get_concurrency_mode ( ); |
| 6681 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 6682 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, ("concurrency mode=%d"),*value); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6683 | break; |
| 6684 | } |
| 6685 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6686 | case WE_GET_SCAN_BAND_PREFERENCE: |
| 6687 | { |
Ratnam Rachuri | b5cffcd | 2015-10-13 18:18:21 +0530 | [diff] [blame] | 6688 | tSmeConfigParams smeConfig; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 6689 | sme_GetConfigParam(hHal, &smeConfig); |
| 6690 | *value = smeConfig.csrConfig.scanBandPreference; |
| 6691 | |
| 6692 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6693 | "scanBandPreference = %d\n", *value); |
| 6694 | break; |
| 6695 | } |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 6696 | case WE_GET_ANTENA_DIVERSITY_SELECTION: |
| 6697 | { |
| 6698 | wlan_hdd_get_current_antenna_index(pAdapter, value); |
| 6699 | break; |
| 6700 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6701 | default: |
| 6702 | { |
| 6703 | hddLog(LOGE, "Invalid IOCTL get_value command %d ",value[0]); |
| 6704 | break; |
| 6705 | } |
| 6706 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6707 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6708 | return ret; |
| 6709 | } |
| 6710 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6711 | static int iw_setnone_getint(struct net_device *dev, |
| 6712 | struct iw_request_info *info, |
| 6713 | union iwreq_data *wrqu, char *extra) |
| 6714 | { |
| 6715 | int ret; |
| 6716 | |
| 6717 | vos_ssr_protect(__func__); |
| 6718 | ret = __iw_setnone_getint(dev, info, wrqu, extra); |
| 6719 | vos_ssr_unprotect(__func__); |
| 6720 | |
| 6721 | return ret; |
| 6722 | |
| 6723 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6724 | /* set param sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6725 | int __iw_set_three_ints_getnone(struct net_device *dev, |
| 6726 | struct iw_request_info *info, |
| 6727 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6728 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6729 | hdd_adapter_t *pAdapter; |
| 6730 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6731 | int *value = (int *)extra; |
| 6732 | int sub_cmd = value[0]; |
| 6733 | int ret = 0; |
| 6734 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6735 | ENTER(); |
Hanumantha Reddy Pothula | d41fa69 | 2015-10-28 00:12:23 +0530 | [diff] [blame] | 6736 | |
| 6737 | if (!capable(CAP_NET_ADMIN)) |
| 6738 | { |
| 6739 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6740 | FL("permission check failed")); |
| 6741 | return -EPERM; |
| 6742 | } |
| 6743 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6744 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6745 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6746 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6747 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6748 | "%s: Adapter is NULL",__func__); |
| 6749 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6750 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6751 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6752 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6753 | if (0 != ret) |
| 6754 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6755 | return ret; |
| 6756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6757 | switch(sub_cmd) |
| 6758 | { |
| 6759 | case WE_SET_WLAN_DBG: |
| 6760 | { |
| 6761 | vos_trace_setValue( value[1], value[2], value[3]); |
| 6762 | break; |
| 6763 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6764 | case WE_SET_WDI_DBG: |
| 6765 | { |
| 6766 | wpalTraceSetLevel( value[1], value[2], value[3]); |
| 6767 | break; |
| 6768 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6769 | case WE_SET_SAP_CHANNELS: |
| 6770 | { |
| 6771 | ret = iw_softap_set_channel_range( dev, value[1], value[2], value[3]); |
| 6772 | break; |
| 6773 | } |
| 6774 | |
| 6775 | default: |
| 6776 | { |
Jeff Johnson | 11e7703 | 2014-02-14 13:22:22 -0800 | [diff] [blame] | 6777 | hddLog(LOGE, "%s: Invalid IOCTL command %d", __func__, sub_cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6778 | break; |
| 6779 | } |
| 6780 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6781 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6782 | return ret; |
| 6783 | } |
| 6784 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 6785 | int iw_set_three_ints_getnone(struct net_device *dev, |
| 6786 | struct iw_request_info *info, |
| 6787 | union iwreq_data *wrqu, char *extra) |
| 6788 | { |
| 6789 | int ret; |
| 6790 | |
| 6791 | vos_ssr_protect(__func__); |
| 6792 | ret = __iw_set_three_ints_getnone(dev, info, wrqu, extra); |
| 6793 | vos_ssr_unprotect(__func__); |
| 6794 | |
| 6795 | return ret; |
| 6796 | } |
| 6797 | |
| 6798 | static int __iw_get_char_setnone(struct net_device *dev, |
| 6799 | struct iw_request_info *info, |
| 6800 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6801 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6802 | hdd_adapter_t *pAdapter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6803 | int sub_cmd = wrqu->data.flags; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6804 | hdd_context_t *pHddCtx; |
| 6805 | int ret = 0; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6806 | #ifdef WLAN_FEATURE_11W |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 6807 | hdd_wext_state_t *pWextState; |
| 6808 | #endif |
| 6809 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6810 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6811 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 6812 | if (pAdapter == NULL) |
| 6813 | { |
| 6814 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6815 | "%s: pAdapter is NULL!", __func__); |
| 6816 | return -EINVAL; |
| 6817 | } |
Alok Kumar | 69a8b75 | 2017-11-08 15:24:32 +0530 | [diff] [blame] | 6818 | |
| 6819 | if (WLAN_HDD_MONITOR == pAdapter->device_mode || |
| 6820 | WLAN_HDD_FTM == pAdapter->device_mode) |
| 6821 | return ret; |
| 6822 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6823 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6824 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6825 | if (0 != ret) |
Yue Ma | 3ede605 | 2013-08-29 00:33:26 -0700 | [diff] [blame] | 6826 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6827 | return ret; |
| 6828 | } |
| 6829 | #ifdef WLAN_FEATURE_11W |
| 6830 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6831 | if (NULL == pWextState) |
| 6832 | { |
| 6833 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 6834 | "%s: pWextState is NULL",__func__); |
Yue Ma | 3ede605 | 2013-08-29 00:33:26 -0700 | [diff] [blame] | 6835 | return -EINVAL; |
| 6836 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 6837 | #endif |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 6838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6839 | switch(sub_cmd) |
| 6840 | { |
| 6841 | case WE_WLAN_VERSION: |
| 6842 | { |
Jeff Johnson | 4824d4c | 2013-02-12 14:23:57 -0800 | [diff] [blame] | 6843 | hdd_wlan_get_version(pAdapter, wrqu, extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6844 | break; |
| 6845 | } |
| 6846 | |
| 6847 | case WE_GET_STATS: |
| 6848 | { |
Sandeep Puligilla | 383bbfc | 2014-05-01 15:06:09 +0530 | [diff] [blame] | 6849 | tHalHandle hHal = NULL; |
| 6850 | tpAniSirGlobal pMac = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6851 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 6852 | hdd_tx_rx_stats_t *pStats = &pAdapter->hdd_stats.hddTxRxStats; |
| 6853 | hdd_chip_reset_stats_t *pResetStats = &pHddCtx->hddChipResetStats; |
Asodi T,Venkateswara Reddy | 55d27ae | 2017-01-19 11:44:54 +0530 | [diff] [blame] | 6854 | hdd_arp_stats_t *parpStats = &pAdapter->hdd_stats.hddArpStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6855 | |
Sandeep Puligilla | 383bbfc | 2014-05-01 15:06:09 +0530 | [diff] [blame] | 6856 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6857 | snprintf(extra, WE_MAX_STR_LEN, |
| 6858 | "\nTransmit" |
| 6859 | "\ncalled %u, dropped %u, backpressured %u, queued %u" |
| 6860 | "\n dropped BK %u, BE %u, VI %u, VO %u" |
| 6861 | "\n classified BK %u, BE %u, VI %u, VO %u" |
| 6862 | "\nbackpressured BK %u, BE %u, VI %u, VO %u" |
| 6863 | "\n queued BK %u, BE %u, VI %u, VO %u" |
| 6864 | "\nfetched %u, empty %u, lowres %u, deqerr %u" |
Ravi Joshi | 4191463 | 2013-10-21 23:02:21 -0700 | [diff] [blame] | 6865 | "\ndequeued %u, depressured %u, deque-depressured %u, completed %u, flushed %u" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6866 | "\n fetched BK %u, BE %u, VI %u, VO %u" |
| 6867 | "\n dequeued BK %u, BE %u, VI %u, VO %u" |
| 6868 | "\n depressured BK %u, BE %u, VI %u, VO %u" |
Ravi Joshi | 4191463 | 2013-10-21 23:02:21 -0700 | [diff] [blame] | 6869 | "\nDeque depressured BK %u, BE %u, VI %u, VO %u" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6870 | "\n flushed BK %u, BE %u, VI %u, VO %u" |
| 6871 | "\n\nReceive" |
| 6872 | "\nchains %u, packets %u, dropped %u, delivered %u, refused %u" |
| 6873 | "\n\nResetsStats" |
| 6874 | "\n TotalLogp %u Cmd53 %u MutexRead %u MIF-Error %u FW-Heartbeat %u Others %u" |
Asodi T,Venkateswara Reddy | 55d27ae | 2017-01-19 11:44:54 +0530 | [diff] [blame] | 6875 | "\n" |
| 6876 | "\n\nARP Transmit" |
| 6877 | "\nTransmit Count %u, dropped %u" |
| 6878 | "\n\nARP Receive" |
| 6879 | "\nReceive Count %u, dropped %u, Delivered %u, Refused %u, Drop Reason %u" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6880 | "\n", |
| 6881 | pStats->txXmitCalled, |
| 6882 | pStats->txXmitDropped, |
| 6883 | pStats->txXmitBackPressured, |
| 6884 | pStats->txXmitQueued, |
| 6885 | |
| 6886 | pStats->txXmitDroppedAC[WLANTL_AC_BK], |
| 6887 | pStats->txXmitDroppedAC[WLANTL_AC_BE], |
| 6888 | pStats->txXmitDroppedAC[WLANTL_AC_VI], |
| 6889 | pStats->txXmitDroppedAC[WLANTL_AC_VO], |
| 6890 | |
| 6891 | pStats->txXmitClassifiedAC[WLANTL_AC_BK], |
| 6892 | pStats->txXmitClassifiedAC[WLANTL_AC_BE], |
| 6893 | pStats->txXmitClassifiedAC[WLANTL_AC_VI], |
| 6894 | pStats->txXmitClassifiedAC[WLANTL_AC_VO], |
| 6895 | |
| 6896 | pStats->txXmitBackPressuredAC[WLANTL_AC_BK], |
| 6897 | pStats->txXmitBackPressuredAC[WLANTL_AC_BE], |
| 6898 | pStats->txXmitBackPressuredAC[WLANTL_AC_VI], |
| 6899 | pStats->txXmitBackPressuredAC[WLANTL_AC_VO], |
| 6900 | |
| 6901 | pStats->txXmitQueuedAC[WLANTL_AC_BK], |
| 6902 | pStats->txXmitQueuedAC[WLANTL_AC_BE], |
| 6903 | pStats->txXmitQueuedAC[WLANTL_AC_VI], |
| 6904 | pStats->txXmitQueuedAC[WLANTL_AC_VO], |
| 6905 | |
| 6906 | pStats->txFetched, |
| 6907 | pStats->txFetchEmpty, |
| 6908 | pStats->txFetchLowResources, |
| 6909 | pStats->txFetchDequeueError, |
| 6910 | |
| 6911 | pStats->txFetchDequeued, |
| 6912 | pStats->txFetchDePressured, |
Ravi Joshi | 4191463 | 2013-10-21 23:02:21 -0700 | [diff] [blame] | 6913 | pStats->txDequeDePressured, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6914 | pStats->txCompleted, |
| 6915 | pStats->txFlushed, |
| 6916 | |
| 6917 | pStats->txFetchedAC[WLANTL_AC_BK], |
| 6918 | pStats->txFetchedAC[WLANTL_AC_BE], |
| 6919 | pStats->txFetchedAC[WLANTL_AC_VI], |
| 6920 | pStats->txFetchedAC[WLANTL_AC_VO], |
| 6921 | |
| 6922 | pStats->txFetchDequeuedAC[WLANTL_AC_BK], |
| 6923 | pStats->txFetchDequeuedAC[WLANTL_AC_BE], |
| 6924 | pStats->txFetchDequeuedAC[WLANTL_AC_VI], |
| 6925 | pStats->txFetchDequeuedAC[WLANTL_AC_VO], |
| 6926 | |
| 6927 | pStats->txFetchDePressuredAC[WLANTL_AC_BK], |
| 6928 | pStats->txFetchDePressuredAC[WLANTL_AC_BE], |
| 6929 | pStats->txFetchDePressuredAC[WLANTL_AC_VI], |
| 6930 | pStats->txFetchDePressuredAC[WLANTL_AC_VO], |
| 6931 | |
Ravi Joshi | 4191463 | 2013-10-21 23:02:21 -0700 | [diff] [blame] | 6932 | pStats->txDequeDePressuredAC[WLANTL_AC_BK], |
| 6933 | pStats->txDequeDePressuredAC[WLANTL_AC_BE], |
| 6934 | pStats->txDequeDePressuredAC[WLANTL_AC_VI], |
| 6935 | pStats->txDequeDePressuredAC[WLANTL_AC_VO], |
| 6936 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6937 | pStats->txFlushedAC[WLANTL_AC_BK], |
| 6938 | pStats->txFlushedAC[WLANTL_AC_BE], |
| 6939 | pStats->txFlushedAC[WLANTL_AC_VI], |
| 6940 | pStats->txFlushedAC[WLANTL_AC_VO], |
| 6941 | |
| 6942 | pStats->rxChains, |
| 6943 | pStats->rxPackets, |
| 6944 | pStats->rxDropped, |
| 6945 | pStats->rxDelivered, |
| 6946 | pStats->rxRefused, |
| 6947 | |
| 6948 | pResetStats->totalLogpResets, |
| 6949 | pResetStats->totalCMD53Failures, |
| 6950 | pResetStats->totalMutexReadFailures, |
| 6951 | pResetStats->totalMIFErrorFailures, |
| 6952 | pResetStats->totalFWHearbeatFailures, |
Asodi T,Venkateswara Reddy | 55d27ae | 2017-01-19 11:44:54 +0530 | [diff] [blame] | 6953 | pResetStats->totalUnknownExceptions, |
| 6954 | |
| 6955 | parpStats->txCount, |
| 6956 | parpStats->txDropped, |
| 6957 | |
| 6958 | parpStats->rxCount, |
| 6959 | parpStats->rxDropped, |
| 6960 | parpStats->rxDelivered, |
| 6961 | parpStats->rxRefused, |
| 6962 | parpStats->reason |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6963 | ); |
Sandeep Puligilla | 383bbfc | 2014-05-01 15:06:09 +0530 | [diff] [blame] | 6964 | wrqu->data.length = strlen(extra); |
| 6965 | |
| 6966 | hHal = WLAN_HDD_GET_HAL_CTX( pAdapter ); |
| 6967 | |
| 6968 | if (hHal) |
| 6969 | pMac = PMAC_STRUCT( hHal ); |
| 6970 | |
| 6971 | if (pMac && (wrqu->data.length < WE_MAX_STR_LEN)) { |
| 6972 | __u32 pmmStatsLength = WE_MAX_STR_LEN - wrqu->data.length; |
| 6973 | snprintf(extra+wrqu->data.length, pmmStatsLength, |
Rajesh Babu Prathipati | 6aa7cb8 | 2014-06-02 09:56:59 +0530 | [diff] [blame] | 6974 | "\n BMPS sleepcnt %lld, BMPS awakecnt %lld" |
| 6975 | "\n BMPS sleepreqfailcnt %lld, BMPS wakeupreqfailcnt %lld" |
| 6976 | "\n IMPS sleepcnt %lld, IMPS awakecnt %lld" |
| 6977 | "\n IMPS sleepreqfailcnt %lld, IMPS wakeupreqfailcnt %lld, IMPS lasterr %lld" |
Sandeep Puligilla | 383bbfc | 2014-05-01 15:06:09 +0530 | [diff] [blame] | 6978 | "\n", |
| 6979 | pMac->pmm.BmpscntSleep, |
| 6980 | pMac->pmm.BmpscntAwake, |
| 6981 | pMac->pmm.BmpsSleeReqFailCnt, |
| 6982 | pMac->pmm.BmpsWakeupReqFailCnt, |
| 6983 | pMac->pmm.ImpsCntSleep, |
| 6984 | pMac->pmm.ImpsCntAwake, |
| 6985 | pMac->pmm.ImpsSleepErrCnt, |
| 6986 | pMac->pmm.ImpsWakeupErrCnt, |
| 6987 | pMac->pmm.ImpsLastErr |
| 6988 | ); |
| 6989 | } |
| 6990 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6991 | wrqu->data.length = strlen(extra)+1; |
| 6992 | break; |
| 6993 | } |
| 6994 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 6995 | /* The case prints the current state of the HDD, SME, CSR, PE, TL |
| 6996 | *it can be extended for WDI Global State as well. |
| 6997 | *And currently it only checks P2P_CLIENT adapter. |
| 6998 | *P2P_DEVICE and P2P_GO have not been added as of now. |
| 6999 | */ |
| 7000 | case WE_GET_STATES: |
| 7001 | { |
| 7002 | int buf = 0, len = 0; |
| 7003 | int adapter_num = 0; |
| 7004 | int count = 0, check = 1; |
| 7005 | |
| 7006 | tANI_U16 tlState; |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7007 | tHalHandle hHal = NULL; |
| 7008 | tpAniSirGlobal pMac = NULL; |
| 7009 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7010 | |
| 7011 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 7012 | hdd_adapter_t *useAdapter = NULL; |
| 7013 | |
| 7014 | /* Print wlan0 or p2p0 states based on the adapter_num |
| 7015 | *by using the correct adapter |
| 7016 | */ |
| 7017 | while ( adapter_num < 2 ) |
| 7018 | { |
| 7019 | if ( WLAN_ADAPTER == adapter_num ) |
| 7020 | { |
| 7021 | useAdapter = pAdapter; |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7022 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7023 | "\n\n wlan0 States:-"); |
| 7024 | len += buf; |
| 7025 | } |
| 7026 | else if ( P2P_ADAPTER == adapter_num ) |
| 7027 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7028 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7029 | "\n\n p2p0 States:-"); |
| 7030 | len += buf; |
| 7031 | |
| 7032 | if( !pHddCtx ) |
| 7033 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7034 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7035 | "\n pHddCtx is NULL"); |
| 7036 | len += buf; |
| 7037 | break; |
| 7038 | } |
| 7039 | |
| 7040 | /*Printing p2p0 states only in the case when the device is |
| 7041 | configured as a p2p_client*/ |
| 7042 | useAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_CLIENT); |
| 7043 | if ( !useAdapter ) |
| 7044 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7045 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7046 | "\n Device not configured as P2P_CLIENT."); |
| 7047 | len += buf; |
| 7048 | break; |
| 7049 | } |
| 7050 | } |
| 7051 | |
| 7052 | hHal = WLAN_HDD_GET_HAL_CTX( useAdapter ); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7053 | if (!hHal) { |
| 7054 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 7055 | "\n pMac is NULL"); |
| 7056 | len += buf; |
| 7057 | break; |
| 7058 | } |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7059 | pMac = PMAC_STRUCT( hHal ); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7060 | if (!pMac) { |
| 7061 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 7062 | "\n pMac is NULL"); |
| 7063 | len += buf; |
| 7064 | break; |
| 7065 | } |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7066 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR( useAdapter ); |
| 7067 | if( !pHddStaCtx ) |
| 7068 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7069 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7070 | "\n pHddStaCtx is NULL"); |
| 7071 | len += buf; |
| 7072 | break; |
| 7073 | } |
| 7074 | |
| 7075 | tlState = smeGetTLSTAState(hHal, pHddStaCtx->conn_info.staId[0]); |
| 7076 | |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7077 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7078 | "\n HDD Conn State - %s " |
| 7079 | "\n \n SME State:" |
| 7080 | "\n Neighbour Roam State - %s" |
| 7081 | "\n CSR State - %s" |
| 7082 | "\n CSR Substate - %s" |
| 7083 | "\n \n TL STA %d State: %s", |
| 7084 | macTraceGetHDDWlanConnState( |
| 7085 | pHddStaCtx->conn_info.connState), |
| 7086 | macTraceGetNeighbourRoamState( |
| 7087 | pMac->roam.neighborRoamInfo.neighborRoamState), |
| 7088 | macTraceGetcsrRoamState( |
| 7089 | pMac->roam.curState[useAdapter->sessionId]), |
| 7090 | macTraceGetcsrRoamSubState( |
| 7091 | pMac->roam.curSubState[useAdapter->sessionId]), |
| 7092 | pHddStaCtx->conn_info.staId[0], |
| 7093 | macTraceGetTLState(tlState) |
| 7094 | ); |
| 7095 | len += buf; |
| 7096 | adapter_num++; |
| 7097 | } |
| 7098 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7099 | if (pMac) { |
| 7100 | /* Printing Lim State starting with global lim states */ |
| 7101 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 7102 | "\n \n LIM STATES:-" |
| 7103 | "\n Global Sme State - %s "\ |
| 7104 | "\n Global mlm State - %s "\ |
| 7105 | "\n", |
| 7106 | macTraceGetLimSmeState(pMac->lim.gLimSmeState), |
| 7107 | macTraceGetLimMlmState(pMac->lim.gLimMlmState) |
| 7108 | ); |
| 7109 | len += buf; |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7110 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7111 | /*printing the PE Sme and Mlm states for valid lim sessions*/ |
Hanumantha Reddy Pothula | 21ecc30 | 2015-07-27 16:23:46 +0530 | [diff] [blame] | 7112 | while ( check < 3 && count < pMac->lim.maxBssId) |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7113 | { |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7114 | if ( pMac->lim.gpSession[count].valid ) |
| 7115 | { |
| 7116 | buf = scnprintf(extra + len, WE_MAX_STR_LEN - len, |
| 7117 | "\n Lim Valid Session %d:-" |
| 7118 | "\n PE Sme State - %s " |
| 7119 | "\n PE Mlm State - %s " |
| 7120 | "\n", |
| 7121 | check, |
| 7122 | macTraceGetLimSmeState(pMac->lim.gpSession[count].limSmeState), |
| 7123 | macTraceGetLimMlmState(pMac->lim.gpSession[count].limMlmState) |
| 7124 | ); |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7125 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7126 | len += buf; |
| 7127 | check++; |
| 7128 | } |
| 7129 | count++; |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7130 | } |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7131 | } |
| 7132 | |
| 7133 | wrqu->data.length = strlen(extra)+1; |
| 7134 | break; |
| 7135 | } |
| 7136 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7137 | case WE_GET_CFG: |
| 7138 | { |
| 7139 | hdd_cfg_get_config(WLAN_HDD_GET_CTX(pAdapter), extra, WE_MAX_STR_LEN); |
| 7140 | wrqu->data.length = strlen(extra)+1; |
| 7141 | break; |
| 7142 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7143 | #ifdef WLAN_FEATURE_11AC |
| 7144 | case WE_GET_RSSI: |
| 7145 | { |
| 7146 | v_S7_t s7Rssi = 0; |
Hanumantha Reddy Pothula | dce6674 | 2015-08-25 18:08:44 +0530 | [diff] [blame] | 7147 | wlan_hdd_get_station_stats(pAdapter); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7148 | wlan_hdd_get_rssi(pAdapter, &s7Rssi); |
| 7149 | snprintf(extra, WE_MAX_STR_LEN, "rssi=%d",s7Rssi); |
| 7150 | wrqu->data.length = strlen(extra)+1; |
| 7151 | break; |
| 7152 | } |
| 7153 | #endif |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7154 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7155 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 7156 | case WE_GET_ROAM_RSSI: |
| 7157 | { |
| 7158 | v_S7_t s7Rssi = 0; |
| 7159 | wlan_hdd_get_roam_rssi(pAdapter, &s7Rssi); |
| 7160 | snprintf(extra, WE_MAX_STR_LEN, "rssi=%d", s7Rssi); |
| 7161 | wrqu->data.length = strlen(extra)+1; |
| 7162 | break; |
| 7163 | } |
| 7164 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7165 | case WE_GET_WMM_STATUS: |
| 7166 | { |
| 7167 | snprintf(extra, WE_MAX_STR_LEN, |
| 7168 | "\nDir: 0=up, 1=down, 3=both\n" |
| 7169 | "|------------------------|\n" |
| 7170 | "|AC | ACM |Admitted| Dir |\n" |
| 7171 | "|------------------------|\n" |
| 7172 | "|VO | %d | %3s | %d |\n" |
| 7173 | "|VI | %d | %3s | %d |\n" |
| 7174 | "|BE | %d | %3s | %d |\n" |
| 7175 | "|BK | %d | %3s | %d |\n" |
| 7176 | "|------------------------|\n", |
| 7177 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessRequired, |
| 7178 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcAccessAllowed?"YES":"NO", |
| 7179 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VO].wmmAcTspecInfo.ts_info.direction, |
| 7180 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessRequired, |
| 7181 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcAccessAllowed?"YES":"NO", |
| 7182 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_VI].wmmAcTspecInfo.ts_info.direction, |
| 7183 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessRequired, |
| 7184 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcAccessAllowed?"YES":"NO", |
| 7185 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BE].wmmAcTspecInfo.ts_info.direction, |
| 7186 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessRequired, |
| 7187 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcAccessAllowed?"YES":"NO", |
| 7188 | pAdapter->hddWmmStatus.wmmAcStatus[WLANTL_AC_BK].wmmAcTspecInfo.ts_info.direction); |
| 7189 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7190 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7191 | wrqu->data.length = strlen(extra)+1; |
| 7192 | break; |
| 7193 | } |
| 7194 | case WE_GET_CHANNEL_LIST: |
| 7195 | { |
| 7196 | VOS_STATUS status; |
| 7197 | v_U8_t i, len; |
| 7198 | char* buf ; |
Sushant Kaushik | 10315f9 | 2014-04-29 11:30:25 +0530 | [diff] [blame] | 7199 | tANI_U8 pBuf[COUNTRY_CODE_LEN]; |
| 7200 | tANI_U8 uBufLen = COUNTRY_CODE_LEN; |
| 7201 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7202 | tChannelListInfo channel_list; |
| 7203 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7204 | memset(&channel_list, 0, sizeof(channel_list)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7205 | status = iw_softap_get_channel_list(dev, info, wrqu, (char *)&channel_list); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 7206 | if ( !VOS_IS_STATUS_SUCCESS( status ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7207 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7208 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s GetChannelList Failed!!!",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7209 | return -EINVAL; |
| 7210 | } |
| 7211 | buf = extra; |
| 7212 | |
| 7213 | /** |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7214 | * Maximum channels = WNI_CFG_VALID_CHANNEL_LIST_LEN. Maximum buffer |
| 7215 | * needed = 5 * number of channels. Check ifsufficient |
| 7216 | * buffer is available and then proceed to fill the buffer. |
| 7217 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7218 | if(WE_MAX_STR_LEN < (5 * WNI_CFG_VALID_CHANNEL_LIST_LEN)) |
| 7219 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7220 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7221 | "%s Insufficient Buffer to populate channel list", |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7222 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7223 | return -EINVAL; |
| 7224 | } |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7225 | len = scnprintf(buf, WE_MAX_STR_LEN, "%u ", |
| 7226 | channel_list.num_channels); |
Sushant Kaushik | 10315f9 | 2014-04-29 11:30:25 +0530 | [diff] [blame] | 7227 | if( eHAL_STATUS_SUCCESS == sme_GetCountryCode(pHddCtx->hHal, pBuf, &uBufLen)) |
| 7228 | { |
| 7229 | //Printing Country code in getChannelList |
| 7230 | for(i= 0; i < COUNTRY_CODE_LEN; i++) |
| 7231 | { |
| 7232 | len += scnprintf(buf + len, WE_MAX_STR_LEN - len, |
| 7233 | "%c ", pBuf[i]); |
| 7234 | } |
| 7235 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7236 | for(i = 0 ; i < channel_list.num_channels; i++) |
| 7237 | { |
Sameer Thalappil | b0a3023 | 2013-09-27 15:37:48 -0700 | [diff] [blame] | 7238 | len += scnprintf(buf + len, WE_MAX_STR_LEN - len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7239 | "%u ", channel_list.channels[i]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7240 | } |
| 7241 | wrqu->data.length = strlen(extra)+1; |
| 7242 | |
| 7243 | break; |
| 7244 | } |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 7245 | #ifdef FEATURE_WLAN_TDLS |
| 7246 | case WE_GET_TDLS_PEERS: |
| 7247 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 7248 | 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] | 7249 | break; |
| 7250 | } |
| 7251 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7252 | #ifdef WLAN_FEATURE_11W |
| 7253 | case WE_GET_11W_INFO: |
| 7254 | { |
| 7255 | hddLog(LOGE, "WE_GET_11W_ENABLED = %d", pWextState->roamProfile.MFPEnabled ); |
| 7256 | |
| 7257 | snprintf(extra, WE_MAX_STR_LEN, |
| 7258 | "\n BSSID %02X:%02X:%02X:%02X:%02X:%02X, Is PMF Assoc? %d" |
| 7259 | "\n Number of Unprotected Disassocs %d" |
| 7260 | "\n Number of Unprotected Deauths %d", |
| 7261 | (*pWextState->roamProfile.BSSIDs.bssid)[0], (*pWextState->roamProfile.BSSIDs.bssid)[1], |
| 7262 | (*pWextState->roamProfile.BSSIDs.bssid)[2], (*pWextState->roamProfile.BSSIDs.bssid)[3], |
| 7263 | (*pWextState->roamProfile.BSSIDs.bssid)[4], (*pWextState->roamProfile.BSSIDs.bssid)[5], |
| 7264 | pWextState->roamProfile.MFPEnabled, pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx, |
| 7265 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx); |
| 7266 | |
| 7267 | wrqu->data.length = strlen(extra)+1; |
| 7268 | break; |
| 7269 | } |
| 7270 | #endif |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 7271 | #ifdef WLAN_FEATURE_RMC |
| 7272 | case WE_GET_IBSS_STA_INFO: |
| 7273 | { |
| 7274 | hdd_station_ctx_t *pHddStaCtx = |
| 7275 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7276 | int idx = 0; |
| 7277 | int length = 0, buf = 0; |
| 7278 | |
| 7279 | for (idx = 0; idx < HDD_MAX_NUM_IBSS_STA; idx++) |
| 7280 | { |
| 7281 | if (0 != pHddStaCtx->conn_info.staId[ idx ]) |
| 7282 | { |
| 7283 | buf = snprintf |
| 7284 | ( |
| 7285 | (extra + length), WE_MAX_STR_LEN - length, |
| 7286 | "\n%d .%02x:%02x:%02x:%02x:%02x:%02x\n", |
| 7287 | pHddStaCtx->conn_info.staId[ idx ], |
| 7288 | pHddStaCtx->conn_info.peerMacAddress[idx].bytes[0], |
| 7289 | pHddStaCtx->conn_info.peerMacAddress[idx].bytes[1], |
| 7290 | pHddStaCtx->conn_info.peerMacAddress[idx].bytes[2], |
| 7291 | pHddStaCtx->conn_info.peerMacAddress[idx].bytes[3], |
| 7292 | pHddStaCtx->conn_info.peerMacAddress[idx].bytes[4], |
| 7293 | pHddStaCtx->conn_info.peerMacAddress[idx].bytes[5] |
| 7294 | ); |
| 7295 | length += buf; |
| 7296 | } |
| 7297 | } |
| 7298 | wrqu->data.length = strlen(extra)+1; |
| 7299 | break; |
| 7300 | } |
| 7301 | #endif |
Girish Gowli | dab72f1 | 2014-09-04 15:34:43 +0530 | [diff] [blame] | 7302 | case WE_GET_SNR: |
| 7303 | { |
| 7304 | v_S7_t s7snr = 0; |
| 7305 | int status = 0; |
| 7306 | hdd_context_t *pHddCtx; |
| 7307 | hdd_station_ctx_t *pHddStaCtx; |
| 7308 | |
| 7309 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7310 | status = wlan_hdd_validate_context(pHddCtx); |
| 7311 | if (0 != status) |
| 7312 | { |
Girish Gowli | dab72f1 | 2014-09-04 15:34:43 +0530 | [diff] [blame] | 7313 | return status; |
| 7314 | } |
| 7315 | |
| 7316 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7317 | |
| 7318 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
| 7319 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 7320 | { |
| 7321 | hddLog(LOGE, "%s: getSNR failed: Enable SNR Monitoring-%d," |
| 7322 | " ConnectionState-%d", __func__, |
| 7323 | pHddCtx->cfg_ini->fEnableSNRMonitoring, |
| 7324 | pHddStaCtx->conn_info.connState); |
| 7325 | return -ENONET; |
| 7326 | } |
| 7327 | |
| 7328 | /*update the stats in TL*/ |
| 7329 | wlan_hdd_get_station_stats(pAdapter); |
| 7330 | wlan_hdd_get_snr(pAdapter, &s7snr); |
| 7331 | snprintf(extra, WE_MAX_STR_LEN, "snr=%d",s7snr); |
| 7332 | wrqu->data.length = strlen(extra) + 1; |
| 7333 | break; |
| 7334 | } |
| 7335 | |
Padma, Santhosh Kumar | 8dcdb70 | 2015-10-20 14:06:21 +0530 | [diff] [blame] | 7336 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 7337 | case WE_GET_OEM_DATA_CAP: |
| 7338 | { |
| 7339 | return iw_get_oem_data_cap(dev, info, wrqu, extra); |
| 7340 | } |
| 7341 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
| 7342 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7343 | default: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7344 | { |
Jeff Johnson | 11e7703 | 2014-02-14 13:22:22 -0800 | [diff] [blame] | 7345 | hddLog(LOGE, "%s: Invalid IOCTL command %d", __func__, sub_cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7346 | break; |
| 7347 | } |
| 7348 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7349 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7350 | return 0; |
| 7351 | } |
| 7352 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7353 | static int iw_get_char_setnone(struct net_device *dev, |
| 7354 | struct iw_request_info *info, |
| 7355 | union iwreq_data *wrqu, char *extra) |
| 7356 | { |
| 7357 | int ret; |
| 7358 | |
| 7359 | vos_ssr_protect(__func__); |
| 7360 | ret = __iw_get_char_setnone(dev, info, wrqu, extra); |
| 7361 | vos_ssr_unprotect(__func__); |
| 7362 | |
| 7363 | return ret; |
| 7364 | } |
| 7365 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7366 | /* action sub-ioctls */ |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7367 | static int __iw_setnone_getnone(struct net_device *dev, |
| 7368 | struct iw_request_info *info, |
| 7369 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7370 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 7371 | hdd_adapter_t *pAdapter; |
| 7372 | hdd_context_t *pHddCtx; |
Girish Gowli | baf3f2b | 2014-06-14 18:02:54 +0530 | [diff] [blame] | 7373 | int sub_cmd; |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 7374 | int ret = 0; /* success */ |
Girish Gowli | baf3f2b | 2014-06-14 18:02:54 +0530 | [diff] [blame] | 7375 | struct iw_point s_priv_data; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7376 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7377 | ENTER(); |
| 7378 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 7379 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7380 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7381 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 7382 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7383 | "%s: Adapter is NULL",__func__); |
| 7384 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7385 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 7386 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7387 | ret = wlan_hdd_validate_context(pHddCtx); |
| 7388 | if (0 != ret) |
| 7389 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 7390 | return ret; |
| 7391 | } |
Girish Gowli | baf3f2b | 2014-06-14 18:02:54 +0530 | [diff] [blame] | 7392 | /* helper function to get iwreq_data with compat handling. */ |
| 7393 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 7394 | { |
| 7395 | return -EINVAL; |
| 7396 | } |
| 7397 | |
| 7398 | sub_cmd = s_priv_data.flags; |
| 7399 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7400 | switch (sub_cmd) |
| 7401 | { |
| 7402 | case WE_CLEAR_STATS: |
| 7403 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7404 | 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] | 7405 | memset(&pAdapter->stats, 0, sizeof(pAdapter->stats)); |
| 7406 | memset(&pAdapter->hdd_stats, 0, sizeof(pAdapter->hdd_stats)); |
| 7407 | break; |
| 7408 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7409 | case WE_INIT_AP: |
| 7410 | { |
Abhishek Singh | 98d2f80 | 2014-02-10 15:47:55 +0530 | [diff] [blame] | 7411 | /*FIX ME: Need to be revisited if multiple SAPs to be supported */ |
| 7412 | |
| 7413 | /* As Soft AP mode might been changed to STA already with |
| 7414 | * killing of Hostapd, need to find the adpater by name |
| 7415 | * rather than mode */ |
| 7416 | hdd_adapter_t* pAdapter_to_stop = |
| 7417 | hdd_get_adapter_by_name(WLAN_HDD_GET_CTX(pAdapter), "softap.0"); |
| 7418 | if( pAdapter_to_stop ) |
| 7419 | { |
| 7420 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7421 | "Adapter with name softap.0 already " |
| 7422 | "exist, ignoring the request.\nRemove the " |
| 7423 | "adapter and try again\n"); |
| 7424 | break; |
| 7425 | } |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 7426 | |
| 7427 | if (wlan_hdd_check_monitor_state(pHddCtx)) { |
| 7428 | hddLog(LOGE, FL("initAP not allowed in STA + MON")); |
| 7429 | ret = -EOPNOTSUPP; |
| 7430 | break; |
| 7431 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7432 | pr_info("Init AP trigger\n"); |
| 7433 | hdd_open_adapter( WLAN_HDD_GET_CTX(pAdapter), WLAN_HDD_SOFTAP, "softap.%d", |
| 7434 | wlan_hdd_get_intf_addr( WLAN_HDD_GET_CTX(pAdapter) ),TRUE); |
| 7435 | break; |
| 7436 | } |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 7437 | #ifdef WLAN_FEATURE_RMC |
| 7438 | case WE_IBSS_GET_PEER_INFO_ALL: |
| 7439 | { |
| 7440 | hdd_wlan_get_ibss_peer_info_all(pAdapter); |
| 7441 | break; |
| 7442 | } |
| 7443 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7444 | case WE_STOP_AP: |
| 7445 | { |
| 7446 | /*FIX ME: Need to be revisited if multiple SAPs to be supported */ |
| 7447 | /* As Soft AP mode has been changed to STA already with killing of Hostapd, |
| 7448 | * this is a dead code and need to find the adpater by name rather than mode */ |
| 7449 | hdd_adapter_t* pAdapter_to_stop = |
| 7450 | hdd_get_adapter_by_name(WLAN_HDD_GET_CTX(pAdapter), "softap.0"); |
| 7451 | if( pAdapter_to_stop ) |
| 7452 | { |
| 7453 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7454 | |
| 7455 | pr_info("Stopping AP mode\n"); |
| 7456 | |
Gopichand Nakkala | fe7246d | 2013-06-10 17:43:37 +0530 | [diff] [blame] | 7457 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 7458 | { |
| 7459 | /* EXIT BMPS as fw cannot handle DEL_STA when its in BMPS */ |
| 7460 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE); |
| 7461 | } |
| 7462 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7463 | /*Make sure that pAdapter cleaned properly*/ |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 7464 | hdd_stop_adapter( pHddCtx, pAdapter_to_stop, VOS_TRUE ); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 7465 | hdd_deinit_adapter( pHddCtx, pAdapter_to_stop, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7466 | memset(&pAdapter_to_stop->sessionCtx, 0, sizeof(pAdapter_to_stop->sessionCtx)); |
| 7467 | |
| 7468 | wlan_hdd_release_intf_addr(WLAN_HDD_GET_CTX(pAdapter), |
| 7469 | pAdapter_to_stop->macAddressCurrent.bytes); |
| 7470 | hdd_close_adapter(WLAN_HDD_GET_CTX(pAdapter), pAdapter_to_stop, |
| 7471 | TRUE); |
Gopichand Nakkala | fe7246d | 2013-06-10 17:43:37 +0530 | [diff] [blame] | 7472 | |
| 7473 | if (FALSE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 7474 | { |
| 7475 | /* put the device back into BMPS */ |
| 7476 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO); |
| 7477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7478 | } |
| 7479 | else |
| 7480 | { |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 7481 | printk(KERN_ERR"SAP adapter not found to stop it!\n"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7482 | } |
| 7483 | |
| 7484 | break; |
| 7485 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7486 | #ifdef WLAN_BTAMP_FEATURE |
| 7487 | case WE_ENABLE_AMP: |
| 7488 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7489 | 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] | 7490 | WLANBAP_RegisterWithHCI(pAdapter); |
| 7491 | break; |
| 7492 | } |
| 7493 | case WE_DISABLE_AMP: |
| 7494 | { |
| 7495 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 7496 | VOS_STATUS status; |
| 7497 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7498 | 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] | 7499 | |
| 7500 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 7501 | status = WLANBAP_StopAmp(); |
| 7502 | if(VOS_STATUS_SUCCESS != status ) |
| 7503 | { |
| 7504 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 7505 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 7506 | "%s: Failed to stop AMP", __func__); |
| 7507 | } |
| 7508 | else |
| 7509 | { |
| 7510 | //a state m/c implementation in PAL is TBD to avoid this delay |
| 7511 | msleep(500); |
| 7512 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 7513 | WLANBAP_DeregisterFromHCI(); |
| 7514 | } |
| 7515 | |
| 7516 | break; |
| 7517 | } |
| 7518 | #endif |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 7519 | case WE_ENABLE_DXE_STALL_DETECT: |
| 7520 | { |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 7521 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7522 | sme_transportDebug(hHal, VOS_FALSE, VOS_TRUE); |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 7523 | break; |
| 7524 | } |
| 7525 | case WE_DISPLAY_DXE_SNAP_SHOT: |
| 7526 | { |
schang | 6295e54 | 2013-03-12 15:31:23 -0700 | [diff] [blame] | 7527 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7528 | sme_transportDebug(hHal, VOS_TRUE, VOS_FALSE); |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 7529 | break; |
| 7530 | } |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7531 | case WE_DISPLAY_DATAPATH_SNAP_SHOT: |
| 7532 | { |
| 7533 | hddLog(LOGE, "%s: called %d",__func__, sub_cmd); |
| 7534 | hdd_wmm_tx_snapshot(pAdapter); |
Mihir Shete | 327c2ab | 2014-11-13 15:17:02 +0530 | [diff] [blame] | 7535 | WLANTL_TLDebugMessage(WLANTL_DEBUG_TX_SNAPSHOT); |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7536 | break; |
| 7537 | } |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 7538 | |
Sandeep Puligilla | a3e7695 | 2014-06-23 15:53:11 +0530 | [diff] [blame] | 7539 | case WE_SET_REASSOC_TRIGGER: |
| 7540 | { |
| 7541 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7542 | tpAniSirGlobal pMac = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7543 | v_U32_t roamId = 0; |
| 7544 | tCsrRoamModifyProfileFields modProfileFields; |
AnjaneeDevi Kapparapu | 228d0c5 | 2015-11-09 12:32:21 +0530 | [diff] [blame] | 7545 | sme_GetModifyProfileFields(pMac, pAdapter->sessionId, &modProfileFields); |
| 7546 | sme_RoamReassoc(pMac, pAdapter->sessionId, NULL, modProfileFields, &roamId, 1); |
Sandeep Puligilla | a3e7695 | 2014-06-23 15:53:11 +0530 | [diff] [blame] | 7547 | return 0; |
| 7548 | } |
| 7549 | |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 7550 | case WE_STOP_OBSS_SCAN: |
| 7551 | { |
| 7552 | /* 1.OBSS Scan is mandatory while operating in 2.4GHz |
| 7553 | 2.OBSS scan is stopped by Firmware during the disassociation |
| 7554 | 3.OBSS stop comamnd is added for debugging purpose*/ |
| 7555 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7556 | tpAniSirGlobal pMac; |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 7557 | |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 7558 | if (pAdapter == NULL) |
| 7559 | { |
| 7560 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7561 | " pAdapter is NULL "); |
Kaushik, Sushant | df30db2 | 2014-05-05 12:14:33 +0530 | [diff] [blame] | 7562 | return -EINVAL; |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 7563 | } |
| 7564 | pMac = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7565 | if (pMac == NULL) |
| 7566 | { |
| 7567 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7568 | " pMac is NULL "); |
Kaushik, Sushant | df30db2 | 2014-05-05 12:14:33 +0530 | [diff] [blame] | 7569 | return -EINVAL; |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 7570 | } |
| 7571 | sme_HT40StopOBSSScan(pMac, pAdapter->sessionId); |
| 7572 | } |
| 7573 | break; |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 7574 | case WE_DUMP_ROAM_TIMER_LOG: |
| 7575 | { |
| 7576 | vos_dump_roam_time_log_service(); |
| 7577 | break; |
| 7578 | } |
Sandeep Puligilla | a3e7695 | 2014-06-23 15:53:11 +0530 | [diff] [blame] | 7579 | |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 7580 | case WE_RESET_ROAM_TIMER_LOG: |
| 7581 | { |
| 7582 | vos_reset_roam_timer_log(); |
| 7583 | break; |
| 7584 | } |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 7585 | case WE_GET_FW_LOGS: |
| 7586 | { |
| 7587 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL, |
| 7588 | WLAN_LOG_INDICATOR_IOCTL, |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 7589 | WLAN_LOG_REASON_IOCTL, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 7590 | TRUE, TRUE); |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 7591 | break; |
| 7592 | } |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 7593 | case WE_GET_FW_MEMDUMP: |
| 7594 | { |
| 7595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 7596 | "FW_MEM_DUMP requested "); |
| 7597 | get_fwr_memdump(dev,info,wrqu,extra); |
| 7598 | break; |
| 7599 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7600 | default: |
| 7601 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7602 | hddLog(LOGE, "%s: unknown ioctl %d", __func__, sub_cmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7603 | break; |
| 7604 | } |
| 7605 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7606 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7607 | return ret; |
| 7608 | } |
| 7609 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 7610 | static int iw_setnone_getnone(struct net_device *dev, |
| 7611 | struct iw_request_info *info, |
| 7612 | union iwreq_data *wrqu, char *extra) |
| 7613 | { |
| 7614 | int ret; |
| 7615 | |
| 7616 | vos_ssr_protect(__func__); |
| 7617 | ret = __iw_setnone_getnone(dev, info, wrqu, extra); |
| 7618 | vos_ssr_unprotect(__func__); |
| 7619 | |
| 7620 | return ret; |
| 7621 | } |
| 7622 | |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7623 | void hdd_wmm_tx_snapshot(hdd_adapter_t *pAdapter) |
| 7624 | { |
| 7625 | /* |
| 7626 | * Function to display HDD WMM information |
| 7627 | * for Tx Queues. |
| 7628 | * Prints globala as well as per client depending |
| 7629 | * whether the clients are registered or not. |
| 7630 | */ |
| 7631 | int i = 0, j = 0; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 7632 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 7633 | ptSapContext pSapCtx = VOS_GET_SAP_CB(pVosContext); |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 7634 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7635 | hdd_ibss_peer_info_t *pPeerInfo; |
mukul sharma | 2cdb8ea | 2015-10-01 14:53:38 +0530 | [diff] [blame] | 7636 | v_SIZE_t tx_queue_count[NUM_TX_QUEUES]; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 7637 | |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7638 | for ( i=0; i< NUM_TX_QUEUES; i++) |
| 7639 | { |
Madan Mohan Koyyalamudi | 2be9f0c | 2013-07-25 16:30:37 +0530 | [diff] [blame] | 7640 | spin_lock_bh(&pAdapter->wmm_tx_queue[i].lock); |
mukul sharma | 2cdb8ea | 2015-10-01 14:53:38 +0530 | [diff] [blame] | 7641 | tx_queue_count[i] = pAdapter->wmm_tx_queue[i].count; |
Madan Mohan Koyyalamudi | 2be9f0c | 2013-07-25 16:30:37 +0530 | [diff] [blame] | 7642 | spin_unlock_bh(&pAdapter->wmm_tx_queue[i].lock); |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7643 | } |
mukul sharma | 2cdb8ea | 2015-10-01 14:53:38 +0530 | [diff] [blame] | 7644 | |
| 7645 | for ( i=0; i< NUM_TX_QUEUES; i++) { |
| 7646 | if (tx_queue_count[i]) { |
| 7647 | hddLog(LOGE, "HDD WMM TxQueue Info For AC: %d Count: %d", |
| 7648 | i, tx_queue_count[i]); |
| 7649 | } |
| 7650 | } |
| 7651 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 7652 | if(pSapCtx == NULL){ |
| 7653 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7654 | FL("psapCtx is NULL")); |
| 7655 | return; |
| 7656 | } |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7657 | |
Vinay Krishna Eranna | 17f6066 | 2015-02-23 13:17:28 +0530 | [diff] [blame] | 7658 | spin_lock_bh(&pSapCtx->staInfo_lock); |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7659 | for(i =0; i<WLAN_MAX_STA_COUNT; i++) |
| 7660 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 7661 | if(pSapCtx->aStaInfo[i].isUsed) |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7662 | { |
| 7663 | hddLog(LOGE, "******STAIndex: %d*********", i); |
| 7664 | for ( j=0; j< NUM_TX_QUEUES; j++) |
| 7665 | { |
Katya Nigam | d5c2421 | 2015-06-19 15:40:58 +0530 | [diff] [blame] | 7666 | if( pSapCtx->aStaInfo[i].wmm_tx_queue[j].count ) |
| 7667 | { |
| 7668 | spin_lock_bh(&pSapCtx->aStaInfo[i].wmm_tx_queue[j].lock); |
mukul sharma | 2cdb8ea | 2015-10-01 14:53:38 +0530 | [diff] [blame] | 7669 | hddLog(LOGE, "HDD TxQueue Info For AC: %d Count: %d", |
| 7670 | j, pSapCtx->aStaInfo[i].wmm_tx_queue[j].count); |
Katya Nigam | d5c2421 | 2015-06-19 15:40:58 +0530 | [diff] [blame] | 7671 | spin_unlock_bh(&pSapCtx->aStaInfo[i].wmm_tx_queue[j].lock); |
| 7672 | } |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7673 | } |
| 7674 | } |
| 7675 | } |
Vinay Krishna Eranna | 17f6066 | 2015-02-23 13:17:28 +0530 | [diff] [blame] | 7676 | spin_unlock_bh(&pSapCtx->staInfo_lock); |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7677 | |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 7678 | if(pHddStaCtx == NULL){ |
| 7679 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7680 | FL("pHddStaCtx is NULL")); |
| 7681 | return; |
| 7682 | } |
| 7683 | |
| 7684 | pPeerInfo = &pHddStaCtx->ibss_peer_info; |
| 7685 | if(pPeerInfo == NULL){ |
| 7686 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7687 | FL("ppeerinfo is NULL")); |
| 7688 | return; |
| 7689 | } |
| 7690 | |
Sravan Kumar Kairam | 8bc9e1e | 2016-01-25 20:50:11 +0530 | [diff] [blame] | 7691 | for (i = 0; i < HDD_MAX_NUM_IBSS_STA; i++) { |
| 7692 | if (pPeerInfo->ibssStaInfo[i].isUsed) { |
| 7693 | hddLog(LOGE, "******IBSS STAIndex: %d*********", i); |
| 7694 | for (j = 0; j < NUM_TX_QUEUES; j++) { |
| 7695 | if (pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].count) { |
| 7696 | spin_lock_bh( |
| 7697 | &pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].lock); |
| 7698 | hddLog(LOGE, |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 7699 | "HDD TxQueue Info For AC: %d Count: %d PrevAdress:%pK, NextAddress:%pK", |
Sravan Kumar Kairam | 8bc9e1e | 2016-01-25 20:50:11 +0530 | [diff] [blame] | 7700 | j, pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].count, |
| 7701 | pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].anchor.prev, |
| 7702 | pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].anchor.next); |
| 7703 | spin_unlock_bh( |
| 7704 | &pPeerInfo->ibssStaInfo[i].wmm_tx_queue[j].lock); |
| 7705 | } |
| 7706 | } |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 7707 | } |
| 7708 | } |
| 7709 | |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 7710 | } |
Sravan Kumar Kairam | 8bc9e1e | 2016-01-25 20:50:11 +0530 | [diff] [blame] | 7711 | |
Girish Gowli | fb9758e | 2014-11-19 15:19:17 +0530 | [diff] [blame] | 7712 | static int __iw_set_var_ints_getnone(struct net_device *dev, |
| 7713 | struct iw_request_info *info, |
| 7714 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7715 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 7716 | hdd_adapter_t *pAdapter; |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 7717 | tHalHandle hHal = NULL; |
Girish Gowli | d4522fd | 2014-06-14 17:20:27 +0530 | [diff] [blame] | 7718 | int sub_cmd; |
Girish Gowli | fb9758e | 2014-11-19 15:19:17 +0530 | [diff] [blame] | 7719 | int *apps_args = (int *) extra; |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 7720 | hdd_station_ctx_t *pStaCtx = NULL ; |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 7721 | hdd_mon_ctx_t *pMonCtx = NULL; |
Mahesh A Saptasagar | 178ab1d | 2014-09-08 15:11:05 +0530 | [diff] [blame] | 7722 | hdd_context_t *pHddCtx = NULL; |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 7723 | hdd_ap_ctx_t *pAPCtx = NULL; |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 7724 | v_CONTEXT_t pVosContext; |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 7725 | int cmd = 0; |
| 7726 | int staId = 0; |
Mahesh A Saptasagar | 178ab1d | 2014-09-08 15:11:05 +0530 | [diff] [blame] | 7727 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7728 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 7729 | ENTER(); |
Girish Gowli | fb9758e | 2014-11-19 15:19:17 +0530 | [diff] [blame] | 7730 | if (extra == NULL) |
Girish Gowli | d4522fd | 2014-06-14 17:20:27 +0530 | [diff] [blame] | 7731 | { |
Girish Gowli | fb9758e | 2014-11-19 15:19:17 +0530 | [diff] [blame] | 7732 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7733 | "%s: NULL extra buffer pointer", __func__); |
| 7734 | return -EINVAL; |
Girish Gowli | d4522fd | 2014-06-14 17:20:27 +0530 | [diff] [blame] | 7735 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 7736 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7737 | if (NULL == pAdapter) |
| 7738 | { |
| 7739 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7740 | "%s: Adapter is NULL",__func__); |
| 7741 | return -EINVAL; |
| 7742 | } |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 7743 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Mahesh A Saptasagar | 178ab1d | 2014-09-08 15:11:05 +0530 | [diff] [blame] | 7744 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 7745 | ret = wlan_hdd_validate_context(pHddCtx); |
| 7746 | if (0 != ret) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7747 | { |
Mahesh A Saptasagar | 178ab1d | 2014-09-08 15:11:05 +0530 | [diff] [blame] | 7748 | return ret; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7749 | } |
Katya Nigam | eae74b6 | 2015-05-28 17:19:16 +0530 | [diff] [blame] | 7750 | if( VOS_MONITOR_MODE != hdd_get_conparam()) |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 7751 | { |
Katya Nigam | eae74b6 | 2015-05-28 17:19:16 +0530 | [diff] [blame] | 7752 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 7753 | if (NULL == hHal) |
| 7754 | { |
| 7755 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7756 | "%s: Hal Context is NULL",__func__); |
| 7757 | return -EINVAL; |
| 7758 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 7759 | } |
| 7760 | sub_cmd = wrqu->data.flags; |
| 7761 | |
| 7762 | hddLog(LOG1, "%s: Received length %d", __func__, wrqu->data.length); |
| 7763 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 7764 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 7765 | if(( sub_cmd == WE_MCC_CONFIG_CREDENTIAL ) || |
| 7766 | (sub_cmd == WE_MCC_CONFIG_PARAMS )) |
| 7767 | { |
| 7768 | if(( pAdapter->device_mode == WLAN_HDD_INFRA_STATION )|| |
| 7769 | ( pAdapter->device_mode == WLAN_HDD_P2P_CLIENT )) |
| 7770 | { |
| 7771 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7772 | staId = pStaCtx->conn_info.staId[0]; |
| 7773 | } |
| 7774 | else if (( pAdapter->device_mode == WLAN_HDD_P2P_GO ) || |
| 7775 | ( pAdapter->device_mode == WLAN_HDD_SOFTAP )) |
| 7776 | { |
| 7777 | pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 7778 | staId = pAPCtx->uBCStaId; |
| 7779 | } |
| 7780 | else |
| 7781 | { |
| 7782 | hddLog(LOGE, "%s: Device mode %d not recognised", __FUNCTION__, pAdapter->device_mode); |
| 7783 | return 0; |
| 7784 | } |
| 7785 | } |
| 7786 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7787 | switch (sub_cmd) |
| 7788 | { |
| 7789 | case WE_LOG_DUMP_CMD: |
| 7790 | { |
Arun Khandavalli | ffbf9c0 | 2015-12-03 16:48:53 +0530 | [diff] [blame] | 7791 | if(apps_args[0] == 26) { |
| 7792 | if (!pHddCtx->cfg_ini->crash_inject_enabled) { |
| 7793 | hddLog(LOGE, "Crash Inject ini disabled, Ignore Crash Inject"); |
| 7794 | return 0; |
| 7795 | } |
| 7796 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7797 | 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] | 7798 | __func__, apps_args[0], apps_args[1], apps_args[2], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7799 | apps_args[3], apps_args[4]); |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 7800 | if (hHal) |
| 7801 | logPrintf(hHal, apps_args[0], apps_args[1], apps_args[2], |
| 7802 | apps_args[3], apps_args[4]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7803 | |
| 7804 | } |
| 7805 | break; |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 7806 | #ifdef WLAN_FEATURE_RMC |
| 7807 | case WE_IBSS_GET_PEER_INFO: |
| 7808 | { |
| 7809 | pr_info ( "Station ID = %d\n",apps_args[0]); |
| 7810 | hdd_wlan_get_ibss_peer_info(pAdapter, apps_args[0]); |
| 7811 | } |
| 7812 | break; |
| 7813 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7814 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7815 | case WE_P2P_NOA_CMD: |
| 7816 | { |
| 7817 | p2p_app_setP2pPs_t p2pNoA; |
| 7818 | |
Rajeev Kumar | a4c475d | 2015-11-27 13:41:24 +0530 | [diff] [blame] | 7819 | if (pAdapter->device_mode != WLAN_HDD_P2P_GO) { |
| 7820 | hddLog(LOGE, |
| 7821 | FL("Setting NoA is not allowed in Device mode:%d"), |
| 7822 | pAdapter->device_mode); |
| 7823 | return -EINVAL; |
| 7824 | } |
| 7825 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7826 | p2pNoA.opp_ps = apps_args[0]; |
| 7827 | p2pNoA.ctWindow = apps_args[1]; |
| 7828 | p2pNoA.duration = apps_args[2]; |
| 7829 | p2pNoA.interval = apps_args[3]; |
| 7830 | p2pNoA.count = apps_args[4]; |
| 7831 | p2pNoA.single_noa_duration = apps_args[5]; |
| 7832 | p2pNoA.psSelection = apps_args[6]; |
| 7833 | |
| 7834 | hddLog(LOG1, "%s: P2P_NOA_ATTR:oppPS %d ctWindow %d duration %d " |
| 7835 | "interval %d count %d single noa duration %d PsSelection %x", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 7836 | __func__, apps_args[0], apps_args[1], apps_args[2], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7837 | apps_args[3], apps_args[4], apps_args[5], apps_args[6]); |
| 7838 | |
| 7839 | hdd_setP2pPs(dev, &p2pNoA); |
| 7840 | |
| 7841 | } |
| 7842 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7843 | |
Katya Nigam | c2f29dc | 2014-01-20 19:29:30 +0530 | [diff] [blame] | 7844 | case WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD: |
| 7845 | { |
| 7846 | hddLog(LOG1, "%s: SELECTIVE_MODULE_LOG %d arg1 %d arg2", |
| 7847 | __func__, apps_args[0], apps_args[1]); |
| 7848 | vosTraceEnable(apps_args[0], apps_args[1]); |
| 7849 | } |
| 7850 | break; |
| 7851 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 7852 | case WE_MTRACE_DUMP_CMD: |
| 7853 | { |
| 7854 | hddLog(LOG1, "%s: MTRACE_DUMP code %d session %d count %d " |
| 7855 | "bitmask_of_module %d ", |
| 7856 | __func__, apps_args[0], apps_args[1], apps_args[2], |
| 7857 | apps_args[3]); |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 7858 | if (hHal) |
| 7859 | vosTraceDumpAll((void*)hHal , apps_args[0], apps_args[1], |
| 7860 | apps_args[2], apps_args[3]); |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 7861 | |
| 7862 | } |
| 7863 | break; |
| 7864 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 7865 | case WE_MCC_CONFIG_CREDENTIAL : |
| 7866 | { |
| 7867 | cmd = 287; //Command should be updated if there is any change |
| 7868 | // in the Riva dump command |
Kumar Anand | 90ca3dd | 2013-01-18 15:24:47 -0800 | [diff] [blame] | 7869 | if((apps_args[0] >= 40 ) && (apps_args[0] <= 160 )) |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 7870 | { |
SaidiReddy Yenuga | 83de699 | 2016-07-12 17:21:11 +0530 | [diff] [blame] | 7871 | if (hHal) |
| 7872 | logPrintf(hHal, cmd, staId, apps_args[0], apps_args[1], |
| 7873 | apps_args[2]); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 7874 | } |
| 7875 | else |
| 7876 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 7877 | hddLog(LOGE, "%s : Enter valid MccCredential value between MIN :40 and MAX:160", __func__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 7878 | return 0; |
| 7879 | } |
| 7880 | } |
| 7881 | break; |
| 7882 | |
| 7883 | case WE_MCC_CONFIG_PARAMS : |
| 7884 | { |
| 7885 | cmd = 288; //command Should be updated if there is any change |
| 7886 | // in the Riva dump command |
| 7887 | hdd_validate_mcc_config(pAdapter, staId, apps_args[0], apps_args[1],apps_args[2]); |
| 7888 | } |
| 7889 | break; |
| 7890 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 7891 | #ifdef FEATURE_WLAN_TDLS |
| 7892 | case WE_TDLS_CONFIG_PARAMS : |
| 7893 | { |
| 7894 | tdls_config_params_t tdlsParams; |
| 7895 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 7896 | tdlsParams.tdls = apps_args[0]; |
| 7897 | tdlsParams.tx_period_t = apps_args[1]; |
| 7898 | tdlsParams.tx_packet_n = apps_args[2]; |
| 7899 | tdlsParams.discovery_period_t = apps_args[3]; |
| 7900 | tdlsParams.discovery_tries_n = apps_args[4]; |
| 7901 | tdlsParams.idle_timeout_t = apps_args[5]; |
| 7902 | tdlsParams.idle_packet_n = apps_args[6]; |
| 7903 | tdlsParams.rssi_hysteresis = apps_args[7]; |
| 7904 | tdlsParams.rssi_trigger_threshold = apps_args[8]; |
| 7905 | tdlsParams.rssi_teardown_threshold = apps_args[9]; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 7906 | |
Chilam Ng | 0112041 | 2013-02-19 18:32:21 -0800 | [diff] [blame] | 7907 | wlan_hdd_tdls_set_params(dev, &tdlsParams); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 7908 | } |
| 7909 | break; |
| 7910 | #endif |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 7911 | case WE_CONFIGURE_MONITOR_MODE: |
| 7912 | { |
Abhishek Singh | b95cdb6 | 2016-02-16 11:31:00 +0530 | [diff] [blame] | 7913 | tVOS_CON_MODE mode = hdd_get_conparam(); |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 7914 | int ret; |
| 7915 | void *cookie; |
| 7916 | struct hdd_request *request; |
| 7917 | static const struct hdd_request_params params = { |
| 7918 | .priv_size = 0, |
| 7919 | .timeout_ms = MON_MODE_MSG_TIMEOUT, |
| 7920 | }; |
Abhishek Singh | b95cdb6 | 2016-02-16 11:31:00 +0530 | [diff] [blame] | 7921 | |
| 7922 | if (VOS_MONITOR_MODE != mode) { |
| 7923 | hddLog(LOGE, FL("invalid mode %d"), mode); |
| 7924 | return -EIO; |
| 7925 | } |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 7926 | |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 7927 | pMonCtx = WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter); |
| 7928 | if( pMonCtx == NULL ) |
| 7929 | { |
| 7930 | hddLog(LOGE, "Monitor Context NULL"); |
Abhishek Singh | b95cdb6 | 2016-02-16 11:31:00 +0530 | [diff] [blame] | 7931 | return -EIO; |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 7932 | } |
| 7933 | hddLog(LOG1, "%s: Monitor MOde Configuration: ChNo=%d ChBW=%d CRCCheck=%d type=%d ConversionBit=%d", |
| 7934 | __func__, apps_args[0], apps_args[1], apps_args[2], |
| 7935 | apps_args[3], apps_args[4]); |
| 7936 | /* Input Validation part of FW */ |
| 7937 | pMonCtx->ChannelNo = apps_args[0]; |
| 7938 | pMonCtx->ChannelBW = apps_args[1]; |
| 7939 | pMonCtx->crcCheckEnabled = apps_args[2]; |
| 7940 | wlan_hdd_mon_set_typesubtype( pMonCtx,apps_args[3]); |
| 7941 | pMonCtx->is80211to803ConReq = apps_args[4]; |
| 7942 | WLANTL_SetIsConversionReq(pVosContext,apps_args[4]); |
| 7943 | if( pMonCtx->is80211to803ConReq ) |
| 7944 | pAdapter->dev->type = ARPHRD_ETHER; |
| 7945 | else |
| 7946 | pAdapter->dev->type = ARPHRD_IEEE80211_RADIOTAP; |
| 7947 | if( (apps_args[3]!= 100 && apps_args[3]!= 0) && apps_args[4] ) |
| 7948 | { |
| 7949 | hddLog(LOGE, "%s: Filtering data packets as management and control" |
| 7950 | " cannot be converted to 802.3 ",__func__); |
| 7951 | pMonCtx->typeSubtypeBitmap = 0xFFFF00000000; |
| 7952 | } |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 7953 | if (MON_MODE_START == pMonCtx->state) { |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 7954 | request = hdd_request_alloc(¶ms); |
| 7955 | if (!request) { |
| 7956 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 7957 | return -ENOMEM; |
| 7958 | } |
| 7959 | cookie = hdd_request_cookie(request); |
| 7960 | |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 7961 | if (VOS_STATUS_SUCCESS != |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 7962 | wlan_hdd_mon_postMsg(cookie, pMonCtx, |
| 7963 | hdd_mon_post_msg_cb)) { |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 7964 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7965 | FL("failed to post MON MODE REQ")); |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 7966 | ret = -EIO; |
| 7967 | } else { |
| 7968 | ret = hdd_request_wait_for_response(request); |
| 7969 | if (ret) |
| 7970 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7971 | FL("failed to wait on monitor mode completion %d"), |
| 7972 | ret); |
| 7973 | } |
| 7974 | hdd_request_put(request); |
| 7975 | } |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 7976 | } |
| 7977 | break; |
| 7978 | |
| 7979 | case WE_SET_MONITOR_MODE_FILTER: |
| 7980 | { |
Abhishek Singh | b95cdb6 | 2016-02-16 11:31:00 +0530 | [diff] [blame] | 7981 | tVOS_CON_MODE mode = hdd_get_conparam(); |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 7982 | int ret; |
| 7983 | void *cookie; |
| 7984 | struct hdd_request *request; |
| 7985 | static const struct hdd_request_params params = { |
| 7986 | .priv_size = 0, |
| 7987 | .timeout_ms = MON_MODE_MSG_TIMEOUT, |
| 7988 | }; |
Abhishek Singh | b95cdb6 | 2016-02-16 11:31:00 +0530 | [diff] [blame] | 7989 | |
| 7990 | if (VOS_MONITOR_MODE != mode) { |
| 7991 | hddLog(LOGE, FL("invalid mode %d"), mode); |
| 7992 | return -EIO; |
| 7993 | } |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 7994 | |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 7995 | pMonCtx = WLAN_HDD_GET_MONITOR_CTX_PTR(pAdapter); |
| 7996 | if( pMonCtx == NULL ) |
| 7997 | { |
| 7998 | hddLog(LOGE, "Monitor Context NULL"); |
Abhishek Singh | b95cdb6 | 2016-02-16 11:31:00 +0530 | [diff] [blame] | 7999 | return -EIO; |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 8000 | } |
| 8001 | /* Input Validation Part of FW */ |
| 8002 | pMonCtx->numOfMacFilters=1; |
| 8003 | pMonCtx->mmFilters[0].macAddr.bytes[0]=apps_args[0]; |
| 8004 | pMonCtx->mmFilters[0].macAddr.bytes[1]=apps_args[1]; |
| 8005 | pMonCtx->mmFilters[0].macAddr.bytes[2]=apps_args[2]; |
| 8006 | pMonCtx->mmFilters[0].macAddr.bytes[3]=apps_args[3]; |
| 8007 | pMonCtx->mmFilters[0].macAddr.bytes[4]=apps_args[4]; |
| 8008 | pMonCtx->mmFilters[0].macAddr.bytes[5]=apps_args[5]; |
| 8009 | pMonCtx->mmFilters[0].isA1filter = apps_args[6]; |
| 8010 | pMonCtx->mmFilters[0].isA2filter = apps_args[7]; |
| 8011 | pMonCtx->mmFilters[0].isA3filter = apps_args[8]; |
| 8012 | hddLog(LOG1, "%s: Monitor Filter: %pM A1=%d A2=%d A3=%d ", |
| 8013 | __func__, pMonCtx->mmFilters[0].macAddr.bytes, |
| 8014 | apps_args[6], apps_args[7], apps_args[8]); |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 8015 | if (MON_MODE_START == pMonCtx->state) { |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 8016 | request = hdd_request_alloc(¶ms); |
| 8017 | if (!request) { |
| 8018 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 8019 | return -ENOMEM; |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 8020 | } |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 8021 | cookie = hdd_request_cookie(request); |
| 8022 | |
| 8023 | if (VOS_STATUS_SUCCESS == |
| 8024 | wlan_hdd_mon_postMsg(cookie, pMonCtx, |
| 8025 | hdd_mon_post_msg_cb)) { |
| 8026 | ret = hdd_request_wait_for_response(request); |
| 8027 | if (ret) |
| 8028 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8029 | FL("failed to wait on monitor mode completion %d"), |
| 8030 | ret); |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 8031 | } |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 8032 | hdd_request_put(request); |
Hanumantha Reddy Pothula | 91cdd7f | 2015-09-03 21:25:16 +0530 | [diff] [blame] | 8033 | } |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 8034 | } |
| 8035 | break; |
| 8036 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8037 | default: |
| 8038 | { |
Jeff Johnson | 11e7703 | 2014-02-14 13:22:22 -0800 | [diff] [blame] | 8039 | hddLog(LOGE, "%s: Invalid IOCTL command %d", |
| 8040 | __func__, sub_cmd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8041 | } |
| 8042 | break; |
| 8043 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8044 | EXIT(); |
Hanumanth Reddy Pothula | b8be9ab | 2018-04-12 20:03:05 +0530 | [diff] [blame] | 8045 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8046 | } |
| 8047 | |
Girish Gowli | fb9758e | 2014-11-19 15:19:17 +0530 | [diff] [blame] | 8048 | static int iw_hdd_set_var_ints_getnone(struct net_device *dev, |
| 8049 | struct iw_request_info *info, |
| 8050 | union iwreq_data *wrqu, char *extra) |
| 8051 | { |
| 8052 | int ret; |
| 8053 | union iwreq_data u_priv_wrqu; |
| 8054 | int apps_args[MAX_VAR_ARGS] = {0}; |
| 8055 | int num_args; |
| 8056 | |
Hanumantha Reddy Pothula | 54df19e | 2015-10-27 21:48:29 +0530 | [diff] [blame] | 8057 | if (!capable(CAP_NET_ADMIN)) |
| 8058 | { |
| 8059 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8060 | FL("permission check failed")); |
| 8061 | return -EPERM; |
| 8062 | } |
| 8063 | |
Girish Gowli | fb9758e | 2014-11-19 15:19:17 +0530 | [diff] [blame] | 8064 | /* helper function to get iwreq_data with compat handling. */ |
| 8065 | if (hdd_priv_get_data(&u_priv_wrqu.data, wrqu)) |
| 8066 | { |
| 8067 | return -EINVAL; |
| 8068 | } |
| 8069 | |
| 8070 | if (NULL == u_priv_wrqu.data.pointer) |
| 8071 | { |
| 8072 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8073 | "%s: NULL data pointer", __func__); |
| 8074 | return -EINVAL; |
| 8075 | } |
| 8076 | |
| 8077 | num_args = u_priv_wrqu.data.length; |
| 8078 | if (num_args > MAX_VAR_ARGS) |
| 8079 | { |
| 8080 | num_args = MAX_VAR_ARGS; |
| 8081 | } |
| 8082 | |
| 8083 | if (copy_from_user(apps_args, u_priv_wrqu.data.pointer, |
| 8084 | (sizeof(int)) * num_args)) |
| 8085 | { |
| 8086 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8087 | "%s: failed to copy data from user buffer", __func__); |
| 8088 | return -EFAULT; |
| 8089 | } |
| 8090 | |
| 8091 | vos_ssr_protect(__func__); |
| 8092 | ret = __iw_set_var_ints_getnone(dev, info, &u_priv_wrqu, |
| 8093 | (char *)&apps_args); |
| 8094 | vos_ssr_unprotect(__func__); |
| 8095 | |
| 8096 | return ret; |
| 8097 | } |
| 8098 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8099 | int iw_set_var_ints_getnone(struct net_device *dev, |
| 8100 | struct iw_request_info *info, |
| 8101 | union iwreq_data *wrqu, char *extra) |
| 8102 | { |
| 8103 | int ret; |
| 8104 | vos_ssr_protect(__func__); |
| 8105 | ret = __iw_set_var_ints_getnone(dev, info, wrqu, extra); |
| 8106 | vos_ssr_unprotect(__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8107 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8108 | return ret; |
| 8109 | } |
| 8110 | |
| 8111 | static int __iw_add_tspec(struct net_device *dev, |
| 8112 | struct iw_request_info *info, |
| 8113 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8114 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8115 | hdd_adapter_t *pAdapter; |
| 8116 | hdd_station_ctx_t *pHddStaCtx; |
| 8117 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8118 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra; |
| 8119 | int params[HDD_WLAN_WMM_PARAM_COUNT]; |
| 8120 | sme_QosWmmTspecInfo tSpec; |
| 8121 | v_U32_t handle; |
Girish Gowli | 1999398 | 2014-06-12 20:05:32 +0530 | [diff] [blame] | 8122 | struct iw_point s_priv_data; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8123 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8124 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8125 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8126 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8127 | if (NULL == pAdapter) |
| 8128 | { |
| 8129 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8130 | "%s: Adapter is NULL",__func__); |
| 8131 | return -EINVAL; |
| 8132 | } |
| 8133 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8134 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8135 | if (0 != ret) |
| 8136 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8137 | return ret; |
| 8138 | } |
| 8139 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8140 | if (NULL == pHddStaCtx) |
| 8141 | { |
| 8142 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8143 | "%s: STA Context is NULL",__func__); |
| 8144 | return -EINVAL; |
| 8145 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8146 | // make sure the application is sufficiently priviledged |
| 8147 | // note that the kernel will do this for "set" ioctls, but since |
| 8148 | // this ioctl wants to return status to user space it must be |
| 8149 | // defined as a "get" ioctl |
| 8150 | if (!capable(CAP_NET_ADMIN)) |
| 8151 | { |
| 8152 | return -EPERM; |
| 8153 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8154 | // we must be associated in order to add a tspec |
| 8155 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 8156 | { |
| 8157 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8158 | return 0; |
| 8159 | } |
| 8160 | |
| 8161 | // since we are defined to be a "get" ioctl, and since the number |
| 8162 | // of params exceeds the number of params that wireless extensions |
Girish Gowli | 1999398 | 2014-06-12 20:05:32 +0530 | [diff] [blame] | 8163 | // will pass down in the iwreq_data, we must copy the "set" params. |
| 8164 | // We must handle the compat for iwreq_data in 32U/64K environment. |
| 8165 | |
| 8166 | // helper fucntion to get iwreq_data with compat handling. |
| 8167 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 8168 | { |
| 8169 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8170 | return 0; |
| 8171 | } |
| 8172 | |
| 8173 | // make sure all params are correctly passed to function |
| 8174 | if ((NULL == s_priv_data.pointer) || |
| 8175 | (HDD_WLAN_WMM_PARAM_COUNT != s_priv_data.length)) |
| 8176 | { |
| 8177 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8178 | return 0; |
| 8179 | } |
| 8180 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8181 | // from user space ourselves |
Girish Gowli | 1999398 | 2014-06-12 20:05:32 +0530 | [diff] [blame] | 8182 | if (copy_from_user(¶ms, s_priv_data.pointer, sizeof(params))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8183 | { |
| 8184 | // hmmm, can't get them |
| 8185 | return -EIO; |
| 8186 | } |
| 8187 | |
| 8188 | // clear the tspec |
| 8189 | memset(&tSpec, 0, sizeof(tSpec)); |
| 8190 | |
| 8191 | // validate the handle |
| 8192 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 8193 | if (HDD_WMM_HANDLE_IMPLICIT == handle) |
| 8194 | { |
| 8195 | // that one is reserved |
| 8196 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8197 | return 0; |
| 8198 | } |
| 8199 | |
| 8200 | // validate the TID |
| 8201 | if (params[HDD_WLAN_WMM_PARAM_TID] > 7) |
| 8202 | { |
| 8203 | // out of range |
| 8204 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8205 | return 0; |
| 8206 | } |
| 8207 | tSpec.ts_info.tid = params[HDD_WLAN_WMM_PARAM_TID]; |
| 8208 | |
| 8209 | // validate the direction |
| 8210 | switch (params[HDD_WLAN_WMM_PARAM_DIRECTION]) |
| 8211 | { |
| 8212 | case HDD_WLAN_WMM_DIRECTION_UPSTREAM: |
| 8213 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_UPLINK; |
| 8214 | break; |
| 8215 | |
| 8216 | case HDD_WLAN_WMM_DIRECTION_DOWNSTREAM: |
| 8217 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_DOWNLINK; |
| 8218 | break; |
| 8219 | |
| 8220 | case HDD_WLAN_WMM_DIRECTION_BIDIRECTIONAL: |
| 8221 | tSpec.ts_info.direction = SME_QOS_WMM_TS_DIR_BOTH; |
| 8222 | break; |
| 8223 | |
| 8224 | default: |
| 8225 | // unknown |
| 8226 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8227 | return 0; |
| 8228 | } |
| 8229 | |
Madan Mohan Koyyalamudi | a5643d6 | 2013-09-25 14:37:55 +0530 | [diff] [blame] | 8230 | tSpec.ts_info.psb = params[HDD_WLAN_WMM_PARAM_APSD]; |
| 8231 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8232 | // validate the user priority |
| 8233 | if (params[HDD_WLAN_WMM_PARAM_USER_PRIORITY] >= SME_QOS_WMM_UP_MAX) |
| 8234 | { |
| 8235 | // out of range |
| 8236 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8237 | return 0; |
| 8238 | } |
| 8239 | tSpec.ts_info.up = params[HDD_WLAN_WMM_PARAM_USER_PRIORITY]; |
Kiet Lam | c6bef88 | 2013-11-11 17:07:36 +0530 | [diff] [blame] | 8240 | if(0 > tSpec.ts_info.up || SME_QOS_WMM_UP_MAX < tSpec.ts_info.up) |
| 8241 | { |
| 8242 | hddLog(VOS_TRACE_LEVEL_ERROR,"***ts_info.up out of bounds***"); |
| 8243 | return 0; |
| 8244 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8245 | |
Madan Mohan Koyyalamudi | c0c6238 | 2013-08-16 23:46:14 +0530 | [diff] [blame] | 8246 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8247 | "%s:TS_INFO PSB %d UP %d !!!", __func__, |
| 8248 | tSpec.ts_info.psb, tSpec.ts_info.up); |
| 8249 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8250 | tSpec.nominal_msdu_size = params[HDD_WLAN_WMM_PARAM_NOMINAL_MSDU_SIZE]; |
| 8251 | tSpec.maximum_msdu_size = params[HDD_WLAN_WMM_PARAM_MAXIMUM_MSDU_SIZE]; |
| 8252 | tSpec.min_data_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_DATA_RATE]; |
| 8253 | tSpec.mean_data_rate = params[HDD_WLAN_WMM_PARAM_MEAN_DATA_RATE]; |
| 8254 | tSpec.peak_data_rate = params[HDD_WLAN_WMM_PARAM_PEAK_DATA_RATE]; |
| 8255 | tSpec.max_burst_size = params[HDD_WLAN_WMM_PARAM_MAX_BURST_SIZE]; |
| 8256 | tSpec.min_phy_rate = params[HDD_WLAN_WMM_PARAM_MINIMUM_PHY_RATE]; |
| 8257 | tSpec.surplus_bw_allowance = params[HDD_WLAN_WMM_PARAM_SURPLUS_BANDWIDTH_ALLOWANCE]; |
| 8258 | tSpec.min_service_interval = params[HDD_WLAN_WMM_PARAM_SERVICE_INTERVAL]; |
| 8259 | tSpec.max_service_interval = params[HDD_WLAN_WMM_PARAM_MAX_SERVICE_INTERVAL]; |
| 8260 | tSpec.suspension_interval = params[HDD_WLAN_WMM_PARAM_SUSPENSION_INTERVAL]; |
| 8261 | tSpec.inactivity_interval = params[HDD_WLAN_WMM_PARAM_INACTIVITY_INTERVAL]; |
| 8262 | |
| 8263 | tSpec.ts_info.burst_size_defn = params[HDD_WLAN_WMM_PARAM_BURST_SIZE_DEFN]; |
| 8264 | |
Kanchanapally, Vidyullatha | 23cea3c | 2014-11-04 13:05:20 +0530 | [diff] [blame] | 8265 | // Save the expected UAPSD settings by application, this will be needed |
| 8266 | // when re-negotiating UAPSD settings during BT Coex cases. |
| 8267 | tSpec.expec_psb_byapp = params[HDD_WLAN_WMM_PARAM_APSD]; |
| 8268 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8269 | // validate the ts info ack policy |
| 8270 | switch (params[HDD_WLAN_WMM_PARAM_ACK_POLICY]) |
| 8271 | { |
| 8272 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_NORMAL_ACK: |
| 8273 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_NORMAL_ACK; |
| 8274 | break; |
| 8275 | |
| 8276 | case HDD_WLAN_WMM_TS_INFO_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK: |
| 8277 | tSpec.ts_info.ack_policy = SME_QOS_WMM_TS_ACK_POLICY_HT_IMMEDIATE_BLOCK_ACK; |
| 8278 | break; |
| 8279 | |
| 8280 | default: |
| 8281 | // unknown |
| 8282 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8283 | return 0; |
| 8284 | } |
| 8285 | |
| 8286 | *pStatus = hdd_wmm_addts(pAdapter, handle, &tSpec); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8287 | |
| 8288 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8289 | return 0; |
| 8290 | } |
| 8291 | |
| 8292 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8293 | static int iw_add_tspec(struct net_device *dev, |
| 8294 | struct iw_request_info *info, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8295 | union iwreq_data *wrqu, char *extra) |
| 8296 | { |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8297 | int ret; |
| 8298 | |
| 8299 | vos_ssr_protect(__func__); |
| 8300 | ret = __iw_add_tspec(dev, info, wrqu, extra); |
| 8301 | vos_ssr_unprotect(__func__); |
| 8302 | |
| 8303 | return ret; |
| 8304 | } |
| 8305 | |
| 8306 | static int __iw_del_tspec(struct net_device *dev, |
| 8307 | struct iw_request_info *info, |
| 8308 | union iwreq_data *wrqu, char *extra) |
| 8309 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8310 | hdd_adapter_t *pAdapter; |
| 8311 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8312 | int *params = (int *)extra; |
| 8313 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra; |
| 8314 | v_U32_t handle; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8315 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8316 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8317 | ENTER(); |
| 8318 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8319 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8320 | if (NULL == pAdapter) |
| 8321 | { |
| 8322 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8323 | "%s: Adapter is NULL",__func__); |
| 8324 | return -EINVAL; |
| 8325 | } |
| 8326 | |
| 8327 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8328 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8329 | if (0 != ret) |
| 8330 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8331 | return ret; |
| 8332 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8333 | // make sure the application is sufficiently priviledged |
| 8334 | // note that the kernel will do this for "set" ioctls, but since |
| 8335 | // this ioctl wants to return status to user space it must be |
| 8336 | // defined as a "get" ioctl |
| 8337 | if (!capable(CAP_NET_ADMIN)) |
| 8338 | { |
| 8339 | return -EPERM; |
| 8340 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8341 | // although we are defined to be a "get" ioctl, the params we require |
| 8342 | // will fit in the iwreq_data, therefore unlike iw_add_tspec() there |
| 8343 | // is no need to copy the params from user space |
| 8344 | |
| 8345 | // validate the handle |
| 8346 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 8347 | if (HDD_WMM_HANDLE_IMPLICIT == handle) |
| 8348 | { |
| 8349 | // that one is reserved |
| 8350 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8351 | return 0; |
| 8352 | } |
| 8353 | |
| 8354 | *pStatus = hdd_wmm_delts(pAdapter, handle); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8355 | |
| 8356 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8357 | return 0; |
| 8358 | } |
| 8359 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8360 | static int iw_del_tspec(struct net_device *dev, |
| 8361 | struct iw_request_info *info, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8362 | union iwreq_data *wrqu, char *extra) |
| 8363 | { |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8364 | int ret; |
| 8365 | |
| 8366 | vos_ssr_protect(__func__); |
| 8367 | ret = __iw_del_tspec(dev, info, wrqu, extra); |
| 8368 | vos_ssr_unprotect(__func__); |
| 8369 | |
| 8370 | return ret; |
| 8371 | } |
| 8372 | |
| 8373 | |
| 8374 | static int __iw_get_tspec(struct net_device *dev, |
| 8375 | struct iw_request_info *info, |
| 8376 | union iwreq_data *wrqu, char *extra) |
| 8377 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8378 | hdd_adapter_t *pAdapter; |
| 8379 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8380 | int *params = (int *)extra; |
| 8381 | hdd_wlan_wmm_status_e *pStatus = (hdd_wlan_wmm_status_e *)extra; |
| 8382 | v_U32_t handle; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8383 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8384 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8385 | ENTER(); |
| 8386 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8387 | // although we are defined to be a "get" ioctl, the params we require |
| 8388 | // will fit in the iwreq_data, therefore unlike iw_add_tspec() there |
| 8389 | // is no need to copy the params from user space |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8390 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8391 | if (NULL == pAdapter) |
| 8392 | { |
| 8393 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8394 | "%s: Adapter is NULL",__func__); |
| 8395 | return -EINVAL; |
| 8396 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8397 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8398 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8399 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8400 | if (0 != ret) |
| 8401 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8402 | return ret; |
| 8403 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8404 | // validate the handle |
| 8405 | handle = params[HDD_WLAN_WMM_PARAM_HANDLE]; |
| 8406 | if (HDD_WMM_HANDLE_IMPLICIT == handle) |
| 8407 | { |
| 8408 | // that one is reserved |
| 8409 | *pStatus = HDD_WLAN_WMM_STATUS_SETUP_FAILED_BAD_PARAM; |
| 8410 | return 0; |
| 8411 | } |
| 8412 | |
| 8413 | *pStatus = hdd_wmm_checkts(pAdapter, handle); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8414 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8415 | return 0; |
| 8416 | } |
| 8417 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8418 | static int iw_get_tspec(struct net_device *dev, |
| 8419 | struct iw_request_info *info, |
| 8420 | union iwreq_data *wrqu, char *extra) |
| 8421 | { |
| 8422 | int ret; |
| 8423 | |
| 8424 | vos_ssr_protect(__func__); |
| 8425 | ret = __iw_get_tspec(dev, info, wrqu, extra); |
| 8426 | vos_ssr_unprotect(__func__); |
| 8427 | |
| 8428 | return ret; |
| 8429 | } |
| 8430 | |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 8431 | /** |
| 8432 | * __iw_setnone_get_threeint() - return three value to up layer. |
| 8433 | * |
| 8434 | * @dev: pointer of net_device of this wireless card |
| 8435 | * @info: meta data about Request sent |
| 8436 | * @wrqu: include request info |
| 8437 | * @extra: buf used for in/Output |
| 8438 | * |
| 8439 | * Return: execute result |
| 8440 | */ |
| 8441 | static int __iw_setnone_get_threeint(struct net_device *dev, |
| 8442 | struct iw_request_info *info, |
| 8443 | union iwreq_data *wrqu, char *extra) |
| 8444 | { |
| 8445 | int ret = 0; /* success */ |
| 8446 | uint32_t *value = (int *)extra; |
| 8447 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8448 | |
| 8449 | hddLog(VOS_TRACE_LEVEL_INFO, FL("param = %d"), value[0]); |
| 8450 | |
| 8451 | switch (value[0]) { |
| 8452 | case WE_GET_TSF: |
| 8453 | ret = hdd_indicate_tsf(adapter, value, 3); |
| 8454 | break; |
| 8455 | default: |
| 8456 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8457 | FL("Invalid IOCTL get_value command %d"), |
| 8458 | value[0]); |
| 8459 | break; |
| 8460 | } |
| 8461 | return ret; |
| 8462 | } |
| 8463 | |
| 8464 | /** |
| 8465 | * iw_setnone_get_threeint() - return three value to up layer. |
| 8466 | * |
| 8467 | * @dev: pointer of net_device of this wireless card |
| 8468 | * @info: meta data about Request sent |
| 8469 | * @wrqu: include request info |
| 8470 | * @extra: buf used for in/Output |
| 8471 | * |
| 8472 | * Return: execute result |
| 8473 | */ |
| 8474 | static int iw_setnone_get_threeint(struct net_device *dev, |
| 8475 | struct iw_request_info *info, |
| 8476 | union iwreq_data *wrqu, char *extra) |
| 8477 | { |
| 8478 | int ret; |
| 8479 | |
| 8480 | vos_ssr_protect(__func__); |
| 8481 | ret = __iw_setnone_get_threeint(dev, info, wrqu, extra); |
| 8482 | vos_ssr_unprotect(__func__); |
| 8483 | |
| 8484 | return ret; |
| 8485 | } |
| 8486 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8487 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8488 | // |
| 8489 | // |
| 8490 | // Each time the supplicant has the auth_request or reassoc request |
| 8491 | // IEs ready. This is pushed to the driver. The driver will inturn use |
| 8492 | // it to send out the auth req and reassoc req for 11r FT Assoc. |
| 8493 | // |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8494 | static int __iw_set_fties(struct net_device *dev, |
| 8495 | struct iw_request_info *info, |
| 8496 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8497 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8498 | hdd_adapter_t *pAdapter; |
| 8499 | hdd_station_ctx_t *pHddStaCtx; |
| 8500 | hdd_context_t *pHddCtx; |
| 8501 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8502 | //v_CONTEXT_t pVosContext; |
| 8503 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8504 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8505 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8506 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8507 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8508 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8509 | "%s: Adapter is NULL",__func__); |
| 8510 | return -EINVAL; |
| 8511 | } |
| 8512 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8513 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8514 | if (0 != ret) |
| 8515 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8516 | return ret; |
| 8517 | } |
| 8518 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8519 | if (NULL == pHddStaCtx) |
| 8520 | { |
| 8521 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8522 | "%s: STA Context is NULL",__func__); |
| 8523 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8524 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8525 | if (!wrqu->data.length) |
| 8526 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8527 | hddLog(LOGE, FL("called with 0 length IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8528 | return -EINVAL; |
| 8529 | } |
| 8530 | if (wrqu->data.pointer == NULL) |
| 8531 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8532 | hddLog(LOGE, FL("called with NULL IE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8533 | return -EINVAL; |
| 8534 | } |
| 8535 | |
| 8536 | // Added for debug on reception of Re-assoc Req. |
| 8537 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 8538 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8539 | hddLog(LOGE, FL("Called with Ie of length = %d when not associated"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8540 | wrqu->data.length); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8541 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8542 | } |
| 8543 | |
| 8544 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8545 | hddLog(LOGE, FL("%s called with Ie of length = %d"), __func__, wrqu->data.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8546 | #endif |
| 8547 | |
| 8548 | // Pass the received FT IEs to SME |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 8549 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, extra, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8550 | wrqu->data.length); |
| 8551 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8552 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8553 | return 0; |
| 8554 | } |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8555 | |
| 8556 | static int iw_set_fties(struct net_device *dev, |
| 8557 | struct iw_request_info *info, |
| 8558 | union iwreq_data *wrqu, char *extra) |
| 8559 | { |
| 8560 | int ret; |
| 8561 | |
| 8562 | vos_ssr_protect(__func__); |
| 8563 | ret = __iw_set_fties(dev, info, wrqu, extra); |
| 8564 | vos_ssr_unprotect(__func__); |
| 8565 | |
| 8566 | return ret; |
| 8567 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8568 | #endif |
| 8569 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8570 | static int __iw_set_dynamic_mcbc_filter(struct net_device *dev, |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 8571 | struct iw_request_info *info, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8572 | union iwreq_data *wrqu, char *extra) |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8573 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8574 | hdd_adapter_t *pAdapter; |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 8575 | tpRcvFltMcAddrList pRequest = (tpRcvFltMcAddrList)extra; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8576 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 8577 | tpSirWlanSetRxpFilters wlanRxpFilterParam; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8578 | tHalHandle hHal; |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8579 | tpSirRcvFltMcAddrList mc_addr_list_ptr; |
| 8580 | int idx; |
| 8581 | eHalStatus ret_val; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8582 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8583 | ENTER(); |
| 8584 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8585 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8586 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8587 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8588 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8589 | "%s: Adapter is NULL",__func__); |
| 8590 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8591 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8592 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8593 | ret_val = wlan_hdd_validate_context(pHddCtx); |
| 8594 | if (0 != ret_val) |
| 8595 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8596 | return ret_val; |
| 8597 | } |
| 8598 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8599 | if (NULL == hHal) |
| 8600 | { |
| 8601 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8602 | "%s: Hal Context is NULL",__func__); |
| 8603 | return -EINVAL; |
| 8604 | } |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8605 | if (HDD_MULTICAST_FILTER_LIST == pRequest->mcastBcastFilterSetting) |
| 8606 | { |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 8607 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8608 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8609 | mc_addr_list_ptr = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
| 8610 | if (NULL == mc_addr_list_ptr) |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 8611 | { |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8612 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8613 | "%s: vos_mem_alloc failed", __func__); |
| 8614 | return -ENOMEM; |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 8615 | } |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8616 | |
| 8617 | mc_addr_list_ptr->ulMulticastAddrCnt = pRequest->mcast_addr_cnt; |
| 8618 | |
| 8619 | if (mc_addr_list_ptr->ulMulticastAddrCnt > HDD_MAX_NUM_MULTICAST_ADDRESS) |
| 8620 | mc_addr_list_ptr->ulMulticastAddrCnt = HDD_MAX_NUM_MULTICAST_ADDRESS; |
| 8621 | |
| 8622 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s MC Addr List Cnt %d", __func__, |
| 8623 | mc_addr_list_ptr->ulMulticastAddrCnt); |
| 8624 | |
| 8625 | for (idx = 0; idx < mc_addr_list_ptr->ulMulticastAddrCnt; idx++) |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 8626 | { |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8627 | memcpy(&mc_addr_list_ptr->multicastAddr[idx], |
| 8628 | pRequest->multicastAddr[idx], HDD_WLAN_MAC_ADDR_LEN); |
| 8629 | |
| 8630 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s MC Addr for Idx %d ="MAC_ADDRESS_STR, __func__, |
| 8631 | idx, MAC_ADDR_ARRAY(mc_addr_list_ptr->multicastAddr[idx])); |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 8632 | } |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 8633 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8634 | ret_val = sme_8023MulticastList(hHal, pAdapter->sessionId, mc_addr_list_ptr); |
| 8635 | vos_mem_free(mc_addr_list_ptr); |
| 8636 | if (eHAL_STATUS_SUCCESS != ret_val) |
| 8637 | { |
| 8638 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to Set MC Address List", |
| 8639 | __func__); |
| 8640 | return -EINVAL; |
| 8641 | } |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 8642 | #endif //WLAN_FEATURE_PACKET_FILTERING |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8643 | } |
| 8644 | else |
| 8645 | { |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 8646 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8647 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 8648 | "%s: Set MC BC Filter Config request: %d suspend %d", |
| 8649 | __func__, pRequest->mcastBcastFilterSetting, |
| 8650 | pHddCtx->hdd_wlan_suspended); |
Mukul Sharma | 75ee8aa | 2016-12-01 14:28:10 +0530 | [diff] [blame] | 8651 | spin_lock(&pHddCtx->filter_lock); |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8652 | pHddCtx->configuredMcastBcastFilter = pRequest->mcastBcastFilterSetting; |
Mukul Sharma | 75ee8aa | 2016-12-01 14:28:10 +0530 | [diff] [blame] | 8653 | spin_unlock(&pHddCtx->filter_lock); |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8654 | |
| 8655 | if (pHddCtx->hdd_wlan_suspended) |
| 8656 | { |
Jeff Johnson | ce3d75e | 2013-04-05 22:34:54 -0700 | [diff] [blame] | 8657 | wlanRxpFilterParam = vos_mem_malloc(sizeof(tSirWlanSetRxpFilters)); |
| 8658 | if (NULL == wlanRxpFilterParam) |
| 8659 | { |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8660 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | ce3d75e | 2013-04-05 22:34:54 -0700 | [diff] [blame] | 8661 | "%s: vos_mem_alloc failed", __func__); |
| 8662 | return -EINVAL; |
| 8663 | } |
| 8664 | |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8665 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 8666 | pRequest->mcastBcastFilterSetting; |
| 8667 | wlanRxpFilterParam->setMcstBcstFilter = TRUE; |
Mukul Sharma | 75ee8aa | 2016-12-01 14:28:10 +0530 | [diff] [blame] | 8668 | /* Fwr expect offload needs to clear before set */ |
| 8669 | hdd_conf_hostoffload(pAdapter, FALSE); |
| 8670 | spin_lock(&pHddCtx->filter_lock); |
| 8671 | pHddCtx->configuredMcastBcastFilter = pRequest->mcastBcastFilterSetting; |
| 8672 | spin_unlock(&pHddCtx->filter_lock); |
| 8673 | if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) |
| 8674 | { |
| 8675 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: pRequest->mcastBcastFilterSetting ", __func__); |
| 8676 | pHddCtx->sus_res_mcastbcast_filter = |
| 8677 | pRequest->mcastBcastFilterSetting; |
| 8678 | } |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8679 | |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 8680 | hdd_conf_hostoffload(pAdapter, TRUE); |
| 8681 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 8682 | pHddCtx->configuredMcastBcastFilter; |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8683 | |
| 8684 | hddLog(VOS_TRACE_LEVEL_INFO, "%s:MC/BC changed Req %d Set %d En %d", |
| 8685 | __func__, |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8686 | pHddCtx->configuredMcastBcastFilter, |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8687 | wlanRxpFilterParam->configuredMcstBcstFilterSetting, |
| 8688 | wlanRxpFilterParam->setMcstBcstFilter); |
| 8689 | |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8690 | if (eHAL_STATUS_SUCCESS != |
| 8691 | sme_ConfigureRxpFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8692 | wlanRxpFilterParam)) |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8693 | { |
| 8694 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8695 | "%s: Failure to execute set HW MC/BC Filter request", |
| 8696 | __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 8697 | vos_mem_free(wlanRxpFilterParam); |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8698 | return -EINVAL; |
| 8699 | } |
| 8700 | |
mukul sharma | e4abd89 | 2016-11-24 22:03:31 +0530 | [diff] [blame] | 8701 | /* mc add list cfg item configuration in fwr */ |
| 8702 | hdd_mc_addr_list_cfg_config(pHddCtx, true); |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 8703 | } |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 8704 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8705 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8706 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8707 | return 0; |
| 8708 | } |
| 8709 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8710 | static int iw_set_dynamic_mcbc_filter(struct net_device *dev, |
| 8711 | struct iw_request_info *info, |
| 8712 | union iwreq_data *wrqu, char *extra) |
| 8713 | { |
| 8714 | int ret; |
| 8715 | |
| 8716 | vos_ssr_protect(__func__); |
| 8717 | ret = __iw_set_dynamic_mcbc_filter(dev, info, wrqu, extra); |
| 8718 | vos_ssr_unprotect(__func__); |
| 8719 | |
| 8720 | return ret; |
| 8721 | } |
| 8722 | |
| 8723 | static int __iw_clear_dynamic_mcbc_filter(struct net_device *dev, |
| 8724 | struct iw_request_info *info, |
| 8725 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8726 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8727 | hdd_adapter_t *pAdapter; |
| 8728 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8729 | tpSirWlanSetRxpFilters wlanRxpFilterParam; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8730 | int ret = 0; |
| 8731 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8732 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8733 | |
Hanumantha Reddy Pothula | d025fbd | 2015-10-27 22:01:39 +0530 | [diff] [blame] | 8734 | if (!capable(CAP_NET_ADMIN)) |
| 8735 | { |
| 8736 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8737 | FL("permission check failed")); |
| 8738 | return -EPERM; |
| 8739 | } |
| 8740 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8741 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8742 | if (NULL == pAdapter) |
| 8743 | { |
| 8744 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8745 | "%s: Adapter is NULL",__func__); |
| 8746 | return -EINVAL; |
| 8747 | } |
| 8748 | |
| 8749 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8750 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8751 | if (0 != ret) |
| 8752 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8753 | return ret; |
| 8754 | } |
Mukul Sharma | 75ee8aa | 2016-12-01 14:28:10 +0530 | [diff] [blame] | 8755 | spin_lock(&pHddCtx->filter_lock); |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8756 | //Reset the filter to INI value as we have to clear the dynamic filter |
| 8757 | pHddCtx->configuredMcastBcastFilter = pHddCtx->cfg_ini->mcastBcastFilterSetting; |
Mukul Sharma | 75ee8aa | 2016-12-01 14:28:10 +0530 | [diff] [blame] | 8758 | spin_unlock(&pHddCtx->filter_lock); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8759 | |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8760 | //Configure FW with new setting |
| 8761 | if (pHddCtx->hdd_wlan_suspended) |
| 8762 | { |
| 8763 | wlanRxpFilterParam = vos_mem_malloc(sizeof(tSirWlanSetRxpFilters)); |
| 8764 | if (NULL == wlanRxpFilterParam) |
| 8765 | { |
| 8766 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8767 | "%s: vos_mem_alloc failed", __func__); |
| 8768 | return -EINVAL; |
| 8769 | } |
| 8770 | |
| 8771 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 8772 | pHddCtx->configuredMcastBcastFilter; |
| 8773 | wlanRxpFilterParam->setMcstBcstFilter = TRUE; |
Mukul Sharma | 75ee8aa | 2016-12-01 14:28:10 +0530 | [diff] [blame] | 8774 | /* Fwr expect offload needs to clear before set */ |
| 8775 | hdd_conf_hostoffload(pAdapter, FALSE); |
| 8776 | spin_lock(&pHddCtx->filter_lock); |
| 8777 | pHddCtx->configuredMcastBcastFilter = |
| 8778 | pHddCtx->cfg_ini->mcastBcastFilterSetting; |
| 8779 | spin_unlock(&pHddCtx->filter_lock); |
| 8780 | |
| 8781 | if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) |
| 8782 | { |
| 8783 | pHddCtx->sus_res_mcastbcast_filter = |
| 8784 | pHddCtx->cfg_ini->mcastBcastFilterSetting; |
| 8785 | } |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8786 | |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 8787 | hdd_conf_hostoffload(pAdapter, TRUE); |
| 8788 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
| 8789 | pHddCtx->configuredMcastBcastFilter; |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8790 | if (eHAL_STATUS_SUCCESS != |
| 8791 | sme_ConfigureRxpFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8792 | wlanRxpFilterParam)) |
| 8793 | { |
| 8794 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8795 | "%s: Failure to execute set HW MC/BC Filter request", |
| 8796 | __func__); |
| 8797 | vos_mem_free(wlanRxpFilterParam); |
| 8798 | return -EINVAL; |
| 8799 | } |
c_hpothu | d3ce76d | 2014-10-28 10:34:13 +0530 | [diff] [blame] | 8800 | |
mukul sharma | e4abd89 | 2016-11-24 22:03:31 +0530 | [diff] [blame] | 8801 | /* mc add list cfg item configuration in fwr */ |
| 8802 | hdd_mc_addr_list_cfg_config(pHddCtx, true); |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 8803 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8804 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8805 | return 0; |
| 8806 | } |
| 8807 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8808 | |
| 8809 | static int iw_clear_dynamic_mcbc_filter(struct net_device *dev, |
| 8810 | struct iw_request_info *info, |
| 8811 | union iwreq_data *wrqu, char *extra) |
| 8812 | { |
| 8813 | int ret; |
| 8814 | |
| 8815 | vos_ssr_protect(__func__); |
| 8816 | ret = __iw_clear_dynamic_mcbc_filter(dev, info, wrqu, extra); |
| 8817 | vos_ssr_unprotect(__func__); |
| 8818 | |
| 8819 | return ret; |
| 8820 | } |
| 8821 | |
| 8822 | static int __iw_set_host_offload(struct net_device *dev, |
| 8823 | struct iw_request_info *info, |
| 8824 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8825 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8826 | hdd_adapter_t *pAdapter; |
| 8827 | hdd_context_t *pHddCtx; |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 8828 | tpHostOffloadRequest pRequest = (tpHostOffloadRequest) extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8829 | tSirHostOffloadReq offloadRequest; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8830 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8831 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8832 | ENTER(); |
| 8833 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8834 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8835 | if (NULL == pAdapter) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8836 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8837 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8838 | "%s: Adapter is NULL",__func__); |
| 8839 | return -EINVAL; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 8840 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8841 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8842 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8843 | if (0 != ret) |
| 8844 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8845 | return ret; |
| 8846 | } |
| 8847 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8848 | /* Debug display of request components. */ |
| 8849 | switch (pRequest->offloadType) |
| 8850 | { |
| 8851 | case WLAN_IPV4_ARP_REPLY_OFFLOAD: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8852 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Host offload request: ARP reply", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8853 | switch (pRequest->enableOrDisable) |
| 8854 | { |
| 8855 | case WLAN_OFFLOAD_DISABLE: |
| 8856 | hddLog(VOS_TRACE_LEVEL_WARN, " disable"); |
| 8857 | break; |
| 8858 | case WLAN_OFFLOAD_ARP_AND_BC_FILTER_ENABLE: |
| 8859 | hddLog(VOS_TRACE_LEVEL_WARN, " BC Filtering enable"); |
| 8860 | case WLAN_OFFLOAD_ENABLE: |
| 8861 | hddLog(VOS_TRACE_LEVEL_WARN, " ARP offload enable"); |
| 8862 | hddLog(VOS_TRACE_LEVEL_WARN, " IP address: %d.%d.%d.%d", |
| 8863 | pRequest->params.hostIpv4Addr[0], pRequest->params.hostIpv4Addr[1], |
| 8864 | pRequest->params.hostIpv4Addr[2], pRequest->params.hostIpv4Addr[3]); |
| 8865 | } |
| 8866 | break; |
| 8867 | |
| 8868 | case WLAN_IPV6_NEIGHBOR_DISCOVERY_OFFLOAD: |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8869 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Host offload request: neighbor discovery", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8870 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8871 | switch (pRequest->enableOrDisable) |
| 8872 | { |
| 8873 | case WLAN_OFFLOAD_DISABLE: |
| 8874 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " disable"); |
| 8875 | break; |
| 8876 | case WLAN_OFFLOAD_ENABLE: |
| 8877 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " enable"); |
| 8878 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, " IP address: %x:%x:%x:%x:%x:%x:%x:%x", |
| 8879 | *(v_U16_t *)(pRequest->params.hostIpv6Addr), |
| 8880 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 2), |
| 8881 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 4), |
| 8882 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 6), |
| 8883 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 8), |
| 8884 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 10), |
| 8885 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 12), |
| 8886 | *(v_U16_t *)(pRequest->params.hostIpv6Addr + 14)); |
| 8887 | } |
| 8888 | } |
| 8889 | |
Hanumanth Reddy Pothula | 94bd51a | 2017-12-01 13:34:48 +0530 | [diff] [blame] | 8890 | vos_mem_zero(&offloadRequest, sizeof(offloadRequest)); |
| 8891 | offloadRequest.offloadType = pRequest->offloadType; |
| 8892 | offloadRequest.enableOrDisable = pRequest->enableOrDisable; |
| 8893 | vos_mem_copy(&offloadRequest.params, &pRequest->params, |
| 8894 | sizeof(pRequest->params)); |
| 8895 | vos_mem_copy(&offloadRequest.bssId, &pRequest->bssId.bytes, |
| 8896 | VOS_MAC_ADDRESS_LEN); |
| 8897 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8898 | if (eHAL_STATUS_SUCCESS != sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8899 | pAdapter->sessionId, &offloadRequest)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8900 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8901 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute host offload request", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8902 | __func__); |
| 8903 | return -EINVAL; |
| 8904 | } |
| 8905 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8906 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8907 | return 0; |
| 8908 | } |
| 8909 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8910 | static int iw_set_host_offload(struct net_device *dev, |
| 8911 | struct iw_request_info *info, |
| 8912 | union iwreq_data *wrqu, char *extra) |
| 8913 | { |
| 8914 | int ret; |
| 8915 | |
| 8916 | vos_ssr_protect(__func__); |
| 8917 | ret = __iw_set_host_offload(dev, info, wrqu, extra); |
| 8918 | vos_ssr_unprotect(__func__); |
| 8919 | |
| 8920 | return ret; |
| 8921 | } |
| 8922 | |
| 8923 | static int __iw_set_keepalive_params(struct net_device *dev, |
| 8924 | struct iw_request_info *info, |
| 8925 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8926 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8927 | hdd_adapter_t *pAdapter; |
| 8928 | hdd_context_t *pHddCtx; |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 8929 | tpKeepAliveRequest pRequest = (tpKeepAliveRequest) extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8930 | tSirKeepAliveReq keepaliveRequest; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8931 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8932 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8933 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8934 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 8935 | if (NULL == pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8936 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8937 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8938 | "%s: Adapter is NULL",__func__); |
| 8939 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8940 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8941 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8942 | ret = wlan_hdd_validate_context(pHddCtx); |
| 8943 | if (0 != ret) |
| 8944 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 8945 | return ret; |
| 8946 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8947 | /* Debug display of request components. */ |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 8948 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8949 | "%s: Set Keep Alive Request : TimePeriod %d size %zu", |
| 8950 | __func__, pRequest->timePeriod, sizeof(tKeepAliveRequest)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8951 | |
| 8952 | switch (pRequest->packetType) |
| 8953 | { |
| 8954 | case WLAN_KEEP_ALIVE_NULL_PKT: |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8955 | hddLog(VOS_TRACE_LEVEL_WARN, "%s: Keep Alive Request: Tx NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8956 | break; |
| 8957 | |
| 8958 | case WLAN_KEEP_ALIVE_UNSOLICIT_ARP_RSP: |
| 8959 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8960 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Keep Alive Request: Tx UnSolicited ARP RSP", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 8961 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8962 | |
| 8963 | hddLog(VOS_TRACE_LEVEL_WARN, " Host IP address: %d.%d.%d.%d", |
| 8964 | pRequest->hostIpv4Addr[0], pRequest->hostIpv4Addr[1], |
| 8965 | pRequest->hostIpv4Addr[2], pRequest->hostIpv4Addr[3]); |
| 8966 | |
| 8967 | hddLog(VOS_TRACE_LEVEL_WARN, " Dest IP address: %d.%d.%d.%d", |
| 8968 | pRequest->destIpv4Addr[0], pRequest->destIpv4Addr[1], |
| 8969 | pRequest->destIpv4Addr[2], pRequest->destIpv4Addr[3]); |
| 8970 | |
| 8971 | hddLog(VOS_TRACE_LEVEL_WARN, " Dest MAC address: %d:%d:%d:%d:%d:%d", |
| 8972 | pRequest->destMacAddr[0], pRequest->destMacAddr[1], |
| 8973 | pRequest->destMacAddr[2], pRequest->destMacAddr[3], |
| 8974 | pRequest->destMacAddr[4], pRequest->destMacAddr[5]); |
| 8975 | break; |
| 8976 | |
| 8977 | } |
| 8978 | |
| 8979 | /* Execute keep alive request. The reason that we can copy the request information |
| 8980 | from the ioctl structure to the SME structure is that they are laid out |
| 8981 | exactly the same. Otherwise, each piece of information would have to be |
| 8982 | copied individually. */ |
| 8983 | memcpy(&keepaliveRequest, pRequest, wrqu->data.length); |
| 8984 | |
Sushant Kaushik | dc3184b | 2015-10-09 12:00:21 +0530 | [diff] [blame] | 8985 | hddLog(VOS_TRACE_LEVEL_INFO, "set Keep: TP before SME %d", |
| 8986 | keepaliveRequest.timePeriod); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8987 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 8988 | if (eHAL_STATUS_SUCCESS != sme_SetKeepAlive(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8989 | pAdapter->sessionId, &keepaliveRequest)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8990 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8991 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Keep Alive", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8992 | __func__); |
| 8993 | return -EINVAL; |
| 8994 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 8995 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8996 | return 0; |
| 8997 | } |
| 8998 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 8999 | static int iw_set_keepalive_params(struct net_device *dev, |
| 9000 | struct iw_request_info *info, |
| 9001 | union iwreq_data *wrqu, char *extra) |
| 9002 | { |
| 9003 | int ret; |
| 9004 | vos_ssr_protect(__func__); |
| 9005 | ret = __iw_set_keepalive_params(dev, info, wrqu, extra); |
| 9006 | vos_ssr_unprotect(__func__); |
| 9007 | |
| 9008 | return ret; |
| 9009 | } |
| 9010 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9011 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9012 | /**----------------------------------------------------------------- |
| 9013 | |
| 9014 | \brief hdd_pkt_filter_done - callback to be executed on completion |
| 9015 | successful/failure) for clear filter request. |
| 9016 | |
| 9017 | \return - None |
| 9018 | |
| 9019 | --------------------------------------------------------------------------*/ |
| 9020 | static void hdd_pkt_filter_done(void *data, v_U32_t status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9021 | { |
Hanumanth Reddy Pothula | 73a2ca8 | 2018-04-11 12:54:39 +0530 | [diff] [blame] | 9022 | struct hdd_request *request; |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9023 | |
Hanumanth Reddy Pothula | 73a2ca8 | 2018-04-11 12:54:39 +0530 | [diff] [blame] | 9024 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9025 | FL("Pkt Filter Clear Status : %d"), status); |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9026 | |
Hanumanth Reddy Pothula | 73a2ca8 | 2018-04-11 12:54:39 +0530 | [diff] [blame] | 9027 | request = hdd_request_get(data); |
| 9028 | if (!request) { |
| 9029 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Obsolete request")); |
| 9030 | if (ioctl_debug) |
| 9031 | pr_info("%s: Obsolete request", __func__); |
| 9032 | return; |
| 9033 | } |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9034 | |
Hanumanth Reddy Pothula | 73a2ca8 | 2018-04-11 12:54:39 +0530 | [diff] [blame] | 9035 | hdd_request_complete(request); |
| 9036 | hdd_request_put(request); |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9037 | } |
| 9038 | |
| 9039 | int wlan_hdd_set_filter(hdd_adapter_t *pAdapter, tpPacketFilterCfg pRequest) |
| 9040 | { |
| 9041 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sravan Kumar Kairam | 893801a | 2016-11-01 19:14:23 +0530 | [diff] [blame] | 9042 | hdd_station_ctx_t *pHddStaCtx = &pAdapter->sessionCtx.station; |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 9043 | tSirRcvPktFilterCfgType packetFilterSetReq = {0}; |
| 9044 | tSirRcvFltPktClearParam packetFilterClrReq = {0}; |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9045 | int i=0, status; |
Hanumanth Reddy Pothula | 73a2ca8 | 2018-04-11 12:54:39 +0530 | [diff] [blame] | 9046 | void *cookie; |
| 9047 | struct hdd_request *request; |
| 9048 | static const struct hdd_request_params params = { |
| 9049 | .priv_size = 0, |
| 9050 | .timeout_ms = PKT_FILTER_TIMEOUT, |
| 9051 | }; |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9052 | |
| 9053 | status = wlan_hdd_validate_context(pHddCtx); |
| 9054 | if (0 != status) |
| 9055 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9056 | |
| 9057 | if (pHddCtx->cfg_ini->disablePacketFilter) |
| 9058 | { |
| 9059 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Packet Filtering Disabled. Returning ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9060 | __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9061 | return 0; |
| 9062 | } |
Agrawal Ashish | a2662d2 | 2016-10-26 12:41:13 +0530 | [diff] [blame] | 9063 | if (pHddCtx->isLogpInProgress) |
| 9064 | { |
| 9065 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9066 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 9067 | return -EBUSY; |
| 9068 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9069 | /* Debug display of request components. */ |
| 9070 | 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] | 9071 | __func__, pRequest->filterAction, pRequest->numParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9072 | |
| 9073 | switch (pRequest->filterAction) |
| 9074 | { |
| 9075 | case HDD_RCV_FILTER_SET: |
| 9076 | 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] | 9077 | __func__, pRequest->filterId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9078 | |
| 9079 | packetFilterSetReq.filterId = pRequest->filterId; |
| 9080 | if ( pRequest->numParams >= HDD_MAX_CMP_PER_PACKET_FILTER) |
| 9081 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9082 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Number of Params exceed Max limit %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9083 | __func__, pRequest->numParams); |
| 9084 | return -EINVAL; |
| 9085 | } |
| 9086 | packetFilterSetReq.numFieldParams = pRequest->numParams; |
| 9087 | packetFilterSetReq.coalesceTime = 0; |
| 9088 | packetFilterSetReq.filterType = 1; |
| 9089 | for (i=0; i < pRequest->numParams; i++) |
| 9090 | { |
| 9091 | packetFilterSetReq.paramsData[i].protocolLayer = pRequest->paramsData[i].protocolLayer; |
| 9092 | packetFilterSetReq.paramsData[i].cmpFlag = pRequest->paramsData[i].cmpFlag; |
| 9093 | packetFilterSetReq.paramsData[i].dataOffset = pRequest->paramsData[i].dataOffset; |
| 9094 | packetFilterSetReq.paramsData[i].dataLength = pRequest->paramsData[i].dataLength; |
| 9095 | packetFilterSetReq.paramsData[i].reserved = 0; |
| 9096 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9097 | hddLog(VOS_TRACE_LEVEL_INFO, "Proto %d Comp Flag %d Filter Type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9098 | pRequest->paramsData[i].protocolLayer, pRequest->paramsData[i].cmpFlag, |
| 9099 | packetFilterSetReq.filterType); |
| 9100 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9101 | hddLog(VOS_TRACE_LEVEL_INFO, "Data Offset %d Data Len %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9102 | pRequest->paramsData[i].dataOffset, pRequest->paramsData[i].dataLength); |
Mahesh A Saptasagar | c1ad309 | 2015-10-27 15:40:18 +0530 | [diff] [blame] | 9103 | if ((sizeof(packetFilterSetReq.paramsData[i].compareData)) < |
| 9104 | (pRequest->paramsData[i].dataLength)) |
| 9105 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9106 | |
| 9107 | memcpy(&packetFilterSetReq.paramsData[i].compareData, |
| 9108 | pRequest->paramsData[i].compareData, pRequest->paramsData[i].dataLength); |
| 9109 | memcpy(&packetFilterSetReq.paramsData[i].dataMask, |
| 9110 | pRequest->paramsData[i].dataMask, pRequest->paramsData[i].dataLength); |
| 9111 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9112 | hddLog(VOS_TRACE_LEVEL_INFO, "CData %d CData %d CData %d CData %d CData %d CData %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9113 | pRequest->paramsData[i].compareData[0], pRequest->paramsData[i].compareData[1], |
| 9114 | pRequest->paramsData[i].compareData[2], pRequest->paramsData[i].compareData[3], |
| 9115 | pRequest->paramsData[i].compareData[4], pRequest->paramsData[i].compareData[5]); |
| 9116 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9117 | hddLog(VOS_TRACE_LEVEL_INFO, "MData %d MData %d MData %d MData %d MData %d MData %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9118 | pRequest->paramsData[i].dataMask[0], pRequest->paramsData[i].dataMask[1], |
| 9119 | pRequest->paramsData[i].dataMask[2], pRequest->paramsData[i].dataMask[3], |
| 9120 | pRequest->paramsData[i].dataMask[4], pRequest->paramsData[i].dataMask[5]); |
| 9121 | } |
| 9122 | |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9123 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, &packetFilterSetReq, pAdapter->sessionId)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9124 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9125 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Set Filter", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9126 | __func__); |
| 9127 | return -EINVAL; |
| 9128 | } |
| 9129 | |
Sravan Kumar Kairam | a97e237 | 2016-11-11 17:20:03 +0530 | [diff] [blame] | 9130 | WLANTL_SetDataPktFilter((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 9131 | pHddStaCtx->conn_info.staId[0], true); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9132 | break; |
| 9133 | |
| 9134 | case HDD_RCV_FILTER_CLEAR: |
| 9135 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9136 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Clear Packet Filter Request for Id: %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9137 | __func__, pRequest->filterId); |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9138 | |
Sravan Kumar Kairam | 893801a | 2016-11-01 19:14:23 +0530 | [diff] [blame] | 9139 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 9140 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) { |
| 9141 | WLANTL_ResetRxSSN((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 9142 | pHddStaCtx->conn_info.staId[0]); |
| 9143 | } |
| 9144 | |
Hanumanth Reddy Pothula | 73a2ca8 | 2018-04-11 12:54:39 +0530 | [diff] [blame] | 9145 | request = hdd_request_alloc(¶ms); |
| 9146 | if (!request) { |
| 9147 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request allocation failure")); |
| 9148 | return VOS_STATUS_E_NOMEM; |
| 9149 | } |
| 9150 | cookie = hdd_request_cookie(request); |
| 9151 | |
| 9152 | packetFilterClrReq.cbCtx = cookie; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9153 | packetFilterClrReq.filterId = pRequest->filterId; |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9154 | packetFilterClrReq.pktFilterCallback = hdd_pkt_filter_done; |
Hanumanth Reddy Pothula | 73a2ca8 | 2018-04-11 12:54:39 +0530 | [diff] [blame] | 9155 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter( |
| 9156 | pHddCtx->hHal, |
| 9157 | &packetFilterClrReq, |
| 9158 | pAdapter->sessionId)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9159 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9160 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to execute Clear Filter", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9161 | __func__); |
Hanumanth Reddy Pothula | 249a2b0 | 2018-05-30 17:04:25 +0530 | [diff] [blame] | 9162 | hdd_request_put(request); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9163 | return -EINVAL; |
| 9164 | } |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9165 | |
Hanumanth Reddy Pothula | 73a2ca8 | 2018-04-11 12:54:39 +0530 | [diff] [blame] | 9166 | status = hdd_request_wait_for_response(request); |
| 9167 | hdd_request_put(request); |
| 9168 | if (status) |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9169 | { |
| 9170 | hddLog(LOGE, FL("failure waiting for pkt_filter_comp_var %d"), |
| 9171 | status); |
| 9172 | return -EINVAL; |
| 9173 | } |
Sravan Kumar Kairam | a97e237 | 2016-11-11 17:20:03 +0530 | [diff] [blame] | 9174 | |
| 9175 | WLANTL_SetDataPktFilter((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 9176 | pHddStaCtx->conn_info.staId[0], false); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9177 | break; |
| 9178 | |
| 9179 | default : |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9180 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Packet Filter Request: Invalid %d", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9181 | __func__, pRequest->filterAction); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9182 | return -EINVAL; |
| 9183 | } |
| 9184 | return 0; |
| 9185 | } |
| 9186 | |
Gopichand Nakkala | 227c7f3 | 2013-06-26 22:44:57 +0530 | [diff] [blame] | 9187 | int wlan_hdd_setIPv6Filter(hdd_context_t *pHddCtx, tANI_U8 filterType, |
| 9188 | tANI_U8 sessionId) |
| 9189 | { |
| 9190 | tSirRcvPktFilterCfgType packetFilterSetReq = {0}; |
| 9191 | tSirRcvFltPktClearParam packetFilterClrReq = {0}; |
| 9192 | |
| 9193 | if (NULL == pHddCtx) |
| 9194 | { |
| 9195 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" NULL HDD Context Passed")); |
| 9196 | return -EINVAL; |
| 9197 | } |
| 9198 | |
| 9199 | if (pHddCtx->isLogpInProgress) |
| 9200 | { |
| 9201 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9202 | "%s:LOGP in Progress. Ignore!!!", __func__); |
| 9203 | return -EBUSY; |
| 9204 | } |
| 9205 | |
| 9206 | if (pHddCtx->cfg_ini->disablePacketFilter) |
| 9207 | { |
| 9208 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9209 | "%s: Packet Filtering Disabled. Returning ", |
| 9210 | __func__ ); |
| 9211 | return -EINVAL; |
| 9212 | } |
| 9213 | |
| 9214 | switch (filterType) |
| 9215 | { |
| 9216 | /* For setting IPV6 MC and UC Filter we need to configure |
| 9217 | * 2 filters, one for MC and one for UC. |
| 9218 | * The Filter ID shouldn't be swapped, which results in making |
| 9219 | * UC Filter ineffective. |
| 9220 | * We have Hardcode all the values |
| 9221 | * |
| 9222 | * Reason for a seperate UC filter is because, driver need to |
| 9223 | * specify the FW that the specific filter is for unicast |
| 9224 | * otherwise FW will not pass the unicast frames by default |
| 9225 | * through the filter. This is required to avoid any performance |
| 9226 | * hits when no unicast filter is set and only MC/BC are set. |
| 9227 | * The way driver informs host is by using the MAC protocol |
| 9228 | * layer, CMP flag set to MAX, CMP Data set to 1. |
| 9229 | */ |
| 9230 | |
| 9231 | case HDD_FILTER_IPV6_MC_UC: |
| 9232 | /* Setting IPV6 MC Filter below |
| 9233 | */ |
| 9234 | packetFilterSetReq.filterType = HDD_RCV_FILTER_SET; |
| 9235 | packetFilterSetReq.filterId = HDD_FILTER_ID_IPV6_MC; |
| 9236 | packetFilterSetReq.numFieldParams = 2; |
| 9237 | packetFilterSetReq.paramsData[0].protocolLayer = |
| 9238 | HDD_FILTER_PROTO_TYPE_MAC; |
| 9239 | packetFilterSetReq.paramsData[0].cmpFlag = |
| 9240 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 9241 | packetFilterSetReq.paramsData[0].dataOffset = |
| 9242 | WLAN_HDD_80211_FRM_DA_OFFSET; |
| 9243 | packetFilterSetReq.paramsData[0].dataLength = 1; |
| 9244 | packetFilterSetReq.paramsData[0].compareData[0] = |
| 9245 | HDD_IPV6_MC_CMP_DATA; |
| 9246 | |
| 9247 | packetFilterSetReq.paramsData[1].protocolLayer = |
| 9248 | HDD_FILTER_PROTO_TYPE_ARP; |
| 9249 | packetFilterSetReq.paramsData[1].cmpFlag = |
| 9250 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 9251 | packetFilterSetReq.paramsData[1].dataOffset = ETH_ALEN; |
| 9252 | packetFilterSetReq.paramsData[1].dataLength = 2; |
| 9253 | packetFilterSetReq.paramsData[1].compareData[0] = |
| 9254 | HDD_IPV6_CMP_DATA_0; |
| 9255 | packetFilterSetReq.paramsData[1].compareData[1] = |
| 9256 | HDD_IPV6_CMP_DATA_1; |
| 9257 | |
| 9258 | |
| 9259 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, |
| 9260 | &packetFilterSetReq, sessionId)) |
| 9261 | { |
| 9262 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9263 | "%s: Failure to execute Set IPv6 Mulicast Filter", |
| 9264 | __func__); |
| 9265 | return -EINVAL; |
| 9266 | } |
| 9267 | |
| 9268 | memset( &packetFilterSetReq, 0, sizeof(tSirRcvPktFilterCfgType)); |
| 9269 | |
| 9270 | /* |
| 9271 | * Setting IPV6 UC Filter below |
| 9272 | */ |
| 9273 | packetFilterSetReq.filterType = HDD_RCV_FILTER_SET; |
| 9274 | packetFilterSetReq.filterId = HDD_FILTER_ID_IPV6_UC; |
| 9275 | packetFilterSetReq.numFieldParams = 2; |
| 9276 | packetFilterSetReq.paramsData[0].protocolLayer = |
| 9277 | HDD_FILTER_PROTO_TYPE_MAC; |
| 9278 | packetFilterSetReq.paramsData[0].cmpFlag = |
| 9279 | HDD_FILTER_CMP_TYPE_MAX; |
| 9280 | packetFilterSetReq.paramsData[0].dataOffset = 0; |
| 9281 | packetFilterSetReq.paramsData[0].dataLength = 1; |
| 9282 | packetFilterSetReq.paramsData[0].compareData[0] = |
| 9283 | HDD_IPV6_UC_CMP_DATA; |
| 9284 | |
| 9285 | packetFilterSetReq.paramsData[1].protocolLayer = |
| 9286 | HDD_FILTER_PROTO_TYPE_ARP; |
| 9287 | packetFilterSetReq.paramsData[1].cmpFlag = |
| 9288 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 9289 | packetFilterSetReq.paramsData[1].dataOffset = ETH_ALEN; |
| 9290 | packetFilterSetReq.paramsData[1].dataLength = 2; |
| 9291 | packetFilterSetReq.paramsData[1].compareData[0] = |
| 9292 | HDD_IPV6_CMP_DATA_0; |
| 9293 | packetFilterSetReq.paramsData[1].compareData[1] = |
| 9294 | HDD_IPV6_CMP_DATA_1; |
| 9295 | |
| 9296 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, |
| 9297 | &packetFilterSetReq, sessionId)) |
| 9298 | { |
| 9299 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9300 | "%s: Failure to execute Set IPv6 Unicast Filter", |
| 9301 | __func__); |
| 9302 | return -EINVAL; |
| 9303 | } |
| 9304 | |
| 9305 | break; |
| 9306 | |
| 9307 | case HDD_FILTER_IPV6_MC: |
| 9308 | /* |
| 9309 | * IPV6 UC Filter might be already set, |
| 9310 | * clear the UC Filter. As the Filter |
| 9311 | * IDs are static, we can directly clear it. |
| 9312 | */ |
| 9313 | packetFilterSetReq.filterType = HDD_RCV_FILTER_SET; |
| 9314 | packetFilterClrReq.filterId = HDD_FILTER_ID_IPV6_UC; |
| 9315 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterClearFilter(pHddCtx->hHal, |
| 9316 | &packetFilterClrReq, sessionId)) |
| 9317 | { |
| 9318 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9319 | "%s: Failure to execute Clear IPv6 Unicast Filter", |
| 9320 | __func__); |
| 9321 | return -EINVAL; |
| 9322 | } |
| 9323 | |
| 9324 | /* |
| 9325 | * Setting IPV6 MC Filter below |
| 9326 | */ |
| 9327 | packetFilterSetReq.filterId = HDD_FILTER_ID_IPV6_MC; |
| 9328 | packetFilterSetReq.numFieldParams = 2; |
| 9329 | packetFilterSetReq.paramsData[0].protocolLayer = |
| 9330 | HDD_FILTER_PROTO_TYPE_MAC; |
| 9331 | packetFilterSetReq.paramsData[0].cmpFlag = |
| 9332 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 9333 | packetFilterSetReq.paramsData[0].dataOffset = |
| 9334 | WLAN_HDD_80211_FRM_DA_OFFSET; |
| 9335 | packetFilterSetReq.paramsData[0].dataLength = 1; |
| 9336 | packetFilterSetReq.paramsData[0].compareData[0] = |
| 9337 | HDD_IPV6_MC_CMP_DATA; |
| 9338 | |
| 9339 | packetFilterSetReq.paramsData[1].protocolLayer = |
| 9340 | HDD_FILTER_PROTO_TYPE_ARP; |
| 9341 | packetFilterSetReq.paramsData[1].cmpFlag = |
| 9342 | HDD_FILTER_CMP_TYPE_NOT_EQUAL; |
| 9343 | packetFilterSetReq.paramsData[1].dataOffset = ETH_ALEN; |
| 9344 | packetFilterSetReq.paramsData[1].dataLength = 2; |
| 9345 | packetFilterSetReq.paramsData[1].compareData[0] = |
| 9346 | HDD_IPV6_CMP_DATA_0; |
| 9347 | packetFilterSetReq.paramsData[1].compareData[1] = |
| 9348 | HDD_IPV6_CMP_DATA_1; |
| 9349 | |
| 9350 | |
| 9351 | if (eHAL_STATUS_SUCCESS != sme_ReceiveFilterSetFilter(pHddCtx->hHal, |
| 9352 | &packetFilterSetReq, sessionId)) |
| 9353 | { |
| 9354 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9355 | "%s: Failure to execute Set IPv6 Multicast Filter", |
| 9356 | __func__); |
| 9357 | return -EINVAL; |
| 9358 | } |
| 9359 | break; |
| 9360 | |
| 9361 | default : |
| 9362 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 9363 | "%s: Packet Filter Request: Invalid", |
| 9364 | __func__); |
| 9365 | return -EINVAL; |
| 9366 | } |
| 9367 | return 0; |
| 9368 | } |
| 9369 | |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 9370 | 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] | 9371 | { |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 9372 | v_U8_t i; |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9373 | tpSirRcvFltMcAddrList pMulticastAddrs = NULL; |
Yue Ma | 3ede605 | 2013-08-29 00:33:26 -0700 | [diff] [blame] | 9374 | tHalHandle hHal = NULL; |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9375 | hdd_context_t* pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9376 | |
Yue Ma | 3ede605 | 2013-08-29 00:33:26 -0700 | [diff] [blame] | 9377 | if (NULL == pHddCtx) |
| 9378 | { |
| 9379 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD CTX is NULL")); |
| 9380 | return; |
| 9381 | } |
| 9382 | |
| 9383 | hHal = pHddCtx->hHal; |
| 9384 | |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9385 | if (NULL == hHal) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9386 | { |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9387 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HAL Handle is NULL")); |
| 9388 | return; |
| 9389 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9390 | |
| 9391 | /* Check if INI is enabled or not, other wise just return |
| 9392 | */ |
Madan Mohan Koyyalamudi | ac94c7e | 2013-08-12 09:37:34 +0530 | [diff] [blame] | 9393 | if (pHddCtx->cfg_ini->fEnableMCAddrList) |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9394 | { |
| 9395 | pMulticastAddrs = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList)); |
| 9396 | if (NULL == pMulticastAddrs) |
| 9397 | { |
| 9398 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Could not allocate Memory")); |
| 9399 | return; |
| 9400 | } |
| 9401 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9402 | if (set) |
| 9403 | { |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9404 | /* Following pre-conditions should be satisfied before wei |
| 9405 | * configure the MC address list. |
| 9406 | */ |
| 9407 | if (((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 9408 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) |
| 9409 | && pAdapter->mc_addr_list.mc_cnt |
| 9410 | && (eConnectionState_Associated == |
| 9411 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 9412 | { |
| 9413 | pMulticastAddrs->ulMulticastAddrCnt = |
| 9414 | pAdapter->mc_addr_list.mc_cnt; |
| 9415 | for (i = 0; i < pAdapter->mc_addr_list.mc_cnt; i++) |
| 9416 | { |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 9417 | memcpy(pMulticastAddrs->multicastAddr[i], |
| 9418 | pAdapter->mc_addr_list.addr[i], |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9419 | sizeof(pAdapter->mc_addr_list.addr[i])); |
| 9420 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 9421 | "%s: %s multicast filter: addr =" |
| 9422 | MAC_ADDRESS_STR, |
| 9423 | __func__, set ? "setting" : "clearing", |
| 9424 | MAC_ADDR_ARRAY(pMulticastAddrs->multicastAddr[i])); |
| 9425 | } |
| 9426 | /* Set multicast filter */ |
| 9427 | sme_8023MulticastList(hHal, pAdapter->sessionId, |
| 9428 | pMulticastAddrs); |
| 9429 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9430 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9431 | else |
| 9432 | { |
| 9433 | /* Need to clear only if it was previously configured |
| 9434 | */ |
| 9435 | if (pAdapter->mc_addr_list.isFilterApplied) |
| 9436 | { |
| 9437 | pMulticastAddrs->ulMulticastAddrCnt = 0; |
| 9438 | sme_8023MulticastList(hHal, pAdapter->sessionId, |
| 9439 | pMulticastAddrs); |
| 9440 | } |
| 9441 | |
| 9442 | } |
| 9443 | pAdapter->mc_addr_list.isFilterApplied = set ? TRUE : FALSE; |
Sameer Thalappil | b492efd | 2013-10-23 14:21:51 -0700 | [diff] [blame] | 9444 | vos_mem_free(pMulticastAddrs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9445 | } |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9446 | else |
| 9447 | { |
| 9448 | hddLog(VOS_TRACE_LEVEL_INFO, |
Madan Mohan Koyyalamudi | ac94c7e | 2013-08-12 09:37:34 +0530 | [diff] [blame] | 9449 | FL("gMCAddrListEnable is not enabled in INI")); |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9450 | } |
| 9451 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9452 | } |
| 9453 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 9454 | static int __iw_set_packet_filter_params(struct net_device *dev, |
| 9455 | struct iw_request_info *info, |
| 9456 | union iwreq_data *wrqu, char *extra) |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 9457 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9458 | hdd_adapter_t *pAdapter; |
| 9459 | hdd_context_t *pHddCtx; |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 9460 | tpPacketFilterCfg pRequest = NULL; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9461 | int ret = 0; |
Girish Gowli | dfdf85e | 2014-06-12 21:01:35 +0530 | [diff] [blame] | 9462 | struct iw_point s_priv_data; |
| 9463 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9464 | ENTER(); |
Hanumantha Reddy Pothula | d75a8d8 | 2015-10-27 21:55:28 +0530 | [diff] [blame] | 9465 | |
| 9466 | if (!capable(CAP_NET_ADMIN)) |
| 9467 | { |
| 9468 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9469 | FL("permission check failed")); |
| 9470 | return -EPERM; |
| 9471 | } |
| 9472 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9473 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9474 | if (NULL == pAdapter) |
| 9475 | { |
| 9476 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9477 | "%s: Adapter is NULL",__func__); |
| 9478 | return -EINVAL; |
| 9479 | } |
| 9480 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9481 | ret = wlan_hdd_validate_context(pHddCtx); |
| 9482 | if (0 != ret) |
| 9483 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9484 | return ret; |
| 9485 | } |
Girish Gowli | dfdf85e | 2014-06-12 21:01:35 +0530 | [diff] [blame] | 9486 | if (hdd_priv_get_data(&s_priv_data, wrqu)) |
| 9487 | { |
| 9488 | return -EINVAL; |
| 9489 | } |
| 9490 | |
| 9491 | if ((NULL == s_priv_data.pointer) || (0 == s_priv_data.length)) |
| 9492 | { |
| 9493 | return -EINVAL; |
| 9494 | } |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 9495 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 9496 | /* ODD number is used for set, copy data using copy_from_user */ |
Girish Gowli | dfdf85e | 2014-06-12 21:01:35 +0530 | [diff] [blame] | 9497 | pRequest = mem_alloc_copy_from_user_helper(s_priv_data.pointer, |
| 9498 | s_priv_data.length); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 9499 | if (NULL == pRequest) |
| 9500 | { |
| 9501 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9502 | "mem_alloc_copy_from_user_helper fail"); |
| 9503 | return -ENOMEM; |
| 9504 | } |
| 9505 | |
Hanumanth Reddy Pothula | 73010b9 | 2016-11-01 16:16:58 +0530 | [diff] [blame] | 9506 | ret = wlan_hdd_set_filter(pAdapter, pRequest); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 9507 | kfree(pRequest); |
| 9508 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9509 | EXIT(); |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 9510 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9511 | } |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 9512 | |
| 9513 | static int iw_set_packet_filter_params(struct net_device *dev, |
| 9514 | struct iw_request_info *info, |
| 9515 | union iwreq_data *wrqu, char *extra) |
| 9516 | { |
| 9517 | int ret; |
| 9518 | |
| 9519 | vos_ssr_protect(__func__); |
| 9520 | ret = __iw_set_packet_filter_params(dev, info, wrqu, extra); |
| 9521 | vos_ssr_unprotect(__func__); |
| 9522 | |
| 9523 | return ret; |
| 9524 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9525 | #endif |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 9526 | static int __iw_get_statistics(struct net_device *dev, |
| 9527 | struct iw_request_info *info, |
| 9528 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9529 | { |
| 9530 | |
| 9531 | VOS_STATUS vos_status = VOS_STATUS_SUCCESS; |
| 9532 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9533 | hdd_wext_state_t *pWextState; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9534 | hdd_adapter_t *pAdapter; |
| 9535 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9536 | char *p = extra; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9537 | int tlen = 0, ret = 0; |
| 9538 | tCsrSummaryStatsInfo *pStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9539 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9540 | tCsrGlobalClassAStatsInfo *aStats; |
| 9541 | tCsrGlobalClassDStatsInfo *dStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9542 | |
| 9543 | ENTER(); |
| 9544 | |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9545 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9546 | if (NULL == pAdapter) |
| 9547 | { |
| 9548 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9549 | "%s: Adapter is NULL",__func__); |
| 9550 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9551 | } |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9552 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9553 | ret = wlan_hdd_validate_context(pHddCtx); |
| 9554 | if (0 != ret) |
| 9555 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9556 | return ret; |
| 9557 | } |
| 9558 | pStats = &(pAdapter->hdd_stats.summary_stat); |
| 9559 | aStats = &(pAdapter->hdd_stats.ClassA_stat); |
| 9560 | dStats = &(pAdapter->hdd_stats.ClassD_stat); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9561 | if (eConnectionState_Associated != (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) { |
| 9562 | |
| 9563 | wrqu->txpower.value = 0; |
| 9564 | } |
| 9565 | else { |
| 9566 | status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD, |
| 9567 | SME_SUMMARY_STATS | |
| 9568 | SME_GLOBAL_CLASSA_STATS | |
| 9569 | SME_GLOBAL_CLASSB_STATS | |
| 9570 | SME_GLOBAL_CLASSC_STATS | |
| 9571 | SME_GLOBAL_CLASSD_STATS | |
| 9572 | SME_PER_STA_STATS, |
| 9573 | hdd_StatisticsCB, 0, FALSE, |
| 9574 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter ); |
| 9575 | |
| 9576 | if (eHAL_STATUS_SUCCESS != status) |
| 9577 | { |
| 9578 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9579 | "%s: Unable to retrieve SME statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9580 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9581 | return -EINVAL; |
| 9582 | } |
| 9583 | |
| 9584 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9585 | if (NULL == pWextState) |
| 9586 | { |
| 9587 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9588 | "%s: pWextState is NULL",__func__); |
| 9589 | return -EINVAL; |
| 9590 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9591 | |
| 9592 | vos_status = vos_wait_single_event(&pWextState->vosevent, WLAN_WAIT_TIME_STATS); |
| 9593 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 9594 | { |
| 9595 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 9596 | "%s: SME timeout while retrieving statistics", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9597 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9598 | /*Remove the SME statistics list by passing NULL in callback argument*/ |
| 9599 | status = sme_GetStatistics( pHddCtx->hHal, eCSR_HDD, |
| 9600 | SME_SUMMARY_STATS | |
| 9601 | SME_GLOBAL_CLASSA_STATS | |
| 9602 | SME_GLOBAL_CLASSB_STATS | |
| 9603 | SME_GLOBAL_CLASSC_STATS | |
| 9604 | SME_GLOBAL_CLASSD_STATS | |
| 9605 | SME_PER_STA_STATS, |
| 9606 | NULL, 0, FALSE, |
| 9607 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.staId[0], pAdapter ); |
| 9608 | |
| 9609 | return -EINVAL; |
| 9610 | } |
| 9611 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RETRY_CNT, |
| 9612 | (tANI_U8) sizeof (pStats->retry_cnt), |
| 9613 | (char*) &(pStats->retry_cnt[0]), |
| 9614 | tlen); |
| 9615 | |
| 9616 | FILL_TLV(p, (tANI_U8)WLAN_STATS_MUL_RETRY_CNT, |
| 9617 | (tANI_U8) sizeof (pStats->multiple_retry_cnt), |
| 9618 | (char*) &(pStats->multiple_retry_cnt[0]), |
| 9619 | tlen); |
| 9620 | |
| 9621 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_FRM_CNT, |
| 9622 | (tANI_U8) sizeof (pStats->tx_frm_cnt), |
| 9623 | (char*) &(pStats->tx_frm_cnt[0]), |
| 9624 | tlen); |
| 9625 | |
| 9626 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_FRM_CNT, |
| 9627 | (tANI_U8) sizeof (pStats->rx_frm_cnt), |
| 9628 | (char*) &(pStats->rx_frm_cnt), |
| 9629 | tlen); |
| 9630 | |
| 9631 | FILL_TLV(p, (tANI_U8)WLAN_STATS_FRM_DUP_CNT, |
| 9632 | (tANI_U8) sizeof (pStats->frm_dup_cnt), |
| 9633 | (char*) &(pStats->frm_dup_cnt), |
| 9634 | tlen); |
| 9635 | |
| 9636 | FILL_TLV(p, (tANI_U8)WLAN_STATS_FAIL_CNT, |
| 9637 | (tANI_U8) sizeof (pStats->fail_cnt), |
| 9638 | (char*) &(pStats->fail_cnt[0]), |
| 9639 | tlen); |
| 9640 | |
| 9641 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_FAIL_CNT, |
| 9642 | (tANI_U8) sizeof (pStats->rts_fail_cnt), |
| 9643 | (char*) &(pStats->rts_fail_cnt), |
| 9644 | tlen); |
| 9645 | |
| 9646 | FILL_TLV(p, (tANI_U8)WLAN_STATS_ACK_FAIL_CNT, |
| 9647 | (tANI_U8) sizeof (pStats->ack_fail_cnt), |
| 9648 | (char*) &(pStats->ack_fail_cnt), |
| 9649 | tlen); |
| 9650 | |
| 9651 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RTS_SUC_CNT, |
| 9652 | (tANI_U8) sizeof (pStats->rts_succ_cnt), |
| 9653 | (char*) &(pStats->rts_succ_cnt), |
| 9654 | tlen); |
| 9655 | |
| 9656 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_DISCARD_CNT, |
| 9657 | (tANI_U8) sizeof (pStats->rx_discard_cnt), |
| 9658 | (char*) &(pStats->rx_discard_cnt), |
| 9659 | tlen); |
| 9660 | |
| 9661 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_ERROR_CNT, |
| 9662 | (tANI_U8) sizeof (pStats->rx_error_cnt), |
| 9663 | (char*) &(pStats->rx_error_cnt), |
| 9664 | tlen); |
| 9665 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 9666 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BYTE_CNT, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9667 | (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]), |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 9668 | (char*) &(dStats->tx_uc_byte_cnt[0]), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9669 | tlen); |
| 9670 | |
| 9671 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BYTE_CNT, |
| 9672 | (tANI_U8) sizeof (dStats->rx_byte_cnt), |
| 9673 | (char*) &(dStats->rx_byte_cnt), |
| 9674 | tlen); |
| 9675 | |
| 9676 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_RATE, |
| 9677 | (tANI_U8) sizeof (dStats->rx_rate), |
| 9678 | (char*) &(dStats->rx_rate), |
| 9679 | tlen); |
| 9680 | |
| 9681 | /* Transmit rate, in units of 500 kbit/sec */ |
| 9682 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_RATE, |
| 9683 | (tANI_U8) sizeof (aStats->tx_rate), |
| 9684 | (char*) &(aStats->tx_rate), |
| 9685 | tlen); |
| 9686 | |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 9687 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_UC_BYTE_CNT, |
| 9688 | (tANI_U8) sizeof (dStats->rx_uc_byte_cnt[0]), |
| 9689 | (char*) &(dStats->rx_uc_byte_cnt[0]), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9690 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 9691 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_MC_BYTE_CNT, |
| 9692 | (tANI_U8) sizeof (dStats->rx_mc_byte_cnt), |
| 9693 | (char*) &(dStats->rx_mc_byte_cnt), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9694 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 9695 | FILL_TLV(p, (tANI_U8)WLAN_STATS_RX_BC_BYTE_CNT, |
| 9696 | (tANI_U8) sizeof (dStats->rx_bc_byte_cnt), |
| 9697 | (char*) &(dStats->rx_bc_byte_cnt), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9698 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 9699 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_UC_BYTE_CNT, |
| 9700 | (tANI_U8) sizeof (dStats->tx_uc_byte_cnt[0]), |
| 9701 | (char*) &(dStats->tx_uc_byte_cnt[0]), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9702 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 9703 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_MC_BYTE_CNT, |
| 9704 | (tANI_U8) sizeof (dStats->tx_mc_byte_cnt), |
| 9705 | (char*) &(dStats->tx_mc_byte_cnt), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9706 | tlen); |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 9707 | FILL_TLV(p, (tANI_U8)WLAN_STATS_TX_BC_BYTE_CNT, |
| 9708 | (tANI_U8) sizeof (dStats->tx_bc_byte_cnt), |
| 9709 | (char*) &(dStats->tx_bc_byte_cnt), |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9710 | tlen); |
| 9711 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9712 | wrqu->data.length = tlen; |
| 9713 | |
| 9714 | } |
| 9715 | |
| 9716 | EXIT(); |
| 9717 | |
| 9718 | return 0; |
| 9719 | } |
| 9720 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 9721 | static int iw_get_statistics(struct net_device *dev, |
| 9722 | struct iw_request_info *info, |
| 9723 | union iwreq_data *wrqu, char *extra) |
| 9724 | { |
| 9725 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9726 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 9727 | vos_ssr_protect(__func__); |
| 9728 | ret = __iw_get_statistics(dev, info, wrqu, extra); |
| 9729 | vos_ssr_unprotect(__func__); |
| 9730 | |
| 9731 | return ret; |
| 9732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9733 | #ifdef FEATURE_WLAN_SCAN_PNO |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9734 | VOS_STATUS iw_set_rssi_filter(struct net_device *dev, struct iw_request_info *info, |
| 9735 | union iwreq_data *wrqu, char *extra, int nOffset) |
| 9736 | { |
| 9737 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9738 | v_U8_t rssiThreshold = 0; |
| 9739 | v_U8_t nRead; |
| 9740 | |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 9741 | nRead = sscanf(extra + nOffset,"%hhu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9742 | &rssiThreshold); |
| 9743 | |
| 9744 | if ( 1 != nRead ) |
| 9745 | { |
| 9746 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 9747 | "Incorrect format"); |
| 9748 | return VOS_STATUS_E_FAILURE; |
| 9749 | } |
| 9750 | |
| 9751 | sme_SetRSSIFilter(WLAN_HDD_GET_HAL_CTX(pAdapter), rssiThreshold); |
| 9752 | return VOS_STATUS_SUCCESS; |
| 9753 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9754 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 9755 | |
| 9756 | //Common function to SetBand |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 9757 | int hdd_setBand(struct net_device *dev, u8 ui_band) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9758 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9759 | hdd_adapter_t *pAdapter; |
| 9760 | tHalHandle hHal; |
| 9761 | hdd_context_t *pHddCtx; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 9762 | hdd_scaninfo_t *pScanInfo = NULL; |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 9763 | eCsrBand band; |
Sachin Ahuja | 120bf63 | 2015-02-24 18:06:34 +0530 | [diff] [blame] | 9764 | int wait_result; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9765 | eCsrBand currBand = eCSR_BAND_MAX; |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 9766 | eCsrBand connectedBand; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9767 | tpAniSirGlobal pMac; |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 9768 | int retval = SEND_CHANNEL_CHANGE_EVENT; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9769 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9770 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9771 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9772 | if (NULL == pAdapter) |
| 9773 | { |
| 9774 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9775 | "%s: Adapter is NULL",__func__); |
| 9776 | return -EINVAL; |
| 9777 | } |
| 9778 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9779 | retval = wlan_hdd_validate_context(pHddCtx); |
| 9780 | if (0 != retval) |
| 9781 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 9782 | return retval; |
| 9783 | } |
| 9784 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 9785 | if (NULL == hHal) |
| 9786 | { |
| 9787 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9788 | "%s: Hal Context is NULL",__func__); |
| 9789 | return -EINVAL; |
| 9790 | } |
| 9791 | pMac = PMAC_STRUCT(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9792 | |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 9793 | switch(ui_band) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9794 | { |
| 9795 | case WLAN_HDD_UI_BAND_AUTO: |
| 9796 | band = eCSR_BAND_ALL; |
| 9797 | break; |
| 9798 | case WLAN_HDD_UI_BAND_5_GHZ: |
| 9799 | band = eCSR_BAND_5G; |
| 9800 | break; |
| 9801 | case WLAN_HDD_UI_BAND_2_4_GHZ: |
| 9802 | band = eCSR_BAND_24; |
| 9803 | break; |
| 9804 | default: |
| 9805 | band = eCSR_BAND_MAX; |
| 9806 | } |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 9807 | connectedBand = |
| 9808 | hdd_connGetConnectedBand(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9809 | |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 9810 | 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] | 9811 | __func__, band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9812 | |
| 9813 | if (band == eCSR_BAND_MAX) |
| 9814 | { |
| 9815 | /* Received change band request with invalid band value */ |
| 9816 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 9817 | "%s: Invalid band value %u", __func__, ui_band); |
| 9818 | return -EINVAL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9819 | } |
| 9820 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 9821 | if ( (band == eCSR_BAND_24 && pHddCtx->cfg_ini->nBandCapability==2) || |
Sushant Kaushik | 1165f87 | 2015-03-30 20:25:27 +0530 | [diff] [blame] | 9822 | (band == eCSR_BAND_5G && pHddCtx->cfg_ini->nBandCapability==1) ) |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 9823 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 9824 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9825 | "%s: band value %u violate INI settings %u", __func__, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9826 | band, pHddCtx->cfg_ini->nBandCapability); |
| 9827 | return -EIO; |
| 9828 | } |
| 9829 | |
Sushant Kaushik | 1165f87 | 2015-03-30 20:25:27 +0530 | [diff] [blame] | 9830 | if (band == eCSR_BAND_ALL) |
| 9831 | { |
| 9832 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, FL("Auto Band " |
| 9833 | "received. Setting band same as ini value %d"), |
| 9834 | pHddCtx->cfg_ini->nBandCapability); |
| 9835 | band = pHddCtx->cfg_ini->nBandCapability; |
| 9836 | } |
| 9837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9838 | if (eHAL_STATUS_SUCCESS != sme_GetFreqBand(hHal, &currBand)) |
| 9839 | { |
| 9840 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9841 | "%s: Failed to get current band config", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9842 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9843 | return -EIO; |
| 9844 | } |
| 9845 | |
| 9846 | if (currBand != band) |
| 9847 | { |
Deepthi Gowri | 00ed0b9 | 2015-01-21 16:04:47 +0530 | [diff] [blame] | 9848 | if ( band == eCSR_BAND_5G ) |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9849 | { |
Deepthi Gowri | 00ed0b9 | 2015-01-21 16:04:47 +0530 | [diff] [blame] | 9850 | /* Return failure if current country code is world regulatory domain*/ |
| 9851 | if( (pMac->scan.countryCodeCurrent[0] == '0' && |
| 9852 | pMac->scan.countryCodeCurrent[1] == '0') ) |
| 9853 | { |
| 9854 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9855 | "%s: failed to set the band value to %u as country code is 00", |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9856 | __func__, band); |
Deepthi Gowri | 00ed0b9 | 2015-01-21 16:04:47 +0530 | [diff] [blame] | 9857 | return -EAGAIN; |
| 9858 | } |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9859 | } |
| 9860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9861 | /* Change band request received. |
| 9862 | * Abort pending scan requests, flush the existing scan results, |
| 9863 | * and change the band capability |
| 9864 | */ |
| 9865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 9866 | "%s: Current band value = %u, new setting %u ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9867 | __func__, currBand, band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9868 | |
Srinivas, Dasari | 187ca4e | 2014-02-07 12:40:09 +0530 | [diff] [blame] | 9869 | /* We need to change the band and flush the scan results here itself |
| 9870 | * as we may get timeout for disconnection in which we will return |
| 9871 | * with out doing any of these |
| 9872 | */ |
| 9873 | if (eHAL_STATUS_SUCCESS != sme_SetFreqBand(hHal, (eCsrBand)band)) |
| 9874 | { |
| 9875 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 9876 | "%s: failed to set the band value to %u ", |
| 9877 | __func__, band); |
| 9878 | return -EINVAL; |
| 9879 | } |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9880 | if(currBand == eCSR_BAND_24 || currBand == eCSR_BAND_5G) |
| 9881 | { |
Sachin Ahuja | 120bf63 | 2015-02-24 18:06:34 +0530 | [diff] [blame] | 9882 | tANI_U8 curr_country[WNI_CFG_COUNTRY_CODE_LEN]; |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9883 | curr_country[0]=pMac->scan.countryCodeCurrent[0]; |
| 9884 | curr_country[1]=pMac->scan.countryCodeCurrent[1]; |
Sachin Ahuja | 120bf63 | 2015-02-24 18:06:34 +0530 | [diff] [blame] | 9885 | INIT_COMPLETION(pHddCtx->linux_reg_req); |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9886 | /* As currunt band is already set to 2.4Ghz/5Ghz we dont have all channel |
| 9887 | * information available in NV so to get the channel information from kernel |
| 9888 | * we need to send regulatory hint for the currunt country |
| 9889 | * And to set the same country again we need to set the dummy country |
| 9890 | * first and then the actual country. |
| 9891 | */ |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9892 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
Ashish Kumar Dhanotiya | aebbe05 | 2017-11-16 14:41:09 +0530 | [diff] [blame] | 9893 | if(curr_country[0] == '0' && curr_country[1] == '0') |
| 9894 | regulatory_hint_user("IN", NL80211_USER_REG_HINT_USER); |
| 9895 | else |
Yeshwanth Sriram Guntuka | 8856621 | 2019-04-17 15:02:33 +0530 | [diff] [blame] | 9896 | regulatory_hint_user("00", NL80211_USER_REG_HINT_USER); |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9897 | #else |
Ashish Kumar Dhanotiya | aebbe05 | 2017-11-16 14:41:09 +0530 | [diff] [blame] | 9898 | if(curr_country[0] == '0' && curr_country[1] == '0') |
| 9899 | regulatory_hint_user("IN"); |
| 9900 | else |
| 9901 | regulatory_hint_user("00"); |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9902 | #endif |
Sachin Ahuja | 120bf63 | 2015-02-24 18:06:34 +0530 | [diff] [blame] | 9903 | wait_result = wait_for_completion_interruptible_timeout( |
| 9904 | &pHddCtx->linux_reg_req, |
| 9905 | msecs_to_jiffies(LINUX_REG_WAIT_TIME)); |
| 9906 | |
| 9907 | /* if the country information does not exist with the kernel, |
| 9908 | then the driver callback would not be called */ |
| 9909 | |
| 9910 | if (wait_result >= 0) |
| 9911 | { |
| 9912 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 9913 | "runtime country code is found in kernel db"); |
| 9914 | } |
| 9915 | else |
| 9916 | { |
| 9917 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN, |
| 9918 | "runtime country code is not found" |
| 9919 | " in kernel db"); |
| 9920 | } |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9921 | |
| 9922 | pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_TRUE; |
Sachin Ahuja | 120bf63 | 2015-02-24 18:06:34 +0530 | [diff] [blame] | 9923 | |
| 9924 | /* |
| 9925 | * Update 11dcountry and current country here as the hint |
| 9926 | * with 00 results in 11d and current country with 00 |
| 9927 | */ |
| 9928 | vos_mem_copy(pMac->scan.countryCode11d, curr_country, |
| 9929 | WNI_CFG_COUNTRY_CODE_LEN); |
| 9930 | vos_mem_copy(pMac->scan.countryCodeCurrent, curr_country, |
| 9931 | WNI_CFG_COUNTRY_CODE_LEN); |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9932 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 9933 | regulatory_hint_user(curr_country, NL80211_USER_REG_HINT_USER); |
| 9934 | #else |
| 9935 | regulatory_hint_user(curr_country); |
| 9936 | #endif |
Sachin Ahuja | 120bf63 | 2015-02-24 18:06:34 +0530 | [diff] [blame] | 9937 | wait_result = wait_for_completion_interruptible_timeout( |
| 9938 | &pHddCtx->linux_reg_req, |
| 9939 | msecs_to_jiffies(LINUX_REG_WAIT_TIME)); |
| 9940 | |
| 9941 | /* if the country information does not exist with the kernel, |
| 9942 | then the driver callback would not be called */ |
| 9943 | if (wait_result >= 0) |
| 9944 | { |
| 9945 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 9946 | "runtime country code is found in kernel db"); |
| 9947 | } |
| 9948 | else |
| 9949 | { |
| 9950 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_WARN, |
| 9951 | "runtime country code is not found" |
| 9952 | " in kernel db"); |
| 9953 | } |
| 9954 | |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 9955 | retval = DO_NOT_SEND_CHANNEL_CHANGE_EVENT; |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9956 | } |
| 9957 | else |
| 9958 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 9959 | #ifdef CONFIG_ENABLE_LINUX_REG |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9960 | vos_update_nv_table_from_wiphy_band((void *)pHddCtx, |
| 9961 | (void *)pHddCtx->wiphy, (eCsrBand)band); |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 9962 | #else |
| 9963 | wlan_hdd_cfg80211_update_band( pHddCtx->wiphy, (eCsrBand)band ); |
| 9964 | #endif |
| 9965 | |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 9966 | } |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 9967 | pScanInfo = &pHddCtx->scan_info; |
| 9968 | if ((pScanInfo != NULL) && pHddCtx->scan_info.mScanPending) |
| 9969 | { |
| 9970 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
| 9971 | eCSR_SCAN_ABORT_DUE_TO_BAND_CHANGE); |
| 9972 | } |
Srinivas, Dasari | 187ca4e | 2014-02-07 12:40:09 +0530 | [diff] [blame] | 9973 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
| 9974 | |
| 9975 | if (band != eCSR_BAND_ALL && |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 9976 | hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)) && |
| 9977 | (connectedBand != band)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9978 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9979 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9980 | long lrc; |
| 9981 | |
| 9982 | /* STA already connected on current band, So issue disconnect first, |
| 9983 | * then change the band*/ |
| 9984 | |
| 9985 | hddLog(VOS_TRACE_LEVEL_INFO, |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 9986 | "%s STA connected in band %u, Changing band to %u, Issuing Disconnect." |
Agarwal Ashish | 2496e87 | 2014-10-01 19:04:29 +0530 | [diff] [blame] | 9987 | , __func__, csrGetCurrentBand(hHal), band); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9988 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9989 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 9990 | |
| 9991 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 9992 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 9993 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9994 | if ( eHAL_STATUS_SUCCESS != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9995 | { |
| 9996 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9997 | "%s csrRoamDisconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9998 | __func__, (int)status ); |
| 9999 | return -EINVAL; |
| 10000 | } |
| 10001 | |
| 10002 | lrc = wait_for_completion_interruptible_timeout( |
| 10003 | &pAdapter->disconnect_comp_var, |
| 10004 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 10005 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 10006 | if (lrc <= 0) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10007 | |
Srinivas Girigowda | cb4c641 | 2013-07-02 10:19:12 -0700 | [diff] [blame] | 10008 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: %s while waiting for csrRoamDisconnect ", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10009 | __func__, (0 == lrc) ? "Timeout" : "Interrupt"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10010 | |
| 10011 | return (0 == lrc) ? -ETIMEDOUT : -EINTR; |
| 10012 | } |
| 10013 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10014 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 10015 | EXIT(); |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 10016 | if (TRUE == pHddCtx->isSetBandByNL) |
| 10017 | return 0; |
| 10018 | else |
| 10019 | return retval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10020 | } |
| 10021 | |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 10022 | int hdd_setBand_helper(struct net_device *dev, const char *command) |
| 10023 | { |
| 10024 | u8 band; |
| 10025 | |
| 10026 | /*convert the band value from ascii to integer*/ |
| 10027 | band = command[WLAN_HDD_UI_SET_BAND_VALUE_OFFSET] - '0'; |
| 10028 | |
| 10029 | return hdd_setBand(dev, band); |
| 10030 | |
| 10031 | } |
| 10032 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 10033 | static int __iw_set_band_config(struct net_device *dev, |
| 10034 | struct iw_request_info *info, |
| 10035 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10036 | { |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 10037 | int *value = (int *)extra; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10038 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 10039 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: ", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10040 | |
Hanumantha Reddy Pothula | f473d66 | 2015-10-27 21:58:39 +0530 | [diff] [blame] | 10041 | if (!capable(CAP_NET_ADMIN)) |
| 10042 | { |
| 10043 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10044 | FL("permission check failed")); |
| 10045 | return -EPERM; |
| 10046 | } |
| 10047 | |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 10048 | return hdd_setBand(dev, value[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10049 | } |
| 10050 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 10051 | static int iw_set_band_config(struct net_device *dev, |
| 10052 | struct iw_request_info *info, |
| 10053 | union iwreq_data *wrqu, char *extra) |
| 10054 | { |
| 10055 | int ret; |
| 10056 | |
| 10057 | vos_ssr_protect(__func__); |
| 10058 | ret = __iw_set_band_config(dev, info, wrqu, extra); |
| 10059 | vos_ssr_unprotect(__func__); |
| 10060 | |
| 10061 | return ret; |
| 10062 | } |
| 10063 | |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 10064 | static int get_fwr_memdump(struct net_device *dev, |
| 10065 | struct iw_request_info *info, |
| 10066 | union iwreq_data *wrqu, char *extra) |
| 10067 | { |
| 10068 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10069 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10070 | int ret; |
| 10071 | ENTER(); |
| 10072 | // HddCtx sanity |
| 10073 | ret = wlan_hdd_validate_context(pHddCtx); |
| 10074 | if (0 != ret) |
| 10075 | { |
| 10076 | return ret; |
| 10077 | } |
| 10078 | if( !pHddCtx->cfg_ini->enableFwrMemDump || |
| 10079 | (FALSE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED))) |
| 10080 | { |
| 10081 | hddLog(VOS_TRACE_LEVEL_INFO, FL("FW dump Logging not supported")); |
| 10082 | return -EINVAL; |
| 10083 | } |
| 10084 | ret = wlan_hdd_fw_mem_dump_req(pHddCtx); |
| 10085 | |
| 10086 | EXIT(); |
| 10087 | return ret; |
| 10088 | } |
| 10089 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 10090 | static int __iw_set_power_params_priv(struct net_device *dev, |
| 10091 | struct iw_request_info *info, |
| 10092 | union iwreq_data *wrqu, char *extra) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10093 | { |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 10094 | int ret; |
| 10095 | char *ptr; |
Hanumantha Reddy Pothula | 2724416 | 2015-10-27 22:10:50 +0530 | [diff] [blame] | 10096 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10097 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10098 | "Set power params Private"); |
Hanumantha Reddy Pothula | 2724416 | 2015-10-27 22:10:50 +0530 | [diff] [blame] | 10099 | |
| 10100 | if (!capable(CAP_NET_ADMIN)) |
| 10101 | { |
| 10102 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10103 | FL("permission check failed")); |
| 10104 | return -EPERM; |
| 10105 | } |
| 10106 | |
Arif Hussain | 0273cba | 2014-01-07 20:58:29 -0800 | [diff] [blame] | 10107 | /* ODD number is used for set, copy data using copy_from_user */ |
| 10108 | ptr = mem_alloc_copy_from_user_helper(wrqu->data.pointer, |
| 10109 | wrqu->data.length); |
| 10110 | if (NULL == ptr) |
| 10111 | { |
| 10112 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10113 | "mem_alloc_copy_from_user_helper fail"); |
| 10114 | return -ENOMEM; |
| 10115 | } |
| 10116 | |
| 10117 | ret = iw_set_power_params(dev, info, wrqu, ptr, 0); |
| 10118 | kfree(ptr); |
| 10119 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10120 | } |
| 10121 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 10122 | static int iw_set_power_params_priv(struct net_device *dev, |
| 10123 | struct iw_request_info *info, |
| 10124 | union iwreq_data *wrqu, char *extra) |
| 10125 | { |
| 10126 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10127 | |
Mahesh A Saptasagar | 97a9f81 | 2014-08-13 13:15:05 +0530 | [diff] [blame] | 10128 | vos_ssr_protect(__func__); |
| 10129 | ret = __iw_set_power_params_priv(dev, info, wrqu, extra); |
| 10130 | vos_ssr_unprotect(__func__); |
| 10131 | |
| 10132 | return ret; |
| 10133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10134 | |
| 10135 | /*string based input*/ |
| 10136 | VOS_STATUS iw_set_power_params(struct net_device *dev, struct iw_request_info *info, |
| 10137 | union iwreq_data *wrqu, char *extra, int nOffset) |
| 10138 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 10139 | hdd_adapter_t *pAdapter; |
| 10140 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10141 | tSirSetPowerParamsReq powerRequest; |
| 10142 | char *ptr; |
| 10143 | v_U8_t ucType; |
| 10144 | v_U32_t uTotalSize, uValue; |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 10145 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10146 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 10147 | ENTER(); |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 10148 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10149 | if (NULL == pAdapter) |
| 10150 | { |
| 10151 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10152 | "%s: Adapter is NULL",__func__); |
| 10153 | return -EINVAL; |
| 10154 | } |
| 10155 | |
| 10156 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10157 | ret = wlan_hdd_validate_context(pHddCtx); |
| 10158 | if (0 != ret) |
| 10159 | { |
Mahesh A Saptasagar | 153c466 | 2015-02-06 12:13:08 +0530 | [diff] [blame] | 10160 | return ret; |
| 10161 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10162 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10163 | "Power Params data len %d data %s", |
| 10164 | wrqu->data.length, |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 10165 | extra); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10166 | |
| 10167 | if (wrqu->data.length <= nOffset ) |
| 10168 | { |
| 10169 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, "set power param input is not correct"); |
| 10170 | return VOS_STATUS_E_FAILURE; |
| 10171 | } |
| 10172 | |
| 10173 | uTotalSize = wrqu->data.length - nOffset; |
| 10174 | |
| 10175 | /*----------------------------------------------------------------------- |
| 10176 | Input is string based and expected to be like this: |
| 10177 | |
| 10178 | <param_type> <param_value> <param_type> <param_value> ... |
| 10179 | |
| 10180 | e.g: |
| 10181 | 1 2 2 3 3 0 4 1 5 1 |
| 10182 | |
| 10183 | e.g. setting just a few: |
| 10184 | 1 2 4 1 |
| 10185 | |
| 10186 | parameter types: |
| 10187 | ----------------------------- |
| 10188 | 1 - Ignore DTIM |
| 10189 | 2 - Listen Interval |
| 10190 | 3 - Broadcast Multicas Filter |
| 10191 | 4 - Beacon Early Termination |
| 10192 | 5 - Beacon Early Termination Interval |
| 10193 | -----------------------------------------------------------------------*/ |
| 10194 | powerRequest.uIgnoreDTIM = SIR_NOCHANGE_POWER_VALUE; |
| 10195 | powerRequest.uListenInterval = SIR_NOCHANGE_POWER_VALUE; |
| 10196 | powerRequest.uBcastMcastFilter = SIR_NOCHANGE_POWER_VALUE; |
| 10197 | powerRequest.uEnableBET = SIR_NOCHANGE_POWER_VALUE; |
| 10198 | powerRequest.uBETInterval = SIR_NOCHANGE_POWER_VALUE; |
| 10199 | |
Arif Hussain | 7adce1b | 2013-11-11 22:59:34 -0800 | [diff] [blame] | 10200 | ptr = extra + nOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10201 | |
| 10202 | while ( uTotalSize ) |
| 10203 | { |
Wilson Yang | 6f97145 | 2013-10-08 15:00:00 -0700 | [diff] [blame] | 10204 | if (1 != sscanf(ptr,"%hhu %n", &(ucType), &nOffset)) |
| 10205 | { |
| 10206 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10207 | "Invalid input parameter type %s",ptr); |
| 10208 | return VOS_STATUS_E_FAILURE; |
| 10209 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10210 | |
| 10211 | uTotalSize -= nOffset; |
| 10212 | |
| 10213 | if (!uTotalSize) |
| 10214 | { |
| 10215 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 10216 | "Invalid input parameter type : %d with no value at offset %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10217 | ucType, nOffset); |
| 10218 | return VOS_STATUS_E_FAILURE; |
| 10219 | } |
| 10220 | |
| 10221 | ptr += nOffset; |
Wilson Yang | 6f97145 | 2013-10-08 15:00:00 -0700 | [diff] [blame] | 10222 | |
Jeff Johnson | 0279779 | 2013-10-26 19:17:13 -0700 | [diff] [blame] | 10223 | if (1 != sscanf(ptr,"%u %n", &(uValue), &nOffset)) |
Wilson Yang | 6f97145 | 2013-10-08 15:00:00 -0700 | [diff] [blame] | 10224 | { |
| 10225 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10226 | "Invalid input parameter value %s",ptr); |
| 10227 | return VOS_STATUS_E_FAILURE; |
| 10228 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10229 | |
| 10230 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10231 | "Power request parameter %d value %d offset %d", |
| 10232 | ucType, uValue, nOffset); |
| 10233 | |
| 10234 | switch (ucType) |
| 10235 | { |
| 10236 | case eSIR_IGNORE_DTIM: |
| 10237 | powerRequest.uIgnoreDTIM = uValue; |
| 10238 | break; |
| 10239 | case eSIR_LISTEN_INTERVAL: |
| 10240 | powerRequest.uListenInterval = uValue; |
| 10241 | break; |
| 10242 | case eSIR_MCAST_BCAST_FILTER: |
| 10243 | powerRequest.uBcastMcastFilter = uValue; |
| 10244 | break; |
| 10245 | case eSIR_ENABLE_BET: |
| 10246 | powerRequest.uEnableBET = uValue; |
| 10247 | break; |
| 10248 | case eSIR_BET_INTERVAL: |
| 10249 | powerRequest.uBETInterval = uValue; |
| 10250 | break; |
| 10251 | default: |
| 10252 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 10253 | "Invalid input parameter type : %d with value: %d at offset %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10254 | ucType, uValue, nOffset); |
| 10255 | return VOS_STATUS_E_FAILURE; |
| 10256 | } |
| 10257 | |
| 10258 | uTotalSize -= nOffset; |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 10259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10260 | "Power request parameter %d Total size", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10261 | uTotalSize); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10262 | ptr += nOffset; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10263 | /* This is added for dynamic Tele LI enable (0xF1) /disable (0xF0)*/ |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 10264 | if(!(uTotalSize - nOffset) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10265 | (powerRequest.uListenInterval != SIR_NOCHANGE_POWER_VALUE)) |
| 10266 | { |
| 10267 | uTotalSize = 0; |
| 10268 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10269 | |
| 10270 | }/*Go for as long as we have a valid string*/ |
| 10271 | |
| 10272 | /* put the device into full power*/ |
| 10273 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE); |
| 10274 | |
| 10275 | /* Apply the power save params*/ |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 10276 | sme_SetPowerParams( WLAN_HDD_GET_HAL_CTX(pAdapter), &powerRequest, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10277 | |
| 10278 | /* put the device back to power save*/ |
| 10279 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO); |
| 10280 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 10281 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10282 | return VOS_STATUS_SUCCESS; |
| 10283 | }/*iw_set_power_params*/ |
| 10284 | |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10285 | // tdlsoffchan |
| 10286 | #ifdef FEATURE_WLAN_TDLS |
| 10287 | |
Atul Mittal | 87ec242 | 2014-09-24 13:12:50 +0530 | [diff] [blame] | 10288 | int iw_set_tdlsoffchannel(hdd_context_t *pHddCtx, int offchannel) |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10289 | { |
| 10290 | if (offchannel < 0 || offchannel > 165) |
| 10291 | { |
| 10292 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Invalid tdls off channel %u", |
| 10293 | __func__, offchannel); |
| 10294 | return -1; |
| 10295 | |
| 10296 | } |
| 10297 | |
| 10298 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls off channel from %d to %d", |
| 10299 | __func__, tdlsOffCh, offchannel); |
| 10300 | |
| 10301 | tdlsOffCh = offchannel; |
| 10302 | return 0; |
| 10303 | } |
| 10304 | |
Atul Mittal | 87ec242 | 2014-09-24 13:12:50 +0530 | [diff] [blame] | 10305 | int iw_set_tdlssecoffchanneloffset(hdd_context_t *pHddCtx, int offchanoffset) |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10306 | { |
| 10307 | if (offchanoffset == 0) |
| 10308 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 10309 | tdlsOffChBwOffset = 1; |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10310 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u", |
| 10311 | __func__, tdlsOffChBwOffset); |
| 10312 | |
| 10313 | return 0; |
| 10314 | |
| 10315 | } |
| 10316 | |
| 10317 | if ( offchanoffset == 40 ) |
| 10318 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 10319 | tdlsOffChBwOffset = 2; |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10320 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u", |
| 10321 | __func__, tdlsOffChBwOffset); |
| 10322 | |
| 10323 | return 0; |
| 10324 | |
| 10325 | } |
| 10326 | if (offchanoffset == -40) |
| 10327 | { |
| 10328 | tdlsOffChBwOffset = 3; |
| 10329 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls secondary off channel offset to %u", |
| 10330 | __func__, tdlsOffChBwOffset); |
| 10331 | |
| 10332 | return 0; |
| 10333 | |
| 10334 | } |
Pradeep Reddy POTTETI | 91566c9 | 2015-03-25 14:05:22 +0530 | [diff] [blame] | 10335 | |
| 10336 | if ((offchanoffset == 80) && |
| 10337 | (TRUE == sme_IsFeatureSupportedByFW(DOT11AC)) && |
| 10338 | (TRUE == sme_IsFeatureSupportedByDriver(DOT11AC))) |
| 10339 | { |
| 10340 | tdlsOffChBwOffset = 4; |
| 10341 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10342 | "%s: change tdls secondary off channel offset to %u", |
| 10343 | __func__, tdlsOffChBwOffset); |
| 10344 | |
| 10345 | return 0; |
| 10346 | } |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10347 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Invalid tdls secondary off channel offset %d", |
| 10348 | __func__, offchanoffset); |
| 10349 | return -1; |
| 10350 | } |
| 10351 | |
Atul Mittal | 87ec242 | 2014-09-24 13:12:50 +0530 | [diff] [blame] | 10352 | int iw_set_tdlsoffchannelmode(hdd_adapter_t *pAdapter, int offchanmode) |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10353 | { |
| 10354 | hddTdlsPeer_t *connPeer = NULL; |
| 10355 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10356 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | 4c30a09 | 2015-10-17 16:13:38 +0530 | [diff] [blame] | 10357 | tSirMacAddr peerMac; |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10358 | if (offchanmode < 0 || offchanmode > 4) |
| 10359 | { |
| 10360 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10361 | "%s: Invalid tdls off channel mode %d", |
| 10362 | __func__, offchanmode); |
| 10363 | return -1; |
| 10364 | } |
| 10365 | |
| 10366 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 10367 | { |
| 10368 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10369 | "%s: tdls off channel mode req in not associated state %d", |
| 10370 | __func__, offchanmode); |
| 10371 | return -1; |
| 10372 | } |
| 10373 | |
| 10374 | if (eTDLS_SUPPORT_ENABLED == pHddCtx->tdls_mode || |
| 10375 | eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == pHddCtx->tdls_mode) |
| 10376 | { |
| 10377 | /* Send TDLS Channel Switch Request to connected peer */ |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10378 | mutex_lock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 10379 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10380 | if (NULL == connPeer) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10381 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10382 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 10383 | "%s: No TDLS Connected Peer", __func__); |
| 10384 | return -1; |
| 10385 | } |
Masti, Narayanraddi | 4c30a09 | 2015-10-17 16:13:38 +0530 | [diff] [blame] | 10386 | vos_mem_copy(peerMac, connPeer->peerMac, sizeof(tSirMacAddr)); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10387 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10388 | } |
| 10389 | else |
| 10390 | { |
| 10391 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 10392 | "%s: TDLS Connection not supported", __func__); |
| 10393 | return -1; |
| 10394 | } |
| 10395 | |
| 10396 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10397 | ("%s: TDLS Channel Switch in swmode=%d"), |
| 10398 | __func__, offchanmode); |
| 10399 | |
| 10400 | switch (offchanmode) |
| 10401 | { |
| 10402 | case 1:/*Enable*/ |
| 10403 | case 2:/*Disable*/ |
| 10404 | { |
| 10405 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10406 | "%s: change tdls off channel mode %d tdls_off_channel %d offchanoffset %d ", |
| 10407 | __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset); |
| 10408 | if (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel) |
| 10409 | { |
| 10410 | |
| 10411 | sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Masti, Narayanraddi | 4c30a09 | 2015-10-17 16:13:38 +0530 | [diff] [blame] | 10412 | pAdapter->sessionId, peerMac, |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10413 | tdlsOffCh, tdlsOffChBwOffset, |
| 10414 | offchanmode); |
| 10415 | } |
| 10416 | else |
| 10417 | { |
| 10418 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10419 | "%s: TDLS Off Channel not supported", __func__); |
| 10420 | return -1; |
| 10421 | } |
| 10422 | break; |
| 10423 | } |
| 10424 | case 3: |
| 10425 | { |
| 10426 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10427 | "%s: change tdls off channel mode %d REJREQ 3 tdls_off_channel %d offchanoffset %d ", |
| 10428 | __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset); |
| 10429 | |
| 10430 | break; |
| 10431 | } |
| 10432 | case 4: |
| 10433 | { |
| 10434 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10435 | "%s: change tdls off channel mode %d UNSOLRESP 4 tdls_off_channel %d offchanoffset %d ", |
| 10436 | __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset); |
| 10437 | break; |
| 10438 | } |
| 10439 | default: |
| 10440 | { |
| 10441 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10442 | "%s: change tdls off channel mode %d Not SET 0 tdls_off_channel %d offchanoffset %d ", |
| 10443 | __func__, offchanmode, tdlsOffCh, tdlsOffChBwOffset); |
| 10444 | break; |
| 10445 | } |
| 10446 | |
| 10447 | } |
| 10448 | |
| 10449 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: change tdls off channel mode to %u", |
| 10450 | __func__, offchanmode); |
| 10451 | return 0; |
| 10452 | } |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10453 | #endif |
| 10454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10455 | // Define the Wireless Extensions to the Linux Network Device structure |
| 10456 | // A number of these routines are NULL (meaning they are not implemented.) |
| 10457 | |
| 10458 | static const iw_handler we_handler[] = |
| 10459 | { |
| 10460 | (iw_handler) iw_set_commit, /* SIOCSIWCOMMIT */ |
| 10461 | (iw_handler) iw_get_name, /* SIOCGIWNAME */ |
| 10462 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 10463 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 10464 | (iw_handler) iw_set_freq, /* SIOCSIWFREQ */ |
| 10465 | (iw_handler) iw_get_freq, /* SIOCGIWFREQ */ |
Ashish Kumar Dhanotiya | 6b484a8 | 2018-04-24 15:11:55 +0530 | [diff] [blame] | 10466 | (iw_handler) NULL, /* SIOCSIWMODE */ |
| 10467 | (iw_handler) NULL, /* SIOCGIWMODE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10468 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 10469 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 10470 | (iw_handler) NULL, /* SIOCSIWRANGE */ |
| 10471 | (iw_handler) iw_get_range, /* SIOCGIWRANGE */ |
SaidiReddy Yenuga | e265093 | 2016-08-30 15:34:43 +0530 | [diff] [blame] | 10472 | (iw_handler) iw_set_priv, /* SIOCSIWPRIV */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10473 | (iw_handler) NULL, /* SIOCGIWPRIV */ |
| 10474 | (iw_handler) NULL, /* SIOCSIWSTATS */ |
| 10475 | (iw_handler) NULL, /* SIOCGIWSTATS */ |
| 10476 | iw_handler_set_spy, /* SIOCSIWSPY */ |
| 10477 | iw_handler_get_spy, /* SIOCGIWSPY */ |
| 10478 | iw_handler_set_thrspy, /* SIOCSIWTHRSPY */ |
| 10479 | iw_handler_get_thrspy, /* SIOCGIWTHRSPY */ |
| 10480 | (iw_handler) iw_set_ap_address, /* SIOCSIWAP */ |
| 10481 | (iw_handler) iw_get_ap_address, /* SIOCGIWAP */ |
| 10482 | (iw_handler) iw_set_mlme, /* SIOCSIWMLME */ |
| 10483 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
| 10484 | (iw_handler) iw_set_scan, /* SIOCSIWSCAN */ |
| 10485 | (iw_handler) iw_get_scan, /* SIOCGIWSCAN */ |
| 10486 | (iw_handler) iw_set_essid, /* SIOCSIWESSID */ |
| 10487 | (iw_handler) iw_get_essid, /* SIOCGIWESSID */ |
| 10488 | (iw_handler) iw_set_nick, /* SIOCSIWNICKN */ |
| 10489 | (iw_handler) iw_get_nick, /* SIOCGIWNICKN */ |
| 10490 | (iw_handler) NULL, /* -- hole -- */ |
| 10491 | (iw_handler) NULL, /* -- hole -- */ |
| 10492 | (iw_handler) iw_set_bitrate, /* SIOCSIWRATE */ |
| 10493 | (iw_handler) iw_get_bitrate, /* SIOCGIWRATE */ |
| 10494 | (iw_handler) iw_set_rts_threshold,/* SIOCSIWRTS */ |
| 10495 | (iw_handler) iw_get_rts_threshold,/* SIOCGIWRTS */ |
| 10496 | (iw_handler) iw_set_frag_threshold, /* SIOCSIWFRAG */ |
| 10497 | (iw_handler) iw_get_frag_threshold, /* SIOCGIWFRAG */ |
| 10498 | (iw_handler) iw_set_tx_power, /* SIOCSIWTXPOW */ |
| 10499 | (iw_handler) iw_get_tx_power, /* SIOCGIWTXPOW */ |
| 10500 | (iw_handler) iw_set_retry, /* SIOCSIWRETRY */ |
| 10501 | (iw_handler) iw_get_retry, /* SIOCGIWRETRY */ |
| 10502 | (iw_handler) iw_set_encode, /* SIOCSIWENCODE */ |
| 10503 | (iw_handler) iw_get_encode, /* SIOCGIWENCODE */ |
| 10504 | (iw_handler) iw_set_power_mode, /* SIOCSIWPOWER */ |
| 10505 | (iw_handler) iw_get_power_mode, /* SIOCGIWPOWER */ |
| 10506 | (iw_handler) NULL, /* -- hole -- */ |
| 10507 | (iw_handler) NULL, /* -- hole -- */ |
| 10508 | (iw_handler) iw_set_genie, /* SIOCSIWGENIE */ |
| 10509 | (iw_handler) iw_get_genie, /* SIOCGIWGENIE */ |
| 10510 | (iw_handler) iw_set_auth, /* SIOCSIWAUTH */ |
| 10511 | (iw_handler) iw_get_auth, /* SIOCGIWAUTH */ |
| 10512 | (iw_handler) iw_set_encodeext, /* SIOCSIWENCODEEXT */ |
| 10513 | (iw_handler) iw_get_encodeext, /* SIOCGIWENCODEEXT */ |
| 10514 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 10515 | }; |
| 10516 | |
| 10517 | static const iw_handler we_private[] = { |
| 10518 | |
| 10519 | [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_setint_getnone, //set priv ioctl |
| 10520 | [WLAN_PRIV_SET_NONE_GET_INT - SIOCIWFIRSTPRIV] = iw_setnone_getint, //get priv ioctl |
| 10521 | [WLAN_PRIV_SET_CHAR_GET_NONE - SIOCIWFIRSTPRIV] = iw_setchar_getnone, //get priv ioctl |
| 10522 | [WLAN_PRIV_SET_THREE_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_set_three_ints_getnone, |
| 10523 | [WLAN_PRIV_GET_CHAR_SET_NONE - SIOCIWFIRSTPRIV] = iw_get_char_setnone, |
| 10524 | [WLAN_PRIV_SET_NONE_GET_NONE - SIOCIWFIRSTPRIV] = iw_setnone_getnone, //action priv ioctl |
Girish Gowli | fb9758e | 2014-11-19 15:19:17 +0530 | [diff] [blame] | 10525 | [WLAN_PRIV_SET_VAR_INT_GET_NONE - SIOCIWFIRSTPRIV] = iw_hdd_set_var_ints_getnone, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10526 | [WLAN_PRIV_ADD_TSPEC - SIOCIWFIRSTPRIV] = iw_add_tspec, |
| 10527 | [WLAN_PRIV_DEL_TSPEC - SIOCIWFIRSTPRIV] = iw_del_tspec, |
| 10528 | [WLAN_PRIV_GET_TSPEC - SIOCIWFIRSTPRIV] = iw_get_tspec, |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 10529 | [WLAN_PRIV_SET_NONE_GET_THREE_INT - SIOCIWFIRSTPRIV] = |
| 10530 | iw_setnone_get_threeint, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10531 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 10532 | [WLAN_PRIV_SET_OEM_DATA_REQ - SIOCIWFIRSTPRIV] = iw_set_oem_data_req, //oem data req Specifc |
| 10533 | [WLAN_PRIV_GET_OEM_DATA_RSP - SIOCIWFIRSTPRIV] = iw_get_oem_data_rsp, //oem data req Specifc |
| 10534 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10535 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10536 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10537 | [WLAN_PRIV_SET_FTIES - SIOCIWFIRSTPRIV] = iw_set_fties, |
| 10538 | #endif |
| 10539 | [WLAN_PRIV_SET_HOST_OFFLOAD - SIOCIWFIRSTPRIV] = iw_set_host_offload, |
| 10540 | [WLAN_GET_WLAN_STATISTICS - SIOCIWFIRSTPRIV] = iw_get_statistics, |
| 10541 | [WLAN_SET_KEEPALIVE_PARAMS - SIOCIWFIRSTPRIV] = iw_set_keepalive_params |
| 10542 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 10543 | , |
| 10544 | [WLAN_SET_PACKET_FILTER_PARAMS - SIOCIWFIRSTPRIV] = iw_set_packet_filter_params |
| 10545 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10546 | , |
| 10547 | [WLAN_SET_BAND_CONFIG - SIOCIWFIRSTPRIV] = iw_set_band_config, |
| 10548 | [WLAN_PRIV_SET_MCBC_FILTER - SIOCIWFIRSTPRIV] = iw_set_dynamic_mcbc_filter, |
| 10549 | [WLAN_PRIV_CLEAR_MCBC_FILTER - SIOCIWFIRSTPRIV] = iw_clear_dynamic_mcbc_filter, |
| 10550 | [WLAN_SET_POWER_PARAMS - SIOCIWFIRSTPRIV] = iw_set_power_params_priv, |
Arif Hussain | 695279c | 2014-03-24 14:06:07 -0700 | [diff] [blame] | 10551 | [WLAN_GET_LINK_SPEED - SIOCIWFIRSTPRIV] = iw_get_linkspeed_priv, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10552 | }; |
| 10553 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 10554 | static const iw_handler we_mon_private[] = { |
| 10555 | [WLAN_PRIV_SET_INT_GET_NONE - SIOCIWFIRSTPRIV] = |
| 10556 | iw_mon_setint_getnone, |
| 10557 | }; |
| 10558 | |
| 10559 | static const struct iw_priv_args we_mon_private_args[] = { |
| 10560 | {WE_SET_MONITOR_STATE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10561 | 0, "monitor"}, |
| 10562 | |
| 10563 | /* handlers for main ioctl */ |
| 10564 | {WLAN_PRIV_SET_INT_GET_NONE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10565 | 0, "" }, |
| 10566 | }; |
| 10567 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10568 | /*Maximum command length can be only 15 */ |
| 10569 | static const struct iw_priv_args we_private_args[] = { |
| 10570 | |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 10571 | { WE_SET_MONITOR_STATE, |
| 10572 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10573 | 0, "monitor" }, |
| 10574 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10575 | /* handlers for main ioctl */ |
| 10576 | { WLAN_PRIV_SET_INT_GET_NONE, |
| 10577 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10578 | 0, |
| 10579 | "" }, |
| 10580 | |
| 10581 | /* handlers for sub-ioctl */ |
| 10582 | { WE_SET_11D_STATE, |
| 10583 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10584 | 0, |
| 10585 | "set11Dstate" }, |
| 10586 | |
| 10587 | { WE_WOWL, |
| 10588 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10589 | 0, |
| 10590 | "wowl" }, |
| 10591 | |
| 10592 | { WE_SET_POWER, |
| 10593 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10594 | 0, |
| 10595 | "setPower" }, |
| 10596 | |
| 10597 | { WE_SET_MAX_ASSOC, |
| 10598 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10599 | 0, |
| 10600 | "setMaxAssoc" }, |
| 10601 | |
| 10602 | { WE_SET_SAP_AUTO_CHANNEL_SELECTION, |
| 10603 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10604 | 0, |
| 10605 | "setAutoChannel" }, |
| 10606 | |
| 10607 | { WE_SET_DATA_INACTIVITY_TO, |
| 10608 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10609 | 0, |
| 10610 | "inactivityTO" }, |
| 10611 | |
| 10612 | { WE_SET_MAX_TX_POWER, |
| 10613 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10614 | 0, |
Arif Hussain | a5ebce0 | 2013-08-09 15:09:58 -0700 | [diff] [blame] | 10615 | "setMaxTxPower" }, |
| 10616 | |
| 10617 | { WE_SET_MAX_TX_POWER_2_4, |
| 10618 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10619 | 0, |
| 10620 | "setTxMaxPower2G" }, |
| 10621 | |
| 10622 | { WE_SET_MAX_TX_POWER_5_0, |
| 10623 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10624 | 0, |
| 10625 | "setTxMaxPower5G" }, |
Rajesh Chauhan | f22af96 | 2013-07-16 18:50:29 -0700 | [diff] [blame] | 10626 | |
| 10627 | /* SAP has TxMax whereas STA has MaxTx, adding TxMax for STA |
| 10628 | * as well to keep same syntax as in SAP. Now onwards, STA |
| 10629 | * will support both */ |
| 10630 | { WE_SET_MAX_TX_POWER, |
| 10631 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10632 | 0, |
| 10633 | "setTxMaxPower" }, |
| 10634 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10635 | /* set Higher DTIM Transition (DTIM1 to DTIM3) |
| 10636 | * 1 = enable and 0 = disable */ |
| 10637 | { |
| 10638 | WE_SET_HIGHER_DTIM_TRANSITION, |
| 10639 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10640 | 0, |
| 10641 | "setHDtimTransn" }, |
| 10642 | |
| 10643 | { WE_SET_TM_LEVEL, |
| 10644 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
Mingcheng Zhu | 87f22fc | 2014-01-30 19:23:32 -0800 | [diff] [blame] | 10645 | 0, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10646 | "setTmLevel" }, |
| 10647 | |
Kiet Lam | 46b8e4e | 2013-11-06 21:49:53 +0530 | [diff] [blame] | 10648 | { WE_ENABLE_STRICT_FCC_REG, |
| 10649 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10650 | 0, |
| 10651 | "setStrictFCCreg" }, |
| 10652 | |
Tushnim Bhattacharyya | a3ba5a5 | 2014-01-30 11:37:33 -0800 | [diff] [blame] | 10653 | { WE_SET_DEBUG_LOG, |
| 10654 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10655 | 0, "setDbgLvl" }, |
Atul Mittal | c0f739f | 2014-07-31 13:47:47 +0530 | [diff] [blame] | 10656 | #ifdef FEATURE_WLAN_TDLS |
| 10657 | { |
| 10658 | WE_SET_TDLS_OFF_CHAN, |
| 10659 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10660 | 0, |
| 10661 | "tdlsoffchan" }, |
| 10662 | { |
| 10663 | WE_SET_TDLS_SEC_OFF_CHAN_OFFSET, |
| 10664 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10665 | 0, |
| 10666 | "tdlsecchnoffst" }, |
| 10667 | { |
| 10668 | WE_SET_TDLS_OFF_CHAN_MODE, |
| 10669 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10670 | 0, |
| 10671 | "tdlsoffchnmode" }, |
| 10672 | #endif |
Tushnim Bhattacharyya | a3ba5a5 | 2014-01-30 11:37:33 -0800 | [diff] [blame] | 10673 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 10674 | { WE_SET_SCAN_BAND_PREFERENCE, |
| 10675 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10676 | 0, "set_scan_pref" }, |
Siddharth Bhal | 678a934 | 2015-02-27 01:12:56 +0530 | [diff] [blame] | 10677 | { |
| 10678 | WE_GET_FRAME_LOG, |
| 10679 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10680 | 0, |
| 10681 | "getFrameLogs" }, |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 10682 | |
Abhishek Singh | 01c73d1 | 2015-03-12 15:13:44 +0530 | [diff] [blame] | 10683 | { WE_SET_MIRACAST_VENDOR_CONFIG, |
| 10684 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10685 | 0, "setMiracstConf" }, |
| 10686 | |
Pradeep Reddy POTTETI | 3150589 | 2015-04-16 16:47:54 +0530 | [diff] [blame] | 10687 | #ifdef FEATURE_WLAN_TDLS |
| 10688 | { |
| 10689 | WE_SET_TDLS_2040_BSS_COEXISTENCE, |
| 10690 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10691 | 0, |
| 10692 | "tdls_2040bsscox" }, |
| 10693 | #endif |
Abhishek Singh | 41988ba | 2015-05-25 19:42:29 +0530 | [diff] [blame] | 10694 | { WE_SET_RTS_CTS_HTVHT, |
| 10695 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10696 | 0, "setRtsCtsHtVht" }, |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 10697 | { WE_SET_PKT_STATS_ENABLE_DISABLE, |
| 10698 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10699 | 0, "setPktStats" }, |
Hanumantha Reddy Pothula | 519a1ea | 2015-12-09 14:06:03 +0530 | [diff] [blame] | 10700 | { WE_SET_PROXIMITY_ENABLE, |
| 10701 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10702 | 0, "setProximity" }, |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 10703 | |
| 10704 | #ifdef WLAN_FEATURE_TSF |
| 10705 | { WE_CAP_TSF, |
| 10706 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10707 | 0, "cap_tsf" }, |
| 10708 | #endif |
SaidiReddy Yenuga | 9c1a614 | 2017-02-06 16:30:04 +0530 | [diff] [blame] | 10709 | { WE_SET_MODULATED_DTIM, |
| 10710 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10711 | 0, "setModDTIM" }, |
SaidiReddy Yenuga | c341fbf | 2017-02-01 20:22:45 +0530 | [diff] [blame] | 10712 | { |
| 10713 | WLAN_SET_DYNNAMIC_AGGREGATION, |
| 10714 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10715 | 0, "setAggregation" }, |
| 10716 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10717 | /* handlers for main ioctl */ |
| 10718 | { WLAN_PRIV_SET_NONE_GET_INT, |
| 10719 | 0, |
| 10720 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10721 | "" }, |
| 10722 | |
| 10723 | /* handlers for sub-ioctl */ |
| 10724 | { WE_GET_11D_STATE, |
| 10725 | 0, |
| 10726 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10727 | "get11Dstate" }, |
| 10728 | |
| 10729 | { WE_IBSS_STATUS, |
| 10730 | 0, |
| 10731 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10732 | "getAdhocStatus" }, |
| 10733 | |
| 10734 | { WE_PMC_STATE, |
| 10735 | 0, |
| 10736 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10737 | "pmcState" }, |
| 10738 | |
| 10739 | { WE_GET_WLAN_DBG, |
| 10740 | 0, |
| 10741 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10742 | "getwlandbg" }, |
| 10743 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10744 | { WE_GET_MAX_ASSOC, |
| 10745 | 0, |
| 10746 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10747 | "getMaxAssoc" }, |
| 10748 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10749 | { WE_GET_WDI_DBG, |
| 10750 | 0, |
| 10751 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10752 | "getwdidbg" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10753 | |
| 10754 | { WE_GET_SAP_AUTO_CHANNEL_SELECTION, |
| 10755 | 0, |
| 10756 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10757 | "getAutoChannel" }, |
| 10758 | |
| 10759 | { WE_GET_CONCURRENCY_MODE, |
| 10760 | 0, |
| 10761 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10762 | "getconcurrency" }, |
| 10763 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 10764 | { WE_GET_SCAN_BAND_PREFERENCE, |
| 10765 | 0, |
| 10766 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10767 | "get_scan_pref"}, |
| 10768 | |
Mahesh A Saptasagar | b63b3e2 | 2015-12-22 15:06:10 +0530 | [diff] [blame] | 10769 | { WE_GET_ANTENA_DIVERSITY_SELECTION, |
| 10770 | 0, |
| 10771 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 10772 | "getCurAnt"}, |
| 10773 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10774 | /* handlers for main ioctl */ |
| 10775 | { WLAN_PRIV_SET_CHAR_GET_NONE, |
| 10776 | IW_PRIV_TYPE_CHAR| 512, |
| 10777 | 0, |
| 10778 | "" }, |
| 10779 | |
| 10780 | /* handlers for sub-ioctl */ |
| 10781 | { WE_WOWL_ADD_PTRN, |
| 10782 | IW_PRIV_TYPE_CHAR| 512, |
| 10783 | 0, |
| 10784 | "wowlAddPtrn" }, |
| 10785 | |
| 10786 | { WE_WOWL_DEL_PTRN, |
| 10787 | IW_PRIV_TYPE_CHAR| 512, |
| 10788 | 0, |
| 10789 | "wowlDelPtrn" }, |
| 10790 | |
| 10791 | #if defined WLAN_FEATURE_VOWIFI |
| 10792 | /* handlers for sub-ioctl */ |
| 10793 | { WE_NEIGHBOR_REPORT_REQUEST, |
| 10794 | IW_PRIV_TYPE_CHAR | 512, |
| 10795 | 0, |
| 10796 | "neighbor" }, |
| 10797 | #endif |
| 10798 | { WE_SET_AP_WPS_IE, |
| 10799 | IW_PRIV_TYPE_CHAR| 512, |
| 10800 | 0, |
| 10801 | "set_ap_wps_ie" }, |
| 10802 | |
| 10803 | { WE_SET_CONFIG, |
| 10804 | IW_PRIV_TYPE_CHAR| 512, |
| 10805 | 0, |
| 10806 | "setConfig" }, |
| 10807 | |
Srinivas Dasari | b8fdd42 | 2014-11-27 10:44:20 +0530 | [diff] [blame] | 10808 | { WE_SET_ENCRYPT_MSG, |
| 10809 | IW_PRIV_TYPE_CHAR| 512, |
| 10810 | 0, |
| 10811 | "encryptMsg" }, |
| 10812 | |
| 10813 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10814 | /* handlers for main ioctl */ |
| 10815 | { WLAN_PRIV_SET_THREE_INT_GET_NONE, |
| 10816 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10817 | 0, |
| 10818 | "" }, |
| 10819 | |
| 10820 | /* handlers for sub-ioctl */ |
| 10821 | { WE_SET_WLAN_DBG, |
| 10822 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10823 | 0, |
| 10824 | "setwlandbg" }, |
| 10825 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10826 | { WE_SET_WDI_DBG, |
| 10827 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10828 | 0, |
| 10829 | "setwdidbg" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10830 | |
| 10831 | { WE_SET_SAP_CHANNELS, |
| 10832 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 10833 | 0, |
| 10834 | "setsapchannels" }, |
| 10835 | |
| 10836 | /* handlers for main ioctl */ |
| 10837 | { WLAN_PRIV_GET_CHAR_SET_NONE, |
| 10838 | 0, |
| 10839 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10840 | "" }, |
| 10841 | |
| 10842 | /* handlers for sub-ioctl */ |
| 10843 | { WE_WLAN_VERSION, |
| 10844 | 0, |
| 10845 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10846 | "version" }, |
| 10847 | { WE_GET_STATS, |
| 10848 | 0, |
| 10849 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10850 | "getStats" }, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 10851 | { WE_GET_STATES, |
| 10852 | 0, |
| 10853 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10854 | "getHostStates" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10855 | { WE_GET_CFG, |
| 10856 | 0, |
| 10857 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10858 | "getConfig" }, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10859 | #ifdef WLAN_FEATURE_11AC |
| 10860 | { WE_GET_RSSI, |
| 10861 | 0, |
| 10862 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10863 | "getRSSI" }, |
| 10864 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10865 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 10866 | { WE_GET_ROAM_RSSI, |
| 10867 | 0, |
| 10868 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10869 | "getRoamRSSI" }, |
| 10870 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10871 | { WE_GET_WMM_STATUS, |
| 10872 | 0, |
| 10873 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10874 | "getWmmStatus" }, |
| 10875 | { |
| 10876 | WE_GET_CHANNEL_LIST, |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 10877 | 0, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10878 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10879 | "getChannelList" }, |
Chilam Ng | 16a2a1c | 2013-01-29 01:27:29 -0800 | [diff] [blame] | 10880 | #ifdef FEATURE_WLAN_TDLS |
| 10881 | { |
| 10882 | WE_GET_TDLS_PEERS, |
| 10883 | 0, |
| 10884 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10885 | "getTdlsPeers" }, |
| 10886 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 10887 | #ifdef WLAN_FEATURE_11W |
| 10888 | { |
| 10889 | WE_GET_11W_INFO, |
| 10890 | 0, |
| 10891 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10892 | "getPMFInfo" }, |
| 10893 | #endif |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 10894 | #ifdef WLAN_FEATURE_RMC |
| 10895 | { |
| 10896 | WE_GET_IBSS_STA_INFO, |
| 10897 | 0, |
| 10898 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10899 | "getIbssSTAs" }, |
| 10900 | #endif |
Girish Gowli | dab72f1 | 2014-09-04 15:34:43 +0530 | [diff] [blame] | 10901 | { WE_GET_SNR, |
| 10902 | 0, |
| 10903 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10904 | "getSNR" }, |
Padma, Santhosh Kumar | 8dcdb70 | 2015-10-20 14:06:21 +0530 | [diff] [blame] | 10905 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 10906 | { |
| 10907 | WE_GET_OEM_DATA_CAP, |
| 10908 | 0, |
| 10909 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 10910 | "getOemDataCap" }, |
| 10911 | #endif /* FEATURE_OEM_DATA_SUPPORT */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10912 | /* handlers for main ioctl */ |
| 10913 | { WLAN_PRIV_SET_NONE_GET_NONE, |
| 10914 | 0, |
| 10915 | 0, |
| 10916 | "" }, |
| 10917 | |
| 10918 | /* handlers for sub-ioctl */ |
| 10919 | { WE_CLEAR_STATS, |
| 10920 | 0, |
| 10921 | 0, |
| 10922 | "clearStats" }, |
| 10923 | { WE_INIT_AP, |
| 10924 | 0, |
| 10925 | 0, |
| 10926 | "initAP" }, |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 10927 | #ifdef WLAN_FEATURE_RMC |
| 10928 | { |
| 10929 | WE_IBSS_GET_PEER_INFO_ALL, |
| 10930 | 0, |
| 10931 | 0, |
| 10932 | "ibssPeerInfoAll" }, |
| 10933 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10934 | { WE_STOP_AP, |
| 10935 | 0, |
| 10936 | 0, |
| 10937 | "exitAP" }, |
Girish Gowli | 345bff8 | 2014-06-09 20:05:24 +0530 | [diff] [blame] | 10938 | #ifdef WLAN_BTAMP_FEATURE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10939 | { WE_ENABLE_AMP, |
| 10940 | 0, |
| 10941 | 0, |
| 10942 | "enableAMP" }, |
| 10943 | { WE_DISABLE_AMP, |
| 10944 | 0, |
| 10945 | 0, |
| 10946 | "disableAMP" }, |
Girish Gowli | 345bff8 | 2014-06-09 20:05:24 +0530 | [diff] [blame] | 10947 | #endif /* WLAN_BTAMP_FEATURE */ |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 10948 | { WE_ENABLE_DXE_STALL_DETECT, |
| 10949 | 0, |
| 10950 | 0, |
| 10951 | "dxeStallDetect" }, |
| 10952 | { WE_DISPLAY_DXE_SNAP_SHOT, |
| 10953 | 0, |
| 10954 | 0, |
| 10955 | "dxeSnapshot" }, |
Madan Mohan Koyyalamudi | a96f544 | 2013-05-10 11:32:06 +0530 | [diff] [blame] | 10956 | { WE_DISPLAY_DATAPATH_SNAP_SHOT, |
| 10957 | 0, |
| 10958 | 0, |
| 10959 | "dataSnapshot"}, |
Madan Mohan Koyyalamudi | 0d0e171 | 2012-10-21 12:02:45 -0700 | [diff] [blame] | 10960 | { |
Sandeep Puligilla | a3e7695 | 2014-06-23 15:53:11 +0530 | [diff] [blame] | 10961 | WE_SET_REASSOC_TRIGGER, |
| 10962 | 0, |
| 10963 | 0, |
| 10964 | "reassoc" }, |
| 10965 | { |
Sandeep Puligilla | 04bb8fd | 2014-02-03 23:21:47 +0530 | [diff] [blame] | 10966 | WE_STOP_OBSS_SCAN, |
| 10967 | 0, |
| 10968 | 0, |
| 10969 | "stopOBSSScan" }, |
Mukul Sharma | 84f2725 | 2014-07-14 18:11:42 +0530 | [diff] [blame] | 10970 | { |
| 10971 | WE_DUMP_ROAM_TIMER_LOG, |
| 10972 | 0, |
| 10973 | 0, |
| 10974 | "dumpRoamDelay" }, |
| 10975 | { |
| 10976 | WE_RESET_ROAM_TIMER_LOG, |
| 10977 | 0, |
| 10978 | 0, |
| 10979 | "resetRoamDelay" }, |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 10980 | { |
| 10981 | WE_GET_FW_LOGS, |
| 10982 | 0, |
| 10983 | 0, |
| 10984 | "getFwLogs" }, |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 10985 | { |
| 10986 | WE_GET_FW_MEMDUMP, |
| 10987 | 0, |
| 10988 | 0, |
| 10989 | "getFwMemDump" }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10990 | /* handlers for main ioctl */ |
| 10991 | { WLAN_PRIV_SET_VAR_INT_GET_NONE, |
| 10992 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 10993 | 0, |
| 10994 | "" }, |
| 10995 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 10996 | |
| 10997 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10998 | /* handlers for sub-ioctl */ |
| 10999 | { WE_LOG_DUMP_CMD, |
| 11000 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11001 | 0, |
| 11002 | "dump" }, |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 11003 | #ifdef WLAN_FEATURE_RMC |
| 11004 | { WE_IBSS_GET_PEER_INFO, |
| 11005 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11006 | 0, |
| 11007 | "ibssPeerInfo" }, |
| 11008 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11009 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 11010 | /* handlers for sub-ioctl */ |
Katya Nigam | c2f29dc | 2014-01-20 19:29:30 +0530 | [diff] [blame] | 11011 | { WE_MTRACE_SELECTIVE_MODULE_LOG_ENABLE_CMD, |
| 11012 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11013 | 0, |
| 11014 | "setdumplog" }, |
| 11015 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 11016 | { WE_MTRACE_DUMP_CMD, |
| 11017 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11018 | 0, |
| 11019 | "dumplog" }, |
| 11020 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11021 | /* handlers for sub ioctl */ |
| 11022 | { |
| 11023 | WE_MCC_CONFIG_CREDENTIAL, |
| 11024 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11025 | 0, |
| 11026 | "setMccCrdnl" }, |
| 11027 | |
| 11028 | /* handlers for sub ioctl */ |
| 11029 | { |
| 11030 | WE_MCC_CONFIG_PARAMS, |
| 11031 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11032 | 0, |
| 11033 | "setMccConfig" }, |
| 11034 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 11035 | #ifdef FEATURE_WLAN_TDLS |
| 11036 | /* handlers for sub ioctl */ |
| 11037 | { |
| 11038 | WE_TDLS_CONFIG_PARAMS, |
| 11039 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11040 | 0, |
| 11041 | "setTdlsConfig" }, |
| 11042 | #endif |
| 11043 | |
Katya Nigam | f0511f6 | 2015-05-05 16:40:57 +0530 | [diff] [blame] | 11044 | { |
| 11045 | WE_CONFIGURE_MONITOR_MODE, |
| 11046 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11047 | 0, |
| 11048 | "MonitorModeConf" }, |
| 11049 | |
| 11050 | { |
| 11051 | WE_SET_MONITOR_MODE_FILTER, |
| 11052 | IW_PRIV_TYPE_INT | MAX_VAR_ARGS, |
| 11053 | 0, |
| 11054 | "MonitorFilter" }, |
| 11055 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11056 | /* handlers for main ioctl */ |
| 11057 | { WLAN_PRIV_ADD_TSPEC, |
| 11058 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | HDD_WLAN_WMM_PARAM_COUNT, |
| 11059 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11060 | "addTspec" }, |
| 11061 | |
| 11062 | /* handlers for main ioctl */ |
| 11063 | { WLAN_PRIV_DEL_TSPEC, |
| 11064 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11065 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11066 | "delTspec" }, |
| 11067 | |
| 11068 | /* handlers for main ioctl */ |
| 11069 | { WLAN_PRIV_GET_TSPEC, |
| 11070 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11071 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
| 11072 | "getTspec" }, |
Manjeet Singh | 3ed7924 | 2017-01-11 19:04:32 +0530 | [diff] [blame] | 11073 | /* handlers for main ioctl */ |
| 11074 | { WLAN_PRIV_SET_NONE_GET_THREE_INT, |
| 11075 | 0, |
| 11076 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11077 | "" }, |
| 11078 | #ifdef WLAN_FEATURE_TSF |
| 11079 | { WE_GET_TSF, |
| 11080 | 0, |
| 11081 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, |
| 11082 | "get_tsf" }, |
| 11083 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11084 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 11085 | /* handlers for main ioctl - OEM DATA */ |
| 11086 | { |
| 11087 | WLAN_PRIV_SET_OEM_DATA_REQ, |
| 11088 | IW_PRIV_TYPE_BYTE | sizeof(struct iw_oem_data_req) | IW_PRIV_SIZE_FIXED, |
| 11089 | 0, |
| 11090 | "set_oem_data_req" }, |
| 11091 | |
| 11092 | /* handlers for main ioctl - OEM DATA */ |
| 11093 | { |
| 11094 | WLAN_PRIV_GET_OEM_DATA_RSP, |
| 11095 | 0, |
| 11096 | IW_PRIV_TYPE_BYTE | MAX_OEM_DATA_RSP_LEN, |
| 11097 | "get_oem_data_rsp" }, |
| 11098 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11099 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11100 | /* handlers for main ioctl - host offload */ |
| 11101 | { |
| 11102 | WLAN_PRIV_SET_HOST_OFFLOAD, |
| 11103 | IW_PRIV_TYPE_BYTE | sizeof(tHostOffloadRequest), |
| 11104 | 0, |
| 11105 | "setHostOffload" }, |
| 11106 | |
| 11107 | { |
| 11108 | WLAN_GET_WLAN_STATISTICS, |
| 11109 | 0, |
| 11110 | IW_PRIV_TYPE_BYTE | WE_MAX_STR_LEN, |
| 11111 | "getWlanStats" }, |
| 11112 | |
| 11113 | { |
| 11114 | WLAN_SET_KEEPALIVE_PARAMS, |
Mahesh A Saptasagar | f18c62b | 2016-02-10 16:03:48 +0530 | [diff] [blame] | 11115 | IW_PRIV_TYPE_BYTE | sizeof(tKeepAliveRequest) | |
| 11116 | IW_PRIV_SIZE_FIXED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11117 | 0, |
| 11118 | "setKeepAlive" }, |
| 11119 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 11120 | { |
| 11121 | WLAN_SET_PACKET_FILTER_PARAMS, |
| 11122 | IW_PRIV_TYPE_BYTE | sizeof(tPacketFilterCfg), |
| 11123 | 0, |
| 11124 | "setPktFilter" }, |
| 11125 | #endif |
| 11126 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 11127 | { |
| 11128 | WLAN_SET_PNO, |
| 11129 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 11130 | 0, |
| 11131 | "setpno" }, |
| 11132 | #endif |
| 11133 | { |
| 11134 | WLAN_SET_BAND_CONFIG, |
Atul Mittal | 54378cb | 2014-04-02 16:51:50 +0530 | [diff] [blame] | 11135 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11136 | 0, |
| 11137 | "SETBAND" }, |
| 11138 | /* handlers for dynamic MC BC ioctl */ |
| 11139 | { |
| 11140 | WLAN_PRIV_SET_MCBC_FILTER, |
Amar Singhal | f3a6e76 | 2013-02-19 15:06:50 -0800 | [diff] [blame] | 11141 | IW_PRIV_TYPE_BYTE | sizeof(tRcvFltMcAddrList), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11142 | 0, |
| 11143 | "setMCBCFilter" }, |
| 11144 | { |
| 11145 | WLAN_PRIV_CLEAR_MCBC_FILTER, |
| 11146 | 0, |
| 11147 | 0, |
| 11148 | "clearMCBCFilter" }, |
| 11149 | { |
| 11150 | WLAN_SET_POWER_PARAMS, |
| 11151 | IW_PRIV_TYPE_CHAR| WE_MAX_STR_LEN, |
| 11152 | 0, |
| 11153 | "setpowerparams" }, |
| 11154 | { |
| 11155 | WLAN_GET_LINK_SPEED, |
| 11156 | IW_PRIV_TYPE_CHAR | 18, |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 11157 | IW_PRIV_TYPE_CHAR | 5, "getLinkSpeed" }, |
Nishank Aggarwal | 87a3688 | 2017-07-11 15:28:27 +0530 | [diff] [blame] | 11158 | { |
| 11159 | WLAN_PRIV_SET_FTIES, |
| 11160 | IW_PRIV_TYPE_CHAR | MAX_FTIE_SIZE, |
| 11161 | 0, "set_ft_ies"}, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11162 | }; |
| 11163 | |
| 11164 | |
| 11165 | |
| 11166 | const struct iw_handler_def we_handler_def = { |
| 11167 | .num_standard = sizeof(we_handler) / sizeof(we_handler[0]), |
| 11168 | .num_private = sizeof(we_private) / sizeof(we_private[0]), |
| 11169 | .num_private_args = sizeof(we_private_args) / sizeof(we_private_args[0]), |
| 11170 | |
| 11171 | .standard = (iw_handler *)we_handler, |
| 11172 | .private = (iw_handler *)we_private, |
| 11173 | .private_args = we_private_args, |
| 11174 | .get_wireless_stats = get_wireless_stats, |
| 11175 | }; |
| 11176 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 11177 | const struct iw_handler_def we_mon_handler_def = { |
| 11178 | .num_standard = 0, |
| 11179 | .num_private = sizeof(we_mon_private) / sizeof(we_mon_private[0]), |
| 11180 | .num_private_args = |
| 11181 | sizeof(we_mon_private_args) / sizeof(we_mon_private_args[0]), |
| 11182 | .standard = NULL, |
| 11183 | .private = (iw_handler *)we_mon_private, |
| 11184 | .private_args = we_mon_private_args, |
| 11185 | .get_wireless_stats = NULL, |
| 11186 | }; |
| 11187 | |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11188 | 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) |
| 11189 | { |
| 11190 | v_U32_t cmd = 288; //Command to RIVA |
| 11191 | hdd_context_t *pHddCtx = NULL; |
| 11192 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 11193 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11194 | /* |
| 11195 | *configMccParam : specify the bit which needs to be modified |
| 11196 | *allowed to update based on wlan_qcom_cfg.ini |
| 11197 | * configuration |
| 11198 | * Bit 0 : SCHEDULE_TIME_SLICE MIN : 5 MAX : 20 |
| 11199 | * Bit 1 : MAX_NULL_SEND_TIME MIN : 1 MAX : 10 |
| 11200 | * Bit 2 : TX_EARLY_STOP_TIME MIN : 1 MAX : 10 |
| 11201 | * Bit 3 : RX_DRAIN_TIME MIN : 1 MAX : 10 |
| 11202 | * Bit 4 : CHANNEL_SWITCH_TIME MIN : 1 MAX : 20 |
| 11203 | * Bit 5 : MIN_CHANNEL_TIME MIN : 5 MAX : 20 |
| 11204 | * Bit 6 : PARK_BEFORE_TBTT MIN : 1 MAX : 5 |
| 11205 | * Bit 7 : MIN_AFTER_DTIM MIN : 5 MAX : 15 |
| 11206 | * Bit 8 : TOO_CLOSE_MARGIN MIN : 1 MAX : 3 |
| 11207 | * Bit 9 : Reserved |
| 11208 | */ |
| 11209 | switch (arg1) |
| 11210 | { |
| 11211 | //Update MCC SCHEDULE_TIME_SLICE parameter |
| 11212 | case MCC_SCHEDULE_TIME_SLICE_CFG_PARAM : |
| 11213 | if( pHddCtx->cfg_ini->configMccParam & 0x0001) |
| 11214 | { |
| 11215 | if((arg2 >= 5) && (arg2 <= 20)) |
| 11216 | { |
| 11217 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 11218 | } |
| 11219 | else |
| 11220 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11221 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11222 | return 0; |
| 11223 | } |
| 11224 | } |
| 11225 | break; |
| 11226 | |
| 11227 | //Update MCC MAX_NULL_SEND_TIME parameter |
| 11228 | case MCC_MAX_NULL_SEND_TIME_CFG_PARAM : |
| 11229 | if( pHddCtx->cfg_ini->configMccParam & 0x0002) |
| 11230 | { |
| 11231 | if((arg2 >= 1) && (arg2 <= 10)) |
| 11232 | { |
| 11233 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 11234 | } |
| 11235 | else |
| 11236 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11237 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11238 | return 0; |
| 11239 | } |
| 11240 | } |
| 11241 | break; |
| 11242 | |
| 11243 | //Update MCC TX_EARLY_STOP_TIME parameter |
| 11244 | case MCC_TX_EARLY_STOP_TIME_CFG_PARAM : |
| 11245 | if( pHddCtx->cfg_ini->configMccParam & 0x0004) |
| 11246 | { |
| 11247 | if((arg2 >= 1) && (arg2 <= 10)) |
| 11248 | { |
| 11249 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 11250 | } |
| 11251 | else |
| 11252 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11253 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11254 | return 0; |
| 11255 | } |
| 11256 | } |
| 11257 | break; |
| 11258 | |
| 11259 | //Update MCC RX_DRAIN_TIME parameter |
| 11260 | case MCC_RX_DRAIN_TIME_CFG_PARAM : |
| 11261 | if( pHddCtx->cfg_ini->configMccParam & 0x0008) |
| 11262 | { |
| 11263 | if((arg2 >= 1) && (arg2 <= 10)) |
| 11264 | { |
| 11265 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 11266 | } |
| 11267 | else |
| 11268 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11269 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11270 | return 0; |
| 11271 | } |
| 11272 | } |
| 11273 | break; |
| 11274 | |
| 11275 | //Update MCC CHANNEL_SWITCH_TIME parameter |
| 11276 | case MCC_CHANNEL_SWITCH_TIME_CFG_PARAM : |
| 11277 | if( pHddCtx->cfg_ini->configMccParam & 0x0010) |
| 11278 | { |
| 11279 | if((arg2 >= 1) && (arg2 <= 20)) |
| 11280 | { |
| 11281 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 11282 | } |
| 11283 | else |
| 11284 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11285 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11286 | return 0; |
| 11287 | } |
| 11288 | } |
| 11289 | break; |
| 11290 | |
| 11291 | //Update MCC MIN_CHANNEL_TIME parameter |
| 11292 | case MCC_MIN_CHANNEL_TIME_CFG_PARAM : |
| 11293 | if( pHddCtx->cfg_ini->configMccParam & 0x0020) |
| 11294 | { |
| 11295 | if((arg2 >= 5) && (arg2 <= 20)) |
| 11296 | { |
| 11297 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 11298 | } |
| 11299 | else |
| 11300 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11301 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11302 | return 0; |
| 11303 | } |
| 11304 | } |
| 11305 | break; |
| 11306 | |
| 11307 | //Update MCC PARK_BEFORE_TBTT parameter |
| 11308 | case MCC_PARK_BEFORE_TBTT_CFG_PARAM : |
| 11309 | if( pHddCtx->cfg_ini->configMccParam & 0x0040) |
| 11310 | { |
| 11311 | if((arg2 >= 1) && (arg2 <= 5)) |
| 11312 | { |
| 11313 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 11314 | } |
| 11315 | else |
| 11316 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11317 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11318 | return 0; |
| 11319 | } |
| 11320 | } |
| 11321 | break; |
| 11322 | |
| 11323 | //Update MCC MIN_AFTER_DTIM parameter |
| 11324 | case MCC_MIN_AFTER_DTIM_CFG_PARAM : |
| 11325 | if( pHddCtx->cfg_ini->configMccParam & 0x0080) |
| 11326 | { |
| 11327 | if((arg2 >= 5) && (arg2 <= 15)) |
| 11328 | { |
| 11329 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 11330 | } |
| 11331 | else |
| 11332 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11333 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11334 | return 0; |
| 11335 | } |
| 11336 | } |
| 11337 | break; |
| 11338 | |
| 11339 | //Update MCC TOO_CLOSE_MARGIN parameter |
| 11340 | case MCC_TOO_CLOSE_MARGIN_CFG_PARAM : |
| 11341 | if( pHddCtx->cfg_ini->configMccParam & 0x0100) |
| 11342 | { |
| 11343 | if((arg2 >= 1) && (arg2 <= 3)) |
| 11344 | { |
| 11345 | logPrintf(hHal, cmd, staId, arg1, arg2, arg3); |
| 11346 | } |
| 11347 | else |
| 11348 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11349 | hddLog(LOGE, "%s : Enter a valid MCC configuration value",__FUNCTION__); |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11350 | return 0; |
| 11351 | } |
| 11352 | } |
| 11353 | break; |
| 11354 | |
| 11355 | default : |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11356 | hddLog(LOGE, "%s : Uknown / Not allowed to configure parameter : %d", |
Madan Mohan Koyyalamudi | d5f04ca | 2012-11-06 15:51:26 -0800 | [diff] [blame] | 11357 | __FUNCTION__,arg1); |
| 11358 | break; |
| 11359 | } |
| 11360 | return 0; |
| 11361 | } |
| 11362 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11363 | int hdd_set_wext(hdd_adapter_t *pAdapter) |
| 11364 | { |
| 11365 | hdd_wext_state_t *pwextBuf; |
| 11366 | 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] | 11367 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11368 | |
| 11369 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11370 | |
| 11371 | // Now configure the roaming profile links. To SSID and bssid. |
| 11372 | pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0; |
| 11373 | pwextBuf->roamProfile.SSIDs.SSIDList = &pHddStaCtx->conn_info.SSID; |
| 11374 | |
| 11375 | pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0; |
| 11376 | pwextBuf->roamProfile.BSSIDs.bssid = &pHddStaCtx->conn_info.bssId; |
| 11377 | |
| 11378 | /*Set the numOfChannels to zero to scan all the channels*/ |
| 11379 | pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0; |
| 11380 | pwextBuf->roamProfile.ChannelInfo.ChannelList = NULL; |
| 11381 | |
| 11382 | /* Default is no encryption */ |
| 11383 | pwextBuf->roamProfile.EncryptionType.numEntries = 1; |
| 11384 | pwextBuf->roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 11385 | |
| 11386 | pwextBuf->roamProfile.mcEncryptionType.numEntries = 1; |
| 11387 | pwextBuf->roamProfile.mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 11388 | |
| 11389 | pwextBuf->roamProfile.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 11390 | |
| 11391 | /* Default is no authentication */ |
| 11392 | pwextBuf->roamProfile.AuthType.numEntries = 1; |
| 11393 | pwextBuf->roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 11394 | |
| 11395 | pwextBuf->roamProfile.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 11396 | pwextBuf->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 11397 | |
| 11398 | /*Set the default scan mode*/ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 11399 | pHddCtx->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11400 | |
| 11401 | hdd_clearRoamProfileIe(pAdapter); |
| 11402 | |
| 11403 | return VOS_STATUS_SUCCESS; |
| 11404 | |
| 11405 | } |
| 11406 | |
| 11407 | int hdd_register_wext(struct net_device *dev) |
| 11408 | { |
| 11409 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 11410 | hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11411 | VOS_STATUS status; |
| 11412 | |
| 11413 | ENTER(); |
| 11414 | |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame] | 11415 | if (pAdapter->device_mode == WLAN_HDD_MONITOR && |
| 11416 | hdd_get_conparam() != VOS_MONITOR_MODE) { |
| 11417 | // Register as a wireless device |
| 11418 | dev->wireless_handlers = (struct iw_handler_def *)&we_mon_handler_def; |
| 11419 | return 0; |
| 11420 | } |
| 11421 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11422 | // Zero the memory. This zeros the profile structure. |
| 11423 | memset(pwextBuf, 0,sizeof(hdd_wext_state_t)); |
| 11424 | |
| 11425 | init_completion(&(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->completion_var); |
| 11426 | |
| 11427 | |
| 11428 | status = hdd_set_wext(pAdapter); |
| 11429 | |
| 11430 | if(!VOS_IS_STATUS_SUCCESS(status)) { |
| 11431 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11432 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: hdd_set_wext failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11433 | return eHAL_STATUS_FAILURE; |
| 11434 | } |
| 11435 | |
| 11436 | if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->vosevent))) |
| 11437 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11438 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD vos event init failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11439 | return eHAL_STATUS_FAILURE; |
| 11440 | } |
| 11441 | |
| 11442 | if (!VOS_IS_STATUS_SUCCESS(vos_event_init(&pwextBuf->scanevent))) |
| 11443 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11444 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("ERROR: HDD scan event init failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11445 | return eHAL_STATUS_FAILURE; |
| 11446 | } |
| 11447 | |
| 11448 | // Register as a wireless device |
| 11449 | dev->wireless_handlers = (struct iw_handler_def *)&we_handler_def; |
| 11450 | |
| 11451 | EXIT(); |
| 11452 | return 0; |
| 11453 | } |
| 11454 | |
| 11455 | int hdd_UnregisterWext(struct net_device *dev) |
| 11456 | { |
Jeff Johnson | c135a9a | 2017-09-19 08:37:24 -0700 | [diff] [blame] | 11457 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"In %s %pK", __func__, dev); |
c_hpothu | 2a13bc3 | 2015-01-21 12:48:54 +0530 | [diff] [blame] | 11458 | if (dev != NULL) |
| 11459 | { |
| 11460 | rtnl_lock(); |
| 11461 | dev->wireless_handlers = NULL; |
| 11462 | rtnl_unlock(); |
| 11463 | } |
c_hpothu | 5f0b6eb | 2014-09-15 13:36:50 +0530 | [diff] [blame] | 11464 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11465 | return 0; |
| 11466 | } |
| 11467 | |
| 11468 | |